@hatchet-dev/typescript-sdk 0.3.0 → 0.4.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.
- package/clients/admin/admin-client.d.ts +18 -1
- package/clients/admin/admin-client.js +43 -0
- package/clients/dispatcher/action-listener.js +25 -25
- package/clients/listener/listener-client.js +1 -0
- package/clients/rest/generated/Api.d.ts +80 -1
- package/clients/rest/generated/Api.js +60 -0
- package/clients/rest/generated/data-contracts.d.ts +56 -1
- package/clients/rest/generated/data-contracts.js +1 -0
- package/clients/worker/worker.d.ts +1 -0
- package/clients/worker/worker.js +8 -1
- package/package.json +5 -1
- package/protoc/workflows/workflows.d.ts +74 -0
- package/protoc/workflows/workflows.js +252 -3
- package/step.d.ts +28 -0
- package/step.js +6 -1
- package/workflow.d.ts +44 -0
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { Channel, ClientFactory } from 'nice-grpc';
|
|
2
|
-
import { CreateWorkflowVersionOpts, WorkflowServiceClient } from '../../protoc/workflows';
|
|
2
|
+
import { CreateWorkflowVersionOpts, RateLimitDuration, WorkflowServiceClient } from '../../protoc/workflows';
|
|
3
3
|
import { ClientConfig } from '../hatchet-client/client-config';
|
|
4
4
|
import { Logger } from '../../util/logger';
|
|
5
5
|
import { Api } from '../rest';
|
|
6
|
+
import { WorkflowRunStatus } from '../rest/generated/data-contracts';
|
|
7
|
+
type WorkflowMetricsQuery = {
|
|
8
|
+
workflowId?: string;
|
|
9
|
+
workflowName?: string;
|
|
10
|
+
status?: WorkflowRunStatus;
|
|
11
|
+
groupKey?: string;
|
|
12
|
+
};
|
|
6
13
|
/**
|
|
7
14
|
* AdminClient is a client for interacting with the Hatchet Admin API. This allows you to configure, trigger,
|
|
8
15
|
* and monitor workflows.
|
|
@@ -32,6 +39,7 @@ export declare class AdminClient {
|
|
|
32
39
|
* @param workflow a workflow definition to create
|
|
33
40
|
*/
|
|
34
41
|
put_workflow(workflow: CreateWorkflowVersionOpts): Promise<void>;
|
|
42
|
+
put_rate_limit(key: string, limit: number, duration?: RateLimitDuration): Promise<void>;
|
|
35
43
|
/**
|
|
36
44
|
* Run a new instance of a workflow with the given input. This will create a new workflow run and return the ID of the
|
|
37
45
|
* new run.
|
|
@@ -88,4 +96,13 @@ export declare class AdminClient {
|
|
|
88
96
|
schedule_workflow(name: string, options?: {
|
|
89
97
|
schedules?: Date[];
|
|
90
98
|
}): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get the metrics for a workflow.
|
|
101
|
+
*
|
|
102
|
+
* @param workflowId the ID of the workflow to get metrics for
|
|
103
|
+
* @param workflowName the name of the workflow to get metrics for
|
|
104
|
+
* @param query an object containing query parameters to filter the metrics
|
|
105
|
+
*/
|
|
106
|
+
get_workflow_metrics({ workflowId, workflowName, status, groupKey }: WorkflowMetricsQuery): Promise<import("axios").AxiosResponse<import("../rest/generated/data-contracts").WorkflowMetrics, any>>;
|
|
91
107
|
}
|
|
108
|
+
export {};
|
|
@@ -56,6 +56,22 @@ class AdminClient {
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
+
put_rate_limit(key, limit, duration = workflows_1.RateLimitDuration.SECOND) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
try {
|
|
62
|
+
yield (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return this.client.putRateLimit({
|
|
64
|
+
key,
|
|
65
|
+
limit,
|
|
66
|
+
duration,
|
|
67
|
+
});
|
|
68
|
+
}), this.logger);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
throw new hatchet_error_1.default(e.message);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
59
75
|
/**
|
|
60
76
|
* Run a new instance of a workflow with the given input. This will create a new workflow run and return the ID of the
|
|
61
77
|
* new run.
|
|
@@ -148,5 +164,32 @@ class AdminClient {
|
|
|
148
164
|
throw new hatchet_error_1.default(e.message);
|
|
149
165
|
}
|
|
150
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the metrics for a workflow.
|
|
169
|
+
*
|
|
170
|
+
* @param workflowId the ID of the workflow to get metrics for
|
|
171
|
+
* @param workflowName the name of the workflow to get metrics for
|
|
172
|
+
* @param query an object containing query parameters to filter the metrics
|
|
173
|
+
*/
|
|
174
|
+
get_workflow_metrics({ workflowId, workflowName, status, groupKey }) {
|
|
175
|
+
const params = {
|
|
176
|
+
status,
|
|
177
|
+
groupKey,
|
|
178
|
+
};
|
|
179
|
+
if (workflowName) {
|
|
180
|
+
this.list_workflows().then((res) => {
|
|
181
|
+
var _a;
|
|
182
|
+
const workflow = (_a = res.rows) === null || _a === void 0 ? void 0 : _a.find((row) => row.name === workflowName);
|
|
183
|
+
if (workflow) {
|
|
184
|
+
return this.api.workflowGetMetrics(workflow.metadata.id, params);
|
|
185
|
+
}
|
|
186
|
+
throw new Error(`Workflow ${workflowName} not found`);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
else if (workflowId) {
|
|
190
|
+
return this.api.workflowGetMetrics(workflowId, params);
|
|
191
|
+
}
|
|
192
|
+
throw new Error('Must provide either a workflowId or workflowName');
|
|
193
|
+
}
|
|
151
194
|
}
|
|
152
195
|
exports.AdminClient = AdminClient;
|
|
@@ -38,7 +38,7 @@ const sleep_1 = __importDefault(require("../../util/sleep"));
|
|
|
38
38
|
const hatchet_error_1 = __importDefault(require("../../util/errors/hatchet-error"));
|
|
39
39
|
const logger_1 = require("../../util/logger");
|
|
40
40
|
const DEFAULT_ACTION_LISTENER_RETRY_INTERVAL = 5000; // milliseconds
|
|
41
|
-
const DEFAULT_ACTION_LISTENER_RETRY_COUNT =
|
|
41
|
+
const DEFAULT_ACTION_LISTENER_RETRY_COUNT = 20;
|
|
42
42
|
// eslint-disable-next-line no-shadow
|
|
43
43
|
var ListenStrategy;
|
|
44
44
|
(function (ListenStrategy) {
|
|
@@ -61,9 +61,10 @@ class ActionListener {
|
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
try {
|
|
64
|
+
const listenClient = yield __await(client.getListenClient());
|
|
64
65
|
try {
|
|
65
|
-
for (var _d = true,
|
|
66
|
-
_c =
|
|
66
|
+
for (var _d = true, listenClient_1 = (e_1 = void 0, __asyncValues(listenClient)), listenClient_1_1; listenClient_1_1 = yield __await(listenClient_1.next()), _a = listenClient_1_1.done, !_a; _d = true) {
|
|
67
|
+
_c = listenClient_1_1.value;
|
|
67
68
|
_d = false;
|
|
68
69
|
const assignedAction = _c;
|
|
69
70
|
const action = Object.assign({}, assignedAction);
|
|
@@ -73,24 +74,25 @@ class ActionListener {
|
|
|
73
74
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
75
|
finally {
|
|
75
76
|
try {
|
|
76
|
-
if (!_d && !_a && (_b =
|
|
77
|
+
if (!_d && !_a && (_b = listenClient_1.return)) yield __await(_b.call(listenClient_1));
|
|
77
78
|
}
|
|
78
79
|
finally { if (e_1) throw e_1.error; }
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
catch (e) {
|
|
83
|
+
client.logger.info('Listener error');
|
|
82
84
|
// if this is a HatchetError, we should throw this error
|
|
83
85
|
if (e instanceof hatchet_error_1.default) {
|
|
84
86
|
throw e;
|
|
85
87
|
}
|
|
86
|
-
if (e.code === nice_grpc_1.Status.CANCELLED) {
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
88
|
if ((yield __await(client.getListenStrategy())) === ListenStrategy.LISTEN_STRATEGY_V2 &&
|
|
90
89
|
e.code === nice_grpc_1.Status.UNIMPLEMENTED) {
|
|
91
90
|
client.setListenStrategy(ListenStrategy.LISTEN_STRATEGY_V1);
|
|
92
91
|
}
|
|
93
92
|
client.incrementRetries();
|
|
93
|
+
client.logger.error(`Listener encountered an error: ${e.message}`);
|
|
94
|
+
client.logger.info(`Retrying in ${client.retryInterval}ms...`);
|
|
95
|
+
yield __await((0, sleep_1.default)(client.retryInterval));
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
});
|
|
@@ -122,20 +124,7 @@ class ActionListener {
|
|
|
122
124
|
if (this.heartbeatInterval) {
|
|
123
125
|
return;
|
|
124
126
|
}
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
yield this.client.heartbeat({
|
|
128
|
-
workerId: this.workerId,
|
|
129
|
-
heartbeatAt: new Date(),
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
catch (e) {
|
|
133
|
-
this.logger.error(`Failed to send heartbeat: ${e.message}`);
|
|
134
|
-
if (e.code === nice_grpc_1.Status.UNIMPLEMENTED) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
this.heartbeatInterval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const beat = () => __awaiter(this, void 0, void 0, function* () {
|
|
139
128
|
try {
|
|
140
129
|
yield this.client.heartbeat({
|
|
141
130
|
workerId: this.workerId,
|
|
@@ -150,7 +139,10 @@ class ActionListener {
|
|
|
150
139
|
}
|
|
151
140
|
this.logger.error(`Failed to send heartbeat: ${e.message}`);
|
|
152
141
|
}
|
|
153
|
-
})
|
|
142
|
+
});
|
|
143
|
+
// start with a heartbeat
|
|
144
|
+
beat();
|
|
145
|
+
this.heartbeatInterval = setInterval(beat, 4000);
|
|
154
146
|
});
|
|
155
147
|
}
|
|
156
148
|
closeHeartbeat() {
|
|
@@ -175,20 +167,28 @@ class ActionListener {
|
|
|
175
167
|
}
|
|
176
168
|
try {
|
|
177
169
|
if (this.listenStrategy === ListenStrategy.LISTEN_STRATEGY_V1) {
|
|
178
|
-
|
|
170
|
+
const result = this.client.listen({
|
|
179
171
|
workerId: this.workerId,
|
|
180
172
|
});
|
|
173
|
+
this.logger.info('Connection established using LISTEN_STRATEGY_V1');
|
|
174
|
+
return result;
|
|
181
175
|
}
|
|
182
176
|
const res = this.client.listenV2({
|
|
183
177
|
workerId: this.workerId,
|
|
184
178
|
});
|
|
185
179
|
this.heartbeat();
|
|
180
|
+
this.logger.info('Connection established using LISTEN_STRATEGY_V2');
|
|
186
181
|
return res;
|
|
187
182
|
}
|
|
188
183
|
catch (e) {
|
|
189
184
|
this.retries += 1;
|
|
190
|
-
this.logger.error(`Attempt ${this.retries}: Failed to connect, retrying...`);
|
|
191
|
-
|
|
185
|
+
this.logger.error(`Attempt ${this.retries}: Failed to connect, retrying...`);
|
|
186
|
+
if (e.code === nice_grpc_1.Status.UNAVAILABLE) {
|
|
187
|
+
// Connection lost, reset heartbeat interval and retry connection
|
|
188
|
+
this.closeHeartbeat();
|
|
189
|
+
return this.getListenClient();
|
|
190
|
+
}
|
|
191
|
+
throw e;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
}
|
|
@@ -91,6 +91,7 @@ const workflowStatusMap = {
|
|
|
91
91
|
[data_contracts_1.WorkflowRunStatus.CANCELLED]: RunEventType.WORKFLOW_RUN_EVENT_TYPE_CANCELLED,
|
|
92
92
|
[data_contracts_1.WorkflowRunStatus.PENDING]: undefined,
|
|
93
93
|
[data_contracts_1.WorkflowRunStatus.RUNNING]: undefined,
|
|
94
|
+
[data_contracts_1.WorkflowRunStatus.QUEUED]: undefined,
|
|
94
95
|
};
|
|
95
96
|
class PollingAsyncListener {
|
|
96
97
|
constructor(workflowRunid, client) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, StepRun, Tenant, TenantInvite, TenantInviteList, TenantMemberList, TriggerWorkflowRunRequest, UpdateTenantInviteRequest, User, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowRun, WorkflowRunList, WorkflowRunStatusList, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
|
|
1
|
+
import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateSNSIntegrationRequest, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, ListSNSIntegrations, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, Tenant, TenantInvite, TenantInviteList, TenantMemberList, TriggerWorkflowRunRequest, UpdateTenantInviteRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunStatus, WorkflowRunStatusList, 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
|
/**
|
|
@@ -112,6 +112,36 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
112
112
|
* @request POST:/api/v1/sns/{tenant}/{event}
|
|
113
113
|
*/
|
|
114
114
|
snsUpdate: (tenant: string, event: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
115
|
+
/**
|
|
116
|
+
* @description List SNS integrations
|
|
117
|
+
*
|
|
118
|
+
* @tags SNS
|
|
119
|
+
* @name SnsList
|
|
120
|
+
* @summary List SNS integrations
|
|
121
|
+
* @request GET:/api/v1/tenants/{tenant}/sns
|
|
122
|
+
* @secure
|
|
123
|
+
*/
|
|
124
|
+
snsList: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListSNSIntegrations, any>>;
|
|
125
|
+
/**
|
|
126
|
+
* @description Create SNS integration
|
|
127
|
+
*
|
|
128
|
+
* @tags SNS
|
|
129
|
+
* @name SnsCreate
|
|
130
|
+
* @summary Create SNS integration
|
|
131
|
+
* @request POST:/api/v1/tenants/{tenant}/sns
|
|
132
|
+
* @secure
|
|
133
|
+
*/
|
|
134
|
+
snsCreate: (tenant: string, data: CreateSNSIntegrationRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<SNSIntegration, any>>;
|
|
135
|
+
/**
|
|
136
|
+
* @description Delete SNS integration
|
|
137
|
+
*
|
|
138
|
+
* @tags SNS
|
|
139
|
+
* @name SnsDelete
|
|
140
|
+
* @summary Delete SNS integration
|
|
141
|
+
* @request DELETE:/api/v1/sns/{sns}
|
|
142
|
+
* @secure
|
|
143
|
+
*/
|
|
144
|
+
snsDelete: (sns: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
115
145
|
/**
|
|
116
146
|
* @description Gets the current user
|
|
117
147
|
*
|
|
@@ -122,6 +152,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
122
152
|
* @secure
|
|
123
153
|
*/
|
|
124
154
|
userGetCurrent: (params?: RequestParams) => Promise<import("axios").AxiosResponse<User, any>>;
|
|
155
|
+
/**
|
|
156
|
+
* @description Update a user password.
|
|
157
|
+
*
|
|
158
|
+
* @tags User
|
|
159
|
+
* @name UserUpdatePassword
|
|
160
|
+
* @summary Change user password
|
|
161
|
+
* @request POST:/api/v1/users/password
|
|
162
|
+
* @secure
|
|
163
|
+
*/
|
|
164
|
+
userUpdatePassword: (data: UserChangePasswordRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<User, any>>;
|
|
125
165
|
/**
|
|
126
166
|
* @description Registers a user.
|
|
127
167
|
*
|
|
@@ -426,6 +466,21 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
426
466
|
* @secure
|
|
427
467
|
*/
|
|
428
468
|
workflowUpdateLinkGithub: (workflow: string, data: LinkGithubRepositoryRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<Workflow, any>>;
|
|
469
|
+
/**
|
|
470
|
+
* @description Get the metrics for a workflow version
|
|
471
|
+
*
|
|
472
|
+
* @tags Workflow
|
|
473
|
+
* @name WorkflowGetMetrics
|
|
474
|
+
* @summary Get workflow metrics
|
|
475
|
+
* @request GET:/api/v1/workflows/{workflow}/metrics
|
|
476
|
+
* @secure
|
|
477
|
+
*/
|
|
478
|
+
workflowGetMetrics: (workflow: string, query?: {
|
|
479
|
+
/** A status of workflow runs to filter by */
|
|
480
|
+
status?: WorkflowRunStatus;
|
|
481
|
+
/** A group key to filter metrics by */
|
|
482
|
+
groupKey?: string;
|
|
483
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowMetrics, any>>;
|
|
429
484
|
/**
|
|
430
485
|
* @description Create a pull request for a workflow
|
|
431
486
|
*
|
|
@@ -509,6 +564,20 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
509
564
|
* @maxLength 36
|
|
510
565
|
*/
|
|
511
566
|
workflowId?: string;
|
|
567
|
+
/**
|
|
568
|
+
* The parent workflow run id
|
|
569
|
+
* @format uuid
|
|
570
|
+
* @minLength 36
|
|
571
|
+
* @maxLength 36
|
|
572
|
+
*/
|
|
573
|
+
parentWorkflowRunId?: string;
|
|
574
|
+
/**
|
|
575
|
+
* The parent step run id
|
|
576
|
+
* @format uuid
|
|
577
|
+
* @minLength 36
|
|
578
|
+
* @maxLength 36
|
|
579
|
+
*/
|
|
580
|
+
parentStepRunId?: string;
|
|
512
581
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowRunList, any>>;
|
|
513
582
|
/**
|
|
514
583
|
* @description Get a workflow run for a tenant
|
|
@@ -553,6 +622,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
553
622
|
* @secure
|
|
554
623
|
*/
|
|
555
624
|
stepRunUpdateRerun: (tenant: string, stepRun: string, data: RerunStepRunRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<StepRun, any>>;
|
|
625
|
+
/**
|
|
626
|
+
* @description Attempts to cancel a step run
|
|
627
|
+
*
|
|
628
|
+
* @tags Step Run
|
|
629
|
+
* @name StepRunUpdateCancel
|
|
630
|
+
* @summary Attempts to cancel a step run
|
|
631
|
+
* @request POST:/api/v1/tenants/{tenant}/step-runs/{step-run}/cancel
|
|
632
|
+
* @secure
|
|
633
|
+
*/
|
|
634
|
+
stepRunUpdateCancel: (tenant: string, stepRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<StepRun, any>>;
|
|
556
635
|
/**
|
|
557
636
|
* @description Get the schema for a step run
|
|
558
637
|
*
|
|
@@ -126,6 +126,36 @@ class Api extends http_client_1.HttpClient {
|
|
|
126
126
|
* @request POST:/api/v1/sns/{tenant}/{event}
|
|
127
127
|
*/
|
|
128
128
|
this.snsUpdate = (tenant, event, params = {}) => this.request(Object.assign({ path: `/api/v1/sns/${tenant}/${event}`, method: 'POST' }, params));
|
|
129
|
+
/**
|
|
130
|
+
* @description List SNS integrations
|
|
131
|
+
*
|
|
132
|
+
* @tags SNS
|
|
133
|
+
* @name SnsList
|
|
134
|
+
* @summary List SNS integrations
|
|
135
|
+
* @request GET:/api/v1/tenants/{tenant}/sns
|
|
136
|
+
* @secure
|
|
137
|
+
*/
|
|
138
|
+
this.snsList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/sns`, method: 'GET', secure: true, format: 'json' }, params));
|
|
139
|
+
/**
|
|
140
|
+
* @description Create SNS integration
|
|
141
|
+
*
|
|
142
|
+
* @tags SNS
|
|
143
|
+
* @name SnsCreate
|
|
144
|
+
* @summary Create SNS integration
|
|
145
|
+
* @request POST:/api/v1/tenants/{tenant}/sns
|
|
146
|
+
* @secure
|
|
147
|
+
*/
|
|
148
|
+
this.snsCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/sns`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
149
|
+
/**
|
|
150
|
+
* @description Delete SNS integration
|
|
151
|
+
*
|
|
152
|
+
* @tags SNS
|
|
153
|
+
* @name SnsDelete
|
|
154
|
+
* @summary Delete SNS integration
|
|
155
|
+
* @request DELETE:/api/v1/sns/{sns}
|
|
156
|
+
* @secure
|
|
157
|
+
*/
|
|
158
|
+
this.snsDelete = (sns, params = {}) => this.request(Object.assign({ path: `/api/v1/sns/${sns}`, method: 'DELETE', secure: true }, params));
|
|
129
159
|
/**
|
|
130
160
|
* @description Gets the current user
|
|
131
161
|
*
|
|
@@ -136,6 +166,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
136
166
|
* @secure
|
|
137
167
|
*/
|
|
138
168
|
this.userGetCurrent = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/current`, method: 'GET', secure: true, format: 'json' }, params));
|
|
169
|
+
/**
|
|
170
|
+
* @description Update a user password.
|
|
171
|
+
*
|
|
172
|
+
* @tags User
|
|
173
|
+
* @name UserUpdatePassword
|
|
174
|
+
* @summary Change user password
|
|
175
|
+
* @request POST:/api/v1/users/password
|
|
176
|
+
* @secure
|
|
177
|
+
*/
|
|
178
|
+
this.userUpdatePassword = (data, params = {}) => this.request(Object.assign({ path: `/api/v1/users/password`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
139
179
|
/**
|
|
140
180
|
* @description Registers a user.
|
|
141
181
|
*
|
|
@@ -393,6 +433,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
393
433
|
* @secure
|
|
394
434
|
*/
|
|
395
435
|
this.workflowUpdateLinkGithub = (workflow, data, params = {}) => this.request(Object.assign({ path: `/api/v1/workflows/${workflow}/link-github`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
436
|
+
/**
|
|
437
|
+
* @description Get the metrics for a workflow version
|
|
438
|
+
*
|
|
439
|
+
* @tags Workflow
|
|
440
|
+
* @name WorkflowGetMetrics
|
|
441
|
+
* @summary Get workflow metrics
|
|
442
|
+
* @request GET:/api/v1/workflows/{workflow}/metrics
|
|
443
|
+
* @secure
|
|
444
|
+
*/
|
|
445
|
+
this.workflowGetMetrics = (workflow, query, params = {}) => this.request(Object.assign({ path: `/api/v1/workflows/${workflow}/metrics`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
396
446
|
/**
|
|
397
447
|
* @description Create a pull request for a workflow
|
|
398
448
|
*
|
|
@@ -473,6 +523,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
473
523
|
* @secure
|
|
474
524
|
*/
|
|
475
525
|
this.stepRunUpdateRerun = (tenant, stepRun, data, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/step-runs/${stepRun}/rerun`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
526
|
+
/**
|
|
527
|
+
* @description Attempts to cancel a step run
|
|
528
|
+
*
|
|
529
|
+
* @tags Step Run
|
|
530
|
+
* @name StepRunUpdateCancel
|
|
531
|
+
* @summary Attempts to cancel a step run
|
|
532
|
+
* @request POST:/api/v1/tenants/{tenant}/step-runs/{step-run}/cancel
|
|
533
|
+
* @secure
|
|
534
|
+
*/
|
|
535
|
+
this.stepRunUpdateCancel = (tenant, stepRun, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/step-runs/${stepRun}/cancel`, method: 'POST', secure: true, format: 'json' }, params));
|
|
476
536
|
/**
|
|
477
537
|
* @description Get the schema for a step run
|
|
478
538
|
*
|
|
@@ -98,6 +98,8 @@ export interface User {
|
|
|
98
98
|
email: string;
|
|
99
99
|
/** Whether the user has verified their email address. */
|
|
100
100
|
emailVerified: boolean;
|
|
101
|
+
/** Whether the user has a password set. */
|
|
102
|
+
hasPassword?: boolean;
|
|
101
103
|
}
|
|
102
104
|
export interface UserTenantPublic {
|
|
103
105
|
/**
|
|
@@ -117,6 +119,12 @@ export interface UserLoginRequest {
|
|
|
117
119
|
/** The password of the user. */
|
|
118
120
|
password: string;
|
|
119
121
|
}
|
|
122
|
+
export interface UserChangePasswordRequest {
|
|
123
|
+
/** The password of the user. */
|
|
124
|
+
password: string;
|
|
125
|
+
/** The new password for the user. */
|
|
126
|
+
newPassword: string;
|
|
127
|
+
}
|
|
120
128
|
export interface UserRegisterRequest {
|
|
121
129
|
/** The name of the user. */
|
|
122
130
|
name: string;
|
|
@@ -239,6 +247,11 @@ export interface EventWorkflowRunSummary {
|
|
|
239
247
|
* @format int64
|
|
240
248
|
*/
|
|
241
249
|
running?: number;
|
|
250
|
+
/**
|
|
251
|
+
* The number of queued runs.
|
|
252
|
+
* @format int64
|
|
253
|
+
*/
|
|
254
|
+
queued?: number;
|
|
242
255
|
/**
|
|
243
256
|
* The number of succeeded runs.
|
|
244
257
|
* @format int64
|
|
@@ -403,6 +416,20 @@ export interface WorkflowRun {
|
|
|
403
416
|
startedAt?: string;
|
|
404
417
|
/** @format date-time */
|
|
405
418
|
finishedAt?: string;
|
|
419
|
+
/**
|
|
420
|
+
* @format uuid
|
|
421
|
+
* @minLength 36
|
|
422
|
+
* @maxLength 36
|
|
423
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
424
|
+
*/
|
|
425
|
+
parentId?: string;
|
|
426
|
+
/**
|
|
427
|
+
* @format uuid
|
|
428
|
+
* @minLength 36
|
|
429
|
+
* @maxLength 36
|
|
430
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
431
|
+
*/
|
|
432
|
+
parentStepRunId?: string;
|
|
406
433
|
}
|
|
407
434
|
export interface WorkflowRunList {
|
|
408
435
|
rows?: WorkflowRun[];
|
|
@@ -413,7 +440,8 @@ export declare enum WorkflowRunStatus {
|
|
|
413
440
|
RUNNING = "RUNNING",
|
|
414
441
|
SUCCEEDED = "SUCCEEDED",
|
|
415
442
|
FAILED = "FAILED",
|
|
416
|
-
CANCELLED = "CANCELLED"
|
|
443
|
+
CANCELLED = "CANCELLED",
|
|
444
|
+
QUEUED = "QUEUED"
|
|
417
445
|
}
|
|
418
446
|
export type WorkflowRunStatusList = WorkflowRunStatus[];
|
|
419
447
|
export declare enum JobRunStatus {
|
|
@@ -471,6 +499,7 @@ export interface StepRun {
|
|
|
471
499
|
step?: Step;
|
|
472
500
|
children?: string[];
|
|
473
501
|
parents?: string[];
|
|
502
|
+
childWorkflowRuns?: string[];
|
|
474
503
|
workerId?: string;
|
|
475
504
|
input?: string;
|
|
476
505
|
output?: string;
|
|
@@ -639,3 +668,29 @@ export declare enum LogLineOrderByDirection {
|
|
|
639
668
|
}
|
|
640
669
|
export type LogLineSearch = string;
|
|
641
670
|
export type LogLineLevelField = LogLineLevel[];
|
|
671
|
+
export interface SNSIntegration {
|
|
672
|
+
metadata: APIResourceMeta;
|
|
673
|
+
/**
|
|
674
|
+
* The unique identifier for the tenant that the SNS integration belongs to.
|
|
675
|
+
* @format uuid
|
|
676
|
+
*/
|
|
677
|
+
tenantId: string;
|
|
678
|
+
/** The Amazon Resource Name (ARN) of the SNS topic. */
|
|
679
|
+
topicArn: string;
|
|
680
|
+
/** The URL to send SNS messages to. */
|
|
681
|
+
ingestUrl?: string;
|
|
682
|
+
}
|
|
683
|
+
export interface ListSNSIntegrations {
|
|
684
|
+
pagination: PaginationResponse;
|
|
685
|
+
rows: SNSIntegration[];
|
|
686
|
+
}
|
|
687
|
+
export interface CreateSNSIntegrationRequest {
|
|
688
|
+
/** The Amazon Resource Name (ARN) of the SNS topic. */
|
|
689
|
+
topicArn: string;
|
|
690
|
+
}
|
|
691
|
+
export interface WorkflowMetrics {
|
|
692
|
+
/** The number of runs for a specific group key (passed via filter) */
|
|
693
|
+
groupKeyRunsCount?: number;
|
|
694
|
+
/** The total number of concurrency group keys. */
|
|
695
|
+
groupKeyCount?: number;
|
|
696
|
+
}
|
|
@@ -33,6 +33,7 @@ var WorkflowRunStatus;
|
|
|
33
33
|
WorkflowRunStatus["SUCCEEDED"] = "SUCCEEDED";
|
|
34
34
|
WorkflowRunStatus["FAILED"] = "FAILED";
|
|
35
35
|
WorkflowRunStatus["CANCELLED"] = "CANCELLED";
|
|
36
|
+
WorkflowRunStatus["QUEUED"] = "QUEUED";
|
|
36
37
|
})(WorkflowRunStatus || (exports.WorkflowRunStatus = WorkflowRunStatus = {}));
|
|
37
38
|
var JobRunStatus;
|
|
38
39
|
(function (JobRunStatus) {
|
|
@@ -24,6 +24,7 @@ export declare class Worker {
|
|
|
24
24
|
maxRuns?: number;
|
|
25
25
|
});
|
|
26
26
|
registerWorkflow(initWorkflow: Workflow): Promise<void>;
|
|
27
|
+
register_workflow(initWorkflow: Workflow): Promise<void>;
|
|
27
28
|
registerAction<T, K>(actionId: string, action: StepRunFunction<T, K>): void;
|
|
28
29
|
handleStartStepRun(action: Action): void;
|
|
29
30
|
handleStartGroupKeyRun(action: Action): void;
|
package/clients/worker/worker.js
CHANGED
|
@@ -42,7 +42,13 @@ class Worker {
|
|
|
42
42
|
this.handle_kill = options.handleKill === undefined ? true : options.handleKill;
|
|
43
43
|
this.logger = new logger_1.Logger(`Worker/${this.name}`, this.client.config.log_level);
|
|
44
44
|
}
|
|
45
|
+
// @deprecated
|
|
45
46
|
registerWorkflow(initWorkflow) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return this.register_workflow(initWorkflow);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
register_workflow(initWorkflow) {
|
|
46
52
|
var _a, _b;
|
|
47
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
54
|
const workflow = Object.assign(Object.assign({}, initWorkflow), { id: this.client.config.namespace + initWorkflow.id });
|
|
@@ -69,7 +75,7 @@ class Worker {
|
|
|
69
75
|
timeout: workflow.timeout || '60s',
|
|
70
76
|
description: workflow.description,
|
|
71
77
|
steps: workflow.steps.map((step) => {
|
|
72
|
-
var _a;
|
|
78
|
+
var _a, _b;
|
|
73
79
|
return ({
|
|
74
80
|
readableId: step.name,
|
|
75
81
|
action: `${workflow.id}:${step.name}`,
|
|
@@ -78,6 +84,7 @@ class Worker {
|
|
|
78
84
|
parents: (_a = step.parents) !== null && _a !== void 0 ? _a : [],
|
|
79
85
|
userData: '{}',
|
|
80
86
|
retries: step.retries || 0,
|
|
87
|
+
rateLimits: (_b = step.rate_limits) !== null && _b !== void 0 ? _b : [], // Add the missing rateLimits property
|
|
81
88
|
});
|
|
82
89
|
}),
|
|
83
90
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"example:event": "npm run exec -- ./examples/example-event.ts",
|
|
35
35
|
"example:event-listen": "npm run exec -- ./examples/example-event-with-results.ts",
|
|
36
36
|
"worker:namespaced": "npm run exec -- ./examples/namespaced-worker.ts",
|
|
37
|
+
|
|
38
|
+
"worker:rate": "npm run exec -- ./examples/rate-limit/worker.ts",
|
|
39
|
+
"example:rate": "npm run exec -- ./examples/rate-limit/events.ts",
|
|
40
|
+
|
|
37
41
|
"worker:fanout": "npm run exec -- ./examples/fanout-worker.ts",
|
|
38
42
|
"worker:simple": "npm run exec -- ./examples/simple-worker.ts",
|
|
39
43
|
"manual:trigger": "npm run exec -- ./examples/manual-trigger.ts",
|
|
@@ -10,6 +10,14 @@ export declare enum ConcurrencyLimitStrategy {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function concurrencyLimitStrategyFromJSON(object: any): ConcurrencyLimitStrategy;
|
|
12
12
|
export declare function concurrencyLimitStrategyToJSON(object: ConcurrencyLimitStrategy): string;
|
|
13
|
+
export declare enum RateLimitDuration {
|
|
14
|
+
SECOND = 0,
|
|
15
|
+
MINUTE = 1,
|
|
16
|
+
HOUR = 2,
|
|
17
|
+
UNRECOGNIZED = -1
|
|
18
|
+
}
|
|
19
|
+
export declare function rateLimitDurationFromJSON(object: any): RateLimitDuration;
|
|
20
|
+
export declare function rateLimitDurationToJSON(object: RateLimitDuration): string;
|
|
13
21
|
export interface PutWorkflowRequest {
|
|
14
22
|
opts: CreateWorkflowVersionOpts | undefined;
|
|
15
23
|
}
|
|
@@ -69,6 +77,14 @@ export interface CreateWorkflowStepOpts {
|
|
|
69
77
|
userData: string;
|
|
70
78
|
/** (optional) the number of retries for the step, default 0 */
|
|
71
79
|
retries: number;
|
|
80
|
+
/** (optional) the rate limits for the step */
|
|
81
|
+
rateLimits: CreateStepRateLimit[];
|
|
82
|
+
}
|
|
83
|
+
export interface CreateStepRateLimit {
|
|
84
|
+
/** (required) the key for the rate limit */
|
|
85
|
+
key: string;
|
|
86
|
+
/** (required) the number of units this step consumes */
|
|
87
|
+
units: number;
|
|
72
88
|
}
|
|
73
89
|
/** ListWorkflowsRequest is the request for ListWorkflows. */
|
|
74
90
|
export interface ListWorkflowsRequest {
|
|
@@ -136,6 +152,16 @@ export interface TriggerWorkflowRequest {
|
|
|
136
152
|
export interface TriggerWorkflowResponse {
|
|
137
153
|
workflowRunId: string;
|
|
138
154
|
}
|
|
155
|
+
export interface PutRateLimitRequest {
|
|
156
|
+
/** (required) the global key for the rate limit */
|
|
157
|
+
key: string;
|
|
158
|
+
/** (required) the max limit for the rate limit (per unit of time) */
|
|
159
|
+
limit: number;
|
|
160
|
+
/** (required) the duration of time for the rate limit (second|minute|hour) */
|
|
161
|
+
duration: RateLimitDuration;
|
|
162
|
+
}
|
|
163
|
+
export interface PutRateLimitResponse {
|
|
164
|
+
}
|
|
139
165
|
export declare const PutWorkflowRequest: {
|
|
140
166
|
encode(message: PutWorkflowRequest, writer?: _m0.Writer): _m0.Writer;
|
|
141
167
|
decode(input: _m0.Reader | Uint8Array, length?: number): PutWorkflowRequest;
|
|
@@ -176,6 +202,14 @@ export declare const CreateWorkflowStepOpts: {
|
|
|
176
202
|
create(base?: DeepPartial<CreateWorkflowStepOpts>): CreateWorkflowStepOpts;
|
|
177
203
|
fromPartial(object: DeepPartial<CreateWorkflowStepOpts>): CreateWorkflowStepOpts;
|
|
178
204
|
};
|
|
205
|
+
export declare const CreateStepRateLimit: {
|
|
206
|
+
encode(message: CreateStepRateLimit, writer?: _m0.Writer): _m0.Writer;
|
|
207
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CreateStepRateLimit;
|
|
208
|
+
fromJSON(object: any): CreateStepRateLimit;
|
|
209
|
+
toJSON(message: CreateStepRateLimit): unknown;
|
|
210
|
+
create(base?: DeepPartial<CreateStepRateLimit>): CreateStepRateLimit;
|
|
211
|
+
fromPartial(object: DeepPartial<CreateStepRateLimit>): CreateStepRateLimit;
|
|
212
|
+
};
|
|
179
213
|
export declare const ListWorkflowsRequest: {
|
|
180
214
|
encode(_: ListWorkflowsRequest, writer?: _m0.Writer): _m0.Writer;
|
|
181
215
|
decode(input: _m0.Reader | Uint8Array, length?: number): ListWorkflowsRequest;
|
|
@@ -232,6 +266,22 @@ export declare const TriggerWorkflowResponse: {
|
|
|
232
266
|
create(base?: DeepPartial<TriggerWorkflowResponse>): TriggerWorkflowResponse;
|
|
233
267
|
fromPartial(object: DeepPartial<TriggerWorkflowResponse>): TriggerWorkflowResponse;
|
|
234
268
|
};
|
|
269
|
+
export declare const PutRateLimitRequest: {
|
|
270
|
+
encode(message: PutRateLimitRequest, writer?: _m0.Writer): _m0.Writer;
|
|
271
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): PutRateLimitRequest;
|
|
272
|
+
fromJSON(object: any): PutRateLimitRequest;
|
|
273
|
+
toJSON(message: PutRateLimitRequest): unknown;
|
|
274
|
+
create(base?: DeepPartial<PutRateLimitRequest>): PutRateLimitRequest;
|
|
275
|
+
fromPartial(object: DeepPartial<PutRateLimitRequest>): PutRateLimitRequest;
|
|
276
|
+
};
|
|
277
|
+
export declare const PutRateLimitResponse: {
|
|
278
|
+
encode(_: PutRateLimitResponse, writer?: _m0.Writer): _m0.Writer;
|
|
279
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): PutRateLimitResponse;
|
|
280
|
+
fromJSON(_: any): PutRateLimitResponse;
|
|
281
|
+
toJSON(_: PutRateLimitResponse): unknown;
|
|
282
|
+
create(base?: DeepPartial<PutRateLimitResponse>): PutRateLimitResponse;
|
|
283
|
+
fromPartial(_: DeepPartial<PutRateLimitResponse>): PutRateLimitResponse;
|
|
284
|
+
};
|
|
235
285
|
/** WorkflowService represents a set of RPCs for managing workflows. */
|
|
236
286
|
export type WorkflowServiceDefinition = typeof WorkflowServiceDefinition;
|
|
237
287
|
export declare const WorkflowServiceDefinition: {
|
|
@@ -304,17 +354,41 @@ export declare const WorkflowServiceDefinition: {
|
|
|
304
354
|
readonly responseStream: false;
|
|
305
355
|
readonly options: {};
|
|
306
356
|
};
|
|
357
|
+
readonly putRateLimit: {
|
|
358
|
+
readonly name: "PutRateLimit";
|
|
359
|
+
readonly requestType: {
|
|
360
|
+
encode(message: PutRateLimitRequest, writer?: _m0.Writer): _m0.Writer;
|
|
361
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): PutRateLimitRequest;
|
|
362
|
+
fromJSON(object: any): PutRateLimitRequest;
|
|
363
|
+
toJSON(message: PutRateLimitRequest): unknown;
|
|
364
|
+
create(base?: DeepPartial<PutRateLimitRequest>): PutRateLimitRequest;
|
|
365
|
+
fromPartial(object: DeepPartial<PutRateLimitRequest>): PutRateLimitRequest;
|
|
366
|
+
};
|
|
367
|
+
readonly requestStream: false;
|
|
368
|
+
readonly responseType: {
|
|
369
|
+
encode(_: PutRateLimitResponse, writer?: _m0.Writer): _m0.Writer;
|
|
370
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): PutRateLimitResponse;
|
|
371
|
+
fromJSON(_: any): PutRateLimitResponse;
|
|
372
|
+
toJSON(_: PutRateLimitResponse): unknown;
|
|
373
|
+
create(base?: DeepPartial<PutRateLimitResponse>): PutRateLimitResponse;
|
|
374
|
+
fromPartial(_: DeepPartial<PutRateLimitResponse>): PutRateLimitResponse;
|
|
375
|
+
};
|
|
376
|
+
readonly responseStream: false;
|
|
377
|
+
readonly options: {};
|
|
378
|
+
};
|
|
307
379
|
};
|
|
308
380
|
};
|
|
309
381
|
export interface WorkflowServiceImplementation<CallContextExt = {}> {
|
|
310
382
|
putWorkflow(request: PutWorkflowRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WorkflowVersion>>;
|
|
311
383
|
scheduleWorkflow(request: ScheduleWorkflowRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WorkflowVersion>>;
|
|
312
384
|
triggerWorkflow(request: TriggerWorkflowRequest, context: CallContext & CallContextExt): Promise<DeepPartial<TriggerWorkflowResponse>>;
|
|
385
|
+
putRateLimit(request: PutRateLimitRequest, context: CallContext & CallContextExt): Promise<DeepPartial<PutRateLimitResponse>>;
|
|
313
386
|
}
|
|
314
387
|
export interface WorkflowServiceClient<CallOptionsExt = {}> {
|
|
315
388
|
putWorkflow(request: DeepPartial<PutWorkflowRequest>, options?: CallOptions & CallOptionsExt): Promise<WorkflowVersion>;
|
|
316
389
|
scheduleWorkflow(request: DeepPartial<ScheduleWorkflowRequest>, options?: CallOptions & CallOptionsExt): Promise<WorkflowVersion>;
|
|
317
390
|
triggerWorkflow(request: DeepPartial<TriggerWorkflowRequest>, options?: CallOptions & CallOptionsExt): Promise<TriggerWorkflowResponse>;
|
|
391
|
+
putRateLimit(request: DeepPartial<PutRateLimitRequest>, options?: CallOptions & CallOptionsExt): Promise<PutRateLimitResponse>;
|
|
318
392
|
}
|
|
319
393
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
320
394
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.WorkflowServiceDefinition = exports.TriggerWorkflowResponse = exports.TriggerWorkflowRequest = exports.WorkflowTriggerCronRef = exports.WorkflowTriggerEventRef = exports.WorkflowVersion = exports.ScheduleWorkflowRequest = exports.ListWorkflowsRequest = exports.CreateWorkflowStepOpts = exports.CreateWorkflowJobOpts = exports.WorkflowConcurrencyOpts = exports.CreateWorkflowVersionOpts = exports.PutWorkflowRequest = exports.concurrencyLimitStrategyToJSON = exports.concurrencyLimitStrategyFromJSON = exports.ConcurrencyLimitStrategy = exports.protobufPackage = void 0;
|
|
26
|
+
exports.WorkflowServiceDefinition = exports.PutRateLimitResponse = exports.PutRateLimitRequest = exports.TriggerWorkflowResponse = exports.TriggerWorkflowRequest = exports.WorkflowTriggerCronRef = exports.WorkflowTriggerEventRef = exports.WorkflowVersion = exports.ScheduleWorkflowRequest = exports.ListWorkflowsRequest = exports.CreateStepRateLimit = exports.CreateWorkflowStepOpts = exports.CreateWorkflowJobOpts = exports.WorkflowConcurrencyOpts = exports.CreateWorkflowVersionOpts = exports.PutWorkflowRequest = exports.rateLimitDurationToJSON = exports.rateLimitDurationFromJSON = exports.RateLimitDuration = exports.concurrencyLimitStrategyToJSON = exports.concurrencyLimitStrategyFromJSON = exports.ConcurrencyLimitStrategy = exports.protobufPackage = void 0;
|
|
27
27
|
const _m0 = __importStar(require("protobufjs/minimal"));
|
|
28
28
|
const timestamp_1 = require("../google/protobuf/timestamp");
|
|
29
29
|
exports.protobufPackage = '';
|
|
@@ -72,6 +72,45 @@ function concurrencyLimitStrategyToJSON(object) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
exports.concurrencyLimitStrategyToJSON = concurrencyLimitStrategyToJSON;
|
|
75
|
+
var RateLimitDuration;
|
|
76
|
+
(function (RateLimitDuration) {
|
|
77
|
+
RateLimitDuration[RateLimitDuration["SECOND"] = 0] = "SECOND";
|
|
78
|
+
RateLimitDuration[RateLimitDuration["MINUTE"] = 1] = "MINUTE";
|
|
79
|
+
RateLimitDuration[RateLimitDuration["HOUR"] = 2] = "HOUR";
|
|
80
|
+
RateLimitDuration[RateLimitDuration["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
81
|
+
})(RateLimitDuration || (exports.RateLimitDuration = RateLimitDuration = {}));
|
|
82
|
+
function rateLimitDurationFromJSON(object) {
|
|
83
|
+
switch (object) {
|
|
84
|
+
case 0:
|
|
85
|
+
case 'SECOND':
|
|
86
|
+
return RateLimitDuration.SECOND;
|
|
87
|
+
case 1:
|
|
88
|
+
case 'MINUTE':
|
|
89
|
+
return RateLimitDuration.MINUTE;
|
|
90
|
+
case 2:
|
|
91
|
+
case 'HOUR':
|
|
92
|
+
return RateLimitDuration.HOUR;
|
|
93
|
+
case -1:
|
|
94
|
+
case 'UNRECOGNIZED':
|
|
95
|
+
default:
|
|
96
|
+
return RateLimitDuration.UNRECOGNIZED;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.rateLimitDurationFromJSON = rateLimitDurationFromJSON;
|
|
100
|
+
function rateLimitDurationToJSON(object) {
|
|
101
|
+
switch (object) {
|
|
102
|
+
case RateLimitDuration.SECOND:
|
|
103
|
+
return 'SECOND';
|
|
104
|
+
case RateLimitDuration.MINUTE:
|
|
105
|
+
return 'MINUTE';
|
|
106
|
+
case RateLimitDuration.HOUR:
|
|
107
|
+
return 'HOUR';
|
|
108
|
+
case RateLimitDuration.UNRECOGNIZED:
|
|
109
|
+
default:
|
|
110
|
+
return 'UNRECOGNIZED';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.rateLimitDurationToJSON = rateLimitDurationToJSON;
|
|
75
114
|
function createBasePutWorkflowRequest() {
|
|
76
115
|
return { opts: undefined };
|
|
77
116
|
}
|
|
@@ -508,6 +547,7 @@ function createBaseCreateWorkflowStepOpts() {
|
|
|
508
547
|
parents: [],
|
|
509
548
|
userData: '',
|
|
510
549
|
retries: 0,
|
|
550
|
+
rateLimits: [],
|
|
511
551
|
};
|
|
512
552
|
}
|
|
513
553
|
exports.CreateWorkflowStepOpts = {
|
|
@@ -533,6 +573,9 @@ exports.CreateWorkflowStepOpts = {
|
|
|
533
573
|
if (message.retries !== 0) {
|
|
534
574
|
writer.uint32(56).int32(message.retries);
|
|
535
575
|
}
|
|
576
|
+
for (const v of message.rateLimits) {
|
|
577
|
+
exports.CreateStepRateLimit.encode(v, writer.uint32(66).fork()).ldelim();
|
|
578
|
+
}
|
|
536
579
|
return writer;
|
|
537
580
|
},
|
|
538
581
|
decode(input, length) {
|
|
@@ -584,6 +627,12 @@ exports.CreateWorkflowStepOpts = {
|
|
|
584
627
|
}
|
|
585
628
|
message.retries = reader.int32();
|
|
586
629
|
continue;
|
|
630
|
+
case 8:
|
|
631
|
+
if (tag !== 66) {
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
message.rateLimits.push(exports.CreateStepRateLimit.decode(reader, reader.uint32()));
|
|
635
|
+
continue;
|
|
587
636
|
}
|
|
588
637
|
if ((tag & 7) === 4 || tag === 0) {
|
|
589
638
|
break;
|
|
@@ -603,10 +652,13 @@ exports.CreateWorkflowStepOpts = {
|
|
|
603
652
|
: [],
|
|
604
653
|
userData: isSet(object.userData) ? globalThis.String(object.userData) : '',
|
|
605
654
|
retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0,
|
|
655
|
+
rateLimits: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.rateLimits)
|
|
656
|
+
? object.rateLimits.map((e) => exports.CreateStepRateLimit.fromJSON(e))
|
|
657
|
+
: [],
|
|
606
658
|
};
|
|
607
659
|
},
|
|
608
660
|
toJSON(message) {
|
|
609
|
-
var _a;
|
|
661
|
+
var _a, _b;
|
|
610
662
|
const obj = {};
|
|
611
663
|
if (message.readableId !== '') {
|
|
612
664
|
obj.readableId = message.readableId;
|
|
@@ -629,13 +681,16 @@ exports.CreateWorkflowStepOpts = {
|
|
|
629
681
|
if (message.retries !== 0) {
|
|
630
682
|
obj.retries = Math.round(message.retries);
|
|
631
683
|
}
|
|
684
|
+
if ((_b = message.rateLimits) === null || _b === void 0 ? void 0 : _b.length) {
|
|
685
|
+
obj.rateLimits = message.rateLimits.map((e) => exports.CreateStepRateLimit.toJSON(e));
|
|
686
|
+
}
|
|
632
687
|
return obj;
|
|
633
688
|
},
|
|
634
689
|
create(base) {
|
|
635
690
|
return exports.CreateWorkflowStepOpts.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
636
691
|
},
|
|
637
692
|
fromPartial(object) {
|
|
638
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
693
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
639
694
|
const message = createBaseCreateWorkflowStepOpts();
|
|
640
695
|
message.readableId = (_a = object.readableId) !== null && _a !== void 0 ? _a : '';
|
|
641
696
|
message.action = (_b = object.action) !== null && _b !== void 0 ? _b : '';
|
|
@@ -644,6 +699,74 @@ exports.CreateWorkflowStepOpts = {
|
|
|
644
699
|
message.parents = ((_e = object.parents) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || [];
|
|
645
700
|
message.userData = (_f = object.userData) !== null && _f !== void 0 ? _f : '';
|
|
646
701
|
message.retries = (_g = object.retries) !== null && _g !== void 0 ? _g : 0;
|
|
702
|
+
message.rateLimits = ((_h = object.rateLimits) === null || _h === void 0 ? void 0 : _h.map((e) => exports.CreateStepRateLimit.fromPartial(e))) || [];
|
|
703
|
+
return message;
|
|
704
|
+
},
|
|
705
|
+
};
|
|
706
|
+
function createBaseCreateStepRateLimit() {
|
|
707
|
+
return { key: '', units: 0 };
|
|
708
|
+
}
|
|
709
|
+
exports.CreateStepRateLimit = {
|
|
710
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
711
|
+
if (message.key !== '') {
|
|
712
|
+
writer.uint32(10).string(message.key);
|
|
713
|
+
}
|
|
714
|
+
if (message.units !== 0) {
|
|
715
|
+
writer.uint32(16).int32(message.units);
|
|
716
|
+
}
|
|
717
|
+
return writer;
|
|
718
|
+
},
|
|
719
|
+
decode(input, length) {
|
|
720
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
721
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
722
|
+
const message = createBaseCreateStepRateLimit();
|
|
723
|
+
while (reader.pos < end) {
|
|
724
|
+
const tag = reader.uint32();
|
|
725
|
+
switch (tag >>> 3) {
|
|
726
|
+
case 1:
|
|
727
|
+
if (tag !== 10) {
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
message.key = reader.string();
|
|
731
|
+
continue;
|
|
732
|
+
case 2:
|
|
733
|
+
if (tag !== 16) {
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
message.units = reader.int32();
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
reader.skipType(tag & 7);
|
|
743
|
+
}
|
|
744
|
+
return message;
|
|
745
|
+
},
|
|
746
|
+
fromJSON(object) {
|
|
747
|
+
return {
|
|
748
|
+
key: isSet(object.key) ? globalThis.String(object.key) : '',
|
|
749
|
+
units: isSet(object.units) ? globalThis.Number(object.units) : 0,
|
|
750
|
+
};
|
|
751
|
+
},
|
|
752
|
+
toJSON(message) {
|
|
753
|
+
const obj = {};
|
|
754
|
+
if (message.key !== '') {
|
|
755
|
+
obj.key = message.key;
|
|
756
|
+
}
|
|
757
|
+
if (message.units !== 0) {
|
|
758
|
+
obj.units = Math.round(message.units);
|
|
759
|
+
}
|
|
760
|
+
return obj;
|
|
761
|
+
},
|
|
762
|
+
create(base) {
|
|
763
|
+
return exports.CreateStepRateLimit.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
764
|
+
},
|
|
765
|
+
fromPartial(object) {
|
|
766
|
+
var _a, _b;
|
|
767
|
+
const message = createBaseCreateStepRateLimit();
|
|
768
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
|
|
769
|
+
message.units = (_b = object.units) !== null && _b !== void 0 ? _b : 0;
|
|
647
770
|
return message;
|
|
648
771
|
},
|
|
649
772
|
};
|
|
@@ -1283,6 +1406,124 @@ exports.TriggerWorkflowResponse = {
|
|
|
1283
1406
|
return message;
|
|
1284
1407
|
},
|
|
1285
1408
|
};
|
|
1409
|
+
function createBasePutRateLimitRequest() {
|
|
1410
|
+
return { key: '', limit: 0, duration: 0 };
|
|
1411
|
+
}
|
|
1412
|
+
exports.PutRateLimitRequest = {
|
|
1413
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
1414
|
+
if (message.key !== '') {
|
|
1415
|
+
writer.uint32(10).string(message.key);
|
|
1416
|
+
}
|
|
1417
|
+
if (message.limit !== 0) {
|
|
1418
|
+
writer.uint32(16).int32(message.limit);
|
|
1419
|
+
}
|
|
1420
|
+
if (message.duration !== 0) {
|
|
1421
|
+
writer.uint32(24).int32(message.duration);
|
|
1422
|
+
}
|
|
1423
|
+
return writer;
|
|
1424
|
+
},
|
|
1425
|
+
decode(input, length) {
|
|
1426
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1427
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1428
|
+
const message = createBasePutRateLimitRequest();
|
|
1429
|
+
while (reader.pos < end) {
|
|
1430
|
+
const tag = reader.uint32();
|
|
1431
|
+
switch (tag >>> 3) {
|
|
1432
|
+
case 1:
|
|
1433
|
+
if (tag !== 10) {
|
|
1434
|
+
break;
|
|
1435
|
+
}
|
|
1436
|
+
message.key = reader.string();
|
|
1437
|
+
continue;
|
|
1438
|
+
case 2:
|
|
1439
|
+
if (tag !== 16) {
|
|
1440
|
+
break;
|
|
1441
|
+
}
|
|
1442
|
+
message.limit = reader.int32();
|
|
1443
|
+
continue;
|
|
1444
|
+
case 3:
|
|
1445
|
+
if (tag !== 24) {
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1448
|
+
message.duration = reader.int32();
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1451
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1452
|
+
break;
|
|
1453
|
+
}
|
|
1454
|
+
reader.skipType(tag & 7);
|
|
1455
|
+
}
|
|
1456
|
+
return message;
|
|
1457
|
+
},
|
|
1458
|
+
fromJSON(object) {
|
|
1459
|
+
return {
|
|
1460
|
+
key: isSet(object.key) ? globalThis.String(object.key) : '',
|
|
1461
|
+
limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
1462
|
+
duration: isSet(object.duration) ? rateLimitDurationFromJSON(object.duration) : 0,
|
|
1463
|
+
};
|
|
1464
|
+
},
|
|
1465
|
+
toJSON(message) {
|
|
1466
|
+
const obj = {};
|
|
1467
|
+
if (message.key !== '') {
|
|
1468
|
+
obj.key = message.key;
|
|
1469
|
+
}
|
|
1470
|
+
if (message.limit !== 0) {
|
|
1471
|
+
obj.limit = Math.round(message.limit);
|
|
1472
|
+
}
|
|
1473
|
+
if (message.duration !== 0) {
|
|
1474
|
+
obj.duration = rateLimitDurationToJSON(message.duration);
|
|
1475
|
+
}
|
|
1476
|
+
return obj;
|
|
1477
|
+
},
|
|
1478
|
+
create(base) {
|
|
1479
|
+
return exports.PutRateLimitRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1480
|
+
},
|
|
1481
|
+
fromPartial(object) {
|
|
1482
|
+
var _a, _b, _c;
|
|
1483
|
+
const message = createBasePutRateLimitRequest();
|
|
1484
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
|
|
1485
|
+
message.limit = (_b = object.limit) !== null && _b !== void 0 ? _b : 0;
|
|
1486
|
+
message.duration = (_c = object.duration) !== null && _c !== void 0 ? _c : 0;
|
|
1487
|
+
return message;
|
|
1488
|
+
},
|
|
1489
|
+
};
|
|
1490
|
+
function createBasePutRateLimitResponse() {
|
|
1491
|
+
return {};
|
|
1492
|
+
}
|
|
1493
|
+
exports.PutRateLimitResponse = {
|
|
1494
|
+
encode(_, writer = _m0.Writer.create()) {
|
|
1495
|
+
return writer;
|
|
1496
|
+
},
|
|
1497
|
+
decode(input, length) {
|
|
1498
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1499
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1500
|
+
const message = createBasePutRateLimitResponse();
|
|
1501
|
+
while (reader.pos < end) {
|
|
1502
|
+
const tag = reader.uint32();
|
|
1503
|
+
switch (tag >>> 3) {
|
|
1504
|
+
}
|
|
1505
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
reader.skipType(tag & 7);
|
|
1509
|
+
}
|
|
1510
|
+
return message;
|
|
1511
|
+
},
|
|
1512
|
+
fromJSON(_) {
|
|
1513
|
+
return {};
|
|
1514
|
+
},
|
|
1515
|
+
toJSON(_) {
|
|
1516
|
+
const obj = {};
|
|
1517
|
+
return obj;
|
|
1518
|
+
},
|
|
1519
|
+
create(base) {
|
|
1520
|
+
return exports.PutRateLimitResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1521
|
+
},
|
|
1522
|
+
fromPartial(_) {
|
|
1523
|
+
const message = createBasePutRateLimitResponse();
|
|
1524
|
+
return message;
|
|
1525
|
+
},
|
|
1526
|
+
};
|
|
1286
1527
|
exports.WorkflowServiceDefinition = {
|
|
1287
1528
|
name: 'WorkflowService',
|
|
1288
1529
|
fullName: 'WorkflowService',
|
|
@@ -1311,6 +1552,14 @@ exports.WorkflowServiceDefinition = {
|
|
|
1311
1552
|
responseStream: false,
|
|
1312
1553
|
options: {},
|
|
1313
1554
|
},
|
|
1555
|
+
putRateLimit: {
|
|
1556
|
+
name: 'PutRateLimit',
|
|
1557
|
+
requestType: exports.PutRateLimitRequest,
|
|
1558
|
+
requestStream: false,
|
|
1559
|
+
responseType: exports.PutRateLimitResponse,
|
|
1560
|
+
responseStream: false,
|
|
1561
|
+
options: {},
|
|
1562
|
+
},
|
|
1314
1563
|
},
|
|
1315
1564
|
};
|
|
1316
1565
|
function toTimestamp(date) {
|
package/step.d.ts
CHANGED
|
@@ -4,21 +4,49 @@ import { LogLevel } from './clients/event/event-client';
|
|
|
4
4
|
import { Logger } from './util/logger';
|
|
5
5
|
import { HatchetClient } from './clients/hatchet-client';
|
|
6
6
|
import { RunEventType } from './clients/listener/listener-client';
|
|
7
|
+
export declare const CreateRateLimitSchema: z.ZodObject<{
|
|
8
|
+
key: z.ZodString;
|
|
9
|
+
units: z.ZodNumber;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
key: string;
|
|
12
|
+
units: number;
|
|
13
|
+
}, {
|
|
14
|
+
key: string;
|
|
15
|
+
units: number;
|
|
16
|
+
}>;
|
|
7
17
|
export declare const CreateStepSchema: z.ZodObject<{
|
|
8
18
|
name: z.ZodString;
|
|
9
19
|
parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
20
|
timeout: z.ZodOptional<z.ZodString>;
|
|
11
21
|
retries: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
23
|
+
key: z.ZodString;
|
|
24
|
+
units: z.ZodNumber;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
key: string;
|
|
27
|
+
units: number;
|
|
28
|
+
}, {
|
|
29
|
+
key: string;
|
|
30
|
+
units: number;
|
|
31
|
+
}>, "many">>;
|
|
12
32
|
}, "strip", z.ZodTypeAny, {
|
|
13
33
|
name: string;
|
|
14
34
|
parents?: string[] | undefined;
|
|
15
35
|
timeout?: string | undefined;
|
|
16
36
|
retries?: number | undefined;
|
|
37
|
+
rate_limits?: {
|
|
38
|
+
key: string;
|
|
39
|
+
units: number;
|
|
40
|
+
}[] | undefined;
|
|
17
41
|
}, {
|
|
18
42
|
name: string;
|
|
19
43
|
parents?: string[] | undefined;
|
|
20
44
|
timeout?: string | undefined;
|
|
21
45
|
retries?: number | undefined;
|
|
46
|
+
rate_limits?: {
|
|
47
|
+
key: string;
|
|
48
|
+
units: number;
|
|
49
|
+
}[] | undefined;
|
|
22
50
|
}>;
|
|
23
51
|
type JSONPrimitive = string | number | boolean | null | Array<JSONPrimitive>;
|
|
24
52
|
export type NextStep = {
|
package/step.js
CHANGED
|
@@ -42,7 +42,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
42
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.Context = exports.CreateStepSchema = void 0;
|
|
45
|
+
exports.Context = exports.CreateStepSchema = exports.CreateRateLimitSchema = void 0;
|
|
46
46
|
/* eslint-disable max-classes-per-file */
|
|
47
47
|
const hatchet_error_1 = __importDefault(require("./util/errors/hatchet-error"));
|
|
48
48
|
const z = __importStar(require("zod"));
|
|
@@ -50,11 +50,16 @@ const workflow_1 = require("./workflow");
|
|
|
50
50
|
const logger_1 = require("./util/logger");
|
|
51
51
|
const parse_1 = require("./util/parse");
|
|
52
52
|
const listener_client_1 = require("./clients/listener/listener-client");
|
|
53
|
+
exports.CreateRateLimitSchema = z.object({
|
|
54
|
+
key: z.string(),
|
|
55
|
+
units: z.number().min(1),
|
|
56
|
+
});
|
|
53
57
|
exports.CreateStepSchema = z.object({
|
|
54
58
|
name: z.string(),
|
|
55
59
|
parents: z.array(z.string()).optional(),
|
|
56
60
|
timeout: workflow_1.HatchetTimeoutSchema.optional(),
|
|
57
61
|
retries: z.number().optional(),
|
|
62
|
+
rate_limits: z.array(exports.CreateRateLimitSchema).optional(),
|
|
58
63
|
});
|
|
59
64
|
class ChildWorkflowRef {
|
|
60
65
|
constructor(workflowRunId, client) {
|
package/workflow.d.ts
CHANGED
|
@@ -6,16 +6,34 @@ declare const StepsSchema: z.ZodArray<z.ZodObject<{
|
|
|
6
6
|
parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
7
|
timeout: z.ZodOptional<z.ZodString>;
|
|
8
8
|
retries: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
units: z.ZodNumber;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
key: string;
|
|
14
|
+
units: number;
|
|
15
|
+
}, {
|
|
16
|
+
key: string;
|
|
17
|
+
units: number;
|
|
18
|
+
}>, "many">>;
|
|
9
19
|
}, "strip", z.ZodTypeAny, {
|
|
10
20
|
name: string;
|
|
11
21
|
parents?: string[] | undefined;
|
|
12
22
|
timeout?: string | undefined;
|
|
13
23
|
retries?: number | undefined;
|
|
24
|
+
rate_limits?: {
|
|
25
|
+
key: string;
|
|
26
|
+
units: number;
|
|
27
|
+
}[] | undefined;
|
|
14
28
|
}, {
|
|
15
29
|
name: string;
|
|
16
30
|
parents?: string[] | undefined;
|
|
17
31
|
timeout?: string | undefined;
|
|
18
32
|
retries?: number | undefined;
|
|
33
|
+
rate_limits?: {
|
|
34
|
+
key: string;
|
|
35
|
+
units: number;
|
|
36
|
+
}[] | undefined;
|
|
19
37
|
}>, "many">;
|
|
20
38
|
export type Steps = z.infer<typeof StepsSchema>;
|
|
21
39
|
export declare const ConcurrencyLimitStrategy: typeof PbConcurrencyLimitStrategy;
|
|
@@ -63,16 +81,34 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
|
|
|
63
81
|
parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
64
82
|
timeout: z.ZodOptional<z.ZodString>;
|
|
65
83
|
retries: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
85
|
+
key: z.ZodString;
|
|
86
|
+
units: z.ZodNumber;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
key: string;
|
|
89
|
+
units: number;
|
|
90
|
+
}, {
|
|
91
|
+
key: string;
|
|
92
|
+
units: number;
|
|
93
|
+
}>, "many">>;
|
|
66
94
|
}, "strip", z.ZodTypeAny, {
|
|
67
95
|
name: string;
|
|
68
96
|
parents?: string[] | undefined;
|
|
69
97
|
timeout?: string | undefined;
|
|
70
98
|
retries?: number | undefined;
|
|
99
|
+
rate_limits?: {
|
|
100
|
+
key: string;
|
|
101
|
+
units: number;
|
|
102
|
+
}[] | undefined;
|
|
71
103
|
}, {
|
|
72
104
|
name: string;
|
|
73
105
|
parents?: string[] | undefined;
|
|
74
106
|
timeout?: string | undefined;
|
|
75
107
|
retries?: number | undefined;
|
|
108
|
+
rate_limits?: {
|
|
109
|
+
key: string;
|
|
110
|
+
units: number;
|
|
111
|
+
}[] | undefined;
|
|
76
112
|
}>, "many">;
|
|
77
113
|
}, "strip", z.ZodTypeAny, {
|
|
78
114
|
description: string;
|
|
@@ -81,6 +117,10 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
|
|
|
81
117
|
parents?: string[] | undefined;
|
|
82
118
|
timeout?: string | undefined;
|
|
83
119
|
retries?: number | undefined;
|
|
120
|
+
rate_limits?: {
|
|
121
|
+
key: string;
|
|
122
|
+
units: number;
|
|
123
|
+
}[] | undefined;
|
|
84
124
|
}[];
|
|
85
125
|
id: string;
|
|
86
126
|
on: {
|
|
@@ -100,6 +140,10 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
|
|
|
100
140
|
parents?: string[] | undefined;
|
|
101
141
|
timeout?: string | undefined;
|
|
102
142
|
retries?: number | undefined;
|
|
143
|
+
rate_limits?: {
|
|
144
|
+
key: string;
|
|
145
|
+
units: number;
|
|
146
|
+
}[] | undefined;
|
|
103
147
|
}[];
|
|
104
148
|
id: string;
|
|
105
149
|
on: {
|