@protobase/workflows 0.80.0 → 0.81.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.
@@ -15,6 +15,7 @@ const runSegment = async ({ runId, definition, input, startedAt, secrets, redact
15
15
  const steps = [];
16
16
  let superseded = false;
17
17
  let kept = /* @__PURE__ */ new Map();
18
+ let keeping = Promise.resolve();
18
19
  const write = async () => {
19
20
  const checkpoints = [...kept.values()].map((checkpoint) => ({
20
21
  ...checkpoint,
@@ -23,7 +24,11 @@ const runSegment = async ({ runId, definition, input, startedAt, secrets, redact
23
24
  kept = /* @__PURE__ */ new Map();
24
25
  if (checkpoints.length === 0) return;
25
26
  const ran = steps.splice(0);
26
- if (ran.length > 0) await keep(ran);
27
+ if (ran.length > 0) {
28
+ const handed = keeping.then(() => keep(ran));
29
+ keeping = handed.catch(() => {});
30
+ await handed;
31
+ }
27
32
  if (await save(checkpoints)) {
28
33
  for (const checkpoint of checkpoints) after.set(checkpoint.scope, checkpoint.seq);
29
34
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/workflows",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "description": "Workflows as state machines with JSONata expressions: their check, a runner that saves only what a run needs to go on and traces every step, and the plugin interface for trigger and step types.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {