@brandboostinggmbh/observable-workflows 0.3.6 → 0.3.8
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 +13 -19
- package/dist/index.js +1 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -214,10 +214,19 @@ type WorkflowContextOptions = {
|
|
|
214
214
|
serializer?: Serializer;
|
|
215
215
|
};
|
|
216
216
|
type InternalWorkflowContextOptions = WorkflowContextOptions & Required<Pick<WorkflowContextOptions, 'serializer' | 'idFactory'>>;
|
|
217
|
+
type WorkflowContextInstance = {
|
|
218
|
+
call: <I>(args: {
|
|
219
|
+
workflow: WorkflowFunction<I>;
|
|
220
|
+
input: I;
|
|
221
|
+
workflowName: string;
|
|
222
|
+
tenantId: string;
|
|
223
|
+
parentInstanceId?: string | undefined;
|
|
224
|
+
}) => Promise<void>;
|
|
225
|
+
retry: <I>(workflow: WorkflowFunction<I>, retryInstanceId: string) => Promise<void>;
|
|
226
|
+
};
|
|
217
227
|
type QueueWorkflowContextOptions = {
|
|
218
228
|
QUEUE: Queue<WorkflowQueueMessage>;
|
|
219
|
-
|
|
220
|
-
idFactory?: () => string;
|
|
229
|
+
workflowContext: WorkflowContextInstance;
|
|
221
230
|
};
|
|
222
231
|
type WorkflowContext = {
|
|
223
232
|
step: StepContext;
|
|
@@ -258,22 +267,7 @@ declare function defineWorkflow<I extends {} | null>(workflowType: string, callb
|
|
|
258
267
|
|
|
259
268
|
//#endregion
|
|
260
269
|
//#region src/observableWorkflows/createWorkflowContext.d.ts
|
|
261
|
-
declare function createWorkflowContext(options: WorkflowContextOptions):
|
|
262
|
-
call: <I>({
|
|
263
|
-
workflow,
|
|
264
|
-
input,
|
|
265
|
-
workflowName,
|
|
266
|
-
tenantId,
|
|
267
|
-
parentInstanceId
|
|
268
|
-
}: {
|
|
269
|
-
workflow: WorkflowFunction<I>;
|
|
270
|
-
input: I;
|
|
271
|
-
workflowName: string;
|
|
272
|
-
tenantId: string;
|
|
273
|
-
parentInstanceId?: string | undefined;
|
|
274
|
-
}) => Promise<void>;
|
|
275
|
-
retry: <I>(workflow: WorkflowFunction<I>, retryInstanceId: string) => Promise<void>;
|
|
276
|
-
};
|
|
270
|
+
declare function createWorkflowContext(options: WorkflowContextOptions): WorkflowContextInstance;
|
|
277
271
|
|
|
278
272
|
//#endregion
|
|
279
273
|
//#region src/observableWorkflows/createQueueWorkflowContext.d.ts
|
|
@@ -312,4 +306,4 @@ declare const defaultSerializer: {
|
|
|
312
306
|
declare const defaultIdFactory: () => string;
|
|
313
307
|
|
|
314
308
|
//#endregion
|
|
315
|
-
export { ConsoleWrapper, InternalWorkflowContextOptions, Log, PossibleValueTypeNames, PossibleValueTypes, QueueWorkflowContextOptions, Serializer, Step, StepContextOptions, StepCtx, StepWorkflowStatus, ValueTypeMap, WorkflowContext, WorkflowContextOptions, WorkflowFunction, WorkflowProperty, WorkflowPropertyDefinition, WorkflowQueueMessage, WorkflowRun, createLogAccessor, createQueueWorkflowContext, createStepContext, createWorkflowContext, defaultIdFactory, defaultSerializer, defineWorkflow, ensureTables, finalizeWorkflowRecord, insertStepRecordFull, insertWorkflowRecord, pushLogToDB, tryDeserializeObj, updateWorkflowName, upsertWorkflowProperty, workflowTableRowToWorkflowRun };
|
|
309
|
+
export { ConsoleWrapper, InternalWorkflowContextOptions, Log, PossibleValueTypeNames, PossibleValueTypes, QueueWorkflowContextOptions, Serializer, Step, StepContextOptions, StepCtx, StepWorkflowStatus, ValueTypeMap, WorkflowContext, WorkflowContextInstance, WorkflowContextOptions, WorkflowFunction, WorkflowProperty, WorkflowPropertyDefinition, WorkflowQueueMessage, WorkflowRun, createLogAccessor, createQueueWorkflowContext, createStepContext, createWorkflowContext, defaultIdFactory, defaultSerializer, defineWorkflow, ensureTables, finalizeWorkflowRecord, insertStepRecordFull, insertWorkflowRecord, pushLogToDB, tryDeserializeObj, updateWorkflowName, upsertWorkflowProperty, workflowTableRowToWorkflowRun };
|
package/dist/index.js
CHANGED
|
@@ -467,11 +467,7 @@ function createQueueWorkflowContext(options) {
|
|
|
467
467
|
const handleWorkflowQueueMessage = async (message, env, workflowResolver) => {
|
|
468
468
|
const workflowFunction = workflowResolver(message.workflowType);
|
|
469
469
|
if (!workflowFunction) throw new Error(`Workflow ${message.workflowType} not found`);
|
|
470
|
-
const wfc =
|
|
471
|
-
D1: env.LOG_DB,
|
|
472
|
-
serializer: options.serializer,
|
|
473
|
-
idFactory: options.idFactory
|
|
474
|
-
});
|
|
470
|
+
const wfc = options.workflowContext;
|
|
475
471
|
if (message.type === "workflow-run") {
|
|
476
472
|
console.log("running workflow", message.input);
|
|
477
473
|
await wfc.call({
|