@lace-cloud/canvas 0.22.0 → 0.23.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.
@@ -12446,27 +12446,25 @@ var stackPreviewSchema = z.object({
12446
12446
  bound: z.number().optional()
12447
12447
  })
12448
12448
  });
12449
- var changeRequestSchema = z.object({
12449
+ var gateChangeRequestSchema = z.object({
12450
12450
  id: z.string(),
12451
- orgId: z.string(),
12452
- teamId: z.string(),
12453
- runId: z.string(),
12454
- bindingId: z.string().nullable(),
12455
- invocationId: z.string().nullable(),
12456
12451
  state: z.string(),
12457
- approverUserId: z.string().nullable(),
12458
- approvalChain: z.unknown(),
12459
- emergencyApproval: z.boolean(),
12460
- narrativeArtifactId: z.string().nullable(),
12461
- policyResolution: z.unknown(),
12462
- externalSystemId: z.string().nullable(),
12463
- externalRef: z.string().nullable(),
12464
- idempotencyKey: z.string().nullable(),
12465
- lastReconciledAt: z.string().nullable(),
12466
- submittedByUserId: z.string().nullable(),
12467
- submittedAt: z.string().nullable(),
12468
- createdAt: z.string(),
12469
- updatedAt: z.string()
12452
+ requirements: z.array(
12453
+ z.object({
12454
+ id: z.string(),
12455
+ state: z.string(),
12456
+ decidedBy: z.enum(["lace", "ecm"])
12457
+ })
12458
+ ),
12459
+ records: z.array(
12460
+ z.object({
12461
+ externalSystemId: z.string(),
12462
+ kind: z.string(),
12463
+ externalRef: z.string().nullable(),
12464
+ externalUrl: z.string().nullable(),
12465
+ state: z.string().nullable()
12466
+ })
12467
+ )
12470
12468
  });
12471
12469
  var runEventSchema = z.discriminatedUnion("type", [
12472
12470
  z.object({ type: z.literal("log"), text: z.string() }),
@@ -12474,8 +12472,11 @@ var runEventSchema = z.discriminatedUnion("type", [
12474
12472
  z.object({
12475
12473
  type: z.literal("gate"),
12476
12474
  resolution: z.object({ mode: z.string(), reason: z.string().optional() }),
12477
- changeRequest: changeRequestSchema.nullable()
12478
- }),
12475
+ changeRequest: gateChangeRequestSchema.nullable()
12476
+ }).refine(
12477
+ (gate) => gate.resolution.mode === "awaiting_approval" === (gate.changeRequest !== null),
12478
+ { message: "a gate event carries a change request exactly when it holds the Run" }
12479
+ ),
12479
12480
  z.object({
12480
12481
  type: z.literal("result"),
12481
12482
  run: runSchema,
@@ -13406,10 +13407,10 @@ function reduceRun(prev, token, event) {
13406
13407
  const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
13407
13408
  const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
13408
13409
  const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
13409
- if (event.type === "gate" && event.resolution.mode === "awaiting_approval") {
13410
+ if (event.type === "gate" && event.changeRequest !== null) {
13410
13411
  return {
13411
13412
  token,
13412
- outcome: { kind: "awaiting-approval", changeRequestId: event.changeRequest?.id ?? "" },
13413
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
13413
13414
  lastLog,
13414
13415
  submitted,
13415
13416
  phases: closePhases(phases)
@@ -14090,4 +14091,4 @@ export {
14090
14091
  AutosaveEndedError,
14091
14092
  autosave
14092
14093
  };
14093
- //# sourceMappingURL=chunk-WNBCPSQJ.mjs.map
14094
+ //# sourceMappingURL=chunk-GV2FO3E2.mjs.map