create-op-node 0.11.2 → 0.11.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/dist/cli.js CHANGED
@@ -259,12 +259,12 @@ async function fetchOutput(auth, workspaceId, outputName) {
259
259
  auth.token,
260
260
  `/workspaces/${encodeURIComponent(workspaceId)}/current-state-version-outputs`
261
261
  );
262
- if (res.status !== 200) return null;
262
+ if (res.status !== 200) return { kind: "error" };
263
263
  const body = res.body;
264
264
  const match = body.data?.find((o) => o.attributes?.name === outputName);
265
- if (!match) return null;
265
+ if (!match) return { kind: "absent" };
266
266
  const value = match.attributes?.value;
267
- return typeof value === "string" ? value : null;
267
+ return typeof value === "string" ? { kind: "value", value } : { kind: "absent" };
268
268
  }
269
269
  async function safeExeca(cmd, args, options) {
270
270
  try {
@@ -709,21 +709,28 @@ async function waitForRunOutput(input, budgets, deps, runId) {
709
709
  );
710
710
  if (r?.finished) {
711
711
  if (!r.succeeded) return { kind: "run-failed", status: r.status };
712
- deps.onProgress?.("fetching");
713
- const value = await safePoll(
714
- () => deps.fetchOutput(
715
- { token: input.token, organization: input.organization },
716
- input.workspaceId,
717
- input.outputName
718
- ),
719
- () => deps.onProgress?.("retry")
720
- );
721
- return value !== null ? { kind: "success", value } : { kind: "output-missing" };
712
+ const out = await tryFetchOutput(input, deps);
713
+ if (out.kind === "value") return { kind: "success", value: out.value };
714
+ if (out.kind === "absent") return { kind: "output-missing" };
722
715
  }
723
716
  await deps.sleep(budgets.pollMs);
724
717
  }
725
718
  return { kind: "timeout" };
726
719
  }
720
+ async function tryFetchOutput(input, deps) {
721
+ deps.onProgress?.("fetching");
722
+ const out = await safePoll(
723
+ () => deps.fetchOutput(
724
+ { token: input.token, organization: input.organization },
725
+ input.workspaceId,
726
+ input.outputName
727
+ ),
728
+ () => deps.onProgress?.("retry")
729
+ );
730
+ if (out === null) return { kind: "error" };
731
+ if (out.kind === "error") deps.onProgress?.("retry");
732
+ return out;
733
+ }
727
734
 
728
735
  // src/commands/init.ts
729
736
  async function ghTokenFromCli() {
@@ -4997,7 +5004,7 @@ function withDefaultSubcommand(argv, known) {
4997
5004
  }
4998
5005
 
4999
5006
  // src/cli.ts
5000
- var VERSION = "0.11.2";
5007
+ var VERSION = "0.11.3";
5001
5008
  var program = new Command();
5002
5009
  program.name("create-op-node").description(
5003
5010
  "Interactive bootstrap for an Opus Populi federation node.\nCloudflare infrastructure \u2192 Mac Studio \u2192 live public API."