@apollo-annotation/cli 0.1.17 → 0.1.19

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 (47) hide show
  1. package/README.md +120 -58
  2. package/bin/dev.js +2 -2
  3. package/bin/run.js +2 -2
  4. package/dist/ApolloConf.d.ts +22 -0
  5. package/dist/ApolloConf.js +144 -0
  6. package/dist/baseCommand.js +7 -17
  7. package/dist/commands/assembly/add-fasta.js +16 -27
  8. package/dist/commands/assembly/add-gff.js +11 -24
  9. package/dist/commands/assembly/check.js +7 -18
  10. package/dist/commands/assembly/delete.js +1 -1
  11. package/dist/commands/assembly/get.test.js +3 -3
  12. package/dist/commands/assembly/sequence.js +7 -21
  13. package/dist/commands/change/get.test.js +1 -1
  14. package/dist/commands/config.js +21 -53
  15. package/dist/commands/feature/add-child.js +21 -29
  16. package/dist/commands/feature/check.js +5 -5
  17. package/dist/commands/feature/copy.js +20 -32
  18. package/dist/commands/feature/delete.js +16 -31
  19. package/dist/commands/feature/edit-attribute.js +15 -10
  20. package/dist/commands/feature/edit-coords.js +39 -27
  21. package/dist/commands/feature/edit-type.js +5 -8
  22. package/dist/commands/feature/edit.js +3 -16
  23. package/dist/commands/feature/get-id.js +0 -1
  24. package/dist/commands/feature/get.js +6 -18
  25. package/dist/commands/feature/import.js +22 -41
  26. package/dist/commands/feature/search.js +1 -1
  27. package/dist/commands/login.js +17 -29
  28. package/dist/commands/logout.js +5 -14
  29. package/dist/commands/refseq/add-alias.d.ts +14 -0
  30. package/dist/commands/refseq/add-alias.js +72 -0
  31. package/dist/commands/status.js +5 -13
  32. package/dist/commands/user/get.test.js +1 -1
  33. package/dist/test/fixtures.js +2 -2
  34. package/dist/utils.d.ts +3 -3
  35. package/dist/utils.js +50 -25
  36. package/oclif.manifest.json +163 -102
  37. package/package.json +11 -3
  38. package/dist/Config.d.ts +0 -43
  39. package/dist/Config.js +0 -233
  40. package/dist/commands/config.test.d.ts +0 -1
  41. package/dist/commands/config.test.js +0 -188
  42. package/dist/commands/login.test.d.ts +0 -1
  43. package/dist/commands/login.test.js +0 -52
  44. package/dist/commands/logout.test.d.ts +0 -1
  45. package/dist/commands/logout.test.js +0 -67
  46. package/dist/commands/status.test.d.ts +0 -1
  47. package/dist/commands/status.test.js +0 -54
package/README.md CHANGED
@@ -1,56 +1,61 @@
1
1
  # Table of contents
2
2
 
3
3
  <!-- toc -->
4
- * [Table of contents](#table-of-contents)
5
- * [Usage](#usage)
6
- * [Commands](#commands)
4
+
5
+ - [Table of contents](#table-of-contents)
6
+ - [Usage](#usage)
7
+ - [Commands](#commands)
7
8
  <!-- tocstop -->
8
9
 
9
10
  # Usage
10
11
 
11
12
  <!-- usage -->
13
+
12
14
  ```sh-session
13
15
  $ npm install -g @apollo-annotation/cli
14
16
  $ apollo COMMAND
15
17
  running command...
16
18
  $ apollo (--version)
17
- @apollo-annotation/cli/0.1.17 linux-x64 node-v18.20.3
19
+ @apollo-annotation/cli/0.1.19 linux-x64 node-v20.14.0
18
20
  $ apollo --help [COMMAND]
19
21
  USAGE
20
22
  $ apollo COMMAND
21
23
  ...
22
24
  ```
25
+
23
26
  <!-- usagestop -->
24
27
 
25
28
  # Commands
26
29
 
27
30
  <!-- commands -->
28
- * [`apollo assembly add-fasta`](#apollo-assembly-add-fasta)
29
- * [`apollo assembly add-gff`](#apollo-assembly-add-gff)
30
- * [`apollo assembly check`](#apollo-assembly-check)
31
- * [`apollo assembly delete`](#apollo-assembly-delete)
32
- * [`apollo assembly get`](#apollo-assembly-get)
33
- * [`apollo assembly sequence`](#apollo-assembly-sequence)
34
- * [`apollo change get`](#apollo-change-get)
35
- * [`apollo config [KEY] [VALUE]`](#apollo-config-key-value)
36
- * [`apollo feature add-child`](#apollo-feature-add-child)
37
- * [`apollo feature check`](#apollo-feature-check)
38
- * [`apollo feature copy`](#apollo-feature-copy)
39
- * [`apollo feature delete`](#apollo-feature-delete)
40
- * [`apollo feature edit`](#apollo-feature-edit)
41
- * [`apollo feature edit-attribute`](#apollo-feature-edit-attribute)
42
- * [`apollo feature edit-coords`](#apollo-feature-edit-coords)
43
- * [`apollo feature edit-type`](#apollo-feature-edit-type)
44
- * [`apollo feature get`](#apollo-feature-get)
45
- * [`apollo feature get-id`](#apollo-feature-get-id)
46
- * [`apollo feature import`](#apollo-feature-import)
47
- * [`apollo feature search`](#apollo-feature-search)
48
- * [`apollo help [COMMANDS]`](#apollo-help-commands)
49
- * [`apollo login`](#apollo-login)
50
- * [`apollo logout`](#apollo-logout)
51
- * [`apollo refseq get`](#apollo-refseq-get)
52
- * [`apollo status`](#apollo-status)
53
- * [`apollo user get`](#apollo-user-get)
31
+
32
+ - [`apollo assembly add-fasta`](#apollo-assembly-add-fasta)
33
+ - [`apollo assembly add-gff`](#apollo-assembly-add-gff)
34
+ - [`apollo assembly check`](#apollo-assembly-check)
35
+ - [`apollo assembly delete`](#apollo-assembly-delete)
36
+ - [`apollo assembly get`](#apollo-assembly-get)
37
+ - [`apollo assembly sequence`](#apollo-assembly-sequence)
38
+ - [`apollo change get`](#apollo-change-get)
39
+ - [`apollo config [KEY] [VALUE]`](#apollo-config-key-value)
40
+ - [`apollo feature add-child`](#apollo-feature-add-child)
41
+ - [`apollo feature check`](#apollo-feature-check)
42
+ - [`apollo feature copy`](#apollo-feature-copy)
43
+ - [`apollo feature delete`](#apollo-feature-delete)
44
+ - [`apollo feature edit`](#apollo-feature-edit)
45
+ - [`apollo feature edit-attribute`](#apollo-feature-edit-attribute)
46
+ - [`apollo feature edit-coords`](#apollo-feature-edit-coords)
47
+ - [`apollo feature edit-type`](#apollo-feature-edit-type)
48
+ - [`apollo feature get`](#apollo-feature-get)
49
+ - [`apollo feature get-id`](#apollo-feature-get-id)
50
+ - [`apollo feature import`](#apollo-feature-import)
51
+ - [`apollo feature search`](#apollo-feature-search)
52
+ - [`apollo help [COMMANDS]`](#apollo-help-commands)
53
+ - [`apollo login`](#apollo-login)
54
+ - [`apollo logout`](#apollo-logout)
55
+ - [`apollo refseq add-alias`](#apollo-refseq-add-alias)
56
+ - [`apollo refseq get`](#apollo-refseq-get)
57
+ - [`apollo status`](#apollo-status)
58
+ - [`apollo user get`](#apollo-user-get)
54
59
 
55
60
  ## `apollo assembly add-fasta`
56
61
 
@@ -82,7 +87,8 @@ EXAMPLES
82
87
  $ apollo assembly add-fasta -i https://.../genome.fa -x https://.../genome.fa.fai -a myAssembly
83
88
  ```
84
89
 
85
- _See code: [src/commands/assembly/add-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/assembly/add-fasta.ts)_
90
+ _See code:
91
+ [src/commands/assembly/add-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/assembly/add-fasta.ts)_
86
92
 
87
93
  ## `apollo assembly add-gff`
88
94
 
@@ -116,7 +122,8 @@ EXAMPLES
116
122
  $ apollo assembly add-gff -i genome.gff -a myAssembly -o
117
123
  ```
118
124
 
119
- _See code: [src/commands/assembly/add-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/assembly/add-gff.ts)_
125
+ _See code:
126
+ [src/commands/assembly/add-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/assembly/add-gff.ts)_
120
127
 
121
128
  ## `apollo assembly check`
122
129
 
@@ -137,8 +144,8 @@ DESCRIPTION
137
144
  Add, view, or delete checks to assembly
138
145
 
139
146
  Manage checks, i.e. the rules ensuring features in an assembly are plausible.
140
- This command only sets the check to apply, to retrieve features flagged by these
141
- checks use `apollo feature check`.
147
+ This command only sets the checks to apply, to retrieve features flagged by
148
+ these checks use `apollo feature check`.
142
149
 
143
150
  EXAMPLES
144
151
  View available check types:
@@ -158,7 +165,8 @@ EXAMPLES
158
165
  $ apollo assembly check -a hg19 -c CDSCheck --delete
159
166
  ```
160
167
 
161
- _See code: [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/assembly/check.ts)_
168
+ _See code:
169
+ [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/assembly/check.ts)_
162
170
 
163
171
  ## `apollo assembly delete`
164
172
 
@@ -185,7 +193,8 @@ EXAMPLES
185
193
  $ apollo assembly delete -a mouse 6605826fbd0eee691f83e73f
186
194
  ```
187
195
 
188
- _See code: [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/assembly/delete.ts)_
196
+ _See code:
197
+ [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/assembly/delete.ts)_
189
198
 
190
199
  ## `apollo assembly get`
191
200
 
@@ -206,7 +215,8 @@ DESCRIPTION
206
215
  Print to stdout the list of assemblies in json format
207
216
  ```
208
217
 
209
- _See code: [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/assembly/get.ts)_
218
+ _See code:
219
+ [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/assembly/get.ts)_
210
220
 
211
221
  ## `apollo assembly sequence`
212
222
 
@@ -240,7 +250,8 @@ EXAMPLES
240
250
  $ apollo assembly sequence -a myAssembly -r chr1 -s 1 -e 1000
241
251
  ```
242
252
 
243
- _See code: [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/assembly/sequence.ts)_
253
+ _See code:
254
+ [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/assembly/sequence.ts)_
244
255
 
245
256
  ## `apollo change get`
246
257
 
@@ -264,7 +275,8 @@ DESCRIPTION
264
275
  need to use the assembly ID.
265
276
  ```
266
277
 
267
- _See code: [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/change/get.ts)_
278
+ _See code:
279
+ [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/change/get.ts)_
268
280
 
269
281
  ## `apollo config [KEY] [VALUE]`
270
282
 
@@ -319,7 +331,8 @@ EXAMPLES
319
331
  $ apollo config address
320
332
  ```
321
333
 
322
- _See code: [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/config.ts)_
334
+ _See code:
335
+ [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/config.ts)_
323
336
 
324
337
  ## `apollo feature add-child`
325
338
 
@@ -349,7 +362,8 @@ EXAMPLES
349
362
  $ apollo feature add-child -i 6605826fbd0eee691f83e73f -t exon -s 10 -e 20
350
363
  ```
351
364
 
352
- _See code: [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/add-child.ts)_
365
+ _See code:
366
+ [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/add-child.ts)_
353
367
 
354
368
  ## `apollo feature check`
355
369
 
@@ -382,7 +396,8 @@ EXAMPLES
382
396
  $ apollo feature check -a hg19
383
397
  ```
384
398
 
385
- _See code: [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/check.ts)_
399
+ _See code:
400
+ [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/check.ts)_
386
401
 
387
402
  ## `apollo feature copy`
388
403
 
@@ -413,7 +428,8 @@ EXAMPLES
413
428
  $ apollo feature copy -i 6605826fbd0eee691f83e73f -r chr1 -s 100 -a hg38
414
429
  ```
415
430
 
416
- _See code: [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/copy.ts)_
431
+ _See code:
432
+ [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/copy.ts)_
417
433
 
418
434
  ## `apollo feature delete`
419
435
 
@@ -437,7 +453,8 @@ DESCRIPTION
437
453
  error unless you set -f/--force.
438
454
  ```
439
455
 
440
- _See code: [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/delete.ts)_
456
+ _See code:
457
+ [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/delete.ts)_
441
458
 
442
459
  ## `apollo feature edit`
443
460
 
@@ -479,7 +496,8 @@ EXAMPLES
479
496
  echo '{"typeName": ... "newType": "G_quartet"}' | apollo feature edit -j -
480
497
  ```
481
498
 
482
- _See code: [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/edit.ts)_
499
+ _See code:
500
+ [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/edit.ts)_
483
501
 
484
502
  ## `apollo feature edit-attribute`
485
503
 
@@ -519,7 +537,8 @@ EXAMPLES
519
537
  $ apollo feature edit-attribute -i 66...3f -a domains -d
520
538
  ```
521
539
 
522
- _See code: [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
540
+ _See code:
541
+ [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
523
542
 
524
543
  ## `apollo feature edit-coords`
525
544
 
@@ -553,7 +572,8 @@ EXAMPLES
553
572
  $ apollo feature edit-coords -i abc...xyz -e 2000
554
573
  ```
555
574
 
556
- _See code: [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
575
+ _See code:
576
+ [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
557
577
 
558
578
  ## `apollo feature edit-type`
559
579
 
@@ -576,7 +596,8 @@ DESCRIPTION
576
596
  term although but the valifdity of the new term is not checked.
577
597
  ```
578
598
 
579
- _See code: [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/edit-type.ts)_
599
+ _See code:
600
+ [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/edit-type.ts)_
580
601
 
581
602
  ## `apollo feature get`
582
603
 
@@ -609,7 +630,8 @@ EXAMPLES
609
630
  $ apollo feature get -a myAssembly -r chr1 -s 1 -e 1000
610
631
  ```
611
632
 
612
- _See code: [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/get.ts)_
633
+ _See code:
634
+ [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/get.ts)_
613
635
 
614
636
  ## `apollo feature get-id`
615
637
 
@@ -638,7 +660,8 @@ EXAMPLES
638
660
  $ apollo feature get-id -i abc...zyz def...foo
639
661
  ```
640
662
 
641
- _See code: [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/get-id.ts)_
663
+ _See code:
664
+ [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/get-id.ts)_
642
665
 
643
666
  ## `apollo feature import`
644
667
 
@@ -666,7 +689,8 @@ EXAMPLES
666
689
  $ apollo feature import -d -i features.gff3 -a myAssembly
667
690
  ```
668
691
 
669
- _See code: [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/import.ts)_
692
+ _See code:
693
+ [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/import.ts)_
670
694
 
671
695
  ## `apollo feature search`
672
696
 
@@ -717,7 +741,8 @@ EXAMPLES
717
741
  $ apollo feature search -a mm9 mm10 -t bac
718
742
  ```
719
743
 
720
- _See code: [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/feature/search.ts)_
744
+ _See code:
745
+ [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/feature/search.ts)_
721
746
 
722
747
  ## `apollo help [COMMANDS]`
723
748
 
@@ -737,7 +762,8 @@ DESCRIPTION
737
762
  Display help for apollo.
738
763
  ```
739
764
 
740
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.8/src/commands/help.ts)_
765
+ _See code:
766
+ [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.8/src/commands/help.ts)_
741
767
 
742
768
  ## `apollo login`
743
769
 
@@ -777,7 +803,8 @@ EXAMPLES
777
803
  $ apollo login --profile my-profile
778
804
  ```
779
805
 
780
- _See code: [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/login.ts)_
806
+ _See code:
807
+ [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/login.ts)_
781
808
 
782
809
  ## `apollo logout`
783
810
 
@@ -806,7 +833,38 @@ EXAMPLES
806
833
  $ apollo logout --profile my-profile
807
834
  ```
808
835
 
809
- _See code: [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/logout.ts)_
836
+ _See code:
837
+ [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/logout.ts)_
838
+
839
+ ## `apollo refseq add-alias`
840
+
841
+ Add reference name aliases from a file
842
+
843
+ ```
844
+ USAGE
845
+ $ apollo refseq add-alias -i <value> -a <value> [--profile <value>] [--config-file <value>]
846
+
847
+ FLAGS
848
+ -a, --assembly=<value> (required) Name for this assembly.
849
+ -i, --input-file=<value> (required) Input refname alias file
850
+ --config-file=<value> Use this config file (mostly for testing)
851
+ --profile=<value> Use credentials from this profile
852
+
853
+ DESCRIPTION
854
+ Add reference name aliases from a file
855
+
856
+ Reference name aliasing is a process to make chromosomes that are named slightly
857
+ differently but which refer to the same thing render properly. This command
858
+ reads a file with reference name aliases and adds them to the database.
859
+
860
+ EXAMPLES
861
+ Add reference name aliases:
862
+
863
+ $ apollo refseq add-alias -i alias.txt -a myAssembly
864
+ ```
865
+
866
+ _See code:
867
+ [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
810
868
 
811
869
  ## `apollo refseq get`
812
870
 
@@ -838,7 +896,8 @@ EXAMPLES
838
896
  $ apollo refseq get -a mm9 mm10
839
897
  ```
840
898
 
841
- _See code: [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/refseq/get.ts)_
899
+ _See code:
900
+ [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/refseq/get.ts)_
842
901
 
843
902
  ## `apollo status`
844
903
 
@@ -860,7 +919,8 @@ DESCRIPTION
860
919
  not check the validity of the access token.
861
920
  ```
862
921
 
863
- _See code: [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/status.ts)_
922
+ _See code:
923
+ [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/status.ts)_
864
924
 
865
925
  ## `apollo user get`
866
926
 
@@ -895,5 +955,7 @@ EXAMPLES
895
955
  $ apollo user get | jq '.[] | select(.createdAt > "2024-03-18")'
896
956
  ```
897
957
 
898
- _See code: [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.17/packages/apollo-cli/src/commands/user/get.ts)_
958
+ _See code:
959
+ [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.1.19/packages/apollo-cli/src/commands/user/get.ts)_
960
+
899
961
  <!-- commandsstop -->
package/bin/dev.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  // eslint-disable-next-line node/shebang
4
4
  async function main() {
5
- const {execute} = await import('@oclif/core')
6
- await execute({development: true, dir: import.meta.url})
5
+ const { execute } = await import('@oclif/core')
6
+ await execute({ development: true, dir: import.meta.url })
7
7
  }
8
8
 
9
9
  await main()
package/bin/run.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  async function main() {
4
- const {execute} = await import('@oclif/core')
5
- await execute({dir: import.meta.url})
4
+ const { execute } = await import('@oclif/core')
5
+ await execute({ dir: import.meta.url })
6
6
  }
7
7
 
8
8
  await main()
@@ -0,0 +1,22 @@
1
+ import Conf from 'conf';
2
+ export declare class ConfigError extends Error {
3
+ }
4
+ export declare enum KEYS {
5
+ address = "address",
6
+ accessType = "accessType",
7
+ accessToken = "accessToken",
8
+ rootCredentials_username = "rootCredentials.username",
9
+ rootCredentials_password = "rootCredentials.password"
10
+ }
11
+ export declare function optionDesc(): string[];
12
+ export declare class ApolloConf extends Conf {
13
+ constructor(configFile: string);
14
+ get store(): Record<string, unknown>;
15
+ set store(newStore: Record<string, unknown>);
16
+ getProfileNames(): string[];
17
+ setAccessType(profileName: string, accessType: string): void;
18
+ getAccess(profileName: string): Promise<{
19
+ address: string;
20
+ accessToken: string;
21
+ }>;
22
+ }
@@ -0,0 +1,144 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import Conf from 'conf';
5
+ import Joi from 'joi';
6
+ import YAML from 'yaml';
7
+ import { checkProfileExists, queryApollo } from './utils.js';
8
+ export class ConfigError extends Error {
9
+ }
10
+ export var KEYS;
11
+ (function (KEYS) {
12
+ KEYS["address"] = "address";
13
+ KEYS["accessType"] = "accessType";
14
+ KEYS["accessToken"] = "accessToken";
15
+ KEYS["rootCredentials_username"] = "rootCredentials.username";
16
+ KEYS["rootCredentials_password"] = "rootCredentials.password";
17
+ })(KEYS || (KEYS = {}));
18
+ function optionDocs() {
19
+ const docs = [];
20
+ for (const v of Object.values(KEYS)) {
21
+ switch (v) {
22
+ case 'address': {
23
+ docs.push({
24
+ key: v,
25
+ description: 'Address and port e.g http://localhost:3999',
26
+ });
27
+ break;
28
+ }
29
+ case 'accessType': {
30
+ docs.push({
31
+ key: v,
32
+ description: 'How to access Apollo. accessType is typically one of: google, microsoft, guest, root. Allowed types depend on your Apollo setup',
33
+ });
34
+ break;
35
+ }
36
+ case 'accessToken': {
37
+ docs.push({
38
+ key: v,
39
+ description: 'Access token. Usually inserted by `apollo login`',
40
+ });
41
+ break;
42
+ }
43
+ case 'rootCredentials.username': {
44
+ docs.push({
45
+ key: v,
46
+ description: 'Username of root account. Only set this for "root" access type',
47
+ });
48
+ break;
49
+ }
50
+ case 'rootCredentials.password': {
51
+ docs.push({
52
+ key: v,
53
+ description: 'Password for root account. Only set this for "root" access type',
54
+ });
55
+ break;
56
+ }
57
+ default: {
58
+ throw new ConfigError(`Unexpected key: ${v}`);
59
+ }
60
+ }
61
+ }
62
+ return docs;
63
+ }
64
+ export function optionDesc() {
65
+ const docs = [];
66
+ for (const x of optionDocs()) {
67
+ docs.push(`- ${x.key}:\n${x.description}`);
68
+ }
69
+ return docs;
70
+ }
71
+ export class ApolloConf extends Conf {
72
+ constructor(configFile) {
73
+ let APOLLO_DISABLE_CONFIG_CREATE = false;
74
+ if (process.env.APOLLO_DISABLE_CONFIG_CREATE !== undefined &&
75
+ process.env.APOLLO_DISABLE_CONFIG_CREATE !== '0') {
76
+ APOLLO_DISABLE_CONFIG_CREATE = true;
77
+ }
78
+ if (APOLLO_DISABLE_CONFIG_CREATE && !fs.existsSync(configFile)) {
79
+ throw new ConfigError('Configuration file does not exist yet, please create it as an empty file first.');
80
+ }
81
+ super({
82
+ projectName: 'apollo-cli',
83
+ fileExtension: path.parse(configFile).ext.replace(/^\./, ''),
84
+ configName: path.parse(configFile).name,
85
+ cwd: path.dirname(configFile),
86
+ serialize: YAML.stringify,
87
+ deserialize: YAML.parse,
88
+ });
89
+ const v = configSchema.validate(this.store);
90
+ if (v.error?.message !== undefined) {
91
+ throw new Error(`Invalid setting: ${v.error.message}`);
92
+ }
93
+ }
94
+ get store() {
95
+ const superStore = super.store;
96
+ const v = configSchema.validate(superStore);
97
+ if (v.error?.message !== undefined) {
98
+ throw new ConfigError(`Invalid key: ${v.error.message}`);
99
+ }
100
+ return superStore;
101
+ }
102
+ set store(newStore) {
103
+ const v = configSchema.validate(newStore);
104
+ if (v.error?.message !== undefined) {
105
+ throw new ConfigError(`Invalid setting: ${v.error.message}`);
106
+ }
107
+ super.store = newStore;
108
+ }
109
+ getProfileNames() {
110
+ return Object.keys(this.store);
111
+ }
112
+ setAccessType(profileName, accessType) {
113
+ if (accessType != 'root') {
114
+ this.delete(`${profileName}.rootCredentials`);
115
+ }
116
+ this.set(`${profileName}.accessType`, accessType);
117
+ }
118
+ async getAccess(profileName) {
119
+ checkProfileExists(profileName, this);
120
+ const address = this.get(`${profileName}.address`);
121
+ if (address.trim() === '') {
122
+ throw new ConfigError(`Profile "${profileName}" has no address. Please run "apollo config" to set it up.`);
123
+ }
124
+ const accessToken = this.get(`${profileName}.accessToken`);
125
+ if (accessToken.trim() === '') {
126
+ throw new ConfigError(`Profile "${profileName}" has no access token. Please run "apollo login" to set it up.`);
127
+ }
128
+ await queryApollo(address, accessToken, 'assemblies');
129
+ return { address, accessToken };
130
+ }
131
+ }
132
+ const profileSchema = Joi.object({
133
+ address: Joi.string().uri({ scheme: /https?/ }),
134
+ accessType: Joi.string().valid('google', 'microsoft', 'root', 'guest'),
135
+ accessToken: Joi.string(),
136
+ rootCredentials: Joi.object({
137
+ username: Joi.string(),
138
+ password: Joi.string(),
139
+ }).when('accessType', {
140
+ is: Joi.string().valid('root'),
141
+ otherwise: Joi.forbidden(),
142
+ }),
143
+ });
144
+ const configSchema = Joi.object().pattern(Joi.string(), profileSchema);
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { Command, Flags } from '@oclif/core';
3
- import { Config, ConfigError } from './Config.js';
3
+ import { ApolloConf } from './ApolloConf.js';
4
4
  import { checkConfigfileExists } from './utils.js';
5
5
  export class BaseCommand extends Command {
6
6
  static baseFlags = {
@@ -26,10 +26,10 @@ export class BaseCommand extends Command {
26
26
  }
27
27
  getConfig(configFile) {
28
28
  if (configFile === undefined) {
29
- configFile = path.join(this.config.configDir, 'config.yaml');
29
+ configFile = path.join(this.config.configDir, 'config.yml');
30
30
  }
31
31
  checkConfigfileExists(configFile);
32
- const config = new Config(configFile);
32
+ const config = new ApolloConf(configFile);
33
33
  return config;
34
34
  }
35
35
  async getAccess(configFile, profileName) {
@@ -37,22 +37,12 @@ export class BaseCommand extends Command {
37
37
  if (profileName === undefined) {
38
38
  profileName = process.env.APOLLO_PROFILE ?? 'default';
39
39
  }
40
- try {
41
- return await config.getAccess(profileName);
42
- }
43
- catch (error) {
44
- if (error instanceof ConfigError) {
45
- this.logToStderr(error.message);
46
- this.exit(1);
47
- }
48
- else {
49
- throw error;
50
- }
51
- }
40
+ return config.getAccess(profileName);
52
41
  }
53
42
  async catch(err) {
54
- // add any custom logic to handle errors from the command
55
- // or simply return the parent class error handling
43
+ if (err.cause instanceof Error) {
44
+ console.error(err.cause);
45
+ }
56
46
  return super.catch(err);
57
47
  }
58
48
  async finally(_) {