@hatchet-dev/typescript-sdk 0.12.4 → 0.13.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/step.d.ts CHANGED
@@ -167,6 +167,7 @@ export declare class Context<T, K = {}> {
167
167
  spawnWorkflow<Q = JsonValue, P = JsonValue>(workflow: string | Workflow, input: Q, options?: string | {
168
168
  key?: string;
169
169
  sticky?: boolean;
170
+ additionalMetadata?: Record<string, string>;
170
171
  }): WorkflowRunRef<P>;
171
172
  additionalMetadata(): Record<string, string>;
172
173
  childIndex(): number | undefined;
package/step.js CHANGED
@@ -225,6 +225,7 @@ class Context {
225
225
  const name = this.client.config.namespace + workflowName;
226
226
  let key = '';
227
227
  let sticky = false;
228
+ let metadata;
228
229
  if (typeof options === 'string') {
229
230
  this.logger.warn('Using key param is deprecated and will be removed in a future release. Use options.key instead.');
230
231
  key = options;
@@ -232,6 +233,7 @@ class Context {
232
233
  else {
233
234
  key = options === null || options === void 0 ? void 0 : options.key;
234
235
  sticky = options === null || options === void 0 ? void 0 : options.sticky;
236
+ metadata = options === null || options === void 0 ? void 0 : options.additionalMetadata;
235
237
  }
236
238
  if (sticky && !this.worker.hasWorkflow(name)) {
237
239
  throw new hatchet_error_1.default(`cannot run with sticky: workflow ${name} is not registered on the worker`);
@@ -243,6 +245,7 @@ class Context {
243
245
  childKey: key,
244
246
  childIndex: this.spawnIndex,
245
247
  desiredWorkerId: sticky ? this.worker.id() : undefined,
248
+ additionalMetadata: metadata,
246
249
  });
247
250
  this.spawnIndex += 1;
248
251
  return resp;
package/workflow.d.ts CHANGED
@@ -69,14 +69,17 @@ export declare const WorkflowConcurrency: z.ZodObject<{
69
69
  name: z.ZodString;
70
70
  maxRuns: z.ZodOptional<z.ZodNumber>;
71
71
  limitStrategy: z.ZodOptional<z.ZodNativeEnum<typeof PbConcurrencyLimitStrategy>>;
72
+ expression: z.ZodOptional<z.ZodString>;
72
73
  }, "strip", z.ZodTypeAny, {
73
74
  name: string;
74
75
  maxRuns?: number | undefined;
75
76
  limitStrategy?: PbConcurrencyLimitStrategy | undefined;
77
+ expression?: string | undefined;
76
78
  }, {
77
79
  name: string;
78
80
  maxRuns?: number | undefined;
79
81
  limitStrategy?: PbConcurrencyLimitStrategy | undefined;
82
+ expression?: string | undefined;
80
83
  }>;
81
84
  export declare const HatchetTimeoutSchema: z.ZodString;
82
85
  export declare const StickyStrategy: typeof PbStickyStrategy;
@@ -331,7 +334,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
331
334
  }>;
332
335
  export interface Workflow extends z.infer<typeof CreateWorkflowSchema> {
333
336
  concurrency?: z.infer<typeof WorkflowConcurrency> & {
334
- key: (ctx: any) => string;
337
+ key?: (ctx: any) => string;
335
338
  };
336
339
  steps: CreateStep<any, any>[];
337
340
  onFailure?: CreateStep<any, any>;
package/workflow.js CHANGED
@@ -42,6 +42,7 @@ exports.WorkflowConcurrency = z.object({
42
42
  name: z.string(),
43
43
  maxRuns: z.number().optional(),
44
44
  limitStrategy: z.nativeEnum(exports.ConcurrencyLimitStrategy).optional(),
45
+ expression: z.string().optional(),
45
46
  });
46
47
  exports.HatchetTimeoutSchema = z.string();
47
48
  exports.StickyStrategy = workflows_1.StickyStrategy;