@gaganref/confect-alchemy 10.6.0-fork.26 → 10.6.0-fork.28

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.
@@ -38,6 +38,26 @@ export const checkpointCreate = Effect.fn("Lifecycle.checkpointCreate")(
38
38
  },
39
39
  );
40
40
 
41
+ export const checkpointUpdate = Effect.fn("Lifecycle.checkpointUpdate")(
42
+ function* (fqn: string, instanceId: string, output: object) {
43
+ const stack = yield* Effect.serviceOption(Stack);
44
+ if (Option.isNone(stack)) return;
45
+ const state = yield* Effect.serviceOption(State);
46
+ if (Option.isNone(state)) return yield* LifecycleStateError.make({ fqn });
47
+ const store = yield* state.value;
48
+ const key = { stack: stack.value.name, stage: stack.value.stage, fqn };
49
+ const row = yield* store.get(key);
50
+ if (
51
+ row === undefined ||
52
+ row.kind === "action" ||
53
+ row.instanceId !== instanceId
54
+ )
55
+ return yield* LifecycleStateError.make({ fqn });
56
+ if (row.status !== "updating") return;
57
+ yield* store.set({ ...key, value: { ...row, attr: output } });
58
+ },
59
+ );
60
+
41
61
  export const shouldAdopt = Effect.fn("Lifecycle.shouldAdopt")(function* (
42
62
  fqn: string,
43
63
  ) {