@atolis-hq/wake 0.3.21 → 0.3.22
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActivityOutcomeKind, ReviewActorKind, ReviewDecisionKind, ReviewerAuthorizationSource, createPullRequestService, } from '../../../activities/index.js';
|
|
2
|
+
import { ApprovalAuthorityKind } from '../../../orchestration/index.js';
|
|
2
3
|
import { BuiltInResourceKind, ResourceCorrelationRole, ResourceStreamKind, resourceId, } from '../../../resources/index.js';
|
|
3
4
|
import { UnknownGitHubIdentity } from '../contracts/vocabulary.js';
|
|
4
5
|
import { commandContext } from './inbound-context.js';
|
|
@@ -143,6 +144,9 @@ async function applyWorkflowSignal(input) {
|
|
|
143
144
|
evidenceId: event.eventId,
|
|
144
145
|
},
|
|
145
146
|
providerEventId: event.eventId,
|
|
147
|
+
...(event.payload.actor.kind === ReviewActorKind.Human
|
|
148
|
+
? { authority: { kind: ApprovalAuthorityKind.Human } }
|
|
149
|
+
: {}),
|
|
146
150
|
}, commandContext(event));
|
|
147
151
|
}
|
|
148
152
|
else if (resumeBlockedOnChanges) {
|
|
@@ -52,7 +52,10 @@ function signalRejectionReason(state, input) {
|
|
|
52
52
|
if (state.acceptedSignalIds.includes(signal.providerEventId))
|
|
53
53
|
return 'provider signal was already accepted';
|
|
54
54
|
const expected = state.waitingFor;
|
|
55
|
-
if (
|
|
55
|
+
if (expected === undefined)
|
|
56
|
+
return 'WorkflowInstance is not waiting for a signal';
|
|
57
|
+
if (state.status !== WorkflowStatus.Waiting &&
|
|
58
|
+
!isBlockedHumanAuthorizedWait(state, signal, expected))
|
|
56
59
|
return 'WorkflowInstance is not waiting for a signal';
|
|
57
60
|
if (!matchesExpectation(signal, expected))
|
|
58
61
|
return 'signal does not match the current expectation';
|
|
@@ -66,6 +69,11 @@ function signalRejectionReason(state, input) {
|
|
|
66
69
|
return 'watch-gate signal outcome is neither done nor rejected';
|
|
67
70
|
return null;
|
|
68
71
|
}
|
|
72
|
+
function isBlockedHumanAuthorizedWait(state, signal, expected) {
|
|
73
|
+
return (state.status === WorkflowStatus.Blocked &&
|
|
74
|
+
signal.authority?.kind === ApprovalAuthorityKind.Human &&
|
|
75
|
+
expected.from?.some((authority) => authority.kind === ApprovalAuthorityKind.Human) === true);
|
|
76
|
+
}
|
|
69
77
|
function signalAuthorityAccepted(signal, expected, consent) {
|
|
70
78
|
if (expected.from === undefined)
|
|
71
79
|
return true;
|