kenso 0.1.51 → 0.1.52
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 +1 -0
- package/dist/kenso.js +31 -3
- package/dist/operations.json +1 -1
- package/docs/reference.md +35 -35
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,7 @@ What changed in the kenso CLI, newest first, by the day it changed. A new versio
|
|
|
12
12
|
- a weekly stderr line says when a newer kenso is out, off with KENSO_NO_UPDATE_NOTIFIER=1
|
|
13
13
|
- kenso completion prints a bash, zsh or fish script that asks kenso __complete on each Tab
|
|
14
14
|
- webhooks listen retries a transient failure on its first poll too
|
|
15
|
+
- --idempotency-key on every command whose operation declares the header
|
|
15
16
|
- Ctrl-C at the delete prompt is an interrupt; test the prompt and kenso api DELETE
|
|
16
17
|
- webhooks listen forwards the delivery envelope, survives a failed poll
|
|
17
18
|
- confirm deletes, accept --json and the common flag names, plain help
|
package/dist/kenso.js
CHANGED
|
@@ -2421,7 +2421,7 @@ var VERSION;
|
|
|
2421
2421
|
var init_version = __esm({
|
|
2422
2422
|
"src/core/version.ts"() {
|
|
2423
2423
|
"use strict";
|
|
2424
|
-
VERSION = true ? "0.1.
|
|
2424
|
+
VERSION = true ? "0.1.52" : "0.0.0-dev";
|
|
2425
2425
|
}
|
|
2426
2426
|
});
|
|
2427
2427
|
|
|
@@ -6369,6 +6369,7 @@ __export(execute_exports, {
|
|
|
6369
6369
|
DATA_KEY: () => DATA_KEY,
|
|
6370
6370
|
HELP_FLAG_MAX: () => HELP_FLAG_MAX,
|
|
6371
6371
|
HELP_NOTES_MAX: () => HELP_NOTES_MAX,
|
|
6372
|
+
IDEMPOTENCY_KEY: () => IDEMPOTENCY_KEY,
|
|
6372
6373
|
buildRequest: () => buildRequest,
|
|
6373
6374
|
helpFlagText: () => helpFlagText,
|
|
6374
6375
|
helpNotes: () => helpNotes,
|
|
@@ -6435,6 +6436,14 @@ function operationFlags(op) {
|
|
|
6435
6436
|
taken.add(`no-${f.flag}`);
|
|
6436
6437
|
flags.push({ flag: `no-${f.flag}`, type: "boolean", required: false, description: `Send ${f.param?.name} as false.`, negates: f.flag });
|
|
6437
6438
|
}
|
|
6439
|
+
if (op.idempotencyKey) {
|
|
6440
|
+
flags.push({
|
|
6441
|
+
flag: IDEMPOTENCY_KEY_FLAG,
|
|
6442
|
+
type: "string",
|
|
6443
|
+
required: op.idempotencyKey.required,
|
|
6444
|
+
description: op.idempotencyKey.required ? "Idempotency-Key, required: a unique value. Run the command again with the same key to retry it safely." : "Idempotency-Key: a unique value. Run the command again with the same key to retry it safely. Without it no key is sent."
|
|
6445
|
+
});
|
|
6446
|
+
}
|
|
6438
6447
|
if (op.body) {
|
|
6439
6448
|
flags.push({
|
|
6440
6449
|
flag: "data",
|
|
@@ -6528,12 +6537,21 @@ function buildRequest(op, values) {
|
|
|
6528
6537
|
if (param.required && isBlank(query[param.name])) throw missing(op, param.flag);
|
|
6529
6538
|
}
|
|
6530
6539
|
const request = { method: op.method, path, retrySafe: op.retrySafe };
|
|
6540
|
+
if (op.idempotencyKey) {
|
|
6541
|
+
const key = values[IDEMPOTENCY_KEY];
|
|
6542
|
+
if (typeof key === "string") {
|
|
6543
|
+
request.headers = { "Idempotency-Key": key };
|
|
6544
|
+
request.retrySafe = true;
|
|
6545
|
+
} else if (op.idempotencyKey.required) {
|
|
6546
|
+
throw missing(op, IDEMPOTENCY_KEY_FLAG);
|
|
6547
|
+
}
|
|
6548
|
+
}
|
|
6531
6549
|
if (Object.keys(query).length > 0) request.query = query;
|
|
6532
6550
|
if (!op.body) return request;
|
|
6533
6551
|
const data = values[DATA_KEY];
|
|
6534
6552
|
const body = isRecord3(data) ? { ...data } : {};
|
|
6535
6553
|
for (const [key, value] of Object.entries(values)) {
|
|
6536
|
-
if (key === DATA_KEY || routeNames.has(key) || queryNames.has(key) || value === void 0) continue;
|
|
6554
|
+
if (key === DATA_KEY || key === IDEMPOTENCY_KEY || routeNames.has(key) || queryNames.has(key) || value === void 0) continue;
|
|
6537
6555
|
body[key] = value;
|
|
6538
6556
|
}
|
|
6539
6557
|
if (op.body.format === "multipart") {
|
|
@@ -6593,6 +6611,14 @@ async function collectValues(ctx, op, flags) {
|
|
|
6593
6611
|
if (f.location === "body" && paramNames.has(f.param.name)) bodyOnly[f.param.name] = value;
|
|
6594
6612
|
else values[f.param.name] = value;
|
|
6595
6613
|
}
|
|
6614
|
+
const idempotencyKey = flags[IDEMPOTENCY_KEY_FLAG];
|
|
6615
|
+
if (op.idempotencyKey && typeof idempotencyKey === "string") {
|
|
6616
|
+
if (idempotencyKey.trim() === "") throw usageError(`--${IDEMPOTENCY_KEY_FLAG} must not be blank.`, { field: IDEMPOTENCY_KEY_FLAG });
|
|
6617
|
+
if (typeof flags.each === "string") {
|
|
6618
|
+
throw usageError(`--${IDEMPOTENCY_KEY_FLAG} names one request; with --each every row gets its own key.`, { field: IDEMPOTENCY_KEY_FLAG });
|
|
6619
|
+
}
|
|
6620
|
+
values[IDEMPOTENCY_KEY] = idempotencyKey.trim();
|
|
6621
|
+
}
|
|
6596
6622
|
if (op.list) {
|
|
6597
6623
|
if (typeof flags.limit === "string" && values.limit === void 0) values.limit = parseNumber(flags.limit, "limit", true);
|
|
6598
6624
|
if (typeof flags.cursor === "string" && values.cursor === void 0) values.cursor = flags.cursor;
|
|
@@ -6772,7 +6798,7 @@ ${api}` : api,
|
|
|
6772
6798
|
run: (ctx, args) => runOperation(ctx, op, args.flags)
|
|
6773
6799
|
};
|
|
6774
6800
|
}
|
|
6775
|
-
var DATA_KEY, SCALAR_TYPES, FLAG_ALIASES, LIST_PARAM_TEXT, HELP_NOTES_MAX, HELP_FLAG_MAX, FOOTER_FLAGS;
|
|
6801
|
+
var DATA_KEY, IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_FLAG, SCALAR_TYPES, FLAG_ALIASES, LIST_PARAM_TEXT, HELP_NOTES_MAX, HELP_FLAG_MAX, FOOTER_FLAGS;
|
|
6776
6802
|
var init_execute = __esm({
|
|
6777
6803
|
"src/generated/execute.ts"() {
|
|
6778
6804
|
"use strict";
|
|
@@ -6783,6 +6809,8 @@ var init_execute = __esm({
|
|
|
6783
6809
|
init_input();
|
|
6784
6810
|
init_secret_flags();
|
|
6785
6811
|
DATA_KEY = "$data";
|
|
6812
|
+
IDEMPOTENCY_KEY = "$idempotencyKey";
|
|
6813
|
+
IDEMPOTENCY_KEY_FLAG = "idempotency-key";
|
|
6786
6814
|
SCALAR_TYPES = /* @__PURE__ */ new Set(["string", "integer", "number", "boolean"]);
|
|
6787
6815
|
FLAG_ALIASES = [
|
|
6788
6816
|
["campaign", "campaign-id"],
|