@odla-ai/cli 0.35.0 → 0.35.1

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/bin.cjs CHANGED
@@ -14452,9 +14452,20 @@ async function bySlug(ctx, slug) {
14452
14452
  "GET",
14453
14453
  `/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(slug)}&limit=1`
14454
14454
  );
14455
- const found = page2.records[0];
14456
- if (!found) throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
14457
- return found;
14455
+ const filtered = page2.records.find((record11) => record11.slug === slug);
14456
+ if (filtered) return filtered;
14457
+ const limit = 100;
14458
+ for (let offset = 0; ; offset += limit) {
14459
+ const fallback = await call(
14460
+ ctx,
14461
+ "GET",
14462
+ `/runbook?app=${encodeURIComponent(ctx.appId)}&limit=${limit}&offset=${offset}`
14463
+ );
14464
+ const found = fallback.records.find((record11) => record11.slug === slug);
14465
+ if (found) return found;
14466
+ if (!fallback.records.length || offset + fallback.records.length >= fallback.total) break;
14467
+ }
14468
+ throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
14458
14469
  }
14459
14470
  function readBody(file, inline) {
14460
14471
  if (inline !== void 0) return inline;
@@ -14538,7 +14549,7 @@ async function runbookRevert(ctx, slug, version) {
14538
14549
  ctx,
14539
14550
  "POST",
14540
14551
  `/runbook/${encodeURIComponent(runbook.id)}/revert`,
14541
- { version }
14552
+ { version, expectedVersion: runbook.version }
14542
14553
  );
14543
14554
  if (ctx.json) return ctx.out.log(JSON.stringify(result, null, 2));
14544
14555
  ctx.out.log(`${slug} reverted to v${version}, now v${result.record?.version ?? runbook.version + 1}`);