@rivetkit/workflow-engine 0.0.0-05-09-fix-workflow-engine-only-commit-step-state-after-success.cc1baa6 → 0.0.0-counter-latency-serverless-docs.cb4ffa1

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.
@@ -43,7 +43,7 @@
43
43
 
44
44
 
45
45
 
46
- var _chunkAS7T5GPLcjs = require('./chunk-AS7T5GPL.cjs');
46
+ var _chunkSFJQFMCWcjs = require('./chunk-SFJQFMCW.cjs');
47
47
 
48
48
 
49
49
 
@@ -89,5 +89,5 @@ var _chunkAS7T5GPLcjs = require('./chunk-AS7T5GPL.cjs');
89
89
 
90
90
 
91
91
 
92
- exports.CancelledError = _chunkAS7T5GPLcjs.CancelledError; exports.CriticalError = _chunkAS7T5GPLcjs.CriticalError; exports.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL = _chunkAS7T5GPLcjs.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL; exports.DEFAULT_MAX_RETRIES = _chunkAS7T5GPLcjs.DEFAULT_MAX_RETRIES; exports.DEFAULT_RETRY_BACKOFF_BASE = _chunkAS7T5GPLcjs.DEFAULT_RETRY_BACKOFF_BASE; exports.DEFAULT_RETRY_BACKOFF_MAX = _chunkAS7T5GPLcjs.DEFAULT_RETRY_BACKOFF_MAX; exports.DEFAULT_STEP_TIMEOUT = _chunkAS7T5GPLcjs.DEFAULT_STEP_TIMEOUT; exports.EntryInProgressError = _chunkAS7T5GPLcjs.EntryInProgressError; exports.EvictedError = _chunkAS7T5GPLcjs.EvictedError; exports.HistoryDivergedError = _chunkAS7T5GPLcjs.HistoryDivergedError; exports.JoinError = _chunkAS7T5GPLcjs.JoinError; exports.Loop = _chunkAS7T5GPLcjs.Loop; exports.MessageWaitError = _chunkAS7T5GPLcjs.MessageWaitError; exports.RaceError = _chunkAS7T5GPLcjs.RaceError; exports.RollbackCheckpointError = _chunkAS7T5GPLcjs.RollbackCheckpointError; exports.RollbackError = _chunkAS7T5GPLcjs.RollbackError; exports.SleepError = _chunkAS7T5GPLcjs.SleepError; exports.StepExhaustedError = _chunkAS7T5GPLcjs.StepExhaustedError; exports.StepFailedError = _chunkAS7T5GPLcjs.StepFailedError; exports.WorkflowContextImpl = _chunkAS7T5GPLcjs.WorkflowContextImpl; exports.appendLoopIteration = _chunkAS7T5GPLcjs.appendLoopIteration; exports.appendName = _chunkAS7T5GPLcjs.appendName; exports.createEntry = _chunkAS7T5GPLcjs.createEntry; exports.createHistorySnapshot = _chunkAS7T5GPLcjs.createHistorySnapshot; exports.createStorage = _chunkAS7T5GPLcjs.createStorage; exports.deleteEntriesWithPrefix = _chunkAS7T5GPLcjs.deleteEntriesWithPrefix; exports.emptyLocation = _chunkAS7T5GPLcjs.emptyLocation; exports.extractErrorInfo = _chunkAS7T5GPLcjs.extractErrorInfo; exports.flush = _chunkAS7T5GPLcjs.flush; exports.generateId = _chunkAS7T5GPLcjs.generateId; exports.getEntry = _chunkAS7T5GPLcjs.getEntry; exports.getOrCreateMetadata = _chunkAS7T5GPLcjs.getOrCreateMetadata; exports.isLocationPrefix = _chunkAS7T5GPLcjs.isLocationPrefix; exports.isLoopIterationMarker = _chunkAS7T5GPLcjs.isLoopIterationMarker; exports.loadMetadata = _chunkAS7T5GPLcjs.loadMetadata; exports.loadStorage = _chunkAS7T5GPLcjs.loadStorage; exports.locationToKey = _chunkAS7T5GPLcjs.locationToKey; exports.locationsEqual = _chunkAS7T5GPLcjs.locationsEqual; exports.parentLocation = _chunkAS7T5GPLcjs.parentLocation; exports.registerName = _chunkAS7T5GPLcjs.registerName; exports.replayWorkflowFromStep = _chunkAS7T5GPLcjs.replayWorkflowFromStep; exports.resolveName = _chunkAS7T5GPLcjs.resolveName; exports.runWorkflow = _chunkAS7T5GPLcjs.runWorkflow; exports.setEntry = _chunkAS7T5GPLcjs.setEntry;
92
+ exports.CancelledError = _chunkSFJQFMCWcjs.CancelledError; exports.CriticalError = _chunkSFJQFMCWcjs.CriticalError; exports.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL = _chunkSFJQFMCWcjs.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL; exports.DEFAULT_MAX_RETRIES = _chunkSFJQFMCWcjs.DEFAULT_MAX_RETRIES; exports.DEFAULT_RETRY_BACKOFF_BASE = _chunkSFJQFMCWcjs.DEFAULT_RETRY_BACKOFF_BASE; exports.DEFAULT_RETRY_BACKOFF_MAX = _chunkSFJQFMCWcjs.DEFAULT_RETRY_BACKOFF_MAX; exports.DEFAULT_STEP_TIMEOUT = _chunkSFJQFMCWcjs.DEFAULT_STEP_TIMEOUT; exports.EntryInProgressError = _chunkSFJQFMCWcjs.EntryInProgressError; exports.EvictedError = _chunkSFJQFMCWcjs.EvictedError; exports.HistoryDivergedError = _chunkSFJQFMCWcjs.HistoryDivergedError; exports.JoinError = _chunkSFJQFMCWcjs.JoinError; exports.Loop = _chunkSFJQFMCWcjs.Loop; exports.MessageWaitError = _chunkSFJQFMCWcjs.MessageWaitError; exports.RaceError = _chunkSFJQFMCWcjs.RaceError; exports.RollbackCheckpointError = _chunkSFJQFMCWcjs.RollbackCheckpointError; exports.RollbackError = _chunkSFJQFMCWcjs.RollbackError; exports.SleepError = _chunkSFJQFMCWcjs.SleepError; exports.StepExhaustedError = _chunkSFJQFMCWcjs.StepExhaustedError; exports.StepFailedError = _chunkSFJQFMCWcjs.StepFailedError; exports.WorkflowContextImpl = _chunkSFJQFMCWcjs.WorkflowContextImpl; exports.appendLoopIteration = _chunkSFJQFMCWcjs.appendLoopIteration; exports.appendName = _chunkSFJQFMCWcjs.appendName; exports.createEntry = _chunkSFJQFMCWcjs.createEntry; exports.createHistorySnapshot = _chunkSFJQFMCWcjs.createHistorySnapshot; exports.createStorage = _chunkSFJQFMCWcjs.createStorage; exports.deleteEntriesWithPrefix = _chunkSFJQFMCWcjs.deleteEntriesWithPrefix; exports.emptyLocation = _chunkSFJQFMCWcjs.emptyLocation; exports.extractErrorInfo = _chunkSFJQFMCWcjs.extractErrorInfo; exports.flush = _chunkSFJQFMCWcjs.flush; exports.generateId = _chunkSFJQFMCWcjs.generateId; exports.getEntry = _chunkSFJQFMCWcjs.getEntry; exports.getOrCreateMetadata = _chunkSFJQFMCWcjs.getOrCreateMetadata; exports.isLocationPrefix = _chunkSFJQFMCWcjs.isLocationPrefix; exports.isLoopIterationMarker = _chunkSFJQFMCWcjs.isLoopIterationMarker; exports.loadMetadata = _chunkSFJQFMCWcjs.loadMetadata; exports.loadStorage = _chunkSFJQFMCWcjs.loadStorage; exports.locationToKey = _chunkSFJQFMCWcjs.locationToKey; exports.locationsEqual = _chunkSFJQFMCWcjs.locationsEqual; exports.parentLocation = _chunkSFJQFMCWcjs.parentLocation; exports.registerName = _chunkSFJQFMCWcjs.registerName; exports.replayWorkflowFromStep = _chunkSFJQFMCWcjs.replayWorkflowFromStep; exports.resolveName = _chunkSFJQFMCWcjs.resolveName; exports.runWorkflow = _chunkSFJQFMCWcjs.runWorkflow; exports.setEntry = _chunkSFJQFMCWcjs.setEntry;
93
93
  //# sourceMappingURL=index.cjs.map
@@ -43,7 +43,7 @@ import {
43
43
  resolveName,
44
44
  runWorkflow,
45
45
  setEntry
46
- } from "./chunk-ODIFRE72.js";
46
+ } from "./chunk-CIDHCIH7.js";
47
47
  export {
48
48
  CancelledError,
49
49
  CriticalError,
@@ -47,7 +47,7 @@
47
47
 
48
48
 
49
49
 
50
- var _chunkAS7T5GPLcjs = require('./chunk-AS7T5GPL.cjs');
50
+ var _chunkSFJQFMCWcjs = require('./chunk-SFJQFMCW.cjs');
51
51
 
52
52
  // src/testing.ts
53
53
  var InMemoryWorkflowMessageDriver = class {
@@ -97,7 +97,7 @@ var InMemoryWorkflowMessageDriver = class {
97
97
  }
98
98
  async waitForMessages(messageNames, abortSignal) {
99
99
  if (abortSignal.aborted) {
100
- throw new (0, _chunkAS7T5GPLcjs.EvictedError)();
100
+ throw new (0, _chunkSFJQFMCWcjs.EvictedError)();
101
101
  }
102
102
  const nameSet = messageNames.length > 0 ? new Set(messageNames) : void 0;
103
103
  if (this.#messages.some(
@@ -118,7 +118,7 @@ var InMemoryWorkflowMessageDriver = class {
118
118
  },
119
119
  abortSignal,
120
120
  onAbort: () => {
121
- waiter.reject(new (0, _chunkAS7T5GPLcjs.EvictedError)());
121
+ waiter.reject(new (0, _chunkSFJQFMCWcjs.EvictedError)());
122
122
  }
123
123
  };
124
124
  abortSignal.addEventListener("abort", waiter.onAbort, {
@@ -158,56 +158,56 @@ var InMemoryDriver = (_class = class {constructor() { _class.prototype.__init.ca
158
158
  __init4() {this.workerPollInterval = 100}
159
159
  __init5() {this.messageDriver = this.#inMemoryMessageDriver}
160
160
  async get(key) {
161
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
162
- const entry = this.kv.get(_chunkAS7T5GPLcjs.keyToHex.call(void 0, key));
161
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
162
+ const entry = this.kv.get(_chunkSFJQFMCWcjs.keyToHex.call(void 0, key));
163
163
  return _nullishCoalesce((entry == null ? void 0 : entry.value), () => ( null));
164
164
  }
165
165
  async set(key, value) {
166
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
167
- this.kv.set(_chunkAS7T5GPLcjs.keyToHex.call(void 0, key), { key, value });
166
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
167
+ this.kv.set(_chunkSFJQFMCWcjs.keyToHex.call(void 0, key), { key, value });
168
168
  }
169
169
  async delete(key) {
170
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
171
- this.kv.delete(_chunkAS7T5GPLcjs.keyToHex.call(void 0, key));
170
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
171
+ this.kv.delete(_chunkSFJQFMCWcjs.keyToHex.call(void 0, key));
172
172
  }
173
173
  async deletePrefix(prefix) {
174
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
174
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
175
175
  for (const [hexKey, entry] of this.kv) {
176
- if (_chunkAS7T5GPLcjs.keyStartsWith.call(void 0, entry.key, prefix)) {
176
+ if (_chunkSFJQFMCWcjs.keyStartsWith.call(void 0, entry.key, prefix)) {
177
177
  this.kv.delete(hexKey);
178
178
  }
179
179
  }
180
180
  }
181
181
  async deleteRange(start, end) {
182
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
182
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
183
183
  for (const [hexKey, entry] of this.kv) {
184
- if (_chunkAS7T5GPLcjs.compareKeys.call(void 0, entry.key, start) >= 0 && _chunkAS7T5GPLcjs.compareKeys.call(void 0, entry.key, end) < 0) {
184
+ if (_chunkSFJQFMCWcjs.compareKeys.call(void 0, entry.key, start) >= 0 && _chunkSFJQFMCWcjs.compareKeys.call(void 0, entry.key, end) < 0) {
185
185
  this.kv.delete(hexKey);
186
186
  }
187
187
  }
188
188
  }
189
189
  async list(prefix) {
190
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
190
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
191
191
  const results = [];
192
192
  for (const entry of this.kv.values()) {
193
- if (_chunkAS7T5GPLcjs.keyStartsWith.call(void 0, entry.key, prefix)) {
193
+ if (_chunkSFJQFMCWcjs.keyStartsWith.call(void 0, entry.key, prefix)) {
194
194
  results.push({ key: entry.key, value: entry.value });
195
195
  }
196
196
  }
197
- return results.sort((a, b) => _chunkAS7T5GPLcjs.compareKeys.call(void 0, a.key, b.key));
197
+ return results.sort((a, b) => _chunkSFJQFMCWcjs.compareKeys.call(void 0, a.key, b.key));
198
198
  }
199
199
  async batch(writes) {
200
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
200
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
201
201
  for (const { key, value } of writes) {
202
- this.kv.set(_chunkAS7T5GPLcjs.keyToHex.call(void 0, key), { key, value });
202
+ this.kv.set(_chunkSFJQFMCWcjs.keyToHex.call(void 0, key), { key, value });
203
203
  }
204
204
  }
205
205
  async setAlarm(workflowId, wakeAt) {
206
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
206
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
207
207
  this.alarms.set(workflowId, wakeAt);
208
208
  }
209
209
  async clearAlarm(workflowId) {
210
- await _chunkAS7T5GPLcjs.sleep.call(void 0, this.latency);
210
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, this.latency);
211
211
  this.alarms.delete(workflowId);
212
212
  }
213
213
  async waitForMessages(messageNames, abortSignal) {
@@ -218,7 +218,7 @@ var InMemoryDriver = (_class = class {constructor() { _class.prototype.__init.ca
218
218
  }
219
219
  while (true) {
220
220
  if (abortSignal.aborted) {
221
- throw new (0, _chunkAS7T5GPLcjs.EvictedError)();
221
+ throw new (0, _chunkSFJQFMCWcjs.EvictedError)();
222
222
  }
223
223
  const messages = await this.messageDriver.receiveMessages({
224
224
  names: messageNames.length > 0 ? messageNames : void 0,
@@ -228,7 +228,7 @@ var InMemoryDriver = (_class = class {constructor() { _class.prototype.__init.ca
228
228
  if (messages.length > 0) {
229
229
  return;
230
230
  }
231
- await _chunkAS7T5GPLcjs.sleep.call(void 0, Math.max(1, this.latency));
231
+ await _chunkSFJQFMCWcjs.sleep.call(void 0, Math.max(1, this.latency));
232
232
  }
233
233
  }
234
234
  /**
@@ -324,5 +324,5 @@ var InMemoryDriver = (_class = class {constructor() { _class.prototype.__init.ca
324
324
 
325
325
 
326
326
 
327
- exports.CancelledError = _chunkAS7T5GPLcjs.CancelledError; exports.CriticalError = _chunkAS7T5GPLcjs.CriticalError; exports.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL = _chunkAS7T5GPLcjs.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL; exports.DEFAULT_MAX_RETRIES = _chunkAS7T5GPLcjs.DEFAULT_MAX_RETRIES; exports.DEFAULT_RETRY_BACKOFF_BASE = _chunkAS7T5GPLcjs.DEFAULT_RETRY_BACKOFF_BASE; exports.DEFAULT_RETRY_BACKOFF_MAX = _chunkAS7T5GPLcjs.DEFAULT_RETRY_BACKOFF_MAX; exports.DEFAULT_STEP_TIMEOUT = _chunkAS7T5GPLcjs.DEFAULT_STEP_TIMEOUT; exports.EntryInProgressError = _chunkAS7T5GPLcjs.EntryInProgressError; exports.EvictedError = _chunkAS7T5GPLcjs.EvictedError; exports.HistoryDivergedError = _chunkAS7T5GPLcjs.HistoryDivergedError; exports.InMemoryDriver = InMemoryDriver; exports.JoinError = _chunkAS7T5GPLcjs.JoinError; exports.Loop = _chunkAS7T5GPLcjs.Loop; exports.MessageWaitError = _chunkAS7T5GPLcjs.MessageWaitError; exports.RaceError = _chunkAS7T5GPLcjs.RaceError; exports.RollbackCheckpointError = _chunkAS7T5GPLcjs.RollbackCheckpointError; exports.RollbackError = _chunkAS7T5GPLcjs.RollbackError; exports.SleepError = _chunkAS7T5GPLcjs.SleepError; exports.StepExhaustedError = _chunkAS7T5GPLcjs.StepExhaustedError; exports.StepFailedError = _chunkAS7T5GPLcjs.StepFailedError; exports.WorkflowContextImpl = _chunkAS7T5GPLcjs.WorkflowContextImpl; exports.appendLoopIteration = _chunkAS7T5GPLcjs.appendLoopIteration; exports.appendName = _chunkAS7T5GPLcjs.appendName; exports.createEntry = _chunkAS7T5GPLcjs.createEntry; exports.createHistorySnapshot = _chunkAS7T5GPLcjs.createHistorySnapshot; exports.createStorage = _chunkAS7T5GPLcjs.createStorage; exports.deleteEntriesWithPrefix = _chunkAS7T5GPLcjs.deleteEntriesWithPrefix; exports.emptyLocation = _chunkAS7T5GPLcjs.emptyLocation; exports.extractErrorInfo = _chunkAS7T5GPLcjs.extractErrorInfo; exports.flush = _chunkAS7T5GPLcjs.flush; exports.generateId = _chunkAS7T5GPLcjs.generateId; exports.getEntry = _chunkAS7T5GPLcjs.getEntry; exports.getOrCreateMetadata = _chunkAS7T5GPLcjs.getOrCreateMetadata; exports.isLocationPrefix = _chunkAS7T5GPLcjs.isLocationPrefix; exports.isLoopIterationMarker = _chunkAS7T5GPLcjs.isLoopIterationMarker; exports.loadMetadata = _chunkAS7T5GPLcjs.loadMetadata; exports.loadStorage = _chunkAS7T5GPLcjs.loadStorage; exports.locationToKey = _chunkAS7T5GPLcjs.locationToKey; exports.locationsEqual = _chunkAS7T5GPLcjs.locationsEqual; exports.parentLocation = _chunkAS7T5GPLcjs.parentLocation; exports.registerName = _chunkAS7T5GPLcjs.registerName; exports.replayWorkflowFromStep = _chunkAS7T5GPLcjs.replayWorkflowFromStep; exports.resolveName = _chunkAS7T5GPLcjs.resolveName; exports.runWorkflow = _chunkAS7T5GPLcjs.runWorkflow; exports.setEntry = _chunkAS7T5GPLcjs.setEntry;
327
+ exports.CancelledError = _chunkSFJQFMCWcjs.CancelledError; exports.CriticalError = _chunkSFJQFMCWcjs.CriticalError; exports.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL = _chunkSFJQFMCWcjs.DEFAULT_LOOP_HISTORY_PRUNE_INTERVAL; exports.DEFAULT_MAX_RETRIES = _chunkSFJQFMCWcjs.DEFAULT_MAX_RETRIES; exports.DEFAULT_RETRY_BACKOFF_BASE = _chunkSFJQFMCWcjs.DEFAULT_RETRY_BACKOFF_BASE; exports.DEFAULT_RETRY_BACKOFF_MAX = _chunkSFJQFMCWcjs.DEFAULT_RETRY_BACKOFF_MAX; exports.DEFAULT_STEP_TIMEOUT = _chunkSFJQFMCWcjs.DEFAULT_STEP_TIMEOUT; exports.EntryInProgressError = _chunkSFJQFMCWcjs.EntryInProgressError; exports.EvictedError = _chunkSFJQFMCWcjs.EvictedError; exports.HistoryDivergedError = _chunkSFJQFMCWcjs.HistoryDivergedError; exports.InMemoryDriver = InMemoryDriver; exports.JoinError = _chunkSFJQFMCWcjs.JoinError; exports.Loop = _chunkSFJQFMCWcjs.Loop; exports.MessageWaitError = _chunkSFJQFMCWcjs.MessageWaitError; exports.RaceError = _chunkSFJQFMCWcjs.RaceError; exports.RollbackCheckpointError = _chunkSFJQFMCWcjs.RollbackCheckpointError; exports.RollbackError = _chunkSFJQFMCWcjs.RollbackError; exports.SleepError = _chunkSFJQFMCWcjs.SleepError; exports.StepExhaustedError = _chunkSFJQFMCWcjs.StepExhaustedError; exports.StepFailedError = _chunkSFJQFMCWcjs.StepFailedError; exports.WorkflowContextImpl = _chunkSFJQFMCWcjs.WorkflowContextImpl; exports.appendLoopIteration = _chunkSFJQFMCWcjs.appendLoopIteration; exports.appendName = _chunkSFJQFMCWcjs.appendName; exports.createEntry = _chunkSFJQFMCWcjs.createEntry; exports.createHistorySnapshot = _chunkSFJQFMCWcjs.createHistorySnapshot; exports.createStorage = _chunkSFJQFMCWcjs.createStorage; exports.deleteEntriesWithPrefix = _chunkSFJQFMCWcjs.deleteEntriesWithPrefix; exports.emptyLocation = _chunkSFJQFMCWcjs.emptyLocation; exports.extractErrorInfo = _chunkSFJQFMCWcjs.extractErrorInfo; exports.flush = _chunkSFJQFMCWcjs.flush; exports.generateId = _chunkSFJQFMCWcjs.generateId; exports.getEntry = _chunkSFJQFMCWcjs.getEntry; exports.getOrCreateMetadata = _chunkSFJQFMCWcjs.getOrCreateMetadata; exports.isLocationPrefix = _chunkSFJQFMCWcjs.isLocationPrefix; exports.isLoopIterationMarker = _chunkSFJQFMCWcjs.isLoopIterationMarker; exports.loadMetadata = _chunkSFJQFMCWcjs.loadMetadata; exports.loadStorage = _chunkSFJQFMCWcjs.loadStorage; exports.locationToKey = _chunkSFJQFMCWcjs.locationToKey; exports.locationsEqual = _chunkSFJQFMCWcjs.locationsEqual; exports.parentLocation = _chunkSFJQFMCWcjs.parentLocation; exports.registerName = _chunkSFJQFMCWcjs.registerName; exports.replayWorkflowFromStep = _chunkSFJQFMCWcjs.replayWorkflowFromStep; exports.resolveName = _chunkSFJQFMCWcjs.resolveName; exports.runWorkflow = _chunkSFJQFMCWcjs.runWorkflow; exports.setEntry = _chunkSFJQFMCWcjs.setEntry;
328
328
  //# sourceMappingURL=testing.cjs.map
@@ -47,7 +47,7 @@ import {
47
47
  runWorkflow,
48
48
  setEntry,
49
49
  sleep
50
- } from "./chunk-ODIFRE72.js";
50
+ } from "./chunk-CIDHCIH7.js";
51
51
 
52
52
  // src/testing.ts
53
53
  var InMemoryWorkflowMessageDriver = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/workflow-engine",
3
- "version": "0.0.0-05-09-fix-workflow-engine-only-commit-step-state-after-success.cc1baa6",
3
+ "version": "0.0.0-counter-latency-serverless-docs.cb4ffa1",
4
4
  "description": "Durable workflow engine with reentrant execution",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
package/src/context.ts CHANGED
@@ -943,8 +943,13 @@ export class WorkflowContextImpl implements WorkflowContextInterface {
943
943
  } catch (error) {
944
944
  // Timeout errors are treated as critical (no retry)
945
945
  if (error instanceof StepTimeoutError) {
946
+ if (entry.kind.type === "step") {
947
+ entry.kind.data.error = String(error);
948
+ }
949
+ entry.dirty = true;
946
950
  metadata.status = "exhausted";
947
951
  metadata.error = String(error);
952
+ await this.flushStorage();
948
953
  await this.notifyStepError(config, metadata.attempts, error, {
949
954
  willRetry: false,
950
955
  });
@@ -962,8 +967,13 @@ export class WorkflowContextImpl implements WorkflowContextInterface {
962
967
  error instanceof CriticalError ||
963
968
  error instanceof RollbackError
964
969
  ) {
970
+ if (entry.kind.type === "step") {
971
+ entry.kind.data.error = String(error);
972
+ }
973
+ entry.dirty = true;
965
974
  metadata.status = "exhausted";
966
975
  metadata.error = String(error);
976
+ await this.flushStorage();
967
977
  await this.notifyStepError(config, metadata.attempts, error, {
968
978
  willRetry: false,
969
979
  });
@@ -980,10 +990,15 @@ export class WorkflowContextImpl implements WorkflowContextInterface {
980
990
  );
981
991
  }
982
992
 
993
+ if (entry.kind.type === "step") {
994
+ entry.kind.data.error = String(error);
995
+ }
996
+ entry.dirty = true;
983
997
  const willRetry = metadata.attempts <= maxRetries;
984
998
  metadata.status = willRetry ? "failed" : "exhausted";
985
999
  metadata.error = String(error);
986
1000
 
1001
+ await this.flushStorage();
987
1002
  if (willRetry) {
988
1003
  const retryDelay = calculateBackoff(
989
1004
  metadata.attempts,