@atolis-hq/wake 0.3.41 → 0.3.43
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/src/bootstrap/integration-runtime.js +1 -3
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/integrations/delivery/application/delivery-service.js +5 -1
- package/dist/src/orchestration/application/start-workflow.js +7 -2
- package/dist/src/orchestration/application/watch-matching.js +2 -0
- package/package.json +1 -1
|
@@ -67,9 +67,7 @@ export async function composeIntegrationRuntime(input) {
|
|
|
67
67
|
},
|
|
68
68
|
adapter: (name) => {
|
|
69
69
|
const provider = providers.find((candidate) => candidate.adapter === name);
|
|
70
|
-
|
|
71
|
-
throw new Error(`Delivery provider ${name} is not configured`);
|
|
72
|
-
return provider.delivery;
|
|
70
|
+
return provider?.delivery ?? null;
|
|
73
71
|
},
|
|
74
72
|
now: () => input.clock.now().toISOString(),
|
|
75
73
|
});
|
|
@@ -58,8 +58,12 @@ export class DeliveryService {
|
|
|
58
58
|
const resource = await this.dependencies.resource(intent.resourceId);
|
|
59
59
|
if (resource === null)
|
|
60
60
|
throw new Error(`Delivery resource not found: ${intent.resourceId}`);
|
|
61
|
-
const adapter = this.dependencies.adapter(resource.adapter);
|
|
62
61
|
const occurrence = { ordinal: intent.occurrenceOrdinal + 1 };
|
|
62
|
+
const adapter = this.dependencies.adapter(resource.adapter);
|
|
63
|
+
if (adapter === null) {
|
|
64
|
+
await this.append(this.failed(intent, occurrence, 'provider-unavailable', `Delivery provider ${resource.adapter} is unavailable`));
|
|
65
|
+
return intent;
|
|
66
|
+
}
|
|
63
67
|
if (intent.state === DeliveryState.Ambiguous || intent.attempts > 0) {
|
|
64
68
|
const reconciled = await adapter.reconcile(intent, intent.reconciliationKey ?? intent.intentEventId, signal);
|
|
65
69
|
await this.append(this.reconciled(intent, occurrence, reconciled));
|
|
@@ -23,8 +23,7 @@ export class StartWorkflow {
|
|
|
23
23
|
this.definitions = definitions;
|
|
24
24
|
}
|
|
25
25
|
async execute(command, context) {
|
|
26
|
-
|
|
27
|
-
if (item === null || item.state !== WorkStatus.Open)
|
|
26
|
+
if (!(await this.isWorkItemOpen(command.workItemId)))
|
|
28
27
|
throw new Error('WorkItem must exist and be open');
|
|
29
28
|
const { definition, fingerprint } = this.definitions.currentDefinition(command.workflowName);
|
|
30
29
|
const existing = await this.repository.load(command.workflowInstanceId);
|
|
@@ -53,6 +52,12 @@ export class StartWorkflow {
|
|
|
53
52
|
await this.repository.append(command.workflowInstanceId, 0, decision.events);
|
|
54
53
|
return (await this.repository.loadRequired(command.workflowInstanceId)).view;
|
|
55
54
|
}
|
|
55
|
+
async isWorkItemOpen(workItemId) {
|
|
56
|
+
const item = await this.work.get(workItemId);
|
|
57
|
+
if (item === null || item.state !== WorkStatus.Open)
|
|
58
|
+
return false;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
56
61
|
definitionFor(view) {
|
|
57
62
|
return this.definitions.resolve(view);
|
|
58
63
|
}
|
|
@@ -4,6 +4,8 @@ import { ActivityEventType, PullRequestCheckState, selectActivityEvent, } from '
|
|
|
4
4
|
// status, and predicate all agree with the incoming event.
|
|
5
5
|
export async function matchWatches(loaded, event, workflows, context) {
|
|
6
6
|
const matches = await Promise.all(loaded.map(async ({ view: parent, sequence }) => {
|
|
7
|
+
if (!(await workflows.isWorkItemOpen(parent.workItemId)))
|
|
8
|
+
return [];
|
|
7
9
|
const definition = context === undefined
|
|
8
10
|
? await workflows.definitionFor(parent)
|
|
9
11
|
: await workflows.definitionForOperation(parent, sequence, context);
|