@brandboostinggmbh/observable-workflows 0.16.4 → 0.17.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.d.ts +3 -0
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -368,6 +368,7 @@ type QueueWorkflowContextOptions = {
|
|
|
368
368
|
QUEUE: Queue<WorkflowQueueMessage>;
|
|
369
369
|
workflowContext: WorkflowContextInstance;
|
|
370
370
|
idFactory?: () => string;
|
|
371
|
+
queueIdentifier: string;
|
|
371
372
|
};
|
|
372
373
|
type HandleWorkflowQueueMessageParams = {
|
|
373
374
|
message: WorkflowQueueMessage;
|
|
@@ -405,6 +406,7 @@ type WorkflowQueueMessage = {
|
|
|
405
406
|
tenantId: string;
|
|
406
407
|
input: any;
|
|
407
408
|
triggerId?: string | null;
|
|
409
|
+
queueIdentifier?: string;
|
|
408
410
|
} | {
|
|
409
411
|
type: 'workflow-retry';
|
|
410
412
|
workflowType: string;
|
|
@@ -413,6 +415,7 @@ type WorkflowQueueMessage = {
|
|
|
413
415
|
triggerId?: string | null;
|
|
414
416
|
/** If true the workflow will attempt to reuse all results from successful steps. Defaults to True */
|
|
415
417
|
reuseSuccessfulSteps?: boolean;
|
|
418
|
+
queueIdentifier?: string;
|
|
416
419
|
};
|
|
417
420
|
type RetryWorkflowOptions = {
|
|
418
421
|
/** If true the retry will attept to reuse all results from successful steps. Defaults to True */
|
package/dist/index.js
CHANGED
|
@@ -1022,7 +1022,8 @@ function createQueueWorkflowContext(options) {
|
|
|
1022
1022
|
workflowName: initialName,
|
|
1023
1023
|
input,
|
|
1024
1024
|
tenantId,
|
|
1025
|
-
triggerId
|
|
1025
|
+
triggerId,
|
|
1026
|
+
queueIdentifier: options.queueIdentifier
|
|
1026
1027
|
});
|
|
1027
1028
|
};
|
|
1028
1029
|
const enqueueRetryWorkflow = async (workflow, tenantId, oldInstanceId, reuseSuccessfulSteps) => {
|
|
@@ -1033,7 +1034,8 @@ function createQueueWorkflowContext(options) {
|
|
|
1033
1034
|
retryInstanceId: oldInstanceId,
|
|
1034
1035
|
tenantId,
|
|
1035
1036
|
triggerId,
|
|
1036
|
-
reuseSuccessfulSteps: reuseSuccessfulSteps ?? true
|
|
1037
|
+
reuseSuccessfulSteps: reuseSuccessfulSteps ?? true,
|
|
1038
|
+
queueIdentifier: options.queueIdentifier
|
|
1037
1039
|
});
|
|
1038
1040
|
};
|
|
1039
1041
|
const enqueueWorkflowBatch = async (workflows) => {
|
|
@@ -1043,12 +1045,14 @@ function createQueueWorkflowContext(options) {
|
|
|
1043
1045
|
workflowName: initialName,
|
|
1044
1046
|
input,
|
|
1045
1047
|
tenantId,
|
|
1046
|
-
triggerId: idFactory()
|
|
1048
|
+
triggerId: idFactory(),
|
|
1049
|
+
queueIdentifier: options.queueIdentifier
|
|
1047
1050
|
} })));
|
|
1048
1051
|
};
|
|
1049
1052
|
const handleWorkflowQueueMessage = async ({ message, env, workflowResolver }) => {
|
|
1050
1053
|
const workflowFunction = workflowResolver(message.workflowType);
|
|
1051
1054
|
if (!workflowFunction) throw new Error(`Workflow ${message.workflowType} not found`);
|
|
1055
|
+
if (message.queueIdentifier != null && message.queueIdentifier !== options.queueIdentifier) console.warn(`Workflow ${message.workflowType} is not in the correct queue handler. It should be handled by queue ${message.queueIdentifier}.`);
|
|
1052
1056
|
const wfc = options.workflowContext;
|
|
1053
1057
|
if (message.type === "workflow-run") {
|
|
1054
1058
|
console.log("running workflow", message.input);
|