Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run test:unit
yarn run lint
yarn lint-staged
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ npm install -g @internxt/cli
$ internxt COMMAND
running command...
$ internxt (--version)
@internxt/cli/1.3.0 darwin-arm64 node-v20.14.0
@internxt/cli/1.3.3 darwin-arm64 node-v20.14.0
$ internxt --help [COMMAND]
USAGE
$ internxt COMMAND
Expand Down Expand Up @@ -79,7 +79,7 @@ EXAMPLES
$ internxt add-cert
```

_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/add-cert.ts)_
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/add-cert.ts)_

## `internxt config`

Expand Down Expand Up @@ -108,7 +108,7 @@ EXAMPLES
$ internxt config
```

_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/config.ts)_
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/config.ts)_

## `internxt create-folder`

Expand All @@ -129,7 +129,7 @@ EXAMPLES
$ internxt create-folder
```

_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/create-folder.ts)_
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/create-folder.ts)_

## `internxt download`

Expand All @@ -152,7 +152,7 @@ EXAMPLES
$ internxt download
```

_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/download.ts)_
_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/download.ts)_

## `internxt list`

Expand Down Expand Up @@ -186,7 +186,7 @@ EXAMPLES
$ internxt list
```

_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/list.ts)_
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/list.ts)_

## `internxt login`

Expand All @@ -212,7 +212,7 @@ EXAMPLES
$ internxt login
```

_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/login.ts)_
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/login.ts)_

## `internxt logout`

Expand All @@ -229,7 +229,7 @@ EXAMPLES
$ internxt logout
```

_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/logout.ts)_
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/logout.ts)_

## `internxt logs`

Expand All @@ -246,7 +246,7 @@ EXAMPLES
$ internxt logs
```

_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/logs.ts)_
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/logs.ts)_

## `internxt move`

Expand All @@ -271,7 +271,7 @@ EXAMPLES
$ internxt move
```

_See code: [src/commands/move.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/move.ts)_
_See code: [src/commands/move.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/move.ts)_

## `internxt rename`

Expand All @@ -296,7 +296,7 @@ EXAMPLES
$ internxt rename
```

_See code: [src/commands/rename.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/rename.ts)_
_See code: [src/commands/rename.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/rename.ts)_

## `internxt trash`

Expand All @@ -320,7 +320,7 @@ EXAMPLES
$ internxt trash
```

_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash.ts)_
_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/trash.ts)_

## `internxt trash-clear`

Expand All @@ -347,7 +347,7 @@ EXAMPLES
$ internxt trash-clear
```

_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-clear.ts)_
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/trash-clear.ts)_

## `internxt trash-list`

Expand Down Expand Up @@ -383,7 +383,7 @@ EXAMPLES
$ internxt trash-list
```

_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-list.ts)_
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/trash-list.ts)_

## `internxt trash-restore`

Expand Down Expand Up @@ -411,7 +411,7 @@ EXAMPLES
$ internxt trash-restore
```

_See code: [src/commands/trash-restore.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-restore.ts)_
_See code: [src/commands/trash-restore.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/trash-restore.ts)_

## `internxt trash clear`

Expand Down Expand Up @@ -520,7 +520,7 @@ EXAMPLES
$ internxt upload
```

_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/upload.ts)_
_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/upload.ts)_

## `internxt webdav ACTION`

Expand All @@ -543,7 +543,7 @@ EXAMPLES
$ internxt webdav status
```

_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/webdav.ts)_
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/webdav.ts)_

## `internxt webdav-config ACTION`

Expand Down Expand Up @@ -571,7 +571,7 @@ EXAMPLES
$ internxt webdav-config change-port
```

_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/webdav-config.ts)_
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/webdav-config.ts)_

## `internxt whoami`

Expand All @@ -588,7 +588,7 @@ EXAMPLES
$ internxt whoami
```

_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/whoami.ts)_
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/whoami.ts)_
<!-- commandsstop -->

# Current Limitations
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
{
"author": "Internxt <[email protected]>",
"version": "1.3.0",
"version": "1.3.3",
"description": "Internxt CLI to manage your encrypted storage",
"scripts": {
"build": "tsc",
"lint": "eslint . --ext .ts",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn build && oclif manifest && oclif readme",
"prepare": "husky",
"prepare": "husky || true",
"test:unit": "nyc --reporter=lcov --reporter=text mocha \"test/**/*.test.ts\" --exit",
"dev:webdav": "nodemon -e ts --exec ts-node src/webdav/index.ts",
"version": "oclif readme && git add README.md",
"pack:win": "oclif pack win",
"migrate": "sequelize db:migrate",
"migrate:undo": "sequelize db:migrate:undo",
"publish:npm": "npm run build && npm publish --scope=@internxt --registry=https://registry.npmjs.org/ --access public",
"publish:github": "npm publish",
"publish:github": "npm publish --scope=@internxt --registry=https://npm.pkg.github.com",
"postinstall": "node ./scripts/skip-in-ci.js || internxt webdav restart"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"homepage": "https://github.com/internxt/cli",
"license": "MIT",
"main": "",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class Config extends Command {
const configList = [
{ key: 'Email', value: userCredentials.user.email },
{ key: 'Root folder ID', value: userCredentials.root_folder_uuid },
{ key: 'Used space', value: FormatUtils.humanFileSize(await UsageService.instance.fetchTotalUsage()) },
{ key: 'Used space', value: FormatUtils.humanFileSize((await UsageService.instance.fetchUsage()).total) },
{ key: 'Available space', value: FormatUtils.formatLimit(await UsageService.instance.fetchSpaceLimit()) },
];
ux.table(
Expand Down
11 changes: 1 addition & 10 deletions src/services/sdk-manager.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Auth, Drive, photos, Network as NetworkModule } from '@internxt/sdk';
import { Auth, Drive, Network as NetworkModule } from '@internxt/sdk';
import { Trash } from '@internxt/sdk/dist/drive';
import { ApiSecurity, AppDetails } from '@internxt/sdk/dist/shared';
import { ConfigService } from './config.service';
Expand Down Expand Up @@ -135,15 +135,6 @@ export class SdkManager {
});
}

/** Photos SDK */
getPhotos() {
const PHOTOS_API_URL = ConfigService.instance.get('PHOTOS_API_URL');

const newToken = SdkManager.getApiSecurity().newToken;

return new photos.Photos(PHOTOS_API_URL, newToken);
}

/** Share SDK */
getShare() {
const DRIVE_NEW_API_URL = ConfigService.instance.get('DRIVE_NEW_API_URL');
Expand Down
12 changes: 4 additions & 8 deletions src/services/usage.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { UsageResponse } from '@internxt/sdk/dist/drive/storage/types';
import { SdkManager } from './sdk-manager.service';

export class UsageService {
public static readonly instance: UsageService = new UsageService();
public static readonly INFINITE_LIMIT = 99 * Math.pow(1024, 4);

public fetchTotalUsage = async (): Promise<number> => {
public fetchUsage = async (): Promise<UsageResponse> => {
const storageClient = SdkManager.instance.getStorage();
const photosClient = SdkManager.instance.getPhotos();
const driveUsage = await storageClient.spaceUsage();

const [driveUsage, { usage: photosUsage }] = await Promise.all([
storageClient.spaceUsage(),
photosClient.photos.getUsage(),
]);

return driveUsage.total + photosUsage;
return driveUsage;
};

public fetchSpaceLimit = async (): Promise<number> => {
Expand Down
Loading