@internxt/cli 1.5.2 → 1.5.4
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/.env +2 -6
- package/README.md +46 -26
- package/bin/dev.js +1 -1
- package/bin/run.js +1 -1
- 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 +11 -6
- package/dist/commands/delete-permanently-file.js +9 -4
- package/dist/commands/delete-permanently-folder.js +9 -4
- 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 +10 -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 +17 -11
- 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/services/auth.service.d.ts +1 -0
- package/dist/services/auth.service.js +13 -1
- package/dist/services/crypto.service.d.ts +1 -1
- package/dist/services/crypto.service.js +2 -2
- package/dist/services/drive/drive-file.service.d.ts +1 -1
- package/dist/services/drive/drive-file.service.js +7 -7
- package/dist/services/drive/drive-folder.service.js +7 -7
- package/dist/services/drive/trash.service.d.ts +6 -4
- package/dist/services/drive/trash.service.js +6 -6
- package/dist/services/sdk-manager.service.d.ts +3 -5
- package/dist/services/sdk-manager.service.js +14 -34
- package/dist/services/thumbnail.service.d.ts +2 -2
- package/dist/services/thumbnail.service.js +6 -6
- package/dist/services/usage.service.d.ts +2 -2
- package/dist/services/usage.service.js +2 -2
- package/dist/types/config.types.d.ts +1 -4
- package/dist/utils/cli.utils.d.ts +13 -4
- package/dist/utils/cli.utils.js +44 -10
- package/dist/utils/pm2.utils.d.ts +1 -1
- package/dist/utils/thumbnail.utils.js +3 -3
- package/dist/utils/webdav.utils.d.ts +2 -3
- package/dist/utils/webdav.utils.js +6 -18
- package/dist/utils/xml.utils.d.ts +1 -1
- package/dist/utils/xml.utils.js +3 -3
- package/dist/webdav/handlers/DELETE.handler.js +5 -1
- package/dist/webdav/handlers/GET.handler.js +6 -2
- package/dist/webdav/handlers/HEAD.handler.js +7 -2
- package/dist/webdav/handlers/MKCOL.handler.js +10 -8
- package/dist/webdav/handlers/MOVE.handler.js +10 -3
- package/dist/webdav/handlers/OPTIONS.handler.js +2 -5
- package/dist/webdav/handlers/PROPFIND.handler.js +31 -21
- package/dist/webdav/handlers/PUT.handler.js +8 -4
- package/dist/webdav/index.js +1 -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 +29 -28
- package/scripts/restart-webdav.js +2 -1
package/.env
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
DRIVE_API_URL=https://drive.internxt.com/api
|
|
1
|
+
DRIVE_WEB_URL=https://drive.internxt.com
|
|
3
2
|
DRIVE_NEW_API_URL=https://api.internxt.com/drive
|
|
4
|
-
PAYMENTS_API_URL=https://api.internxt.com/payments
|
|
5
3
|
NETWORK_URL=https://api.internxt.com
|
|
6
4
|
APP_CRYPTO_SECRET=6KYQBP847D4ATSFA
|
|
7
|
-
APP_CRYPTO_SECRET2=8Q8VMUE3BJZV87GT
|
|
8
5
|
APP_MAGIC_IV=d139cb9a2cd17092e79e1861cf9d7023
|
|
9
|
-
APP_MAGIC_SALT=38dce0391b49efba88dbc8c39ebf868f0267eb110bb0012ab27dc52a528d61b1d1ed9d76f400ff58e3240028442b1eab9bb84e111d9dadd997982dbde9dbd25e
|
|
10
|
-
NODE_ENV=production
|
|
6
|
+
APP_MAGIC_SALT=38dce0391b49efba88dbc8c39ebf868f0267eb110bb0012ab27dc52a528d61b1d1ed9d76f400ff58e3240028442b1eab9bb84e111d9dadd997982dbde9dbd25e
|
package/README.md
CHANGED
|
@@ -7,17 +7,37 @@ A CLI tool to interact with your Internxt encrypted files
|
|
|
7
7
|
|
|
8
8
|
<!-- toc -->
|
|
9
9
|
* [Internxt CLI](#internxt-cli)
|
|
10
|
+
* [Project Maintenance](#project-maintenance)
|
|
10
11
|
* [Installation](#installation)
|
|
11
12
|
* [Usage](#usage)
|
|
12
13
|
* [Commands](#commands)
|
|
13
14
|
* [Current Limitations](#current-limitations)
|
|
14
15
|
<!-- tocstop -->
|
|
15
16
|
|
|
17
|
+
# Project Maintenance
|
|
18
|
+
|
|
19
|
+
<!-- maintenance -->
|
|
20
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
21
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
22
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
23
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
24
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
25
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
26
|
+
[](https://sonarcloud.io/summary/new_code?id=internxt_cli)
|
|
27
|
+
|
|
28
|
+
We aim to achieve:
|
|
29
|
+
|
|
30
|
+
- An 'A' rating in Maintainability
|
|
31
|
+
- An 'A' rating in Security
|
|
32
|
+
- Less than 3% duplicated lines
|
|
33
|
+
- At least 80% test coverage
|
|
34
|
+
<!-- maintenancestop -->
|
|
35
|
+
|
|
16
36
|
# Installation
|
|
17
37
|
|
|
18
38
|
You can install the Internxt CLI by using NPM:
|
|
19
39
|
|
|
20
|
-
Requires Node >=
|
|
40
|
+
Requires Node >= 22.12.0
|
|
21
41
|
|
|
22
42
|
`npm i -g @internxt/cli`
|
|
23
43
|
|
|
@@ -31,7 +51,7 @@ $ npm install -g @internxt/cli
|
|
|
31
51
|
$ internxt COMMAND
|
|
32
52
|
running command...
|
|
33
53
|
$ internxt (--version)
|
|
34
|
-
@internxt/cli/1.5.
|
|
54
|
+
@internxt/cli/1.5.4 linux-x64 node-v22.17.0
|
|
35
55
|
$ internxt --help [COMMAND]
|
|
36
56
|
USAGE
|
|
37
57
|
$ internxt COMMAND
|
|
@@ -99,7 +119,7 @@ EXAMPLES
|
|
|
99
119
|
$ internxt add-cert
|
|
100
120
|
```
|
|
101
121
|
|
|
102
|
-
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
122
|
+
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/add-cert.ts)_
|
|
103
123
|
|
|
104
124
|
## `internxt config`
|
|
105
125
|
|
|
@@ -119,7 +139,7 @@ EXAMPLES
|
|
|
119
139
|
$ internxt config
|
|
120
140
|
```
|
|
121
141
|
|
|
122
|
-
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
142
|
+
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/config.ts)_
|
|
123
143
|
|
|
124
144
|
## `internxt create-folder`
|
|
125
145
|
|
|
@@ -148,7 +168,7 @@ EXAMPLES
|
|
|
148
168
|
$ internxt create-folder
|
|
149
169
|
```
|
|
150
170
|
|
|
151
|
-
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
171
|
+
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/create-folder.ts)_
|
|
152
172
|
|
|
153
173
|
## `internxt delete-permanently-file`
|
|
154
174
|
|
|
@@ -178,7 +198,7 @@ EXAMPLES
|
|
|
178
198
|
$ internxt delete-permanently-file
|
|
179
199
|
```
|
|
180
200
|
|
|
181
|
-
_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
201
|
+
_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/delete-permanently-file.ts)_
|
|
182
202
|
|
|
183
203
|
## `internxt delete-permanently-folder`
|
|
184
204
|
|
|
@@ -208,7 +228,7 @@ EXAMPLES
|
|
|
208
228
|
$ internxt delete-permanently-folder
|
|
209
229
|
```
|
|
210
230
|
|
|
211
|
-
_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
231
|
+
_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/delete-permanently-folder.ts)_
|
|
212
232
|
|
|
213
233
|
## `internxt delete permanently file`
|
|
214
234
|
|
|
@@ -297,7 +317,7 @@ EXAMPLES
|
|
|
297
317
|
$ internxt download-file
|
|
298
318
|
```
|
|
299
319
|
|
|
300
|
-
_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
320
|
+
_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/download-file.ts)_
|
|
301
321
|
|
|
302
322
|
## `internxt download file`
|
|
303
323
|
|
|
@@ -356,7 +376,7 @@ EXAMPLES
|
|
|
356
376
|
$ internxt list
|
|
357
377
|
```
|
|
358
378
|
|
|
359
|
-
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
379
|
+
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/list.ts)_
|
|
360
380
|
|
|
361
381
|
## `internxt login`
|
|
362
382
|
|
|
@@ -385,7 +405,7 @@ EXAMPLES
|
|
|
385
405
|
$ internxt login
|
|
386
406
|
```
|
|
387
407
|
|
|
388
|
-
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
408
|
+
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/login.ts)_
|
|
389
409
|
|
|
390
410
|
## `internxt logout`
|
|
391
411
|
|
|
@@ -405,7 +425,7 @@ EXAMPLES
|
|
|
405
425
|
$ internxt logout
|
|
406
426
|
```
|
|
407
427
|
|
|
408
|
-
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
428
|
+
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/logout.ts)_
|
|
409
429
|
|
|
410
430
|
## `internxt logs`
|
|
411
431
|
|
|
@@ -425,7 +445,7 @@ EXAMPLES
|
|
|
425
445
|
$ internxt logs
|
|
426
446
|
```
|
|
427
447
|
|
|
428
|
-
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
448
|
+
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/logs.ts)_
|
|
429
449
|
|
|
430
450
|
## `internxt move-file`
|
|
431
451
|
|
|
@@ -457,7 +477,7 @@ EXAMPLES
|
|
|
457
477
|
$ internxt move-file
|
|
458
478
|
```
|
|
459
479
|
|
|
460
|
-
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
480
|
+
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/move-file.ts)_
|
|
461
481
|
|
|
462
482
|
## `internxt move-folder`
|
|
463
483
|
|
|
@@ -489,7 +509,7 @@ EXAMPLES
|
|
|
489
509
|
$ internxt move-folder
|
|
490
510
|
```
|
|
491
511
|
|
|
492
|
-
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
512
|
+
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/move-folder.ts)_
|
|
493
513
|
|
|
494
514
|
## `internxt move file`
|
|
495
515
|
|
|
@@ -580,7 +600,7 @@ EXAMPLES
|
|
|
580
600
|
$ internxt rename-file
|
|
581
601
|
```
|
|
582
602
|
|
|
583
|
-
_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
603
|
+
_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/rename-file.ts)_
|
|
584
604
|
|
|
585
605
|
## `internxt rename-folder`
|
|
586
606
|
|
|
@@ -611,7 +631,7 @@ EXAMPLES
|
|
|
611
631
|
$ internxt rename-folder
|
|
612
632
|
```
|
|
613
633
|
|
|
614
|
-
_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
634
|
+
_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/rename-folder.ts)_
|
|
615
635
|
|
|
616
636
|
## `internxt rename file`
|
|
617
637
|
|
|
@@ -699,7 +719,7 @@ EXAMPLES
|
|
|
699
719
|
$ internxt trash-clear
|
|
700
720
|
```
|
|
701
721
|
|
|
702
|
-
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
722
|
+
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/trash-clear.ts)_
|
|
703
723
|
|
|
704
724
|
## `internxt trash-file`
|
|
705
725
|
|
|
@@ -729,7 +749,7 @@ EXAMPLES
|
|
|
729
749
|
$ internxt trash-file
|
|
730
750
|
```
|
|
731
751
|
|
|
732
|
-
_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
752
|
+
_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/trash-file.ts)_
|
|
733
753
|
|
|
734
754
|
## `internxt trash-folder`
|
|
735
755
|
|
|
@@ -759,7 +779,7 @@ EXAMPLES
|
|
|
759
779
|
$ internxt trash-folder
|
|
760
780
|
```
|
|
761
781
|
|
|
762
|
-
_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
782
|
+
_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/trash-folder.ts)_
|
|
763
783
|
|
|
764
784
|
## `internxt trash-list`
|
|
765
785
|
|
|
@@ -785,7 +805,7 @@ EXAMPLES
|
|
|
785
805
|
$ internxt trash-list
|
|
786
806
|
```
|
|
787
807
|
|
|
788
|
-
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
808
|
+
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/trash-list.ts)_
|
|
789
809
|
|
|
790
810
|
## `internxt trash-restore-file`
|
|
791
811
|
|
|
@@ -816,7 +836,7 @@ EXAMPLES
|
|
|
816
836
|
$ internxt trash-restore-file
|
|
817
837
|
```
|
|
818
838
|
|
|
819
|
-
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
839
|
+
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/trash-restore-file.ts)_
|
|
820
840
|
|
|
821
841
|
## `internxt trash-restore-folder`
|
|
822
842
|
|
|
@@ -847,7 +867,7 @@ EXAMPLES
|
|
|
847
867
|
$ internxt trash-restore-folder
|
|
848
868
|
```
|
|
849
869
|
|
|
850
|
-
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
870
|
+
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/trash-restore-folder.ts)_
|
|
851
871
|
|
|
852
872
|
## `internxt trash clear`
|
|
853
873
|
|
|
@@ -1044,7 +1064,7 @@ EXAMPLES
|
|
|
1044
1064
|
$ internxt upload-file
|
|
1045
1065
|
```
|
|
1046
1066
|
|
|
1047
|
-
_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1067
|
+
_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/upload-file.ts)_
|
|
1048
1068
|
|
|
1049
1069
|
## `internxt upload file`
|
|
1050
1070
|
|
|
@@ -1099,7 +1119,7 @@ EXAMPLES
|
|
|
1099
1119
|
$ internxt webdav status
|
|
1100
1120
|
```
|
|
1101
1121
|
|
|
1102
|
-
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1122
|
+
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/webdav.ts)_
|
|
1103
1123
|
|
|
1104
1124
|
## `internxt webdav-config`
|
|
1105
1125
|
|
|
@@ -1125,7 +1145,7 @@ EXAMPLES
|
|
|
1125
1145
|
$ internxt webdav-config
|
|
1126
1146
|
```
|
|
1127
1147
|
|
|
1128
|
-
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1148
|
+
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/webdav-config.ts)_
|
|
1129
1149
|
|
|
1130
1150
|
## `internxt whoami`
|
|
1131
1151
|
|
|
@@ -1145,7 +1165,7 @@ EXAMPLES
|
|
|
1145
1165
|
$ internxt whoami
|
|
1146
1166
|
```
|
|
1147
1167
|
|
|
1148
|
-
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.
|
|
1168
|
+
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.4/src/commands/whoami.ts)_
|
|
1149
1169
|
<!-- commandsstop -->
|
|
1150
1170
|
|
|
1151
1171
|
# Current Limitations
|
package/bin/dev.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node_modules/.bin/ts-node
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
require('dotenv').config({ path: __dirname + '/../.env' });
|
|
3
|
+
require('dotenv').config({ path: __dirname + '/../.env', quiet: true });
|
|
4
4
|
(async () => {
|
|
5
5
|
const oclif = await import('@oclif/core');
|
|
6
6
|
await oclif.execute({ development: true, dir: __dirname });
|
package/bin/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
require('dotenv').config({ path: __dirname + '/../.env' });
|
|
3
|
+
require('dotenv').config({ path: __dirname + '/../.env', quiet: true });
|
|
4
4
|
(async () => {
|
|
5
5
|
const oclif = await import('@oclif/core');
|
|
6
6
|
await oclif.execute({ development: false, dir: __dirname });
|
|
@@ -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();
|
|
52
|
-
const message = `Folder ${newFolder.plainName} created successfully, view it at ${config_service_1.ConfigService.instance.get('
|
|
50
|
+
cli_utils_1.CLIUtils.done(flags['json']);
|
|
51
|
+
const message = `Folder ${newFolder.plainName} created successfully, view it at ${config_service_1.ConfigService.instance.get('DRIVE_WEB_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 = {};
|
|
@@ -33,14 +32,20 @@ class DeletePermanentlyFile extends core_1.Command {
|
|
|
33
32
|
if (!driveFile) {
|
|
34
33
|
throw new Error('File not found');
|
|
35
34
|
}
|
|
36
|
-
await trash_service_1.TrashService.instance.deleteFile(
|
|
35
|
+
await trash_service_1.TrashService.instance.deleteFile(driveFile.uuid);
|
|
37
36
|
const message = 'File permanently deleted successfully';
|
|
38
37
|
cli_utils_1.CLIUtils.success(this.log.bind(this), message);
|
|
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 {
|
|
@@ -33,14 +32,20 @@ class DeletePermanentlyFolder extends core_1.Command {
|
|
|
33
32
|
if (!driveFolder) {
|
|
34
33
|
throw new Error('Folder not found');
|
|
35
34
|
}
|
|
36
|
-
await trash_service_1.TrashService.instance.deleteFolder(driveFolder.
|
|
35
|
+
await trash_service_1.TrashService.instance.deleteFolder(driveFolder.uuid);
|
|
37
36
|
const message = 'Folder permanently deleted successfully';
|
|
38
37
|
cli_utils_1.CLIUtils.success(this.log.bind(this), message);
|
|
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) => {
|