@doist/automations-cli 1.21.1 → 1.21.3
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 -0
- package/dist/index.js +158 -221
- package/dist/index.js.map +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -56,6 +56,10 @@ after editing a shared package. Run `npm unlink --global @doist/automations-cli`
|
|
|
56
56
|
A global install and a link cannot both own `tda`, so uninstall the published package first if you
|
|
57
57
|
have one.
|
|
58
58
|
|
|
59
|
+
## Changing the icon
|
|
60
|
+
|
|
61
|
+
The icon on the OAuth consent screen is `icons/service_automations-cli_color_192px.png`, published to the CDN on merge. See [docs/icon.md](docs/icon.md).
|
|
62
|
+
|
|
59
63
|
## Releases
|
|
60
64
|
|
|
61
65
|
`@doist/automations-cli` is published from `main` by
|
package/dist/index.js
CHANGED
|
@@ -6899,7 +6899,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6899
6899
|
// package.json
|
|
6900
6900
|
var package_default = {
|
|
6901
6901
|
name: "@doist/automations-cli",
|
|
6902
|
-
version: "1.21.
|
|
6902
|
+
version: "1.21.3",
|
|
6903
6903
|
description: "Command-line client for Todoist Automations",
|
|
6904
6904
|
type: "module",
|
|
6905
6905
|
bin: {
|
|
@@ -6945,7 +6945,7 @@ var package_default = {
|
|
|
6945
6945
|
dependencies: {
|
|
6946
6946
|
"@doist/cli-core": "1.7.0",
|
|
6947
6947
|
"@napi-rs/keyring": "2.1.1",
|
|
6948
|
-
ai: "7.0.
|
|
6948
|
+
ai: "7.0.141",
|
|
6949
6949
|
commander: "15.0.0",
|
|
6950
6950
|
oauth4webapi: "3.8.8",
|
|
6951
6951
|
open: "11.0.4"
|
|
@@ -6959,7 +6959,7 @@ var package_default = {
|
|
|
6959
6959
|
"semantic-release": "25.0.9",
|
|
6960
6960
|
"semantic-release-monorepo": "8.0.2",
|
|
6961
6961
|
typescript: "6.0.3",
|
|
6962
|
-
vitest: "5.0.
|
|
6962
|
+
vitest: "5.0.4"
|
|
6963
6963
|
},
|
|
6964
6964
|
engines: {
|
|
6965
6965
|
node: ">=24"
|
|
@@ -7878,6 +7878,7 @@ __export(util_exports, {
|
|
|
7878
7878
|
required: () => required,
|
|
7879
7879
|
safeExtend: () => safeExtend,
|
|
7880
7880
|
shallowClone: () => shallowClone,
|
|
7881
|
+
sizeCaps: () => sizeCaps,
|
|
7881
7882
|
slugify: () => slugify,
|
|
7882
7883
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
7883
7884
|
toZod: () => toZod,
|
|
@@ -8397,6 +8398,18 @@ function prefixIssues(path, issues) {
|
|
|
8397
8398
|
function unwrapMessage(message) {
|
|
8398
8399
|
return typeof message === "string" ? message : message?.message;
|
|
8399
8400
|
}
|
|
8401
|
+
function sizeCaps(defChecks) {
|
|
8402
|
+
const caps = [];
|
|
8403
|
+
for (const ch of defChecks ?? []) {
|
|
8404
|
+
const d = ch._zod.def;
|
|
8405
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
8406
|
+
break;
|
|
8407
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
8408
|
+
if (max >= 0)
|
|
8409
|
+
caps.push([max, ch]);
|
|
8410
|
+
}
|
|
8411
|
+
return caps;
|
|
8412
|
+
}
|
|
8400
8413
|
function attachSchema(issues, start, inst) {
|
|
8401
8414
|
var _a3;
|
|
8402
8415
|
for (let i = start; i < issues.length; i++) {
|
|
@@ -9817,7 +9830,7 @@ ${content.join("\n")}
|
|
|
9817
9830
|
var version = {
|
|
9818
9831
|
major: 4,
|
|
9819
9832
|
minor: 6,
|
|
9820
|
-
patch:
|
|
9833
|
+
patch: 7
|
|
9821
9834
|
};
|
|
9822
9835
|
|
|
9823
9836
|
// ../../node_modules/zod/v4/core/schemas.js
|
|
@@ -10573,6 +10586,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
10573
10586
|
return payload;
|
|
10574
10587
|
};
|
|
10575
10588
|
});
|
|
10589
|
+
function capSize(inst, size) {
|
|
10590
|
+
const caps = sizeCaps(inst._zod.def.checks);
|
|
10591
|
+
if (!caps.length)
|
|
10592
|
+
return;
|
|
10593
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
10594
|
+
const parse3 = inst._zod.parse;
|
|
10595
|
+
inst._zod.parse = (payload, ctx) => {
|
|
10596
|
+
const n = size(payload.value);
|
|
10597
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
10598
|
+
for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
|
|
10599
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
10600
|
+
const start = payload.issues.length;
|
|
10601
|
+
ch._zod.check(payload);
|
|
10602
|
+
payload.issues[start].continue = false;
|
|
10603
|
+
attachSchema(payload.issues, start, inst);
|
|
10604
|
+
return payload;
|
|
10605
|
+
}
|
|
10606
|
+
}
|
|
10607
|
+
}
|
|
10608
|
+
return parse3(payload, ctx);
|
|
10609
|
+
};
|
|
10610
|
+
}
|
|
10611
|
+
var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
|
|
10612
|
+
var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
|
|
10613
|
+
var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
|
|
10576
10614
|
function handleArrayResult(result, final, index) {
|
|
10577
10615
|
if (result.issues.length) {
|
|
10578
10616
|
final.issues.push(...prefixIssues(index, result.issues));
|
|
@@ -10616,6 +10654,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
10616
10654
|
}
|
|
10617
10655
|
return payload;
|
|
10618
10656
|
};
|
|
10657
|
+
capSize(inst, arraySize);
|
|
10619
10658
|
});
|
|
10620
10659
|
function handlePropertyResult(result, final, key, input2, optin, optout) {
|
|
10621
10660
|
const isPresent = key in input2;
|
|
@@ -11572,6 +11611,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
11572
11611
|
return Promise.all(proms).then(() => payload);
|
|
11573
11612
|
return payload;
|
|
11574
11613
|
};
|
|
11614
|
+
capSize(inst, mapSize);
|
|
11575
11615
|
});
|
|
11576
11616
|
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
11577
11617
|
if (keyResult.issues.length) {
|
|
@@ -11638,6 +11678,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
11638
11678
|
return Promise.all(proms).then(() => payload);
|
|
11639
11679
|
return payload;
|
|
11640
11680
|
};
|
|
11681
|
+
capSize(inst, setSize);
|
|
11641
11682
|
});
|
|
11642
11683
|
function handleSetResult(result, final) {
|
|
11643
11684
|
if (result.issues.length) {
|
|
@@ -21168,9 +21209,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
21168
21209
|
doc.write(`}`);
|
|
21169
21210
|
return outputVar;
|
|
21170
21211
|
}
|
|
21212
|
+
function generateSizeGate(doc, schema, size) {
|
|
21213
|
+
for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
|
|
21214
|
+
doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
|
|
21215
|
+
}
|
|
21216
|
+
}
|
|
21171
21217
|
function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
21172
21218
|
const def = schema._zod.def;
|
|
21173
21219
|
doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
|
|
21220
|
+
generateSizeGate(doc, schema, `${accessor}.length`);
|
|
21174
21221
|
const outputVar = buildsValue ? newVar(ctx) : null;
|
|
21175
21222
|
const iVar = newVar(ctx);
|
|
21176
21223
|
const elemVar = newVar(ctx);
|
|
@@ -21570,6 +21617,7 @@ function literalPropertyKey(ctx, key) {
|
|
|
21570
21617
|
function generateMapCheck(doc, ctx, schema, accessor) {
|
|
21571
21618
|
const def = schema._zod.def;
|
|
21572
21619
|
doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
|
|
21620
|
+
generateSizeGate(doc, schema, `${accessor}.size`);
|
|
21573
21621
|
const outputVar = newVar(ctx);
|
|
21574
21622
|
const kVar = newVar(ctx);
|
|
21575
21623
|
const valVar = newVar(ctx);
|
|
@@ -21586,6 +21634,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
|
|
|
21586
21634
|
function generateSetCheck(doc, ctx, schema, accessor) {
|
|
21587
21635
|
const def = schema._zod.def;
|
|
21588
21636
|
doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
|
|
21637
|
+
generateSizeGate(doc, schema, `${accessor}.size`);
|
|
21589
21638
|
const outputVar = newVar(ctx);
|
|
21590
21639
|
const valVar = newVar(ctx);
|
|
21591
21640
|
doc.write(`const ${outputVar} = new Set();`);
|
|
@@ -33179,6 +33228,94 @@ function readManifestName(manifest) {
|
|
|
33179
33228
|
return typeof name === "string" && name.trim() ? name : "(unnamed)";
|
|
33180
33229
|
}
|
|
33181
33230
|
|
|
33231
|
+
// ../../packages/sdk/dist/esm/drafts/draft-test.js
|
|
33232
|
+
var DEFAULT_POLL_INTERVALS_MS = { first: 2e3, max: 1e4 };
|
|
33233
|
+
var STATUS_REQUEST_GRACE_MS = 1e4;
|
|
33234
|
+
var OPEN_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
33235
|
+
"pending",
|
|
33236
|
+
"running"
|
|
33237
|
+
]);
|
|
33238
|
+
async function startDraftTest(draftApi, { draftId, request: request2 }) {
|
|
33239
|
+
const started = await draftApi.test(draftId, request2);
|
|
33240
|
+
return {
|
|
33241
|
+
draftId,
|
|
33242
|
+
testRunId: started.testRunId,
|
|
33243
|
+
trigger: started.trigger,
|
|
33244
|
+
connectorCalls: started.connectorCalls,
|
|
33245
|
+
status: started.status
|
|
33246
|
+
};
|
|
33247
|
+
}
|
|
33248
|
+
async function waitForDraftTest(draftApi, { draftId, testRunId }, { timeoutMs, pollIntervalsMs, requestGraceMs, onPoll, signal }) {
|
|
33249
|
+
const intervals = pollIntervalsMs ?? DEFAULT_POLL_INTERVALS_MS;
|
|
33250
|
+
const deadline = Date.now() + timeoutMs;
|
|
33251
|
+
let intervalMs = intervals.first;
|
|
33252
|
+
const requestTimeout = AbortSignal.timeout(timeoutMs + (requestGraceMs ?? STATUS_REQUEST_GRACE_MS));
|
|
33253
|
+
const requestSignal = AbortSignal.any([signal, requestTimeout]);
|
|
33254
|
+
let last = null;
|
|
33255
|
+
while (true) {
|
|
33256
|
+
try {
|
|
33257
|
+
last = await draftApi.getTestRun(draftId, testRunId, void 0, requestSignal);
|
|
33258
|
+
} catch (error62) {
|
|
33259
|
+
if (signal.aborted || !requestTimeout.aborted)
|
|
33260
|
+
throw error62;
|
|
33261
|
+
return toFinished(last, "timed_out");
|
|
33262
|
+
}
|
|
33263
|
+
if (!OPEN_RUN_STATUSES.has(last.status)) {
|
|
33264
|
+
return toFinished(last, toOutcome(last.status));
|
|
33265
|
+
}
|
|
33266
|
+
onPoll?.(last);
|
|
33267
|
+
const remainingMs = deadline - Date.now();
|
|
33268
|
+
if (remainingMs <= 0) {
|
|
33269
|
+
return toFinished(last, "timed_out");
|
|
33270
|
+
}
|
|
33271
|
+
await delay(Math.min(intervalMs, remainingMs), signal);
|
|
33272
|
+
intervalMs = Math.min(intervalMs * 2, intervals.max);
|
|
33273
|
+
}
|
|
33274
|
+
}
|
|
33275
|
+
function toDraftTestTriggerSelector(value) {
|
|
33276
|
+
if (typeof value === "number")
|
|
33277
|
+
return { index: value };
|
|
33278
|
+
return /^\d+$/.test(value) ? { index: Number(value) } : { event: value };
|
|
33279
|
+
}
|
|
33280
|
+
function toFinished(run, outcome) {
|
|
33281
|
+
return {
|
|
33282
|
+
outcome,
|
|
33283
|
+
status: run?.status ?? "pending",
|
|
33284
|
+
failedStep: run?.failedStep ?? null,
|
|
33285
|
+
error: run?.failedStep?.error ?? (run ? getRunOutcomeReason(run) : null) ?? (run?.status === "data-expired" ? "Temporal no longer holds this run's history, so its outcome is unknown" : null),
|
|
33286
|
+
result: run?.result ?? null
|
|
33287
|
+
};
|
|
33288
|
+
}
|
|
33289
|
+
function toOutcome(status) {
|
|
33290
|
+
switch (status) {
|
|
33291
|
+
case "completed":
|
|
33292
|
+
return "passed";
|
|
33293
|
+
case "skipped":
|
|
33294
|
+
return "skipped";
|
|
33295
|
+
case "cancelled":
|
|
33296
|
+
return "cancelled";
|
|
33297
|
+
default:
|
|
33298
|
+
return "failed";
|
|
33299
|
+
}
|
|
33300
|
+
}
|
|
33301
|
+
function delay(ms, signal) {
|
|
33302
|
+
return new Promise((resolve, reject) => {
|
|
33303
|
+
if (signal.aborted) {
|
|
33304
|
+
reject(signal.reason);
|
|
33305
|
+
return;
|
|
33306
|
+
}
|
|
33307
|
+
const onAbort = () => {
|
|
33308
|
+
clearTimeout(timer);
|
|
33309
|
+
reject(signal.reason);
|
|
33310
|
+
};
|
|
33311
|
+
const timer = setTimeout(() => {
|
|
33312
|
+
signal.removeEventListener("abort", onAbort);
|
|
33313
|
+
resolve();
|
|
33314
|
+
}, ms);
|
|
33315
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
33316
|
+
});
|
|
33317
|
+
}
|
|
33318
|
+
|
|
33182
33319
|
// src/lib/auth-environment.ts
|
|
33183
33320
|
import { InvalidArgumentError } from "commander";
|
|
33184
33321
|
var ENVIRONMENTS = {
|
|
@@ -33784,156 +33921,7 @@ function parseHeaders(values) {
|
|
|
33784
33921
|
}
|
|
33785
33922
|
|
|
33786
33923
|
// src/lib/auth-html.ts
|
|
33787
|
-
var
|
|
33788
|
-
<g id="Size=72, Style=Color">
|
|
33789
|
-
<g id="AUTOMATIONS CLI">
|
|
33790
|
-
<rect x="3" y="3" width="66" height="66" rx="12" fill="#858585"/>
|
|
33791
|
-
<g id="Terminal" filter="url(#filter0_iiiiiiii_automations)">
|
|
33792
|
-
<rect x="4.83334" y="4.83325" width="62.3333" height="62.3333" rx="11" fill="#60574E"/>
|
|
33793
|
-
<rect x="4.83334" y="4.83325" width="62.3333" height="62.3333" rx="11" fill="url(#paint0_radial_automations)" fill-opacity="0.8"/>
|
|
33794
|
-
<g id="Automations">
|
|
33795
|
-
<g id="Automations Base" filter="url(#filter1_ddii_automations)">
|
|
33796
|
-
<rect x="11.7083" y="11.7083" width="22" height="22" rx="4.58333" fill="#FFB466"/>
|
|
33797
|
-
<rect x="11.7083" y="11.7083" width="22" height="22" rx="4.58333" fill="url(#paint1_linear_automations)" fill-opacity="0.3" style="mix-blend-mode:color-burn"/>
|
|
33798
|
-
</g>
|
|
33799
|
-
<g id="Mark" transform="translate(11.7083 11.7083) scale(0.6875)">
|
|
33800
|
-
<g transform="translate(11.69 17.23) rotate(15.38) translate(-11.6127 -13.9462)">
|
|
33801
|
-
<path d="M19.6079 0.599355C17.3441 -0.321872 14.9739 -0.14792 13.46 0.89331C13.2119 1.0517 12.8569 1.33576 12.5208 1.72732C11.7692 2.60307 11.3623 3.63039 11.2455 4.71375C9.23223 4.72389 7.26359 5.26923 5.91356 6.71772C4.51769 8.21546 4.20143 10.1821 4.50239 12.1398C3.03356 12.6072 1.73247 13.5334 0.797604 15.0344C-0.763486 17.5411 0.0452254 21.226 2.54055 23.9633C3.86696 25.4182 6.02038 27.1152 9.12043 27.7103C9.4387 27.7774 9.7679 27.8383 10.1084 27.8924C10.1631 27.8912 10.2077 27.8829 10.2452 27.8663C10.3679 27.8115 10.4529 27.7164 10.4936 27.5884C10.5386 27.4464 10.4665 27.2329 10.3225 26.8061L10.3223 26.8053C10.295 26.7244 10.2394 26.5328 10.2229 26.4847C10.1092 26.1536 10.1013 25.6968 9.29531 25.5323C6.36484 24.9697 4.22412 22.9285 3.443 21.7079C1.93568 19.5884 1.74985 17.3834 2.5381 16.1175C3.15559 15.1259 3.99949 14.4762 5.00959 14.1271C5.0662 14.2875 5.12651 14.4471 5.18941 14.6047C6.26598 17.3029 8.34278 19.9218 10.7168 21.4594C12.5207 22.6277 14.0688 23.191 15.3656 23.2173C16.7185 23.2446 17.7648 22.679 18.3785 21.7329C19.1495 20.5441 18.9055 19.1005 18.2192 17.8597C17.5219 16.5993 16.2786 15.3443 14.618 14.2688C12.3111 12.7746 9.6482 11.8023 7.16738 11.7667C6.94958 11.7636 6.73278 11.7676 6.5175 11.7794C6.29761 10.2804 6.58767 8.99855 7.41267 8.11328C8.25927 7.2049 9.64226 6.75076 11.3481 6.76069C11.3942 6.99403 11.4511 7.2276 11.5191 7.45994C12.1111 9.48257 13.5227 11.5049 15.5552 13.1574C16.5948 14.0026 17.873 14.7596 19.1105 15.0578C20.3597 15.3589 21.8418 15.2258 22.7273 13.8605C23.4042 12.8168 23.3646 11.5943 22.7683 10.4454C22.1932 9.33738 21.0943 8.26144 19.5493 7.26071C17.7444 6.09178 15.4953 5.21721 13.2899 4.87294C13.3774 4.17741 13.6441 3.56421 14.0766 3.06037C14.1711 2.95366 14.4136 2.7086 14.6268 2.58184C15.5245 1.96452 17.2529 1.76519 18.9922 2.54473C19.0717 2.57587 19.162 2.61474 19.258 2.65802C19.6838 2.84995 19.8972 2.94538 20.0408 2.91486C20.1702 2.88726 20.2715 2.81303 20.3369 2.69806C20.4092 2.57052 20.3835 2.35019 20.3321 1.90979L20.332 1.90897C20.3223 1.82552 20.3146 1.75546 20.3086 1.70584C20.2668 1.36373 20.3503 0.922479 19.6079 0.599355ZM7.09311 13.8459C7.09073 13.8399 7.08762 13.8343 7.08529 13.8283C7.08348 13.8237 7.08223 13.8183 7.0804 13.8137H7.09213C7.10728 13.8138 7.12287 13.8144 7.13806 13.8146C9.13659 13.8433 11.4274 14.6433 13.503 15.9876C14.9676 16.9362 15.9342 17.9639 16.425 18.8509C16.9266 19.7579 16.8492 20.3271 16.6595 20.6196C16.4638 20.9213 16.112 21.1845 15.4076 21.1704C14.6469 21.155 13.4768 20.806 11.8318 19.7406C9.84087 18.4511 8.02486 16.1811 7.09311 13.8459ZM16.8481 11.5685C15.1147 10.1591 13.994 8.51485 13.5196 6.9941C15.2544 7.34223 17.0102 8.05638 18.4342 8.97854C19.8239 9.87862 20.6018 10.7185 20.9497 11.3888C21.2762 12.0181 21.2074 12.4377 21.0073 12.7462C20.7924 13.0776 20.4132 13.2646 19.5913 13.0666C18.7576 12.8657 17.753 12.3042 16.8481 11.5685Z" fill="#57432F" fill-rule="evenodd" clip-rule="evenodd"/>
|
|
33802
|
-
</g>
|
|
33803
|
-
</g>
|
|
33804
|
-
</g>
|
|
33805
|
-
<g id="Underscore" filter="url(#filter2_ddii_automations)">
|
|
33806
|
-
<rect x="38.0052" y="30.0417" width="17.4167" height="3.66667" rx="1.83333" fill="#FFB466"/>
|
|
33807
|
-
<rect x="38.0052" y="30.0417" width="17.4167" height="3.66667" rx="1.83333" fill="url(#paint2_linear_automations)" fill-opacity="0.3" style="mix-blend-mode:color-burn"/>
|
|
33808
|
-
</g>
|
|
33809
|
-
</g>
|
|
33810
|
-
</g>
|
|
33811
|
-
</g>
|
|
33812
|
-
<defs>
|
|
33813
|
-
<filter id="filter0_iiiiiiii_automations" x="4.83334" y="4.83325" width="62.3333" height="62.3333" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
33814
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
33815
|
-
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
33816
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33817
|
-
<feOffset/>
|
|
33818
|
-
<feGaussianBlur stdDeviation="6.63667"/>
|
|
33819
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33820
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.94902 0 0 0 0 0.94902 0 0 0 0 0.94902 0 0 0 1 0"/>
|
|
33821
|
-
<feBlend mode="plus-darker" in2="shape" result="effect1_innerShadow_automations"/>
|
|
33822
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33823
|
-
<feOffset/>
|
|
33824
|
-
<feGaussianBlur stdDeviation="1.30167"/>
|
|
33825
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33826
|
-
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0"/>
|
|
33827
|
-
<feBlend mode="overlay" in2="effect1_innerShadow_automations" result="effect2_innerShadow_automations"/>
|
|
33828
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33829
|
-
<feMorphology radius="0.88" operator="dilate" in="SourceAlpha" result="effect3_innerShadow_automations"/>
|
|
33830
|
-
<feOffset dx="-0.88" dy="-0.88"/>
|
|
33831
|
-
<feGaussianBlur stdDeviation="0.22"/>
|
|
33832
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33833
|
-
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
|
|
33834
|
-
<feBlend mode="overlay" in2="effect2_innerShadow_automations" result="effect3_innerShadow_automations"/>
|
|
33835
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33836
|
-
<feMorphology radius="0.88" operator="dilate" in="SourceAlpha" result="effect4_innerShadow_automations"/>
|
|
33837
|
-
<feOffset dx="-1.68667" dy="-1.68667"/>
|
|
33838
|
-
<feGaussianBlur stdDeviation="0.22"/>
|
|
33839
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33840
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.14902 0 0 0 0 0.14902 0 0 0 0 0.14902 0 0 0 1 0"/>
|
|
33841
|
-
<feBlend mode="plus-lighter" in2="effect3_innerShadow_automations" result="effect4_innerShadow_automations"/>
|
|
33842
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33843
|
-
<feOffset dx="-0.22" dy="-0.22"/>
|
|
33844
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33845
|
-
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.45 0"/>
|
|
33846
|
-
<feBlend mode="normal" in2="effect4_innerShadow_automations" result="effect5_innerShadow_automations"/>
|
|
33847
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33848
|
-
<feMorphology radius="0.88" operator="dilate" in="SourceAlpha" result="effect6_innerShadow_automations"/>
|
|
33849
|
-
<feOffset dx="0.88" dy="0.88"/>
|
|
33850
|
-
<feGaussianBlur stdDeviation="0.22"/>
|
|
33851
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33852
|
-
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
|
|
33853
|
-
<feBlend mode="overlay" in2="effect5_innerShadow_automations" result="effect6_innerShadow_automations"/>
|
|
33854
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33855
|
-
<feMorphology radius="0.88" operator="dilate" in="SourceAlpha" result="effect7_innerShadow_automations"/>
|
|
33856
|
-
<feOffset dx="1.68667" dy="1.68667"/>
|
|
33857
|
-
<feGaussianBlur stdDeviation="0.22"/>
|
|
33858
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33859
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.2 0 0 0 0 0.2 0 0 0 0 0.2 0 0 0 1 0"/>
|
|
33860
|
-
<feBlend mode="plus-lighter" in2="effect6_innerShadow_automations" result="effect7_innerShadow_automations"/>
|
|
33861
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33862
|
-
<feOffset dx="0.22" dy="0.22"/>
|
|
33863
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33864
|
-
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0"/>
|
|
33865
|
-
<feBlend mode="normal" in2="effect7_innerShadow_automations" result="effect8_innerShadow_automations"/>
|
|
33866
|
-
</filter>
|
|
33867
|
-
<filter id="filter1_ddii_automations" x="7.12501" y="7.12492" width="31.1667" height="31.1667" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
33868
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
33869
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33870
|
-
<feOffset/>
|
|
33871
|
-
<feGaussianBlur stdDeviation="2.29167"/>
|
|
33872
|
-
<feComposite in2="hardAlpha" operator="out"/>
|
|
33873
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.634402 0 0 0 0 0.336572 0 0 0 0 0.028646 0 0 0 0.7 0"/>
|
|
33874
|
-
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_automations"/>
|
|
33875
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33876
|
-
<feOffset/>
|
|
33877
|
-
<feGaussianBlur stdDeviation="0.916667"/>
|
|
33878
|
-
<feComposite in2="hardAlpha" operator="out"/>
|
|
33879
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.635294 0 0 0 0 0.336438 0 0 0 0 0.027451 0 0 0 0.8 0"/>
|
|
33880
|
-
<feBlend mode="normal" in2="effect1_dropShadow_automations" result="effect2_dropShadow_automations"/>
|
|
33881
|
-
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_automations" result="shape"/>
|
|
33882
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33883
|
-
<feOffset dy="0.458333"/>
|
|
33884
|
-
<feGaussianBlur stdDeviation="0.229167"/>
|
|
33885
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33886
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.870968 0 0 0 0 0.752016 0 0 0 0 0.629032 0 0 0 1 0"/>
|
|
33887
|
-
<feBlend mode="normal" in2="shape" result="effect3_innerShadow_automations"/>
|
|
33888
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33889
|
-
<feOffset dy="-0.458333"/>
|
|
33890
|
-
<feGaussianBlur stdDeviation="0.229167"/>
|
|
33891
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33892
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.7728 0 0 0 0 0.465213 0 0 0 0 0.1472 0 0 0 1 0"/>
|
|
33893
|
-
<feBlend mode="normal" in2="effect3_innerShadow_automations" result="effect4_innerShadow_automations"/>
|
|
33894
|
-
</filter>
|
|
33895
|
-
<filter id="filter2_ddii_automations" x="33.4219" y="25.4584" width="26.5833" height="12.8334" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
33896
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
33897
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33898
|
-
<feOffset/>
|
|
33899
|
-
<feGaussianBlur stdDeviation="2.29167"/>
|
|
33900
|
-
<feComposite in2="hardAlpha" operator="out"/>
|
|
33901
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.634402 0 0 0 0 0.336572 0 0 0 0 0.028646 0 0 0 0.7 0"/>
|
|
33902
|
-
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_automations"/>
|
|
33903
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33904
|
-
<feOffset/>
|
|
33905
|
-
<feGaussianBlur stdDeviation="0.916667"/>
|
|
33906
|
-
<feComposite in2="hardAlpha" operator="out"/>
|
|
33907
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.635294 0 0 0 0 0.336438 0 0 0 0 0.027451 0 0 0 0.8 0"/>
|
|
33908
|
-
<feBlend mode="normal" in2="effect1_dropShadow_automations" result="effect2_dropShadow_automations"/>
|
|
33909
|
-
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_automations" result="shape"/>
|
|
33910
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33911
|
-
<feOffset dy="0.458333"/>
|
|
33912
|
-
<feGaussianBlur stdDeviation="0.229167"/>
|
|
33913
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33914
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.870968 0 0 0 0 0.752016 0 0 0 0 0.629032 0 0 0 1 0"/>
|
|
33915
|
-
<feBlend mode="normal" in2="shape" result="effect3_innerShadow_automations"/>
|
|
33916
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
33917
|
-
<feOffset dy="-0.458333"/>
|
|
33918
|
-
<feGaussianBlur stdDeviation="0.229167"/>
|
|
33919
|
-
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
|
33920
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.7728 0 0 0 0 0.465213 0 0 0 0 0.1472 0 0 0 1 0"/>
|
|
33921
|
-
<feBlend mode="normal" in2="effect3_innerShadow_automations" result="effect4_innerShadow_automations"/>
|
|
33922
|
-
</filter>
|
|
33923
|
-
<radialGradient id="paint0_radial_automations" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(36 24.9084) rotate(90) scale(44.8021 44.9389)">
|
|
33924
|
-
<stop stop-opacity="0"/>
|
|
33925
|
-
<stop offset="1"/>
|
|
33926
|
-
</radialGradient>
|
|
33927
|
-
<linearGradient id="paint1_linear_automations" x1="29.3542" y1="14.5728" x2="12.5406" y2="33.7347" gradientUnits="userSpaceOnUse">
|
|
33928
|
-
<stop stop-color="white"/>
|
|
33929
|
-
<stop offset="1" stop-color="#331A00"/>
|
|
33930
|
-
</linearGradient>
|
|
33931
|
-
<linearGradient id="paint2_linear_automations" x1="51.0699" y1="30.6131" x2="50.4646" y2="35.1722" gradientUnits="userSpaceOnUse">
|
|
33932
|
-
<stop stop-color="white"/>
|
|
33933
|
-
<stop offset="1" stop-color="#331A00"/>
|
|
33934
|
-
</linearGradient>
|
|
33935
|
-
</defs>
|
|
33936
|
-
</svg>`;
|
|
33924
|
+
var ICON = `<img src="${AUTOMATIONS_CLI_LOGO_URL}" width="72" height="72" alt="" referrerpolicy="no-referrer">`;
|
|
33937
33925
|
var PALETTE = `
|
|
33938
33926
|
:root {
|
|
33939
33927
|
color-scheme: light dark;
|
|
@@ -34018,6 +34006,7 @@ var SHARED_STYLES = `
|
|
|
34018
34006
|
position: relative;
|
|
34019
34007
|
isolation: isolate;
|
|
34020
34008
|
}
|
|
34009
|
+
.logo img,
|
|
34021
34010
|
.logo svg {
|
|
34022
34011
|
display: block;
|
|
34023
34012
|
width: 100%;
|
|
@@ -34175,7 +34164,7 @@ var SUCCESS_HTML = `<!DOCTYPE html>
|
|
|
34175
34164
|
<div class="container">
|
|
34176
34165
|
<header class="header">
|
|
34177
34166
|
<div class="logo">
|
|
34178
|
-
${
|
|
34167
|
+
${ICON}
|
|
34179
34168
|
<div class="badge">
|
|
34180
34169
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
34181
34170
|
<polyline points="20 6 9 17 4 12"/>
|
|
@@ -34265,7 +34254,7 @@ function errorHtml(message) {
|
|
|
34265
34254
|
<body>
|
|
34266
34255
|
<div class="container">
|
|
34267
34256
|
<div class="logo">
|
|
34268
|
-
${
|
|
34257
|
+
${ICON}
|
|
34269
34258
|
<div class="badge">
|
|
34270
34259
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round">
|
|
34271
34260
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
@@ -37309,7 +37298,6 @@ async function readSource(options, input2) {
|
|
|
37309
37298
|
// src/commands/draft/draft-service.ts
|
|
37310
37299
|
import { CliError as CliError4, getErrorMessage as getErrorMessage8 } from "@doist/cli-core";
|
|
37311
37300
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
37312
|
-
import { setTimeout as wait2 } from "node:timers/promises";
|
|
37313
37301
|
function createDraft2(draftApi, input2) {
|
|
37314
37302
|
return withRecoveryHints(draftApi, createDraft(draftApi, input2));
|
|
37315
37303
|
}
|
|
@@ -37368,13 +37356,7 @@ function draftHints(scope, draftId) {
|
|
|
37368
37356
|
function scopeFlag(scope) {
|
|
37369
37357
|
return scope === null ? "--personal" : `--workspace ${scope}`;
|
|
37370
37358
|
}
|
|
37371
|
-
|
|
37372
|
-
var STATUS_REQUEST_GRACE_MS = 1e4;
|
|
37373
|
-
var OPEN_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
37374
|
-
"pending",
|
|
37375
|
-
"running"
|
|
37376
|
-
]);
|
|
37377
|
-
async function startDraftTest(draftApi, {
|
|
37359
|
+
async function startDraftTest2(draftApi, {
|
|
37378
37360
|
draftId,
|
|
37379
37361
|
request: request2,
|
|
37380
37362
|
wait: waitFor,
|
|
@@ -37382,13 +37364,13 @@ async function startDraftTest(draftApi, {
|
|
|
37382
37364
|
}) {
|
|
37383
37365
|
let started;
|
|
37384
37366
|
try {
|
|
37385
|
-
started = await draftApi
|
|
37367
|
+
started = await startDraftTest(draftApi, { draftId, request: request2 });
|
|
37386
37368
|
} catch (error62) {
|
|
37387
37369
|
const refusal = getDraftTestRequestError(error62);
|
|
37388
37370
|
if (!refusal) throw error62;
|
|
37389
37371
|
throw toDraftTestCliError(refusal, draftId, draftApi.workspaceId);
|
|
37390
37372
|
}
|
|
37391
|
-
const
|
|
37373
|
+
const identity = {
|
|
37392
37374
|
draftId,
|
|
37393
37375
|
testRunId: started.testRunId,
|
|
37394
37376
|
trigger: started.trigger,
|
|
@@ -37396,61 +37378,19 @@ async function startDraftTest(draftApi, {
|
|
|
37396
37378
|
command: `tda draft test-run ${draftId} ${started.testRunId} ${scopeFlag(draftApi.workspaceId)}`
|
|
37397
37379
|
};
|
|
37398
37380
|
if (!waitFor) {
|
|
37399
|
-
return { action: "test_started", ...
|
|
37381
|
+
return { action: "test_started", ...identity, status: started.status };
|
|
37400
37382
|
}
|
|
37401
|
-
const
|
|
37402
|
-
const deadline = Date.now() + waitFor.timeoutMs;
|
|
37403
|
-
let intervalMs = intervals.first;
|
|
37404
|
-
let last = null;
|
|
37405
|
-
while (true) {
|
|
37406
|
-
const requestTimeout = AbortSignal.timeout(
|
|
37407
|
-
Math.max(deadline - Date.now(), 0) + (waitFor.requestGraceMs ?? STATUS_REQUEST_GRACE_MS)
|
|
37408
|
-
);
|
|
37409
|
-
try {
|
|
37410
|
-
last = await draftApi.getTestRun(
|
|
37411
|
-
draftId,
|
|
37412
|
-
started.testRunId,
|
|
37413
|
-
void 0,
|
|
37414
|
-
AbortSignal.any([signal, requestTimeout])
|
|
37415
|
-
);
|
|
37416
|
-
} catch (error62) {
|
|
37417
|
-
if (signal.aborted || !requestTimeout.aborted) throw error62;
|
|
37418
|
-
return toFinished(base, last, "timed_out");
|
|
37419
|
-
}
|
|
37420
|
-
if (!OPEN_RUN_STATUSES.has(last.status)) {
|
|
37421
|
-
return toFinished(base, last, toOutcome(last.status));
|
|
37422
|
-
}
|
|
37423
|
-
const remainingMs = deadline - Date.now();
|
|
37424
|
-
if (remainingMs <= 0) {
|
|
37425
|
-
return toFinished(base, last, "timed_out");
|
|
37426
|
-
}
|
|
37427
|
-
await wait2(Math.min(intervalMs, remainingMs), void 0, { signal });
|
|
37428
|
-
intervalMs = Math.min(intervalMs * 2, intervals.max);
|
|
37429
|
-
}
|
|
37430
|
-
}
|
|
37431
|
-
function toFinished(base, run, outcome) {
|
|
37383
|
+
const finished = await waitForDraftTest(draftApi, started, { ...waitFor, signal });
|
|
37432
37384
|
return {
|
|
37433
37385
|
action: "test_finished",
|
|
37434
|
-
...
|
|
37435
|
-
outcome,
|
|
37436
|
-
status:
|
|
37437
|
-
failedStep:
|
|
37438
|
-
error:
|
|
37439
|
-
result:
|
|
37386
|
+
...identity,
|
|
37387
|
+
outcome: finished.outcome,
|
|
37388
|
+
status: finished.status,
|
|
37389
|
+
failedStep: finished.failedStep,
|
|
37390
|
+
error: finished.error,
|
|
37391
|
+
result: finished.result
|
|
37440
37392
|
};
|
|
37441
37393
|
}
|
|
37442
|
-
function toOutcome(status) {
|
|
37443
|
-
switch (status) {
|
|
37444
|
-
case "completed":
|
|
37445
|
-
return "passed";
|
|
37446
|
-
case "skipped":
|
|
37447
|
-
return "skipped";
|
|
37448
|
-
case "cancelled":
|
|
37449
|
-
return "cancelled";
|
|
37450
|
-
default:
|
|
37451
|
-
return "failed";
|
|
37452
|
-
}
|
|
37453
|
-
}
|
|
37454
37394
|
function draftNotReadyError(message, draftId, scope) {
|
|
37455
37395
|
const flag = scopeFlag(scope);
|
|
37456
37396
|
return new CliError4("DRAFT_NOT_READY", message, {
|
|
@@ -37476,9 +37416,6 @@ function toDraftTestCliError(refusal, draftId, scope) {
|
|
|
37476
37416
|
return new CliError4(refusal.code.toUpperCase(), refusal.message);
|
|
37477
37417
|
}
|
|
37478
37418
|
}
|
|
37479
|
-
function parseTriggerOption(value) {
|
|
37480
|
-
return /^\d+$/.test(value) ? { index: Number(value) } : { event: value };
|
|
37481
|
-
}
|
|
37482
37419
|
async function readTestPayloadFile(path) {
|
|
37483
37420
|
let content;
|
|
37484
37421
|
try {
|
|
@@ -37874,10 +37811,10 @@ function registerDraftCommand(program) {
|
|
|
37874
37811
|
}
|
|
37875
37812
|
const timeoutMs = parseTestTimeout(options.timeout ?? DEFAULT_TEST_WAIT);
|
|
37876
37813
|
const draftApi = bindDraftApi(api, await resolveWorkspaceScope(options), { signal });
|
|
37877
|
-
return
|
|
37814
|
+
return startDraftTest2(draftApi, {
|
|
37878
37815
|
draftId,
|
|
37879
37816
|
request: {
|
|
37880
|
-
...options.trigger !== void 0 ? { trigger:
|
|
37817
|
+
...options.trigger !== void 0 ? { trigger: toDraftTestTriggerSelector(options.trigger) } : {},
|
|
37881
37818
|
...options.payloadFile !== void 0 ? { payload: await readTestPayloadFile(options.payloadFile) } : {}
|
|
37882
37819
|
},
|
|
37883
37820
|
wait: options.wait === true ? { timeoutMs } : null,
|