@koda-sl/baker-cli 0.367.0-dev.e10535428 → 0.367.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/dist/cli.js
CHANGED
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
validateCanvasDeep,
|
|
70
70
|
withoutCastName,
|
|
71
71
|
ytDlpBlockSignal
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-AI4HWQVN.js";
|
|
73
73
|
import {
|
|
74
74
|
csvOrJson,
|
|
75
75
|
daysAgoIso,
|
|
@@ -64311,9 +64311,26 @@ function matchesTrigger(kind, query) {
|
|
|
64311
64311
|
const family = query.replace(/\.?\*?$/, "");
|
|
64312
64312
|
return kind === query || kind.startsWith(`${family}.`);
|
|
64313
64313
|
}
|
|
64314
|
-
function shapeTriggerCatalog(
|
|
64314
|
+
function shapeTriggerCatalog(response, filter) {
|
|
64315
64315
|
const { trigger, group } = filter;
|
|
64316
|
-
|
|
64316
|
+
const unfiltered = trigger === void 0 && group === void 0;
|
|
64317
|
+
if (unfiltered && filter.full) return { ok: true, data: response };
|
|
64318
|
+
const parsed = triggerCatalogSchema.safeParse(response);
|
|
64319
|
+
if (!parsed.success) {
|
|
64320
|
+
return {
|
|
64321
|
+
ok: false,
|
|
64322
|
+
error: {
|
|
64323
|
+
code: "INTERNAL_ERROR",
|
|
64324
|
+
message: "The trigger list came back in a shape this version of the CLI cannot read.",
|
|
64325
|
+
fix: {
|
|
64326
|
+
action: "run `baker scheduled-agents triggers --full`",
|
|
64327
|
+
explanation: "--full prints the whole list as the server sent it, without reading it."
|
|
64328
|
+
}
|
|
64329
|
+
}
|
|
64330
|
+
};
|
|
64331
|
+
}
|
|
64332
|
+
const catalog = parsed.data;
|
|
64333
|
+
if (unfiltered) {
|
|
64317
64334
|
return {
|
|
64318
64335
|
ok: true,
|
|
64319
64336
|
data: {
|
|
@@ -64328,12 +64345,17 @@ function shapeTriggerCatalog(catalog, filter) {
|
|
|
64328
64345
|
]
|
|
64329
64346
|
};
|
|
64330
64347
|
}
|
|
64331
|
-
const groups = catalog.groups.filter((entry) =>
|
|
64348
|
+
const groups = catalog.groups.filter((entry) => group === void 0 || entry.group === group).map((entry) => ({
|
|
64332
64349
|
...entry,
|
|
64333
|
-
triggers: entry.triggers.filter(
|
|
64350
|
+
triggers: entry.triggers.filter(
|
|
64351
|
+
(t) => trigger === void 0 || matchesTrigger(t.kind, trigger)
|
|
64352
|
+
)
|
|
64334
64353
|
})).filter((entry) => entry.triggers.length > 0);
|
|
64335
64354
|
if (groups.length === 0) {
|
|
64336
|
-
const asked = [
|
|
64355
|
+
const asked = [
|
|
64356
|
+
trigger === void 0 ? null : `--trigger "${trigger}"`,
|
|
64357
|
+
group === void 0 ? null : `--group "${group}"`
|
|
64358
|
+
].filter(Boolean);
|
|
64337
64359
|
return {
|
|
64338
64360
|
ok: false,
|
|
64339
64361
|
error: {
|
|
@@ -64368,8 +64390,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
64368
64390
|
run: async ({ args: args5 }) => {
|
|
64369
64391
|
try {
|
|
64370
64392
|
const response = await apiPost("/api/scheduled-agents/triggers", {});
|
|
64371
|
-
const
|
|
64372
|
-
const shaped = shapeTriggerCatalog(catalog, { trigger: args5.trigger, group: args5.group, full: args5.full });
|
|
64393
|
+
const shaped = shapeTriggerCatalog(response.data, { trigger: args5.trigger, group: args5.group, full: args5.full });
|
|
64373
64394
|
writeJson(shaped);
|
|
64374
64395
|
if (!shaped.ok) process.exit(1);
|
|
64375
64396
|
} catch (err) {
|