@atolis-hq/wake 0.3.22 → 0.3.23
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.
|
@@ -5,14 +5,17 @@ import { ActivityActivationStatus, WorkflowStatus } from '../contracts/vocabular
|
|
|
5
5
|
import { activation, nextOrdinal, stateDraft } from './decision-events.js';
|
|
6
6
|
export function isOperatorRetryEligible(view) {
|
|
7
7
|
const pending = view.pendingActivation;
|
|
8
|
-
|
|
9
|
-
view.blockReason === 'unconfigured outcome failed' &&
|
|
8
|
+
const eligibleActivation = view.status === WorkflowStatus.Blocked &&
|
|
10
9
|
pending !== undefined &&
|
|
11
10
|
pending.status === ActivityActivationStatus.Completed &&
|
|
12
11
|
pending.supplemental !== true &&
|
|
13
12
|
pending.followOnIndex === undefined &&
|
|
14
|
-
view.
|
|
15
|
-
|
|
13
|
+
view.acceptedOutcomes.includes(pending.activationId);
|
|
14
|
+
if (!eligibleActivation || pending === undefined)
|
|
15
|
+
return false;
|
|
16
|
+
return ((view.blockReason === 'unconfigured outcome failed' &&
|
|
17
|
+
view.lastOutcome?.kind === ActivityOutcomeKind.Failed) ||
|
|
18
|
+
view.executionFailure?.activationId === pending.activationId);
|
|
16
19
|
}
|
|
17
20
|
export function isChangesResumeEligible(view) {
|
|
18
21
|
const pending = view.pendingActivation;
|
|
@@ -32,7 +35,7 @@ export function requestOperatorRetry(definition, state, input) {
|
|
|
32
35
|
if (!isOperatorRetryEligible(state))
|
|
33
36
|
return {
|
|
34
37
|
kind: 'ignored',
|
|
35
|
-
reason: 'workflow is not blocked for
|
|
38
|
+
reason: 'workflow is not blocked for a retryable failed stage',
|
|
36
39
|
};
|
|
37
40
|
const stage = definition.stages[stageName(state.currentStage)];
|
|
38
41
|
const events = [
|
|
@@ -58,6 +58,7 @@ function applyActivityFact(state, event) {
|
|
|
58
58
|
return;
|
|
59
59
|
case OrchestrationEventType.ActivityExecutionFailed:
|
|
60
60
|
state.acceptedOutcomes.push(event.payload.activationId);
|
|
61
|
+
state.executionFailure = event.payload;
|
|
61
62
|
updateActivationStatus(state, event.payload.activationId, ActivityActivationStatus.Completed);
|
|
62
63
|
return;
|
|
63
64
|
case OrchestrationEventType.ActivityWaiting:
|
|
@@ -234,6 +235,7 @@ export function immutableWorkflowInstanceView(state) {
|
|
|
234
235
|
? {}
|
|
235
236
|
: { pendingActivation: state.pendingActivation }),
|
|
236
237
|
...(state.lastOutcome === undefined ? {} : { lastOutcome: state.lastOutcome }),
|
|
238
|
+
...(state.executionFailure === undefined ? {} : { executionFailure: state.executionFailure }),
|
|
237
239
|
...(state.waitingFor === undefined ? {} : { waitingFor: state.waitingFor }),
|
|
238
240
|
};
|
|
239
241
|
}
|