@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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-EG23MPUC.js";
4
+ } from "./chunk-SRL2TN24.js";
5
5
  import {
6
6
  exitCodeFor
7
7
  } from "./chunk-UKLSRQ5J.js";
@@ -9,4 +9,4 @@ export {
9
9
  exitCodeFor,
10
10
  runCli
11
11
  };
12
- //# sourceMappingURL=cli-Z5NSTS75.js.map
12
+ //# sourceMappingURL=cli-HS35QLXR.js.map
package/dist/index.cjs CHANGED
@@ -13485,9 +13485,20 @@ async function bySlug(ctx, slug) {
13485
13485
  "GET",
13486
13486
  `/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(slug)}&limit=1`
13487
13487
  );
13488
- const found = page2.records[0];
13489
- if (!found) throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
13490
- return found;
13488
+ const filtered = page2.records.find((record11) => record11.slug === slug);
13489
+ if (filtered) return filtered;
13490
+ const limit = 100;
13491
+ for (let offset = 0; ; offset += limit) {
13492
+ const fallback = await call(
13493
+ ctx,
13494
+ "GET",
13495
+ `/runbook?app=${encodeURIComponent(ctx.appId)}&limit=${limit}&offset=${offset}`
13496
+ );
13497
+ const found = fallback.records.find((record11) => record11.slug === slug);
13498
+ if (found) return found;
13499
+ if (!fallback.records.length || offset + fallback.records.length >= fallback.total) break;
13500
+ }
13501
+ throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
13491
13502
  }
13492
13503
  function readBody(file, inline) {
13493
13504
  if (inline !== void 0) return inline;
@@ -13572,7 +13583,7 @@ async function runbookRevert(ctx, slug, version) {
13572
13583
  ctx,
13573
13584
  "POST",
13574
13585
  `/runbook/${encodeURIComponent(runbook.id)}/revert`,
13575
- { version }
13586
+ { version, expectedVersion: runbook.version }
13576
13587
  );
13577
13588
  if (ctx.json) return ctx.out.log(JSON.stringify(result, null, 2));
13578
13589
  ctx.out.log(`${slug} reverted to v${version}, now v${result.record?.version ?? runbook.version + 1}`);