@hatchet-dev/typescript-sdk 0.1.13 → 0.1.15
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/dispatcher/dispatcher-client.d.ts +1 -0
- package/clients/hatchet-client/hatchet-client.d.ts +1 -1
- package/clients/hatchet-client/hatchet-client.js +3 -1
- package/clients/rest/generated/Api.d.ts +126 -5
- package/clients/rest/generated/Api.js +122 -4
- package/clients/rest/generated/data-contracts.d.ts +90 -0
- package/clients/rest/generated/data-contracts.js +6 -1
- package/clients/worker/worker.d.ts +2 -0
- package/clients/worker/worker.js +5 -2
- package/package.json +6 -3
- package/protoc/dispatcher/dispatcher.d.ts +59 -0
- package/protoc/dispatcher/dispatcher.js +173 -4
- package/protoc/workflows/workflows.d.ts +3 -0
- package/protoc/workflows/workflows.js +22 -2
- package/step.d.ts +6 -1
- package/step.js +12 -4
- package/workflow.d.ts +8 -0
|
@@ -28,5 +28,5 @@ export declare class HatchetClient {
|
|
|
28
28
|
static with_host_port(host: string, port: number, config?: Partial<ClientConfig>, options?: HatchetClientOptions): HatchetClient;
|
|
29
29
|
static init(config?: Partial<ClientConfig>, options?: HatchetClientOptions, axiosConfig?: AxiosRequestConfig): HatchetClient;
|
|
30
30
|
run(workflow: string | Workflow): Promise<Worker>;
|
|
31
|
-
worker(workflow: string | Workflow): Promise<Worker>;
|
|
31
|
+
worker(workflow: string | Workflow, maxRuns?: number): Promise<Worker>;
|
|
32
32
|
}
|
|
@@ -114,6 +114,7 @@ class HatchetClient {
|
|
|
114
114
|
static init(config, options, axiosConfig) {
|
|
115
115
|
return new HatchetClient(config, options, axiosConfig);
|
|
116
116
|
}
|
|
117
|
+
// @deprecated
|
|
117
118
|
run(workflow) {
|
|
118
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
120
|
const worker = yield this.worker(workflow);
|
|
@@ -121,11 +122,12 @@ class HatchetClient {
|
|
|
121
122
|
return worker;
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
|
-
worker(workflow) {
|
|
125
|
+
worker(workflow, maxRuns) {
|
|
125
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
127
|
const name = typeof workflow === 'string' ? workflow : workflow.id;
|
|
127
128
|
const worker = new worker_1.Worker(this, {
|
|
128
129
|
name,
|
|
130
|
+
maxRuns,
|
|
129
131
|
});
|
|
130
132
|
if (typeof workflow !== 'string') {
|
|
131
133
|
yield worker.registerWorkflow(workflow);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, ListAPITokensResponse, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, StepRun, Tenant, TenantInvite, TenantInviteList, TenantMemberList, TriggerWorkflowRunRequest, UpdateTenantInviteRequest, User, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowRun, WorkflowRunList, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
|
|
1
|
+
import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, StepRun, Tenant, TenantInvite, TenantInviteList, TenantMemberList, TriggerWorkflowRunRequest, UpdateTenantInviteRequest, User, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowRun, WorkflowRunList, 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
|
/**
|
|
@@ -10,6 +10,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
10
10
|
* @request GET:/api/v1/meta
|
|
11
11
|
*/
|
|
12
12
|
metadataGet: (params?: RequestParams) => Promise<import("axios").AxiosResponse<APIMeta, any>>;
|
|
13
|
+
/**
|
|
14
|
+
* @description List all integrations
|
|
15
|
+
*
|
|
16
|
+
* @tags Metadata
|
|
17
|
+
* @name MetadataListIntegrations
|
|
18
|
+
* @summary List integrations
|
|
19
|
+
* @request GET:/api/v1/meta/integrations
|
|
20
|
+
* @secure
|
|
21
|
+
*/
|
|
22
|
+
metadataListIntegrations: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ListAPIMetaIntegration, any>>;
|
|
13
23
|
/**
|
|
14
24
|
* @description Logs in a user.
|
|
15
25
|
*
|
|
@@ -23,20 +33,58 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
23
33
|
* @description Starts the OAuth flow
|
|
24
34
|
*
|
|
25
35
|
* @tags User
|
|
26
|
-
* @name
|
|
36
|
+
* @name UserUpdateGoogleOauthStart
|
|
27
37
|
* @summary Start OAuth flow
|
|
28
38
|
* @request GET:/api/v1/users/google/start
|
|
29
39
|
*/
|
|
30
|
-
|
|
40
|
+
userUpdateGoogleOauthStart: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
31
41
|
/**
|
|
32
42
|
* @description Completes the OAuth flow
|
|
33
43
|
*
|
|
34
44
|
* @tags User
|
|
35
|
-
* @name
|
|
45
|
+
* @name UserUpdateGoogleOauthCallback
|
|
36
46
|
* @summary Complete OAuth flow
|
|
37
47
|
* @request GET:/api/v1/users/google/callback
|
|
38
48
|
*/
|
|
39
|
-
|
|
49
|
+
userUpdateGoogleOauthCallback: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Starts the OAuth flow
|
|
52
|
+
*
|
|
53
|
+
* @tags User
|
|
54
|
+
* @name UserUpdateGithubOauthStart
|
|
55
|
+
* @summary Start OAuth flow
|
|
56
|
+
* @request GET:/api/v1/users/github/start
|
|
57
|
+
* @secure
|
|
58
|
+
*/
|
|
59
|
+
userUpdateGithubOauthStart: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
60
|
+
/**
|
|
61
|
+
* @description Completes the OAuth flow
|
|
62
|
+
*
|
|
63
|
+
* @tags User
|
|
64
|
+
* @name UserUpdateGithubOauthCallback
|
|
65
|
+
* @summary Complete OAuth flow
|
|
66
|
+
* @request GET:/api/v1/users/github/callback
|
|
67
|
+
* @secure
|
|
68
|
+
*/
|
|
69
|
+
userUpdateGithubOauthCallback: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
70
|
+
/**
|
|
71
|
+
* @description Github App global webhook
|
|
72
|
+
*
|
|
73
|
+
* @tags Github
|
|
74
|
+
* @name GithubUpdateGlobalWebhook
|
|
75
|
+
* @summary Github app global webhook
|
|
76
|
+
* @request POST:/api/v1/github/webhook
|
|
77
|
+
*/
|
|
78
|
+
githubUpdateGlobalWebhook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
79
|
+
/**
|
|
80
|
+
* @description Github App tenant webhook
|
|
81
|
+
*
|
|
82
|
+
* @tags Github
|
|
83
|
+
* @name GithubUpdateTenantWebhook
|
|
84
|
+
* @summary Github app tenant webhook
|
|
85
|
+
* @request POST:/api/v1/github/webhook/{webhook}
|
|
86
|
+
*/
|
|
87
|
+
githubUpdateTenantWebhook: (webhook: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
40
88
|
/**
|
|
41
89
|
* @description Gets the current user
|
|
42
90
|
*
|
|
@@ -329,6 +377,36 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
329
377
|
*/
|
|
330
378
|
version?: string;
|
|
331
379
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowVersionDefinition, any>>;
|
|
380
|
+
/**
|
|
381
|
+
* @description Link a github repository to a workflow
|
|
382
|
+
*
|
|
383
|
+
* @tags Workflow
|
|
384
|
+
* @name WorkflowUpdateLinkGithub
|
|
385
|
+
* @summary Link github repository
|
|
386
|
+
* @request POST:/api/v1/workflows/{workflow}/link-github
|
|
387
|
+
* @secure
|
|
388
|
+
*/
|
|
389
|
+
workflowUpdateLinkGithub: (workflow: string, data: LinkGithubRepositoryRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<Workflow, any>>;
|
|
390
|
+
/**
|
|
391
|
+
* @description Create a pull request for a workflow
|
|
392
|
+
*
|
|
393
|
+
* @tags Workflow
|
|
394
|
+
* @name StepRunUpdateCreatePr
|
|
395
|
+
* @summary Create pull request
|
|
396
|
+
* @request POST:/api/v1/step-runs/{step-run}/create-pr
|
|
397
|
+
* @secure
|
|
398
|
+
*/
|
|
399
|
+
stepRunUpdateCreatePr: (stepRun: string, data: CreatePullRequestFromStepRun, params?: RequestParams) => Promise<import("axios").AxiosResponse<CreatePullRequestFromStepRun, any>>;
|
|
400
|
+
/**
|
|
401
|
+
* @description Get the diff for a step run between the most recent run and the first run.
|
|
402
|
+
*
|
|
403
|
+
* @tags Workflow
|
|
404
|
+
* @name StepRunGetDiff
|
|
405
|
+
* @summary Get diff
|
|
406
|
+
* @request GET:/api/v1/step-runs/{step-run}/diff
|
|
407
|
+
* @secure
|
|
408
|
+
*/
|
|
409
|
+
stepRunGetDiff: (stepRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<GetStepRunDiffResponse, any>>;
|
|
332
410
|
/**
|
|
333
411
|
* @description Get all workflow runs for a tenant
|
|
334
412
|
*
|
|
@@ -374,6 +452,19 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
374
452
|
* @secure
|
|
375
453
|
*/
|
|
376
454
|
workflowRunGet: (tenant: string, workflowRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowRun, any>>;
|
|
455
|
+
/**
|
|
456
|
+
* @description List all pull requests for a workflow run
|
|
457
|
+
*
|
|
458
|
+
* @tags Workflow
|
|
459
|
+
* @name WorkflowRunListPullRequests
|
|
460
|
+
* @summary List pull requests
|
|
461
|
+
* @request GET:/api/v1/tenants/{tenant}/workflow-runs/{workflow-run}/prs
|
|
462
|
+
* @secure
|
|
463
|
+
*/
|
|
464
|
+
workflowRunListPullRequests: (tenant: string, workflowRun: string, query?: {
|
|
465
|
+
/** The pull request state */
|
|
466
|
+
state?: PullRequestState;
|
|
467
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListPullRequestsResponse, any>>;
|
|
377
468
|
/**
|
|
378
469
|
* @description Get a step run by id
|
|
379
470
|
*
|
|
@@ -414,4 +505,34 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
414
505
|
* @secure
|
|
415
506
|
*/
|
|
416
507
|
workerGet: (worker: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<Worker, any>>;
|
|
508
|
+
/**
|
|
509
|
+
* @description List Github App installations
|
|
510
|
+
*
|
|
511
|
+
* @tags Github
|
|
512
|
+
* @name GithubAppListInstallations
|
|
513
|
+
* @summary List Github App installations
|
|
514
|
+
* @request GET:/api/v1/github-app/installations
|
|
515
|
+
* @secure
|
|
516
|
+
*/
|
|
517
|
+
githubAppListInstallations: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubAppInstallationsResponse, any>>;
|
|
518
|
+
/**
|
|
519
|
+
* @description List Github App repositories
|
|
520
|
+
*
|
|
521
|
+
* @tags Github
|
|
522
|
+
* @name GithubAppListRepos
|
|
523
|
+
* @summary List Github App repositories
|
|
524
|
+
* @request GET:/api/v1/github-app/installations/{gh-installation}/repos
|
|
525
|
+
* @secure
|
|
526
|
+
*/
|
|
527
|
+
githubAppListRepos: (ghInstallation: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubReposResponse, any>>;
|
|
528
|
+
/**
|
|
529
|
+
* @description List Github App branches
|
|
530
|
+
*
|
|
531
|
+
* @tags Github
|
|
532
|
+
* @name GithubAppListBranches
|
|
533
|
+
* @summary List Github App branches
|
|
534
|
+
* @request GET:/api/v1/github-app/installations/{gh-installation}/repos/{gh-repo-owner}/{gh-repo-name}/branches
|
|
535
|
+
* @secure
|
|
536
|
+
*/
|
|
537
|
+
githubAppListBranches: (ghInstallation: string, ghRepoOwner: string, ghRepoName: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubBranchesResponse, any>>;
|
|
417
538
|
}
|
|
@@ -24,6 +24,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
24
24
|
* @request GET:/api/v1/meta
|
|
25
25
|
*/
|
|
26
26
|
this.metadataGet = (params = {}) => this.request(Object.assign({ path: `/api/v1/meta`, method: 'GET', format: 'json' }, params));
|
|
27
|
+
/**
|
|
28
|
+
* @description List all integrations
|
|
29
|
+
*
|
|
30
|
+
* @tags Metadata
|
|
31
|
+
* @name MetadataListIntegrations
|
|
32
|
+
* @summary List integrations
|
|
33
|
+
* @request GET:/api/v1/meta/integrations
|
|
34
|
+
* @secure
|
|
35
|
+
*/
|
|
36
|
+
this.metadataListIntegrations = (params = {}) => this.request(Object.assign({ path: `/api/v1/meta/integrations`, method: 'GET', secure: true, format: 'json' }, params));
|
|
27
37
|
/**
|
|
28
38
|
* @description Logs in a user.
|
|
29
39
|
*
|
|
@@ -37,20 +47,58 @@ class Api extends http_client_1.HttpClient {
|
|
|
37
47
|
* @description Starts the OAuth flow
|
|
38
48
|
*
|
|
39
49
|
* @tags User
|
|
40
|
-
* @name
|
|
50
|
+
* @name UserUpdateGoogleOauthStart
|
|
41
51
|
* @summary Start OAuth flow
|
|
42
52
|
* @request GET:/api/v1/users/google/start
|
|
43
53
|
*/
|
|
44
|
-
this.
|
|
54
|
+
this.userUpdateGoogleOauthStart = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/google/start`, method: 'GET' }, params));
|
|
45
55
|
/**
|
|
46
56
|
* @description Completes the OAuth flow
|
|
47
57
|
*
|
|
48
58
|
* @tags User
|
|
49
|
-
* @name
|
|
59
|
+
* @name UserUpdateGoogleOauthCallback
|
|
50
60
|
* @summary Complete OAuth flow
|
|
51
61
|
* @request GET:/api/v1/users/google/callback
|
|
52
62
|
*/
|
|
53
|
-
this.
|
|
63
|
+
this.userUpdateGoogleOauthCallback = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/google/callback`, method: 'GET' }, params));
|
|
64
|
+
/**
|
|
65
|
+
* @description Starts the OAuth flow
|
|
66
|
+
*
|
|
67
|
+
* @tags User
|
|
68
|
+
* @name UserUpdateGithubOauthStart
|
|
69
|
+
* @summary Start OAuth flow
|
|
70
|
+
* @request GET:/api/v1/users/github/start
|
|
71
|
+
* @secure
|
|
72
|
+
*/
|
|
73
|
+
this.userUpdateGithubOauthStart = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/github/start`, method: 'GET', secure: true }, params));
|
|
74
|
+
/**
|
|
75
|
+
* @description Completes the OAuth flow
|
|
76
|
+
*
|
|
77
|
+
* @tags User
|
|
78
|
+
* @name UserUpdateGithubOauthCallback
|
|
79
|
+
* @summary Complete OAuth flow
|
|
80
|
+
* @request GET:/api/v1/users/github/callback
|
|
81
|
+
* @secure
|
|
82
|
+
*/
|
|
83
|
+
this.userUpdateGithubOauthCallback = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/github/callback`, method: 'GET', secure: true }, params));
|
|
84
|
+
/**
|
|
85
|
+
* @description Github App global webhook
|
|
86
|
+
*
|
|
87
|
+
* @tags Github
|
|
88
|
+
* @name GithubUpdateGlobalWebhook
|
|
89
|
+
* @summary Github app global webhook
|
|
90
|
+
* @request POST:/api/v1/github/webhook
|
|
91
|
+
*/
|
|
92
|
+
this.githubUpdateGlobalWebhook = (params = {}) => this.request(Object.assign({ path: `/api/v1/github/webhook`, method: 'POST' }, params));
|
|
93
|
+
/**
|
|
94
|
+
* @description Github App tenant webhook
|
|
95
|
+
*
|
|
96
|
+
* @tags Github
|
|
97
|
+
* @name GithubUpdateTenantWebhook
|
|
98
|
+
* @summary Github app tenant webhook
|
|
99
|
+
* @request POST:/api/v1/github/webhook/{webhook}
|
|
100
|
+
*/
|
|
101
|
+
this.githubUpdateTenantWebhook = (webhook, params = {}) => this.request(Object.assign({ path: `/api/v1/github/webhook/${webhook}`, method: 'POST' }, params));
|
|
54
102
|
/**
|
|
55
103
|
* @description Gets the current user
|
|
56
104
|
*
|
|
@@ -298,6 +346,36 @@ class Api extends http_client_1.HttpClient {
|
|
|
298
346
|
* @secure
|
|
299
347
|
*/
|
|
300
348
|
this.workflowVersionGetDefinition = (workflow, query, params = {}) => this.request(Object.assign({ path: `/api/v1/workflows/${workflow}/versions/definition`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
349
|
+
/**
|
|
350
|
+
* @description Link a github repository to a workflow
|
|
351
|
+
*
|
|
352
|
+
* @tags Workflow
|
|
353
|
+
* @name WorkflowUpdateLinkGithub
|
|
354
|
+
* @summary Link github repository
|
|
355
|
+
* @request POST:/api/v1/workflows/{workflow}/link-github
|
|
356
|
+
* @secure
|
|
357
|
+
*/
|
|
358
|
+
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));
|
|
359
|
+
/**
|
|
360
|
+
* @description Create a pull request for a workflow
|
|
361
|
+
*
|
|
362
|
+
* @tags Workflow
|
|
363
|
+
* @name StepRunUpdateCreatePr
|
|
364
|
+
* @summary Create pull request
|
|
365
|
+
* @request POST:/api/v1/step-runs/{step-run}/create-pr
|
|
366
|
+
* @secure
|
|
367
|
+
*/
|
|
368
|
+
this.stepRunUpdateCreatePr = (stepRun, data, params = {}) => this.request(Object.assign({ path: `/api/v1/step-runs/${stepRun}/create-pr`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
369
|
+
/**
|
|
370
|
+
* @description Get the diff for a step run between the most recent run and the first run.
|
|
371
|
+
*
|
|
372
|
+
* @tags Workflow
|
|
373
|
+
* @name StepRunGetDiff
|
|
374
|
+
* @summary Get diff
|
|
375
|
+
* @request GET:/api/v1/step-runs/{step-run}/diff
|
|
376
|
+
* @secure
|
|
377
|
+
*/
|
|
378
|
+
this.stepRunGetDiff = (stepRun, params = {}) => this.request(Object.assign({ path: `/api/v1/step-runs/${stepRun}/diff`, method: 'GET', secure: true, format: 'json' }, params));
|
|
301
379
|
/**
|
|
302
380
|
* @description Get all workflow runs for a tenant
|
|
303
381
|
*
|
|
@@ -318,6 +396,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
318
396
|
* @secure
|
|
319
397
|
*/
|
|
320
398
|
this.workflowRunGet = (tenant, workflowRun, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflow-runs/${workflowRun}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
399
|
+
/**
|
|
400
|
+
* @description List all pull requests for a workflow run
|
|
401
|
+
*
|
|
402
|
+
* @tags Workflow
|
|
403
|
+
* @name WorkflowRunListPullRequests
|
|
404
|
+
* @summary List pull requests
|
|
405
|
+
* @request GET:/api/v1/tenants/{tenant}/workflow-runs/{workflow-run}/prs
|
|
406
|
+
* @secure
|
|
407
|
+
*/
|
|
408
|
+
this.workflowRunListPullRequests = (tenant, workflowRun, query, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflow-runs/${workflowRun}/prs`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
321
409
|
/**
|
|
322
410
|
* @description Get a step run by id
|
|
323
411
|
*
|
|
@@ -358,6 +446,36 @@ class Api extends http_client_1.HttpClient {
|
|
|
358
446
|
* @secure
|
|
359
447
|
*/
|
|
360
448
|
this.workerGet = (worker, params = {}) => this.request(Object.assign({ path: `/api/v1/workers/${worker}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
449
|
+
/**
|
|
450
|
+
* @description List Github App installations
|
|
451
|
+
*
|
|
452
|
+
* @tags Github
|
|
453
|
+
* @name GithubAppListInstallations
|
|
454
|
+
* @summary List Github App installations
|
|
455
|
+
* @request GET:/api/v1/github-app/installations
|
|
456
|
+
* @secure
|
|
457
|
+
*/
|
|
458
|
+
this.githubAppListInstallations = (params = {}) => this.request(Object.assign({ path: `/api/v1/github-app/installations`, method: 'GET', secure: true, format: 'json' }, params));
|
|
459
|
+
/**
|
|
460
|
+
* @description List Github App repositories
|
|
461
|
+
*
|
|
462
|
+
* @tags Github
|
|
463
|
+
* @name GithubAppListRepos
|
|
464
|
+
* @summary List Github App repositories
|
|
465
|
+
* @request GET:/api/v1/github-app/installations/{gh-installation}/repos
|
|
466
|
+
* @secure
|
|
467
|
+
*/
|
|
468
|
+
this.githubAppListRepos = (ghInstallation, params = {}) => this.request(Object.assign({ path: `/api/v1/github-app/installations/${ghInstallation}/repos`, method: 'GET', secure: true, format: 'json' }, params));
|
|
469
|
+
/**
|
|
470
|
+
* @description List Github App branches
|
|
471
|
+
*
|
|
472
|
+
* @tags Github
|
|
473
|
+
* @name GithubAppListBranches
|
|
474
|
+
* @summary List Github App branches
|
|
475
|
+
* @request GET:/api/v1/github-app/installations/{gh-installation}/repos/{gh-repo-owner}/{gh-repo-name}/branches
|
|
476
|
+
* @secure
|
|
477
|
+
*/
|
|
478
|
+
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));
|
|
361
479
|
}
|
|
362
480
|
}
|
|
363
481
|
exports.Api = Api;
|
|
@@ -8,6 +8,16 @@ export interface APIMetaAuth {
|
|
|
8
8
|
*/
|
|
9
9
|
schemes?: string[];
|
|
10
10
|
}
|
|
11
|
+
export type ListAPIMetaIntegration = APIMetaIntegration[];
|
|
12
|
+
export interface APIMetaIntegration {
|
|
13
|
+
/**
|
|
14
|
+
* the name of the integration
|
|
15
|
+
* @example "github"
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/** whether this integration is enabled on the instance */
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}
|
|
11
21
|
export interface APIErrors {
|
|
12
22
|
errors: APIError[];
|
|
13
23
|
}
|
|
@@ -275,6 +285,23 @@ export interface Workflow {
|
|
|
275
285
|
lastRun?: WorkflowRun;
|
|
276
286
|
/** The jobs of the workflow. */
|
|
277
287
|
jobs?: Job[];
|
|
288
|
+
deployment?: WorkflowDeploymentConfig;
|
|
289
|
+
}
|
|
290
|
+
export interface WorkflowDeploymentConfig {
|
|
291
|
+
metadata: APIResourceMeta;
|
|
292
|
+
/** The repository name. */
|
|
293
|
+
gitRepoName: string;
|
|
294
|
+
/** The repository owner. */
|
|
295
|
+
gitRepoOwner: string;
|
|
296
|
+
/** The repository branch. */
|
|
297
|
+
gitRepoBranch: string;
|
|
298
|
+
/** The Github App installation. */
|
|
299
|
+
githubAppInstallation?: GithubAppInstallation;
|
|
300
|
+
/**
|
|
301
|
+
* The id of the Github App installation.
|
|
302
|
+
* @format uuid
|
|
303
|
+
*/
|
|
304
|
+
githubAppInstallationId: string;
|
|
278
305
|
}
|
|
279
306
|
export interface WorkflowVersionMeta {
|
|
280
307
|
metadata: APIResourceMeta;
|
|
@@ -453,6 +480,7 @@ export interface StepRun {
|
|
|
453
480
|
cancelledAtEpoch?: number;
|
|
454
481
|
cancelledReason?: string;
|
|
455
482
|
cancelledError?: string;
|
|
483
|
+
inputSchema?: string;
|
|
456
484
|
}
|
|
457
485
|
export interface WorkerList {
|
|
458
486
|
pagination?: PaginationResponse;
|
|
@@ -507,3 +535,65 @@ export interface RerunStepRunRequest {
|
|
|
507
535
|
export interface TriggerWorkflowRunRequest {
|
|
508
536
|
input: object;
|
|
509
537
|
}
|
|
538
|
+
export interface LinkGithubRepositoryRequest {
|
|
539
|
+
/**
|
|
540
|
+
* The repository name.
|
|
541
|
+
* @minLength 36
|
|
542
|
+
* @maxLength 36
|
|
543
|
+
*/
|
|
544
|
+
installationId: string;
|
|
545
|
+
/** The repository name. */
|
|
546
|
+
gitRepoName: string;
|
|
547
|
+
/** The repository owner. */
|
|
548
|
+
gitRepoOwner: string;
|
|
549
|
+
/** The repository branch. */
|
|
550
|
+
gitRepoBranch: string;
|
|
551
|
+
}
|
|
552
|
+
export interface GithubBranch {
|
|
553
|
+
branch_name: string;
|
|
554
|
+
is_default: boolean;
|
|
555
|
+
}
|
|
556
|
+
export interface GithubRepo {
|
|
557
|
+
repo_owner: string;
|
|
558
|
+
repo_name: string;
|
|
559
|
+
}
|
|
560
|
+
export interface GithubAppInstallation {
|
|
561
|
+
metadata: APIResourceMeta;
|
|
562
|
+
installation_settings_url: string;
|
|
563
|
+
account_name: string;
|
|
564
|
+
account_avatar_url: string;
|
|
565
|
+
}
|
|
566
|
+
export interface ListGithubAppInstallationsResponse {
|
|
567
|
+
pagination: PaginationResponse;
|
|
568
|
+
rows: GithubAppInstallation[];
|
|
569
|
+
}
|
|
570
|
+
export type ListGithubReposResponse = GithubRepo[];
|
|
571
|
+
export type ListGithubBranchesResponse = GithubBranch[];
|
|
572
|
+
export interface CreatePullRequestFromStepRun {
|
|
573
|
+
branchName: string;
|
|
574
|
+
}
|
|
575
|
+
export interface GetStepRunDiffResponse {
|
|
576
|
+
diffs: StepRunDiff[];
|
|
577
|
+
}
|
|
578
|
+
export interface StepRunDiff {
|
|
579
|
+
key: string;
|
|
580
|
+
original: string;
|
|
581
|
+
modified: string;
|
|
582
|
+
}
|
|
583
|
+
export interface ListPullRequestsResponse {
|
|
584
|
+
pullRequests: PullRequest[];
|
|
585
|
+
}
|
|
586
|
+
export interface PullRequest {
|
|
587
|
+
repositoryOwner: string;
|
|
588
|
+
repositoryName: string;
|
|
589
|
+
pullRequestID: number;
|
|
590
|
+
pullRequestTitle: string;
|
|
591
|
+
pullRequestNumber: number;
|
|
592
|
+
pullRequestHeadBranch: string;
|
|
593
|
+
pullRequestBaseBranch: string;
|
|
594
|
+
pullRequestState: PullRequestState;
|
|
595
|
+
}
|
|
596
|
+
export declare enum PullRequestState {
|
|
597
|
+
Open = "open",
|
|
598
|
+
Closed = "closed"
|
|
599
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ---------------------------------------------------------------
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowRunStatus = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantMemberRole = void 0;
|
|
13
|
+
exports.PullRequestState = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowRunStatus = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantMemberRole = void 0;
|
|
14
14
|
var TenantMemberRole;
|
|
15
15
|
(function (TenantMemberRole) {
|
|
16
16
|
TenantMemberRole["OWNER"] = "OWNER";
|
|
@@ -52,3 +52,8 @@ var StepRunStatus;
|
|
|
52
52
|
StepRunStatus["FAILED"] = "FAILED";
|
|
53
53
|
StepRunStatus["CANCELLED"] = "CANCELLED";
|
|
54
54
|
})(StepRunStatus || (exports.StepRunStatus = StepRunStatus = {}));
|
|
55
|
+
var PullRequestState;
|
|
56
|
+
(function (PullRequestState) {
|
|
57
|
+
PullRequestState["Open"] = "open";
|
|
58
|
+
PullRequestState["Closed"] = "closed";
|
|
59
|
+
})(PullRequestState || (exports.PullRequestState = PullRequestState = {}));
|
|
@@ -16,10 +16,12 @@ export declare class Worker {
|
|
|
16
16
|
listener: ActionListener | undefined;
|
|
17
17
|
futures: Record<Action['stepRunId'], HatchetPromise<any>>;
|
|
18
18
|
contexts: Record<Action['stepRunId'], Context<any, any>>;
|
|
19
|
+
maxRuns?: number;
|
|
19
20
|
logger: Logger;
|
|
20
21
|
constructor(client: HatchetClient, options: {
|
|
21
22
|
name: string;
|
|
22
23
|
handleKill?: boolean;
|
|
24
|
+
maxRuns?: number;
|
|
23
25
|
});
|
|
24
26
|
registerWorkflow(workflow: Workflow): Promise<void>;
|
|
25
27
|
registerAction<T, K>(actionId: string, action: StepRunFunction<T, K>): void;
|
package/clients/worker/worker.js
CHANGED
|
@@ -35,6 +35,7 @@ class Worker {
|
|
|
35
35
|
this.client = client;
|
|
36
36
|
this.name = options.name;
|
|
37
37
|
this.action_registry = {};
|
|
38
|
+
this.maxRuns = options.maxRuns;
|
|
38
39
|
process.on('SIGTERM', () => this.exitGracefully());
|
|
39
40
|
process.on('SIGINT', () => this.exitGracefully());
|
|
40
41
|
this.killing = false;
|
|
@@ -74,6 +75,7 @@ class Worker {
|
|
|
74
75
|
inputs: '{}',
|
|
75
76
|
parents: (_a = step.parents) !== null && _a !== void 0 ? _a : [],
|
|
76
77
|
userData: '{}',
|
|
78
|
+
retries: step.retries || 0,
|
|
77
79
|
});
|
|
78
80
|
}),
|
|
79
81
|
},
|
|
@@ -96,7 +98,7 @@ class Worker {
|
|
|
96
98
|
}
|
|
97
99
|
handleStartStepRun(action) {
|
|
98
100
|
const { actionId } = action;
|
|
99
|
-
const context = new step_1.Context(action
|
|
101
|
+
const context = new step_1.Context(action);
|
|
100
102
|
this.contexts[action.stepRunId] = context;
|
|
101
103
|
const step = this.action_registry[actionId];
|
|
102
104
|
if (!step) {
|
|
@@ -145,7 +147,7 @@ class Worker {
|
|
|
145
147
|
}
|
|
146
148
|
handleStartGroupKeyRun(action) {
|
|
147
149
|
const { actionId } = action;
|
|
148
|
-
const context = new step_1.Context(action
|
|
150
|
+
const context = new step_1.Context(action);
|
|
149
151
|
const key = action.getGroupKeyRunId;
|
|
150
152
|
this.contexts[key] = context;
|
|
151
153
|
this.logger.debug(`Starting group key run ${key}`);
|
|
@@ -275,6 +277,7 @@ class Worker {
|
|
|
275
277
|
workerName: this.name,
|
|
276
278
|
services: ['default'],
|
|
277
279
|
actions: Object.keys(this.action_registry),
|
|
280
|
+
maxRuns: this.maxRuns,
|
|
278
281
|
});
|
|
279
282
|
const generator = this.listener.actions();
|
|
280
283
|
this.logger.info(`Worker ${this.name} listening for actions`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,8 +31,11 @@
|
|
|
31
31
|
"worker:simple": "npm run exec -- ./examples/simple-worker.ts",
|
|
32
32
|
"manual:trigger": "npm run exec -- ./examples/manual-trigger.ts",
|
|
33
33
|
"worker:dag": "npm run exec -- ./examples/dag-worker.ts",
|
|
34
|
-
"worker:concurrency": "npm run exec -- ./examples/concurrency/concurrency-worker.ts",
|
|
35
|
-
"event:concurrency": "npm run exec -- ./examples/concurrency/concurrency-event.ts",
|
|
34
|
+
"worker:concurrency": "npm run exec -- ./examples/concurrency/cancel-in-progress/concurrency-worker.ts",
|
|
35
|
+
"event:concurrency": "npm run exec -- ./examples/concurrency/cancel-in-progress/concurrency-event.ts",
|
|
36
|
+
"worker:concurrency:rr": "npm run exec -- ./examples/concurrency/group-round-robin/concurrency-worker.ts",
|
|
37
|
+
"event:concurrency:rr": "npm run exec -- ./examples/concurrency/group-round-robin/concurrency-event.ts",
|
|
38
|
+
"worker:retries": "npm run exec -- ./examples/retries-worker.ts",
|
|
36
39
|
"api": "npm run exec -- ./examples/api.ts",
|
|
37
40
|
"prepublish": "cp package.json dist/package.json;",
|
|
38
41
|
"publish:ci": "rm -rf ./dist && npm run tsc:build && npm run prepublish && cd dist && npm publish --access public --no-git-checks",
|
|
@@ -53,6 +53,8 @@ export interface WorkerRegisterRequest {
|
|
|
53
53
|
actions: string[];
|
|
54
54
|
/** (optional) the services for this worker */
|
|
55
55
|
services: string[];
|
|
56
|
+
/** (optional) the max number of runs this worker can handle */
|
|
57
|
+
maxRuns?: number | undefined;
|
|
56
58
|
}
|
|
57
59
|
export interface WorkerRegisterResponse {
|
|
58
60
|
/** the tenant id */
|
|
@@ -152,6 +154,23 @@ export interface WorkflowEvent {
|
|
|
152
154
|
eventTimestamp: Date | undefined;
|
|
153
155
|
/** the event payload */
|
|
154
156
|
eventPayload: string;
|
|
157
|
+
/**
|
|
158
|
+
* whether this is the last event for the workflow run - server
|
|
159
|
+
* will hang up the connection but clients might want to case
|
|
160
|
+
*/
|
|
161
|
+
hangup: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface OverridesData {
|
|
164
|
+
/** the step run id */
|
|
165
|
+
stepRunId: string;
|
|
166
|
+
/** the path of the data to set */
|
|
167
|
+
path: string;
|
|
168
|
+
/** the value to set */
|
|
169
|
+
value: string;
|
|
170
|
+
/** the filename of the caller */
|
|
171
|
+
callerFilename: string;
|
|
172
|
+
}
|
|
173
|
+
export interface OverridesDataResponse {
|
|
155
174
|
}
|
|
156
175
|
export declare const WorkerRegisterRequest: {
|
|
157
176
|
encode(message: WorkerRegisterRequest, writer?: _m0.Writer): _m0.Writer;
|
|
@@ -241,6 +260,22 @@ export declare const WorkflowEvent: {
|
|
|
241
260
|
create(base?: DeepPartial<WorkflowEvent>): WorkflowEvent;
|
|
242
261
|
fromPartial(object: DeepPartial<WorkflowEvent>): WorkflowEvent;
|
|
243
262
|
};
|
|
263
|
+
export declare const OverridesData: {
|
|
264
|
+
encode(message: OverridesData, writer?: _m0.Writer): _m0.Writer;
|
|
265
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): OverridesData;
|
|
266
|
+
fromJSON(object: any): OverridesData;
|
|
267
|
+
toJSON(message: OverridesData): unknown;
|
|
268
|
+
create(base?: DeepPartial<OverridesData>): OverridesData;
|
|
269
|
+
fromPartial(object: DeepPartial<OverridesData>): OverridesData;
|
|
270
|
+
};
|
|
271
|
+
export declare const OverridesDataResponse: {
|
|
272
|
+
encode(_: OverridesDataResponse, writer?: _m0.Writer): _m0.Writer;
|
|
273
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): OverridesDataResponse;
|
|
274
|
+
fromJSON(_: any): OverridesDataResponse;
|
|
275
|
+
toJSON(_: OverridesDataResponse): unknown;
|
|
276
|
+
create(base?: DeepPartial<OverridesDataResponse>): OverridesDataResponse;
|
|
277
|
+
fromPartial(_: DeepPartial<OverridesDataResponse>): OverridesDataResponse;
|
|
278
|
+
};
|
|
244
279
|
export type DispatcherDefinition = typeof DispatcherDefinition;
|
|
245
280
|
export declare const DispatcherDefinition: {
|
|
246
281
|
readonly name: "Dispatcher";
|
|
@@ -356,6 +391,28 @@ export declare const DispatcherDefinition: {
|
|
|
356
391
|
readonly responseStream: false;
|
|
357
392
|
readonly options: {};
|
|
358
393
|
};
|
|
394
|
+
readonly putOverridesData: {
|
|
395
|
+
readonly name: "PutOverridesData";
|
|
396
|
+
readonly requestType: {
|
|
397
|
+
encode(message: OverridesData, writer?: _m0.Writer): _m0.Writer;
|
|
398
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): OverridesData;
|
|
399
|
+
fromJSON(object: any): OverridesData;
|
|
400
|
+
toJSON(message: OverridesData): unknown;
|
|
401
|
+
create(base?: DeepPartial<OverridesData>): OverridesData;
|
|
402
|
+
fromPartial(object: DeepPartial<OverridesData>): OverridesData;
|
|
403
|
+
};
|
|
404
|
+
readonly requestStream: false;
|
|
405
|
+
readonly responseType: {
|
|
406
|
+
encode(_: OverridesDataResponse, writer?: _m0.Writer): _m0.Writer;
|
|
407
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): OverridesDataResponse;
|
|
408
|
+
fromJSON(_: any): OverridesDataResponse;
|
|
409
|
+
toJSON(_: OverridesDataResponse): unknown;
|
|
410
|
+
create(base?: DeepPartial<OverridesDataResponse>): OverridesDataResponse;
|
|
411
|
+
fromPartial(_: DeepPartial<OverridesDataResponse>): OverridesDataResponse;
|
|
412
|
+
};
|
|
413
|
+
readonly responseStream: false;
|
|
414
|
+
readonly options: {};
|
|
415
|
+
};
|
|
359
416
|
readonly unsubscribe: {
|
|
360
417
|
readonly name: "Unsubscribe";
|
|
361
418
|
readonly requestType: {
|
|
@@ -386,6 +443,7 @@ export interface DispatcherServiceImplementation<CallContextExt = {}> {
|
|
|
386
443
|
subscribeToWorkflowEvents(request: SubscribeToWorkflowEventsRequest, context: CallContext & CallContextExt): ServerStreamingMethodResult<DeepPartial<WorkflowEvent>>;
|
|
387
444
|
sendStepActionEvent(request: StepActionEvent, context: CallContext & CallContextExt): Promise<DeepPartial<ActionEventResponse>>;
|
|
388
445
|
sendGroupKeyActionEvent(request: GroupKeyActionEvent, context: CallContext & CallContextExt): Promise<DeepPartial<ActionEventResponse>>;
|
|
446
|
+
putOverridesData(request: OverridesData, context: CallContext & CallContextExt): Promise<DeepPartial<OverridesDataResponse>>;
|
|
389
447
|
unsubscribe(request: WorkerUnsubscribeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WorkerUnsubscribeResponse>>;
|
|
390
448
|
}
|
|
391
449
|
export interface DispatcherClient<CallOptionsExt = {}> {
|
|
@@ -394,6 +452,7 @@ export interface DispatcherClient<CallOptionsExt = {}> {
|
|
|
394
452
|
subscribeToWorkflowEvents(request: DeepPartial<SubscribeToWorkflowEventsRequest>, options?: CallOptions & CallOptionsExt): AsyncIterable<WorkflowEvent>;
|
|
395
453
|
sendStepActionEvent(request: DeepPartial<StepActionEvent>, options?: CallOptions & CallOptionsExt): Promise<ActionEventResponse>;
|
|
396
454
|
sendGroupKeyActionEvent(request: DeepPartial<GroupKeyActionEvent>, options?: CallOptions & CallOptionsExt): Promise<ActionEventResponse>;
|
|
455
|
+
putOverridesData(request: DeepPartial<OverridesData>, options?: CallOptions & CallOptionsExt): Promise<OverridesDataResponse>;
|
|
397
456
|
unsubscribe(request: DeepPartial<WorkerUnsubscribeRequest>, options?: CallOptions & CallOptionsExt): Promise<WorkerUnsubscribeResponse>;
|
|
398
457
|
}
|
|
399
458
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
@@ -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.DispatcherDefinition = exports.WorkflowEvent = exports.SubscribeToWorkflowEventsRequest = exports.ActionEventResponse = exports.StepActionEvent = exports.GroupKeyActionEvent = exports.WorkerUnsubscribeResponse = exports.WorkerUnsubscribeRequest = exports.WorkerListenRequest = exports.AssignedAction = exports.WorkerRegisterResponse = exports.WorkerRegisterRequest = exports.resourceEventTypeToJSON = exports.resourceEventTypeFromJSON = exports.ResourceEventType = exports.resourceTypeToJSON = exports.resourceTypeFromJSON = exports.ResourceType = exports.stepActionEventTypeToJSON = exports.stepActionEventTypeFromJSON = exports.StepActionEventType = exports.groupKeyActionEventTypeToJSON = exports.groupKeyActionEventTypeFromJSON = exports.GroupKeyActionEventType = exports.actionTypeToJSON = exports.actionTypeFromJSON = exports.ActionType = exports.protobufPackage = void 0;
|
|
26
|
+
exports.DispatcherDefinition = exports.OverridesDataResponse = exports.OverridesData = exports.WorkflowEvent = exports.SubscribeToWorkflowEventsRequest = exports.ActionEventResponse = exports.StepActionEvent = exports.GroupKeyActionEvent = exports.WorkerUnsubscribeResponse = exports.WorkerUnsubscribeRequest = exports.WorkerListenRequest = exports.AssignedAction = exports.WorkerRegisterResponse = exports.WorkerRegisterRequest = exports.resourceEventTypeToJSON = exports.resourceEventTypeFromJSON = exports.ResourceEventType = exports.resourceTypeToJSON = exports.resourceTypeFromJSON = exports.ResourceType = exports.stepActionEventTypeToJSON = exports.stepActionEventTypeFromJSON = exports.StepActionEventType = exports.groupKeyActionEventTypeToJSON = exports.groupKeyActionEventTypeFromJSON = exports.GroupKeyActionEventType = exports.actionTypeToJSON = exports.actionTypeFromJSON = exports.ActionType = 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 = "";
|
|
@@ -253,7 +253,7 @@ function resourceEventTypeToJSON(object) {
|
|
|
253
253
|
}
|
|
254
254
|
exports.resourceEventTypeToJSON = resourceEventTypeToJSON;
|
|
255
255
|
function createBaseWorkerRegisterRequest() {
|
|
256
|
-
return { workerName: "", actions: [], services: [] };
|
|
256
|
+
return { workerName: "", actions: [], services: [], maxRuns: undefined };
|
|
257
257
|
}
|
|
258
258
|
exports.WorkerRegisterRequest = {
|
|
259
259
|
encode(message, writer = _m0.Writer.create()) {
|
|
@@ -266,6 +266,9 @@ exports.WorkerRegisterRequest = {
|
|
|
266
266
|
for (const v of message.services) {
|
|
267
267
|
writer.uint32(26).string(v);
|
|
268
268
|
}
|
|
269
|
+
if (message.maxRuns !== undefined) {
|
|
270
|
+
writer.uint32(32).int32(message.maxRuns);
|
|
271
|
+
}
|
|
269
272
|
return writer;
|
|
270
273
|
},
|
|
271
274
|
decode(input, length) {
|
|
@@ -293,6 +296,12 @@ exports.WorkerRegisterRequest = {
|
|
|
293
296
|
}
|
|
294
297
|
message.services.push(reader.string());
|
|
295
298
|
continue;
|
|
299
|
+
case 4:
|
|
300
|
+
if (tag !== 32) {
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
message.maxRuns = reader.int32();
|
|
304
|
+
continue;
|
|
296
305
|
}
|
|
297
306
|
if ((tag & 7) === 4 || tag === 0) {
|
|
298
307
|
break;
|
|
@@ -306,6 +315,7 @@ exports.WorkerRegisterRequest = {
|
|
|
306
315
|
workerName: isSet(object.workerName) ? globalThis.String(object.workerName) : "",
|
|
307
316
|
actions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.actions) ? object.actions.map((e) => globalThis.String(e)) : [],
|
|
308
317
|
services: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.services) ? object.services.map((e) => globalThis.String(e)) : [],
|
|
318
|
+
maxRuns: isSet(object.maxRuns) ? globalThis.Number(object.maxRuns) : undefined,
|
|
309
319
|
};
|
|
310
320
|
},
|
|
311
321
|
toJSON(message) {
|
|
@@ -320,17 +330,21 @@ exports.WorkerRegisterRequest = {
|
|
|
320
330
|
if ((_b = message.services) === null || _b === void 0 ? void 0 : _b.length) {
|
|
321
331
|
obj.services = message.services;
|
|
322
332
|
}
|
|
333
|
+
if (message.maxRuns !== undefined) {
|
|
334
|
+
obj.maxRuns = Math.round(message.maxRuns);
|
|
335
|
+
}
|
|
323
336
|
return obj;
|
|
324
337
|
},
|
|
325
338
|
create(base) {
|
|
326
339
|
return exports.WorkerRegisterRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
327
340
|
},
|
|
328
341
|
fromPartial(object) {
|
|
329
|
-
var _a, _b, _c;
|
|
342
|
+
var _a, _b, _c, _d;
|
|
330
343
|
const message = createBaseWorkerRegisterRequest();
|
|
331
344
|
message.workerName = (_a = object.workerName) !== null && _a !== void 0 ? _a : "";
|
|
332
345
|
message.actions = ((_b = object.actions) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
|
|
333
346
|
message.services = ((_c = object.services) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
|
|
347
|
+
message.maxRuns = (_d = object.maxRuns) !== null && _d !== void 0 ? _d : undefined;
|
|
334
348
|
return message;
|
|
335
349
|
},
|
|
336
350
|
};
|
|
@@ -1235,6 +1249,7 @@ function createBaseWorkflowEvent() {
|
|
|
1235
1249
|
resourceId: "",
|
|
1236
1250
|
eventTimestamp: undefined,
|
|
1237
1251
|
eventPayload: "",
|
|
1252
|
+
hangup: false,
|
|
1238
1253
|
};
|
|
1239
1254
|
}
|
|
1240
1255
|
exports.WorkflowEvent = {
|
|
@@ -1257,6 +1272,9 @@ exports.WorkflowEvent = {
|
|
|
1257
1272
|
if (message.eventPayload !== "") {
|
|
1258
1273
|
writer.uint32(50).string(message.eventPayload);
|
|
1259
1274
|
}
|
|
1275
|
+
if (message.hangup === true) {
|
|
1276
|
+
writer.uint32(56).bool(message.hangup);
|
|
1277
|
+
}
|
|
1260
1278
|
return writer;
|
|
1261
1279
|
},
|
|
1262
1280
|
decode(input, length) {
|
|
@@ -1302,6 +1320,12 @@ exports.WorkflowEvent = {
|
|
|
1302
1320
|
}
|
|
1303
1321
|
message.eventPayload = reader.string();
|
|
1304
1322
|
continue;
|
|
1323
|
+
case 7:
|
|
1324
|
+
if (tag !== 56) {
|
|
1325
|
+
break;
|
|
1326
|
+
}
|
|
1327
|
+
message.hangup = reader.bool();
|
|
1328
|
+
continue;
|
|
1305
1329
|
}
|
|
1306
1330
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1307
1331
|
break;
|
|
@@ -1318,6 +1342,7 @@ exports.WorkflowEvent = {
|
|
|
1318
1342
|
resourceId: isSet(object.resourceId) ? globalThis.String(object.resourceId) : "",
|
|
1319
1343
|
eventTimestamp: isSet(object.eventTimestamp) ? fromJsonTimestamp(object.eventTimestamp) : undefined,
|
|
1320
1344
|
eventPayload: isSet(object.eventPayload) ? globalThis.String(object.eventPayload) : "",
|
|
1345
|
+
hangup: isSet(object.hangup) ? globalThis.Boolean(object.hangup) : false,
|
|
1321
1346
|
};
|
|
1322
1347
|
},
|
|
1323
1348
|
toJSON(message) {
|
|
@@ -1340,13 +1365,16 @@ exports.WorkflowEvent = {
|
|
|
1340
1365
|
if (message.eventPayload !== "") {
|
|
1341
1366
|
obj.eventPayload = message.eventPayload;
|
|
1342
1367
|
}
|
|
1368
|
+
if (message.hangup === true) {
|
|
1369
|
+
obj.hangup = message.hangup;
|
|
1370
|
+
}
|
|
1343
1371
|
return obj;
|
|
1344
1372
|
},
|
|
1345
1373
|
create(base) {
|
|
1346
1374
|
return exports.WorkflowEvent.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1347
1375
|
},
|
|
1348
1376
|
fromPartial(object) {
|
|
1349
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1377
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1350
1378
|
const message = createBaseWorkflowEvent();
|
|
1351
1379
|
message.workflowRunId = (_a = object.workflowRunId) !== null && _a !== void 0 ? _a : "";
|
|
1352
1380
|
message.resourceType = (_b = object.resourceType) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -1354,6 +1382,139 @@ exports.WorkflowEvent = {
|
|
|
1354
1382
|
message.resourceId = (_d = object.resourceId) !== null && _d !== void 0 ? _d : "";
|
|
1355
1383
|
message.eventTimestamp = (_e = object.eventTimestamp) !== null && _e !== void 0 ? _e : undefined;
|
|
1356
1384
|
message.eventPayload = (_f = object.eventPayload) !== null && _f !== void 0 ? _f : "";
|
|
1385
|
+
message.hangup = (_g = object.hangup) !== null && _g !== void 0 ? _g : false;
|
|
1386
|
+
return message;
|
|
1387
|
+
},
|
|
1388
|
+
};
|
|
1389
|
+
function createBaseOverridesData() {
|
|
1390
|
+
return { stepRunId: "", path: "", value: "", callerFilename: "" };
|
|
1391
|
+
}
|
|
1392
|
+
exports.OverridesData = {
|
|
1393
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
1394
|
+
if (message.stepRunId !== "") {
|
|
1395
|
+
writer.uint32(10).string(message.stepRunId);
|
|
1396
|
+
}
|
|
1397
|
+
if (message.path !== "") {
|
|
1398
|
+
writer.uint32(18).string(message.path);
|
|
1399
|
+
}
|
|
1400
|
+
if (message.value !== "") {
|
|
1401
|
+
writer.uint32(26).string(message.value);
|
|
1402
|
+
}
|
|
1403
|
+
if (message.callerFilename !== "") {
|
|
1404
|
+
writer.uint32(34).string(message.callerFilename);
|
|
1405
|
+
}
|
|
1406
|
+
return writer;
|
|
1407
|
+
},
|
|
1408
|
+
decode(input, length) {
|
|
1409
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1410
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1411
|
+
const message = createBaseOverridesData();
|
|
1412
|
+
while (reader.pos < end) {
|
|
1413
|
+
const tag = reader.uint32();
|
|
1414
|
+
switch (tag >>> 3) {
|
|
1415
|
+
case 1:
|
|
1416
|
+
if (tag !== 10) {
|
|
1417
|
+
break;
|
|
1418
|
+
}
|
|
1419
|
+
message.stepRunId = reader.string();
|
|
1420
|
+
continue;
|
|
1421
|
+
case 2:
|
|
1422
|
+
if (tag !== 18) {
|
|
1423
|
+
break;
|
|
1424
|
+
}
|
|
1425
|
+
message.path = reader.string();
|
|
1426
|
+
continue;
|
|
1427
|
+
case 3:
|
|
1428
|
+
if (tag !== 26) {
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1431
|
+
message.value = reader.string();
|
|
1432
|
+
continue;
|
|
1433
|
+
case 4:
|
|
1434
|
+
if (tag !== 34) {
|
|
1435
|
+
break;
|
|
1436
|
+
}
|
|
1437
|
+
message.callerFilename = reader.string();
|
|
1438
|
+
continue;
|
|
1439
|
+
}
|
|
1440
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1441
|
+
break;
|
|
1442
|
+
}
|
|
1443
|
+
reader.skipType(tag & 7);
|
|
1444
|
+
}
|
|
1445
|
+
return message;
|
|
1446
|
+
},
|
|
1447
|
+
fromJSON(object) {
|
|
1448
|
+
return {
|
|
1449
|
+
stepRunId: isSet(object.stepRunId) ? globalThis.String(object.stepRunId) : "",
|
|
1450
|
+
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
|
1451
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
1452
|
+
callerFilename: isSet(object.callerFilename) ? globalThis.String(object.callerFilename) : "",
|
|
1453
|
+
};
|
|
1454
|
+
},
|
|
1455
|
+
toJSON(message) {
|
|
1456
|
+
const obj = {};
|
|
1457
|
+
if (message.stepRunId !== "") {
|
|
1458
|
+
obj.stepRunId = message.stepRunId;
|
|
1459
|
+
}
|
|
1460
|
+
if (message.path !== "") {
|
|
1461
|
+
obj.path = message.path;
|
|
1462
|
+
}
|
|
1463
|
+
if (message.value !== "") {
|
|
1464
|
+
obj.value = message.value;
|
|
1465
|
+
}
|
|
1466
|
+
if (message.callerFilename !== "") {
|
|
1467
|
+
obj.callerFilename = message.callerFilename;
|
|
1468
|
+
}
|
|
1469
|
+
return obj;
|
|
1470
|
+
},
|
|
1471
|
+
create(base) {
|
|
1472
|
+
return exports.OverridesData.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1473
|
+
},
|
|
1474
|
+
fromPartial(object) {
|
|
1475
|
+
var _a, _b, _c, _d;
|
|
1476
|
+
const message = createBaseOverridesData();
|
|
1477
|
+
message.stepRunId = (_a = object.stepRunId) !== null && _a !== void 0 ? _a : "";
|
|
1478
|
+
message.path = (_b = object.path) !== null && _b !== void 0 ? _b : "";
|
|
1479
|
+
message.value = (_c = object.value) !== null && _c !== void 0 ? _c : "";
|
|
1480
|
+
message.callerFilename = (_d = object.callerFilename) !== null && _d !== void 0 ? _d : "";
|
|
1481
|
+
return message;
|
|
1482
|
+
},
|
|
1483
|
+
};
|
|
1484
|
+
function createBaseOverridesDataResponse() {
|
|
1485
|
+
return {};
|
|
1486
|
+
}
|
|
1487
|
+
exports.OverridesDataResponse = {
|
|
1488
|
+
encode(_, writer = _m0.Writer.create()) {
|
|
1489
|
+
return writer;
|
|
1490
|
+
},
|
|
1491
|
+
decode(input, length) {
|
|
1492
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1493
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1494
|
+
const message = createBaseOverridesDataResponse();
|
|
1495
|
+
while (reader.pos < end) {
|
|
1496
|
+
const tag = reader.uint32();
|
|
1497
|
+
switch (tag >>> 3) {
|
|
1498
|
+
}
|
|
1499
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1500
|
+
break;
|
|
1501
|
+
}
|
|
1502
|
+
reader.skipType(tag & 7);
|
|
1503
|
+
}
|
|
1504
|
+
return message;
|
|
1505
|
+
},
|
|
1506
|
+
fromJSON(_) {
|
|
1507
|
+
return {};
|
|
1508
|
+
},
|
|
1509
|
+
toJSON(_) {
|
|
1510
|
+
const obj = {};
|
|
1511
|
+
return obj;
|
|
1512
|
+
},
|
|
1513
|
+
create(base) {
|
|
1514
|
+
return exports.OverridesDataResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1515
|
+
},
|
|
1516
|
+
fromPartial(_) {
|
|
1517
|
+
const message = createBaseOverridesDataResponse();
|
|
1357
1518
|
return message;
|
|
1358
1519
|
},
|
|
1359
1520
|
};
|
|
@@ -1401,6 +1562,14 @@ exports.DispatcherDefinition = {
|
|
|
1401
1562
|
responseStream: false,
|
|
1402
1563
|
options: {},
|
|
1403
1564
|
},
|
|
1565
|
+
putOverridesData: {
|
|
1566
|
+
name: "PutOverridesData",
|
|
1567
|
+
requestType: exports.OverridesData,
|
|
1568
|
+
requestStream: false,
|
|
1569
|
+
responseType: exports.OverridesDataResponse,
|
|
1570
|
+
responseStream: false,
|
|
1571
|
+
options: {},
|
|
1572
|
+
},
|
|
1404
1573
|
unsubscribe: {
|
|
1405
1574
|
name: "Unsubscribe",
|
|
1406
1575
|
requestType: exports.WorkerUnsubscribeRequest,
|
|
@@ -5,6 +5,7 @@ export declare enum ConcurrencyLimitStrategy {
|
|
|
5
5
|
CANCEL_IN_PROGRESS = 0,
|
|
6
6
|
DROP_NEWEST = 1,
|
|
7
7
|
QUEUE_NEWEST = 2,
|
|
8
|
+
GROUP_ROUND_ROBIN = 3,
|
|
8
9
|
UNRECOGNIZED = -1
|
|
9
10
|
}
|
|
10
11
|
export declare function concurrencyLimitStrategyFromJSON(object: any): ConcurrencyLimitStrategy;
|
|
@@ -64,6 +65,8 @@ export interface CreateWorkflowStepOpts {
|
|
|
64
65
|
parents: string[];
|
|
65
66
|
/** (optional) the custom step user data, assuming string representation of JSON */
|
|
66
67
|
userData: string;
|
|
68
|
+
/** (optional) the number of retries for the step, default 0 */
|
|
69
|
+
retries: number;
|
|
67
70
|
}
|
|
68
71
|
/** ListWorkflowsRequest is the request for ListWorkflows. */
|
|
69
72
|
export interface ListWorkflowsRequest {
|
|
@@ -33,6 +33,7 @@ var ConcurrencyLimitStrategy;
|
|
|
33
33
|
ConcurrencyLimitStrategy[ConcurrencyLimitStrategy["CANCEL_IN_PROGRESS"] = 0] = "CANCEL_IN_PROGRESS";
|
|
34
34
|
ConcurrencyLimitStrategy[ConcurrencyLimitStrategy["DROP_NEWEST"] = 1] = "DROP_NEWEST";
|
|
35
35
|
ConcurrencyLimitStrategy[ConcurrencyLimitStrategy["QUEUE_NEWEST"] = 2] = "QUEUE_NEWEST";
|
|
36
|
+
ConcurrencyLimitStrategy[ConcurrencyLimitStrategy["GROUP_ROUND_ROBIN"] = 3] = "GROUP_ROUND_ROBIN";
|
|
36
37
|
ConcurrencyLimitStrategy[ConcurrencyLimitStrategy["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
37
38
|
})(ConcurrencyLimitStrategy || (exports.ConcurrencyLimitStrategy = ConcurrencyLimitStrategy = {}));
|
|
38
39
|
function concurrencyLimitStrategyFromJSON(object) {
|
|
@@ -46,6 +47,9 @@ function concurrencyLimitStrategyFromJSON(object) {
|
|
|
46
47
|
case 2:
|
|
47
48
|
case "QUEUE_NEWEST":
|
|
48
49
|
return ConcurrencyLimitStrategy.QUEUE_NEWEST;
|
|
50
|
+
case 3:
|
|
51
|
+
case "GROUP_ROUND_ROBIN":
|
|
52
|
+
return ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN;
|
|
49
53
|
case -1:
|
|
50
54
|
case "UNRECOGNIZED":
|
|
51
55
|
default:
|
|
@@ -61,6 +65,8 @@ function concurrencyLimitStrategyToJSON(object) {
|
|
|
61
65
|
return "DROP_NEWEST";
|
|
62
66
|
case ConcurrencyLimitStrategy.QUEUE_NEWEST:
|
|
63
67
|
return "QUEUE_NEWEST";
|
|
68
|
+
case ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN:
|
|
69
|
+
return "GROUP_ROUND_ROBIN";
|
|
64
70
|
case ConcurrencyLimitStrategy.UNRECOGNIZED:
|
|
65
71
|
default:
|
|
66
72
|
return "UNRECOGNIZED";
|
|
@@ -470,7 +476,7 @@ exports.CreateWorkflowJobOpts = {
|
|
|
470
476
|
},
|
|
471
477
|
};
|
|
472
478
|
function createBaseCreateWorkflowStepOpts() {
|
|
473
|
-
return { readableId: "", action: "", timeout: "", inputs: "", parents: [], userData: "" };
|
|
479
|
+
return { readableId: "", action: "", timeout: "", inputs: "", parents: [], userData: "", retries: 0 };
|
|
474
480
|
}
|
|
475
481
|
exports.CreateWorkflowStepOpts = {
|
|
476
482
|
encode(message, writer = _m0.Writer.create()) {
|
|
@@ -492,6 +498,9 @@ exports.CreateWorkflowStepOpts = {
|
|
|
492
498
|
if (message.userData !== "") {
|
|
493
499
|
writer.uint32(50).string(message.userData);
|
|
494
500
|
}
|
|
501
|
+
if (message.retries !== 0) {
|
|
502
|
+
writer.uint32(56).int32(message.retries);
|
|
503
|
+
}
|
|
495
504
|
return writer;
|
|
496
505
|
},
|
|
497
506
|
decode(input, length) {
|
|
@@ -537,6 +546,12 @@ exports.CreateWorkflowStepOpts = {
|
|
|
537
546
|
}
|
|
538
547
|
message.userData = reader.string();
|
|
539
548
|
continue;
|
|
549
|
+
case 7:
|
|
550
|
+
if (tag !== 56) {
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
message.retries = reader.int32();
|
|
554
|
+
continue;
|
|
540
555
|
}
|
|
541
556
|
if ((tag & 7) === 4 || tag === 0) {
|
|
542
557
|
break;
|
|
@@ -553,6 +568,7 @@ exports.CreateWorkflowStepOpts = {
|
|
|
553
568
|
inputs: isSet(object.inputs) ? globalThis.String(object.inputs) : "",
|
|
554
569
|
parents: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.parents) ? object.parents.map((e) => globalThis.String(e)) : [],
|
|
555
570
|
userData: isSet(object.userData) ? globalThis.String(object.userData) : "",
|
|
571
|
+
retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0,
|
|
556
572
|
};
|
|
557
573
|
},
|
|
558
574
|
toJSON(message) {
|
|
@@ -576,13 +592,16 @@ exports.CreateWorkflowStepOpts = {
|
|
|
576
592
|
if (message.userData !== "") {
|
|
577
593
|
obj.userData = message.userData;
|
|
578
594
|
}
|
|
595
|
+
if (message.retries !== 0) {
|
|
596
|
+
obj.retries = Math.round(message.retries);
|
|
597
|
+
}
|
|
579
598
|
return obj;
|
|
580
599
|
},
|
|
581
600
|
create(base) {
|
|
582
601
|
return exports.CreateWorkflowStepOpts.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
583
602
|
},
|
|
584
603
|
fromPartial(object) {
|
|
585
|
-
var _a, _b, _c, _d, _e, _f;
|
|
604
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
586
605
|
const message = createBaseCreateWorkflowStepOpts();
|
|
587
606
|
message.readableId = (_a = object.readableId) !== null && _a !== void 0 ? _a : "";
|
|
588
607
|
message.action = (_b = object.action) !== null && _b !== void 0 ? _b : "";
|
|
@@ -590,6 +609,7 @@ exports.CreateWorkflowStepOpts = {
|
|
|
590
609
|
message.inputs = (_d = object.inputs) !== null && _d !== void 0 ? _d : "";
|
|
591
610
|
message.parents = ((_e = object.parents) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || [];
|
|
592
611
|
message.userData = (_f = object.userData) !== null && _f !== void 0 ? _f : "";
|
|
612
|
+
message.retries = (_g = object.retries) !== null && _g !== void 0 ? _g : 0;
|
|
593
613
|
return message;
|
|
594
614
|
},
|
|
595
615
|
};
|
package/step.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
+
import { Action } from './clients/dispatcher/action-listener';
|
|
2
3
|
export declare const CreateStepSchema: z.ZodObject<{
|
|
3
4
|
name: z.ZodString;
|
|
4
5
|
parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5
6
|
timeout: z.ZodOptional<z.ZodString>;
|
|
7
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
6
8
|
}, "strip", z.ZodTypeAny, {
|
|
7
9
|
name: string;
|
|
8
10
|
parents?: string[] | undefined;
|
|
9
11
|
timeout?: string | undefined;
|
|
12
|
+
retries?: number | undefined;
|
|
10
13
|
}, {
|
|
11
14
|
name: string;
|
|
12
15
|
parents?: string[] | undefined;
|
|
13
16
|
timeout?: string | undefined;
|
|
17
|
+
retries?: number | undefined;
|
|
14
18
|
}>;
|
|
15
19
|
export type NextStep = {
|
|
16
20
|
[key: string]: string;
|
|
@@ -23,8 +27,9 @@ interface ContextData<T, K> {
|
|
|
23
27
|
}
|
|
24
28
|
export declare class Context<T, K> {
|
|
25
29
|
data: ContextData<T, K>;
|
|
30
|
+
input: T;
|
|
26
31
|
controller: AbortController;
|
|
27
|
-
constructor(
|
|
32
|
+
constructor(action: Action);
|
|
28
33
|
stepOutput(step: string): string;
|
|
29
34
|
triggeredByEvent(): boolean;
|
|
30
35
|
workflowInput(): T;
|
package/step.js
CHANGED
|
@@ -34,12 +34,21 @@ exports.CreateStepSchema = z.object({
|
|
|
34
34
|
name: z.string(),
|
|
35
35
|
parents: z.array(z.string()).optional(),
|
|
36
36
|
timeout: workflow_1.HatchetTimeoutSchema.optional(),
|
|
37
|
+
retries: z.number().optional(),
|
|
37
38
|
});
|
|
38
39
|
class Context {
|
|
39
|
-
constructor(
|
|
40
|
+
constructor(action) {
|
|
40
41
|
this.controller = new AbortController();
|
|
41
42
|
try {
|
|
42
|
-
|
|
43
|
+
const data = JSON.parse(JSON.parse(action.actionPayload));
|
|
44
|
+
this.data = data;
|
|
45
|
+
// if this is a getGroupKeyRunId, the data is the workflow input
|
|
46
|
+
if (action.getGroupKeyRunId !== '') {
|
|
47
|
+
this.input = data;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.input = data.input;
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
catch (e) {
|
|
45
54
|
throw new hatchet_error_1.default(`Could not parse payload: ${e.message}`);
|
|
@@ -59,8 +68,7 @@ class Context {
|
|
|
59
68
|
return ((_a = this.data) === null || _a === void 0 ? void 0 : _a.triggered_by) === 'event';
|
|
60
69
|
}
|
|
61
70
|
workflowInput() {
|
|
62
|
-
|
|
63
|
-
return (_a = this.data) === null || _a === void 0 ? void 0 : _a.input;
|
|
71
|
+
return this.input;
|
|
64
72
|
}
|
|
65
73
|
userData() {
|
|
66
74
|
var _a;
|
package/workflow.d.ts
CHANGED
|
@@ -5,14 +5,17 @@ declare const StepsSchema: z.ZodArray<z.ZodObject<{
|
|
|
5
5
|
name: z.ZodString;
|
|
6
6
|
parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
7
|
timeout: z.ZodOptional<z.ZodString>;
|
|
8
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
8
9
|
}, "strip", z.ZodTypeAny, {
|
|
9
10
|
name: string;
|
|
10
11
|
parents?: string[] | undefined;
|
|
11
12
|
timeout?: string | undefined;
|
|
13
|
+
retries?: number | undefined;
|
|
12
14
|
}, {
|
|
13
15
|
name: string;
|
|
14
16
|
parents?: string[] | undefined;
|
|
15
17
|
timeout?: string | undefined;
|
|
18
|
+
retries?: number | undefined;
|
|
16
19
|
}>, "many">;
|
|
17
20
|
export type Steps = z.infer<typeof StepsSchema>;
|
|
18
21
|
export declare const ConcurrencyLimitStrategy: typeof PbConcurrencyLimitStrategy;
|
|
@@ -58,14 +61,17 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
|
|
|
58
61
|
name: z.ZodString;
|
|
59
62
|
parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
60
63
|
timeout: z.ZodOptional<z.ZodString>;
|
|
64
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
61
65
|
}, "strip", z.ZodTypeAny, {
|
|
62
66
|
name: string;
|
|
63
67
|
parents?: string[] | undefined;
|
|
64
68
|
timeout?: string | undefined;
|
|
69
|
+
retries?: number | undefined;
|
|
65
70
|
}, {
|
|
66
71
|
name: string;
|
|
67
72
|
parents?: string[] | undefined;
|
|
68
73
|
timeout?: string | undefined;
|
|
74
|
+
retries?: number | undefined;
|
|
69
75
|
}>, "many">;
|
|
70
76
|
}, "strip", z.ZodTypeAny, {
|
|
71
77
|
description: string;
|
|
@@ -73,6 +79,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
|
|
|
73
79
|
name: string;
|
|
74
80
|
parents?: string[] | undefined;
|
|
75
81
|
timeout?: string | undefined;
|
|
82
|
+
retries?: number | undefined;
|
|
76
83
|
}[];
|
|
77
84
|
id: string;
|
|
78
85
|
on: {
|
|
@@ -90,6 +97,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
|
|
|
90
97
|
name: string;
|
|
91
98
|
parents?: string[] | undefined;
|
|
92
99
|
timeout?: string | undefined;
|
|
100
|
+
retries?: number | undefined;
|
|
93
101
|
}[];
|
|
94
102
|
id: string;
|
|
95
103
|
on: {
|