Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DRIVE_URL=https://drive.internxt.com
DRIVE_API_URL=https://drive.internxt.com/api
DRIVE_NEW_API_URL=https://api.internxt.com/drive
PAYMENTS_API_URL=https://api.internxt.com/payments
NETWORK_URL=https://api.internxt.com
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/commands-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ on:
push:
workflow_dispatch:

permissions:
contents: read
pull-requests: read

jobs:

commands-unit-tests:
strategy:
matrix:
Expand All @@ -14,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.1
node-version: '22.x'
cache: yarn
# Generate a .npmrc file with the NPM_TOKEN
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '22.x'

- run: |
echo "@internxt:registry=https://npm.pkg.github.com/" > .npmrc
Expand All @@ -24,7 +24,6 @@ jobs:
- name: Add .env
run: |
echo "DRIVE_URL=https://drive.internxt.com" >> .env
echo "DRIVE_API_URL=https://drive.internxt.com/api" >> .env
echo "DRIVE_NEW_API_URL=https://api.internxt.com/drive" >> .env
echo "PAYMENTS_API_URL=https://api.internxt.com/payments" >> .env
echo "NETWORK_URL=https://api.internxt.com" >> .env
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-node@v4
with:
node-version: 20.12.1
node-version: '22.x'
cache: yarn
# Generate a .npmrc file with the NPM_TOKEN
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A CLI tool to interact with your Internxt encrypted files

You can install the Internxt CLI by using NPM:

Requires Node >= 20.12.1
Requires Node >= 22.12.0

`npm i -g @internxt/cli`

Expand Down
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"/oclif.manifest.json"
],
"dependencies": {
"@inquirer/prompts": "7.5.0",
"@internxt/inxt-js": "2.1.0",
"@internxt/lib": "1.2.1",
"@internxt/sdk": "1.7.0",
"@oclif/core": "4.3.0",
"@types/validator": "13.15.0",
"@inquirer/prompts": "7.5.3",
"@internxt/inxt-js": "2.2.1",
"@internxt/lib": "1.3.1",
"@internxt/sdk": "1.10.0",
"@oclif/core": "4.4.0",
"@types/validator": "13.15.2",
"async": "3.2.6",
"axios": "1.9.0",
"axios": "1.10.0",
"bip39": "3.1.0",
"body-parser": "2.2.0",
"cli-progress": "3.12.0",
Expand All @@ -51,45 +51,45 @@
"express": "5.1.0",
"express-async-handler": "1.2.0",
"express-basic-auth": "1.2.1",
"fast-xml-parser": "5.2.2",
"fast-xml-parser": "5.2.5",
"mime-types": "3.0.1",
"openpgp": "5.11.2",
"pm2": "6.0.5",
"openpgp": "5.11.3",
"pm2": "6.0.8",
"range-parser": "1.2.1",
"reflect-metadata": "0.2.2",
"selfsigned": "2.4.1",
"sharp": "0.34.1",
"sharp": "0.34.2",
"tty-table": "4.2.3",
"winston": "3.17.0"
},
"devDependencies": {
"@internxt/eslint-config-internxt": "2.0.0",
"@internxt/prettier-config": "internxt/prettier-config#v1.0.2",
"@oclif/test": "4.1.12",
"@oclif/test": "4.1.13",
"@openpgp/web-stream-tools": "0.0.11-patch-1",
"@types/async": "3.2.24",
"@types/cli-progress": "3.11.6",
"@types/express": "5.0.1",
"@types/mime-types": "2.1.4",
"@types/node": "22.15.16",
"@types/express": "5.0.3",
"@types/mime-types": "3.0.1",
"@types/node": "22.15.33",
"@types/range-parser": "1.2.7",
"@vitest/coverage-istanbul": "3.1.3",
"@vitest/spy": "3.1.3",
"eslint": "9.26.0",
"@vitest/coverage-istanbul": "3.2.4",
"@vitest/spy": "3.2.4",
"eslint": "9.29.0",
"husky": "9.1.7",
"lint-staged": "15.5.2",
"nock": "14.0.4",
"lint-staged": "16.1.2",
"nock": "14.0.5",
"nodemon": "3.1.10",
"oclif": "4.17.46",
"prettier": "3.5.3",
"oclif": "4.20.1",
"prettier": "3.6.1",
"rimraf": "6.0.1",
"ts-node": "10.9.2",
"typescript": "5.8.3",
"vitest": "3.1.3",
"vitest": "3.2.4",
"vitest-mock-express": "2.2.0"
},
"engines": {
"node": ">=20.12.1"
"node": ">=22.12.0"
},
"bin": {
"internxt": "./bin/run.js"
Expand Down
2 changes: 1 addition & 1 deletion src/commands/delete-permanently-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class DeletePermanentlyFile extends Command {
throw new Error('File not found');
}

await TrashService.instance.deleteFile({ fileId: driveFile.id, folderId: driveFile.folderId });
await TrashService.instance.deleteFile(driveFile.uuid);
const message = 'File permanently deleted successfully';
CLIUtils.success(this.log.bind(this), message);
return { success: true, message };
Expand Down
2 changes: 1 addition & 1 deletion src/commands/delete-permanently-folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class DeletePermanentlyFolder extends Command {
throw new Error('Folder not found');
}

await TrashService.instance.deleteFolder(driveFolder.id);
await TrashService.instance.deleteFolder(driveFolder.uuid);
const message = 'Folder permanently deleted successfully';
CLIUtils.success(this.log.bind(this), message);
return { success: true, message };
Expand Down
2 changes: 1 addition & 1 deletion src/commands/upload-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default class UploadFile extends Command {
thumbnailBuffer,
fileType,
user.bucket,
createdDriveFile.id,
createdDriveFile.uuid,
networkFacade,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class AuthService {
token: oldCreds.token,
newToken: oldCreds.newToken,
});
const usersClient = SdkManager.instance.getUsers(true);
const usersClient = SdkManager.instance.getUsers();
const newCreds = await usersClient.getUserData({ userUuid: oldCreds.user.uuid });

const loginCreds = {
Expand Down
2 changes: 1 addition & 1 deletion src/services/crypto.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class CryptoService {
public static readonly instance: CryptoService = new CryptoService();

public static readonly cryptoProvider: CryptoProvider = {
async encryptPasswordHash(password: Password, encryptedSalt: string): Promise<string> {
encryptPasswordHash(password: Password, encryptedSalt: string): string {
const salt = CryptoService.instance.decryptText(encryptedSalt);
const hashObj = CryptoService.instance.passToHash({ password, salt });
return CryptoService.instance.encryptText(hashObj.hash);
Expand Down
16 changes: 8 additions & 8 deletions src/services/drive/drive-file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class DriveFileService {
static readonly instance = new DriveFileService();

public createFile = async (payload: StorageTypes.FileEntryByUuid): Promise<DriveFileItem> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
const driveFile = await storageClient.createFileEntryByUuid(payload);

return {
Expand All @@ -28,7 +28,7 @@ export class DriveFileService {
};

public getFileMetadata = async (uuid: string): Promise<DriveFileItem> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();

const [getFileMetadata] = storageClient.getFile(uuid);

Expand All @@ -37,23 +37,23 @@ export class DriveFileService {
};

public moveFile = (payload: StorageTypes.MoveFileUuidPayload): Promise<StorageTypes.FileMeta> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
return storageClient.moveFileByUuid(payload);
};

public renameFile = (fileUuid: string, payload: { plainName?: string; type?: string | null }): Promise<void> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
return storageClient.updateFileMetaByUUID(fileUuid, payload);
};

public getFileMetadataByPath = async (path: string): Promise<DriveFileItem> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
const fileMetadata = await storageClient.getFileByPath(encodeURIComponent(path));
return DriveUtils.driveFileMetaToItem(fileMetadata);
};

public createThumbnail = (payload: StorageTypes.ThumbnailEntry): Promise<StorageTypes.Thumbnail> => {
const storageClient = SdkManager.instance.getStorage(false);
return storageClient.createThumbnailEntry(payload);
public createThumbnail = (payload: StorageTypes.CreateThumbnailEntryPayload): Promise<StorageTypes.Thumbnail> => {
const storageClient = SdkManager.instance.getStorage();
return storageClient.createThumbnailEntryWithUUID(payload);
};
}
14 changes: 7 additions & 7 deletions src/services/drive/drive-folder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ export class DriveFolderService {
static readonly instance = new DriveFolderService();

public getFolderMetaByUuid = async (uuid: string): Promise<DriveFolderItem> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
const folderMeta = await storageClient.getFolderMeta(uuid);
return DriveUtils.driveFolderMetaToItem(folderMeta);
};

public getFolderMetaById = async (id: number): Promise<DriveFolderItem> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
const folderMeta = await storageClient.getFolderMetaById(id);
return DriveUtils.driveFolderMetaToItem(folderMeta);
};

public getFolderContent = async (folderUuid: string) => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
const folders = await this.getAllSubfolders(storageClient, folderUuid, 0);
const files = await this.getAllSubfiles(storageClient, folderUuid, 0);
return { folders, files };
Expand Down Expand Up @@ -58,7 +58,7 @@ export class DriveFolderService {
};

public moveFolder = (payload: StorageTypes.MoveFolderUuidPayload): Promise<StorageTypes.FolderMeta> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
return storageClient.moveFolderByUuid(payload);
};

Expand All @@ -73,17 +73,17 @@ export class DriveFolderService {
public createFolder(
payload: StorageTypes.CreateFolderByUuidPayload,
): [Promise<StorageTypes.CreateFolderResponse>, RequestCanceler] {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
return storageClient.createFolderByUuid(payload);
}

public renameFolder = (payload: { folderUuid: string; name: string }): Promise<void> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
return storageClient.updateFolderNameWithUUID(payload);
};

public getFolderMetadataByPath = async (path: string): Promise<DriveFolderItem> => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
const folderMeta = await storageClient.getFolderByPath(encodeURIComponent(path));
return DriveUtils.driveFolderMetaToItem({
...folderMeta,
Expand Down
14 changes: 7 additions & 7 deletions src/services/drive/trash.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ export class TrashService {
static readonly instance = new TrashService();

public trashItems = (payload: StorageTypes.AddItemsToTrashPayload) => {
const storageClient = SdkManager.instance.getStorage(true);
const storageClient = SdkManager.instance.getStorage();
return storageClient.addItemsToTrash(payload);
};

public deleteFile = (payload: StorageTypes.DeleteFilePayload) => {
const storageClient = SdkManager.instance.getStorage(false);
return storageClient.deleteFile(payload);
public deleteFile = (fileId: string) => {
const storageClient = SdkManager.instance.getStorage();
return storageClient.deleteFileByUuid(fileId);
};

public deleteFolder = (folderId: number) => {
const storageClient = SdkManager.instance.getStorage(false);
return storageClient.deleteFolder(folderId);
public deleteFolder = (folderId: string) => {
const storageClient = SdkManager.instance.getStorage();
return storageClient.deleteFolderByUuid(folderId);
};

public clearTrash = () => {
Expand Down
Loading
Loading