@apollo-annotation/cli 0.1.19 → 0.1.20
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 +283 -106
- package/dist/baseCommand.d.ts +1 -1
- package/dist/baseCommand.js +3 -4
- package/dist/commands/assembly/add-from-fasta.d.ts +23 -0
- package/dist/commands/assembly/add-from-fasta.js +165 -0
- package/dist/commands/assembly/{add-gff.d.ts → add-from-gff.d.ts} +5 -3
- package/dist/commands/assembly/{add-gff.js → add-from-gff.js} +20 -21
- package/dist/commands/assembly/check.js +9 -9
- package/dist/commands/assembly/delete.js +4 -4
- package/dist/commands/assembly/get.js +4 -4
- package/dist/commands/assembly/sequence.js +4 -4
- package/dist/commands/change/get.js +7 -7
- package/dist/commands/config.js +3 -4
- package/dist/commands/feature/add-child.js +6 -5
- package/dist/commands/feature/check.js +6 -6
- package/dist/commands/feature/copy.js +5 -4
- package/dist/commands/feature/delete.js +4 -4
- package/dist/commands/feature/edit-attribute.js +6 -5
- package/dist/commands/feature/edit-coords.js +5 -5
- package/dist/commands/feature/edit-type.js +5 -5
- package/dist/commands/feature/edit.js +5 -5
- package/dist/commands/feature/get-id.js +5 -5
- package/dist/commands/feature/get.js +3 -3
- package/dist/commands/feature/import.d.ts +2 -2
- package/dist/commands/feature/import.js +6 -6
- package/dist/commands/feature/search.js +6 -6
- package/dist/commands/file/delete.d.ts +13 -0
- package/dist/commands/file/delete.js +58 -0
- package/dist/commands/file/download.d.ts +14 -0
- package/dist/commands/file/download.js +45 -0
- package/dist/commands/file/get.d.ts +13 -0
- package/dist/commands/file/get.js +38 -0
- package/dist/commands/file/upload.d.ts +16 -0
- package/dist/commands/file/upload.js +88 -0
- package/dist/commands/jbrowse/get-config.d.ts +10 -0
- package/dist/commands/jbrowse/get-config.js +21 -0
- package/dist/commands/jbrowse/set-config.d.ts +13 -0
- package/dist/commands/jbrowse/set-config.js +51 -0
- package/dist/commands/login.js +11 -15
- package/dist/commands/logout.js +2 -2
- package/dist/commands/refseq/add-alias.js +3 -3
- package/dist/commands/refseq/get.js +8 -8
- package/dist/commands/status.js +4 -3
- package/dist/commands/user/get.js +3 -3
- package/dist/fileCommand.d.ts +5 -0
- package/dist/fileCommand.js +76 -0
- package/dist/utils.d.ts +20 -9
- package/dist/utils.js +25 -103
- package/oclif.manifest.json +445 -69
- package/package.json +50 -43
- package/dist/commands/assembly/add-fasta.d.ts +0 -15
- package/dist/commands/assembly/add-fasta.js +0 -87
package/package.json
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo-annotation/cli",
|
|
3
|
+
"version": "0.1.20",
|
|
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
|
-
"
|
|
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
|
-
"
|
|
18
|
-
|
|
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.
|
|
54
|
-
"@apollo-annotation/shared": "^0.1.
|
|
87
|
+
"@apollo-annotation/mst": "^0.1.20",
|
|
88
|
+
"@apollo-annotation/shared": "^0.1.20",
|
|
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
|
-
"
|
|
76
|
-
"
|
|
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
|
-
}
|