sim 2.1.22-preview.143.1 → 2.1.22-preview.145.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.
Files changed (2) hide show
  1. package/dist/index.js +12 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6970,6 +6970,9 @@ function omit(obj, keys) {
6970
6970
  }
6971
6971
  return result;
6972
6972
  }
6973
+ function isRecordLike(value) {
6974
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6975
+ }
6973
6976
 
6974
6977
  // src/update/install.ts
6975
6978
  var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
@@ -20427,9 +20430,6 @@ function resolveWorkflowRunSelection(flags) {
20427
20430
  }
20428
20431
  };
20429
20432
  }
20430
- function isRecord(value) {
20431
- return typeof value === "object" && value !== null && !Array.isArray(value);
20432
- }
20433
20433
  function stringField(frame, key) {
20434
20434
  const value = frame[key];
20435
20435
  return typeof value === "string" ? value : null;
@@ -20443,13 +20443,13 @@ async function readWorkflowResult(response) {
20443
20443
  } catch {
20444
20444
  throw new SimApiError(`Workflow run returned malformed JSON${contentType ? ` as ${contentType}` : ""}`, response.status);
20445
20445
  }
20446
- if (!isRecord(envelope)) {
20446
+ if (!isRecordLike(envelope)) {
20447
20447
  throw new SimApiError("Workflow run returned an invalid result envelope", response.status);
20448
20448
  }
20449
- return isRecord(envelope.data) ? envelope.data : envelope;
20449
+ return isRecordLike(envelope.data) ? envelope.data : envelope;
20450
20450
  }
20451
20451
  for await (const value of readNdjson(response.body, "Workflow result stream")) {
20452
- if (!isRecord(value) || typeof value.type !== "string") {
20452
+ if (!isRecordLike(value) || typeof value.type !== "string") {
20453
20453
  throw new SimApiError("Workflow result stream returned an unknown event", response.status);
20454
20454
  }
20455
20455
  if (value.type === "heartbeat")
@@ -20457,7 +20457,7 @@ async function readWorkflowResult(response) {
20457
20457
  if (value.type === "error") {
20458
20458
  throw new SimApiError(safeOneLine(typeof value.error === "string" ? value.error : "Workflow run failed"), typeof value.status === "number" ? value.status : 0, typeof value.code === "string" ? value.code : null);
20459
20459
  }
20460
- if (value.type === "final" && isRecord(value.data))
20460
+ if (value.type === "final" && isRecordLike(value.data))
20461
20461
  return value.data;
20462
20462
  throw new SimApiError("Workflow result stream returned an unknown event", response.status);
20463
20463
  }
@@ -20562,7 +20562,7 @@ async function renderRunStream(body, options) {
20562
20562
  }
20563
20563
  if (frame === DONE_SENTINEL)
20564
20564
  break;
20565
- if (!isRecord(frame))
20565
+ if (!isRecordLike(frame))
20566
20566
  continue;
20567
20567
  if (frame.event === undefined && typeof frame.chunk === "string") {
20568
20568
  commentary.inline(sanitize(frame.chunk));
@@ -20588,7 +20588,7 @@ async function renderRunStream(body, options) {
20588
20588
  commentary.endLine();
20589
20589
  throw new SimApiError(safeOneLine(stringField(frame, "error") ?? "The workflow run failed."), 0);
20590
20590
  case "final":
20591
- if (isRecord(frame.data))
20591
+ if (isRecordLike(frame.data))
20592
20592
  final = frame.data;
20593
20593
  break;
20594
20594
  default:
@@ -20696,18 +20696,15 @@ var MAX_POLL_DELAY_MS = 15000;
20696
20696
  var POLL_BACKOFF_FACTOR = 2;
20697
20697
  var DEFAULT_WAIT_TIMEOUT_SECONDS = 3600;
20698
20698
  var WAIT_TIMEOUT_FLAG = "--wait-timeout <seconds>";
20699
- function isRecord2(value) {
20700
- return typeof value === "object" && value !== null && !Array.isArray(value);
20701
- }
20702
20699
  function optionalString(value) {
20703
20700
  return typeof value === "string" && value !== "" ? value : null;
20704
20701
  }
20705
20702
  function readRun(raw) {
20706
- const run = isRecord2(raw) && isRecord2(raw.data) ? raw.data : raw;
20707
- if (!isRecord2(run) || typeof run.status !== "string") {
20703
+ const run = isRecordLike(raw) && isRecordLike(raw.data) ? raw.data : raw;
20704
+ if (!isRecordLike(run) || typeof run.status !== "string") {
20708
20705
  throw new SimApiError("Run status response carried no status.", 0);
20709
20706
  }
20710
- const paused = isRecord2(run.paused) ? run.paused : null;
20707
+ const paused = isRecordLike(run.paused) ? run.paused : null;
20711
20708
  return {
20712
20709
  status: run.status,
20713
20710
  pauseKind: paused ? optionalString(paused.pauseKind) : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.1.22-preview.143.1",
3
+ "version": "2.1.22-preview.145.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "imports": {