@hatchet-dev/typescript-sdk 1.15.2 → 1.17.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.
Files changed (202) hide show
  1. package/README.md +14 -2
  2. package/clients/admin/admin-client.d.ts +2 -2
  3. package/clients/admin/admin-client.js +8 -9
  4. package/clients/dispatcher/action-listener.d.ts +3 -6
  5. package/clients/dispatcher/action-listener.js +54 -23
  6. package/clients/dispatcher/dispatcher-client.js +5 -8
  7. package/clients/dispatcher/heartbeat/heartbeat-worker.js +7 -4
  8. package/clients/event/event-client.d.ts +2 -2
  9. package/clients/event/event-client.js +5 -11
  10. package/clients/hatchet-client/hatchet-logger.js +8 -17
  11. package/clients/listeners/durable-listener/durable-listener-client.d.ts +115 -15
  12. package/clients/listeners/durable-listener/durable-listener-client.js +769 -19
  13. package/clients/listeners/durable-listener/pooled-durable-listener-client.js +11 -22
  14. package/clients/listeners/run-listener/child-listener-client.d.ts +1 -1
  15. package/clients/listeners/run-listener/child-listener-client.js +34 -30
  16. package/clients/listeners/run-listener/pooled-child-listener-client.js +9 -19
  17. package/clients/rest/generated/Api.d.ts +25 -1
  18. package/clients/rest/generated/Api.js +20 -0
  19. package/clients/rest/generated/data-contracts.d.ts +60 -1
  20. package/clients/rest/generated/data-contracts.js +9 -1
  21. package/legacy/examples/affinity-workers.js +2 -3
  22. package/legacy/examples/byo-logger.js +0 -2
  23. package/legacy/examples/concurrency/cancel-in-progress/concurrency-worker.js +4 -2
  24. package/legacy/examples/concurrency/group-round-robin/concurrency-event.js +0 -1
  25. package/legacy/examples/concurrency/group-round-robin/concurrency-worker-expression.js +4 -2
  26. package/legacy/examples/concurrency/group-round-robin/concurrency-worker-key-fn.js +4 -2
  27. package/legacy/examples/example-event.js +0 -3
  28. package/legacy/examples/logger.js +0 -1
  29. package/legacy/examples/sticky-worker-with-check.js +0 -1
  30. package/legacy/examples/sticky-worker.js +0 -1
  31. package/legacy/legacy-client.js +2 -2
  32. package/legacy/legacy-transformer.js +2 -4
  33. package/legacy/step.d.ts +16 -16
  34. package/legacy/step.js +8 -17
  35. package/legacy/workflow.d.ts +81 -81
  36. package/package.json +20 -29
  37. package/protoc/dispatcher/dispatcher.d.ts +20 -0
  38. package/protoc/dispatcher/dispatcher.js +136 -2
  39. package/protoc/v1/dispatcher.d.ts +168 -0
  40. package/protoc/v1/dispatcher.js +1920 -1
  41. package/protoc/v1/shared/trigger.d.ts +89 -0
  42. package/protoc/v1/shared/trigger.js +493 -0
  43. package/protoc/v1/workflows.d.ts +34 -34
  44. package/protoc/v1/workflows.js +252 -200
  45. package/protoc/workflows/workflows.d.ts +2 -75
  46. package/protoc/workflows/workflows.js +16 -491
  47. package/util/abort-error.d.ts +15 -1
  48. package/util/abort-error.js +30 -5
  49. package/util/config-loader/config-loader.js +4 -3
  50. package/util/config-loader/token.js +9 -2
  51. package/util/errors/eviction-not-supported-error.d.ts +5 -0
  52. package/util/errors/eviction-not-supported-error.js +18 -0
  53. package/util/errors/hatchet-error.d.ts +9 -1
  54. package/util/errors/hatchet-error.js +23 -2
  55. package/util/errors/non-determinism-error.d.ts +7 -0
  56. package/util/errors/non-determinism-error.js +21 -0
  57. package/util/errors/task-run-terminated-error.d.ts +6 -0
  58. package/util/errors/task-run-terminated-error.js +15 -0
  59. package/util/grpc-error.d.ts +9 -0
  60. package/util/grpc-error.js +25 -0
  61. package/util/hatchet-promise/hatchet-promise.d.ts +6 -1
  62. package/util/hatchet-promise/hatchet-promise.js +16 -2
  63. package/util/logger/logger.js +0 -1
  64. package/util/parse.d.ts +1 -1
  65. package/util/parse.js +4 -2
  66. package/util/retrier.js +2 -3
  67. package/util/sleep.d.ts +3 -2
  68. package/util/sleep.js +6 -4
  69. package/util/workflow-run-ref.js +5 -3
  70. package/v1/client/admin.d.ts +2 -2
  71. package/v1/client/admin.js +2 -6
  72. package/v1/client/client.d.ts +7 -11
  73. package/v1/client/client.interface.d.ts +5 -8
  74. package/v1/client/client.js +34 -40
  75. package/v1/client/duration.d.ts +11 -1
  76. package/v1/client/duration.js +44 -0
  77. package/v1/client/features/cel.js +1 -1
  78. package/v1/client/features/crons.js +2 -2
  79. package/v1/client/features/index.d.ts +5 -0
  80. package/v1/client/features/index.js +5 -0
  81. package/v1/client/features/logs.d.ts +37 -0
  82. package/v1/client/features/logs.js +46 -0
  83. package/v1/client/features/runs.d.ts +16 -3
  84. package/v1/client/features/runs.js +38 -4
  85. package/v1/client/features/schedules.js +4 -4
  86. package/v1/client/features/webhooks.js +4 -2
  87. package/v1/client/features/workflows.js +1 -1
  88. package/v1/client/worker/context.d.ts +101 -6
  89. package/v1/client/worker/context.js +257 -44
  90. package/v1/client/worker/deprecated/deprecation.js +8 -4
  91. package/v1/client/worker/deprecated/index.d.ts +1 -1
  92. package/v1/client/worker/deprecated/index.js +2 -1
  93. package/v1/client/worker/deprecated/legacy-worker.d.ts +5 -0
  94. package/v1/client/worker/deprecated/legacy-worker.js +33 -24
  95. package/v1/client/worker/deprecated/pre-eviction.d.ts +12 -0
  96. package/v1/client/worker/deprecated/pre-eviction.js +37 -0
  97. package/v1/client/worker/engine-version.d.ts +5 -0
  98. package/v1/client/worker/engine-version.js +14 -0
  99. package/v1/client/worker/eviction/eviction-cache.d.ts +33 -0
  100. package/v1/client/worker/eviction/eviction-cache.js +139 -0
  101. package/v1/client/worker/eviction/eviction-manager.d.ts +42 -0
  102. package/v1/client/worker/eviction/eviction-manager.js +132 -0
  103. package/v1/client/worker/eviction/eviction-policy.d.ts +19 -0
  104. package/v1/client/worker/eviction/eviction-policy.js +8 -0
  105. package/v1/client/worker/eviction/index.d.ts +3 -0
  106. package/v1/client/worker/eviction/index.js +11 -0
  107. package/v1/client/worker/health-server.js +3 -3
  108. package/v1/client/worker/slot-utils.js +0 -3
  109. package/v1/client/worker/worker-internal.d.ts +23 -4
  110. package/v1/client/worker/worker-internal.js +216 -148
  111. package/v1/client/worker/worker.d.ts +1 -0
  112. package/v1/client/worker/worker.js +34 -0
  113. package/v1/conditions/base.js +0 -1
  114. package/v1/conditions/index.js +2 -4
  115. package/v1/conditions/sleep-condition.js +2 -1
  116. package/v1/conditions/transformer.js +2 -1
  117. package/v1/declaration.d.ts +6 -4
  118. package/v1/declaration.js +20 -7
  119. package/v1/examples/__e2e__/harness.d.ts +5 -0
  120. package/v1/examples/__e2e__/harness.js +17 -3
  121. package/v1/examples/affinity/affinity-workers.js +0 -1
  122. package/v1/examples/bulk_operations/workflow.js +0 -1
  123. package/v1/examples/cancellation/run.js +0 -1
  124. package/v1/examples/cancellations/run.js +0 -1
  125. package/v1/examples/child_workflows/run.js +0 -2
  126. package/v1/examples/child_workflows/workflow.js +0 -1
  127. package/v1/examples/concurrency-rr/load.js +0 -1
  128. package/v1/examples/concurrency-rr/run.js +0 -3
  129. package/v1/examples/concurrency_limit_rr/load.js +0 -1
  130. package/v1/examples/concurrency_limit_rr/run.js +0 -3
  131. package/v1/examples/concurrency_workflow_level/workflow.d.ts +1 -1
  132. package/v1/examples/concurrency_workflow_level/workflow.js +1 -1
  133. package/v1/examples/conditions/event.js +0 -1
  134. package/v1/examples/conditions/run.js +0 -1
  135. package/v1/examples/dag/run.js +0 -1
  136. package/v1/examples/dag_match_condition/event.js +0 -1
  137. package/v1/examples/dag_match_condition/run.js +0 -1
  138. package/v1/examples/deep/run.js +0 -2
  139. package/v1/examples/durable/workflow.d.ts +57 -0
  140. package/v1/examples/durable/workflow.js +164 -10
  141. package/v1/examples/durable-event/event.js +0 -1
  142. package/v1/examples/durable-event/run.js +0 -2
  143. package/v1/examples/durable-event/workflow.js +2 -7
  144. package/v1/examples/durable-sleep/event.js +0 -1
  145. package/v1/examples/durable-sleep/run.js +0 -2
  146. package/v1/examples/durable_event/event.js +0 -1
  147. package/v1/examples/durable_event/run.js +0 -2
  148. package/v1/examples/durable_event/workflow.d.ts +1 -0
  149. package/v1/examples/durable_event/workflow.js +4 -9
  150. package/v1/examples/durable_eviction/capacity-worker.d.ts +1 -0
  151. package/v1/examples/durable_eviction/capacity-worker.js +31 -0
  152. package/v1/examples/durable_eviction/worker.d.ts +1 -0
  153. package/v1/examples/durable_eviction/worker.js +34 -0
  154. package/v1/examples/durable_eviction/workflow.d.ts +44 -0
  155. package/v1/examples/durable_eviction/workflow.js +129 -0
  156. package/v1/examples/durable_sleep/event.js +0 -1
  157. package/v1/examples/durable_sleep/run.js +0 -2
  158. package/v1/examples/e2e-worker.js +42 -19
  159. package/v1/examples/events/event.js +0 -1
  160. package/v1/examples/high-memory/run.js +0 -1
  161. package/v1/examples/inferred-typing/run.js +0 -1
  162. package/v1/examples/landing_page/durable-excution.js +0 -1
  163. package/v1/examples/landing_page/queues.js +0 -1
  164. package/v1/examples/legacy/run.js +0 -1
  165. package/v1/examples/logger/byo-logger.js +0 -2
  166. package/v1/examples/logger/logger.js +0 -1
  167. package/v1/examples/logging/byo-logger.js +0 -2
  168. package/v1/examples/logging/logger.js +0 -1
  169. package/v1/examples/middleware/recipes.js +3 -1
  170. package/v1/examples/migration-guides/mergent.js +2 -1
  171. package/v1/examples/multiple_wf_concurrency/run.js +0 -3
  172. package/v1/examples/non_retryable/run.js +0 -1
  173. package/v1/examples/on_event/event.js +0 -1
  174. package/v1/examples/on_failure/run.js +0 -1
  175. package/v1/examples/on_failure/workflow.js +0 -1
  176. package/v1/examples/on_success/run.js +0 -1
  177. package/v1/examples/on_success/workflow.js +0 -1
  178. package/v1/examples/priority/run.js +0 -1
  179. package/v1/examples/priority/workflow.js +0 -1
  180. package/v1/examples/retries/run.js +0 -1
  181. package/v1/examples/retries/workflow.js +0 -1
  182. package/v1/examples/simple/bulk.js +0 -1
  183. package/v1/examples/simple/cron.js +0 -2
  184. package/v1/examples/simple/delay.js +0 -1
  185. package/v1/examples/simple/enqueue.js +0 -2
  186. package/v1/examples/simple/run.js +0 -1
  187. package/v1/examples/simple/schedule.js +0 -1
  188. package/v1/examples/simple/workflow-with-child.js +10 -4
  189. package/v1/examples/sticky/run.js +0 -1
  190. package/v1/examples/sticky/workflow.js +0 -1
  191. package/v1/examples/streaming/nextjs-proxy.js +0 -1
  192. package/v1/examples/streaming/run.js +0 -1
  193. package/v1/examples/timeout/run.js +0 -1
  194. package/v1/examples/timeouts/run.js +0 -1
  195. package/v1/index.d.ts +5 -0
  196. package/v1/index.js +10 -0
  197. package/v1/parent-run-context-vars.d.ts +6 -0
  198. package/v1/slot-types.js +0 -1
  199. package/v1/task.d.ts +10 -2
  200. package/v1/task.js +2 -1
  201. package/version.d.ts +1 -1
  202. package/version.js +1 -1
@@ -31,7 +31,6 @@ const workflow = {
31
31
  name: 'logger-step1',
32
32
  run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
33
33
  // log in a for loop
34
- // eslint-disable-next-line no-plusplus
35
34
  for (let i = 0; i < 10; i++) {
36
35
  ctx.logger.info(`log message ${i}`);
37
36
  yield sleep(200);
@@ -25,7 +25,6 @@ const workflow = {
25
25
  const results = [];
26
26
  const count = 57;
27
27
  hardChildWorkerId = undefined; // we reset this - if we run this multiple times at the same time it will break
28
- // eslint-disable-next-line no-plusplus
29
28
  for (let i = 0; i < count; i++) {
30
29
  const result = yield ctx.spawnWorkflow(childWorkflow, {}, { sticky: true });
31
30
  results.push(result.output);
@@ -24,7 +24,6 @@ const workflow = {
24
24
  name: 'step1',
25
25
  run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  const results = [];
27
- // eslint-disable-next-line no-plusplus
28
27
  for (let i = 0; i < 50; i++) {
29
28
  const result = yield ctx.spawnWorkflow(childWorkflow, {}, { sticky: true });
30
29
  results.push(result.result());
@@ -35,7 +35,7 @@ class LegacyHatchetClient {
35
35
  }
36
36
  catch (e) {
37
37
  if (e instanceof zod_1.z.ZodError) {
38
- throw new Error(`Invalid client config: ${e.message}`);
38
+ throw new Error(`Invalid client config: ${e.message}`, { cause: e });
39
39
  }
40
40
  throw e;
41
41
  }
@@ -56,7 +56,7 @@ class LegacyHatchetClient {
56
56
  this.admin = new admin_client_1.AdminClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this.api, this.tenantId, this.listener, this.runs);
57
57
  this.durableListener =
58
58
  durableListener ||
59
- new durable_listener_client_1.DurableListenerClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this.api);
59
+ new durable_listener_client_1.DurableListenerClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory);
60
60
  this.logger = logger || this.config.logger('HatchetClient', this.config.log_level);
61
61
  this.logger.debug(`Initialized HatchetClient`);
62
62
  }
@@ -76,7 +76,6 @@ function transformLegacyWorkflow(workflow) {
76
76
  for (const step of workflow.steps) {
77
77
  const taskOpts = legacyStepToTaskOpts(step, taskMap, workflow.timeout);
78
78
  taskMap[step.name] = taskOpts;
79
- // eslint-disable-next-line no-underscore-dangle
80
79
  declaration.definition._tasks.push(taskOpts);
81
80
  }
82
81
  // Handle onFailure
@@ -116,9 +115,7 @@ function wrapLegacyStepRun(step) {
116
115
  return (input, ctx) => {
117
116
  // Access the V1Worker from the ContextWorker's private field.
118
117
  // This is intentionally accessing a private field for legacy compatibility.
119
- // eslint-disable-next-line no-underscore-dangle
120
118
  const v1Worker = ctx.worker.worker;
121
- // eslint-disable-next-line no-underscore-dangle
122
119
  const v0ctx = new step_1.V0Context(ctx.action, ctx.v1.v0, v1Worker);
123
120
  // Share the abort controller so cancellation propagates
124
121
  v0ctx.controller = ctx.controller;
@@ -129,8 +126,9 @@ function wrapLegacyStepRun(step) {
129
126
  * Maps legacy rate limits to v1 format.
130
127
  */
131
128
  function mapLegacyRateLimits(limits) {
132
- if (!limits)
129
+ if (!limits) {
133
130
  return undefined;
131
+ }
134
132
  return limits.map((l) => ({
135
133
  staticKey: l.staticKey || l.key,
136
134
  dynamicKey: l.dynamicKey,
package/legacy/step.d.ts CHANGED
@@ -6,8 +6,8 @@ import { LogLevel } from '../clients/event/event-client';
6
6
  import { Logger } from '../util/logger';
7
7
  import WorkflowRunRef from '../util/workflow-run-ref';
8
8
  import { WorkerLabels } from '../clients/dispatcher/dispatcher-client';
9
- import { CreateStepRateLimit, RateLimitDuration, WorkerLabelComparator } from '../protoc/workflows';
10
- import { CreateWorkflowTaskOpts, Priority } from '../v1';
9
+ import { CreateStepRateLimit, RateLimitDuration } from '../protoc/workflows';
10
+ import { CreateWorkflowTaskOpts, Priority, WorkerLabelComparator } from '../v1';
11
11
  import { RunOpts, TaskWorkflowDeclaration, BaseWorkflowDeclaration as WorkflowV1 } from '../v1/declaration';
12
12
  import { Conditions } from '../v1/conditions';
13
13
  import { Duration } from '../v1/client/duration';
@@ -25,16 +25,16 @@ export declare const CreateRateLimitSchema: z.ZodObject<{
25
25
  units: string | number;
26
26
  key?: string | undefined;
27
27
  duration?: RateLimitDuration | undefined;
28
+ limit?: string | number | undefined;
28
29
  staticKey?: string | undefined;
29
30
  dynamicKey?: string | undefined;
30
- limit?: string | number | undefined;
31
31
  }, {
32
32
  units: string | number;
33
33
  key?: string | undefined;
34
34
  duration?: RateLimitDuration | undefined;
35
+ limit?: string | number | undefined;
35
36
  staticKey?: string | undefined;
36
37
  dynamicKey?: string | undefined;
37
- limit?: string | number | undefined;
38
38
  }>;
39
39
  export declare const DesiredWorkerLabelSchema: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
40
40
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -68,16 +68,16 @@ export declare const CreateStepSchema: z.ZodObject<{
68
68
  units: string | number;
69
69
  key?: string | undefined;
70
70
  duration?: RateLimitDuration | undefined;
71
+ limit?: string | number | undefined;
71
72
  staticKey?: string | undefined;
72
73
  dynamicKey?: string | undefined;
73
- limit?: string | number | undefined;
74
74
  }, {
75
75
  units: string | number;
76
76
  key?: string | undefined;
77
77
  duration?: RateLimitDuration | undefined;
78
+ limit?: string | number | undefined;
78
79
  staticKey?: string | undefined;
79
80
  dynamicKey?: string | undefined;
80
- limit?: string | number | undefined;
81
81
  }>, "many">>;
82
82
  worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
83
83
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -110,13 +110,17 @@ export declare const CreateStepSchema: z.ZodObject<{
110
110
  timeout?: string | undefined;
111
111
  parents?: string[] | undefined;
112
112
  retries?: number | undefined;
113
+ backoff?: {
114
+ factor?: number | undefined;
115
+ maxSeconds?: number | undefined;
116
+ } | undefined;
113
117
  rate_limits?: {
114
118
  units: string | number;
115
119
  key?: string | undefined;
116
120
  duration?: RateLimitDuration | undefined;
121
+ limit?: string | number | undefined;
117
122
  staticKey?: string | undefined;
118
123
  dynamicKey?: string | undefined;
119
- limit?: string | number | undefined;
120
124
  }[] | undefined;
121
125
  worker_labels?: Record<string, string | number | {
122
126
  value: string | number;
@@ -124,22 +128,22 @@ export declare const CreateStepSchema: z.ZodObject<{
124
128
  comparator?: WorkerLabelComparator | undefined;
125
129
  weight?: number | undefined;
126
130
  } | undefined> | undefined;
127
- backoff?: {
128
- factor?: number | undefined;
129
- maxSeconds?: number | undefined;
130
- } | undefined;
131
131
  }, {
132
132
  name: string;
133
133
  timeout?: string | undefined;
134
134
  parents?: string[] | undefined;
135
135
  retries?: number | undefined;
136
+ backoff?: {
137
+ factor?: number | undefined;
138
+ maxSeconds?: number | undefined;
139
+ } | undefined;
136
140
  rate_limits?: {
137
141
  units: string | number;
138
142
  key?: string | undefined;
139
143
  duration?: RateLimitDuration | undefined;
144
+ limit?: string | number | undefined;
140
145
  staticKey?: string | undefined;
141
146
  dynamicKey?: string | undefined;
142
- limit?: string | number | undefined;
143
147
  }[] | undefined;
144
148
  worker_labels?: Record<string, string | number | {
145
149
  value: string | number;
@@ -147,10 +151,6 @@ export declare const CreateStepSchema: z.ZodObject<{
147
151
  comparator?: WorkerLabelComparator | undefined;
148
152
  weight?: number | undefined;
149
153
  } | undefined> | undefined;
150
- backoff?: {
151
- factor?: number | undefined;
152
- maxSeconds?: number | undefined;
153
- } | undefined;
154
154
  }>;
155
155
  export type NextStep = {
156
156
  [key: string]: JsonValue;
package/legacy/step.js CHANGED
@@ -47,8 +47,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.V0DurableContext = exports.V0Context = exports.V0ContextWorker = exports.CreateStepSchema = exports.DesiredWorkerLabelSchema = exports.CreateRateLimitSchema = void 0;
49
49
  exports.mapRateLimit = mapRateLimit;
50
- /* eslint-disable no-underscore-dangle */
51
- /* eslint-disable max-classes-per-file */
52
50
  const hatchet_error_1 = __importDefault(require("../util/errors/hatchet-error"));
53
51
  const z = __importStar(require("zod"));
54
52
  const parse_1 = require("../util/parse");
@@ -58,6 +56,7 @@ const declaration_1 = require("../v1/declaration");
58
56
  const conditions_1 = require("../v1/conditions");
59
57
  const condition_1 = require("../protoc/v1/shared/condition");
60
58
  const transformer_1 = require("../v1/conditions/transformer");
59
+ const duration_1 = require("../v1/client/duration");
61
60
  const apply_namespace_1 = require("../util/apply-namespace");
62
61
  exports.CreateRateLimitSchema = z.object({
63
62
  key: z.string().optional(),
@@ -78,7 +77,7 @@ exports.DesiredWorkerLabelSchema = z
78
77
  // (optional) comparator for the label
79
78
  // if not provided, the default is EQUAL
80
79
  // desired COMPARATOR actual (i.e. desired > actual for GREATER_THAN)
81
- comparator: z.nativeEnum(workflows_1.WorkerLabelComparator).optional(),
80
+ comparator: z.nativeEnum(v1_1.WorkerLabelComparator).optional(),
82
81
  }),
83
82
  ])
84
83
  .optional();
@@ -325,7 +324,7 @@ class V0Context {
325
324
  this.logger.warn('cannot refresh timeout from context without stepRunId');
326
325
  return;
327
326
  }
328
- yield this.v0.dispatcher.refreshTimeout(incrementBy, taskRunExternalId);
327
+ yield this.v0.dispatcher.refreshTimeout((0, duration_1.durationToString)(incrementBy), taskRunExternalId);
329
328
  });
330
329
  }
331
330
  /**
@@ -421,7 +420,6 @@ class V0Context {
421
420
  resp.forEach((ref, index) => {
422
421
  const wf = workflows[index].workflow;
423
422
  if (wf instanceof declaration_1.TaskWorkflowDeclaration) {
424
- // eslint-disable-next-line no-param-reassign
425
423
  ref._standaloneTaskName = wf._standalone_task_name;
426
424
  }
427
425
  res.push(ref);
@@ -472,13 +470,7 @@ class V0Context {
472
470
  spawnWorkflow(workflow, input, options) {
473
471
  return __awaiter(this, void 0, void 0, function* () {
474
472
  const { workflowRunId, taskRunExternalId } = this.action;
475
- let workflowName = '';
476
- if (typeof workflow === 'string') {
477
- workflowName = workflow;
478
- }
479
- else {
480
- workflowName = workflow.id;
481
- }
473
+ const workflowName = typeof workflow === 'string' ? workflow : workflow.id;
482
474
  const name = (0, apply_namespace_1.applyNamespace)(workflowName, this.v0.config.namespace);
483
475
  const opts = options || {};
484
476
  const { sticky } = opts;
@@ -570,7 +562,6 @@ class V0DurableContext extends V0Context {
570
562
  waitFor(conditions) {
571
563
  return __awaiter(this, void 0, void 0, function* () {
572
564
  const pbConditions = (0, transformer_1.conditionsToPb)((0, conditions_1.Render)(condition_1.Action.CREATE, conditions), this.v0.config.namespace);
573
- // eslint-disable-next-line no-plusplus
574
565
  const key = `waitFor-${this.waitKey++}`;
575
566
  yield this.v0.durableListener.registerDurableEvent({
576
567
  taskId: this.action.taskRunExternalId,
@@ -592,15 +583,15 @@ class V0DurableContext extends V0Context {
592
583
  }
593
584
  exports.V0DurableContext = V0DurableContext;
594
585
  function mapRateLimit(limits) {
595
- if (!limits)
586
+ if (!limits) {
596
587
  return [];
588
+ }
597
589
  return limits.map((l) => {
598
590
  let key = l.staticKey;
599
591
  const keyExpression = l.dynamicKey;
600
592
  if (l.key !== undefined) {
601
- // eslint-disable-next-line no-console
602
593
  console.warn('key is deprecated and will be removed in a future release, please use staticKey instead');
603
- key = l.key;
594
+ ({ key } = l);
604
595
  }
605
596
  if (keyExpression !== undefined) {
606
597
  if (key !== undefined) {
@@ -617,7 +608,7 @@ function mapRateLimit(limits) {
617
608
  let units;
618
609
  let unitsExpression;
619
610
  if (typeof l.units === 'number') {
620
- units = l.units;
611
+ ({ units } = l);
621
612
  }
622
613
  else {
623
614
  if (!validateCelExpression(l.units)) {