@apollo-annotation/cli 0.1.19 → 0.1.21

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 (54) hide show
  1. package/README.md +297 -115
  2. package/dist/baseCommand.d.ts +1 -1
  3. package/dist/baseCommand.js +3 -4
  4. package/dist/commands/assembly/add-from-fasta.d.ts +22 -0
  5. package/dist/commands/assembly/add-from-fasta.js +157 -0
  6. package/dist/commands/assembly/{add-gff.d.ts → add-from-gff.d.ts} +5 -3
  7. package/dist/commands/assembly/add-from-gff.js +64 -0
  8. package/dist/commands/assembly/check.js +9 -9
  9. package/dist/commands/assembly/delete.js +4 -4
  10. package/dist/commands/assembly/get.js +4 -4
  11. package/dist/commands/assembly/sequence.js +4 -4
  12. package/dist/commands/change/get.js +7 -7
  13. package/dist/commands/config.js +4 -6
  14. package/dist/commands/feature/add-child.js +6 -5
  15. package/dist/commands/feature/check.js +6 -6
  16. package/dist/commands/feature/copy.js +5 -4
  17. package/dist/commands/feature/delete.js +4 -4
  18. package/dist/commands/feature/edit-attribute.js +6 -5
  19. package/dist/commands/feature/edit-coords.js +5 -5
  20. package/dist/commands/feature/edit-type.js +5 -5
  21. package/dist/commands/feature/edit.js +5 -5
  22. package/dist/commands/feature/get-id.js +5 -5
  23. package/dist/commands/feature/get.js +3 -3
  24. package/dist/commands/feature/import.d.ts +5 -3
  25. package/dist/commands/feature/import.js +15 -14
  26. package/dist/commands/feature/search.js +6 -6
  27. package/dist/commands/file/delete.d.ts +13 -0
  28. package/dist/commands/file/delete.js +58 -0
  29. package/dist/commands/file/download.d.ts +14 -0
  30. package/dist/commands/file/download.js +45 -0
  31. package/dist/commands/file/get.d.ts +13 -0
  32. package/dist/commands/file/get.js +38 -0
  33. package/dist/commands/file/upload.d.ts +18 -0
  34. package/dist/commands/file/upload.js +89 -0
  35. package/dist/commands/jbrowse/get-config.d.ts +10 -0
  36. package/dist/commands/jbrowse/get-config.js +21 -0
  37. package/dist/commands/jbrowse/set-config.d.ts +13 -0
  38. package/dist/commands/jbrowse/set-config.js +51 -0
  39. package/dist/commands/login.js +11 -15
  40. package/dist/commands/logout.js +2 -2
  41. package/dist/commands/refseq/add-alias.d.ts +3 -1
  42. package/dist/commands/refseq/add-alias.js +13 -12
  43. package/dist/commands/refseq/get.js +8 -8
  44. package/dist/commands/status.js +4 -3
  45. package/dist/commands/user/get.js +3 -3
  46. package/dist/fileCommand.d.ts +5 -0
  47. package/dist/fileCommand.js +76 -0
  48. package/dist/utils.d.ts +7 -21
  49. package/dist/utils.js +37 -109
  50. package/oclif.manifest.json +449 -90
  51. package/package.json +50 -43
  52. package/dist/commands/assembly/add-fasta.d.ts +0 -15
  53. package/dist/commands/assembly/add-fasta.js +0 -87
  54. package/dist/commands/assembly/add-gff.js +0 -63
package/package.json CHANGED
@@ -1,22 +1,19 @@
1
1
  {
2
2
  "name": "@apollo-annotation/cli",
3
+ "version": "0.1.21",
3
4
  "description": "Command line interface for the Apollo annotation server",
4
- "version": "0.1.19",
5
- "author": "Apollo Team",
6
5
  "repository": {
7
6
  "type": "git",
8
7
  "url": "https://github.com/GMOD/Apollo3.git",
9
8
  "directory": "packages/apollo-cli"
10
9
  },
11
- "bin": {
12
- "apollo": "./bin/run.js"
13
- },
10
+ "author": "Apollo Team",
14
11
  "type": "module",
12
+ "exports": "./dist/index.js",
15
13
  "main": "",
16
14
  "types": "dist/index.d.ts",
17
- "exports": "./dist/index.js",
18
- "engines": {
19
- "node": ">=18.0.0"
15
+ "bin": {
16
+ "apollo": "./bin/run.js"
20
17
  },
21
18
  "files": [
22
19
  "/bin",
@@ -26,13 +23,50 @@
26
23
  "scripts": {
27
24
  "build": "shx rm -rf dist && tsc -b",
28
25
  "dev": "tsx bin/dev.js",
29
- "postpack": "shx rm -f oclif.manifest.json",
30
- "posttest": "yarn lint",
31
26
  "prepack": "yarn build && oclif manifest && oclif readme && prettier --write README.md",
27
+ "postpack": "shx rm -f oclif.manifest.json",
32
28
  "prepare": "yarn build",
33
29
  "test": "mocha --require src/test/fixtures.ts 'src/**/*.test.ts'",
30
+ "posttest": "yarn lint",
34
31
  "test:ci": "nyc mocha 'src/**/*.test.ts'",
35
- "version": "oclif readme && git add README.md"
32
+ "version": "oclif readme --multi --dir ../website/docs/cli/ && oclif readme && git add README.md"
33
+ },
34
+ "oclif": {
35
+ "bin": "apollo",
36
+ "commands": "./dist/commands",
37
+ "dirname": "apollo-cli",
38
+ "helpOptions": {
39
+ "flagSortOrder": "none",
40
+ "maxWidth": 80
41
+ },
42
+ "plugins": [
43
+ "@oclif/plugin-help"
44
+ ],
45
+ "repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/apollo-cli/<%- commandPath %>",
46
+ "topicSeparator": " ",
47
+ "topics": {
48
+ "assembly": {
49
+ "description": "Commands to manage assemblies"
50
+ },
51
+ "change": {
52
+ "description": "Commands to manage the change log"
53
+ },
54
+ "feature": {
55
+ "description": "Commands to manage features"
56
+ },
57
+ "file": {
58
+ "description": "Commands to manage files"
59
+ },
60
+ "jbrowse": {
61
+ "description": "Commands to manage the JBrowse configuration"
62
+ },
63
+ "refseq": {
64
+ "description": "Commands to manage reference sequences"
65
+ },
66
+ "user": {
67
+ "description": "Commands to manage users"
68
+ }
69
+ }
36
70
  },
37
71
  "dependencies": {
38
72
  "@inquirer/input": "^1.2.14",
@@ -50,12 +84,12 @@
50
84
  "yaml": "^2.3.4"
51
85
  },
52
86
  "devDependencies": {
53
- "@apollo-annotation/mst": "^0.1.19",
54
- "@apollo-annotation/shared": "^0.1.19",
87
+ "@apollo-annotation/mst": "^0.1.21",
88
+ "@apollo-annotation/shared": "^0.1.21",
55
89
  "@istanbuljs/esm-loader-hook": "^0.2.0",
56
90
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
57
91
  "@oclif/test": "^3.1.3",
58
- "@types/chai": "^4",
92
+ "@types/chai": "^4.3.19",
59
93
  "@types/cli-progress": "^3",
60
94
  "@types/inquirer": "^9.0.7",
61
95
  "@types/mocha": "^10",
@@ -72,35 +106,8 @@
72
106
  "tsx": "^4.6.2",
73
107
  "typescript": "^5.5.3"
74
108
  },
75
- "oclif": {
76
- "helpOptions": {
77
- "flagSortOrder": "none"
78
- },
79
- "bin": "apollo",
80
- "dirname": "apollo-cli",
81
- "commands": "./dist/commands",
82
- "plugins": [
83
- "@oclif/plugin-help"
84
- ],
85
- "repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/apollo-cli/<%- commandPath %>",
86
- "topicSeparator": " ",
87
- "topics": {
88
- "assembly": {
89
- "description": "Commands to handle assemblies"
90
- },
91
- "change": {
92
- "description": "Commands to handle the log of changes made to the database"
93
- },
94
- "feature": {
95
- "description": "Commands to handle features"
96
- },
97
- "refseq": {
98
- "description": "Commands to handle reference sequences"
99
- },
100
- "user": {
101
- "description": "Commands to handle users"
102
- }
103
- }
109
+ "engines": {
110
+ "node": ">=18.0.0"
104
111
  },
105
112
  "publishConfig": {
106
113
  "access": "public"
@@ -1,15 +0,0 @@
1
- import { BaseCommand } from '../../baseCommand.js';
2
- export default class Get extends BaseCommand<typeof Get> {
3
- static description: string;
4
- static examples: {
5
- description: string;
6
- command: string;
7
- }[];
8
- static flags: {
9
- 'input-file': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- assembly: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
- index: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
- force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
13
- };
14
- run(): Promise<void>;
15
- }
@@ -1,87 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- import { Flags } from '@oclif/core';
5
- import { ObjectId } from 'bson';
6
- import { BaseCommand } from '../../baseCommand.js';
7
- import { createFetchErrorMessage, submitAssembly, uploadFile, wrapLines, } from '../../utils.js';
8
- export default class Get extends BaseCommand {
9
- static description = 'Add new assembly from local or external fasta file';
10
- static examples = [
11
- {
12
- description: wrapLines('From local file:'),
13
- command: '<%= config.bin %> <%= command.id %> -i genome.fa -a myAssembly',
14
- },
15
- {
16
- description: wrapLines('From external source we also need the URL of the index:'),
17
- command: '<%= config.bin %> <%= command.id %> -i https://.../genome.fa -x https://.../genome.fa.fai -a myAssembly',
18
- },
19
- ];
20
- static flags = {
21
- 'input-file': Flags.string({
22
- char: 'i',
23
- description: 'Input fasta file',
24
- required: true,
25
- }),
26
- assembly: Flags.string({
27
- char: 'a',
28
- description: 'Name for this assembly. Use the file name if omitted',
29
- }),
30
- index: Flags.string({
31
- char: 'x',
32
- description: 'URL of the index. Required if input is an external source and ignored if input is a local file',
33
- }),
34
- force: Flags.boolean({
35
- char: 'f',
36
- description: 'Delete existing assembly, if it exists',
37
- }),
38
- };
39
- async run() {
40
- const { flags } = await this.parse(Get);
41
- const access = await this.getAccess(flags['config-file'], flags.profile);
42
- const assemblyName = flags.assembly ?? path.basename(flags['input-file']);
43
- const isExternal = isValidHttpUrl(flags['input-file']);
44
- let res;
45
- if (isExternal) {
46
- if (flags.index === undefined) {
47
- this.error('Please provide the URL to the index of the external fasta file');
48
- }
49
- const body = {
50
- assemblyName,
51
- typeName: 'AddAssemblyFromExternalChange',
52
- externalLocation: {
53
- fa: flags['input-file'],
54
- fai: flags.index,
55
- },
56
- };
57
- res = (await submitAssembly(access.address, access.accessToken, body, flags.force));
58
- }
59
- else {
60
- if (!isExternal && !fs.existsSync(flags['input-file'])) {
61
- this.error(`File ${flags['input-file']} does not exist`);
62
- }
63
- const fileId = await uploadFile(access.address, access.accessToken, flags['input-file'], 'text/x-fasta');
64
- const body = {
65
- assemblyName,
66
- fileId,
67
- typeName: 'AddAssemblyFromFileChange',
68
- assembly: new ObjectId().toHexString(),
69
- };
70
- res = (await submitAssembly(access.address, access.accessToken, body, flags.force));
71
- }
72
- if (!res.ok) {
73
- const errorMessage = await createFetchErrorMessage(res, 'Submit assembly failed');
74
- throw new Error(errorMessage);
75
- }
76
- }
77
- }
78
- function isValidHttpUrl(x) {
79
- let url;
80
- try {
81
- url = new URL(x);
82
- }
83
- catch {
84
- return false;
85
- }
86
- return url.protocol === 'http:' || url.protocol === 'https:';
87
- }
@@ -1,63 +0,0 @@
1
- import * as fs from 'node:fs';
2
- import * as path from 'node:path';
3
- import { Flags } from '@oclif/core';
4
- import { ObjectId } from 'bson';
5
- import { BaseCommand } from '../../baseCommand.js';
6
- import { createFetchErrorMessage, submitAssembly, uploadFile, wrapLines, } from '../../utils.js';
7
- export default class AddGff extends BaseCommand {
8
- static summary = 'Add new assembly from gff or gft file';
9
- static description = wrapLines('The gff file is expected to contain sequences as per gff specifications. Features are also imported by default.');
10
- static examples = [
11
- {
12
- description: 'Import sequences and features:',
13
- command: '<%= config.bin %> <%= command.id %> -i genome.gff -a myAssembly',
14
- },
15
- {
16
- description: 'Import sequences only:',
17
- command: '<%= config.bin %> <%= command.id %> -i genome.gff -a myAssembly -o',
18
- },
19
- ];
20
- static flags = {
21
- 'input-file': Flags.string({
22
- char: 'i',
23
- description: 'Input gff or gtf file',
24
- required: true,
25
- }),
26
- assembly: Flags.string({
27
- char: 'a',
28
- description: 'Name for this assembly. Use the file name if omitted',
29
- }),
30
- 'omit-features': Flags.boolean({
31
- char: 'o',
32
- description: 'Do not import features, only upload the sequences',
33
- }),
34
- force: Flags.boolean({
35
- char: 'f',
36
- description: 'Delete existing assembly, if it exists',
37
- }),
38
- };
39
- async run() {
40
- const { flags } = await this.parse(AddGff);
41
- if (!fs.existsSync(flags['input-file'])) {
42
- this.error(`File ${flags['input-file']} does not exist`);
43
- }
44
- const access = await this.getAccess(flags['config-file'], flags.profile);
45
- const fileId = await uploadFile(access.address, access.accessToken, flags['input-file'], 'text/x-gff3');
46
- let typeName = 'AddAssemblyAndFeaturesFromFileChange';
47
- if (flags['omit-features']) {
48
- typeName = 'AddAssemblyFromFileChange';
49
- }
50
- const assemblyName = flags.assembly ?? path.basename(flags['input-file']);
51
- const body = {
52
- assemblyName,
53
- fileId,
54
- typeName,
55
- assembly: new ObjectId().toHexString(),
56
- };
57
- const res = await submitAssembly(access.address, access.accessToken, body, flags.force);
58
- if (!res.ok) {
59
- const errorMessage = await createFetchErrorMessage(res, 'getFeatureById failed');
60
- throw new Error(errorMessage);
61
- }
62
- }
63
- }