@hatchet-dev/typescript-sdk 1.30.1 → 1.31.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "1.30.1",
3
+ "version": "1.31.0",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -113,6 +113,21 @@ export declare function mapSlotRequestsPb(task: {
113
113
  slotCost?: number;
114
114
  }, isDurable: boolean): Record<string, number>;
115
115
  export declare function mapRateLimitPb(limits: CreateWorkflowTaskOpts<any, any>['rateLimits']): CreateStepRateLimit[];
116
+ export declare function mapConcurrencyPb(entries: Concurrency[]): {
117
+ expression: string;
118
+ maxRuns: number | undefined;
119
+ limitStrategy: import("../..").ConcurrencyLimitStrategy | undefined;
120
+ name: string | undefined;
121
+ isTenantScoped: boolean | undefined;
122
+ maxRunsExpression: string | undefined;
123
+ }[];
124
+ export declare function taskConcurrencyArr(task: {
125
+ concurrency?: Concurrency | Concurrency[];
126
+ }, workflow: {
127
+ taskDefaults?: {
128
+ concurrency?: Concurrency | Concurrency[];
129
+ };
130
+ }): Concurrency[];
116
131
  export declare function assertValidConcurrencyArr(concurrency: Concurrency[] | undefined): void;
117
132
  export declare function mapBatchConfigPb(batch: CreateWorkflowTaskOpts<any, any>['batch']): TaskBatchConfig | undefined;
118
133
  export declare function resolveExecutionTimeout(task: {
@@ -55,6 +55,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
55
55
  exports.InternalWorker = void 0;
56
56
  exports.mapSlotRequestsPb = mapSlotRequestsPb;
57
57
  exports.mapRateLimitPb = mapRateLimitPb;
58
+ exports.mapConcurrencyPb = mapConcurrencyPb;
59
+ exports.taskConcurrencyArr = taskConcurrencyArr;
58
60
  exports.assertValidConcurrencyArr = assertValidConcurrencyArr;
59
61
  exports.mapBatchConfigPb = mapBatchConfigPb;
60
62
  exports.resolveExecutionTimeout = resolveExecutionTimeout;
@@ -307,7 +309,7 @@ class InternalWorker {
307
309
  eventTriggers,
308
310
  cronTriggers,
309
311
  sticky: stickyStrategy,
310
- concurrencyArr,
312
+ concurrencyArr: mapConcurrencyPb(concurrencyArr),
311
313
  onFailureTask,
312
314
  defaultPriority: workflow.defaultPriority,
313
315
  inputJsonSchema,
@@ -333,22 +335,13 @@ class InternalWorker {
333
335
  slotRequests: mapSlotRequestsPb(task, durableTaskSet.has(task)),
334
336
  batch: mapBatchConfigPb(batchOf(task)),
335
337
  concurrency: (() => {
336
- var _a;
337
- const taskConcurrency = task.concurrency
338
- ? Array.isArray(task.concurrency)
339
- ? task.concurrency
340
- : [task.concurrency]
341
- : ((_a = workflow.taskDefaults) === null || _a === void 0 ? void 0 : _a.concurrency)
342
- ? Array.isArray(workflow.taskDefaults.concurrency)
343
- ? workflow.taskDefaults.concurrency
344
- : [workflow.taskDefaults.concurrency]
345
- : [];
338
+ const taskConcurrency = taskConcurrencyArr(task, workflow);
346
339
  assertValidConcurrencyArr(taskConcurrency);
347
- return taskConcurrency;
340
+ return mapConcurrencyPb(taskConcurrency);
348
341
  })(),
349
342
  });
350
343
  }),
351
- concurrency: concurrencySolo,
344
+ concurrency: concurrencySolo ? mapConcurrencyPb([concurrencySolo])[0] : undefined,
352
345
  defaultFilters: (_w = (_v = workflow.defaultFilters) === null || _v === void 0 ? void 0 : _v.map((f) => ({
353
346
  scope: f.scope,
354
347
  expression: f.expression,
@@ -1116,10 +1109,42 @@ function parseBatchPayload(actionPayload) {
1116
1109
  function batchOf(task) {
1117
1110
  return 'batch' in task ? task.batch : undefined;
1118
1111
  }
1112
+ // mapConcurrencyPb maps SDK concurrency entries onto the proto shape; entries keep their
1113
+ // declared order, which is the chain order.
1114
+ function mapConcurrencyPb(entries) {
1115
+ return entries.map((c) => ({
1116
+ expression: c.expression,
1117
+ // a string maxRuns is a CEL expression; the static field then carries the default
1118
+ // of 1, which only governs slots created before the expression existed
1119
+ maxRuns: typeof c.maxRuns === 'string' ? 1 : c.maxRuns,
1120
+ limitStrategy: c.limitStrategy,
1121
+ name: c.name,
1122
+ isTenantScoped: c.isTenantScoped,
1123
+ maxRunsExpression: typeof c.maxRuns === 'string' ? c.maxRuns : undefined,
1124
+ }));
1125
+ }
1126
+ function taskConcurrencyArr(task, workflow) {
1127
+ var _a;
1128
+ if (task.concurrency) {
1129
+ return Array.isArray(task.concurrency) ? task.concurrency : [task.concurrency];
1130
+ }
1131
+ if ((_a = workflow.taskDefaults) === null || _a === void 0 ? void 0 : _a.concurrency) {
1132
+ return Array.isArray(workflow.taskDefaults.concurrency)
1133
+ ? workflow.taskDefaults.concurrency
1134
+ : [workflow.taskDefaults.concurrency];
1135
+ }
1136
+ return [];
1137
+ }
1119
1138
  function assertValidConcurrencyArr(concurrency) {
1120
1139
  concurrency === null || concurrency === void 0 ? void 0 : concurrency.forEach((c) => {
1140
+ if (typeof c.maxRuns === 'string') {
1141
+ if (!c.maxRuns.trim()) {
1142
+ throw new Error('concurrency.maxRuns expression must be non-empty');
1143
+ }
1144
+ return;
1145
+ }
1121
1146
  if (c.maxRuns !== undefined && (!Number.isInteger(c.maxRuns) || c.maxRuns <= 0)) {
1122
- throw new Error(`concurrency.maxRuns must be a positive integer when provided, got: ${c.maxRuns}`);
1147
+ throw new Error(`concurrency.maxRuns must be a positive integer or a CEL expression, got: ${c.maxRuns}`);
1123
1148
  }
1124
1149
  });
1125
1150
  }
@@ -228,7 +228,9 @@ export type TaskDefaults = {
228
228
  */
229
229
  workerLabels?: CreateWorkflowTaskOpts<any, any>['desiredWorkerLabels'];
230
230
  /**
231
- * (optional) the concurrency options for the task.
231
+ * (optional) the concurrency options for the task, processed in array order. Entries
232
+ * may be workflow-scoped strategies or tenant-scoped entries (`isTenantScoped`)
233
+ * strategies, whose definitions are upserted as part of workflow registration.
232
234
  */
233
235
  concurrency?: Concurrency | Concurrency[];
234
236
  };
@@ -0,0 +1,10 @@
1
+ export type WorkflowInput = {
2
+ account: string;
3
+ tier: string;
4
+ };
5
+ export type WorkflowOutput = {
6
+ 'dynamic-task': {
7
+ account: string;
8
+ };
9
+ };
10
+ export declare const concurrencyDynamicWorkflow: import("../..").WorkflowDeclaration<WorkflowInput, WorkflowOutput, {}>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.concurrencyDynamicWorkflow = void 0;
13
+ const v1_1 = require("../..");
14
+ const hatchet_client_1 = require("../hatchet-client");
15
+ // > Dynamic Max Runs
16
+ // maxRuns accepts a number or a CEL expression string. With an expression, each
17
+ // concurrency group's limit is computed from the task's input.
18
+ exports.concurrencyDynamicWorkflow = hatchet_client_1.hatchet.workflow({
19
+ name: 'concurrency-dynamic',
20
+ });
21
+ exports.concurrencyDynamicWorkflow.task({
22
+ name: 'dynamic-task',
23
+ concurrency: [
24
+ {
25
+ expression: 'input.account',
26
+ maxRuns: "input.tier == 'premium' ? 10 : 1",
27
+ limitStrategy: v1_1.ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN,
28
+ },
29
+ ],
30
+ fn: (input) => __awaiter(void 0, void 0, void 0, function* () { return ({ account: input.account }); }),
31
+ });
32
+ // !!
@@ -0,0 +1,17 @@
1
+ import { Concurrency } from '../..';
2
+ export declare const SLEEP_TIME_MS = 1500;
3
+ export type WorkflowInput = {
4
+ group: string;
5
+ inline?: string;
6
+ };
7
+ export type RunWindow = {
8
+ startMs: number;
9
+ endMs: number;
10
+ };
11
+ export type WorkflowOutput = {
12
+ 'shared-task': RunWindow;
13
+ };
14
+ export declare const sharedLimit: Concurrency;
15
+ export declare const concurrencySharedWorkflowA: import("../..").WorkflowDeclaration<WorkflowInput, WorkflowOutput, {}>;
16
+ export declare const concurrencySharedWorkflowB: import("../..").WorkflowDeclaration<WorkflowInput, WorkflowOutput, {}>;
17
+ export declare const concurrencySharedMixedWorkflow: import("../..").WorkflowDeclaration<WorkflowInput, WorkflowOutput, {}>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.concurrencySharedMixedWorkflow = exports.concurrencySharedWorkflowB = exports.concurrencySharedWorkflowA = exports.sharedLimit = exports.SLEEP_TIME_MS = void 0;
13
+ const v1_1 = require("../..");
14
+ const hatchet_client_1 = require("../hatchet-client");
15
+ const sleep = (ms) => new Promise((resolve) => {
16
+ setTimeout(resolve, ms);
17
+ });
18
+ exports.SLEEP_TIME_MS = 1500;
19
+ // > Shared Concurrency Strategy
20
+ // A tenant-scoped strategy is shared across workflows: every task declaring the same name
21
+ // consumes the same concurrency limit. The definition rides on workflow registration and
22
+ // re-registering the name updates it in place.
23
+ exports.sharedLimit = {
24
+ name: 'ts-example-shared-limit',
25
+ isTenantScoped: true,
26
+ expression: 'input.group',
27
+ maxRuns: 1,
28
+ limitStrategy: v1_1.ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN,
29
+ };
30
+ const runWindowTask = () => __awaiter(void 0, void 0, void 0, function* () {
31
+ const startMs = Date.now();
32
+ yield sleep(exports.SLEEP_TIME_MS);
33
+ return { startMs, endMs: Date.now() };
34
+ });
35
+ exports.concurrencySharedWorkflowA = hatchet_client_1.hatchet.workflow({
36
+ name: 'concurrency-shared-a',
37
+ });
38
+ exports.concurrencySharedWorkflowA.task({
39
+ name: 'shared-task',
40
+ concurrency: [exports.sharedLimit],
41
+ fn: runWindowTask,
42
+ });
43
+ exports.concurrencySharedWorkflowB = hatchet_client_1.hatchet.workflow({
44
+ name: 'concurrency-shared-b',
45
+ });
46
+ exports.concurrencySharedWorkflowB.task({
47
+ name: 'shared-task',
48
+ concurrency: [exports.sharedLimit],
49
+ fn: runWindowTask,
50
+ });
51
+ // !!
52
+ // > Mixed Inline And Shared Concurrency
53
+ // A single task can combine a workflow-scoped inline strategy with a shared strategy;
54
+ // both limits apply at once.
55
+ exports.concurrencySharedMixedWorkflow = hatchet_client_1.hatchet.workflow({
56
+ name: 'concurrency-shared-mixed',
57
+ });
58
+ exports.concurrencySharedMixedWorkflow.task({
59
+ name: 'shared-task',
60
+ concurrency: [
61
+ {
62
+ expression: 'input.inline',
63
+ maxRuns: 1,
64
+ limitStrategy: v1_1.ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN,
65
+ },
66
+ exports.sharedLimit,
67
+ ],
68
+ fn: runWindowTask,
69
+ });
70
+ // !!
@@ -25,30 +25,31 @@ const workflow_4 = require("./concurrency_cancel_newest/workflow");
25
25
  const workflow_5 = require("./concurrency_cancel_queued_except_newest/workflow");
26
26
  const workflow_6 = require("./concurrency_cancel_queued_except_oldest/workflow");
27
27
  const workflow_7 = require("./concurrency_multiple_keys/workflow");
28
- const workflow_8 = require("./concurrency_workflow_level/workflow");
29
- const workflow_9 = require("./dag/workflow");
30
- const workflow_10 = require("./durable/workflow");
31
- const workflow_11 = require("./durable_event/workflow");
32
- const workflow_12 = require("./durable_eviction/workflow");
33
- const workflow_13 = require("./durable_callback_ordering/workflow");
34
- const workflow_14 = require("./durable_sleep/workflow");
35
- const workflow_15 = require("./logger/workflow");
36
- const workflow_16 = require("./non_retryable/workflow");
37
- const workflow_17 = require("./on_failure/workflow");
38
- const workflow_18 = require("./idempotency/workflow");
39
- const workflow_19 = require("./on_event/workflow");
40
- const workflow_20 = require("./return_exceptions/workflow");
41
- const workflow_21 = require("./run_details/workflow");
28
+ const workflow_8 = require("./concurrency_shared/workflow");
29
+ const workflow_9 = require("./concurrency_workflow_level/workflow");
30
+ const workflow_10 = require("./dag/workflow");
31
+ const workflow_11 = require("./durable/workflow");
32
+ const workflow_12 = require("./durable_event/workflow");
33
+ const workflow_13 = require("./durable_eviction/workflow");
34
+ const workflow_14 = require("./durable_callback_ordering/workflow");
35
+ const workflow_15 = require("./durable_sleep/workflow");
36
+ const workflow_16 = require("./logger/workflow");
37
+ const workflow_17 = require("./non_retryable/workflow");
38
+ const workflow_18 = require("./on_failure/workflow");
39
+ const workflow_19 = require("./idempotency/workflow");
40
+ const workflow_20 = require("./on_event/workflow");
41
+ const workflow_21 = require("./return_exceptions/workflow");
42
+ const workflow_22 = require("./run_details/workflow");
42
43
  const e2e_workflows_1 = require("./simple/e2e-workflows");
43
- const workflow_22 = require("./batch_assign/workflow");
44
- const workflow_23 = require("./streaming/workflow");
45
- const workflow_24 = require("./subscribe_to_stream/workflow");
46
- const workflow_25 = require("./timeout/workflow");
47
- const workflow_26 = require("./webhooks/workflow");
48
- const workflow_27 = require("./child_index/workflow");
49
- const workflow_28 = require("./support_agent/workflow");
50
- const workflow_29 = require("./welcome_email/workflow");
51
- const workflow_30 = require("./pdf_pipeline/workflow");
44
+ const workflow_23 = require("./batch_assign/workflow");
45
+ const workflow_24 = require("./streaming/workflow");
46
+ const workflow_25 = require("./subscribe_to_stream/workflow");
47
+ const workflow_26 = require("./timeout/workflow");
48
+ const workflow_27 = require("./webhooks/workflow");
49
+ const workflow_28 = require("./child_index/workflow");
50
+ const workflow_29 = require("./support_agent/workflow");
51
+ const workflow_30 = require("./welcome_email/workflow");
52
+ const workflow_31 = require("./pdf_pipeline/workflow");
52
53
  const workflows = [
53
54
  workflow_1.bulkChild,
54
55
  workflow_1.bulkParentWorkflow,
@@ -62,78 +63,81 @@ const workflows = [
62
63
  workflow_5.concurrencyCancelQueuedExceptNewestWorkflow,
63
64
  workflow_6.concurrencyCancelQueuedExceptOldestWorkflow,
64
65
  workflow_7.concurrencyMultipleKeysWorkflow,
65
- workflow_8.concurrencyWorkflowLevelWorkflow,
66
- workflow_9.dag,
67
- workflow_10.durableWorkflow,
68
- workflow_10.waitForSleepTwice,
69
- workflow_10.spawnChildTask,
70
- workflow_10.durableWithSpawn,
71
- workflow_10.durableWithBulkSpawn,
72
- workflow_10.durableSleepEventSpawn,
73
- workflow_10.durableWithExplicitSpawn,
74
- workflow_10.durableNonDeterminism,
75
- workflow_10.durableReplayReset,
76
- workflow_10.dagChildWorkflow,
77
- workflow_10.durableSpawnDag,
78
- workflow_10.waitForEventLookback,
79
- workflow_10.waitForOrEventLookback,
80
- workflow_10.waitForTwoEventsSecondPushedFirst,
81
- workflow_10.errorRaisingTask,
82
- workflow_10.errorRaisingDurableParent,
83
- workflow_11.durableEvent,
84
- workflow_11.durableEventWithFilter,
85
- workflow_13.callbackOrderingLeaf,
86
- workflow_13.callbackOrderingMid,
87
- workflow_13.callbackOrderingRoot,
88
- workflow_14.durableSleep,
89
- workflow_12.evictableSleep,
90
- workflow_12.evictableWaitForEvent,
91
- workflow_12.evictableMemoThenWaitForEvent,
92
- workflow_12.evictableChildSpawn,
93
- workflow_12.multipleEviction,
94
- workflow_12.nonEvictableSleep,
95
- workflow_12.childTask,
96
- workflow_12.bulkChildTask,
97
- workflow_12.evictableChildBulkSpawn,
98
- (0, workflow_15.createLoggingWorkflow)(hatchet_client_1.hatchet),
99
- workflow_16.nonRetryableWorkflow,
100
- workflow_17.failureWorkflow,
101
- workflow_18.idempotentTask,
102
- workflow_18.idempotentTaskShortWindow,
103
- workflow_19.lower,
104
- workflow_20.returnExceptionsTask,
105
- workflow_21.runDetailTestWorkflow,
66
+ workflow_8.concurrencySharedWorkflowA,
67
+ workflow_8.concurrencySharedWorkflowB,
68
+ workflow_8.concurrencySharedMixedWorkflow,
69
+ workflow_9.concurrencyWorkflowLevelWorkflow,
70
+ workflow_10.dag,
71
+ workflow_11.durableWorkflow,
72
+ workflow_11.waitForSleepTwice,
73
+ workflow_11.spawnChildTask,
74
+ workflow_11.durableWithSpawn,
75
+ workflow_11.durableWithBulkSpawn,
76
+ workflow_11.durableSleepEventSpawn,
77
+ workflow_11.durableWithExplicitSpawn,
78
+ workflow_11.durableNonDeterminism,
79
+ workflow_11.durableReplayReset,
80
+ workflow_11.dagChildWorkflow,
81
+ workflow_11.durableSpawnDag,
82
+ workflow_11.waitForEventLookback,
83
+ workflow_11.waitForOrEventLookback,
84
+ workflow_11.waitForTwoEventsSecondPushedFirst,
85
+ workflow_11.errorRaisingTask,
86
+ workflow_11.errorRaisingDurableParent,
87
+ workflow_12.durableEvent,
88
+ workflow_12.durableEventWithFilter,
89
+ workflow_14.callbackOrderingLeaf,
90
+ workflow_14.callbackOrderingMid,
91
+ workflow_14.callbackOrderingRoot,
92
+ workflow_15.durableSleep,
93
+ workflow_13.evictableSleep,
94
+ workflow_13.evictableWaitForEvent,
95
+ workflow_13.evictableMemoThenWaitForEvent,
96
+ workflow_13.evictableChildSpawn,
97
+ workflow_13.multipleEviction,
98
+ workflow_13.nonEvictableSleep,
99
+ workflow_13.childTask,
100
+ workflow_13.bulkChildTask,
101
+ workflow_13.evictableChildBulkSpawn,
102
+ (0, workflow_16.createLoggingWorkflow)(hatchet_client_1.hatchet),
103
+ workflow_17.nonRetryableWorkflow,
104
+ workflow_18.failureWorkflow,
105
+ workflow_19.idempotentTask,
106
+ workflow_19.idempotentTaskShortWindow,
107
+ workflow_20.lower,
108
+ workflow_21.returnExceptionsTask,
109
+ workflow_22.runDetailTestWorkflow,
106
110
  e2e_workflows_1.helloWorld,
107
111
  e2e_workflows_1.helloWorldDurable,
108
- workflow_23.streamingTask,
109
- workflow_24.dagStream,
110
- workflow_24.longStream,
111
- workflow_25.timeoutTask,
112
- workflow_25.refreshTimeoutTask,
113
- workflow_26.webhookWorkflow,
114
- workflow_27.childIndexChild,
115
- workflow_27.childIndexParent,
116
- workflow_27.scenarioTask,
117
- workflow_27.orchestratorTask,
118
- workflow_28.supportAgent,
119
- workflow_28.triageTicket,
120
- workflow_28.generateReply,
121
- workflow_28.escalateTicket,
122
- workflow_29.welcomeEmail,
123
- workflow_30.pdfPipeline,
124
- workflow_22.batchSimple,
125
- workflow_22.batchKeyed,
126
- workflow_22.batchKeyedFailable,
127
- workflow_22.batchKeyedInterval,
128
- workflow_22.batchLarge,
129
- workflow_22.batchSingle,
130
- workflow_22.batchOrdered,
131
- workflow_22.batchBroadcast,
132
- workflow_22.batchCancel,
133
- workflow_22.child,
134
- workflow_22.childBatch,
135
- workflow_22.batchChildSpawn,
136
- workflow_22.batchChildBatchSpawn,
112
+ workflow_24.streamingTask,
113
+ workflow_25.dagStream,
114
+ workflow_25.longStream,
115
+ workflow_26.timeoutTask,
116
+ workflow_26.refreshTimeoutTask,
117
+ workflow_27.webhookWorkflow,
118
+ workflow_28.childIndexChild,
119
+ workflow_28.childIndexParent,
120
+ workflow_28.scenarioTask,
121
+ workflow_28.orchestratorTask,
122
+ workflow_29.supportAgent,
123
+ workflow_29.triageTicket,
124
+ workflow_29.generateReply,
125
+ workflow_29.escalateTicket,
126
+ workflow_30.welcomeEmail,
127
+ workflow_31.pdfPipeline,
128
+ workflow_23.batchSimple,
129
+ workflow_23.batchKeyed,
130
+ workflow_23.batchKeyedFailable,
131
+ workflow_23.batchKeyedInterval,
132
+ workflow_23.batchLarge,
133
+ workflow_23.batchSingle,
134
+ workflow_23.batchOrdered,
135
+ workflow_23.batchBroadcast,
136
+ workflow_23.batchCancel,
137
+ workflow_23.child,
138
+ workflow_23.childBatch,
139
+ workflow_23.batchChildSpawn,
140
+ workflow_23.batchChildBatchSpawn,
137
141
  ];
138
142
  function main() {
139
143
  return __awaiter(this, void 0, void 0, function* () {
package/v1/task.d.ts CHANGED
@@ -11,7 +11,7 @@ export { ConcurrencyLimitStrategy, WorkerLabelComparator };
11
11
  */
12
12
  export type Concurrency = {
13
13
  /**
14
- * required the CEL expression to use for concurrency
14
+ * required: the CEL expression to use for concurrency
15
15
  *
16
16
  * @example
17
17
  * ```
@@ -20,17 +20,38 @@ export type Concurrency = {
20
20
  */
21
21
  expression: string;
22
22
  /**
23
- * (optional) the maximum number of concurrent workflow runs
23
+ * (optional) the maximum number of concurrent runs: a fixed number, or a CEL
24
+ * expression over task input computing the max runs for that task's concurrency
25
+ * group. With an expression, a group's effective limit is the value from its most
26
+ * recently created task.
24
27
  *
25
28
  * default: 1
29
+ *
30
+ * @example
31
+ * ```
32
+ * maxRuns: 5
33
+ * maxRuns: "input.tier == 'premium' ? 10 : 1"
34
+ * ```
26
35
  */
27
- maxRuns?: number;
36
+ maxRuns?: number | string;
28
37
  /**
29
38
  * (optional) the strategy to use when the concurrency limit is reached
30
39
  *
31
40
  * default: CANCEL_IN_PROGRESS
32
41
  */
33
42
  limitStrategy?: ConcurrencyLimitStrategy;
43
+ /**
44
+ * (required when isTenantScoped) the strategy name; unique per tenant for tenant-scoped
45
+ * strategies
46
+ */
47
+ name?: string;
48
+ /**
49
+ * (optional) when true, the entry defines (or updates in place) a tenant-scoped strategy
50
+ * shared across workflows, keyed by name: every task declaring the same name consumes
51
+ * the same concurrency limit. The position in the concurrency list is the chain order,
52
+ * and chains sharing tenant-scoped strategies must order them consistently.
53
+ */
54
+ isTenantScoped?: boolean;
34
55
  };
35
56
  /**
36
57
  * @deprecated use Concurrency instead
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const HATCHET_VERSION = "1.30.1";
1
+ export declare const HATCHET_VERSION = "1.31.0";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HATCHET_VERSION = void 0;
4
- exports.HATCHET_VERSION = '1.30.1';
4
+ exports.HATCHET_VERSION = '1.31.0';