@brandboostinggmbh/observable-workflows 0.11.4 → 0.12.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 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -394,6 +394,8 @@ type WorkflowQueueMessage = {
|
|
|
394
394
|
tenantId: string;
|
|
395
395
|
retryInstanceId: string;
|
|
396
396
|
triggerId?: string | null;
|
|
397
|
+
/** If true the workflow will attempt to reuse all results from successful steps. Defaults to True */
|
|
398
|
+
reuseSuccessfulSteps?: boolean;
|
|
397
399
|
};
|
|
398
400
|
type RetryWorkflowOptions = {
|
|
399
401
|
/** If true the retry will attept to reuse all results from successful steps. Defaults to True */
|
|
@@ -452,7 +454,7 @@ declare function createQueueWorkflowContext(options: QueueWorkflowContextOptions
|
|
|
452
454
|
input: I;
|
|
453
455
|
initialName: string;
|
|
454
456
|
}>) => Promise<void>;
|
|
455
|
-
enqueueRetryWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, oldInstanceId: string) => Promise<void>;
|
|
457
|
+
enqueueRetryWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, oldInstanceId: string, reuseSuccessfulSteps?: boolean) => Promise<void>;
|
|
456
458
|
handleWorkflowQueueMessage: ({
|
|
457
459
|
message,
|
|
458
460
|
env,
|
package/dist/index.js
CHANGED
|
@@ -745,9 +745,7 @@ const createLogAccessor = (context) => {
|
|
|
745
745
|
}
|
|
746
746
|
const listWorkflows = async (limit, offset, filter) => {
|
|
747
747
|
const { sql, bindings } = buildFilteredWorkflowQuery(filter);
|
|
748
|
-
console.log("executing listWorkflows with SQL", sql);
|
|
749
748
|
const result = await context.D1.prepare(sql).bind(...bindings, limit, offset).all();
|
|
750
|
-
console.log("listWorkflows finished. Processing results...");
|
|
751
749
|
if (result.results) {
|
|
752
750
|
const workflows = await Promise.all(result.results.map((row) => workflowTableRowToWorkflowRun(row, internalSerializer, context.externalBlobStorage)));
|
|
753
751
|
return workflows;
|
|
@@ -914,14 +912,15 @@ function createQueueWorkflowContext(options) {
|
|
|
914
912
|
triggerId
|
|
915
913
|
});
|
|
916
914
|
};
|
|
917
|
-
const enqueueRetryWorkflow = async (workflow, tenantId, oldInstanceId) => {
|
|
915
|
+
const enqueueRetryWorkflow = async (workflow, tenantId, oldInstanceId, reuseSuccessfulSteps) => {
|
|
918
916
|
const triggerId = idFactory();
|
|
919
917
|
await options.QUEUE.send({
|
|
920
918
|
type: "workflow-retry",
|
|
921
919
|
workflowType: workflow.workflowType,
|
|
922
920
|
retryInstanceId: oldInstanceId,
|
|
923
921
|
tenantId,
|
|
924
|
-
triggerId
|
|
922
|
+
triggerId,
|
|
923
|
+
reuseSuccessfulSteps: reuseSuccessfulSteps ?? true
|
|
925
924
|
});
|
|
926
925
|
};
|
|
927
926
|
const enqueueWorkflowBatch = async (workflows) => {
|
|
@@ -952,7 +951,8 @@ function createQueueWorkflowContext(options) {
|
|
|
952
951
|
await wfc.retry({
|
|
953
952
|
workflow: workflowFunction,
|
|
954
953
|
retryInstanceId: message.retryInstanceId,
|
|
955
|
-
triggerId: message.triggerId
|
|
954
|
+
triggerId: message.triggerId,
|
|
955
|
+
retryOptions: { reuseSuccessfulSteps: message.reuseSuccessfulSteps ?? true }
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
958
|
};
|