@brandboostinggmbh/observable-workflows 0.11.5 → 0.12.1

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 CHANGED
@@ -381,6 +381,12 @@ type WorkflowFunction<INPUT, TYPE extends string = string> = {
381
381
  * Use either the WorkflowContect, or the QueueWorkflowContext to run or enqueue this. */
382
382
  _callback: (input: INPUT, ctx: WorkflowContext) => Promise<any>;
383
383
  };
384
+ type WorkflowEnqueueBatchItem<I = any> = {
385
+ workflow: WorkflowFunction<I>;
386
+ tenantId: string;
387
+ input: I;
388
+ initialName: string;
389
+ };
384
390
  type WorkflowQueueMessage = {
385
391
  type: 'workflow-run';
386
392
  workflowType: string;
@@ -394,6 +400,8 @@ type WorkflowQueueMessage = {
394
400
  tenantId: string;
395
401
  retryInstanceId: string;
396
402
  triggerId?: string | null;
403
+ /** If true the workflow will attempt to reuse all results from successful steps. Defaults to True */
404
+ reuseSuccessfulSteps?: boolean;
397
405
  };
398
406
  type RetryWorkflowOptions = {
399
407
  /** If true the retry will attept to reuse all results from successful steps. Defaults to True */
@@ -446,13 +454,8 @@ declare const createLogAccessor: (context: {
446
454
  //#region src/observableWorkflows/createQueueWorkflowContext.d.ts
447
455
  declare function createQueueWorkflowContext(options: QueueWorkflowContextOptions): {
448
456
  enqueueWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, input: I, initialName: string) => Promise<void>;
449
- enqueueWorkflowBatch: <I>(workflows: Array<{
450
- workflow: WorkflowFunction<I>;
451
- tenantId: string;
452
- input: I;
453
- initialName: string;
454
- }>) => Promise<void>;
455
- enqueueRetryWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, oldInstanceId: string) => Promise<void>;
457
+ enqueueWorkflowBatch: <I>(workflows: Array<WorkflowEnqueueBatchItem<I>>) => Promise<void>;
458
+ enqueueRetryWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, oldInstanceId: string, reuseSuccessfulSteps?: boolean) => Promise<void>;
456
459
  handleWorkflowQueueMessage: ({
457
460
  message,
458
461
  env,
@@ -520,4 +523,4 @@ type R2ExternalBlobStorageOptions = {
520
523
  declare function createR2ExternalBlobStorage(options: R2ExternalBlobStorageOptions): ExternalBlobStorage;
521
524
 
522
525
  //#endregion
523
- export { ConsoleWrapper, DateRangeFilter, ExternalBlobStorage, HandleWorkflowQueueMessageParams, InternalWorkflowContextOptions, Log, PossibleValueTypeNames, PossibleValueTypes, PropertyFilter, QueueWorkflowContextOptions, R2ExternalBlobStorageOptions, Serializer, Step, StepContextOptions, StepCtx, StepWorkflowStatus, StringFilter, ValueTypeMap, WorkflowContext, WorkflowContextInstance, WorkflowContextOptions, WorkflowFilter, WorkflowFunction, WorkflowProperty, WorkflowPropertyDefinition, WorkflowQueueMessage, WorkflowRun, createLogAccessor, createQueueWorkflowContext, createR2ExternalBlobStorage, createStepContext, createWorkflowContext, defaultIdFactory, defaultSerializer, defineWorkflow, deserializeWithExternalStorage, ensureTables, finalizeWorkflowRecord, insertStepRecordFull, insertWorkflowRecord, pushLogToDB, serializeWithExternalStorage, tryDeserializeObj, updateWorkflowName, upsertWorkflowProperty, workflowTableRowToWorkflowRun };
526
+ export { ConsoleWrapper, DateRangeFilter, ExternalBlobStorage, HandleWorkflowQueueMessageParams, InternalWorkflowContextOptions, Log, PossibleValueTypeNames, PossibleValueTypes, PropertyFilter, QueueWorkflowContextOptions, R2ExternalBlobStorageOptions, Serializer, Step, StepContextOptions, StepCtx, StepWorkflowStatus, StringFilter, ValueTypeMap, WorkflowEnqueueBatchItem as WorkflowBatchItem, WorkflowContext, WorkflowContextInstance, WorkflowContextOptions, WorkflowFilter, WorkflowFunction, WorkflowProperty, WorkflowPropertyDefinition, WorkflowQueueMessage, WorkflowRun, createLogAccessor, createQueueWorkflowContext, createR2ExternalBlobStorage, createStepContext, createWorkflowContext, defaultIdFactory, defaultSerializer, defineWorkflow, deserializeWithExternalStorage, ensureTables, finalizeWorkflowRecord, insertStepRecordFull, insertWorkflowRecord, pushLogToDB, serializeWithExternalStorage, tryDeserializeObj, updateWorkflowName, upsertWorkflowProperty, workflowTableRowToWorkflowRun };
package/dist/index.js CHANGED
@@ -912,14 +912,15 @@ function createQueueWorkflowContext(options) {
912
912
  triggerId
913
913
  });
914
914
  };
915
- const enqueueRetryWorkflow = async (workflow, tenantId, oldInstanceId) => {
915
+ const enqueueRetryWorkflow = async (workflow, tenantId, oldInstanceId, reuseSuccessfulSteps) => {
916
916
  const triggerId = idFactory();
917
917
  await options.QUEUE.send({
918
918
  type: "workflow-retry",
919
919
  workflowType: workflow.workflowType,
920
920
  retryInstanceId: oldInstanceId,
921
921
  tenantId,
922
- triggerId
922
+ triggerId,
923
+ reuseSuccessfulSteps: reuseSuccessfulSteps ?? true
923
924
  });
924
925
  };
925
926
  const enqueueWorkflowBatch = async (workflows) => {
@@ -950,7 +951,8 @@ function createQueueWorkflowContext(options) {
950
951
  await wfc.retry({
951
952
  workflow: workflowFunction,
952
953
  retryInstanceId: message.retryInstanceId,
953
- triggerId: message.triggerId
954
+ triggerId: message.triggerId,
955
+ retryOptions: { reuseSuccessfulSteps: message.reuseSuccessfulSteps ?? true }
954
956
  });
955
957
  }
956
958
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandboostinggmbh/observable-workflows",
3
- "version": "0.11.5",
3
+ "version": "0.12.1",
4
4
  "description": "My awesome typescript library",
5
5
  "type": "module",
6
6
  "license": "MIT",