@roarkanalytics/cli 0.50.1 → 0.51.2
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 +21 -0
- package/README.md +1 -0
- package/commands.js +23 -0
- package/completions.js +4 -4
- package/man/roark-metric-collection-job-cancel.1 +93 -0
- package/man/roark.1 +3 -0
- package/npm-shrinkwrap.json +6 -6
- package/package.json +3 -2
- package/runtime/program.d.ts +19 -0
- package/runtime/program.js +42 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.\" File generated from our OpenAPI spec by app-agent-codegen. Do not edit.
|
|
2
|
+
.TH "ROARK\-METRIC\-COLLECTION\-JOB\-CANCEL" "1" "" "roark-metric-collection-job-cancel" "Roark Analytics API Manual"
|
|
3
|
+
.SH "NAME"
|
|
4
|
+
roark\-metric\-collection\-job\-cancel \- Cancel a metric collection job
|
|
5
|
+
.SH "SYNOPSIS"
|
|
6
|
+
.B roark metric collection\-job cancel
|
|
7
|
+
\fIjob\-id\fR [\fIoptions\fR]
|
|
8
|
+
.SH "DESCRIPTION"
|
|
9
|
+
Stops a metric collection job that has not finished. No further conversations are processed and the job ends in CANCELED. Items the job had not reached are marked SKIPPED. Metric values already produced are kept, and items that were mid\-computation when the cancel arrived may still complete. Only the items that completed are billed. Safe to call more than once: a job that has already finished (COMPLETED, FAILED, or CANCELED) is returned unchanged.
|
|
10
|
+
.SH "API"
|
|
11
|
+
POST /v1/metric/collection\-jobs/{jobId}/cancel
|
|
12
|
+
.SH "ARGUMENTS"
|
|
13
|
+
.TP
|
|
14
|
+
\fIjob\-id\fR
|
|
15
|
+
The ID of the metric collection job to cancel
|
|
16
|
+
.SH "GLOBAL OPTIONS"
|
|
17
|
+
.TP
|
|
18
|
+
\fB\-\-data\fR \fI<json>\fR
|
|
19
|
+
Request body as JSON, or @file to read one (@\- for stdin).
|
|
20
|
+
.TP
|
|
21
|
+
\fB\-y\fR, \fB\-\-yes\fR
|
|
22
|
+
Skip confirmation prompts.
|
|
23
|
+
.TP
|
|
24
|
+
\fB\-\-no\-input\fR
|
|
25
|
+
Never prompt; fail instead.
|
|
26
|
+
.TP
|
|
27
|
+
\fB\-\-base\-url\fR \fI<url>\fR
|
|
28
|
+
API base URL.
|
|
29
|
+
.TP
|
|
30
|
+
\fB\-\-token\fR \fI<token>\fR
|
|
31
|
+
Bearer token. Prefer ROARK_API_BEARER_TOKEN or the stored credential.
|
|
32
|
+
.TP
|
|
33
|
+
\fB\-\-timeout\fR \fI<ms>\fR
|
|
34
|
+
Request timeout in milliseconds.
|
|
35
|
+
.TP
|
|
36
|
+
\fB\-\-max\-retries\fR \fI<count>\fR
|
|
37
|
+
Retries for retryable failures.
|
|
38
|
+
.TP
|
|
39
|
+
\fB\-\-format\fR \fI<format>\fR
|
|
40
|
+
Output format: auto, json, jsonl, plain.
|
|
41
|
+
.TP
|
|
42
|
+
\fB\-\-json\fR
|
|
43
|
+
Shorthand for \-\-format json.
|
|
44
|
+
.TP
|
|
45
|
+
\fB\-\-no\-color\fR
|
|
46
|
+
Disable colour.
|
|
47
|
+
.TP
|
|
48
|
+
\fB\-q\fR, \fB\-\-quiet\fR
|
|
49
|
+
Suppress non\-essential output.
|
|
50
|
+
.TP
|
|
51
|
+
\fB\-\-allow\-project\-base\-url\fR
|
|
52
|
+
Send the stored credential to a base URL set by a project .roark.json. Refused by default.
|
|
53
|
+
.SH "EXAMPLES"
|
|
54
|
+
.PP
|
|
55
|
+
.RS 4
|
|
56
|
+
.nf
|
|
57
|
+
roark metric collection\-job cancel <job\-id>
|
|
58
|
+
.fi
|
|
59
|
+
.RE
|
|
60
|
+
.SH "ENVIRONMENT"
|
|
61
|
+
.TP
|
|
62
|
+
\fBROARK_API_BEARER_TOKEN\fR
|
|
63
|
+
Bearer token used when \-\-token is not given.
|
|
64
|
+
.TP
|
|
65
|
+
\fBROARK_BASE_URL\fR
|
|
66
|
+
API base URL.
|
|
67
|
+
.TP
|
|
68
|
+
\fBROARK_ALLOW_PROJECT_BASE_URL\fR
|
|
69
|
+
Trusts a base URL set by a project .roark.json, like \-\-allow\-project\-base\-url.
|
|
70
|
+
.TP
|
|
71
|
+
\fBNO_COLOR\fR
|
|
72
|
+
Disables colour when set to any value.
|
|
73
|
+
.SH "EXIT STATUS"
|
|
74
|
+
.TP
|
|
75
|
+
\fB0\fR
|
|
76
|
+
The command succeeded.
|
|
77
|
+
.TP
|
|
78
|
+
\fB1\fR
|
|
79
|
+
The API rejected the request.
|
|
80
|
+
.TP
|
|
81
|
+
\fB2\fR
|
|
82
|
+
The command line was wrong.
|
|
83
|
+
.TP
|
|
84
|
+
\fB3\fR
|
|
85
|
+
No credential, or the credential was refused.
|
|
86
|
+
.TP
|
|
87
|
+
\fB4\fR
|
|
88
|
+
The addressed resource does not exist.
|
|
89
|
+
.TP
|
|
90
|
+
\fB5\fR
|
|
91
|
+
The request never completed: connection, timeout, or abort.
|
|
92
|
+
.SH "SEE ALSO"
|
|
93
|
+
.BR roark (1)
|
package/man/roark.1
CHANGED
|
@@ -291,6 +291,9 @@ List HTTP request definitions See roark\-http\-request\-definition\-list(1).
|
|
|
291
291
|
\fBroark http\-request\-definition update\fR
|
|
292
292
|
Update HTTP request definition See roark\-http\-request\-definition\-update(1).
|
|
293
293
|
.TP
|
|
294
|
+
\fBroark metric collection\-job cancel\fR
|
|
295
|
+
Cancel a metric collection job See roark\-metric\-collection\-job\-cancel(1).
|
|
296
|
+
.TP
|
|
294
297
|
\fBroark metric collection\-job create\fR
|
|
295
298
|
Create and run a metric collection job See roark\-metric\-collection\-job\-create(1).
|
|
296
299
|
.TP
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roarkanalytics/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@roarkanalytics/cli",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.51.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@roarkanalytics/sdk": "^5.
|
|
12
|
+
"@roarkanalytics/sdk": "^5.12.0",
|
|
13
13
|
"commander": "^14.0.3",
|
|
14
14
|
"yaml": "^2.9.0"
|
|
15
15
|
},
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"node_modules/@roarkanalytics/sdk": {
|
|
24
|
-
"version": "5.
|
|
25
|
-
"resolved": "https://registry.npmjs.org/@roarkanalytics/sdk/-/sdk-5.
|
|
26
|
-
"integrity": "sha512
|
|
24
|
+
"version": "5.12.0",
|
|
25
|
+
"resolved": "https://registry.npmjs.org/@roarkanalytics/sdk/-/sdk-5.12.0.tgz",
|
|
26
|
+
"integrity": "sha512-s+DRYkWPWvFha9Ri51sah7Nkm5t9RdTFX5bwfLpX5q87B/6VZiWD6Dwp2gkQwdErNyK8+P2X3mpwSUvFp1o85g==",
|
|
27
27
|
"license": "Apache-2.0"
|
|
28
28
|
},
|
|
29
29
|
"node_modules/commander": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roarkanalytics/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.2",
|
|
4
4
|
"description": "The official command line interface for the Roark API",
|
|
5
5
|
"author": "Roark <james@roark.ai>",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"fix": "eslint --fix . && prettier --write ."
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@roarkanalytics/sdk": "^5.
|
|
32
|
+
"@roarkanalytics/sdk": "^5.12.0",
|
|
33
33
|
"commander": "^14.0.3",
|
|
34
34
|
"yaml": "^2.9.0"
|
|
35
35
|
},
|
|
@@ -112,6 +112,7 @@
|
|
|
112
112
|
"./man/roark-http-request-definition-get.1",
|
|
113
113
|
"./man/roark-http-request-definition-list.1",
|
|
114
114
|
"./man/roark-http-request-definition-update.1",
|
|
115
|
+
"./man/roark-metric-collection-job-cancel.1",
|
|
115
116
|
"./man/roark-metric-collection-job-create.1",
|
|
116
117
|
"./man/roark-metric-collection-job-get.1",
|
|
117
118
|
"./man/roark-metric-collection-job-list.1",
|
package/runtime/program.d.ts
CHANGED
|
@@ -17,6 +17,25 @@ export interface ProgramOptions {
|
|
|
17
17
|
groups: Readonly<Record<string, string>>;
|
|
18
18
|
completions: Readonly<Record<string, string>>;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* What the confirmation prompt names as the thing being deleted.
|
|
22
|
+
*
|
|
23
|
+
* A path parameter IS that thing, so a command with one reads it back:
|
|
24
|
+
* `call delete abc123` asks about `abc123`.
|
|
25
|
+
*
|
|
26
|
+
* A batch delete has no path parameter - its targets arrive in a required flag -
|
|
27
|
+
* and the fallback named the command instead, so `call batch delete` asked
|
|
28
|
+
* "Permanently delete call batch delete?". That sentence cannot help the one
|
|
29
|
+
* person the prompt exists for: someone who typed the wrong `--call-ids` and has
|
|
30
|
+
* a last chance to notice. It is also the only destructive command without a
|
|
31
|
+
* positional, and the only one that deletes in bulk, so the single worst place
|
|
32
|
+
* to say nothing useful.
|
|
33
|
+
*
|
|
34
|
+
* So the targets come from the required flags, which are what identifies them.
|
|
35
|
+
* The command path stays as the last resort, for a destructive command that one
|
|
36
|
+
* day identifies its target some other way - wrong, but never silent.
|
|
37
|
+
*/
|
|
38
|
+
export declare const deletionTarget: (command: CliCommand, positionals: string[], options: Record<string, unknown>) => string;
|
|
20
39
|
interface GlobalOptions {
|
|
21
40
|
baseUrl?: string;
|
|
22
41
|
project?: string;
|
package/runtime/program.js
CHANGED
|
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.run = exports.createProgram = exports.resolveOutput = exports.assertBaseUrlIsTrusted = void 0;
|
|
12
|
+
exports.run = exports.createProgram = exports.resolveOutput = exports.assertBaseUrlIsTrusted = exports.deletionTarget = void 0;
|
|
13
13
|
const commander_1 = require("commander");
|
|
14
14
|
const sdk_1 = __importDefault(require("@roarkanalytics/sdk"));
|
|
15
15
|
const api_1 = require("./commands/api");
|
|
@@ -25,6 +25,46 @@ const output_1 = require("./output");
|
|
|
25
25
|
/** Verbs whose effect a user cannot undo, so they get a confirmation prompt. */
|
|
26
26
|
const DESTRUCTIVE_VERBS = new Set(['delete']);
|
|
27
27
|
const isDestructive = (command) => DESTRUCTIVE_VERBS.has(command.commandPath.at(-1) ?? '');
|
|
28
|
+
/** Values beyond this are counted rather than listed; a prompt nobody reads is not a prompt. */
|
|
29
|
+
const MAX_LISTED_TARGETS = 5;
|
|
30
|
+
/**
|
|
31
|
+
* What the confirmation prompt names as the thing being deleted.
|
|
32
|
+
*
|
|
33
|
+
* A path parameter IS that thing, so a command with one reads it back:
|
|
34
|
+
* `call delete abc123` asks about `abc123`.
|
|
35
|
+
*
|
|
36
|
+
* A batch delete has no path parameter - its targets arrive in a required flag -
|
|
37
|
+
* and the fallback named the command instead, so `call batch delete` asked
|
|
38
|
+
* "Permanently delete call batch delete?". That sentence cannot help the one
|
|
39
|
+
* person the prompt exists for: someone who typed the wrong `--call-ids` and has
|
|
40
|
+
* a last chance to notice. It is also the only destructive command without a
|
|
41
|
+
* positional, and the only one that deletes in bulk, so the single worst place
|
|
42
|
+
* to say nothing useful.
|
|
43
|
+
*
|
|
44
|
+
* So the targets come from the required flags, which are what identifies them.
|
|
45
|
+
* The command path stays as the last resort, for a destructive command that one
|
|
46
|
+
* day identifies its target some other way - wrong, but never silent.
|
|
47
|
+
*/
|
|
48
|
+
const deletionTarget = (command, positionals, options) => {
|
|
49
|
+
if (positionals.length > 0)
|
|
50
|
+
return positionals.join(' ');
|
|
51
|
+
const targets = command.flags
|
|
52
|
+
.filter((flag) => flag.required)
|
|
53
|
+
.flatMap((flag) => {
|
|
54
|
+
const raw = options[(0, input_1.optionKey)(flag.name)];
|
|
55
|
+
if (raw === undefined)
|
|
56
|
+
return [];
|
|
57
|
+
return (Array.isArray(raw) ? raw : [raw]).map((value) => String(value));
|
|
58
|
+
});
|
|
59
|
+
if (targets.length === 0)
|
|
60
|
+
return command.commandPath.join(' ');
|
|
61
|
+
// `call batch delete` -> `call`, so the count reads as the thing it counts.
|
|
62
|
+
const noun = command.commandPath[0] ?? 'record';
|
|
63
|
+
const listed = targets.slice(0, MAX_LISTED_TARGETS).join(', ');
|
|
64
|
+
const rest = targets.length - MAX_LISTED_TARGETS;
|
|
65
|
+
return `${targets.length} ${noun}${targets.length === 1 ? '' : 's'}: ${listed}${rest > 0 ? ` and ${rest} more` : ''}`;
|
|
66
|
+
};
|
|
67
|
+
exports.deletionTarget = deletionTarget;
|
|
28
68
|
/**
|
|
29
69
|
* Global flags are declared on every leaf as well as the root so they can be
|
|
30
70
|
* written on either side of the verb. Commander does not inherit options down
|
|
@@ -212,7 +252,7 @@ const addApiCommand = (root, options, definition) => {
|
|
|
212
252
|
const runApiCommand = async (definition, positionals, options, program) => {
|
|
213
253
|
const output = (0, exports.resolveOutput)(options);
|
|
214
254
|
if (isDestructive(definition)) {
|
|
215
|
-
await (0, confirm_1.confirm)(`Permanently delete ${
|
|
255
|
+
await (0, confirm_1.confirm)(`Permanently delete ${(0, exports.deletionTarget)(definition, positionals, options)}?`, {
|
|
216
256
|
assumeYes: options.yes === true,
|
|
217
257
|
noInput: options.input === false,
|
|
218
258
|
});
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.51.2";
|
package/version.js
CHANGED