@hatchet-dev/typescript-sdk 0.7.2 → 0.8.0-alpha.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.
@@ -4,6 +4,8 @@ import { StepActionEvent, StepActionEventType, GroupKeyActionEvent, GroupKeyActi
4
4
  import HatchetPromise from '../../util/hatchet-promise/hatchet-promise';
5
5
  import { Workflow } from '../../workflow';
6
6
  import { Logger } from '../../util/logger';
7
+ import { WebhookHandler } from './handler';
8
+ import { WebhookWorkerCreateRequest } from '../rest/generated/data-contracts';
7
9
  import { Context, StepRunFunction } from '../../step';
8
10
  export type ActionRegistry = Record<Action['actionId'], Function>;
9
11
  export declare class Worker {
@@ -18,20 +20,25 @@ export declare class Worker {
18
20
  maxRuns?: number;
19
21
  logger: Logger;
20
22
  registeredWorkflowPromises: Array<Promise<any>>;
23
+ registeredWorkflowIds: string[];
21
24
  constructor(client: HatchetClient, options: {
22
25
  name: string;
23
26
  handleKill?: boolean;
24
27
  maxRuns?: number;
25
28
  });
29
+ private registerActions;
30
+ getHandler(workflow: Workflow): WebhookHandler;
31
+ registerWebhook(webhook: WebhookWorkerCreateRequest): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WebhookWorker, any>>;
26
32
  registerWorkflow(initWorkflow: Workflow): Promise<void>;
27
33
  register_workflow(initWorkflow: Workflow): Promise<void>;
28
34
  registerAction<T, K>(actionId: string, action: StepRunFunction<T, K>): void;
29
- handleStartStepRun(action: Action): void;
30
- handleStartGroupKeyRun(action: Action): void;
35
+ handleStartStepRun(action: Action): Promise<void>;
36
+ handleStartGroupKeyRun(action: Action): Promise<void>;
31
37
  getStepActionEvent(action: Action, eventType: StepActionEventType, payload?: any): StepActionEvent;
32
38
  getGroupKeyActionEvent(action: Action, eventType: GroupKeyActionEventType, payload?: any): GroupKeyActionEvent;
33
- handleCancelStepRun(action: Action): void;
39
+ handleCancelStepRun(action: Action): Promise<void>;
34
40
  stop(): Promise<void>;
35
41
  exitGracefully(handleKill: boolean): Promise<void>;
36
42
  start(): Promise<void>;
43
+ handleAction(action: Action): Promise<void>;
37
44
  }
@@ -25,13 +25,14 @@ const dispatcher_1 = require("../../protoc/dispatcher");
25
25
  const hatchet_promise_1 = __importDefault(require("../../util/hatchet-promise/hatchet-promise"));
26
26
  const workflows_1 = require("../../protoc/workflows");
27
27
  const logger_1 = require("../../util/logger");
28
- // import sleep from '../../util/sleep.js';
28
+ const handler_1 = require("./handler");
29
29
  const step_1 = require("../../step");
30
30
  class Worker {
31
31
  constructor(client, options) {
32
32
  this.futures = {};
33
33
  this.contexts = {};
34
34
  this.registeredWorkflowPromises = [];
35
+ this.registeredWorkflowIds = [];
35
36
  this.client = client;
36
37
  this.name = this.client.config.namespace + options.name;
37
38
  this.action_registry = {};
@@ -42,6 +43,31 @@ class Worker {
42
43
  this.handle_kill = options.handleKill === undefined ? true : options.handleKill;
43
44
  this.logger = new logger_1.Logger(`Worker/${this.name}`, this.client.config.log_level);
44
45
  }
46
+ registerActions(workflow) {
47
+ var _a;
48
+ const newActions = workflow.steps.reduce((acc, step) => {
49
+ acc[`${workflow.id}:${step.name}`] = step.run;
50
+ return acc;
51
+ }, {});
52
+ const onFailureAction = workflow.onFailure
53
+ ? {
54
+ [`${workflow.id}-on-failure:${workflow.onFailure.name}`]: workflow.onFailure.run,
55
+ }
56
+ : {};
57
+ this.action_registry = Object.assign(Object.assign(Object.assign({}, this.action_registry), newActions), onFailureAction);
58
+ this.action_registry = ((_a = workflow.concurrency) === null || _a === void 0 ? void 0 : _a.name)
59
+ ? Object.assign(Object.assign({}, this.action_registry), { [`${workflow.id}:${workflow.concurrency.name}`]: workflow.concurrency.key }) : Object.assign({}, this.action_registry);
60
+ }
61
+ getHandler(workflow) {
62
+ const wf = Object.assign(Object.assign({}, workflow), { id: this.client.config.namespace + workflow.id });
63
+ this.registerActions(wf);
64
+ return new handler_1.WebhookHandler(this);
65
+ }
66
+ registerWebhook(webhook) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ return this.client.admin.webhook_create(Object.assign(Object.assign({}, webhook), { workflows: this.registeredWorkflowIds }));
69
+ });
70
+ }
45
71
  // @deprecated
46
72
  registerWorkflow(initWorkflow) {
47
73
  return __awaiter(this, void 0, void 0, function* () {
@@ -50,7 +76,7 @@ class Worker {
50
76
  }
51
77
  register_workflow(initWorkflow) {
52
78
  return __awaiter(this, void 0, void 0, function* () {
53
- var _a, _b, _c;
79
+ var _a, _b;
54
80
  const workflow = Object.assign(Object.assign({}, initWorkflow), { id: this.client.config.namespace + initWorkflow.id });
55
81
  try {
56
82
  const concurrency = ((_a = workflow.concurrency) === null || _a === void 0 ? void 0 : _a.name)
@@ -78,6 +104,7 @@ class Worker {
78
104
  ],
79
105
  }
80
106
  : undefined;
107
+ this.registeredWorkflowIds.push(workflow.id);
81
108
  const registeredWorkflow = this.client.admin.put_workflow({
82
109
  name: workflow.id,
83
110
  description: workflow.description,
@@ -114,140 +141,139 @@ class Worker {
114
141
  catch (e) {
115
142
  throw new hatchet_error_1.default(`Could not register workflow: ${e.message}`);
116
143
  }
117
- const newActions = workflow.steps.reduce((acc, step) => {
118
- acc[`${workflow.id}:${step.name}`] = step.run;
119
- return acc;
120
- }, {});
121
- const onFailureAction = workflow.onFailure
122
- ? {
123
- [`${workflow.id}-on-failure:${workflow.onFailure.name}`]: workflow.onFailure.run,
124
- }
125
- : {};
126
- this.action_registry = Object.assign(Object.assign(Object.assign({}, this.action_registry), newActions), onFailureAction);
127
- this.action_registry = ((_c = workflow.concurrency) === null || _c === void 0 ? void 0 : _c.name)
128
- ? Object.assign(Object.assign({}, this.action_registry), { [`${workflow.id}:${workflow.concurrency.name}`]: workflow.concurrency.key }) : Object.assign({}, this.action_registry);
144
+ this.registerActions(workflow);
129
145
  });
130
146
  }
131
147
  registerAction(actionId, action) {
132
148
  this.action_registry[actionId] = action;
133
149
  }
134
150
  handleStartStepRun(action) {
135
- const { actionId } = action;
136
- try {
137
- const context = new step_1.Context(action, this.client);
138
- this.contexts[action.stepRunId] = context;
139
- const step = this.action_registry[actionId];
140
- if (!step) {
141
- this.logger.error(`Could not find step '${actionId}'`);
142
- return;
143
- }
144
- const run = () => __awaiter(this, void 0, void 0, function* () {
145
- return step(context);
146
- });
147
- const success = (result) => {
148
- this.logger.info(`Step run ${action.stepRunId} succeeded`);
149
- try {
150
- // Send the action event to the dispatcher
151
- const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_COMPLETED, result);
152
- this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
153
- this.logger.error(`Could not send action event: ${e.message}`);
154
- });
155
- // delete the run from the futures
156
- delete this.futures[action.stepRunId];
157
- }
158
- catch (e) {
159
- this.logger.error(`Could not send action event: ${e.message}`);
160
- }
161
- };
162
- const failure = (error) => {
163
- this.logger.error(`Step run ${action.stepRunId} failed: ${error.message}`);
164
- if (error.stack) {
165
- this.logger.error(error.stack);
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ const { actionId } = action;
153
+ try {
154
+ const context = new step_1.Context(action, this.client);
155
+ this.contexts[action.stepRunId] = context;
156
+ const step = this.action_registry[actionId];
157
+ if (!step) {
158
+ this.logger.error(`Could not find step '${actionId}'`);
159
+ return;
166
160
  }
167
- try {
168
- // Send the action event to the dispatcher
169
- const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_FAILED, {
170
- message: error === null || error === void 0 ? void 0 : error.message,
171
- stack: error === null || error === void 0 ? void 0 : error.stack,
172
- });
173
- this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
161
+ const run = () => __awaiter(this, void 0, void 0, function* () {
162
+ return step(context);
163
+ });
164
+ const success = (result) => {
165
+ this.logger.info(`Step run ${action.stepRunId} succeeded`);
166
+ try {
167
+ // Send the action event to the dispatcher
168
+ const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_COMPLETED, result);
169
+ this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
170
+ this.logger.error(`Could not send action event: ${e.message}`);
171
+ });
172
+ // delete the run from the futures
173
+ delete this.futures[action.stepRunId];
174
+ }
175
+ catch (e) {
174
176
  this.logger.error(`Could not send action event: ${e.message}`);
175
- });
176
- // delete the run from the futures
177
- delete this.futures[action.stepRunId];
178
- }
179
- catch (e) {
177
+ }
178
+ };
179
+ const failure = (error) => {
180
+ this.logger.error(`Step run ${action.stepRunId} failed: ${error.message}`);
181
+ if (error.stack) {
182
+ this.logger.error(error.stack);
183
+ }
184
+ try {
185
+ // Send the action event to the dispatcher
186
+ const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_FAILED, {
187
+ message: error === null || error === void 0 ? void 0 : error.message,
188
+ stack: error === null || error === void 0 ? void 0 : error.stack,
189
+ });
190
+ this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
191
+ this.logger.error(`Could not send action event: ${e.message}`);
192
+ });
193
+ // delete the run from the futures
194
+ delete this.futures[action.stepRunId];
195
+ }
196
+ catch (e) {
197
+ this.logger.error(`Could not send action event: ${e.message}`);
198
+ }
199
+ };
200
+ const future = new hatchet_promise_1.default(run().then(success).catch(failure));
201
+ this.futures[action.stepRunId] = future;
202
+ // Send the action event to the dispatcher
203
+ const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_STARTED);
204
+ this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
180
205
  this.logger.error(`Could not send action event: ${e.message}`);
181
- }
182
- };
183
- const future = new hatchet_promise_1.default(run().then(success).catch(failure));
184
- this.futures[action.stepRunId] = future;
185
- // Send the action event to the dispatcher
186
- const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_STARTED);
187
- this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
206
+ });
207
+ yield future.promise;
208
+ }
209
+ catch (e) {
188
210
  this.logger.error(`Could not send action event: ${e.message}`);
189
- });
190
- }
191
- catch (e) {
192
- this.logger.error(`Could not send action event: ${e.message}`);
193
- }
211
+ }
212
+ });
194
213
  }
195
214
  handleStartGroupKeyRun(action) {
196
- const { actionId } = action;
197
- try {
198
- const context = new step_1.Context(action, this.client);
199
- const key = action.getGroupKeyRunId;
200
- this.contexts[key] = context;
201
- this.logger.debug(`Starting group key run ${key}`);
202
- const step = this.action_registry[actionId];
203
- if (!step) {
204
- this.logger.error(`Could not find step '${actionId}'`);
205
- return;
206
- }
207
- const run = () => __awaiter(this, void 0, void 0, function* () {
208
- return step(context);
209
- });
210
- const success = (result) => {
211
- this.logger.info(`Step run ${action.stepRunId} succeeded`);
212
- try {
213
- // Send the action event to the dispatcher
214
- const event = this.getGroupKeyActionEvent(action, dispatcher_1.GroupKeyActionEventType.GROUP_KEY_EVENT_TYPE_COMPLETED, result);
215
- this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
216
- this.logger.error(`Could not send action event: ${e.message}`);
217
- });
218
- // delete the run from the futures
219
- delete this.futures[key];
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ const { actionId } = action;
217
+ try {
218
+ const context = new step_1.Context(action, this.client);
219
+ const key = action.getGroupKeyRunId;
220
+ if (!key) {
221
+ this.logger.error(`No group key run id provided for action ${actionId}`);
222
+ return;
220
223
  }
221
- catch (e) {
222
- this.logger.error(`Could not send action event: ${e.message}`);
224
+ this.contexts[key] = context;
225
+ this.logger.debug(`Starting group key run ${key}`);
226
+ const step = this.action_registry[actionId];
227
+ if (!step) {
228
+ this.logger.error(`Could not find step '${actionId}'`);
229
+ return;
223
230
  }
224
- };
225
- const failure = (error) => {
226
- this.logger.error(`Step run ${key} failed: ${error.message}`);
227
- try {
228
- // Send the action event to the dispatcher
229
- const event = this.getGroupKeyActionEvent(action, dispatcher_1.GroupKeyActionEventType.GROUP_KEY_EVENT_TYPE_FAILED, error);
230
- this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
231
+ const run = () => __awaiter(this, void 0, void 0, function* () {
232
+ return step(context);
233
+ });
234
+ const success = (result) => {
235
+ this.logger.info(`Step run ${action.stepRunId} succeeded`);
236
+ try {
237
+ // Send the action event to the dispatcher
238
+ const event = this.getGroupKeyActionEvent(action, dispatcher_1.GroupKeyActionEventType.GROUP_KEY_EVENT_TYPE_COMPLETED, result);
239
+ this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
240
+ this.logger.error(`Could not send action event: ${e.message}`);
241
+ });
242
+ // delete the run from the futures
243
+ delete this.futures[key];
244
+ }
245
+ catch (e) {
231
246
  this.logger.error(`Could not send action event: ${e.message}`);
232
- });
233
- // delete the run from the futures
234
- delete this.futures[key];
235
- }
236
- catch (e) {
247
+ }
248
+ };
249
+ const failure = (error) => {
250
+ this.logger.error(`Step run ${key} failed: ${error.message}`);
251
+ try {
252
+ // Send the action event to the dispatcher
253
+ const event = this.getGroupKeyActionEvent(action, dispatcher_1.GroupKeyActionEventType.GROUP_KEY_EVENT_TYPE_FAILED, error);
254
+ this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
255
+ this.logger.error(`Could not send action event: ${e.message}`);
256
+ });
257
+ // delete the run from the futures
258
+ delete this.futures[key];
259
+ }
260
+ catch (e) {
261
+ this.logger.error(`Could not send action event: ${e.message}`);
262
+ }
263
+ };
264
+ const future = new hatchet_promise_1.default(run().then(success).catch(failure));
265
+ this.futures[key] = future;
266
+ // Send the action event to the dispatcher
267
+ const event = this.getGroupKeyActionEvent(action, dispatcher_1.GroupKeyActionEventType.GROUP_KEY_EVENT_TYPE_STARTED);
268
+ this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
237
269
  this.logger.error(`Could not send action event: ${e.message}`);
238
- }
239
- };
240
- const future = new hatchet_promise_1.default(run().then(success).catch(failure));
241
- this.futures[action.getGroupKeyRunId] = future;
242
- // Send the action event to the dispatcher
243
- const event = this.getGroupKeyActionEvent(action, dispatcher_1.GroupKeyActionEventType.GROUP_KEY_EVENT_TYPE_STARTED);
244
- this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
270
+ });
271
+ yield future.promise;
272
+ }
273
+ catch (e) {
245
274
  this.logger.error(`Could not send action event: ${e.message}`);
246
- });
247
- }
248
- catch (e) {
249
- this.logger.error(`Could not send action event: ${e.message}`);
250
- }
275
+ }
276
+ });
251
277
  }
252
278
  getStepActionEvent(action, eventType, payload = '') {
253
279
  return {
@@ -263,6 +289,9 @@ class Worker {
263
289
  };
264
290
  }
265
291
  getGroupKeyActionEvent(action, eventType, payload = '') {
292
+ if (!action.getGroupKeyRunId) {
293
+ throw new hatchet_error_1.default('No group key run id provided');
294
+ }
266
295
  return {
267
296
  workerId: this.name,
268
297
  workflowRunId: action.workflowRunId,
@@ -274,26 +303,29 @@ class Worker {
274
303
  };
275
304
  }
276
305
  handleCancelStepRun(action) {
277
- try {
278
- this.logger.info(`Cancelling step run ${action.stepRunId}`);
279
- const { stepRunId } = action;
280
- const future = this.futures[stepRunId];
281
- const context = this.contexts[stepRunId];
282
- if (context && context.controller) {
283
- context.controller.abort('Cancelled by worker');
284
- delete this.contexts[stepRunId];
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ try {
308
+ this.logger.info(`Cancelling step run ${action.stepRunId}`);
309
+ const { stepRunId } = action;
310
+ const future = this.futures[stepRunId];
311
+ const context = this.contexts[stepRunId];
312
+ if (context && context.controller) {
313
+ context.controller.abort('Cancelled by worker');
314
+ delete this.contexts[stepRunId];
315
+ }
316
+ if (future) {
317
+ future.promise.catch(() => {
318
+ this.logger.info(`Cancelled step run ${action.stepRunId}`);
319
+ });
320
+ future.cancel('Cancelled by worker');
321
+ yield future.promise;
322
+ delete this.futures[stepRunId];
323
+ }
285
324
  }
286
- if (future) {
287
- future.promise.catch(() => {
288
- this.logger.info(`Cancelled step run ${action.stepRunId}`);
289
- });
290
- future.cancel('Cancelled by worker');
291
- delete this.futures[stepRunId];
325
+ catch (e) {
326
+ this.logger.error(`Could not cancel step run: ${e.message}`);
292
327
  }
293
- }
294
- catch (e) {
295
- this.logger.error(`Could not cancel step run: ${e.message}`);
296
- }
328
+ });
297
329
  }
298
330
  stop() {
299
331
  return __awaiter(this, void 0, void 0, function* () {
@@ -341,18 +373,7 @@ class Worker {
341
373
  _d = false;
342
374
  const action = _c;
343
375
  this.logger.info(`Worker ${this.name} received action ${action.actionId}:${action.actionType}`);
344
- if (action.actionType === dispatcher_1.ActionType.START_STEP_RUN) {
345
- this.handleStartStepRun(action);
346
- }
347
- else if (action.actionType === dispatcher_1.ActionType.CANCEL_STEP_RUN) {
348
- this.handleCancelStepRun(action);
349
- }
350
- else if (action.actionType === dispatcher_1.ActionType.START_GET_GROUP_KEY) {
351
- this.handleStartGroupKeyRun(action);
352
- }
353
- else {
354
- this.logger.error(`Worker ${this.name} received unknown action type ${action.actionType}`);
355
- }
376
+ void this.handleAction(action);
356
377
  }
357
378
  }
358
379
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -374,5 +395,24 @@ class Worker {
374
395
  }
375
396
  });
376
397
  }
398
+ handleAction(action) {
399
+ return __awaiter(this, void 0, void 0, function* () {
400
+ const type = action.actionType
401
+ ? (0, dispatcher_1.actionTypeFromJSON)(action.actionType)
402
+ : dispatcher_1.ActionType.START_STEP_RUN;
403
+ if (type === dispatcher_1.ActionType.START_STEP_RUN) {
404
+ yield this.handleStartStepRun(action);
405
+ }
406
+ else if (type === dispatcher_1.ActionType.CANCEL_STEP_RUN) {
407
+ yield this.handleCancelStepRun(action);
408
+ }
409
+ else if (type === dispatcher_1.ActionType.START_GET_GROUP_KEY) {
410
+ yield this.handleStartGroupKeyRun(action);
411
+ }
412
+ else {
413
+ this.logger.error(`Worker ${this.name} received unknown action type ${type}`);
414
+ }
415
+ });
416
+ }
377
417
  }
378
418
  exports.Worker = Worker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "0.7.2",
3
+ "version": "0.8.0-alpha.0",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "prepare": "npm run build",
20
20
  "tsc:build": "tsc && resolve-tspaths",
21
21
  "test:unit": "jest --testMatch='**/*.test.ts'",
22
- "test:e2e": "jest --testMatch='**/*.e2e.ts'",
22
+ "test:e2e": "jest --testMatch='**/*.e2e.ts' --runInBand --detectOpenHandles",
23
23
  "test:unit:watch": "jest --testMatch='**/*.test.ts' --watch",
24
24
  "generate": "pnpm run '/generate-.*/'",
25
25
  "generate-api": "npx --yes swagger-cli bundle ./hatchet/api-contracts/openapi/openapi.yaml --outfile openapi.yaml --type yaml && npx swagger-typescript-api -p openapi.yaml -o src/clients/rest/generated -n hatchet.ts --modular --axios",
@@ -100,4 +100,4 @@
100
100
  "yaml": "^2.3.4",
101
101
  "zod": "^3.22.4"
102
102
  }
103
- }
103
+ }
@@ -1,4 +1,4 @@
1
- import type { CallContext, CallOptions } from 'nice-grpc-common';
1
+ import { type CallContext, type CallOptions } from 'nice-grpc-common';
2
2
  import * as _m0 from 'protobufjs/minimal';
3
3
  export declare const protobufPackage = "";
4
4
  export declare enum ActionType {
@@ -96,6 +96,8 @@ export interface AssignedAction {
96
96
  actionPayload: string;
97
97
  /** the step name */
98
98
  stepName: string;
99
+ /** the count number of the retry attempt */
100
+ retryCount: number;
99
101
  }
100
102
  export interface WorkerListenRequest {
101
103
  /** the id of the worker */
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.178.0
5
+ // protoc v3.19.1
6
+ // source: dispatcher/dispatcher.proto
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -480,6 +485,7 @@ function createBaseAssignedAction() {
480
485
  actionType: 0,
481
486
  actionPayload: '',
482
487
  stepName: '',
488
+ retryCount: 0,
483
489
  };
484
490
  }
485
491
  exports.AssignedAction = {
@@ -520,6 +526,9 @@ exports.AssignedAction = {
520
526
  if (message.stepName !== '') {
521
527
  writer.uint32(98).string(message.stepName);
522
528
  }
529
+ if (message.retryCount !== 0) {
530
+ writer.uint32(104).int32(message.retryCount);
531
+ }
523
532
  return writer;
524
533
  },
525
534
  decode(input, length) {
@@ -601,6 +610,12 @@ exports.AssignedAction = {
601
610
  }
602
611
  message.stepName = reader.string();
603
612
  continue;
613
+ case 13:
614
+ if (tag !== 104) {
615
+ break;
616
+ }
617
+ message.retryCount = reader.int32();
618
+ continue;
604
619
  }
605
620
  if ((tag & 7) === 4 || tag === 0) {
606
621
  break;
@@ -625,6 +640,7 @@ exports.AssignedAction = {
625
640
  actionType: isSet(object.actionType) ? actionTypeFromJSON(object.actionType) : 0,
626
641
  actionPayload: isSet(object.actionPayload) ? globalThis.String(object.actionPayload) : '',
627
642
  stepName: isSet(object.stepName) ? globalThis.String(object.stepName) : '',
643
+ retryCount: isSet(object.retryCount) ? globalThis.Number(object.retryCount) : 0,
628
644
  };
629
645
  },
630
646
  toJSON(message) {
@@ -665,13 +681,16 @@ exports.AssignedAction = {
665
681
  if (message.stepName !== '') {
666
682
  obj.stepName = message.stepName;
667
683
  }
684
+ if (message.retryCount !== 0) {
685
+ obj.retryCount = Math.round(message.retryCount);
686
+ }
668
687
  return obj;
669
688
  },
670
689
  create(base) {
671
690
  return exports.AssignedAction.fromPartial(base !== null && base !== void 0 ? base : {});
672
691
  },
673
692
  fromPartial(object) {
674
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
693
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
675
694
  const message = createBaseAssignedAction();
676
695
  message.tenantId = (_a = object.tenantId) !== null && _a !== void 0 ? _a : '';
677
696
  message.workflowRunId = (_b = object.workflowRunId) !== null && _b !== void 0 ? _b : '';
@@ -685,6 +704,7 @@ exports.AssignedAction = {
685
704
  message.actionType = (_k = object.actionType) !== null && _k !== void 0 ? _k : 0;
686
705
  message.actionPayload = (_l = object.actionPayload) !== null && _l !== void 0 ? _l : '';
687
706
  message.stepName = (_m = object.stepName) !== null && _m !== void 0 ? _m : '';
707
+ message.retryCount = (_o = object.retryCount) !== null && _o !== void 0 ? _o : 0;
688
708
  return message;
689
709
  },
690
710
  };
@@ -1389,7 +1409,7 @@ exports.WorkflowEvent = {
1389
1409
  if (message.eventPayload !== '') {
1390
1410
  writer.uint32(50).string(message.eventPayload);
1391
1411
  }
1392
- if (message.hangup === true) {
1412
+ if (message.hangup !== false) {
1393
1413
  writer.uint32(56).bool(message.hangup);
1394
1414
  }
1395
1415
  if (message.stepRetries !== undefined) {
@@ -1504,7 +1524,7 @@ exports.WorkflowEvent = {
1504
1524
  if (message.eventPayload !== '') {
1505
1525
  obj.eventPayload = message.eventPayload;
1506
1526
  }
1507
- if (message.hangup === true) {
1527
+ if (message.hangup !== false) {
1508
1528
  obj.hangup = message.hangup;
1509
1529
  }
1510
1530
  if (message.stepRetries !== undefined) {
@@ -1,4 +1,4 @@
1
- import type { CallContext, CallOptions } from 'nice-grpc-common';
1
+ import { type CallContext, type CallOptions } from 'nice-grpc-common';
2
2
  import * as _m0 from 'protobufjs/minimal';
3
3
  export declare const protobufPackage = "";
4
4
  export interface Event {
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.178.0
5
+ // protoc v3.19.1
6
+ // source: events/events.proto
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.178.0
5
+ // protoc v3.19.1
6
+ // source: google/protobuf/timestamp.proto
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -99,6 +104,9 @@ function longToNumber(long) {
99
104
  if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
100
105
  throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
101
106
  }
107
+ if (long.lt(globalThis.Number.MIN_SAFE_INTEGER)) {
108
+ throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER');
109
+ }
102
110
  return long.toNumber();
103
111
  }
104
112
  if (_m0.util.Long !== Long) {
@@ -1,4 +1,4 @@
1
- import type { CallContext, CallOptions } from 'nice-grpc-common';
1
+ import { type CallContext, type CallOptions } from 'nice-grpc-common';
2
2
  import * as _m0 from 'protobufjs/minimal';
3
3
  export declare const protobufPackage = "";
4
4
  export declare enum ConcurrencyLimitStrategy {
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.178.0
5
+ // protoc v3.19.1
6
+ // source: workflows/workflows.proto
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);