@genobank/biofs 3.21.0 → 3.22.0
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/CHANGELOG.md +4 -0
- package/dist/commands/imaging/package.d.ts +64 -0
- package/dist/commands/imaging/package.d.ts.map +1 -0
- package/dist/commands/imaging/package.js +235 -0
- package/dist/commands/imaging/package.js.map +1 -0
- package/dist/commands/inventory-delegate/index.d.ts +28 -0
- package/dist/commands/inventory-delegate/index.d.ts.map +1 -0
- package/dist/commands/inventory-delegate/index.js +171 -0
- package/dist/commands/inventory-delegate/index.js.map +1 -0
- package/dist/commands/inventory-list/index.d.ts +33 -0
- package/dist/commands/inventory-list/index.d.ts.map +1 -0
- package/dist/commands/inventory-list/index.js +74 -0
- package/dist/commands/inventory-list/index.js.map +1 -0
- package/dist/commands/inventory-register/index.d.ts +8 -0
- package/dist/commands/inventory-register/index.d.ts.map +1 -0
- package/dist/commands/inventory-register/index.js +57 -0
- package/dist/commands/inventory-register/index.js.map +1 -0
- package/dist/commands/job-view/index.d.ts +15 -0
- package/dist/commands/job-view/index.d.ts.map +1 -0
- package/dist/commands/job-view/index.js +88 -0
- package/dist/commands/job-view/index.js.map +1 -0
- package/dist/commands/neoantigen-pipeline/index.d.ts +35 -1
- package/dist/commands/neoantigen-pipeline/index.d.ts.map +1 -1
- package/dist/commands/neoantigen-pipeline/index.js +107 -1
- package/dist/commands/neoantigen-pipeline/index.js.map +1 -1
- package/dist/commands/parabricks/index.d.ts +83 -0
- package/dist/commands/parabricks/index.d.ts.map +1 -0
- package/dist/commands/parabricks/index.js +340 -0
- package/dist/commands/parabricks/index.js.map +1 -0
- package/dist/commands/parabricks/registry.json +15100 -0
- package/dist/commands/whoami.d.ts +1 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +20 -0
- package/dist/commands/whoami.js.map +1 -1
- package/dist/index.js +169 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/utils/node_roles.d.ts +16 -0
- package/dist/lib/utils/node_roles.d.ts.map +1 -0
- package/dist/lib/utils/node_roles.js +34 -0
- package/dist/lib/utils/node_roles.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildInventoryListBody = buildInventoryListBody;
|
|
7
|
+
exports.groupRows = groupRows;
|
|
8
|
+
exports.inventoryListCommand = inventoryListCommand;
|
|
9
|
+
/**
|
|
10
|
+
* biofs inventory-list (--serial <s...> | --lab <name>) [--type <t...>] [--limit n] [--json]
|
|
11
|
+
*
|
|
12
|
+
* NODE OPERATOR verb, read-only. Lists the file rows of bioroutes.inventory for given sample serials or one lab (never the whole inventory), so a pipeline can name its inputs by
|
|
13
|
+
* biocid. Copies of one file in several buckets are grouped. A thin client: biofs-node (POST /agent/inventory_list) checks the signer is a node operator and reads the table.
|
|
14
|
+
*/
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const credentials_1 = require("../../lib/auth/credentials");
|
|
18
|
+
const node_roles_1 = require("../../lib/utils/node_roles");
|
|
19
|
+
const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
|
|
20
|
+
|| `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
|
|
21
|
+
function buildInventoryListBody(options) {
|
|
22
|
+
const serials = options.serial || [];
|
|
23
|
+
if (!serials.length && !options.lab)
|
|
24
|
+
throw new Error('give --serial <serial...> or --lab <name> (the whole inventory is never listed)');
|
|
25
|
+
const body = { serials, types: (options.type || []).map((t) => t.toLowerCase()) };
|
|
26
|
+
if (options.lab)
|
|
27
|
+
body.lab = options.lab;
|
|
28
|
+
if (options.limit !== undefined) {
|
|
29
|
+
const n = parseInt(options.limit, 10);
|
|
30
|
+
if (!Number.isFinite(n) || n < 1)
|
|
31
|
+
throw new Error('--limit must be a positive number');
|
|
32
|
+
body.limit = n;
|
|
33
|
+
}
|
|
34
|
+
return body;
|
|
35
|
+
}
|
|
36
|
+
/** One line per distinct file (serial, type, object name); the number of copies and the distinct buckets are kept. */
|
|
37
|
+
function groupRows(rows) {
|
|
38
|
+
const m = new Map();
|
|
39
|
+
for (const r of rows) {
|
|
40
|
+
const name = (r.object || '').split('/').pop() || '';
|
|
41
|
+
const key = `${r.sample_serial}|${r.filetype}|${name}|${r.size}`;
|
|
42
|
+
let g = m.get(key);
|
|
43
|
+
if (!g) {
|
|
44
|
+
g = { serial: r.sample_serial || '', type: r.filetype || '', name, size: r.size, owner: r.owner_wallet, copies: 0, buckets: [], biocids: [] };
|
|
45
|
+
m.set(key, g);
|
|
46
|
+
}
|
|
47
|
+
g.copies += 1;
|
|
48
|
+
if (r.bucket && !g.buckets.includes(r.bucket))
|
|
49
|
+
g.buckets.push(r.bucket);
|
|
50
|
+
if (r.biocid)
|
|
51
|
+
g.biocids.push(r.biocid);
|
|
52
|
+
}
|
|
53
|
+
return [...m.values()].sort((a, b) => (a.serial + a.type + a.name).localeCompare(b.serial + b.type + b.name));
|
|
54
|
+
}
|
|
55
|
+
async function inventoryListCommand(options) {
|
|
56
|
+
const body = buildInventoryListBody(options);
|
|
57
|
+
const credentials = await (0, credentials_1.getCredentials)();
|
|
58
|
+
if (!credentials)
|
|
59
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
60
|
+
const headers = { 'X-Biofs-Wallet': credentials.wallet_address, 'X-Biofs-Signature': credentials.user_signature };
|
|
61
|
+
const r = await axios_1.default.post(`${BIOFS_NODE_BASE}/inventory_list`, body, { headers, timeout: 60000, validateStatus: (s) => s < 500 });
|
|
62
|
+
if (r.status >= 400)
|
|
63
|
+
throw new Error((0, node_roles_1.nodeErrorMessage)(r.status, r.data?.error));
|
|
64
|
+
if (options.json) {
|
|
65
|
+
console.log(JSON.stringify(r.data, null, 2));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const groups = groupRows(r.data.rows);
|
|
69
|
+
for (const g of groups) {
|
|
70
|
+
console.log(`${chalk_1.default.bold(g.serial)} ${g.type.padEnd(8)} ${g.name} ${g.size ?? '?'} bytes owner ${g.owner} ${g.copies} cop${g.copies === 1 ? 'y' : 'ies'} in ${g.buckets.join(', ')}`);
|
|
71
|
+
}
|
|
72
|
+
console.log(chalk_1.default.gray(`${r.data.count} rows, ${groups.length} distinct files${r.data.truncated ? ' (truncated: raise --limit)' : ''}. Use --json for the biocids.`));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/inventory-list/index.ts"],"names":[],"mappings":";;;;;AA2BA,wDAWC;AAGD,8BAYC;AAED,oDAaC;AApED;;;;;GAKG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,4DAA4D;AAC5D,2DAA8D;AAE9D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc;OAC7C,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,sBAAsB,iBAAiB,CAAC;AAehF,SAAgB,sBAAsB,CAAC,OAA6B;IAClE,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;IACrC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACxI,MAAM,IAAI,GAA4B,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;IAC3G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
3
|
+
yes?: boolean;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildInventoryRegisterBody(biocids: string[], options: InventoryRegisterOptions): Record<string, unknown>;
|
|
7
|
+
export declare function inventoryRegisterCommand(biocids: string[], options: InventoryRegisterOptions): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/inventory-register/index.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMxH;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAclH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildInventoryRegisterBody = buildInventoryRegisterBody;
|
|
7
|
+
exports.inventoryRegisterCommand = inventoryRegisterCommand;
|
|
8
|
+
/**
|
|
9
|
+
* biofs inventory-register <biocid...> --attest "<basis>" [--yes] [--json]
|
|
10
|
+
*
|
|
11
|
+
* NODE OPERATOR verb. Copies file rows that already sit in bioroutes.inventory into biocid_registry, the table jobs resolve their inputs through. Ownership is never changed: the
|
|
12
|
+
* registry row carries the inventory row's own owner. The rows are marked consent "custodian" and carry the operator's attestation. A dry run is the default; --yes writes.
|
|
13
|
+
* A thin client: biofs-node (POST /agent/inventory_register) checks the signer is a node operator, reads both tables and writes only what it validates.
|
|
14
|
+
*/
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const credentials_1 = require("../../lib/auth/credentials");
|
|
18
|
+
const node_roles_1 = require("../../lib/utils/node_roles");
|
|
19
|
+
const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
|
|
20
|
+
|| `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
|
|
21
|
+
const BIOCID_RE = /^biocid:\/\/[A-Za-z0-9_-]+\/0x[0-9a-fA-F]{40}\/[A-Za-z0-9_-]+\/\S+$/;
|
|
22
|
+
function buildInventoryRegisterBody(biocids, options) {
|
|
23
|
+
if (!biocids.length)
|
|
24
|
+
throw new Error('give at least one biocid');
|
|
25
|
+
for (const b of biocids)
|
|
26
|
+
if (!BIOCID_RE.test(b))
|
|
27
|
+
throw new Error(`not a biocid (a gs:// path, URL or file name is never accepted): ${b}`);
|
|
28
|
+
const attestation = String(options.attest || '').replace(/\s+/g, ' ').trim();
|
|
29
|
+
if (attestation.length < 20)
|
|
30
|
+
throw new Error('--attest needs at least 20 characters: the basis on which GenoBank.io holds and uses these files');
|
|
31
|
+
return { biocids, attestation, dry_run: !options.yes };
|
|
32
|
+
}
|
|
33
|
+
async function inventoryRegisterCommand(biocids, options) {
|
|
34
|
+
const body = buildInventoryRegisterBody(biocids, options);
|
|
35
|
+
const credentials = await (0, credentials_1.getCredentials)();
|
|
36
|
+
if (!credentials)
|
|
37
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
38
|
+
const headers = { 'X-Biofs-Wallet': credentials.wallet_address, 'X-Biofs-Signature': credentials.user_signature };
|
|
39
|
+
const r = await axios_1.default.post(`${BIOFS_NODE_BASE}/inventory_register`, body, { headers, timeout: 60000, validateStatus: (s) => s < 500 });
|
|
40
|
+
if (r.status >= 400)
|
|
41
|
+
throw new Error((0, node_roles_1.nodeErrorMessage)(r.status, r.data?.error));
|
|
42
|
+
if (options.json) {
|
|
43
|
+
console.log(JSON.stringify(r.data, null, 2));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const d = r.data;
|
|
47
|
+
console.log(chalk_1.default.bold(d.dry_run ? 'Dry run: nothing was written. Add --yes to register.' : 'Registered.'));
|
|
48
|
+
for (const x of d.registered || [])
|
|
49
|
+
console.log(chalk_1.default.green(` ${d.dry_run ? 'would register' : 'registered'} ${x.biocid} owner ${x.owner_wallet} ${x.file_size} bytes`));
|
|
50
|
+
for (const x of d.exists || [])
|
|
51
|
+
console.log(chalk_1.default.gray(` already registered ${x}`));
|
|
52
|
+
for (const x of d.errors || [])
|
|
53
|
+
console.log(chalk_1.default.red(` refused ${x.biocid}: ${x.reason}`));
|
|
54
|
+
if ((d.errors || []).length)
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/inventory-register/index.ts"],"names":[],"mappings":";;;;;AAsBA,gEAMC;AAED,4DAcC;AA5CD;;;;;;GAMG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,4DAA4D;AAC5D,2DAA8D;AAE9D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc;OAC7C,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,sBAAsB,iBAAiB,CAAC;AAChF,MAAM,SAAS,GAAG,qEAAqE,CAAC;AAQxF,SAAgB,0BAA0B,CAAC,OAAiB,EAAE,OAAiC;IAC7F,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACjE,KAAK,MAAM,CAAC,IAAI,OAAO;QAAE,IAAI,CAAC,SAAS,C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+
from?: string;
|
|
8
|
+
json?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildJobsPath(o: JobsOptions): string;
|
|
11
|
+
export declare function buildLogPath(job: string, from: number): string;
|
|
12
|
+
export declare function elapsed(a?: string | number | null, b?: string | number | null): string;
|
|
13
|
+
export declare function jobsCommand(o: JobsOptions): Promise<void>;
|
|
14
|
+
export declare function jobLogCommand(job: string, o: JobLogOptions, sleep?: (ms: number) => Promise<void>): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/job-view/index.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,WAAW;IAAG,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;AAC/D,MAAM,WAAW,aAAa;IAAG,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;AAElF,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAKpD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED,wBAAgB,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAMtF;AAWD,wBAAsB,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,GAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAiD,GAAG,OAAO,CAAC,IAAI,CAAC,CAWtK"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildJobsPath = buildJobsPath;
|
|
7
|
+
exports.buildLogPath = buildLogPath;
|
|
8
|
+
exports.elapsed = elapsed;
|
|
9
|
+
exports.jobsCommand = jobsCommand;
|
|
10
|
+
exports.jobLogCommand = jobLogCommand;
|
|
11
|
+
/**
|
|
12
|
+
* biofs jobs [--limit n] [--json] the governed jobs you may see (as owner, submitter, node operator or node viewer), newest first
|
|
13
|
+
* biofs job-log <job> [--follow] [--from n] [--json] the run log of a job (pbrun's own output), live with --follow; also: biofs pbrun logs <job>
|
|
14
|
+
*
|
|
15
|
+
* Read-only CLIENT verbs over biofs-node (GET /agent/jobs_recent, GET /agent/job_log). The node decides who may see a job; a job you may not see is "not found".
|
|
16
|
+
*/
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
+
const credentials_1 = require("../../lib/auth/credentials");
|
|
20
|
+
const node_roles_1 = require("../../lib/utils/node_roles");
|
|
21
|
+
const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
|
|
22
|
+
|| `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
|
|
23
|
+
const JOB_RE = /^neo-[0-9a-f-]{36}$/;
|
|
24
|
+
function buildJobsPath(o) {
|
|
25
|
+
if (o.limit === undefined)
|
|
26
|
+
return '/jobs_recent';
|
|
27
|
+
const n = parseInt(o.limit, 10);
|
|
28
|
+
if (!Number.isFinite(n) || n < 1 || n > 100)
|
|
29
|
+
throw new Error('--limit must be between 1 and 100');
|
|
30
|
+
return `/jobs_recent?limit=${n}`;
|
|
31
|
+
}
|
|
32
|
+
function buildLogPath(job, from) {
|
|
33
|
+
if (!JOB_RE.test(job))
|
|
34
|
+
throw new Error('give a job id of the form neo-<uuid>');
|
|
35
|
+
if (!Number.isInteger(from) || from < 0)
|
|
36
|
+
throw new Error('--from must be a non-negative integer');
|
|
37
|
+
return `/job_log?neoantigen_job_id=${job}&from=${from}`;
|
|
38
|
+
}
|
|
39
|
+
function elapsed(a, b) {
|
|
40
|
+
if (!a)
|
|
41
|
+
return '';
|
|
42
|
+
const t0 = typeof a === 'number' ? a * 1000 : Date.parse(a);
|
|
43
|
+
const t1 = b ? (typeof b === 'number' ? b * 1000 : Date.parse(b)) : Date.now();
|
|
44
|
+
const s = Math.max(0, Math.round((t1 - t0) / 1000));
|
|
45
|
+
return s >= 3600 ? `${Math.floor(s / 3600)}h${String(Math.floor((s % 3600) / 60)).padStart(2, '0')}m` : s >= 60 ? `${Math.floor(s / 60)}m${String(s % 60).padStart(2, '0')}s` : `${s}s`;
|
|
46
|
+
}
|
|
47
|
+
async function get(path) {
|
|
48
|
+
const credentials = await (0, credentials_1.getCredentials)();
|
|
49
|
+
if (!credentials)
|
|
50
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
51
|
+
const headers = { 'X-Biofs-Wallet': credentials.wallet_address, 'X-Biofs-Signature': credentials.user_signature };
|
|
52
|
+
const r = await axios_1.default.get(`${BIOFS_NODE_BASE}${path}`, { headers, timeout: 30000, validateStatus: (s) => s < 500 });
|
|
53
|
+
if (r.status >= 400)
|
|
54
|
+
throw new Error((0, node_roles_1.nodeErrorMessage)(r.status, r.data?.error));
|
|
55
|
+
return r.data;
|
|
56
|
+
}
|
|
57
|
+
async function jobsCommand(o) {
|
|
58
|
+
const d = await get(buildJobsPath(o));
|
|
59
|
+
if (o.json) {
|
|
60
|
+
console.log(JSON.stringify(d, null, 2));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
for (const j of d.jobs) {
|
|
64
|
+
const st = j.status === 'done' ? chalk_1.default.green(j.status) : j.status === 'failed' ? chalk_1.default.red(j.status) : chalk_1.default.yellow(j.status || '?');
|
|
65
|
+
console.log(`${j.neoantigen_job_id} ${st.padEnd(9)} ${(j.tool || j.kind || '').padEnd(14)} ${(j.case_id || '').padEnd(14)} ${elapsed(j.started_at || j.created_at, j.finished_at).padEnd(8)} ${j.stage || j.error || ''}`);
|
|
66
|
+
}
|
|
67
|
+
console.log(chalk_1.default.gray(`${d.count} jobs`));
|
|
68
|
+
}
|
|
69
|
+
async function jobLogCommand(job, o, sleep = (ms) => new Promise((r) => setTimeout(r, ms))) {
|
|
70
|
+
let from = o.from === undefined ? 0 : parseInt(o.from, 10);
|
|
71
|
+
for (;;) {
|
|
72
|
+
const d = await get(buildLogPath(job, from));
|
|
73
|
+
if (o.json)
|
|
74
|
+
console.log(JSON.stringify(d));
|
|
75
|
+
else if (d.text)
|
|
76
|
+
process.stdout.write(d.text);
|
|
77
|
+
from = d.next;
|
|
78
|
+
if (!o.follow) {
|
|
79
|
+
if (!o.json && !d.finished)
|
|
80
|
+
console.error(chalk_1.default.gray(`\n[${d.status}${d.stage ? ': ' + d.stage : ''}; next offset ${d.next}; add --follow to stream]`));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (d.finished && !d.text)
|
|
84
|
+
return;
|
|
85
|
+
await sleep(d.text ? 500 : 3000);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/job-view/index.ts"],"names":[],"mappings":";;;;;AAkBA,sCAKC;AAED,oCAIC;AAED,0BAMC;AAWD,kCAQC;AAED,sCAWC;AArED;;;;;GAKG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,4DAA4D;AAC5D,2DAA8D;AAE9D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc;OAC7C,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,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AC,CAAC;QACnL,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI;YAAE,OAAO;QAClC,MAAM,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
|
|
@@ -108,6 +108,15 @@ export interface SynapsePullOptions {
|
|
|
108
108
|
wait?: boolean;
|
|
109
109
|
json?: boolean;
|
|
110
110
|
}
|
|
111
|
+
export interface PublicFetchOptions {
|
|
112
|
+
accession?: string;
|
|
113
|
+
outName?: string;
|
|
114
|
+
pairs?: string;
|
|
115
|
+
maxTotalBytes?: string;
|
|
116
|
+
owner?: string;
|
|
117
|
+
wait?: boolean;
|
|
118
|
+
json?: boolean;
|
|
119
|
+
}
|
|
111
120
|
export interface TeslaGateOptions {
|
|
112
121
|
outcomes: string;
|
|
113
122
|
features: string[];
|
|
@@ -127,12 +136,14 @@ export declare function parseSynIds(list: string | undefined, flag: string): str
|
|
|
127
136
|
export declare function parseSuffixes(list: string | undefined): string[];
|
|
128
137
|
/** Third-party controlled-access data from Synapse onto a worker: the Synapse token lives only on the worker, never in this request, and the job never runs on the node that holds the registry. */
|
|
129
138
|
export declare function buildSynapseBody(caseId: string, o: SynapsePullOptions, wallet: string, signature: string): Record<string, unknown>;
|
|
139
|
+
/** biofs public-fetch: a PUBLIC ENA paired FASTQ run onto a governed worker. The body names an accession and nothing that names a place (no URL, no host): the worker asks the archive. */
|
|
140
|
+
export declare function buildPublicFetchBody(caseId: string, o: PublicFetchOptions, wallet: string, signature: string): Record<string, unknown>;
|
|
130
141
|
export declare function parseSha256(flag: string, v: string): string;
|
|
131
142
|
/** "1=biocid://...,2=biocid://..." (repeatable): TESLA patient id to the biocid of that subject's neoantigen-evidence features table. */
|
|
132
143
|
export declare function parseFeatures(items: string[] | string | undefined): Record<string, string>;
|
|
133
144
|
/** The registered test of the case 1 evidence gate on the TESLA subjects. The code hash, protocol hash and ledger record must be the frozen ones; the worker refuses code that differs. */
|
|
134
145
|
export declare function buildTeslaGateBody(caseId: string, o: TeslaGateOptions, wallet: string, signature: string): Record<string, unknown>;
|
|
135
|
-
type Kind = 'evidence' | 'design' | 'hla' | 'fusion' | 'indel' | 'synapse' | 'tesla_gate';
|
|
146
|
+
type Kind = 'evidence' | 'design' | 'hla' | 'fusion' | 'indel' | 'synapse' | 'tesla_gate' | 'parabricks' | 'public_fetch' | 'identity';
|
|
136
147
|
/** One line about the on-chain proof of a finished job. Never blank for a finished job: an unanchored job must not look anchored. */
|
|
137
148
|
export declare function anchorLine(row: any): string | null;
|
|
138
149
|
export declare function neoantigenEvidenceSubmitCommand(caseId: string, options: NeoantigenEvidenceOptions): Promise<void>;
|
|
@@ -141,7 +152,30 @@ export declare function neoantigenHlaSubmitCommand(caseId: string, options: Neoa
|
|
|
141
152
|
export declare function neoantigenFusionSubmitCommand(caseId: string, options: NeoantigenFusionOptions): Promise<void>;
|
|
142
153
|
export declare function neoantigenIndelSubmitCommand(caseId: string, options: NeoantigenIndelOptions): Promise<void>;
|
|
143
154
|
export declare function synapsePullSubmitCommand(caseId: string, options: SynapsePullOptions): Promise<void>;
|
|
155
|
+
export declare function publicFetchSubmitCommand(caseId: string, options: PublicFetchOptions): Promise<void>;
|
|
156
|
+
export interface IdentityOptions {
|
|
157
|
+
sample: string[];
|
|
158
|
+
codeSha256: string;
|
|
159
|
+
protocolSha256: string;
|
|
160
|
+
ledgerRecord: string;
|
|
161
|
+
minDepth?: string;
|
|
162
|
+
minGq?: string;
|
|
163
|
+
executor?: string;
|
|
164
|
+
owner?: string;
|
|
165
|
+
wait?: boolean;
|
|
166
|
+
json?: boolean;
|
|
167
|
+
}
|
|
168
|
+
/** label=biocid entries, 2 to 8, labels of letters, digits, _ and - (never a person name), no biocid twice. */
|
|
169
|
+
export declare function parseSamples(items: string[] | string | undefined): Record<string, string>;
|
|
170
|
+
/** Are these samples the same individual? The registered identity protocol: the code hash, protocol hash and ledger record must be the frozen ones; the worker refuses code that differs. */
|
|
171
|
+
export declare function buildIdentityBody(caseId: string, o: IdentityOptions, wallet: string, signature: string): Record<string, unknown>;
|
|
172
|
+
export declare function identitySubmitCommand(caseId: string, options: IdentityOptions): Promise<void>;
|
|
144
173
|
export declare function teslaGateSubmitCommand(caseId: string, options: TeslaGateOptions): Promise<void>;
|
|
174
|
+
/** Used by the pbrun verbs (commands/parabricks): sign, submit the job body, optionally wait. The body is built and checked by the caller. */
|
|
175
|
+
export declare function parabricksSubmit(buildBody: (wallet: string, signature: string) => Record<string, unknown>, options: {
|
|
176
|
+
wait?: boolean;
|
|
177
|
+
json?: boolean;
|
|
178
|
+
}): Promise<void>;
|
|
145
179
|
export declare function neoantigenStatusCommand(kind: Kind, id: string, options: {
|
|
146
180
|
wait?: boolean;
|
|
147
181
|
json?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/neoantigen-pipeline/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/neoantigen-pipeline/index.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,SAAS,QAA6E,CAAC;AACpG,eAAO,MAAM,MAAM,QAAmC,CAAC;AAEvD,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC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uffixes = parseSuffixes;
|
|
25
25
|
exports.buildSynapseBody = buildSynapseBody;
|
|
26
|
+
exports.buildPublicFetchBody = buildPublicFetchBody;
|
|
26
27
|
exports.parseSha256 = parseSha256;
|
|
27
28
|
exports.parseFeatures = parseFeatures;
|
|
28
29
|
exports.buildTeslaGateBody = buildTeslaGateBody;
|
|
@@ -33,7 +34,12 @@ exports.neoantigenHlaSubmitCommand = neoantigenHlaSubmitCommand;
|
|
|
33
34
|
exports.neoantigenFusionSubmitCommand = neoantigenFusionSubmitCommand;
|
|
34
35
|
exports.neoantigenIndelSubmitCommand = neoantigenIndelSubmitCommand;
|
|
35
36
|
exports.synapsePullSubmitCommand = synapsePullSubmitCommand;
|
|
37
|
+
exports.publicFetchSubmitCommand = publicFetchSubmitCommand;
|
|
38
|
+
exports.parseSamples = parseSamples;
|
|
39
|
+
exports.buildIdentityBody = buildIdentityBody;
|
|
40
|
+
exports.identitySubmitCommand = identitySubmitCommand;
|
|
36
41
|
exports.teslaGateSubmitCommand = teslaGateSubmitCommand;
|
|
42
|
+
exports.parabricksSubmit = parabricksSubmit;
|
|
37
43
|
exports.neoantigenStatusCommand = neoantigenStatusCommand;
|
|
38
44
|
/**
|
|
39
45
|
* biofs neoantigen-evidence submit <caseId> --somatic-sqlite <biocid> --filtered-vcf <biocid> --tumor <biocid> --normal <biocid> [--second-dna <biocid>] [--rna <biocid>] [--tpm <biocid>]
|
|
@@ -43,6 +49,7 @@ exports.neoantigenStatusCommand = neoantigenStatusCommand;
|
|
|
43
49
|
* biofs neoantigen-fusion submit <caseId> --fusion-evidence <biocid> --five-gene <symbol> --three-gene <symbol> (--hla <alleles> | --hla-from <biocid>) [--min-templates 10]
|
|
44
50
|
* biofs neoantigen-indel submit <caseId> --somatic-sqlite <biocid> (--hla <alleles> | --hla-from <biocid>) [--tpm <biocid>] [--rna <biocid>] [--min-alt 8] [--genes TGFBR2,...]
|
|
45
51
|
* biofs synapse-pull submit <caseId> (--entities syn1,syn2 | --folder syn123 [--suffixes .fastq.gz,.bam]) [--project syn123] [--list-only] --access-basis "<approval>" [--max-total-bytes N]
|
|
52
|
+
* biofs identity-concordance submit <caseId> --sample label=<gvcf biocid> ... --code-sha256 <hex> --protocol-sha256 <hex> --ledger-record <n> are these samples the same individual (decision support)
|
|
46
53
|
* biofs tesla-gate submit <caseId> --outcomes <biocid> --features 1=<biocid> 2=<biocid> ... --code-sha256 <hex> --protocol-sha256 <hex> --ledger-record <n> [--selftest]
|
|
47
54
|
* every submit verb takes [--executor auto|worker|local]: auto (default) runs on a healthy neoantigen worker agent and otherwise on the node, worker never falls back, local never uses a worker.
|
|
48
55
|
* biofs neoantigen-design status <job> [--wait]
|
|
@@ -62,6 +69,7 @@ exports.neoantigenStatusCommand = neoantigenStatusCommand;
|
|
|
62
69
|
const axios_1 = __importDefault(require("axios"));
|
|
63
70
|
const chalk_1 = __importDefault(require("chalk"));
|
|
64
71
|
const credentials_1 = require("../../lib/auth/credentials");
|
|
72
|
+
const node_roles_1 = require("../../lib/utils/node_roles");
|
|
65
73
|
const logger_1 = require("../../lib/utils/logger");
|
|
66
74
|
const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
|
|
67
75
|
|| `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
|
|
@@ -284,6 +292,31 @@ function buildSynapseBody(caseId, o, wallet, signature) {
|
|
|
284
292
|
}
|
|
285
293
|
return body;
|
|
286
294
|
}
|
|
295
|
+
/** biofs public-fetch: a PUBLIC ENA paired FASTQ run onto a governed worker. The body names an accession and nothing that names a place (no URL, no host): the worker asks the archive. */
|
|
296
|
+
function buildPublicFetchBody(caseId, o, wallet, signature) {
|
|
297
|
+
if (!/^[A-Za-z0-9_-]{1,64}$/.test(caseId))
|
|
298
|
+
throw new Error('caseId must be a case identifier of letters, digits, _ or - (never a person name)');
|
|
299
|
+
const acc = (o.accession || '').trim();
|
|
300
|
+
if (!/^[SED]RR[0-9]{6,9}$/.test(acc))
|
|
301
|
+
throw new Error('--accession must be an ENA run accession like SRR1234567');
|
|
302
|
+
const body = { wallet: ownerOr(o.owner, wallet), signature, case_id: caseId, executor: 'worker', accession: acc };
|
|
303
|
+
if (o.outName) {
|
|
304
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]{0,40}$/.test(o.outName))
|
|
305
|
+
throw new Error('--out-name must be letters, digits, _ or -, starting with a letter, up to 41 characters');
|
|
306
|
+
body.out_name = o.outName;
|
|
307
|
+
}
|
|
308
|
+
if (o.pairs !== undefined && o.pairs !== '') {
|
|
309
|
+
const n = Number(o.pairs);
|
|
310
|
+
if (!Number.isInteger(n) || n < 1000 || n > 50000000)
|
|
311
|
+
throw new Error('--pairs must be an integer from 1000 to 50000000');
|
|
312
|
+
body.subsample_pairs = n;
|
|
313
|
+
}
|
|
314
|
+
const cap = Number(o.maxTotalBytes);
|
|
315
|
+
if (o.maxTotalBytes === undefined || o.maxTotalBytes === '' || !Number.isInteger(cap) || cap < 1 || cap > 2e12)
|
|
316
|
+
throw new Error('--max-total-bytes is required: a positive integer up to 2000000000000 (the download is refused above it)');
|
|
317
|
+
body.max_total_bytes = cap;
|
|
318
|
+
return body;
|
|
319
|
+
}
|
|
287
320
|
function parseSha256(flag, v) {
|
|
288
321
|
const x = (v || '').trim().toLowerCase();
|
|
289
322
|
if (!/^[0-9a-f]{64}$/.test(x))
|
|
@@ -346,6 +379,9 @@ const ROUTE = {
|
|
|
346
379
|
indel: { post: 'neoantigen_indel', status: 'neoantigen_indel_status', id: 'neoantigen_job_id', verb: 'neoantigen-indel' },
|
|
347
380
|
synapse: { post: 'neoantigen_synapse', status: 'neoantigen_synapse_status', id: 'neoantigen_job_id', verb: 'synapse-pull' },
|
|
348
381
|
tesla_gate: { post: 'neoantigen_tesla_gate', status: 'neoantigen_tesla_gate_status', id: 'neoantigen_job_id', verb: 'tesla-gate' },
|
|
382
|
+
parabricks: { post: 'neoantigen_parabricks', status: 'neoantigen_parabricks_status', id: 'neoantigen_job_id', verb: 'pbrun' },
|
|
383
|
+
public_fetch: { post: 'neoantigen_public_fetch', status: 'neoantigen_public_fetch_status', id: 'neoantigen_job_id', verb: 'public-fetch' },
|
|
384
|
+
identity: { post: 'neoantigen_identity', status: 'neoantigen_identity_status', id: 'neoantigen_job_id', verb: 'identity-concordance' },
|
|
349
385
|
};
|
|
350
386
|
async function fetchStatus(kind, id, headers) {
|
|
351
387
|
const r = await axios_1.default.get(`${BIOFS_NODE_BASE}/${ROUTE[kind].status}`, {
|
|
@@ -403,7 +439,7 @@ async function waitFor(kind, id, headers, json) {
|
|
|
403
439
|
async function submit(kind, body, headers, opts) {
|
|
404
440
|
const r = await axios_1.default.post(`${BIOFS_NODE_BASE}/${ROUTE[kind].post}`, body, { headers, timeout: 60000, validateStatus: (s) => s < 500 });
|
|
405
441
|
if (r.status >= 400)
|
|
406
|
-
throw new Error(
|
|
442
|
+
throw new Error((0, node_roles_1.nodeErrorMessage)(r.status, r.data?.error, typeof body.wallet === 'string' ? body.wallet : undefined));
|
|
407
443
|
const id = r.data[ROUTE[kind].id];
|
|
408
444
|
if (!opts.wait) {
|
|
409
445
|
if (opts.json)
|
|
@@ -476,6 +512,71 @@ async function synapsePullSubmitCommand(caseId, options) {
|
|
|
476
512
|
process.exit(1);
|
|
477
513
|
}
|
|
478
514
|
}
|
|
515
|
+
async function publicFetchSubmitCommand(caseId, options) {
|
|
516
|
+
try {
|
|
517
|
+
const a = await auth();
|
|
518
|
+
await submit('public_fetch', buildPublicFetchBody(caseId, options, a.wallet, a.signature), a.headers, options);
|
|
519
|
+
}
|
|
520
|
+
catch (e) {
|
|
521
|
+
logger_1.Logger.error(`public-fetch submit failed: ${e.message}`);
|
|
522
|
+
process.exit(1);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/** label=biocid entries, 2 to 8, labels of letters, digits, _ and - (never a person name), no biocid twice. */
|
|
526
|
+
function parseSamples(items) {
|
|
527
|
+
const raw = [].concat(items || []).flatMap((x) => String(x).split(/,(?=[A-Za-z0-9_-]{1,32}=)/)).map((x) => x.trim()).filter(Boolean);
|
|
528
|
+
if (raw.length < 2 || raw.length > 8)
|
|
529
|
+
throw new Error('--sample needs 2 to 8 entries of label=biocid, for example L13972=biocid://genobank/0x.../gvcf/neo-....g.vcf.gz');
|
|
530
|
+
const out = {};
|
|
531
|
+
const seen = new Set();
|
|
532
|
+
for (const r of raw) {
|
|
533
|
+
const i = r.indexOf('=');
|
|
534
|
+
const id = r.slice(0, i);
|
|
535
|
+
if (i < 1 || !/^[A-Za-z0-9_-]{1,32}$/.test(id))
|
|
536
|
+
throw new Error(`--sample entry "${r}" is not label=biocid (letters, digits, _ and - only)`);
|
|
537
|
+
if (out[id])
|
|
538
|
+
throw new Error(`--sample names label ${id} twice`);
|
|
539
|
+
const b = requireBiocid(`--sample ${id}`, r.slice(i + 1));
|
|
540
|
+
if (seen.has(b.toLowerCase()))
|
|
541
|
+
throw new Error(`--sample lists the same biocid twice (${id})`);
|
|
542
|
+
seen.add(b.toLowerCase());
|
|
543
|
+
out[id] = b;
|
|
544
|
+
}
|
|
545
|
+
return out;
|
|
546
|
+
}
|
|
547
|
+
/** Are these samples the same individual? The registered identity protocol: the code hash, protocol hash and ledger record must be the frozen ones; the worker refuses code that differs. */
|
|
548
|
+
function buildIdentityBody(caseId, o, wallet, signature) {
|
|
549
|
+
if (!/^[A-Za-z0-9_-]{1,64}$/.test(caseId))
|
|
550
|
+
throw new Error('caseId must be a case identifier of letters, digits, _ or - (never a person name)');
|
|
551
|
+
const rec = Number(o.ledgerRecord);
|
|
552
|
+
if (!Number.isInteger(rec) || rec < 1)
|
|
553
|
+
throw new Error('--ledger-record must be the pre-registration ledger record number');
|
|
554
|
+
const num = (name, v, lo, hi, def) => {
|
|
555
|
+
const n = v === undefined ? def : Number(v);
|
|
556
|
+
if (!Number.isInteger(n) || n < lo || n > hi)
|
|
557
|
+
throw new Error(`${name} must be an integer from ${lo} to ${hi}`);
|
|
558
|
+
return n;
|
|
559
|
+
};
|
|
560
|
+
return {
|
|
561
|
+
wallet: ownerOr(o.owner, wallet), signature, case_id: caseId,
|
|
562
|
+
samples_biocids: parseSamples(o.sample),
|
|
563
|
+
min_depth: num('--min-depth', o.minDepth, 1, 200, 10), min_gq: num('--min-gq', o.minGq, 0, 99, 20),
|
|
564
|
+
code_sha256: parseSha256('--code-sha256', o.codeSha256),
|
|
565
|
+
protocol_sha256: parseSha256('--protocol-sha256', o.protocolSha256),
|
|
566
|
+
ledger_record: rec,
|
|
567
|
+
executor: parseExecutor(o.executor),
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
async function identitySubmitCommand(caseId, options) {
|
|
571
|
+
try {
|
|
572
|
+
const a = await auth();
|
|
573
|
+
await submit('identity', buildIdentityBody(caseId, options, a.wallet, a.signature), a.headers, options);
|
|
574
|
+
}
|
|
575
|
+
catch (e) {
|
|
576
|
+
logger_1.Logger.error(`identity-concordance submit failed: ${e.message}`);
|
|
577
|
+
process.exit(1);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
479
580
|
async function teslaGateSubmitCommand(caseId, options) {
|
|
480
581
|
try {
|
|
481
582
|
const a = await auth();
|
|
@@ -486,6 +587,11 @@ async function teslaGateSubmitCommand(caseId, options) {
|
|
|
486
587
|
process.exit(1);
|
|
487
588
|
}
|
|
488
589
|
}
|
|
590
|
+
/** Used by the pbrun verbs (commands/parabricks): sign, submit the job body, optionally wait. The body is built and checked by the caller. */
|
|
591
|
+
async function parabricksSubmit(buildBody, options) {
|
|
592
|
+
const a = await auth();
|
|
593
|
+
await submit('parabricks', buildBody(a.wallet, a.signature), a.headers, options);
|
|
594
|
+
}
|
|
489
595
|
async function neoantigenStatusCommand(kind, id, options) {
|
|
490
596
|
try {
|
|
491
597
|
const a = await auth();
|