@aikirun/workflow 0.13.0 → 0.14.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.
- package/dist/index.js +9 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -548,15 +548,15 @@ var WorkflowRunHandleImpl = class {
|
|
|
548
548
|
await this.refresh();
|
|
549
549
|
return this.run.state;
|
|
550
550
|
};
|
|
551
|
-
const isNeitherExpectedNorTerminal = (state) =>
|
|
551
|
+
const isNeitherExpectedNorTerminal = (state) => state.status !== expectedStatus && !isTerminalWorkflowRunStatus(state.status);
|
|
552
552
|
if (!Number.isFinite(maxAttempts) && !options?.abortSignal) {
|
|
553
553
|
const maybeResult2 = await withRetry(loadState, retryStrategy, {
|
|
554
|
-
shouldRetryOnResult: isNeitherExpectedNorTerminal
|
|
554
|
+
shouldRetryOnResult: async (state) => isNeitherExpectedNorTerminal(state)
|
|
555
555
|
}).run();
|
|
556
556
|
if (maybeResult2.state === "timeout") {
|
|
557
557
|
throw new Error("Something's wrong, this should've never timed out");
|
|
558
558
|
}
|
|
559
|
-
if (
|
|
559
|
+
if (maybeResult2.result.status !== expectedStatus) {
|
|
560
560
|
return {
|
|
561
561
|
success: false,
|
|
562
562
|
cause: "run_terminated"
|
|
@@ -569,10 +569,13 @@ var WorkflowRunHandleImpl = class {
|
|
|
569
569
|
}
|
|
570
570
|
const maybeResult = options?.abortSignal ? await withRetry(loadState, retryStrategy, {
|
|
571
571
|
abortSignal: options.abortSignal,
|
|
572
|
-
shouldRetryOnResult: isNeitherExpectedNorTerminal
|
|
573
|
-
}).run() : await withRetry(loadState, retryStrategy, {
|
|
572
|
+
shouldRetryOnResult: async (state) => isNeitherExpectedNorTerminal(state)
|
|
573
|
+
}).run() : await withRetry(loadState, retryStrategy, {
|
|
574
|
+
shouldRetryOnResult: async (state) => isNeitherExpectedNorTerminal(state)
|
|
575
|
+
}).run();
|
|
576
|
+
this.logger.info("Maybe result", { maybeResult });
|
|
574
577
|
if (maybeResult.state === "completed") {
|
|
575
|
-
if (
|
|
578
|
+
if (maybeResult.result.status !== expectedStatus) {
|
|
576
579
|
return {
|
|
577
580
|
success: false,
|
|
578
581
|
cause: "run_terminated"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aikirun/workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Workflow SDK for Aiki - define durable workflows with tasks, sleeps, waits, and event handling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "tsup"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@aikirun/types": "0.
|
|
21
|
+
"@aikirun/types": "0.14.0",
|
|
22
22
|
"@standard-schema/spec": "^1.1.0"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|