@apollo-annotation/cli 0.3.8 → 0.3.10

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
@@ -16,7 +16,7 @@ $ npm install -g @apollo-annotation/cli
16
16
  $ apollo COMMAND
17
17
  running command...
18
18
  $ apollo (--version)
19
- @apollo-annotation/cli/0.3.8 linux-x64 node-v20.19.5
19
+ @apollo-annotation/cli/0.3.10 linux-x64 node-v24.11.1
20
20
  $ apollo --help [COMMAND]
21
21
  USAGE
22
22
  $ apollo COMMAND
@@ -48,6 +48,7 @@ USAGE
48
48
  - [`apollo feature edit-type`](#apollo-feature-edit-type)
49
49
  - [`apollo feature get`](#apollo-feature-get)
50
50
  - [`apollo feature get-id`](#apollo-feature-get-id)
51
+ - [`apollo feature get-indexed-id ID`](#apollo-feature-get-indexed-id-id)
51
52
  - [`apollo feature import INPUT-FILE`](#apollo-feature-import-input-file)
52
53
  - [`apollo feature search`](#apollo-feature-search)
53
54
  - [`apollo file delete`](#apollo-file-delete)
@@ -115,7 +116,7 @@ EXAMPLES
115
116
  ```
116
117
 
117
118
  _See code:
118
- [src/commands/assembly/add-from-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/assembly/add-from-fasta.ts)_
119
+ [src/commands/assembly/add-from-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/assembly/add-from-fasta.ts)_
119
120
 
120
121
  ## `apollo assembly add-from-gff INPUT-FILE`
121
122
 
@@ -151,7 +152,7 @@ EXAMPLES
151
152
  ```
152
153
 
153
154
  _See code:
154
- [src/commands/assembly/add-from-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/assembly/add-from-gff.ts)_
155
+ [src/commands/assembly/add-from-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/assembly/add-from-gff.ts)_
155
156
 
156
157
  ## `apollo assembly check`
157
158
 
@@ -193,7 +194,7 @@ EXAMPLES
193
194
  ```
194
195
 
195
196
  _See code:
196
- [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/assembly/check.ts)_
197
+ [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/assembly/check.ts)_
197
198
 
198
199
  ## `apollo assembly delete`
199
200
 
@@ -221,7 +222,7 @@ EXAMPLES
221
222
  ```
222
223
 
223
224
  _See code:
224
- [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/assembly/delete.ts)_
225
+ [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/assembly/delete.ts)_
225
226
 
226
227
  ## `apollo assembly get`
227
228
 
@@ -243,7 +244,7 @@ DESCRIPTION
243
244
  ```
244
245
 
245
246
  _See code:
246
- [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/assembly/get.ts)_
247
+ [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/assembly/get.ts)_
247
248
 
248
249
  ## `apollo assembly sequence`
249
250
 
@@ -278,7 +279,7 @@ EXAMPLES
278
279
  ```
279
280
 
280
281
  _See code:
281
- [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/assembly/sequence.ts)_
282
+ [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/assembly/sequence.ts)_
282
283
 
283
284
  ## `apollo change get`
284
285
 
@@ -302,7 +303,7 @@ DESCRIPTION
302
303
  ```
303
304
 
304
305
  _See code:
305
- [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/change/get.ts)_
306
+ [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/change/get.ts)_
306
307
 
307
308
  ## `apollo config [KEY] [VALUE]`
308
309
 
@@ -354,7 +355,7 @@ EXAMPLES
354
355
  ```
355
356
 
356
357
  _See code:
357
- [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/config.ts)_
358
+ [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/config.ts)_
358
359
 
359
360
  ## `apollo export gff3 ASSEMBLY`
360
361
 
@@ -382,7 +383,7 @@ EXAMPLES
382
383
  ```
383
384
 
384
385
  _See code:
385
- [src/commands/export/gff3.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/export/gff3.ts)_
386
+ [src/commands/export/gff3.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/export/gff3.ts)_
386
387
 
387
388
  ## `apollo feature add-child`
388
389
 
@@ -413,7 +414,7 @@ EXAMPLES
413
414
  ```
414
415
 
415
416
  _See code:
416
- [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/add-child.ts)_
417
+ [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/add-child.ts)_
417
418
 
418
419
  ## `apollo feature check`
419
420
 
@@ -446,7 +447,7 @@ EXAMPLES
446
447
  ```
447
448
 
448
449
  _See code:
449
- [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/check.ts)_
450
+ [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/check.ts)_
450
451
 
451
452
  ## `apollo feature copy`
452
453
 
@@ -477,7 +478,7 @@ EXAMPLES
477
478
  ```
478
479
 
479
480
  _See code:
480
- [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/copy.ts)_
481
+ [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/copy.ts)_
481
482
 
482
483
  ## `apollo feature delete`
483
484
 
@@ -501,7 +502,7 @@ DESCRIPTION
501
502
  ```
502
503
 
503
504
  _See code:
504
- [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/delete.ts)_
505
+ [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/delete.ts)_
505
506
 
506
507
  ## `apollo feature edit`
507
508
 
@@ -543,7 +544,7 @@ EXAMPLES
543
544
  ```
544
545
 
545
546
  _See code:
546
- [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/edit.ts)_
547
+ [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/edit.ts)_
547
548
 
548
549
  ## `apollo feature edit-attribute`
549
550
 
@@ -583,7 +584,7 @@ EXAMPLES
583
584
  ```
584
585
 
585
586
  _See code:
586
- [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
587
+ [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
587
588
 
588
589
  ## `apollo feature edit-coords`
589
590
 
@@ -617,7 +618,7 @@ EXAMPLES
617
618
  ```
618
619
 
619
620
  _See code:
620
- [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
621
+ [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
621
622
 
622
623
  ## `apollo feature edit-type`
623
624
 
@@ -641,7 +642,7 @@ DESCRIPTION
641
642
  ```
642
643
 
643
644
  _See code:
644
- [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/edit-type.ts)_
645
+ [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/edit-type.ts)_
645
646
 
646
647
  ## `apollo feature get`
647
648
 
@@ -675,7 +676,7 @@ EXAMPLES
675
676
  ```
676
677
 
677
678
  _See code:
678
- [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/get.ts)_
679
+ [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/get.ts)_
679
680
 
680
681
  ## `apollo feature get-id`
681
682
 
@@ -703,7 +704,39 @@ EXAMPLES
703
704
  ```
704
705
 
705
706
  _See code:
706
- [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/get-id.ts)_
707
+ [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/get-id.ts)_
708
+
709
+ ## `apollo feature get-indexed-id ID`
710
+
711
+ Get features given an indexed identifier
712
+
713
+ ```
714
+ USAGE
715
+ $ apollo feature get-indexed-id ID [--profile <value>] [--config-file <value>] [-a <value>] [--topLevel]
716
+
717
+ ARGUMENTS
718
+ ID Indexed identifier to search for
719
+
720
+ FLAGS
721
+ -a, --assembly=<value>... Assembly names or IDs to search; use "-" to read it from stdin. If omitted search all
722
+ assemblies
723
+ --config-file=<value> Use this config file (mostly for testing)
724
+ --profile=<value> Use credentials from this profile
725
+ --topLevel Return the top-level parent of the feature instead of the feature itself
726
+
727
+ DESCRIPTION
728
+ Get features given an indexed identifier
729
+
730
+ Get features that match a given indexed identifier, such as the ID of a feature from an imported GFF3 file
731
+
732
+ EXAMPLES
733
+ Get features for this indexed identifier:
734
+
735
+ $ apollo feature get-indexed-id -i abc...zyz def...foo
736
+ ```
737
+
738
+ _See code:
739
+ [src/commands/feature/get-indexed-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/get-indexed-id.ts)_
707
740
 
708
741
  ## `apollo feature import INPUT-FILE`
709
742
 
@@ -734,7 +767,7 @@ EXAMPLES
734
767
  ```
735
768
 
736
769
  _See code:
737
- [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/import.ts)_
770
+ [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/import.ts)_
738
771
 
739
772
  ## `apollo feature search`
740
773
 
@@ -785,7 +818,7 @@ EXAMPLES
785
818
  ```
786
819
 
787
820
  _See code:
788
- [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/feature/search.ts)_
821
+ [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/feature/search.ts)_
789
822
 
790
823
  ## `apollo file delete`
791
824
 
@@ -812,7 +845,7 @@ EXAMPLES
812
845
  ```
813
846
 
814
847
  _See code:
815
- [src/commands/file/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/file/delete.ts)_
848
+ [src/commands/file/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/file/delete.ts)_
816
849
 
817
850
  ## `apollo file download`
818
851
 
@@ -840,7 +873,7 @@ EXAMPLES
840
873
  ```
841
874
 
842
875
  _See code:
843
- [src/commands/file/download.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/file/download.ts)_
876
+ [src/commands/file/download.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/file/download.ts)_
844
877
 
845
878
  ## `apollo file get`
846
879
 
@@ -867,7 +900,7 @@ EXAMPLES
867
900
  ```
868
901
 
869
902
  _See code:
870
- [src/commands/file/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/file/get.ts)_
903
+ [src/commands/file/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/file/get.ts)_
871
904
 
872
905
  ## `apollo file upload INPUT-FILE`
873
906
 
@@ -904,7 +937,7 @@ EXAMPLES
904
937
  ```
905
938
 
906
939
  _See code:
907
- [src/commands/file/upload.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/file/upload.ts)_
940
+ [src/commands/file/upload.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/file/upload.ts)_
908
941
 
909
942
  ## `apollo help [COMMANDS]`
910
943
 
@@ -970,7 +1003,7 @@ EXAMPLES
970
1003
  ```
971
1004
 
972
1005
  _See code:
973
- [src/commands/jbrowse/desktop.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/jbrowse/desktop.ts)_
1006
+ [src/commands/jbrowse/desktop.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/jbrowse/desktop.ts)_
974
1007
 
975
1008
  ## `apollo jbrowse get-config`
976
1009
 
@@ -996,7 +1029,7 @@ EXAMPLES
996
1029
  ```
997
1030
 
998
1031
  _See code:
999
- [src/commands/jbrowse/get-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/jbrowse/get-config.ts)_
1032
+ [src/commands/jbrowse/get-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/jbrowse/get-config.ts)_
1000
1033
 
1001
1034
  ## `apollo jbrowse set-config INPUTFILE`
1002
1035
 
@@ -1025,7 +1058,7 @@ EXAMPLES
1025
1058
  ```
1026
1059
 
1027
1060
  _See code:
1028
- [src/commands/jbrowse/set-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/jbrowse/set-config.ts)_
1061
+ [src/commands/jbrowse/set-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/jbrowse/set-config.ts)_
1029
1062
 
1030
1063
  ## `apollo login`
1031
1064
 
@@ -1064,7 +1097,7 @@ EXAMPLES
1064
1097
  ```
1065
1098
 
1066
1099
  _See code:
1067
- [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/login.ts)_
1100
+ [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/login.ts)_
1068
1101
 
1069
1102
  ## `apollo logout`
1070
1103
 
@@ -1094,7 +1127,7 @@ EXAMPLES
1094
1127
  ```
1095
1128
 
1096
1129
  _See code:
1097
- [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/logout.ts)_
1130
+ [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/logout.ts)_
1098
1131
 
1099
1132
  ## `apollo refseq add-alias INPUT-FILE`
1100
1133
 
@@ -1125,7 +1158,7 @@ EXAMPLES
1125
1158
  ```
1126
1159
 
1127
1160
  _See code:
1128
- [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
1161
+ [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
1129
1162
 
1130
1163
  ## `apollo refseq get`
1131
1164
 
@@ -1157,7 +1190,7 @@ EXAMPLES
1157
1190
  ```
1158
1191
 
1159
1192
  _See code:
1160
- [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/refseq/get.ts)_
1193
+ [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/refseq/get.ts)_
1161
1194
 
1162
1195
  ## `apollo status`
1163
1196
 
@@ -1179,7 +1212,7 @@ DESCRIPTION
1179
1212
  ```
1180
1213
 
1181
1214
  _See code:
1182
- [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/status.ts)_
1215
+ [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/status.ts)_
1183
1216
 
1184
1217
  ## `apollo user get`
1185
1218
 
@@ -1215,6 +1248,6 @@ EXAMPLES
1215
1248
  ```
1216
1249
 
1217
1250
  _See code:
1218
- [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.8/packages/apollo-cli/src/commands/user/get.ts)_
1251
+ [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.10/packages/apollo-cli/src/commands/user/get.ts)_
1219
1252
 
1220
1253
  <!-- commandsstop -->
@@ -0,0 +1,17 @@
1
+ import { BaseCommand } from '../../baseCommand.js';
2
+ export default class Get extends BaseCommand<typeof Get> {
3
+ static summary: string;
4
+ static description: string;
5
+ static examples: {
6
+ description: string;
7
+ command: string;
8
+ }[];
9
+ static args: {
10
+ id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
11
+ };
12
+ static flags: {
13
+ assembly: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
+ topLevel: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
15
+ };
16
+ run(): Promise<void>;
17
+ }
@@ -0,0 +1,66 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { fetch } from 'undici';
3
+ import { BaseCommand } from '../../baseCommand.js';
4
+ import { convertAssemblyNameToId, createFetchErrorMessage, idReader, localhostToAddress, } from '../../utils.js';
5
+ export default class Get extends BaseCommand {
6
+ static summary = 'Get features given an indexed identifier';
7
+ static description = 'Get features that match a given indexed identifier, such as the ID of a feature from an imported GFF3 file';
8
+ static examples = [
9
+ {
10
+ description: 'Get features for this indexed identifier:',
11
+ command: '<%= config.bin %> <%= command.id %> -i abc...zyz def...foo',
12
+ },
13
+ ];
14
+ static args = {
15
+ id: Args.string({
16
+ description: 'Indexed identifier to search for',
17
+ required: true,
18
+ }),
19
+ };
20
+ static flags = {
21
+ assembly: Flags.string({
22
+ char: 'a',
23
+ multiple: true,
24
+ description: 'Assembly names or IDs to search; use "-" to read it from stdin. If omitted search all assemblies',
25
+ }),
26
+ topLevel: Flags.boolean({
27
+ description: 'Return the top-level parent of the feature instead of the feature itself',
28
+ }),
29
+ };
30
+ async run() {
31
+ const { args, flags } = await this.parse(Get);
32
+ const access = await this.getAccess();
33
+ const { topLevel } = flags;
34
+ const { id } = args;
35
+ const assembly = flags.assembly && (await idReader(flags.assembly));
36
+ const assemblyIds = assembly &&
37
+ (await convertAssemblyNameToId(access.address, access.accessToken, assembly));
38
+ if (assemblyIds?.length === 0) {
39
+ this.log(JSON.stringify([], null, 2));
40
+ this.exit(0);
41
+ }
42
+ const url = new URL(localhostToAddress(`${access.address}/features/getByIndexedId`));
43
+ const searchParams = new URLSearchParams({ id });
44
+ if (assemblyIds) {
45
+ searchParams.append('assemblies', assemblyIds.join(','));
46
+ }
47
+ if (topLevel) {
48
+ searchParams.append('topLevel', 'true');
49
+ }
50
+ url.search = searchParams.toString();
51
+ const uri = url.toString();
52
+ const auth = {
53
+ headers: {
54
+ authorization: `Bearer ${access.accessToken}`,
55
+ 'Content-Type': 'application/json',
56
+ },
57
+ };
58
+ const response = await fetch(uri, auth);
59
+ if (!response.ok) {
60
+ const errorMessage = await createFetchErrorMessage(response, 'Failed to access Apollo with the current address and/or access token\nThe server returned:\n');
61
+ throw new Error(errorMessage);
62
+ }
63
+ const results = (await response.json());
64
+ this.log(JSON.stringify(results, null, 2));
65
+ }
66
+ }
package/dist/test/test.js CHANGED
@@ -18,14 +18,19 @@
18
18
  import assert from 'node:assert';
19
19
  import * as crypto from 'node:crypto';
20
20
  import fs from 'node:fs';
21
- import { afterEach, before, beforeEach, describe } from 'node:test';
21
+ import { after, afterEach, before, beforeEach, describe } from 'node:test';
22
+ import { MongoClient } from 'mongodb';
22
23
  import { Shell, deleteAllChecks } from './utils.js';
23
24
  const apollo = 'yarn dev';
24
25
  const P = '--profile testAdmin';
26
+ // let client = MongoClient
27
+ let client;
25
28
  let configFile = '';
26
29
  let configFileBak = '';
27
30
  void describe('Test CLI', () => {
28
31
  before(() => {
32
+ const uri = 'mongodb://localhost:27017/apolloTestCliDb?directConnection=true';
33
+ client = new MongoClient(uri);
29
34
  configFile = new Shell(`${apollo} config --get-config-file`).stdout.trim();
30
35
  configFileBak = `${configFile}.bak`;
31
36
  if (fs.existsSync(configFileBak)) {
@@ -36,11 +41,24 @@ void describe('Test CLI', () => {
36
41
  new Shell(`${apollo} config ${P} rootPassword pass`);
37
42
  new Shell(`${apollo} login ${P} -f`);
38
43
  });
44
+ after(async () => {
45
+ await client.close();
46
+ });
39
47
  beforeEach(() => {
40
48
  // Backup starting config file
41
49
  fs.copyFileSync(configFile, configFileBak);
42
50
  });
43
- afterEach(() => {
51
+ afterEach(async () => {
52
+ const database = client.db('apolloTestCliDb');
53
+ await Promise.all([
54
+ 'assemblies',
55
+ 'changes',
56
+ 'counters',
57
+ 'features',
58
+ 'files',
59
+ 'refseqchunks',
60
+ 'refseqs',
61
+ ].map((collectionName) => database.collection(collectionName).deleteMany({})));
44
62
  // Put back starting config file
45
63
  fs.renameSync(configFileBak, configFile);
46
64
  });
@@ -501,6 +519,42 @@ void describe('Test CLI', () => {
501
519
  p = new Shell(`${apollo} feature search ${P} -a vv1 -t Q`);
502
520
  assert.ok(p.stdout.includes('"Q"'));
503
521
  });
522
+ void globalThis.itName('Get feature by indexed ID', () => {
523
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/tiny.fasta.gff3 -a vv1 -f`);
524
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/tiny.fasta.gff3 -a vv2 -f`);
525
+ // Search multiple assemblies
526
+ let p = new Shell(`${apollo} feature get-indexed-id ${P} MyGene -a vv1 vv2`);
527
+ let out = JSON.parse(p.stdout);
528
+ assert.strictEqual(out.length, 2);
529
+ assert.ok(p.stdout.includes('MyGene'));
530
+ // Specifying no assembly defaults to searching all assemblies
531
+ p = new Shell(`${apollo} feature get-indexed-id ${P} MyGene`);
532
+ out = JSON.parse(p.stdout);
533
+ assert.strictEqual(out.length, 2);
534
+ assert.ok(p.stdout.includes('MyGene'));
535
+ // Search single assembly
536
+ p = new Shell(`${apollo} feature get-indexed-id ${P} MyGene -a vv1`);
537
+ out = JSON.parse(p.stdout);
538
+ assert.strictEqual(out.length, 1);
539
+ assert.ok(p.stdout.includes('MyGene'));
540
+ // Warn on unknown assembly
541
+ p = new Shell(`${apollo} feature get-indexed-id ${P} EDEN -a foobar`);
542
+ assert.strictEqual('[]', p.stdout.trim());
543
+ assert.ok(p.stderr.includes('Warning'));
544
+ // Return empty array with no matches
545
+ p = new Shell(`${apollo} feature get-indexed-id ${P} foobarspam -a vv1`);
546
+ assert.deepStrictEqual(p.stdout.trim(), '[]');
547
+ // Gets subfeature
548
+ p = new Shell(`${apollo} feature get-indexed-id ${P} myCDS.1 -a vv1`);
549
+ out = JSON.parse(p.stdout);
550
+ assert.strictEqual(out.length, 1);
551
+ assert.ok(out.at(0)?.type === 'CDS');
552
+ // Gets top-level feature from subfeature id
553
+ p = new Shell(`${apollo} feature get-indexed-id ${P} myCDS.1 -a vv1 --topLevel`);
554
+ out = JSON.parse(p.stdout);
555
+ assert.strictEqual(out.length, 1);
556
+ assert.ok(out.at(0)?.type === 'gene');
557
+ });
504
558
  void globalThis.itName('Delete features', () => {
505
559
  new Shell(`${apollo} assembly add-from-gff ${P} test_data/tiny.fasta.gff3 -a vv1 -f`);
506
560
  let p = new Shell(`${apollo} feature search ${P} -a vv1 -t EDEN`);
@@ -684,10 +684,22 @@
684
684
  "sequence.js"
685
685
  ]
686
686
  },
687
- "change:get": {
687
+ "export:gff3": {
688
688
  "aliases": [],
689
- "args": {},
690
- "description": "Return the change log in json format. Note that when an assembly is deleted the link between common name and ID is lost (it can still be recovered by inspecting the change log but at present this task is left to the user). In such cases you need to use the assembly ID.",
689
+ "args": {
690
+ "assembly": {
691
+ "description": "Export annotations for this assembly name or id",
692
+ "name": "assembly",
693
+ "required": true
694
+ }
695
+ },
696
+ "description": "Export the annotations for an assembly to stdout as gff3",
697
+ "examples": [
698
+ {
699
+ "description": "Export annotations for myAssembly:",
700
+ "command": "<%= config.bin %> <%= command.id %> myAssembly > out.gff3"
701
+ }
702
+ ],
691
703
  "flags": {
692
704
  "profile": {
693
705
  "description": "Use credentials from this profile",
@@ -703,48 +715,33 @@
703
715
  "multiple": false,
704
716
  "type": "option"
705
717
  },
706
- "assembly": {
707
- "char": "a",
708
- "description": "Get changes only for these assembly names or IDs (but see description)",
709
- "name": "assembly",
710
- "hasDynamicHelp": false,
711
- "multiple": true,
712
- "type": "option"
718
+ "include-fasta": {
719
+ "description": "Include fasta sequence in output",
720
+ "name": "include-fasta",
721
+ "allowNo": false,
722
+ "type": "boolean"
713
723
  }
714
724
  },
715
725
  "hasDynamicHelp": false,
716
726
  "hiddenAliases": [],
717
- "id": "change:get",
727
+ "id": "export:gff3",
718
728
  "pluginAlias": "@apollo-annotation/cli",
719
729
  "pluginName": "@apollo-annotation/cli",
720
730
  "pluginType": "core",
721
731
  "strict": true,
722
- "summary": "Get list of changes",
723
732
  "enableJsonFlag": false,
724
733
  "isESM": true,
725
734
  "relativePath": [
726
735
  "dist",
727
736
  "commands",
728
- "change",
729
- "get.js"
737
+ "export",
738
+ "gff3.js"
730
739
  ]
731
740
  },
732
- "export:gff3": {
741
+ "change:get": {
733
742
  "aliases": [],
734
- "args": {
735
- "assembly": {
736
- "description": "Export annotations for this assembly name or id",
737
- "name": "assembly",
738
- "required": true
739
- }
740
- },
741
- "description": "Export the annotations for an assembly to stdout as gff3",
742
- "examples": [
743
- {
744
- "description": "Export annotations for myAssembly:",
745
- "command": "<%= config.bin %> <%= command.id %> myAssembly > out.gff3"
746
- }
747
- ],
743
+ "args": {},
744
+ "description": "Return the change log in json format. Note that when an assembly is deleted the link between common name and ID is lost (it can still be recovered by inspecting the change log but at present this task is left to the user). In such cases you need to use the assembly ID.",
748
745
  "flags": {
749
746
  "profile": {
750
747
  "description": "Use credentials from this profile",
@@ -760,27 +757,30 @@
760
757
  "multiple": false,
761
758
  "type": "option"
762
759
  },
763
- "include-fasta": {
764
- "description": "Include fasta sequence in output",
765
- "name": "include-fasta",
766
- "allowNo": false,
767
- "type": "boolean"
760
+ "assembly": {
761
+ "char": "a",
762
+ "description": "Get changes only for these assembly names or IDs (but see description)",
763
+ "name": "assembly",
764
+ "hasDynamicHelp": false,
765
+ "multiple": true,
766
+ "type": "option"
768
767
  }
769
768
  },
770
769
  "hasDynamicHelp": false,
771
770
  "hiddenAliases": [],
772
- "id": "export:gff3",
771
+ "id": "change:get",
773
772
  "pluginAlias": "@apollo-annotation/cli",
774
773
  "pluginName": "@apollo-annotation/cli",
775
774
  "pluginType": "core",
776
775
  "strict": true,
776
+ "summary": "Get list of changes",
777
777
  "enableJsonFlag": false,
778
778
  "isESM": true,
779
779
  "relativePath": [
780
780
  "dist",
781
781
  "commands",
782
- "export",
783
- "gff3.js"
782
+ "change",
783
+ "get.js"
784
784
  ]
785
785
  },
786
786
  "feature:add-child": {
@@ -1382,6 +1382,69 @@
1382
1382
  "get-id.js"
1383
1383
  ]
1384
1384
  },
1385
+ "feature:get-indexed-id": {
1386
+ "aliases": [],
1387
+ "args": {
1388
+ "id": {
1389
+ "description": "Indexed identifier to search for",
1390
+ "name": "id",
1391
+ "required": true
1392
+ }
1393
+ },
1394
+ "description": "Get features that match a given indexed identifier, such as the ID of a feature from an imported GFF3 file",
1395
+ "examples": [
1396
+ {
1397
+ "description": "Get features for this indexed identifier:",
1398
+ "command": "<%= config.bin %> <%= command.id %> -i abc...zyz def...foo"
1399
+ }
1400
+ ],
1401
+ "flags": {
1402
+ "profile": {
1403
+ "description": "Use credentials from this profile",
1404
+ "name": "profile",
1405
+ "hasDynamicHelp": false,
1406
+ "multiple": false,
1407
+ "type": "option"
1408
+ },
1409
+ "config-file": {
1410
+ "description": "Use this config file (mostly for testing)",
1411
+ "name": "config-file",
1412
+ "hasDynamicHelp": false,
1413
+ "multiple": false,
1414
+ "type": "option"
1415
+ },
1416
+ "assembly": {
1417
+ "char": "a",
1418
+ "description": "Assembly names or IDs to search; use \"-\" to read it from stdin. If omitted search all assemblies",
1419
+ "name": "assembly",
1420
+ "hasDynamicHelp": false,
1421
+ "multiple": true,
1422
+ "type": "option"
1423
+ },
1424
+ "topLevel": {
1425
+ "description": "Return the top-level parent of the feature instead of the feature itself",
1426
+ "name": "topLevel",
1427
+ "allowNo": false,
1428
+ "type": "boolean"
1429
+ }
1430
+ },
1431
+ "hasDynamicHelp": false,
1432
+ "hiddenAliases": [],
1433
+ "id": "feature:get-indexed-id",
1434
+ "pluginAlias": "@apollo-annotation/cli",
1435
+ "pluginName": "@apollo-annotation/cli",
1436
+ "pluginType": "core",
1437
+ "strict": true,
1438
+ "summary": "Get features given an indexed identifier",
1439
+ "enableJsonFlag": false,
1440
+ "isESM": true,
1441
+ "relativePath": [
1442
+ "dist",
1443
+ "commands",
1444
+ "feature",
1445
+ "get-indexed-id.js"
1446
+ ]
1447
+ },
1385
1448
  "feature:get": {
1386
1449
  "aliases": [],
1387
1450
  "args": {},
@@ -2196,5 +2259,5 @@
2196
2259
  ]
2197
2260
  }
2198
2261
  },
2199
- "version": "0.3.8"
2262
+ "version": "0.3.10"
2200
2263
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo-annotation/cli",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "Command line interface for the Apollo annotation server",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "posttest": "yarn lint",
31
31
  "test:ci": "nyc mocha 'src/**/*.test.ts'",
32
32
  "test:cli": "yarn tsx src/test/test.ts",
33
- "version": "oclif readme --multi --dir ../website/docs/admin/cli/ && oclif readme && git add README.md"
33
+ "version": "oclif readme --multi --dir ../website/docs/03-guides/04-cli/ && oclif readme && git add README.md"
34
34
  },
35
35
  "oclif": {
36
36
  "bin": "apollo",
@@ -89,8 +89,8 @@
89
89
  "yaml": "^2.3.4"
90
90
  },
91
91
  "devDependencies": {
92
- "@apollo-annotation/mst": "^0.3.8",
93
- "@apollo-annotation/shared": "^0.3.8",
92
+ "@apollo-annotation/mst": "^0.3.10",
93
+ "@apollo-annotation/shared": "^0.3.10",
94
94
  "@istanbuljs/esm-loader-hook": "^0.2.0",
95
95
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
96
96
  "@oclif/test": "^3.1.3",
@@ -99,10 +99,11 @@
99
99
  "@types/cross-spawn": "^6.0.6",
100
100
  "@types/inquirer": "^9.0.7",
101
101
  "@types/mocha": "^10",
102
- "@types/node": "^18.14.2",
102
+ "@types/node": "^20.19.15",
103
103
  "babel-plugin-istanbul": "^6.1.1",
104
104
  "cross-spawn": "^7.0.3",
105
105
  "mocha": "^10.2.0",
106
+ "mongodb": "^4.7.0",
106
107
  "nyc": "^15.1.0",
107
108
  "oclif": "^4.4.2",
108
109
  "prettier": "^3.3.2",