@super-protocol/sp-cli 0.0.2-beta.2 → 0.0.2-beta.5

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 CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @super-protocol/sp-cli
21
21
  $ sp COMMAND
22
22
  running command...
23
23
  $ sp (--version)
24
- @super-protocol/sp-cli/0.0.2-beta.2 linux-x64 node-v22.21.1
24
+ @super-protocol/sp-cli/0.0.2-beta.5 linux-x64 node-v22.21.1
25
25
  $ sp --help [COMMAND]
26
26
  USAGE
27
27
  $ sp COMMAND
@@ -42,17 +42,10 @@ USAGE
42
42
  * [`sp config list`](#sp-config-list)
43
43
  * [`sp config show`](#sp-config-show)
44
44
  * [`sp config use`](#sp-config-use)
45
+ * [`sp files download RESOURCEFILE LOCALDIRECTORY`](#sp-files-download-resourcefile-localdirectory)
46
+ * [`sp files upload PATH`](#sp-files-upload-path)
45
47
  * [`sp help [COMMAND]`](#sp-help-command)
46
- * [`sp plugins`](#sp-plugins)
47
- * [`sp plugins add PLUGIN`](#sp-plugins-add-plugin)
48
- * [`sp plugins:inspect PLUGIN...`](#sp-pluginsinspect-plugin)
49
- * [`sp plugins install PLUGIN`](#sp-plugins-install-plugin)
50
- * [`sp plugins link PATH`](#sp-plugins-link-path)
51
- * [`sp plugins remove [PLUGIN]`](#sp-plugins-remove-plugin)
52
- * [`sp plugins reset`](#sp-plugins-reset)
53
- * [`sp plugins uninstall [PLUGIN]`](#sp-plugins-uninstall-plugin)
54
- * [`sp plugins unlink [PLUGIN]`](#sp-plugins-unlink-plugin)
55
- * [`sp plugins update`](#sp-plugins-update)
48
+ * [`sp login`](#sp-login)
56
49
  * [`sp storage base`](#sp-storage-base)
57
50
  * [`sp storage create`](#sp-storage-create)
58
51
  * [`sp storage select`](#sp-storage-select)
@@ -69,7 +62,7 @@ GLOBAL FLAGS
69
62
  --json Format output as json.
70
63
  ```
71
64
 
72
- _See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/account/info.ts)_
65
+ _See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/account/info.ts)_
73
66
 
74
67
  ## `sp auth login`
75
68
 
@@ -86,11 +79,14 @@ GLOBAL FLAGS
86
79
  DESCRIPTION
87
80
  Authorization
88
81
 
82
+ ALIASES
83
+ $ sp login
84
+
89
85
  EXAMPLES
90
86
  $ sp auth login
91
87
  ```
92
88
 
93
- _See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/auth/login.ts)_
89
+ _See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/auth/login.ts)_
94
90
 
95
91
  ## `sp auth me`
96
92
 
@@ -103,7 +99,7 @@ GLOBAL FLAGS
103
99
  --json Format output as json.
104
100
  ```
105
101
 
106
- _See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/auth/me.ts)_
102
+ _See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/auth/me.ts)_
107
103
 
108
104
  ## `sp base`
109
105
 
@@ -116,7 +112,7 @@ GLOBAL FLAGS
116
112
  --json Format output as json.
117
113
  ```
118
114
 
119
- _See code: [src/commands/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/base.ts)_
115
+ _See code: [src/commands/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/base.ts)_
120
116
 
121
117
  ## `sp config`
122
118
 
@@ -146,7 +142,7 @@ EXAMPLES
146
142
  $ sp config delete - Delete a configuration
147
143
  ```
148
144
 
149
- _See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/index.ts)_
145
+ _See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/index.ts)_
150
146
 
151
147
  ## `sp config add [FILE]`
152
148
 
@@ -185,7 +181,7 @@ EXAMPLES
185
181
  }
186
182
  ```
187
183
 
188
- _See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/add.ts)_
184
+ _See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/add.ts)_
189
185
 
190
186
  ## `sp config base`
191
187
 
@@ -197,7 +193,7 @@ GLOBAL FLAGS
197
193
  --json Format output as json.
198
194
  ```
199
195
 
200
- _See code: [src/commands/config/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/base.ts)_
196
+ _See code: [src/commands/config/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/base.ts)_
201
197
 
202
198
  ## `sp config create`
203
199
 
@@ -224,7 +220,7 @@ EXAMPLES
224
220
  $ sp config create --name "Production" --url "https://api.dp.superprotocol.com"
225
221
  ```
226
222
 
227
- _See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/create.ts)_
223
+ _See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/create.ts)_
228
224
 
229
225
  ## `sp config delete`
230
226
 
@@ -252,7 +248,7 @@ EXAMPLES
252
248
  $ sp config delete --name "My Config" --force
253
249
  ```
254
250
 
255
- _See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/delete.ts)_
251
+ _See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/delete.ts)_
256
252
 
257
253
  ## `sp config list`
258
254
 
@@ -272,7 +268,7 @@ EXAMPLES
272
268
  $ sp config list
273
269
  ```
274
270
 
275
- _See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/list.ts)_
271
+ _See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/list.ts)_
276
272
 
277
273
  ## `sp config show`
278
274
 
@@ -292,7 +288,7 @@ EXAMPLES
292
288
  $ sp config show
293
289
  ```
294
290
 
295
- _See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/show.ts)_
291
+ _See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/show.ts)_
296
292
 
297
293
  ## `sp config use`
298
294
 
@@ -312,318 +308,112 @@ EXAMPLES
312
308
  $ sp config use
313
309
  ```
314
310
 
315
- _See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/config/use.ts)_
311
+ _See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/config/use.ts)_
316
312
 
317
- ## `sp help [COMMAND]`
313
+ ## `sp files download RESOURCEFILE LOCALDIRECTORY`
318
314
 
319
- Display help for sp.
315
+ describe the command here
320
316
 
321
317
  ```
322
318
  USAGE
323
- $ sp help [COMMAND...] [-n]
319
+ $ sp files download RESOURCEFILE LOCALDIRECTORY [--json] [--config <value>] [--maximum-concurrent <value>]
324
320
 
325
321
  ARGUMENTS
326
- [COMMAND...] Command to show help for.
327
-
328
- FLAGS
329
- -n, --nested-commands Include all nested commands in the output.
330
-
331
- DESCRIPTION
332
- Display help for sp.
333
- ```
334
-
335
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.33/src/commands/help.ts)_
336
-
337
- ## `sp plugins`
338
-
339
- List installed plugins.
340
-
341
- ```
342
- USAGE
343
- $ sp plugins [--json] [--core]
322
+ RESOURCEFILE Path to a resource file
323
+ LOCALDIRECTORY Path to save downloaded file
344
324
 
345
325
  FLAGS
346
- --core Show core plugins.
326
+ --maximum-concurrent=<value> [default: 1] Maximum concurrent pieces to upload at once per transfer
347
327
 
348
328
  GLOBAL FLAGS
349
- --json Format output as json.
350
-
351
- DESCRIPTION
352
- List installed plugins.
353
-
354
- EXAMPLES
355
- $ sp plugins
356
- ```
357
-
358
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/index.ts)_
359
-
360
- ## `sp plugins add PLUGIN`
361
-
362
- Installs a plugin into sp.
363
-
364
- ```
365
- USAGE
366
- $ sp plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
367
-
368
- ARGUMENTS
369
- PLUGIN... Plugin to install.
370
-
371
- FLAGS
372
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
373
- -h, --help Show CLI help.
374
- -s, --silent Silences npm output.
375
- -v, --verbose Show verbose npm output.
376
-
377
- GLOBAL FLAGS
378
- --json Format output as json.
379
-
380
- DESCRIPTION
381
- Installs a plugin into sp.
382
-
383
- Uses npm to install plugins.
384
-
385
- Installation of a user-installed plugin will override a core plugin.
386
-
387
- Use the SP_NPM_LOG_LEVEL environment variable to set the npm loglevel.
388
- Use the SP_NPM_REGISTRY environment variable to set the npm registry.
389
-
390
- ALIASES
391
- $ sp plugins add
392
-
393
- EXAMPLES
394
- Install a plugin from npm registry.
395
-
396
- $ sp plugins add myplugin
397
-
398
- Install a plugin from a github url.
399
-
400
- $ sp plugins add https://github.com/someuser/someplugin
401
-
402
- Install a plugin from a github slug.
403
-
404
- $ sp plugins add someuser/someplugin
405
- ```
406
-
407
- ## `sp plugins:inspect PLUGIN...`
408
-
409
- Displays installation properties of a plugin.
410
-
411
- ```
412
- USAGE
413
- $ sp plugins inspect PLUGIN...
414
-
415
- ARGUMENTS
416
- PLUGIN... [default: .] Plugin to inspect.
417
-
418
- FLAGS
419
- -h, --help Show CLI help.
420
- -v, --verbose
421
-
422
- GLOBAL FLAGS
423
- --json Format output as json.
329
+ --config=<value> Specify config file.
330
+ --json Format output as json.
424
331
 
425
332
  DESCRIPTION
426
- Displays installation properties of a plugin.
333
+ describe the command here
427
334
 
428
335
  EXAMPLES
429
- $ sp plugins inspect myplugin
336
+ $ sp files download ./resource.json ./pathToDownload
430
337
  ```
431
338
 
432
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/inspect.ts)_
339
+ _See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/files/download.ts)_
433
340
 
434
- ## `sp plugins install PLUGIN`
341
+ ## `sp files upload PATH`
435
342
 
436
- Installs a plugin into sp.
343
+ describe the command here
437
344
 
438
345
  ```
439
346
  USAGE
440
- $ sp plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
347
+ $ sp files upload PATH [--json] [--config <value>] [--filename <value>] [--maximum-concurrent <value>]
348
+ [--metadata <value>] [--output <value>] [--skip-encryption] [--sync]
441
349
 
442
350
  ARGUMENTS
443
- PLUGIN... Plugin to install.
351
+ PATH file or directory to upload
444
352
 
445
353
  FLAGS
446
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
447
- -h, --help Show CLI help.
448
- -s, --silent Silences npm output.
449
- -v, --verbose Show verbose npm output.
354
+ --filename=<value> The name of the resulting file/directory in the storage
355
+ --maximum-concurrent=<value> [default: 1] Maximum concurrent pieces to upload at once per transfer
356
+ --metadata=<value> Path to a metadata file for adding fields to the resource file
357
+ --output=<value> [default: resource.json] Path to save resource file that is used to access the uploaded
358
+ file
359
+ --skip-encryption Skip file encryption before upload
360
+ --sync Sync mode: delete files in target that don't exist in source
450
361
 
451
362
  GLOBAL FLAGS
452
- --json Format output as json.
453
-
454
- DESCRIPTION
455
- Installs a plugin into sp.
456
-
457
- Uses npm to install plugins.
458
-
459
- Installation of a user-installed plugin will override a core plugin.
460
-
461
- Use the SP_NPM_LOG_LEVEL environment variable to set the npm loglevel.
462
- Use the SP_NPM_REGISTRY environment variable to set the npm registry.
463
-
464
- ALIASES
465
- $ sp plugins add
466
-
467
- EXAMPLES
468
- Install a plugin from npm registry.
469
-
470
- $ sp plugins install myplugin
471
-
472
- Install a plugin from a github url.
473
-
474
- $ sp plugins install https://github.com/someuser/someplugin
475
-
476
- Install a plugin from a github slug.
477
-
478
- $ sp plugins install someuser/someplugin
479
- ```
480
-
481
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/install.ts)_
482
-
483
- ## `sp plugins link PATH`
484
-
485
- Links a plugin into the CLI for development.
486
-
487
- ```
488
- USAGE
489
- $ sp plugins link PATH [-h] [--install] [-v]
490
-
491
- ARGUMENTS
492
- PATH [default: .] path to plugin
493
-
494
- FLAGS
495
- -h, --help Show CLI help.
496
- -v, --verbose
497
- --[no-]install Install dependencies after linking the plugin.
498
-
499
- DESCRIPTION
500
- Links a plugin into the CLI for development.
501
-
502
- Installation of a linked plugin will override a user-installed or core plugin.
503
-
504
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
505
- command will override the user-installed or core plugin implementation. This is useful for development work.
506
-
507
-
508
- EXAMPLES
509
- $ sp plugins link myplugin
510
- ```
511
-
512
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/link.ts)_
513
-
514
- ## `sp plugins remove [PLUGIN]`
515
-
516
- Removes a plugin from the CLI.
517
-
518
- ```
519
- USAGE
520
- $ sp plugins remove [PLUGIN...] [-h] [-v]
521
-
522
- ARGUMENTS
523
- [PLUGIN...] plugin to uninstall
524
-
525
- FLAGS
526
- -h, --help Show CLI help.
527
- -v, --verbose
363
+ --config=<value> Specify config file.
364
+ --json Format output as json.
528
365
 
529
366
  DESCRIPTION
530
- Removes a plugin from the CLI.
531
-
532
- ALIASES
533
- $ sp plugins unlink
534
- $ sp plugins remove
367
+ describe the command here
535
368
 
536
369
  EXAMPLES
537
- $ sp plugins remove myplugin
370
+ $ sp files upload ./file.txt
538
371
  ```
539
372
 
540
- ## `sp plugins reset`
373
+ _See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/files/upload.ts)_
541
374
 
542
- Remove all user-installed and linked plugins.
543
-
544
- ```
545
- USAGE
546
- $ sp plugins reset [--hard] [--reinstall]
547
-
548
- FLAGS
549
- --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
550
- --reinstall Reinstall all plugins after uninstalling.
551
- ```
552
-
553
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/reset.ts)_
554
-
555
- ## `sp plugins uninstall [PLUGIN]`
375
+ ## `sp help [COMMAND]`
556
376
 
557
- Removes a plugin from the CLI.
377
+ Display help for sp.
558
378
 
559
379
  ```
560
380
  USAGE
561
- $ sp plugins uninstall [PLUGIN...] [-h] [-v]
381
+ $ sp help [COMMAND...] [-n]
562
382
 
563
383
  ARGUMENTS
564
- [PLUGIN...] plugin to uninstall
384
+ [COMMAND...] Command to show help for.
565
385
 
566
386
  FLAGS
567
- -h, --help Show CLI help.
568
- -v, --verbose
387
+ -n, --nested-commands Include all nested commands in the output.
569
388
 
570
389
  DESCRIPTION
571
- Removes a plugin from the CLI.
572
-
573
- ALIASES
574
- $ sp plugins unlink
575
- $ sp plugins remove
576
-
577
- EXAMPLES
578
- $ sp plugins uninstall myplugin
390
+ Display help for sp.
579
391
  ```
580
392
 
581
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/uninstall.ts)_
393
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.33/src/commands/help.ts)_
582
394
 
583
- ## `sp plugins unlink [PLUGIN]`
395
+ ## `sp login`
584
396
 
585
- Removes a plugin from the CLI.
397
+ Authorization
586
398
 
587
399
  ```
588
400
  USAGE
589
- $ sp plugins unlink [PLUGIN...] [-h] [-v]
590
-
591
- ARGUMENTS
592
- [PLUGIN...] plugin to uninstall
401
+ $ sp login [--json] [--config <value>]
593
402
 
594
- FLAGS
595
- -h, --help Show CLI help.
596
- -v, --verbose
403
+ GLOBAL FLAGS
404
+ --config=<value> Specify config file.
405
+ --json Format output as json.
597
406
 
598
407
  DESCRIPTION
599
- Removes a plugin from the CLI.
408
+ Authorization
600
409
 
601
410
  ALIASES
602
- $ sp plugins unlink
603
- $ sp plugins remove
411
+ $ sp login
604
412
 
605
413
  EXAMPLES
606
- $ sp plugins unlink myplugin
414
+ $ sp login
607
415
  ```
608
416
 
609
- ## `sp plugins update`
610
-
611
- Update installed plugins.
612
-
613
- ```
614
- USAGE
615
- $ sp plugins update [-h] [-v]
616
-
617
- FLAGS
618
- -h, --help Show CLI help.
619
- -v, --verbose
620
-
621
- DESCRIPTION
622
- Update installed plugins.
623
- ```
624
-
625
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.50/src/commands/plugins/update.ts)_
626
-
627
417
  ## `sp storage base`
628
418
 
629
419
  ```
@@ -635,7 +425,7 @@ GLOBAL FLAGS
635
425
  --json Format output as json.
636
426
  ```
637
427
 
638
- _See code: [src/commands/storage/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/storage/base.ts)_
428
+ _See code: [src/commands/storage/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/storage/base.ts)_
639
429
 
640
430
  ## `sp storage create`
641
431
 
@@ -664,7 +454,7 @@ EXAMPLES
664
454
  $ sp storage create --not-default
665
455
  ```
666
456
 
667
- _See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/storage/create.ts)_
457
+ _See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/storage/create.ts)_
668
458
 
669
459
  ## `sp storage select`
670
460
 
@@ -690,7 +480,7 @@ EXAMPLES
690
480
  $ sp storage select --id=2de3e3a4-0000-1111-2222-333344445555
691
481
  ```
692
482
 
693
- _See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/storage/select.ts)_
483
+ _See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/storage/select.ts)_
694
484
 
695
485
  ## `sp storage update`
696
486
 
@@ -717,5 +507,5 @@ EXAMPLES
717
507
  $ sp storage update --id=2de3e3a4-0000-1111-2222-333344445555
718
508
  ```
719
509
 
720
- _See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.2/src/commands/storage/update.ts)_
510
+ _See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.5/src/commands/storage/update.ts)_
721
511
  <!-- commandsstop -->
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../base.js';
2
2
  export default class SpLogin extends BaseCommand<typeof SpLogin> {
3
+ static aliases: string[];
3
4
  static description: string;
4
5
  static examples: string[];
5
6
  checkStorage(): Promise<void>;
@@ -2,6 +2,7 @@ import { AuthService } from '../../services/auth.service.js';
2
2
  import { StorageService } from '../../services/storage.service.js';
3
3
  import { BaseCommand } from '../base.js';
4
4
  export default class SpLogin extends BaseCommand {
5
+ static aliases = ['login'];
5
6
  static description = 'Authorization';
6
7
  static examples = [
7
8
  `<%= config.bin %> <%= command.id %>
@@ -13,7 +14,7 @@ export default class SpLogin extends BaseCommand {
13
14
  const storageService = new StorageService(providerClient, this.logger);
14
15
  if (!await storageService.hasStorage()) {
15
16
  this.logger.info('Requesting default storage');
16
- const { id, isCentralized, storageType } = await storageService.initStorage();
17
+ const { id, isCentralized, storageType } = await storageService.getCentralizedStorage();
17
18
  this.logger.info({ id, isCentralized, storageType }, 'Requested new storage');
18
19
  await storageService.saveStorage(id);
19
20
  }
@@ -42,5 +43,6 @@ export default class SpLogin extends BaseCommand {
42
43
  this.logger.error({ err: error }, 'Storage initialization failed');
43
44
  this.warn('Storage initialization failed. You can set up storage later using "sp storage create" or "sp storage select".');
44
45
  }
46
+ this.log('Successfully authorized');
45
47
  }
46
48
  }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../base.js';
2
+ export default class FilesDownload extends BaseCommand<typeof FilesDownload> {
3
+ static args: {
4
+ resourceFile: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ localDirectory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ 'maximum-concurrent': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ static help: string;
13
+ init(): Promise<void>;
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,53 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { StorageService } from '../../services/storage.service.js';
3
+ import { createProgressPrinter } from '../../utils/progress.js';
4
+ import { BaseCommand } from '../base.js';
5
+ export default class FilesDownload extends BaseCommand {
6
+ static args = {
7
+ resourceFile: Args.string({ description: 'Path to a resource file', required: true }),
8
+ // eslint-disable-next-line perfectionist/sort-objects
9
+ localDirectory: Args.string({ description: 'Path to save downloaded file', required: true }),
10
+ };
11
+ static description = 'describe the command here';
12
+ static examples = [
13
+ '<%= config.bin %> <%= command.id %> ./resource.json ./pathToDownload ',
14
+ ];
15
+ static flags = {
16
+ 'maximum-concurrent': Flags.integer({
17
+ default: 1, description: 'Maximum concurrent pieces to upload at once per transfer', max: 1000, min: 1,
18
+ }),
19
+ };
20
+ static help = 'Download and decrypt a file from the remote storage to <localPath> using resource file <resourcePath>';
21
+ async init() {
22
+ await super.init();
23
+ await this.container.initProviderClient({ enableAuth: false }).initConfigManager().build();
24
+ }
25
+ async run() {
26
+ const { args, flags } = await this.parse(FilesDownload);
27
+ const { providerClient } = this.container;
28
+ const storageSerivce = new StorageService(providerClient, this.logger);
29
+ const progress = createProgressPrinter({
30
+ action: 'Download',
31
+ start: 'Downloading: ',
32
+ });
33
+ try {
34
+ await storageSerivce.download({
35
+ downloadPath: args.localDirectory,
36
+ maximumConcurrent: flags['maximum-concurrent'],
37
+ resourcePath: args.resourceFile,
38
+ }, ({ current, key, total }) => {
39
+ progress.advance(key, current / total * 100, `Downloading: ${key} [${current}/${total}]`);
40
+ });
41
+ progress.finish();
42
+ }
43
+ catch (error) {
44
+ let reason = '';
45
+ this.logger.error({ err: error }, 'Error trying download');
46
+ if (error instanceof Error) {
47
+ reason = error.message;
48
+ }
49
+ this.error(`Download aborted. Reason: ${reason}`);
50
+ }
51
+ this.log('Download successful completed');
52
+ }
53
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseCommand } from '../base.js';
2
+ export default class FilesUpload extends BaseCommand<typeof FilesUpload> {
3
+ static args: {
4
+ path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ filename: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'maximum-concurrent': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ metadata: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'skip-encryption': import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ sync: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ };
16
+ init(): Promise<void>;
17
+ run(): Promise<void>;
18
+ }