@nyrra/prismantix-cli 0.0.3-next.23 → 0.0.3-next.25
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 +4 -2
- package/dist/api.d.ts +4 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +5 -2
- package/dist/commands/records/generate.d.ts +2 -0
- package/dist/commands/records/generate.d.ts.map +1 -1
- package/dist/commands/records/generate.js +47 -2
- package/dist/commands/records/status.d.ts.map +1 -1
- package/dist/commands/records/status.js +5 -0
- package/dist/generation.d.ts +4 -1
- package/dist/generation.d.ts.map +1 -1
- package/dist/generation.js +16 -3
- package/oclif.manifest.json +16 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,14 +10,16 @@ prismantix ontology list
|
|
|
10
10
|
prismantix object list healthcare
|
|
11
11
|
prismantix object details deviations
|
|
12
12
|
prismantix records pull --client NVO
|
|
13
|
-
prismantix records generate --client NVO --ontology
|
|
13
|
+
prismantix records generate --client NVO --ontology operations
|
|
14
|
+
prismantix records generate --client BSX --ontology medtech \
|
|
15
|
+
--object device-installations --object service-events --count 10
|
|
14
16
|
prismantix records status <operation-id>
|
|
15
17
|
prismantix records cancel <operation-id>
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
Every command supports `--json`. JSON mode reserves stdout for one result; progress and diagnostics go to stderr. `--api-base` overrides `PRISMANTIX_API_BASE`, whose default is `https://api.prismantix.com`.
|
|
19
21
|
|
|
20
|
-
`records generate` waits for completion by default with a 30-minute timeout. Use `--no-wait`, `--timeout`, and `--poll-interval` for operational control. A completed operation exits 0. A failed operation or an operation canceled while this command is waiting exits 1 with a typed error; an explicitly acknowledged `records cancel` request exits 0.
|
|
22
|
+
`records generate` waits for completion by default with a 30-minute timeout. With no `--object` flags it preserves the complete-ontology defaults. For a targeted run, repeat `--object` with catalog object slugs and provide `--count` (1-100 records per selected object); prerequisites are resolved automatically and existing prerequisite records are reused. Use `--no-wait`, `--timeout`, and `--poll-interval` for operational control. Terminal output includes requested, persisted, rejected, and failed counts per object. A completed operation exits 0. A failed operation or an operation canceled while this command is waiting exits 1 with a typed error; an explicitly acknowledged `records cancel` request exits 0.
|
|
21
23
|
|
|
22
24
|
`records pull` creates and waits for a CSV-bundle export, then writes `manifest.json` and its files under `./prismantix-exports/<canonical-client-id>/<export-id>/`. Use `--output`, repeatable `--table`, `--timeout`, and `--poll-interval` when needed.
|
|
23
25
|
|
package/dist/api.d.ts
CHANGED
|
@@ -185,7 +185,10 @@ type ApiClientError = ApiConfigurationError | ApiDecodeError | ApiHttpError | Ap
|
|
|
185
185
|
interface PrismantixApiClientService {
|
|
186
186
|
readonly cancelRecordGeneration: (operationId: string) => Effect.Effect<RecordGenerationStatus, ApiClientError>;
|
|
187
187
|
readonly createExport: (clientId: string) => Effect.Effect<ExportCreated, ApiClientError>;
|
|
188
|
-
readonly createRecordGeneration: (clientId: string, ontologyId: string, idempotencyKey: string
|
|
188
|
+
readonly createRecordGeneration: (clientId: string, ontologyId: string, idempotencyKey: string, objects?: readonly {
|
|
189
|
+
readonly count: number;
|
|
190
|
+
readonly objectSlug: string;
|
|
191
|
+
}[]) => Effect.Effect<RecordGenerationCreated, ApiClientError>;
|
|
189
192
|
readonly getExportStatus: (exportId: string) => Effect.Effect<ExportStatus, ApiClientError>;
|
|
190
193
|
readonly getFile: (exportId: string, tableName: string) => Effect.Effect<Response, ApiClientError>;
|
|
191
194
|
readonly getManifest: (exportId: string) => Effect.Effect<ExportManifest, ApiClientError>;
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,cAAc,EACd,OAAO,EACP,MAAM,EACN,KAAK,EAGL,MAAM,EACN,MAAM,QAAQ,CAAC;AAOhB,QAAA,MAAM,kBAAkB;;;;;;;;;EAStB,CAAC;AACH,MAAM,WAAW,kBAAmB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E,cAAc,CAAC,CAAC;IAC3D,QAAQ,CAAC,cAAc,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,eAAe,EAAE,EAAE,cAAc,CAAC,CAAC;IACzF,QAAQ,CAAC,mBAAmB,EAAE,CAC7B,UAAU,EAAE,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,SAAS,qBAAqB,EAAE,EAAE,cAAc,CAAC,CAAC;CACrE;;AAED,qBAAa,mBAAoB,SAAQ,wBAGC;CAAG;AAE7C,UAAU,+BAA+B;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAClC;AAaD,eAAO,MAAM,4BAA4B,GAAI,UAAS,+BAAoC,mEA4GxF,CAAC"}
|
package/dist/api.js
CHANGED
|
@@ -163,8 +163,11 @@ export const makePrismantixApiClientLayer = (options = {}) => Layer.effect(Prism
|
|
|
163
163
|
return PrismantixApiClient.of({
|
|
164
164
|
cancelRecordGeneration: (operationId) => request("POST", `/v1/record-generations/${encodeURIComponent(operationId)}/cancel`, RecordGenerationStatusSchema, {}, true),
|
|
165
165
|
createExport: (clientId) => request("POST", `/v1/clients/${encodeURIComponent(clientId)}/exports`, ExportCreatedSchema, { body: JSON.stringify({ output: { kind: "csv_bundle" } }) }),
|
|
166
|
-
createRecordGeneration: (clientId, ontologyId, idempotencyKey) => request("POST", `/v1/clients/${encodeURIComponent(clientId)}/record-generations`, RecordGenerationCreatedSchema, {
|
|
167
|
-
body: JSON.stringify({
|
|
166
|
+
createRecordGeneration: (clientId, ontologyId, idempotencyKey, objects) => request("POST", `/v1/clients/${encodeURIComponent(clientId)}/record-generations`, RecordGenerationCreatedSchema, {
|
|
167
|
+
body: JSON.stringify({
|
|
168
|
+
...(objects === undefined ? {} : { objects }),
|
|
169
|
+
ontologyId,
|
|
170
|
+
}),
|
|
168
171
|
headers: { "Idempotency-Key": idempotencyKey },
|
|
169
172
|
}, true),
|
|
170
173
|
getExportStatus: (exportId) => request("GET", `/v1/exports/${encodeURIComponent(exportId)}`, ExportStatusSchema, {}, true),
|
|
@@ -4,6 +4,8 @@ export default class RecordsGenerate extends Command {
|
|
|
4
4
|
static flags: {
|
|
5
5
|
client: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
6
|
ontology: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
object: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
count: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
9
|
"poll-interval": import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
timeout: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/records/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/records/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAkD7C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IACnD,OAAgB,WAAW,SACqE;IAChG,OAAgB,KAAK;;;;;;;;;;MAwBnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4CjC"}
|
|
@@ -4,12 +4,49 @@ import { Effect } from "effect";
|
|
|
4
4
|
import { apiFlags, failCommand, printResult, requireValue, runApiEffect, validatePositiveInteger, } from "../../command-support.js";
|
|
5
5
|
import { DEFAULT_GENERATION_TIMEOUT_MS, DEFAULT_POLL_INTERVAL_MS } from "../../constants.js";
|
|
6
6
|
import { createRecordGeneration, waitForRecordGeneration } from "../../generation.js";
|
|
7
|
+
import { CliUserError } from "../../errors.js";
|
|
8
|
+
const MAX_RECORDS_PER_OBJECT = 100;
|
|
9
|
+
function requestedObjects(objects, count) {
|
|
10
|
+
if (!objects?.length) {
|
|
11
|
+
if (count !== undefined) {
|
|
12
|
+
throw new CliUserError("invalid_argument", "--count requires at least one --object.");
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const requestedCount = requireRequestedObjectCount(count);
|
|
17
|
+
const normalized = uniqueObjectSlugs(objects);
|
|
18
|
+
return normalized.map((objectSlug) => ({ count: requestedCount, objectSlug }));
|
|
19
|
+
}
|
|
20
|
+
function requireRequestedObjectCount(count) {
|
|
21
|
+
if (count === undefined) {
|
|
22
|
+
throw new CliUserError("invalid_argument", "--count is required when --object is used.");
|
|
23
|
+
}
|
|
24
|
+
validatePositiveInteger(count, "--count");
|
|
25
|
+
if (count > MAX_RECORDS_PER_OBJECT) {
|
|
26
|
+
throw new CliUserError("invalid_argument", `--count must be ${MAX_RECORDS_PER_OBJECT} or less.`);
|
|
27
|
+
}
|
|
28
|
+
return count;
|
|
29
|
+
}
|
|
30
|
+
function uniqueObjectSlugs(objects) {
|
|
31
|
+
const normalized = objects.map((object) => requireValue(object, "--object").toLowerCase());
|
|
32
|
+
if (new Set(normalized).size !== normalized.length) {
|
|
33
|
+
throw new CliUserError("invalid_argument", "--object values must be unique.");
|
|
34
|
+
}
|
|
35
|
+
return normalized;
|
|
36
|
+
}
|
|
7
37
|
export default class RecordsGenerate extends Command {
|
|
8
|
-
static description = "Append
|
|
38
|
+
static description = "Append generated records for selected ontology objects, or the complete ontology by default.";
|
|
9
39
|
static flags = {
|
|
10
40
|
...apiFlags,
|
|
11
41
|
client: Flags.string({ description: "Client ID.", required: true }),
|
|
12
42
|
ontology: Flags.string({ description: "Registered ontology ID.", required: true }),
|
|
43
|
+
object: Flags.string({
|
|
44
|
+
description: "Ontology object slug to generate; repeat for multiple objects.",
|
|
45
|
+
multiple: true,
|
|
46
|
+
}),
|
|
47
|
+
count: Flags.integer({
|
|
48
|
+
description: "Records per selected object (1-100; requires --object).",
|
|
49
|
+
}),
|
|
13
50
|
"poll-interval": Flags.integer({
|
|
14
51
|
default: DEFAULT_POLL_INTERVAL_MS,
|
|
15
52
|
description: "Polling interval in milliseconds.",
|
|
@@ -31,10 +68,11 @@ export default class RecordsGenerate extends Command {
|
|
|
31
68
|
validatePositiveInteger(flags.timeout, "--timeout");
|
|
32
69
|
const clientId = requireValue(flags.client, "--client");
|
|
33
70
|
const ontologyId = requireValue(flags.ontology, "--ontology");
|
|
71
|
+
const objects = requestedObjects(flags.object, flags.count);
|
|
34
72
|
const idempotencyKey = randomUUID();
|
|
35
73
|
const printOperationId = (operationId) => this.logToStderr(operationId);
|
|
36
74
|
const result = await runApiEffect(Effect.gen(function* () {
|
|
37
|
-
const created = yield* createRecordGeneration(clientId, ontologyId, idempotencyKey);
|
|
75
|
+
const created = yield* createRecordGeneration(clientId, ontologyId, idempotencyKey, objects);
|
|
38
76
|
yield* Effect.sync(() => printOperationId(created.operationId));
|
|
39
77
|
if (!flags.wait)
|
|
40
78
|
return created;
|
|
@@ -47,6 +85,13 @@ export default class RecordsGenerate extends Command {
|
|
|
47
85
|
this.log(`Record generation ${result.operationId}: ${result.status}`);
|
|
48
86
|
this.log(`Client: ${result.clientId}`);
|
|
49
87
|
this.log(`Ontology: ${result.ontologyId}`);
|
|
88
|
+
if ("steps" in result) {
|
|
89
|
+
for (const step of result.steps) {
|
|
90
|
+
this.log(`${step.objectSlug}: ${step.state}; persisted ${step.persistedCount}/${step.requestedCount}; rejected ${step.rejectedCount}`);
|
|
91
|
+
for (const issue of step.issues)
|
|
92
|
+
this.log(` ${issue}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
50
95
|
});
|
|
51
96
|
}
|
|
52
97
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/records/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAU5C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,OAAgB,IAAI;;MAAoD;IACxE,OAAgB,WAAW,SAAyC;IACpE,OAAgB,KAAK;;;MAAY;IAEpB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/records/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAU5C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,OAAgB,IAAI;;MAAoD;IACxE,OAAgB,WAAW,SAAyC;IACpE,OAAgB,KAAK;;;MAAY;IAEpB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAmBjC"}
|
|
@@ -13,6 +13,11 @@ export default class RecordsStatus extends Command {
|
|
|
13
13
|
printResult(this, result, flags.json, () => {
|
|
14
14
|
this.log(`Record generation ${result.operationId}: ${result.status}`);
|
|
15
15
|
this.log(`Persisted: ${result.totals.persistedCount}/${result.totals.requestedCount}`);
|
|
16
|
+
for (const step of result.steps) {
|
|
17
|
+
this.log(`${step.objectSlug}: ${step.state}; persisted ${step.persistedCount}/${step.requestedCount}; rejected ${step.rejectedCount}`);
|
|
18
|
+
for (const issue of step.issues)
|
|
19
|
+
this.log(` ${issue}`);
|
|
20
|
+
}
|
|
16
21
|
});
|
|
17
22
|
}
|
|
18
23
|
catch (error) {
|
package/dist/generation.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ export interface WaitForGenerationOptions {
|
|
|
6
6
|
readonly sleep?: (milliseconds: number) => Promise<void>;
|
|
7
7
|
readonly timeoutMs: number;
|
|
8
8
|
}
|
|
9
|
-
export declare function createRecordGeneration(clientId: string, ontologyId: string, idempotencyKey: string
|
|
9
|
+
export declare function createRecordGeneration(clientId: string, ontologyId: string, idempotencyKey: string, objects?: readonly {
|
|
10
|
+
readonly count: number;
|
|
11
|
+
readonly objectSlug: string;
|
|
12
|
+
}[]): Effect.Effect<RecordGenerationCreated, import("./api.js").ApiConfigurationError | import("./api.js").ApiHttpError | import("./api.js").ApiTransportError | import("./api.js").ApiDecodeError, PrismantixApiClient>;
|
|
10
13
|
export declare function getRecordGeneration(operationId: string): Effect.Effect<RecordGenerationStatus, import("./api.js").ApiConfigurationError | import("./api.js").ApiHttpError | import("./api.js").ApiTransportError | import("./api.js").ApiDecodeError, PrismantixApiClient>;
|
|
11
14
|
export declare function cancelRecordGeneration(operationId: string): Effect.Effect<RecordGenerationStatus, import("./api.js").ApiConfigurationError | import("./api.js").ApiHttpError | import("./api.js").ApiTransportError | import("./api.js").ApiDecodeError, PrismantixApiClient>;
|
|
12
15
|
export declare function waitForRecordGeneration(created: RecordGenerationCreated, options: WaitForGenerationOptions): Effect.Effect<RecordGenerationStatus, unknown, PrismantixApiClient>;
|
package/dist/generation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../src/generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,MAAM,EAAgB,MAAM,QAAQ,CAAC;AACnE,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../src/generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,MAAM,EAAgB,MAAM,QAAQ,CAAC;AACnE,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,sNAM5E;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,qNAKtD;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,qNAKzD;AAED,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,wBAAwB,uEASjC"}
|
package/dist/generation.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Cause, Effect, Exit, Option } from "effect";
|
|
2
2
|
import { PrismantixApiClient, } from "./api.js";
|
|
3
3
|
import { CliUserError } from "./errors.js";
|
|
4
|
-
export function createRecordGeneration(clientId, ontologyId, idempotencyKey) {
|
|
4
|
+
export function createRecordGeneration(clientId, ontologyId, idempotencyKey, objects) {
|
|
5
5
|
return Effect.gen(function* () {
|
|
6
6
|
const api = yield* PrismantixApiClient;
|
|
7
|
-
return yield* api.createRecordGeneration(clientId, ontologyId, idempotencyKey);
|
|
7
|
+
return yield* api.createRecordGeneration(clientId, ontologyId, idempotencyKey, objects);
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
export function getRecordGeneration(operationId) {
|
|
@@ -56,10 +56,23 @@ function requireCompletedGeneration(status) {
|
|
|
56
56
|
if (status.status === "canceled") {
|
|
57
57
|
throw new CliUserError("record_generation_canceled", `Record generation ${status.operationId} was canceled.`);
|
|
58
58
|
}
|
|
59
|
+
throw new CliUserError("record_generation_failed", failedGenerationMessage(status));
|
|
60
|
+
}
|
|
61
|
+
function failedGenerationStepDetails(status) {
|
|
62
|
+
return status.steps
|
|
63
|
+
.filter((step) => step.state === "failed" || step.persistedCount !== step.requestedCount)
|
|
64
|
+
.map((step) => {
|
|
65
|
+
const issues = step.issues.length > 0 ? `; ${step.issues.join("; ")}` : "";
|
|
66
|
+
return `${step.objectSlug} persisted ${step.persistedCount}/${step.requestedCount}, rejected ${step.rejectedCount}${issues}`;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function failedGenerationMessage(status) {
|
|
59
70
|
const failureDetails = status.failure
|
|
60
71
|
? `${status.failure.message} (${status.failure.code})`
|
|
61
72
|
: "The API did not provide failure details.";
|
|
62
|
-
|
|
73
|
+
const stepDetails = failedGenerationStepDetails(status);
|
|
74
|
+
const failedObjects = stepDetails.length > 0 ? ` Failed objects: ${stepDetails.join(" | ")}.` : "";
|
|
75
|
+
return `Record generation ${status.operationId} failed: ${failureDetails}${failedObjects}`;
|
|
63
76
|
}
|
|
64
77
|
function throwIfTimedOut(operationId, elapsedMs, timeoutMs) {
|
|
65
78
|
if (elapsedMs < timeoutMs)
|
package/oclif.manifest.json
CHANGED
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"records:generate": {
|
|
163
163
|
"aliases": [],
|
|
164
164
|
"args": {},
|
|
165
|
-
"description": "Append
|
|
165
|
+
"description": "Append generated records for selected ontology objects, or the complete ontology by default.",
|
|
166
166
|
"flags": {
|
|
167
167
|
"api-base": {
|
|
168
168
|
"description": "PrismantiX API base URL.",
|
|
@@ -194,6 +194,20 @@
|
|
|
194
194
|
"multiple": false,
|
|
195
195
|
"type": "option"
|
|
196
196
|
},
|
|
197
|
+
"object": {
|
|
198
|
+
"description": "Ontology object slug to generate; repeat for multiple objects.",
|
|
199
|
+
"name": "object",
|
|
200
|
+
"hasDynamicHelp": false,
|
|
201
|
+
"multiple": true,
|
|
202
|
+
"type": "option"
|
|
203
|
+
},
|
|
204
|
+
"count": {
|
|
205
|
+
"description": "Records per selected object (1-100; requires --object).",
|
|
206
|
+
"name": "count",
|
|
207
|
+
"hasDynamicHelp": false,
|
|
208
|
+
"multiple": false,
|
|
209
|
+
"type": "option"
|
|
210
|
+
},
|
|
197
211
|
"poll-interval": {
|
|
198
212
|
"description": "Polling interval in milliseconds.",
|
|
199
213
|
"name": "poll-interval",
|
|
@@ -349,5 +363,5 @@
|
|
|
349
363
|
]
|
|
350
364
|
}
|
|
351
365
|
},
|
|
352
|
-
"version": "0.0.3-next.
|
|
366
|
+
"version": "0.0.3-next.25"
|
|
353
367
|
}
|