@lumerahq/cli 0.30.0 → 0.30.1-dev.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/index.js
CHANGED
|
@@ -240,25 +240,25 @@ async function main() {
|
|
|
240
240
|
switch (command) {
|
|
241
241
|
// Resource commands
|
|
242
242
|
case "plan":
|
|
243
|
-
await import("./resources-
|
|
243
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.plan(args.slice(1)));
|
|
244
244
|
break;
|
|
245
245
|
case "apply":
|
|
246
|
-
await import("./resources-
|
|
246
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.apply(args.slice(1)));
|
|
247
247
|
break;
|
|
248
248
|
case "pull":
|
|
249
|
-
await import("./resources-
|
|
249
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.pull(args.slice(1)));
|
|
250
250
|
break;
|
|
251
251
|
case "destroy":
|
|
252
|
-
await import("./resources-
|
|
252
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.destroy(args.slice(1)));
|
|
253
253
|
break;
|
|
254
254
|
case "list":
|
|
255
|
-
await import("./resources-
|
|
255
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.list(args.slice(1)));
|
|
256
256
|
break;
|
|
257
257
|
case "show":
|
|
258
|
-
await import("./resources-
|
|
258
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.show(args.slice(1)));
|
|
259
259
|
break;
|
|
260
260
|
case "diff":
|
|
261
|
-
await import("./resources-
|
|
261
|
+
await import("./resources-CZ32Y3KM.js").then((m) => m.diff(args.slice(1)));
|
|
262
262
|
break;
|
|
263
263
|
// Development
|
|
264
264
|
case "dev":
|
|
@@ -2177,6 +2177,7 @@ async function applyAutomations(api, localAutomations, projectId) {
|
|
|
2177
2177
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id).map((a) => [a.external_id, a]));
|
|
2178
2178
|
for (const { automation, code } of localAutomations) {
|
|
2179
2179
|
const remote = remoteByExternalId.get(automation.external_id);
|
|
2180
|
+
const appliedAction = remote ? "updated" : "created";
|
|
2180
2181
|
const payload = {
|
|
2181
2182
|
external_id: automation.external_id,
|
|
2182
2183
|
name: automation.name,
|
|
@@ -2194,11 +2195,9 @@ async function applyAutomations(api, localAutomations, projectId) {
|
|
|
2194
2195
|
if (remote) {
|
|
2195
2196
|
await api.updateAutomation(remote.id, payload);
|
|
2196
2197
|
automationId = remote.id;
|
|
2197
|
-
console.log(pc2.green(" \u2713"), `${automation.name} (updated)`);
|
|
2198
2198
|
} else {
|
|
2199
2199
|
const created = await api.createAutomation(payload);
|
|
2200
2200
|
automationId = created.id;
|
|
2201
|
-
console.log(pc2.green(" \u2713"), `${automation.name} (created)`);
|
|
2202
2201
|
}
|
|
2203
2202
|
const localPresets = automation.inputs?.presets;
|
|
2204
2203
|
if (localPresets) {
|
|
@@ -2221,6 +2220,7 @@ async function applyAutomations(api, localAutomations, projectId) {
|
|
|
2221
2220
|
);
|
|
2222
2221
|
}
|
|
2223
2222
|
}
|
|
2223
|
+
console.log(pc2.green(" \u2713"), `${automation.name} (${appliedAction})`);
|
|
2224
2224
|
} catch (e) {
|
|
2225
2225
|
console.log(pc2.red(" \u2717"), `${automation.name}: ${e}`);
|
|
2226
2226
|
errors++;
|
|
@@ -2269,19 +2269,27 @@ async function setSchedule(api, automationId, schedule, localPresets) {
|
|
|
2269
2269
|
const remotePresets = await api.listPresets(automationId);
|
|
2270
2270
|
const preset = remotePresets.find((p) => p.name === presetName);
|
|
2271
2271
|
if (!preset) {
|
|
2272
|
-
|
|
2273
|
-
return;
|
|
2272
|
+
throw new Error(`Schedule preset '${presetName}' not found`);
|
|
2274
2273
|
}
|
|
2274
|
+
const expectedSchedule = {
|
|
2275
|
+
schedule: schedule.cron,
|
|
2276
|
+
schedule_tz: schedule.timezone || "UTC",
|
|
2277
|
+
schedule_preset_id: preset.id
|
|
2278
|
+
};
|
|
2279
|
+
await api.updateAutomation(automationId, expectedSchedule);
|
|
2280
|
+
let persisted;
|
|
2275
2281
|
try {
|
|
2276
|
-
await api.
|
|
2277
|
-
schedule: schedule.cron,
|
|
2278
|
-
schedule_tz: schedule.timezone || "UTC",
|
|
2279
|
-
schedule_preset_id: preset.id
|
|
2280
|
-
});
|
|
2281
|
-
console.log(pc2.dim(` Set schedule: ${schedule.cron}`));
|
|
2282
|
+
persisted = await api.getAutomation(automationId);
|
|
2282
2283
|
} catch (e) {
|
|
2283
|
-
|
|
2284
|
+
throw new Error(`Failed to verify persisted schedule: ${String(e)}`);
|
|
2285
|
+
}
|
|
2286
|
+
const mismatches = Object.keys(expectedSchedule).filter((field) => persisted[field] !== expectedSchedule[field]).map(
|
|
2287
|
+
(field) => `${field} expected ${JSON.stringify(expectedSchedule[field])}, got ${JSON.stringify(persisted[field])}`
|
|
2288
|
+
);
|
|
2289
|
+
if (mismatches.length > 0) {
|
|
2290
|
+
throw new Error(`Schedule update was not persisted: ${mismatches.join("; ")}`);
|
|
2284
2291
|
}
|
|
2292
|
+
console.log(pc2.dim(` Set schedule: ${schedule.cron}`));
|
|
2285
2293
|
}
|
|
2286
2294
|
async function applyHooks(api, localHooks, collections, projectId) {
|
|
2287
2295
|
let errors = 0;
|
|
@@ -4519,6 +4527,7 @@ async function diff(args) {
|
|
|
4519
4527
|
export {
|
|
4520
4528
|
apply,
|
|
4521
4529
|
applyAgents,
|
|
4530
|
+
applyAutomations,
|
|
4522
4531
|
applyCollections,
|
|
4523
4532
|
applySkills,
|
|
4524
4533
|
convertCollectionToApiFormat,
|