@internxt/cli 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/dist/commands/add-cert.d.ts +1 -1
- package/dist/commands/add-cert.js +23 -23
- package/dist/commands/config.js +8 -3
- package/dist/commands/create-folder.js +10 -5
- package/dist/commands/delete-permanently-file.js +8 -3
- package/dist/commands/delete-permanently-folder.js +8 -3
- package/dist/commands/download-file.js +21 -16
- package/dist/commands/list.js +8 -3
- package/dist/commands/login.js +8 -3
- package/dist/commands/logout.js +8 -3
- package/dist/commands/logs.js +8 -3
- package/dist/commands/move-file.js +8 -3
- package/dist/commands/move-folder.js +8 -3
- package/dist/commands/rename-file.js +8 -3
- package/dist/commands/rename-folder.js +8 -3
- package/dist/commands/trash-clear.js +8 -3
- package/dist/commands/trash-file.js +8 -3
- package/dist/commands/trash-folder.js +8 -3
- package/dist/commands/trash-list.js +8 -3
- package/dist/commands/trash-restore-file.js +8 -3
- package/dist/commands/trash-restore-folder.js +8 -3
- package/dist/commands/upload-file.js +15 -9
- package/dist/commands/webdav-config.js +8 -3
- package/dist/commands/webdav.js +22 -22
- package/dist/commands/whoami.js +8 -3
- package/dist/hooks/prerun/auth_check.js +13 -7
- package/dist/utils/cli.utils.d.ts +13 -4
- package/dist/utils/cli.utils.js +44 -10
- package/dist/utils/xml.utils.d.ts +1 -1
- package/dist/utils/xml.utils.js +3 -3
- package/dist/webdav/handlers/PROPFIND.handler.js +12 -1
- package/dist/webdav/middewares/auth.middleware.js +10 -2
- package/dist/webdav/middewares/errors.middleware.js +8 -13
- package/dist/webdav/webdav-server.d.ts +2 -1
- package/dist/webdav/webdav-server.js +6 -3
- package/oclif.manifest.json +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ $ npm install -g @internxt/cli
|
|
|
31
31
|
$ internxt COMMAND
|
|
32
32
|
running command...
|
|
33
33
|
$ internxt (--version)
|
|
34
|
-
@internxt/cli/1.5.
|
|
34
|
+
@internxt/cli/1.5.3 linux-x64 node-v20.19.1
|
|
35
35
|
$ internxt --help [COMMAND]
|
|
36
36
|
USAGE
|
|
37
37
|
$ internxt COMMAND
|
|
@@ -99,7 +99,7 @@ EXAMPLES
|
|
|
99
99
|
$ internxt add-cert
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
102
|
+
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/add-cert.ts)_
|
|
103
103
|
|
|
104
104
|
## `internxt config`
|
|
105
105
|
|
|
@@ -119,7 +119,7 @@ EXAMPLES
|
|
|
119
119
|
$ internxt config
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
122
|
+
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/config.ts)_
|
|
123
123
|
|
|
124
124
|
## `internxt create-folder`
|
|
125
125
|
|
|
@@ -148,7 +148,7 @@ EXAMPLES
|
|
|
148
148
|
$ internxt create-folder
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
151
|
+
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/create-folder.ts)_
|
|
152
152
|
|
|
153
153
|
## `internxt delete-permanently-file`
|
|
154
154
|
|
|
@@ -178,7 +178,7 @@ EXAMPLES
|
|
|
178
178
|
$ internxt delete-permanently-file
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
181
|
+
_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/delete-permanently-file.ts)_
|
|
182
182
|
|
|
183
183
|
## `internxt delete-permanently-folder`
|
|
184
184
|
|
|
@@ -208,7 +208,7 @@ EXAMPLES
|
|
|
208
208
|
$ internxt delete-permanently-folder
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
-
_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
211
|
+
_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/delete-permanently-folder.ts)_
|
|
212
212
|
|
|
213
213
|
## `internxt delete permanently file`
|
|
214
214
|
|
|
@@ -297,7 +297,7 @@ EXAMPLES
|
|
|
297
297
|
$ internxt download-file
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
300
|
+
_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/download-file.ts)_
|
|
301
301
|
|
|
302
302
|
## `internxt download file`
|
|
303
303
|
|
|
@@ -356,7 +356,7 @@ EXAMPLES
|
|
|
356
356
|
$ internxt list
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
359
|
+
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/list.ts)_
|
|
360
360
|
|
|
361
361
|
## `internxt login`
|
|
362
362
|
|
|
@@ -385,7 +385,7 @@ EXAMPLES
|
|
|
385
385
|
$ internxt login
|
|
386
386
|
```
|
|
387
387
|
|
|
388
|
-
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
388
|
+
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/login.ts)_
|
|
389
389
|
|
|
390
390
|
## `internxt logout`
|
|
391
391
|
|
|
@@ -405,7 +405,7 @@ EXAMPLES
|
|
|
405
405
|
$ internxt logout
|
|
406
406
|
```
|
|
407
407
|
|
|
408
|
-
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
408
|
+
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/logout.ts)_
|
|
409
409
|
|
|
410
410
|
## `internxt logs`
|
|
411
411
|
|
|
@@ -425,7 +425,7 @@ EXAMPLES
|
|
|
425
425
|
$ internxt logs
|
|
426
426
|
```
|
|
427
427
|
|
|
428
|
-
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
428
|
+
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/logs.ts)_
|
|
429
429
|
|
|
430
430
|
## `internxt move-file`
|
|
431
431
|
|
|
@@ -457,7 +457,7 @@ EXAMPLES
|
|
|
457
457
|
$ internxt move-file
|
|
458
458
|
```
|
|
459
459
|
|
|
460
|
-
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
460
|
+
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/move-file.ts)_
|
|
461
461
|
|
|
462
462
|
## `internxt move-folder`
|
|
463
463
|
|
|
@@ -489,7 +489,7 @@ EXAMPLES
|
|
|
489
489
|
$ internxt move-folder
|
|
490
490
|
```
|
|
491
491
|
|
|
492
|
-
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
492
|
+
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/move-folder.ts)_
|
|
493
493
|
|
|
494
494
|
## `internxt move file`
|
|
495
495
|
|
|
@@ -580,7 +580,7 @@ EXAMPLES
|
|
|
580
580
|
$ internxt rename-file
|
|
581
581
|
```
|
|
582
582
|
|
|
583
|
-
_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
583
|
+
_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/rename-file.ts)_
|
|
584
584
|
|
|
585
585
|
## `internxt rename-folder`
|
|
586
586
|
|
|
@@ -611,7 +611,7 @@ EXAMPLES
|
|
|
611
611
|
$ internxt rename-folder
|
|
612
612
|
```
|
|
613
613
|
|
|
614
|
-
_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
614
|
+
_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/rename-folder.ts)_
|
|
615
615
|
|
|
616
616
|
## `internxt rename file`
|
|
617
617
|
|
|
@@ -699,7 +699,7 @@ EXAMPLES
|
|
|
699
699
|
$ internxt trash-clear
|
|
700
700
|
```
|
|
701
701
|
|
|
702
|
-
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
702
|
+
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-clear.ts)_
|
|
703
703
|
|
|
704
704
|
## `internxt trash-file`
|
|
705
705
|
|
|
@@ -729,7 +729,7 @@ EXAMPLES
|
|
|
729
729
|
$ internxt trash-file
|
|
730
730
|
```
|
|
731
731
|
|
|
732
|
-
_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
732
|
+
_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-file.ts)_
|
|
733
733
|
|
|
734
734
|
## `internxt trash-folder`
|
|
735
735
|
|
|
@@ -759,7 +759,7 @@ EXAMPLES
|
|
|
759
759
|
$ internxt trash-folder
|
|
760
760
|
```
|
|
761
761
|
|
|
762
|
-
_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
762
|
+
_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-folder.ts)_
|
|
763
763
|
|
|
764
764
|
## `internxt trash-list`
|
|
765
765
|
|
|
@@ -785,7 +785,7 @@ EXAMPLES
|
|
|
785
785
|
$ internxt trash-list
|
|
786
786
|
```
|
|
787
787
|
|
|
788
|
-
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
788
|
+
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-list.ts)_
|
|
789
789
|
|
|
790
790
|
## `internxt trash-restore-file`
|
|
791
791
|
|
|
@@ -816,7 +816,7 @@ EXAMPLES
|
|
|
816
816
|
$ internxt trash-restore-file
|
|
817
817
|
```
|
|
818
818
|
|
|
819
|
-
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
819
|
+
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-restore-file.ts)_
|
|
820
820
|
|
|
821
821
|
## `internxt trash-restore-folder`
|
|
822
822
|
|
|
@@ -847,7 +847,7 @@ EXAMPLES
|
|
|
847
847
|
$ internxt trash-restore-folder
|
|
848
848
|
```
|
|
849
849
|
|
|
850
|
-
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
850
|
+
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-restore-folder.ts)_
|
|
851
851
|
|
|
852
852
|
## `internxt trash clear`
|
|
853
853
|
|
|
@@ -1044,7 +1044,7 @@ EXAMPLES
|
|
|
1044
1044
|
$ internxt upload-file
|
|
1045
1045
|
```
|
|
1046
1046
|
|
|
1047
|
-
_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1047
|
+
_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/upload-file.ts)_
|
|
1048
1048
|
|
|
1049
1049
|
## `internxt upload file`
|
|
1050
1050
|
|
|
@@ -1099,7 +1099,7 @@ EXAMPLES
|
|
|
1099
1099
|
$ internxt webdav status
|
|
1100
1100
|
```
|
|
1101
1101
|
|
|
1102
|
-
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1102
|
+
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/webdav.ts)_
|
|
1103
1103
|
|
|
1104
1104
|
## `internxt webdav-config`
|
|
1105
1105
|
|
|
@@ -1125,7 +1125,7 @@ EXAMPLES
|
|
|
1125
1125
|
$ internxt webdav-config
|
|
1126
1126
|
```
|
|
1127
1127
|
|
|
1128
|
-
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1128
|
+
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/webdav-config.ts)_
|
|
1129
1129
|
|
|
1130
1130
|
## `internxt whoami`
|
|
1131
1131
|
|
|
@@ -1145,7 +1145,7 @@ EXAMPLES
|
|
|
1145
1145
|
$ internxt whoami
|
|
1146
1146
|
```
|
|
1147
1147
|
|
|
1148
|
-
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1148
|
+
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/whoami.ts)_
|
|
1149
1149
|
<!-- commandsstop -->
|
|
1150
1150
|
|
|
1151
1151
|
# Current Limitations
|
|
@@ -9,7 +9,6 @@ const config_service_1 = require("../services/config.service");
|
|
|
9
9
|
const node_os_1 = __importDefault(require("node:os"));
|
|
10
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
12
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
13
12
|
class AddCert extends core_1.Command {
|
|
14
13
|
static args = {};
|
|
15
14
|
static description = 'Add a self-signed certificate to the trusted store for macOS, Linux, and Windows.';
|
|
@@ -18,32 +17,33 @@ class AddCert extends core_1.Command {
|
|
|
18
17
|
static flags = {};
|
|
19
18
|
static enableJsonFlag = true;
|
|
20
19
|
run = async () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
command = `powershell -ExecutionPolicy Bypass -File "${node_path_1.default.join(scriptBasePath, 'add-cert.ps1')}" -certPath "${certPath}"`;
|
|
28
|
-
}
|
|
29
|
-
else if (platform === 'darwin' || platform === 'linux') {
|
|
30
|
-
command = `bash "${node_path_1.default.join(scriptBasePath, 'add-cert.sh')}" "${certPath}"`;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
throw new Error(`Unsupported OS: ${platform}`);
|
|
34
|
-
}
|
|
35
|
-
await this.executeCommand(command);
|
|
36
|
-
const message = 'Certificate successfully added to the trusted store.';
|
|
37
|
-
cli_utils_1.CLIUtils.success(this.log.bind(this), message);
|
|
38
|
-
return { success: true, message };
|
|
20
|
+
const certPath = node_path_1.default.join(config_service_1.ConfigService.WEBDAV_SSL_CERTS_DIR, 'cert.crt');
|
|
21
|
+
const platform = node_os_1.default.platform();
|
|
22
|
+
const scriptBasePath = node_path_1.default.join(__dirname, '../../scripts');
|
|
23
|
+
let command = '';
|
|
24
|
+
if (platform === 'win32') {
|
|
25
|
+
command = `powershell -ExecutionPolicy Bypass -File "${node_path_1.default.join(scriptBasePath, 'add-cert.ps1')}" -certPath "${certPath}"`;
|
|
39
26
|
}
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
else if (platform === 'darwin' || platform === 'linux') {
|
|
28
|
+
command = `bash "${node_path_1.default.join(scriptBasePath, 'add-cert.sh')}" "${certPath}"`;
|
|
42
29
|
}
|
|
30
|
+
else {
|
|
31
|
+
throw new Error(`Unsupported OS: ${platform}`);
|
|
32
|
+
}
|
|
33
|
+
await this.executeCommand(command);
|
|
34
|
+
const message = 'Certificate successfully added to the trusted store.';
|
|
35
|
+
cli_utils_1.CLIUtils.success(this.log.bind(this), message);
|
|
36
|
+
return { success: true, message };
|
|
43
37
|
};
|
|
44
38
|
catch = async (error) => {
|
|
45
|
-
|
|
46
|
-
cli_utils_1.CLIUtils.
|
|
39
|
+
const { flags } = await this.parse(AddCert);
|
|
40
|
+
cli_utils_1.CLIUtils.catchError({
|
|
41
|
+
error,
|
|
42
|
+
command: this.id,
|
|
43
|
+
logReporter: this.log.bind(this),
|
|
44
|
+
errorReporter: this.error.bind(this),
|
|
45
|
+
jsonFlag: flags['json'],
|
|
46
|
+
});
|
|
47
47
|
this.exit(1);
|
|
48
48
|
};
|
|
49
49
|
executeCommand = (command) => {
|
package/dist/commands/config.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const config_service_1 = require("../services/config.service");
|
|
5
5
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
6
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
7
6
|
const usage_service_1 = require("../services/usage.service");
|
|
8
7
|
const format_utils_1 = require("../utils/format.utils");
|
|
9
8
|
class Config extends core_1.Command {
|
|
@@ -38,8 +37,14 @@ class Config extends core_1.Command {
|
|
|
38
37
|
}
|
|
39
38
|
};
|
|
40
39
|
catch = async (error) => {
|
|
41
|
-
|
|
42
|
-
cli_utils_1.CLIUtils.
|
|
40
|
+
const { flags } = await this.parse(Config);
|
|
41
|
+
cli_utils_1.CLIUtils.catchError({
|
|
42
|
+
error,
|
|
43
|
+
command: this.id,
|
|
44
|
+
logReporter: this.log.bind(this),
|
|
45
|
+
errorReporter: this.error.bind(this),
|
|
46
|
+
jsonFlag: flags['json'],
|
|
47
|
+
});
|
|
43
48
|
this.exit(1);
|
|
44
49
|
};
|
|
45
50
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
5
4
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
6
5
|
const drive_folder_service_1 = require("../services/drive/drive-folder.service");
|
|
7
6
|
const config_service_1 = require("../services/config.service");
|
|
@@ -38,7 +37,7 @@ class CreateFolder extends core_1.Command {
|
|
|
38
37
|
if (folderUuid.trim().length === 0) {
|
|
39
38
|
folderUuid = userCredentials.user.rootFolderId;
|
|
40
39
|
}
|
|
41
|
-
cli_utils_1.CLIUtils.doing('Creating folder...');
|
|
40
|
+
cli_utils_1.CLIUtils.doing('Creating folder...', flags['json']);
|
|
42
41
|
const [createNewFolder, requestCanceler] = drive_folder_service_1.DriveFolderService.instance.createFolder({
|
|
43
42
|
plainName: folderName,
|
|
44
43
|
parentFolderUuid: folderUuid,
|
|
@@ -48,14 +47,20 @@ class CreateFolder extends core_1.Command {
|
|
|
48
47
|
process.exit(1);
|
|
49
48
|
});
|
|
50
49
|
const newFolder = await createNewFolder;
|
|
51
|
-
cli_utils_1.CLIUtils.done();
|
|
50
|
+
cli_utils_1.CLIUtils.done(flags['json']);
|
|
52
51
|
const message = `Folder ${newFolder.plainName} created successfully, view it at ${config_service_1.ConfigService.instance.get('DRIVE_URL')}/folder/${newFolder.uuid}`;
|
|
53
52
|
cli_utils_1.CLIUtils.success(this.log.bind(this), message);
|
|
54
53
|
return { success: true, message, folder: newFolder };
|
|
55
54
|
};
|
|
56
55
|
catch = async (error) => {
|
|
57
|
-
|
|
58
|
-
cli_utils_1.CLIUtils.
|
|
56
|
+
const { flags } = await this.parse(CreateFolder);
|
|
57
|
+
cli_utils_1.CLIUtils.catchError({
|
|
58
|
+
error,
|
|
59
|
+
command: this.id,
|
|
60
|
+
logReporter: this.log.bind(this),
|
|
61
|
+
errorReporter: this.error.bind(this),
|
|
62
|
+
jsonFlag: flags['json'],
|
|
63
|
+
});
|
|
59
64
|
this.exit(1);
|
|
60
65
|
};
|
|
61
66
|
getFolderName = async (folderNameFlag, nonInteractive) => {
|
|
@@ -6,7 +6,6 @@ const cli_utils_1 = require("../utils/cli.utils");
|
|
|
6
6
|
const command_types_1 = require("../types/command.types");
|
|
7
7
|
const validation_service_1 = require("../services/validation.service");
|
|
8
8
|
const drive_file_service_1 = require("../services/drive/drive-file.service");
|
|
9
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
10
9
|
const trash_service_1 = require("../services/drive/trash.service");
|
|
11
10
|
class DeletePermanentlyFile extends core_1.Command {
|
|
12
11
|
static args = {};
|
|
@@ -39,8 +38,14 @@ class DeletePermanentlyFile extends core_1.Command {
|
|
|
39
38
|
return { success: true, message };
|
|
40
39
|
};
|
|
41
40
|
catch = async (error) => {
|
|
42
|
-
|
|
43
|
-
cli_utils_1.CLIUtils.
|
|
41
|
+
const { flags } = await this.parse(DeletePermanentlyFile);
|
|
42
|
+
cli_utils_1.CLIUtils.catchError({
|
|
43
|
+
error,
|
|
44
|
+
command: this.id,
|
|
45
|
+
logReporter: this.log.bind(this),
|
|
46
|
+
errorReporter: this.error.bind(this),
|
|
47
|
+
jsonFlag: flags['json'],
|
|
48
|
+
});
|
|
44
49
|
this.exit(1);
|
|
45
50
|
};
|
|
46
51
|
getFileUuid = async (fileUuidFlag, nonInteractive) => {
|
|
@@ -5,7 +5,6 @@ const config_service_1 = require("../services/config.service");
|
|
|
5
5
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
6
6
|
const command_types_1 = require("../types/command.types");
|
|
7
7
|
const validation_service_1 = require("../services/validation.service");
|
|
8
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
9
8
|
const trash_service_1 = require("../services/drive/trash.service");
|
|
10
9
|
const drive_folder_service_1 = require("../services/drive/drive-folder.service");
|
|
11
10
|
class DeletePermanentlyFolder extends core_1.Command {
|
|
@@ -39,8 +38,14 @@ class DeletePermanentlyFolder extends core_1.Command {
|
|
|
39
38
|
return { success: true, message };
|
|
40
39
|
};
|
|
41
40
|
catch = async (error) => {
|
|
42
|
-
|
|
43
|
-
cli_utils_1.CLIUtils.
|
|
41
|
+
const { flags } = await this.parse(DeletePermanentlyFolder);
|
|
42
|
+
cli_utils_1.CLIUtils.catchError({
|
|
43
|
+
error,
|
|
44
|
+
command: this.id,
|
|
45
|
+
logReporter: this.log.bind(this),
|
|
46
|
+
errorReporter: this.error.bind(this),
|
|
47
|
+
jsonFlag: flags['json'],
|
|
48
|
+
});
|
|
44
49
|
this.exit(1);
|
|
45
50
|
};
|
|
46
51
|
getFolderUuid = async (folderUuidFlag, nonInteractive) => {
|
|
@@ -15,7 +15,6 @@ const node_fs_1 = require("node:fs");
|
|
|
15
15
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
16
16
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
17
|
const stream_utils_1 = require("../utils/stream.utils");
|
|
18
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
19
18
|
const command_types_1 = require("../types/command.types");
|
|
20
19
|
const validation_service_1 = require("../services/validation.service");
|
|
21
20
|
const inxt_js_1 = require("@internxt/inxt-js");
|
|
@@ -54,20 +53,20 @@ class DownloadFile extends core_1.Command {
|
|
|
54
53
|
downloadDirectory = '.';
|
|
55
54
|
}
|
|
56
55
|
const fileUuid = await this.getFileUuid(flags['id'], nonInteractive);
|
|
57
|
-
const driveFile = await this.getFileMetadata(fileUuid);
|
|
56
|
+
const driveFile = await this.getFileMetadata(fileUuid, flags['json']);
|
|
58
57
|
const downloadPath = await this.getDownloadPath(downloadDirectory, driveFile, overwrite);
|
|
59
58
|
const { user } = await auth_service_1.AuthService.instance.getAuthDetails();
|
|
60
|
-
const networkFacade = await this.prepareNetwork(user);
|
|
59
|
+
const networkFacade = await this.prepareNetwork(user, flags['json']);
|
|
61
60
|
const fileWriteStream = (0, node_fs_1.createWriteStream)(downloadPath);
|
|
62
61
|
const progressBar = cli_utils_1.CLIUtils.progress({
|
|
63
62
|
format: 'Downloading file [{bar}] {percentage}%',
|
|
64
63
|
linewrap: true,
|
|
65
|
-
});
|
|
66
|
-
progressBar
|
|
64
|
+
}, flags['json']);
|
|
65
|
+
progressBar?.start(100, 0);
|
|
67
66
|
const [executeDownload, abortable] = await networkFacade.downloadToStream(user.bucket, user.mnemonic, driveFile.fileId, driveFile.size, stream_utils_1.StreamUtils.writeStreamToWritableStream(fileWriteStream), undefined, {
|
|
68
67
|
abortController: new AbortController(),
|
|
69
68
|
progressCallback: (progress) => {
|
|
70
|
-
progressBar
|
|
69
|
+
progressBar?.update(progress * 0.99);
|
|
71
70
|
},
|
|
72
71
|
});
|
|
73
72
|
process.on('SIGINT', () => {
|
|
@@ -75,15 +74,21 @@ class DownloadFile extends core_1.Command {
|
|
|
75
74
|
process.exit(1);
|
|
76
75
|
});
|
|
77
76
|
await executeDownload;
|
|
78
|
-
progressBar
|
|
79
|
-
progressBar
|
|
77
|
+
progressBar?.update(100);
|
|
78
|
+
progressBar?.stop();
|
|
80
79
|
const message = `File downloaded successfully to ${downloadPath}`;
|
|
81
80
|
cli_utils_1.CLIUtils.success(this.log.bind(this), message);
|
|
82
81
|
return { success: true, message, file: driveFile };
|
|
83
82
|
};
|
|
84
83
|
catch = async (error) => {
|
|
85
|
-
|
|
86
|
-
cli_utils_1.CLIUtils.
|
|
84
|
+
const { flags } = await this.parse(DownloadFile);
|
|
85
|
+
cli_utils_1.CLIUtils.catchError({
|
|
86
|
+
error,
|
|
87
|
+
command: this.id,
|
|
88
|
+
logReporter: this.log.bind(this),
|
|
89
|
+
errorReporter: this.error.bind(this),
|
|
90
|
+
jsonFlag: flags['json'],
|
|
91
|
+
});
|
|
87
92
|
this.exit(1);
|
|
88
93
|
};
|
|
89
94
|
getFileUuid = async (fileUuidFlag, nonInteractive) => {
|
|
@@ -119,10 +124,10 @@ class DownloadFile extends core_1.Command {
|
|
|
119
124
|
}, this.log.bind(this));
|
|
120
125
|
return directory;
|
|
121
126
|
};
|
|
122
|
-
getFileMetadata = async (uuid) => {
|
|
123
|
-
cli_utils_1.CLIUtils.doing('Getting file metadata');
|
|
127
|
+
getFileMetadata = async (uuid, jsonFlag) => {
|
|
128
|
+
cli_utils_1.CLIUtils.doing('Getting file metadata', jsonFlag);
|
|
124
129
|
const driveFile = await drive_file_service_1.DriveFileService.instance.getFileMetadata(uuid);
|
|
125
|
-
cli_utils_1.CLIUtils.done();
|
|
130
|
+
cli_utils_1.CLIUtils.done(jsonFlag);
|
|
126
131
|
if (!driveFile) {
|
|
127
132
|
throw new Error('File not found');
|
|
128
133
|
}
|
|
@@ -149,8 +154,8 @@ class DownloadFile extends core_1.Command {
|
|
|
149
154
|
}
|
|
150
155
|
return downloadPath;
|
|
151
156
|
};
|
|
152
|
-
prepareNetwork = async (user) => {
|
|
153
|
-
cli_utils_1.CLIUtils.doing('Preparing Network');
|
|
157
|
+
prepareNetwork = async (user, jsonFlag) => {
|
|
158
|
+
cli_utils_1.CLIUtils.doing('Preparing Network', jsonFlag);
|
|
154
159
|
const networkModule = sdk_manager_service_1.SdkManager.instance.getNetwork({
|
|
155
160
|
user: user.bridgeUser,
|
|
156
161
|
pass: user.userId,
|
|
@@ -162,7 +167,7 @@ class DownloadFile extends core_1.Command {
|
|
|
162
167
|
encryptionKey: user.mnemonic,
|
|
163
168
|
});
|
|
164
169
|
const networkFacade = new network_facade_service_1.NetworkFacade(networkModule, environment, download_service_1.DownloadService.instance, crypto_service_1.CryptoService.instance);
|
|
165
|
-
cli_utils_1.CLIUtils.done();
|
|
170
|
+
cli_utils_1.CLIUtils.done(jsonFlag);
|
|
166
171
|
return networkFacade;
|
|
167
172
|
};
|
|
168
173
|
}
|
package/dist/commands/list.js
CHANGED
|
@@ -7,7 +7,6 @@ const cli_utils_1 = require("../utils/cli.utils");
|
|
|
7
7
|
const command_types_1 = require("../types/command.types");
|
|
8
8
|
const validation_service_1 = require("../services/validation.service");
|
|
9
9
|
const format_utils_1 = require("../utils/format.utils");
|
|
10
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
11
10
|
class List extends core_1.Command {
|
|
12
11
|
static args = {};
|
|
13
12
|
static description = 'Lists the content of a folder id.';
|
|
@@ -71,8 +70,14 @@ class List extends core_1.Command {
|
|
|
71
70
|
return { success: true, list: { folders, files } };
|
|
72
71
|
};
|
|
73
72
|
catch = async (error) => {
|
|
74
|
-
|
|
75
|
-
cli_utils_1.CLIUtils.
|
|
73
|
+
const { flags } = await this.parse(List);
|
|
74
|
+
cli_utils_1.CLIUtils.catchError({
|
|
75
|
+
error,
|
|
76
|
+
command: this.id,
|
|
77
|
+
logReporter: this.log.bind(this),
|
|
78
|
+
errorReporter: this.error.bind(this),
|
|
79
|
+
jsonFlag: flags['json'],
|
|
80
|
+
});
|
|
76
81
|
this.exit(1);
|
|
77
82
|
};
|
|
78
83
|
getFolderUuid = async (folderUuidFlag, nonInteractive) => {
|
package/dist/commands/login.js
CHANGED
|
@@ -6,7 +6,6 @@ const auth_service_1 = require("../services/auth.service");
|
|
|
6
6
|
const config_service_1 = require("../services/config.service");
|
|
7
7
|
const validation_service_1 = require("../services/validation.service");
|
|
8
8
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
9
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
10
9
|
const sdk_manager_service_1 = require("../services/sdk-manager.service");
|
|
11
10
|
class Login extends core_1.Command {
|
|
12
11
|
static args = {};
|
|
@@ -64,8 +63,14 @@ class Login extends core_1.Command {
|
|
|
64
63
|
};
|
|
65
64
|
};
|
|
66
65
|
catch = async (error) => {
|
|
67
|
-
|
|
68
|
-
cli_utils_1.CLIUtils.
|
|
66
|
+
const { flags } = await this.parse(Login);
|
|
67
|
+
cli_utils_1.CLIUtils.catchError({
|
|
68
|
+
error,
|
|
69
|
+
command: this.id,
|
|
70
|
+
logReporter: this.log.bind(this),
|
|
71
|
+
errorReporter: this.error.bind(this),
|
|
72
|
+
jsonFlag: flags['json'],
|
|
73
|
+
});
|
|
69
74
|
this.exit(1);
|
|
70
75
|
};
|
|
71
76
|
getEmail = async (emailFlag, nonInteractive) => {
|
package/dist/commands/logout.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const config_service_1 = require("../services/config.service");
|
|
5
5
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
6
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
7
6
|
class Logout extends core_1.Command {
|
|
8
7
|
static args = {};
|
|
9
8
|
static description = 'Logs out the current internxt user that is logged into the Internxt CLI.';
|
|
@@ -26,8 +25,14 @@ class Logout extends core_1.Command {
|
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
catch = async (error) => {
|
|
29
|
-
|
|
30
|
-
cli_utils_1.CLIUtils.
|
|
28
|
+
const { flags } = await this.parse(Logout);
|
|
29
|
+
cli_utils_1.CLIUtils.catchError({
|
|
30
|
+
error,
|
|
31
|
+
command: this.id,
|
|
32
|
+
logReporter: this.log.bind(this),
|
|
33
|
+
errorReporter: this.error.bind(this),
|
|
34
|
+
jsonFlag: flags['json'],
|
|
35
|
+
});
|
|
31
36
|
this.exit(1);
|
|
32
37
|
};
|
|
33
38
|
}
|
package/dist/commands/logs.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const config_service_1 = require("../services/config.service");
|
|
5
5
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
6
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
7
6
|
class Logs extends core_1.Command {
|
|
8
7
|
static args = {};
|
|
9
8
|
static description = 'Displays the Internxt CLI logs directory path';
|
|
@@ -17,8 +16,14 @@ class Logs extends core_1.Command {
|
|
|
17
16
|
return { success: true, message, path: config_service_1.ConfigService.INTERNXT_CLI_LOGS_DIR };
|
|
18
17
|
};
|
|
19
18
|
catch = async (error) => {
|
|
20
|
-
|
|
21
|
-
cli_utils_1.CLIUtils.
|
|
19
|
+
const { flags } = await this.parse(Logs);
|
|
20
|
+
cli_utils_1.CLIUtils.catchError({
|
|
21
|
+
error,
|
|
22
|
+
command: this.id,
|
|
23
|
+
logReporter: this.log.bind(this),
|
|
24
|
+
errorReporter: this.error.bind(this),
|
|
25
|
+
jsonFlag: flags['json'],
|
|
26
|
+
});
|
|
22
27
|
this.exit(1);
|
|
23
28
|
};
|
|
24
29
|
}
|
|
@@ -6,7 +6,6 @@ const cli_utils_1 = require("../utils/cli.utils");
|
|
|
6
6
|
const command_types_1 = require("../types/command.types");
|
|
7
7
|
const validation_service_1 = require("../services/validation.service");
|
|
8
8
|
const drive_file_service_1 = require("../services/drive/drive-file.service");
|
|
9
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
10
9
|
class MoveFile extends core_1.Command {
|
|
11
10
|
static args = {};
|
|
12
11
|
static description = 'Move a file into a destination folder.';
|
|
@@ -44,8 +43,14 @@ class MoveFile extends core_1.Command {
|
|
|
44
43
|
return { success: true, message, file: newFile };
|
|
45
44
|
};
|
|
46
45
|
catch = async (error) => {
|
|
47
|
-
|
|
48
|
-
cli_utils_1.CLIUtils.
|
|
46
|
+
const { flags } = await this.parse(MoveFile);
|
|
47
|
+
cli_utils_1.CLIUtils.catchError({
|
|
48
|
+
error,
|
|
49
|
+
command: this.id,
|
|
50
|
+
logReporter: this.log.bind(this),
|
|
51
|
+
errorReporter: this.error.bind(this),
|
|
52
|
+
jsonFlag: flags['json'],
|
|
53
|
+
});
|
|
49
54
|
this.exit(1);
|
|
50
55
|
};
|
|
51
56
|
getFileUuid = async (fileUuidFlag, nonInteractive) => {
|
|
@@ -6,7 +6,6 @@ const drive_folder_service_1 = require("../services/drive/drive-folder.service")
|
|
|
6
6
|
const cli_utils_1 = require("../utils/cli.utils");
|
|
7
7
|
const command_types_1 = require("../types/command.types");
|
|
8
8
|
const validation_service_1 = require("../services/validation.service");
|
|
9
|
-
const errors_utils_1 = require("../utils/errors.utils");
|
|
10
9
|
class MoveFolder extends core_1.Command {
|
|
11
10
|
static args = {};
|
|
12
11
|
static description = 'Move a folder into a destination folder.';
|
|
@@ -44,8 +43,14 @@ class MoveFolder extends core_1.Command {
|
|
|
44
43
|
return { success: true, message, folder: newFolder };
|
|
45
44
|
};
|
|
46
45
|
catch = async (error) => {
|
|
47
|
-
|
|
48
|
-
cli_utils_1.CLIUtils.
|
|
46
|
+
const { flags } = await this.parse(MoveFolder);
|
|
47
|
+
cli_utils_1.CLIUtils.catchError({
|
|
48
|
+
error,
|
|
49
|
+
command: this.id,
|
|
50
|
+
logReporter: this.log.bind(this),
|
|
51
|
+
errorReporter: this.error.bind(this),
|
|
52
|
+
jsonFlag: flags['json'],
|
|
53
|
+
});
|
|
49
54
|
this.exit(1);
|
|
50
55
|
};
|
|
51
56
|
getFolderUuid = async (folderUuidFlag, nonInteractive) => {
|