@rivetkit/workflow-engine 2.3.0-rc.10 → 2.3.0-rc.11
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.
- package/dist/tsup/{chunk-CIDHCIH7.js → chunk-DFNXCZ47.js} +13 -22
- package/dist/tsup/chunk-DFNXCZ47.js.map +1 -0
- package/dist/tsup/{chunk-SFJQFMCW.cjs → chunk-U2W3KHJC.cjs} +13 -22
- package/dist/tsup/chunk-U2W3KHJC.cjs.map +1 -0
- package/dist/tsup/index.cjs +2 -2
- package/dist/tsup/index.d.cts +11 -7
- package/dist/tsup/index.d.ts +11 -7
- package/dist/tsup/index.js +1 -1
- package/dist/tsup/testing.cjs +23 -23
- package/dist/tsup/testing.js +1 -1
- package/package.json +1 -1
- package/schemas/serde.ts +1 -3
- package/src/context.ts +21 -30
- package/src/index.ts +8 -8
- package/src/location.ts +1 -1
- package/src/types.ts +3 -1
- package/dist/tsup/chunk-CIDHCIH7.js.map +0 -1
- package/dist/tsup/chunk-SFJQFMCW.cjs.map +0 -1
|
@@ -1963,7 +1963,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
1963
1963
|
* Throws HistoryDivergedError if duplicate detected.
|
|
1964
1964
|
*/
|
|
1965
1965
|
checkDuplicateName(name) {
|
|
1966
|
-
const fullKey = locationToKey(this.storage, this.currentLocation)
|
|
1966
|
+
const fullKey = `${locationToKey(this.storage, this.currentLocation)}/${name}`;
|
|
1967
1967
|
if (this.usedNamesInExecution.has(fullKey)) {
|
|
1968
1968
|
throw new HistoryDivergedError(
|
|
1969
1969
|
`Duplicate entry name "${name}" at location "${locationToKey(this.storage, this.currentLocation)}". Each step/loop/sleep/queue.next/join/race must have a unique name within its scope.`
|
|
@@ -2017,7 +2017,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2017
2017
|
validateComplete() {
|
|
2018
2018
|
const prefix = locationToKey(this.storage, this.currentLocation);
|
|
2019
2019
|
for (const key of this.storage.history.entries.keys()) {
|
|
2020
|
-
const isUnderPrefix = prefix === "" ? true : key.startsWith(prefix
|
|
2020
|
+
const isUnderPrefix = prefix === "" ? true : key.startsWith(`${prefix}/`) || key === prefix;
|
|
2021
2021
|
if (isUnderPrefix) {
|
|
2022
2022
|
if (!this.visitedKeys.has(key)) {
|
|
2023
2023
|
throw new HistoryDivergedError(
|
|
@@ -2201,7 +2201,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2201
2201
|
}
|
|
2202
2202
|
const maxRetries2 = config2.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
2203
2203
|
if (metadata2.attempts > maxRetries2) {
|
|
2204
|
-
const lastError =
|
|
2204
|
+
const lastError = metadata2.error;
|
|
2205
2205
|
const exhaustedError = new StepExhaustedError(
|
|
2206
2206
|
config2.name,
|
|
2207
2207
|
lastError
|
|
@@ -2290,14 +2290,13 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2290
2290
|
});
|
|
2291
2291
|
return output;
|
|
2292
2292
|
} catch (error) {
|
|
2293
|
-
if (
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2293
|
+
if (entry.kind.type === "step") {
|
|
2294
|
+
entry.kind.data.error = String(error);
|
|
2295
|
+
}
|
|
2296
|
+
entry.dirty = true;
|
|
2297
|
+
if (error instanceof StepTimeoutError && !config2.retryOnTimeout) {
|
|
2298
2298
|
metadata.status = "exhausted";
|
|
2299
2299
|
metadata.error = String(error);
|
|
2300
|
-
await this.flushStorage();
|
|
2301
2300
|
await this.notifyStepError(config2, metadata.attempts, error, {
|
|
2302
2301
|
willRetry: false
|
|
2303
2302
|
});
|
|
@@ -2311,13 +2310,8 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2311
2310
|
);
|
|
2312
2311
|
}
|
|
2313
2312
|
if (error instanceof CriticalError || error instanceof RollbackError) {
|
|
2314
|
-
if (entry.kind.type === "step") {
|
|
2315
|
-
entry.kind.data.error = String(error);
|
|
2316
|
-
}
|
|
2317
|
-
entry.dirty = true;
|
|
2318
2313
|
metadata.status = "exhausted";
|
|
2319
2314
|
metadata.error = String(error);
|
|
2320
|
-
await this.flushStorage();
|
|
2321
2315
|
await this.notifyStepError(config2, metadata.attempts, error, {
|
|
2322
2316
|
willRetry: false
|
|
2323
2317
|
});
|
|
@@ -2330,14 +2324,9 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2330
2324
|
})
|
|
2331
2325
|
);
|
|
2332
2326
|
}
|
|
2333
|
-
if (entry.kind.type === "step") {
|
|
2334
|
-
entry.kind.data.error = String(error);
|
|
2335
|
-
}
|
|
2336
|
-
entry.dirty = true;
|
|
2337
2327
|
const willRetry = metadata.attempts <= maxRetries;
|
|
2338
2328
|
metadata.status = willRetry ? "failed" : "exhausted";
|
|
2339
2329
|
metadata.error = String(error);
|
|
2340
|
-
await this.flushStorage();
|
|
2341
2330
|
if (willRetry) {
|
|
2342
2331
|
const retryDelay = calculateBackoff(
|
|
2343
2332
|
metadata.attempts,
|
|
@@ -2361,7 +2350,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2361
2350
|
attachTryStepFailure(
|
|
2362
2351
|
new StepExhaustedError(config2.name, String(error)),
|
|
2363
2352
|
{
|
|
2364
|
-
kind: "exhausted",
|
|
2353
|
+
kind: error instanceof StepTimeoutError ? "timeout" : "exhausted",
|
|
2365
2354
|
stepName: config2.name,
|
|
2366
2355
|
attempts: metadata.attempts,
|
|
2367
2356
|
error: extractErrorInfo(error)
|
|
@@ -2379,7 +2368,9 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2379
2368
|
*
|
|
2380
2369
|
* Note: This does NOT cancel the underlying operation. JavaScript Promises
|
|
2381
2370
|
* cannot be cancelled once started. When a timeout occurs:
|
|
2382
|
-
* - The step is
|
|
2371
|
+
* - The step is rejected with StepTimeoutError. By default this is treated
|
|
2372
|
+
* as a critical failure with no retry. Set retryOnTimeout: true on the
|
|
2373
|
+
* step config to retry timeouts like any other error.
|
|
2383
2374
|
* - The underlying async operation continues running in the background
|
|
2384
2375
|
* - Any side effects from the operation may still occur
|
|
2385
2376
|
*
|
|
@@ -4210,4 +4201,4 @@ export {
|
|
|
4210
4201
|
runWorkflow,
|
|
4211
4202
|
replayWorkflowFromStep
|
|
4212
4203
|
};
|
|
4213
|
-
//# sourceMappingURL=chunk-
|
|
4204
|
+
//# sourceMappingURL=chunk-DFNXCZ47.js.map
|