@brandboostinggmbh/observable-workflows 0.3.3 → 0.3.6

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
@@ -127,14 +127,12 @@ declare function upsertWorkflowProperty<T extends keyof ValueTypeMap>({
127
127
  context,
128
128
  instanceId,
129
129
  key,
130
- valueType,
131
130
  value,
132
131
  tenantId
133
132
  }: {
134
133
  context: InternalWorkflowContextOptions;
135
134
  instanceId: string;
136
135
  key: string;
137
- valueType: T;
138
136
  value: ValueTypeMap[T];
139
137
  tenantId: string;
140
138
  }): Promise<boolean>;
@@ -225,7 +223,7 @@ type WorkflowContext = {
225
223
  step: StepContext;
226
224
  console: ConsoleWrapper;
227
225
  setWorkflowName: (newName: string) => Promise<void>;
228
- setWorkflowProperty: <T extends keyof ValueTypeMap>(key: string, valueType: T, value: ValueTypeMap[T]) => Promise<void>;
226
+ setWorkflowProperty: <T extends keyof ValueTypeMap>(key: string, value: ValueTypeMap[T]) => Promise<void>;
229
227
  tenantId: string;
230
228
  };
231
229
  type WorkflowFunction<INPUT, TYPE extends string = string> = {
@@ -282,9 +280,9 @@ declare function createWorkflowContext(options: WorkflowContextOptions): {
282
280
  declare function createQueueWorkflowContext(options: QueueWorkflowContextOptions): {
283
281
  enqueueWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, input: I, initialName: string) => Promise<void>;
284
282
  enqueueRetryWorkflow: <I>(workflow: WorkflowFunction<I>, tenantId: string, oldInstanceId: string) => Promise<void>;
285
- handleWorkflowQueueMessage: <T>(message: WorkflowQueueMessage, env: {
283
+ handleWorkflowQueueMessage: (message: WorkflowQueueMessage, env: {
286
284
  LOG_DB: D1Database;
287
- }, workflowResolver: (workflowType: string) => WorkflowFunction<T> | undefined) => Promise<void>;
285
+ }, workflowResolver: (workflowType: string) => WorkflowFunction<any> | undefined) => Promise<void>;
288
286
  };
289
287
 
290
288
  //#endregion
package/dist/index.js CHANGED
@@ -159,7 +159,8 @@ async function updateWorkflowName(context, instanceId, newWorkflowName) {
159
159
  WHERE instanceId = ?`
160
160
  ).bind(newWorkflowName, instanceId).run();
161
161
  }
162
- async function upsertWorkflowProperty({ context, instanceId, key, valueType, value, tenantId }) {
162
+ async function upsertWorkflowProperty({ context, instanceId, key, value, tenantId }) {
163
+ const valueType = typeof value;
163
164
  const serializedValue = valueType === "object" ? JSON.stringify(value) : String(value);
164
165
  const res = await context.D1.prepare(
165
166
  /* sql */
@@ -383,12 +384,11 @@ function createWorkflowContext(options) {
383
384
  async setWorkflowName(newName) {
384
385
  await updateWorkflowName({ D1: options.D1 }, instanceId, newName);
385
386
  },
386
- async setWorkflowProperty(key, valueType, value) {
387
+ async setWorkflowProperty(key, value) {
387
388
  await upsertWorkflowProperty({
388
389
  context: internalContext,
389
390
  instanceId,
390
391
  key,
391
- valueType,
392
392
  value,
393
393
  tenantId
394
394
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandboostinggmbh/observable-workflows",
3
- "version": "0.3.3",
3
+ "version": "0.3.6",
4
4
  "description": "My awesome typescript library",
5
5
  "type": "module",
6
6
  "license": "MIT",