@hatchet-dev/typescript-sdk 0.8.0-alpha.2 → 0.8.1

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.
@@ -3,7 +3,7 @@ import { CreateWorkflowVersionOpts, RateLimitDuration, WorkflowServiceClient } f
3
3
  import { ClientConfig } from '../hatchet-client/client-config';
4
4
  import { Logger } from '../../util/logger';
5
5
  import { Api } from '../rest';
6
- import { WebhookWorkerCreateRequest, WorkflowRunStatus } from '../rest/generated/data-contracts';
6
+ import { WorkflowRunStatus, WorkflowRunStatusList } from '../rest/generated/data-contracts';
7
7
  type WorkflowMetricsQuery = {
8
8
  workflowId?: string;
9
9
  workflowName?: string;
@@ -33,71 +33,132 @@ export declare class AdminClient {
33
33
  tenantId: string;
34
34
  logger: Logger;
35
35
  constructor(config: ClientConfig, channel: Channel, factory: ClientFactory, api: Api, tenantId: string);
36
+ /**
37
+ * @deprecated use putWorkflow instead
38
+ */
39
+ put_workflow(opts: CreateWorkflowVersionOpts): Promise<void>;
36
40
  /**
37
41
  * Creates a new workflow or updates an existing workflow. If the workflow already exists, Hatchet will automatically
38
42
  * determine if the workflow definition has changed and create a new version if necessary.
39
43
  * @param workflow a workflow definition to create
40
44
  */
41
- put_workflow(workflow: CreateWorkflowVersionOpts): Promise<void>;
42
- put_rate_limit(key: string, limit: number, duration?: RateLimitDuration): Promise<void>;
43
- webhook_create(data: WebhookWorkerCreateRequest): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WebhookWorker, any>>;
45
+ putWorkflow(workflow: CreateWorkflowVersionOpts): Promise<void>;
46
+ /**
47
+ * @deprecated use putRateLimit instead
48
+ */
49
+ put_rate_limit(key: string, limit: number, duration: RateLimitDuration): Promise<void>;
50
+ putRateLimit(key: string, limit: number, duration?: RateLimitDuration): Promise<void>;
51
+ /**
52
+ * @deprecated use runWorkflow instead
53
+ */
54
+ run_workflow<T = object>(workflowName: string, input: T, options?: {
55
+ parentId?: string | undefined;
56
+ parentStepRunId?: string | undefined;
57
+ childIndex?: number | undefined;
58
+ childKey?: string | undefined;
59
+ additionalMetadata?: Record<string, string> | undefined;
60
+ }): Promise<string>;
44
61
  /**
45
62
  * Run a new instance of a workflow with the given input. This will create a new workflow run and return the ID of the
46
63
  * new run.
47
64
  * @param workflowName the name of the workflow to run
48
65
  * @param input an object containing the input to the workflow
66
+ * @param options an object containing the options to run the workflow
49
67
  * @returns the ID of the new workflow run
50
68
  */
51
- run_workflow<T = object>(workflowName: string, input: T, options?: {
69
+ runWorkflow<T = object>(workflowName: string, input: T, options?: {
52
70
  parentId?: string | undefined;
53
71
  parentStepRunId?: string | undefined;
54
72
  childIndex?: number | undefined;
55
73
  childKey?: string | undefined;
56
74
  additionalMetadata?: Record<string, string> | undefined;
57
75
  }): Promise<string>;
76
+ /**
77
+ * @deprecated use listWorkflows instead
78
+ */
79
+ list_workflows(): Promise<import("../rest/generated/data-contracts").WorkflowList>;
58
80
  /**
59
81
  * List workflows in the tenant associated with the API token.
60
82
  * @returns a list of all workflows in the tenant
61
83
  */
62
- list_workflows(): Promise<import("../rest/generated/data-contracts").WorkflowList>;
84
+ listWorkflows(): Promise<import("../rest/generated/data-contracts").WorkflowList>;
85
+ /**
86
+ * @deprecated use getWorkflow instead
87
+ */
88
+ get_workflow(workflowId: string): Promise<import("../rest/generated/data-contracts").Workflow>;
63
89
  /**
64
90
  * Get a workflow by its ID.
65
91
  * @param workflowId the workflow ID (**note:** this is not the same as the workflow version id)
66
92
  * @returns
67
93
  */
68
- get_workflow(workflowId: string): Promise<import("../rest/generated/data-contracts").Workflow>;
94
+ getWorkflow(workflowId: string): Promise<import("../rest/generated/data-contracts").Workflow>;
95
+ /**
96
+ * @deprecated use getWorkflowVersion instead
97
+ */
98
+ get_workflow_version(workflowId: string, version?: string): Promise<import("../rest/generated/data-contracts").WorkflowVersion>;
69
99
  /**
70
100
  * Get a workflow version.
71
101
  * @param workflowId the workflow ID
72
102
  * @param version the version of the workflow to get. If not provided, the latest version will be returned.
73
103
  * @returns the workflow version
74
104
  */
75
- get_workflow_version(workflowId: string, version?: string): Promise<import("../rest/generated/data-contracts").WorkflowVersion>;
105
+ getWorkflowVersion(workflowId: string, version?: string): Promise<import("../rest/generated/data-contracts").WorkflowVersion>;
106
+ /**
107
+ * @deprecated use getWorkflowRun instead
108
+ */
109
+ get_workflow_run(workflowRunId: string): Promise<import("../rest/generated/data-contracts").WorkflowRun>;
76
110
  /**
77
111
  * Get a workflow run.
78
112
  * @param workflowRunId the id of the workflow run to get
79
113
  * @returns the workflow run
80
114
  */
81
- get_workflow_run(workflowRunId: string): Promise<import("../rest/generated/data-contracts").WorkflowRun>;
115
+ getWorkflowRun(workflowRunId: string): Promise<import("../rest/generated/data-contracts").WorkflowRun>;
116
+ /**
117
+ * @deprecated use listWorkflowRuns instead
118
+ */
119
+ list_workflow_runs(query: {
120
+ offset?: number | undefined;
121
+ limit?: number | undefined;
122
+ eventId?: string | undefined;
123
+ workflowId?: string | undefined;
124
+ parentWorkflowRunId?: string | undefined;
125
+ parentStepRunId?: string | undefined;
126
+ statuses?: WorkflowRunStatusList | undefined;
127
+ additionalMetadata?: string[] | undefined;
128
+ }): Promise<import("../rest/generated/data-contracts").WorkflowRunList>;
82
129
  /**
83
130
  * List workflow runs in the tenant associated with the API token.
84
131
  * @param query the query to filter the list of workflow runs
85
132
  * @returns
86
133
  */
87
- list_workflow_runs(query: {
134
+ listWorkflowRuns(query: {
88
135
  offset?: number | undefined;
89
136
  limit?: number | undefined;
90
137
  eventId?: string | undefined;
91
138
  workflowId?: string | undefined;
139
+ parentWorkflowRunId?: string | undefined;
140
+ parentStepRunId?: string | undefined;
141
+ statuses?: WorkflowRunStatusList | undefined;
142
+ additionalMetadata?: string[] | undefined;
92
143
  }): Promise<import("../rest/generated/data-contracts").WorkflowRunList>;
144
+ /**
145
+ * @deprecated use scheduleWorkflow instead
146
+ */
147
+ schedule_workflow(name: string, options?: {
148
+ schedules?: Date[];
149
+ }): Promise<void>;
93
150
  /**
94
151
  * Schedule a workflow to run at a specific time or times.
95
152
  * @param name the name of the workflow to schedule
96
153
  * @param options an object containing the schedules to set
97
154
  */
98
- schedule_workflow(name: string, options?: {
155
+ scheduleWorkflow(name: string, options?: {
99
156
  schedules?: Date[];
100
157
  }): void;
158
+ /**
159
+ * @deprecated use getWorkflowMetrics instead
160
+ */
161
+ get_workflow_metrics(data: WorkflowMetricsQuery): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WorkflowMetrics, any>>;
101
162
  /**
102
163
  * Get the metrics for a workflow.
103
164
  *
@@ -105,6 +166,6 @@ export declare class AdminClient {
105
166
  * @param workflowName the name of the workflow to get metrics for
106
167
  * @param query an object containing query parameters to filter the metrics
107
168
  */
108
- get_workflow_metrics({ workflowId, workflowName, status, groupKey }: WorkflowMetricsQuery): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WorkflowMetrics, any>>;
169
+ getWorkflowMetrics({ workflowId, workflowName, status, groupKey }: WorkflowMetricsQuery): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WorkflowMetrics, any>>;
109
170
  }
110
171
  export {};
@@ -41,12 +41,20 @@ class AdminClient {
41
41
  this.tenantId = tenantId;
42
42
  this.logger = new logger_1.Logger(`Admin`, config.log_level);
43
43
  }
44
+ /**
45
+ * @deprecated use putWorkflow instead
46
+ */
47
+ put_workflow(opts) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ return this.putWorkflow(opts);
50
+ });
51
+ }
44
52
  /**
45
53
  * Creates a new workflow or updates an existing workflow. If the workflow already exists, Hatchet will automatically
46
54
  * determine if the workflow definition has changed and create a new version if necessary.
47
55
  * @param workflow a workflow definition to create
48
56
  */
49
- put_workflow(workflow) {
57
+ putWorkflow(workflow) {
50
58
  return __awaiter(this, void 0, void 0, function* () {
51
59
  try {
52
60
  yield (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () { return this.client.putWorkflow({ opts: workflow }); }), this.logger);
@@ -56,7 +64,15 @@ class AdminClient {
56
64
  }
57
65
  });
58
66
  }
59
- put_rate_limit(key_1, limit_1) {
67
+ /**
68
+ * @deprecated use putRateLimit instead
69
+ */
70
+ put_rate_limit(key, limit, duration) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ return this.putRateLimit(key, limit, duration);
73
+ });
74
+ }
75
+ putRateLimit(key_1, limit_1) {
60
76
  return __awaiter(this, arguments, void 0, function* (key, limit, duration = workflows_1.RateLimitDuration.SECOND) {
61
77
  try {
62
78
  yield (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () {
@@ -72,9 +88,12 @@ class AdminClient {
72
88
  }
73
89
  });
74
90
  }
75
- webhook_create(data) {
91
+ /**
92
+ * @deprecated use runWorkflow instead
93
+ */
94
+ run_workflow(workflowName, input, options) {
76
95
  return __awaiter(this, void 0, void 0, function* () {
77
- return this.api.webhookCreate(this.tenantId, data);
96
+ return this.runWorkflow(workflowName, input, options);
78
97
  });
79
98
  }
80
99
  /**
@@ -82,9 +101,10 @@ class AdminClient {
82
101
  * new run.
83
102
  * @param workflowName the name of the workflow to run
84
103
  * @param input an object containing the input to the workflow
104
+ * @param options an object containing the options to run the workflow
85
105
  * @returns the ID of the new workflow run
86
106
  */
87
- run_workflow(workflowName, input, options) {
107
+ runWorkflow(workflowName, input, options) {
88
108
  return __awaiter(this, void 0, void 0, function* () {
89
109
  let computedName = workflowName;
90
110
  try {
@@ -102,34 +122,58 @@ class AdminClient {
102
122
  }
103
123
  });
104
124
  }
125
+ /**
126
+ * @deprecated use listWorkflows instead
127
+ */
128
+ list_workflows() {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ return this.listWorkflows();
131
+ });
132
+ }
105
133
  /**
106
134
  * List workflows in the tenant associated with the API token.
107
135
  * @returns a list of all workflows in the tenant
108
136
  */
109
- list_workflows() {
137
+ listWorkflows() {
110
138
  return __awaiter(this, void 0, void 0, function* () {
111
139
  const res = yield this.api.workflowList(this.tenantId);
112
140
  return res.data;
113
141
  });
114
142
  }
143
+ /**
144
+ * @deprecated use getWorkflow instead
145
+ */
146
+ get_workflow(workflowId) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ return this.getWorkflow(workflowId);
149
+ });
150
+ }
115
151
  /**
116
152
  * Get a workflow by its ID.
117
153
  * @param workflowId the workflow ID (**note:** this is not the same as the workflow version id)
118
154
  * @returns
119
155
  */
120
- get_workflow(workflowId) {
156
+ getWorkflow(workflowId) {
121
157
  return __awaiter(this, void 0, void 0, function* () {
122
158
  const res = yield this.api.workflowGet(workflowId);
123
159
  return res.data;
124
160
  });
125
161
  }
162
+ /**
163
+ * @deprecated use getWorkflowVersion instead
164
+ */
165
+ get_workflow_version(workflowId, version) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ return this.getWorkflowVersion(workflowId, version);
168
+ });
169
+ }
126
170
  /**
127
171
  * Get a workflow version.
128
172
  * @param workflowId the workflow ID
129
173
  * @param version the version of the workflow to get. If not provided, the latest version will be returned.
130
174
  * @returns the workflow version
131
175
  */
132
- get_workflow_version(workflowId, version) {
176
+ getWorkflowVersion(workflowId, version) {
133
177
  return __awaiter(this, void 0, void 0, function* () {
134
178
  const res = yield this.api.workflowVersionGet(workflowId, {
135
179
  version,
@@ -137,34 +181,58 @@ class AdminClient {
137
181
  return res.data;
138
182
  });
139
183
  }
184
+ /**
185
+ * @deprecated use getWorkflowRun instead
186
+ */
187
+ get_workflow_run(workflowRunId) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ return this.getWorkflowRun(workflowRunId);
190
+ });
191
+ }
140
192
  /**
141
193
  * Get a workflow run.
142
194
  * @param workflowRunId the id of the workflow run to get
143
195
  * @returns the workflow run
144
196
  */
145
- get_workflow_run(workflowRunId) {
197
+ getWorkflowRun(workflowRunId) {
146
198
  return __awaiter(this, void 0, void 0, function* () {
147
199
  const res = yield this.api.workflowRunGet(this.tenantId, workflowRunId);
148
200
  return res.data;
149
201
  });
150
202
  }
203
+ /**
204
+ * @deprecated use listWorkflowRuns instead
205
+ */
206
+ list_workflow_runs(query) {
207
+ return __awaiter(this, void 0, void 0, function* () {
208
+ return this.listWorkflowRuns(query);
209
+ });
210
+ }
151
211
  /**
152
212
  * List workflow runs in the tenant associated with the API token.
153
213
  * @param query the query to filter the list of workflow runs
154
214
  * @returns
155
215
  */
156
- list_workflow_runs(query) {
216
+ listWorkflowRuns(query) {
157
217
  return __awaiter(this, void 0, void 0, function* () {
158
218
  const res = yield this.api.workflowRunList(this.tenantId, query);
159
219
  return res.data;
160
220
  });
161
221
  }
222
+ /**
223
+ * @deprecated use scheduleWorkflow instead
224
+ */
225
+ schedule_workflow(name, options) {
226
+ return __awaiter(this, void 0, void 0, function* () {
227
+ return this.scheduleWorkflow(name, options);
228
+ });
229
+ }
162
230
  /**
163
231
  * Schedule a workflow to run at a specific time or times.
164
232
  * @param name the name of the workflow to schedule
165
233
  * @param options an object containing the schedules to set
166
234
  */
167
- schedule_workflow(name, options) {
235
+ scheduleWorkflow(name, options) {
168
236
  try {
169
237
  this.client.scheduleWorkflow({
170
238
  name,
@@ -175,6 +243,14 @@ class AdminClient {
175
243
  throw new hatchet_error_1.default(e.message);
176
244
  }
177
245
  }
246
+ /**
247
+ * @deprecated use getWorkflowMetrics instead
248
+ */
249
+ get_workflow_metrics(data) {
250
+ return __awaiter(this, void 0, void 0, function* () {
251
+ return this.getWorkflowMetrics(data);
252
+ });
253
+ }
178
254
  /**
179
255
  * Get the metrics for a workflow.
180
256
  *
@@ -182,13 +258,13 @@ class AdminClient {
182
258
  * @param workflowName the name of the workflow to get metrics for
183
259
  * @param query an object containing query parameters to filter the metrics
184
260
  */
185
- get_workflow_metrics({ workflowId, workflowName, status, groupKey }) {
261
+ getWorkflowMetrics({ workflowId, workflowName, status, groupKey }) {
186
262
  const params = {
187
263
  status,
188
264
  groupKey,
189
265
  };
190
266
  if (workflowName) {
191
- this.list_workflows().then((res) => {
267
+ this.listWorkflows().then((res) => {
192
268
  var _a;
193
269
  const workflow = (_a = res.rows) === null || _a === void 0 ? void 0 : _a.find((row) => row.name === workflowName);
194
270
  if (workflow) {
@@ -1,57 +1,14 @@
1
1
  import { DispatcherClient as PbDispatcherClient, AssignedAction } from '../../protoc/dispatcher';
2
2
  import { ClientConfig } from '../hatchet-client/client-config';
3
3
  import { Logger } from '../../util/logger';
4
- import { z } from 'zod';
5
4
  import { DispatcherClient } from './dispatcher-client';
6
5
  import { Heartbeat } from './heartbeat/heartbeat-controller';
7
6
  declare enum ListenStrategy {
8
7
  LISTEN_STRATEGY_V1 = 1,
9
8
  LISTEN_STRATEGY_V2 = 2
10
9
  }
11
- export declare const ActionObject: z.ZodObject<{
12
- tenantId: z.ZodString;
13
- jobId: z.ZodString;
14
- jobName: z.ZodString;
15
- jobRunId: z.ZodString;
16
- stepId: z.ZodString;
17
- stepRunId: z.ZodString;
18
- actionId: z.ZodString;
19
- actionType: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
20
- actionPayload: z.ZodString;
21
- workflowRunId: z.ZodString;
22
- getGroupKeyRunId: z.ZodOptional<z.ZodString>;
23
- stepName: z.ZodString;
24
- retryCount: z.ZodNumber;
25
- }, "strip", z.ZodTypeAny, {
26
- tenantId: string;
27
- stepRunId: string;
28
- workflowRunId: string;
29
- jobId: string;
30
- jobName: string;
31
- jobRunId: string;
32
- stepId: string;
33
- actionId: string;
34
- actionPayload: string;
35
- stepName: string;
36
- retryCount: number;
37
- getGroupKeyRunId?: string | undefined;
38
- actionType?: number | undefined;
39
- }, {
40
- tenantId: string;
41
- stepRunId: string;
42
- workflowRunId: string;
43
- jobId: string;
44
- jobName: string;
45
- jobRunId: string;
46
- stepId: string;
47
- actionId: string;
48
- actionPayload: string;
49
- stepName: string;
50
- retryCount: number;
51
- getGroupKeyRunId?: string | undefined;
52
- actionType?: unknown;
53
- }>;
54
- export type Action = z.infer<typeof ActionObject>;
10
+ export interface Action extends AssignedAction {
11
+ }
55
12
  export declare class ActionListener {
56
13
  config: ClientConfig;
57
14
  client: PbDispatcherClient;
@@ -65,21 +22,7 @@ export declare class ActionListener {
65
22
  listenStrategy: ListenStrategy;
66
23
  heartbeat: Heartbeat;
67
24
  constructor(client: DispatcherClient, workerId: string, retryInterval?: number, retryCount?: number);
68
- actions: () => AsyncGenerator<{
69
- tenantId: string;
70
- stepRunId: string;
71
- workflowRunId: string;
72
- jobId: string;
73
- jobName: string;
74
- jobRunId: string;
75
- stepId: string;
76
- actionId: string;
77
- actionPayload: string;
78
- stepName: string;
79
- retryCount: number;
80
- getGroupKeyRunId?: string | undefined;
81
- actionType?: number | undefined;
82
- }, void, unknown>;
25
+ actions: () => AsyncGenerator<Action, void, unknown>;
83
26
  setListenStrategy(strategy: ListenStrategy): Promise<void>;
84
27
  getListenStrategy(): Promise<ListenStrategy>;
85
28
  incrementRetries(): Promise<void>;
@@ -32,13 +32,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ActionListener = exports.ActionObject = void 0;
36
- const dispatcher_1 = require("../../protoc/dispatcher");
35
+ exports.ActionListener = void 0;
37
36
  const nice_grpc_1 = require("nice-grpc");
38
37
  const sleep_1 = __importDefault(require("../../util/sleep"));
39
38
  const hatchet_error_1 = __importDefault(require("../../util/errors/hatchet-error"));
40
39
  const logger_1 = require("../../util/logger");
41
- const zod_1 = require("zod");
42
40
  const heartbeat_controller_1 = require("./heartbeat/heartbeat-controller");
43
41
  const DEFAULT_ACTION_LISTENER_RETRY_INTERVAL = 5000; // milliseconds
44
42
  const DEFAULT_ACTION_LISTENER_RETRY_COUNT = 20;
@@ -48,21 +46,6 @@ var ListenStrategy;
48
46
  ListenStrategy[ListenStrategy["LISTEN_STRATEGY_V1"] = 1] = "LISTEN_STRATEGY_V1";
49
47
  ListenStrategy[ListenStrategy["LISTEN_STRATEGY_V2"] = 2] = "LISTEN_STRATEGY_V2";
50
48
  })(ListenStrategy || (ListenStrategy = {}));
51
- exports.ActionObject = zod_1.z.object({
52
- tenantId: zod_1.z.string(),
53
- jobId: zod_1.z.string(),
54
- jobName: zod_1.z.string(),
55
- jobRunId: zod_1.z.string(),
56
- stepId: zod_1.z.string(),
57
- stepRunId: zod_1.z.string(),
58
- actionId: zod_1.z.string(),
59
- actionType: zod_1.z.preprocess((s) => (0, dispatcher_1.actionTypeFromJSON)(s), zod_1.z.number().optional()),
60
- actionPayload: zod_1.z.string(),
61
- workflowRunId: zod_1.z.string(),
62
- getGroupKeyRunId: zod_1.z.string().optional(),
63
- stepName: zod_1.z.string(),
64
- retryCount: zod_1.z.number(),
65
- });
66
49
  class ActionListener {
67
50
  constructor(client, workerId, retryInterval = DEFAULT_ACTION_LISTENER_RETRY_INTERVAL, retryCount = DEFAULT_ACTION_LISTENER_RETRY_COUNT) {
68
51
  this.lastConnectionAttempt = 0;
@@ -29,5 +29,4 @@ export declare class HatchetClient {
29
29
  static init(config?: Partial<ClientConfig>, options?: HatchetClientOptions, axiosConfig?: AxiosRequestConfig): HatchetClient;
30
30
  run(workflow: string | Workflow): Promise<Worker>;
31
31
  worker(workflow: string | Workflow, maxRuns?: number): Promise<Worker>;
32
- webhooks(workflow: Workflow): import("../worker/handler").WebhookHandler;
33
32
  }
@@ -142,11 +142,5 @@ class HatchetClient {
142
142
  return worker;
143
143
  });
144
144
  }
145
- webhooks(workflow) {
146
- const worker = new worker_1.Worker(this, {
147
- name: workflow.id,
148
- });
149
- return worker.getHandler(workflow);
150
- }
151
145
  }
152
146
  exports.HatchetClient = HatchetClient;
@@ -1,4 +1,4 @@
1
- import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantResourcePolicy, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, WebhookWorker, WebhookWorkerCreateRequest, WebhookWorkerListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
1
+ import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantResourcePolicy, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
2
2
  import { HttpClient, RequestParams } from './http-client';
3
3
  export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
4
  /**
@@ -919,21 +919,4 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
919
919
  * @secure
920
920
  */
921
921
  githubAppListBranches: (ghInstallation: string, ghRepoOwner: string, ghRepoName: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubBranchesResponse, any>>;
922
- /**
923
- * @description Lists all webhooks
924
- *
925
- * @name WebhookList
926
- * @summary List webhooks
927
- * @request GET:/api/v1/webhook-workers/{tenant}
928
- * @secure
929
- */
930
- webhookList: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<WebhookWorkerListResponse, any>>;
931
- /**
932
- * @description Creates a webhook
933
- *
934
- * @name WebhookCreate
935
- * @summary Create a webhook
936
- * @request POST:/api/v1/webhook-workers/{tenant}/create
937
- */
938
- webhookCreate: (tenant: string, data: WebhookWorkerCreateRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<WebhookWorker, any>>;
939
922
  }
@@ -761,23 +761,6 @@ class Api extends http_client_1.HttpClient {
761
761
  * @secure
762
762
  */
763
763
  this.githubAppListBranches = (ghInstallation, ghRepoOwner, ghRepoName, params = {}) => this.request(Object.assign({ path: `/api/v1/github-app/installations/${ghInstallation}/repos/${ghRepoOwner}/${ghRepoName}/branches`, method: 'GET', secure: true, format: 'json' }, params));
764
- /**
765
- * @description Lists all webhooks
766
- *
767
- * @name WebhookList
768
- * @summary List webhooks
769
- * @request GET:/api/v1/webhook-workers/{tenant}
770
- * @secure
771
- */
772
- this.webhookList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/webhook-workers/${tenant}`, method: 'GET', secure: true, format: 'json' }, params));
773
- /**
774
- * @description Creates a webhook
775
- *
776
- * @name WebhookCreate
777
- * @summary Create a webhook
778
- * @request POST:/api/v1/webhook-workers/{tenant}/create
779
- */
780
- this.webhookCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/webhook-workers/${tenant}/create`, method: 'POST', body: data, type: http_client_1.ContentType.Json, format: 'json' }, params));
781
764
  }
782
765
  }
783
766
  exports.Api = Api;
@@ -894,28 +894,3 @@ export interface WorkflowMetrics {
894
894
  /** The total number of concurrency group keys. */
895
895
  groupKeyCount?: number;
896
896
  }
897
- export interface WebhookWorker {
898
- metadata: APIResourceMeta;
899
- /** The webhook url. */
900
- url: string;
901
- /** The secret key for validation. */
902
- secret: string;
903
- }
904
- export interface WebhookWorkerCreateRequest {
905
- /** The webhook url. */
906
- url: string;
907
- /** The workflow IDs or names to register for this webhook worker. If not provided, workflows will be automatically detected. */
908
- workflows?: string[];
909
- /**
910
- * The secret key for validation. If not provided, a random secret will be generated.
911
- * @minLength 32
912
- */
913
- secret?: string;
914
- }
915
- export interface WebhookWorkerCreateResponse {
916
- worker?: WebhookWorker;
917
- }
918
- export interface WebhookWorkerListResponse {
919
- pagination?: PaginationResponse;
920
- rows?: WebhookWorker[];
921
- }
@@ -4,8 +4,6 @@ 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';
9
7
  import { Context, StepRunFunction } from '../../step';
10
8
  export type ActionRegistry = Record<Action['actionId'], Function>;
11
9
  export declare class Worker {
@@ -20,25 +18,23 @@ export declare class Worker {
20
18
  maxRuns?: number;
21
19
  logger: Logger;
22
20
  registeredWorkflowPromises: Array<Promise<any>>;
23
- registeredWorkflowIds: string[];
24
21
  constructor(client: HatchetClient, options: {
25
22
  name: string;
26
23
  handleKill?: boolean;
27
24
  maxRuns?: number;
28
25
  });
29
- private registerActions;
30
- getHandler(workflow: Workflow): WebhookHandler;
31
- registerWebhook(webhook: WebhookWorkerCreateRequest): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WebhookWorker, any>>;
32
- registerWorkflow(initWorkflow: Workflow): Promise<void>;
26
+ /**
27
+ * @deprecated use registerWorkflow instead
28
+ */
33
29
  register_workflow(initWorkflow: Workflow): Promise<void>;
30
+ registerWorkflow(initWorkflow: Workflow): Promise<void>;
34
31
  registerAction<T, K>(actionId: string, action: StepRunFunction<T, K>): void;
35
- handleStartStepRun(action: Action): Promise<void>;
36
- handleStartGroupKeyRun(action: Action): Promise<void>;
32
+ handleStartStepRun(action: Action): void;
33
+ handleStartGroupKeyRun(action: Action): void;
37
34
  getStepActionEvent(action: Action, eventType: StepActionEventType, payload?: any): StepActionEvent;
38
35
  getGroupKeyActionEvent(action: Action, eventType: GroupKeyActionEventType, payload?: any): GroupKeyActionEvent;
39
- handleCancelStepRun(action: Action): Promise<void>;
36
+ handleCancelStepRun(action: Action): void;
40
37
  stop(): Promise<void>;
41
38
  exitGracefully(handleKill: boolean): Promise<void>;
42
39
  start(): Promise<void>;
43
- handleAction(action: Action): Promise<void>;
44
40
  }