@super-protocol/sp-cli 0.0.2-beta.9 → 0.0.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.
Files changed (43) hide show
  1. package/README.md +134 -65
  2. package/bin/dev.js +1 -1
  3. package/dist/commands/account/get-sppi.d.ts +8 -0
  4. package/dist/commands/account/get-sppi.js +23 -0
  5. package/dist/commands/account/info.d.ts +1 -0
  6. package/dist/commands/account/info.js +5 -2
  7. package/dist/commands/auth/login.d.ts +4 -1
  8. package/dist/commands/auth/login.js +4 -2
  9. package/dist/commands/config/add.js +1 -16
  10. package/dist/commands/config/base.d.ts +1 -0
  11. package/dist/commands/config/base.js +22 -4
  12. package/dist/commands/config/create.js +1 -11
  13. package/dist/commands/config/list.js +20 -19
  14. package/dist/commands/files/download.js +8 -6
  15. package/dist/commands/files/upload.js +8 -6
  16. package/dist/commands/storage/base.js +3 -1
  17. package/dist/commands/storage/select.d.ts +4 -4
  18. package/dist/commands/storage/select.js +15 -21
  19. package/dist/commands/storage/show.d.ts +17 -0
  20. package/dist/commands/storage/show.js +36 -0
  21. package/dist/commands/workflows/extend-lease.d.ts +17 -0
  22. package/dist/commands/workflows/extend-lease.js +94 -0
  23. package/dist/config/config.schema.d.ts +9 -0
  24. package/dist/config/config.schema.js +5 -0
  25. package/dist/constants.d.ts +3 -0
  26. package/dist/constants.js +3 -0
  27. package/dist/hooks/finally/shutdown-blockchain.d.ts +3 -0
  28. package/dist/hooks/finally/shutdown-blockchain.js +8 -0
  29. package/dist/lib/container.d.ts +1 -0
  30. package/dist/lib/container.js +23 -1
  31. package/dist/managers/account-manager.d.ts +1 -0
  32. package/dist/managers/account-manager.js +17 -13
  33. package/dist/managers/config-file-manager.d.ts +1 -1
  34. package/dist/managers/config-file-manager.js +16 -4
  35. package/dist/services/storage.service.d.ts +3 -1
  36. package/dist/services/storage.service.js +87 -44
  37. package/dist/utils/helper.d.ts +1 -0
  38. package/dist/utils/helper.js +1 -0
  39. package/dist/utils/progress.js +10 -2
  40. package/oclif.manifest.json +190 -151
  41. package/package.json +10 -6
  42. package/dist/config/resource.schema.d.ts +0 -31
  43. package/dist/config/resource.schema.js +0 -14
@@ -1,84 +1,11 @@
1
1
  {
2
2
  "commands": {
3
- "base": {
4
- "aliases": [],
5
- "args": {},
6
- "flags": {
7
- "json": {
8
- "description": "Format output as json.",
9
- "helpGroup": "GLOBAL",
10
- "name": "json",
11
- "allowNo": false,
12
- "type": "boolean"
13
- },
14
- "config": {
15
- "helpGroup": "GLOBAL",
16
- "name": "config",
17
- "required": false,
18
- "summary": "Specify config file.",
19
- "hasDynamicHelp": false,
20
- "multiple": false,
21
- "type": "option"
22
- }
23
- },
24
- "hasDynamicHelp": false,
25
- "hiddenAliases": [],
26
- "id": "base",
27
- "pluginAlias": "@super-protocol/sp-cli",
28
- "pluginName": "@super-protocol/sp-cli",
29
- "pluginType": "core",
30
- "strict": true,
31
- "enableJsonFlag": true,
32
- "isESM": true,
33
- "relativePath": [
34
- "dist",
35
- "commands",
36
- "base.js"
37
- ]
38
- },
39
- "account:info": {
40
- "aliases": [],
41
- "args": {},
42
- "flags": {
43
- "json": {
44
- "description": "Format output as json.",
45
- "helpGroup": "GLOBAL",
46
- "name": "json",
47
- "allowNo": false,
48
- "type": "boolean"
49
- },
50
- "config": {
51
- "helpGroup": "GLOBAL",
52
- "name": "config",
53
- "required": false,
54
- "summary": "Specify config file.",
55
- "hasDynamicHelp": false,
56
- "multiple": false,
57
- "type": "option"
58
- }
59
- },
60
- "hasDynamicHelp": false,
61
- "hiddenAliases": [],
62
- "id": "account:info",
63
- "pluginAlias": "@super-protocol/sp-cli",
64
- "pluginName": "@super-protocol/sp-cli",
65
- "pluginType": "core",
66
- "strict": true,
67
- "enableJsonFlag": true,
68
- "isESM": true,
69
- "relativePath": [
70
- "dist",
71
- "commands",
72
- "account",
73
- "info.js"
74
- ]
75
- },
76
3
  "auth:login": {
77
4
  "aliases": [
78
5
  "login"
79
6
  ],
80
7
  "args": {},
81
- "description": "Authorization",
8
+ "description": "Login to SuperProtocol (sign up or sign in).",
82
9
  "examples": [
83
10
  "<%= config.bin %> <%= command.id %>\n"
84
11
  ],
@@ -208,34 +135,6 @@
208
135
  "add.js"
209
136
  ]
210
137
  },
211
- "config:base": {
212
- "aliases": [],
213
- "args": {},
214
- "flags": {
215
- "json": {
216
- "description": "Format output as json.",
217
- "helpGroup": "GLOBAL",
218
- "name": "json",
219
- "allowNo": false,
220
- "type": "boolean"
221
- }
222
- },
223
- "hasDynamicHelp": false,
224
- "hiddenAliases": [],
225
- "id": "config:base",
226
- "pluginAlias": "@super-protocol/sp-cli",
227
- "pluginName": "@super-protocol/sp-cli",
228
- "pluginType": "core",
229
- "strict": true,
230
- "enableJsonFlag": true,
231
- "isESM": true,
232
- "relativePath": [
233
- "dist",
234
- "commands",
235
- "config",
236
- "base.js"
237
- ]
238
- },
239
138
  "config:create": {
240
139
  "aliases": [],
241
140
  "args": {},
@@ -489,7 +388,7 @@
489
388
  "required": true
490
389
  }
491
390
  },
492
- "description": "describe the command here",
391
+ "description": "Download file or directory described in resource file",
493
392
  "examples": [
494
393
  "<%= config.bin %> <%= command.id %> ./resource.json ./pathToDownload "
495
394
  ],
@@ -511,7 +410,7 @@
511
410
  "type": "option"
512
411
  },
513
412
  "maximum-concurrent": {
514
- "description": "Maximum concurrent pieces to upload at once per transfer",
413
+ "description": "Maximum concurrent pieces to download at once per transfer",
515
414
  "name": "maximum-concurrent",
516
415
  "default": 1,
517
416
  "hasDynamicHelp": false,
@@ -545,7 +444,7 @@
545
444
  "required": true
546
445
  }
547
446
  },
548
- "description": "describe the command here",
447
+ "description": "Upload file or directory to remote storage",
549
448
  "examples": [
550
449
  "<%= config.bin %> <%= command.id %> ./file.txt"
551
450
  ],
@@ -630,9 +529,15 @@
630
529
  "upload.js"
631
530
  ]
632
531
  },
633
- "storage:base": {
532
+ "storage:create": {
634
533
  "aliases": [],
635
534
  "args": {},
535
+ "description": "Create a new storage entry from file or interactive prompts.",
536
+ "examples": [
537
+ "<%= config.bin %> storage create",
538
+ "<%= config.bin %> storage create --fromFile ./storage.json",
539
+ "<%= config.bin %> storage create --not-default"
540
+ ],
636
541
  "flags": {
637
542
  "json": {
638
543
  "description": "Format output as json.",
@@ -649,32 +554,46 @@
649
554
  "hasDynamicHelp": false,
650
555
  "multiple": false,
651
556
  "type": "option"
557
+ },
558
+ "fromFile": {
559
+ "aliases": [
560
+ "fromFile"
561
+ ],
562
+ "char": "f",
563
+ "description": "Path to a JSON file that contains AddStorageDto payload.",
564
+ "name": "fromFile",
565
+ "hasDynamicHelp": false,
566
+ "multiple": false,
567
+ "type": "option"
568
+ },
569
+ "notDefault": {
570
+ "description": "Skip setting the created storage as default.",
571
+ "name": "notDefault",
572
+ "allowNo": false,
573
+ "type": "boolean"
652
574
  }
653
575
  },
654
576
  "hasDynamicHelp": false,
655
577
  "hiddenAliases": [],
656
- "id": "storage:base",
578
+ "id": "storage:create",
657
579
  "pluginAlias": "@super-protocol/sp-cli",
658
580
  "pluginName": "@super-protocol/sp-cli",
659
581
  "pluginType": "core",
660
582
  "strict": true,
661
- "enableJsonFlag": true,
662
583
  "isESM": true,
663
584
  "relativePath": [
664
585
  "dist",
665
586
  "commands",
666
587
  "storage",
667
- "base.js"
588
+ "create.js"
668
589
  ]
669
590
  },
670
- "storage:create": {
591
+ "storage:select": {
671
592
  "aliases": [],
672
593
  "args": {},
673
- "description": "Create a new storage entry from file or interactive prompts.",
594
+ "description": "Select a storage that will be used by subsequent commands.",
674
595
  "examples": [
675
- "<%= config.bin %> storage create",
676
- "<%= config.bin %> storage create --fromFile ./storage.json",
677
- "<%= config.bin %> storage create --not-default"
596
+ "<%= config.bin %> storage select"
678
597
  ],
679
598
  "flags": {
680
599
  "json": {
@@ -692,48 +611,29 @@
692
611
  "hasDynamicHelp": false,
693
612
  "multiple": false,
694
613
  "type": "option"
695
- },
696
- "fromFile": {
697
- "aliases": [
698
- "fromFile"
699
- ],
700
- "char": "f",
701
- "description": "Path to a JSON file that contains AddStorageDto payload.",
702
- "name": "fromFile",
703
- "hasDynamicHelp": false,
704
- "multiple": false,
705
- "type": "option"
706
- },
707
- "notDefault": {
708
- "description": "Skip setting the created storage as default.",
709
- "name": "notDefault",
710
- "allowNo": false,
711
- "type": "boolean"
712
614
  }
713
615
  },
714
616
  "hasDynamicHelp": false,
715
617
  "hiddenAliases": [],
716
- "id": "storage:create",
618
+ "id": "storage:select",
717
619
  "pluginAlias": "@super-protocol/sp-cli",
718
620
  "pluginName": "@super-protocol/sp-cli",
719
621
  "pluginType": "core",
720
622
  "strict": true,
721
- "enableJsonFlag": true,
722
623
  "isESM": true,
723
624
  "relativePath": [
724
625
  "dist",
725
626
  "commands",
726
627
  "storage",
727
- "create.js"
628
+ "select.js"
728
629
  ]
729
630
  },
730
- "storage:select": {
631
+ "storage:show": {
731
632
  "aliases": [],
732
633
  "args": {},
733
- "description": "Select a storage that will be used by subsequent commands.",
634
+ "description": "Show current selected storage",
734
635
  "examples": [
735
- "<%= config.bin %> storage select",
736
- "<%= config.bin %> storage select --id=2de3e3a4-0000-1111-2222-333344445555"
636
+ "<%= config.bin %> <%= command.id %>"
737
637
  ],
738
638
  "flags": {
739
639
  "json": {
@@ -751,30 +651,21 @@
751
651
  "hasDynamicHelp": false,
752
652
  "multiple": false,
753
653
  "type": "option"
754
- },
755
- "id": {
756
- "char": "i",
757
- "description": "Storage ID to select",
758
- "name": "id",
759
- "hasDynamicHelp": false,
760
- "multiple": false,
761
- "type": "option"
762
654
  }
763
655
  },
764
656
  "hasDynamicHelp": false,
765
657
  "hiddenAliases": [],
766
- "id": "storage:select",
658
+ "id": "storage:show",
767
659
  "pluginAlias": "@super-protocol/sp-cli",
768
660
  "pluginName": "@super-protocol/sp-cli",
769
661
  "pluginType": "core",
770
662
  "strict": true,
771
- "enableJsonFlag": true,
772
663
  "isESM": true,
773
664
  "relativePath": [
774
665
  "dist",
775
666
  "commands",
776
667
  "storage",
777
- "select.js"
668
+ "show.js"
778
669
  ]
779
670
  },
780
671
  "storage:update": {
@@ -826,7 +717,6 @@
826
717
  "pluginName": "@super-protocol/sp-cli",
827
718
  "pluginType": "core",
828
719
  "strict": true,
829
- "enableJsonFlag": true,
830
720
  "isESM": true,
831
721
  "relativePath": [
832
722
  "dist",
@@ -834,7 +724,156 @@
834
724
  "storage",
835
725
  "update.js"
836
726
  ]
727
+ },
728
+ "workflows:extend-lease": {
729
+ "aliases": [],
730
+ "args": {
731
+ "orderId": {
732
+ "description": "Order ID",
733
+ "name": "orderId",
734
+ "required": true
735
+ }
736
+ },
737
+ "description": "Replenish deposit for a workflow to extend its lease time",
738
+ "examples": [
739
+ "<%= config.bin %> <%= command.id %> <orderId> --sppi 1.5",
740
+ "<%= config.bin %> <%= command.id %> <orderId> --minutes 120",
741
+ "<%= config.bin %> <%= command.id %> <orderId> --sppi 2 --yes"
742
+ ],
743
+ "flags": {
744
+ "json": {
745
+ "description": "Format output as json.",
746
+ "helpGroup": "GLOBAL",
747
+ "name": "json",
748
+ "allowNo": false,
749
+ "type": "boolean"
750
+ },
751
+ "config": {
752
+ "helpGroup": "GLOBAL",
753
+ "name": "config",
754
+ "required": false,
755
+ "summary": "Specify config file.",
756
+ "hasDynamicHelp": false,
757
+ "multiple": false,
758
+ "type": "option"
759
+ },
760
+ "minutes": {
761
+ "description": "Time to extend order in minutes (automatically calculates tokens)",
762
+ "name": "minutes",
763
+ "hasDynamicHelp": false,
764
+ "multiple": false,
765
+ "type": "option"
766
+ },
767
+ "sppi": {
768
+ "description": "SPPI token amount to add to the order",
769
+ "name": "sppi",
770
+ "hasDynamicHelp": false,
771
+ "multiple": false,
772
+ "type": "option"
773
+ },
774
+ "yes": {
775
+ "char": "y",
776
+ "description": "Skip confirmation prompt",
777
+ "name": "yes",
778
+ "allowNo": false,
779
+ "type": "boolean"
780
+ }
781
+ },
782
+ "hasDynamicHelp": false,
783
+ "hiddenAliases": [],
784
+ "id": "workflows:extend-lease",
785
+ "pluginAlias": "@super-protocol/sp-cli",
786
+ "pluginName": "@super-protocol/sp-cli",
787
+ "pluginType": "core",
788
+ "strict": true,
789
+ "enableJsonFlag": true,
790
+ "isESM": true,
791
+ "relativePath": [
792
+ "dist",
793
+ "commands",
794
+ "workflows",
795
+ "extend-lease.js"
796
+ ]
797
+ },
798
+ "account:get-sppi": {
799
+ "aliases": [],
800
+ "args": {},
801
+ "description": "Get SPPI (Super Protocol incentive tokens) ",
802
+ "examples": [
803
+ "<%= config.bin %> <%= command.id %>"
804
+ ],
805
+ "flags": {
806
+ "json": {
807
+ "description": "Format output as json.",
808
+ "helpGroup": "GLOBAL",
809
+ "name": "json",
810
+ "allowNo": false,
811
+ "type": "boolean"
812
+ },
813
+ "config": {
814
+ "helpGroup": "GLOBAL",
815
+ "name": "config",
816
+ "required": false,
817
+ "summary": "Specify config file.",
818
+ "hasDynamicHelp": false,
819
+ "multiple": false,
820
+ "type": "option"
821
+ }
822
+ },
823
+ "hasDynamicHelp": false,
824
+ "hiddenAliases": [],
825
+ "id": "account:get-sppi",
826
+ "pluginAlias": "@super-protocol/sp-cli",
827
+ "pluginName": "@super-protocol/sp-cli",
828
+ "pluginType": "core",
829
+ "strict": true,
830
+ "enableJsonFlag": true,
831
+ "isESM": true,
832
+ "relativePath": [
833
+ "dist",
834
+ "commands",
835
+ "account",
836
+ "get-sppi.js"
837
+ ]
838
+ },
839
+ "account:info": {
840
+ "aliases": [],
841
+ "args": {},
842
+ "description": "Information about current authorized user",
843
+ "flags": {
844
+ "json": {
845
+ "description": "Format output as json.",
846
+ "helpGroup": "GLOBAL",
847
+ "name": "json",
848
+ "allowNo": false,
849
+ "type": "boolean"
850
+ },
851
+ "config": {
852
+ "helpGroup": "GLOBAL",
853
+ "name": "config",
854
+ "required": false,
855
+ "summary": "Specify config file.",
856
+ "hasDynamicHelp": false,
857
+ "multiple": false,
858
+ "type": "option"
859
+ }
860
+ },
861
+ "hasDynamicHelp": false,
862
+ "hiddenAliases": [],
863
+ "id": "account:info",
864
+ "pluginAlias": "@super-protocol/sp-cli",
865
+ "pluginName": "@super-protocol/sp-cli",
866
+ "pluginType": "core",
867
+ "strict": true,
868
+ "enableJsonFlag": true,
869
+ "isESM": true,
870
+ "relativePath": [
871
+ "dist",
872
+ "commands",
873
+ "account",
874
+ "info.js"
875
+ ]
837
876
  }
838
877
  },
839
- "version": "0.0.2-beta.9"
878
+ "version": "0.0.3"
840
879
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@super-protocol/sp-cli",
3
3
  "description": "SuperProtocol Command line interface",
4
- "version": "0.0.2-beta.9",
4
+ "version": "0.0.3",
5
5
  "author": "SuperProtocol",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -19,9 +19,11 @@
19
19
  "@oclif/plugin-help": "^6.2.33",
20
20
  "@oclif/plugin-warn-if-update-available": "^3.1.50",
21
21
  "@sinclair/typebox": "^0.33.22",
22
- "@super-protocol/dto-js": "^1.3.0",
23
- "@super-protocol/provider-client": "^0.1.8",
24
- "@super-protocol/sp-files-addon": "^0.12.7",
22
+ "@super-protocol/provider-client": "^0.1.9",
23
+ "@super-protocol/sdk-js": "^3.17.1",
24
+ "@super-protocol/dto-js": "^1.3.1",
25
+ "@super-protocol/sp-files-addon": "^0.12.8",
26
+ "console-table-printer": "^2.15.0",
25
27
  "cookie": "^1.0.2",
26
28
  "jsonwebtoken": "^9.0.2",
27
29
  "pino": "^9.14.0",
@@ -77,11 +79,12 @@
77
79
  "globPatterns": [
78
80
  "**/*.+(js|cjs|mjs|ts|tsx|mts|cts)",
79
81
  "!**/*.+(d.*|test.*|spec.*|helpers.*)?(x)",
80
- "!**/base.ts"
82
+ "!**/base.(ts|js)"
81
83
  ]
82
84
  },
83
85
  "plugins": [
84
86
  "@oclif/plugin-help",
87
+ "@oclif/plugin-autocomplete",
85
88
  "@oclif/plugin-warn-if-update-available"
86
89
  ],
87
90
  "warn-if-update-available": {
@@ -98,7 +101,8 @@
98
101
  "identifier": "com.super-protocol.cli"
99
102
  },
100
103
  "hooks": {
101
- "init": "./dist/hooks/init/init-container"
104
+ "init": "./dist/hooks/init/init-container",
105
+ "finally": "./dist/hooks/finally/shutdown-blockchain"
102
106
  }
103
107
  },
104
108
  "repository": "git+ssh://git@github.com/Super-Protocol/sp-cli.git",
@@ -1,31 +0,0 @@
1
- import { ResourceType, StorageType } from '@super-protocol/provider-client';
2
- import { Type } from 'typebox';
3
- export declare const storageResourceSchema: Type.TObject<{
4
- hash: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TObject<{
5
- algo: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TEnum<typeof import("@super-protocol/dto-js").HashAlgorithm>;
6
- hash: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
7
- encoding: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TEnum<typeof import("@super-protocol/dto-js").Encoding>;
8
- }>;
9
- resource: Type.TObject<{
10
- credentials: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TUnion<[import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TIntersect<[import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TObject<{
11
- bucket: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
12
- prefix: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
13
- }>, import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TObject<{
14
- token: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
15
- }>]>, import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TIntersect<[import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TObject<{
16
- bucket: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
17
- prefix: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
18
- }>, import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TObject<{
19
- accessKeyId: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
20
- secretKey: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
21
- endpoint: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
22
- }>]>, import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TObject<{
23
- bucket: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
24
- prefix: import("@sinclair/typebox", { with: { "resolution-mode": "require" } }).TString;
25
- }>]>;
26
- filepath: Type.TString;
27
- storageType: Type.TEnum<[StorageType.S3, StorageType.FS, StorageType.StorJ]>;
28
- type: Type.TEnum<[ResourceType.StorageProvider, ResourceType.Url]>;
29
- }>;
30
- size: Type.TNumber;
31
- }>;
@@ -1,14 +0,0 @@
1
- import { HashSchema, StorageAccessCredentialsSchema } from '@super-protocol/dto-js';
2
- import { ResourceType, StorageType } from '@super-protocol/provider-client';
3
- import { Type } from 'typebox';
4
- const storageProviderResourceSchema = Type.Object({
5
- credentials: StorageAccessCredentialsSchema,
6
- filepath: Type.String({ minLength: 1 }),
7
- storageType: Type.Enum(StorageType),
8
- type: Type.Enum(ResourceType),
9
- });
10
- export const storageResourceSchema = Type.Object({
11
- hash: HashSchema,
12
- resource: storageProviderResourceSchema,
13
- size: Type.Number({ minimum: 0 }),
14
- });