@hatchet-dev/typescript-sdk 0.7.1 → 0.7.3
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.js +5 -1
- package/clients/rest/generated/Api.d.ts +21 -1
- package/clients/rest/generated/Api.js +20 -0
- package/clients/rest/generated/data-contracts.d.ts +47 -0
- package/clients/rest/generated/data-contracts.js +9 -1
- package/clients/worker/worker.js +7 -2
- package/package.json +3 -3
- package/protoc/dispatcher/dispatcher.d.ts +3 -1
- package/protoc/dispatcher/dispatcher.js +23 -3
- package/protoc/events/events.d.ts +1 -1
- package/protoc/events/events.js +5 -0
- package/protoc/google/protobuf/timestamp.js +8 -0
- package/protoc/workflows/workflows.d.ts +1 -1
- package/protoc/workflows/workflows.js +5 -0
- package/step.d.ts +1 -1
- package/step.js +2 -1
|
@@ -81,9 +81,13 @@ class AdminClient {
|
|
|
81
81
|
*/
|
|
82
82
|
run_workflow(workflowName, input, options) {
|
|
83
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
let computedName = workflowName;
|
|
84
85
|
try {
|
|
86
|
+
if (this.config.namespace && !workflowName.startsWith(this.config.namespace)) {
|
|
87
|
+
computedName = this.config.namespace + workflowName;
|
|
88
|
+
}
|
|
85
89
|
const inputStr = JSON.stringify(input);
|
|
86
|
-
const resp = yield this.client.triggerWorkflow(Object.assign(Object.assign({ name:
|
|
90
|
+
const resp = yield this.client.triggerWorkflow(Object.assign(Object.assign({ name: computedName, input: inputStr }, options), { additionalMetadata: (options === null || options === void 0 ? void 0 : options.additionalMetadata)
|
|
87
91
|
? JSON.stringify(options === null || options === void 0 ? void 0 : options.additionalMetadata)
|
|
88
92
|
: undefined }));
|
|
89
93
|
return resp.workflowRunId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMemberList, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
|
|
1
|
+
import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantResourcePolicy, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
|
|
2
2
|
import { HttpClient, RequestParams } from './http-client';
|
|
3
3
|
export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
4
|
/**
|
|
@@ -190,6 +190,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
190
190
|
* @secure
|
|
191
191
|
*/
|
|
192
192
|
alertEmailGroupList: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<TenantAlertEmailGroupList, any>>;
|
|
193
|
+
/**
|
|
194
|
+
* @description Gets the resource policy for a tenant
|
|
195
|
+
*
|
|
196
|
+
* @tags Tenant
|
|
197
|
+
* @name TenantResourcePolicyGet
|
|
198
|
+
* @summary Create tenant alert email group
|
|
199
|
+
* @request GET:/api/v1/tenants/{tenant}/resource-policy
|
|
200
|
+
* @secure
|
|
201
|
+
*/
|
|
202
|
+
tenantResourcePolicyGet: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<TenantResourcePolicy, any>>;
|
|
193
203
|
/**
|
|
194
204
|
* @description Updates a tenant alert email group
|
|
195
205
|
*
|
|
@@ -475,6 +485,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
475
485
|
* @secure
|
|
476
486
|
*/
|
|
477
487
|
tenantMemberList: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<TenantMemberList, any>>;
|
|
488
|
+
/**
|
|
489
|
+
* @description Delete a member from a tenant
|
|
490
|
+
*
|
|
491
|
+
* @tags Tenant
|
|
492
|
+
* @name TenantMemberDelete
|
|
493
|
+
* @summary Delete a tenant member
|
|
494
|
+
* @request DELETE:/api/v1/tenants/{tenant}/members/{member}
|
|
495
|
+
* @secure
|
|
496
|
+
*/
|
|
497
|
+
tenantMemberDelete: (tenant: string, member: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<TenantMember, any>>;
|
|
478
498
|
/**
|
|
479
499
|
* @description Get the data for an event.
|
|
480
500
|
*
|
|
@@ -204,6 +204,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
204
204
|
* @secure
|
|
205
205
|
*/
|
|
206
206
|
this.alertEmailGroupList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/alerting-email-groups`, method: 'GET', secure: true, format: 'json' }, params));
|
|
207
|
+
/**
|
|
208
|
+
* @description Gets the resource policy for a tenant
|
|
209
|
+
*
|
|
210
|
+
* @tags Tenant
|
|
211
|
+
* @name TenantResourcePolicyGet
|
|
212
|
+
* @summary Create tenant alert email group
|
|
213
|
+
* @request GET:/api/v1/tenants/{tenant}/resource-policy
|
|
214
|
+
* @secure
|
|
215
|
+
*/
|
|
216
|
+
this.tenantResourcePolicyGet = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/resource-policy`, method: 'GET', secure: true, format: 'json' }, params));
|
|
207
217
|
/**
|
|
208
218
|
* @description Updates a tenant alert email group
|
|
209
219
|
*
|
|
@@ -461,6 +471,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
461
471
|
* @secure
|
|
462
472
|
*/
|
|
463
473
|
this.tenantMemberList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/members`, method: 'GET', secure: true, format: 'json' }, params));
|
|
474
|
+
/**
|
|
475
|
+
* @description Delete a member from a tenant
|
|
476
|
+
*
|
|
477
|
+
* @tags Tenant
|
|
478
|
+
* @name TenantMemberDelete
|
|
479
|
+
* @summary Delete a tenant member
|
|
480
|
+
* @request DELETE:/api/v1/tenants/{tenant}/members/{member}
|
|
481
|
+
* @secure
|
|
482
|
+
*/
|
|
483
|
+
this.tenantMemberDelete = (tenant, member, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/members/${member}`, method: 'DELETE', secure: true, format: 'json' }, params));
|
|
464
484
|
/**
|
|
465
485
|
* @description Get the data for an event.
|
|
466
486
|
*
|
|
@@ -168,6 +168,8 @@ export interface Tenant {
|
|
|
168
168
|
slug: string;
|
|
169
169
|
/** Whether the tenant has opted out of analytics. */
|
|
170
170
|
analyticsOptOut?: boolean;
|
|
171
|
+
/** Whether to alert tenant members. */
|
|
172
|
+
alertMemberEmails?: boolean;
|
|
171
173
|
}
|
|
172
174
|
export interface TenantMember {
|
|
173
175
|
metadata: APIResourceMeta;
|
|
@@ -187,6 +189,35 @@ export declare enum TenantMemberRole {
|
|
|
187
189
|
ADMIN = "ADMIN",
|
|
188
190
|
MEMBER = "MEMBER"
|
|
189
191
|
}
|
|
192
|
+
export declare enum TenantResource {
|
|
193
|
+
WORKER = "WORKER",
|
|
194
|
+
EVENT = "EVENT",
|
|
195
|
+
WORKFLOW_RUN = "WORKFLOW_RUN",
|
|
196
|
+
CRON = "CRON",
|
|
197
|
+
SCHEDULE = "SCHEDULE"
|
|
198
|
+
}
|
|
199
|
+
export interface TenantResourceLimit {
|
|
200
|
+
metadata: APIResourceMeta;
|
|
201
|
+
/** The resource associated with this limit. */
|
|
202
|
+
resource: TenantResource;
|
|
203
|
+
/** The limit associated with this limit. */
|
|
204
|
+
limitValue: number;
|
|
205
|
+
/** The alarm value associated with this limit to warn of approaching limit value. */
|
|
206
|
+
alarmValue?: number;
|
|
207
|
+
/** The current value associated with this limit. */
|
|
208
|
+
value: number;
|
|
209
|
+
/** The meter window for the limit. (i.e. 1 day, 1 week, 1 month) */
|
|
210
|
+
window?: string;
|
|
211
|
+
/**
|
|
212
|
+
* The last time the limit was refilled.
|
|
213
|
+
* @format date-time
|
|
214
|
+
*/
|
|
215
|
+
lastRefill?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface TenantResourcePolicy {
|
|
218
|
+
/** A list of resource limits for the tenant. */
|
|
219
|
+
limits: TenantResourceLimit[];
|
|
220
|
+
}
|
|
190
221
|
export interface CreateTenantInviteRequest {
|
|
191
222
|
/** The email of the user to invite. */
|
|
192
223
|
email: string;
|
|
@@ -199,6 +230,14 @@ export interface UpdateTenantInviteRequest {
|
|
|
199
230
|
}
|
|
200
231
|
export interface TenantAlertingSettings {
|
|
201
232
|
metadata: APIResourceMeta;
|
|
233
|
+
/** Whether to alert tenant members. */
|
|
234
|
+
alertMemberEmails?: boolean;
|
|
235
|
+
/** Whether to send alerts when workflow runs fail. */
|
|
236
|
+
enableWorkflowRunFailureAlerts?: boolean;
|
|
237
|
+
/** Whether to enable alerts when tokens are approaching expiration. */
|
|
238
|
+
enableExpiringTokenAlerts?: boolean;
|
|
239
|
+
/** Whether to enable alerts when tenant resources are approaching limits. */
|
|
240
|
+
enableTenantResourceLimitAlerts?: boolean;
|
|
202
241
|
/** The max frequency at which to alert. */
|
|
203
242
|
maxAlertingFrequency: string;
|
|
204
243
|
/**
|
|
@@ -275,6 +314,14 @@ export interface UpdateTenantRequest {
|
|
|
275
314
|
name?: string;
|
|
276
315
|
/** Whether the tenant has opted out of analytics. */
|
|
277
316
|
analyticsOptOut?: boolean;
|
|
317
|
+
/** Whether to alert tenant members. */
|
|
318
|
+
alertMemberEmails?: boolean;
|
|
319
|
+
/** Whether to send alerts when workflow runs fail. */
|
|
320
|
+
enableWorkflowRunFailureAlerts?: boolean;
|
|
321
|
+
/** Whether to enable alerts when tokens are approaching expiration. */
|
|
322
|
+
enableExpiringTokenAlerts?: boolean;
|
|
323
|
+
/** Whether to enable alerts when tenant resources are approaching limits. */
|
|
324
|
+
enableTenantResourceLimitAlerts?: boolean;
|
|
278
325
|
/** The max frequency at which to alert. */
|
|
279
326
|
maxAlertingFrequency?: string;
|
|
280
327
|
}
|
|
@@ -10,13 +10,21 @@
|
|
|
10
10
|
* ---------------------------------------------------------------
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowRunStatus = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantMemberRole = void 0;
|
|
13
|
+
exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowRunStatus = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantResource = exports.TenantMemberRole = void 0;
|
|
14
14
|
var TenantMemberRole;
|
|
15
15
|
(function (TenantMemberRole) {
|
|
16
16
|
TenantMemberRole["OWNER"] = "OWNER";
|
|
17
17
|
TenantMemberRole["ADMIN"] = "ADMIN";
|
|
18
18
|
TenantMemberRole["MEMBER"] = "MEMBER";
|
|
19
19
|
})(TenantMemberRole || (exports.TenantMemberRole = TenantMemberRole = {}));
|
|
20
|
+
var TenantResource;
|
|
21
|
+
(function (TenantResource) {
|
|
22
|
+
TenantResource["WORKER"] = "WORKER";
|
|
23
|
+
TenantResource["EVENT"] = "EVENT";
|
|
24
|
+
TenantResource["WORKFLOW_RUN"] = "WORKFLOW_RUN";
|
|
25
|
+
TenantResource["CRON"] = "CRON";
|
|
26
|
+
TenantResource["SCHEDULE"] = "SCHEDULE";
|
|
27
|
+
})(TenantResource || (exports.TenantResource = TenantResource = {}));
|
|
20
28
|
var EventOrderByField;
|
|
21
29
|
(function (EventOrderByField) {
|
|
22
30
|
EventOrderByField["CreatedAt"] = "createdAt";
|
package/clients/worker/worker.js
CHANGED
|
@@ -148,9 +148,14 @@ class Worker {
|
|
|
148
148
|
this.logger.info(`Step run ${action.stepRunId} succeeded`);
|
|
149
149
|
try {
|
|
150
150
|
// Send the action event to the dispatcher
|
|
151
|
-
const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_COMPLETED, result);
|
|
151
|
+
const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_COMPLETED, result || null);
|
|
152
152
|
this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
|
|
153
|
-
this.logger.error(`Could not send action event: ${e.message}`);
|
|
153
|
+
this.logger.error(`Could not send completed action event: ${e.message}`);
|
|
154
|
+
// send a failure event
|
|
155
|
+
const failureEvent = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_FAILED, e.message);
|
|
156
|
+
this.client.dispatcher.sendStepActionEvent(failureEvent).catch((err2) => {
|
|
157
|
+
this.logger.error(`Could not send failed action event: ${err2.message}`);
|
|
158
|
+
});
|
|
154
159
|
});
|
|
155
160
|
// delete the run from the futures
|
|
156
161
|
delete this.futures[action.stepRunId];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"autoprefixer": "^10.4.16",
|
|
65
65
|
"dotenv-cli": "^7.3.0",
|
|
66
66
|
"eslint": "^8.56.0",
|
|
67
|
-
"eslint-config-airbnb-typescript": "^
|
|
67
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
68
68
|
"eslint-config-prettier": "^9.1.0",
|
|
69
69
|
"eslint-config-standard-with-typescript": "^43.0.0",
|
|
70
70
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
71
71
|
"eslint-plugin-import": "^2.29.1",
|
|
72
|
-
"eslint-plugin-jest": "^
|
|
72
|
+
"eslint-plugin-jest": "^28.5.0",
|
|
73
73
|
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
|
|
74
74
|
"eslint-plugin-prettier": "^5.0.1",
|
|
75
75
|
"eslint-plugin-promise": "^6.0.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CallContext, type CallOptions } from 'nice-grpc-common';
|
|
2
2
|
import * as _m0 from 'protobufjs/minimal';
|
|
3
3
|
export declare const protobufPackage = "";
|
|
4
4
|
export declare enum ActionType {
|
|
@@ -96,6 +96,8 @@ export interface AssignedAction {
|
|
|
96
96
|
actionPayload: string;
|
|
97
97
|
/** the step name */
|
|
98
98
|
stepName: string;
|
|
99
|
+
/** the count number of the retry attempt */
|
|
100
|
+
retryCount: number;
|
|
99
101
|
}
|
|
100
102
|
export interface WorkerListenRequest {
|
|
101
103
|
/** the id of the worker */
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v1.178.0
|
|
5
|
+
// protoc v3.19.1
|
|
6
|
+
// source: dispatcher/dispatcher.proto
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -480,6 +485,7 @@ function createBaseAssignedAction() {
|
|
|
480
485
|
actionType: 0,
|
|
481
486
|
actionPayload: '',
|
|
482
487
|
stepName: '',
|
|
488
|
+
retryCount: 0,
|
|
483
489
|
};
|
|
484
490
|
}
|
|
485
491
|
exports.AssignedAction = {
|
|
@@ -520,6 +526,9 @@ exports.AssignedAction = {
|
|
|
520
526
|
if (message.stepName !== '') {
|
|
521
527
|
writer.uint32(98).string(message.stepName);
|
|
522
528
|
}
|
|
529
|
+
if (message.retryCount !== 0) {
|
|
530
|
+
writer.uint32(104).int32(message.retryCount);
|
|
531
|
+
}
|
|
523
532
|
return writer;
|
|
524
533
|
},
|
|
525
534
|
decode(input, length) {
|
|
@@ -601,6 +610,12 @@ exports.AssignedAction = {
|
|
|
601
610
|
}
|
|
602
611
|
message.stepName = reader.string();
|
|
603
612
|
continue;
|
|
613
|
+
case 13:
|
|
614
|
+
if (tag !== 104) {
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
message.retryCount = reader.int32();
|
|
618
|
+
continue;
|
|
604
619
|
}
|
|
605
620
|
if ((tag & 7) === 4 || tag === 0) {
|
|
606
621
|
break;
|
|
@@ -625,6 +640,7 @@ exports.AssignedAction = {
|
|
|
625
640
|
actionType: isSet(object.actionType) ? actionTypeFromJSON(object.actionType) : 0,
|
|
626
641
|
actionPayload: isSet(object.actionPayload) ? globalThis.String(object.actionPayload) : '',
|
|
627
642
|
stepName: isSet(object.stepName) ? globalThis.String(object.stepName) : '',
|
|
643
|
+
retryCount: isSet(object.retryCount) ? globalThis.Number(object.retryCount) : 0,
|
|
628
644
|
};
|
|
629
645
|
},
|
|
630
646
|
toJSON(message) {
|
|
@@ -665,13 +681,16 @@ exports.AssignedAction = {
|
|
|
665
681
|
if (message.stepName !== '') {
|
|
666
682
|
obj.stepName = message.stepName;
|
|
667
683
|
}
|
|
684
|
+
if (message.retryCount !== 0) {
|
|
685
|
+
obj.retryCount = Math.round(message.retryCount);
|
|
686
|
+
}
|
|
668
687
|
return obj;
|
|
669
688
|
},
|
|
670
689
|
create(base) {
|
|
671
690
|
return exports.AssignedAction.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
672
691
|
},
|
|
673
692
|
fromPartial(object) {
|
|
674
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
693
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
675
694
|
const message = createBaseAssignedAction();
|
|
676
695
|
message.tenantId = (_a = object.tenantId) !== null && _a !== void 0 ? _a : '';
|
|
677
696
|
message.workflowRunId = (_b = object.workflowRunId) !== null && _b !== void 0 ? _b : '';
|
|
@@ -685,6 +704,7 @@ exports.AssignedAction = {
|
|
|
685
704
|
message.actionType = (_k = object.actionType) !== null && _k !== void 0 ? _k : 0;
|
|
686
705
|
message.actionPayload = (_l = object.actionPayload) !== null && _l !== void 0 ? _l : '';
|
|
687
706
|
message.stepName = (_m = object.stepName) !== null && _m !== void 0 ? _m : '';
|
|
707
|
+
message.retryCount = (_o = object.retryCount) !== null && _o !== void 0 ? _o : 0;
|
|
688
708
|
return message;
|
|
689
709
|
},
|
|
690
710
|
};
|
|
@@ -1389,7 +1409,7 @@ exports.WorkflowEvent = {
|
|
|
1389
1409
|
if (message.eventPayload !== '') {
|
|
1390
1410
|
writer.uint32(50).string(message.eventPayload);
|
|
1391
1411
|
}
|
|
1392
|
-
if (message.hangup
|
|
1412
|
+
if (message.hangup !== false) {
|
|
1393
1413
|
writer.uint32(56).bool(message.hangup);
|
|
1394
1414
|
}
|
|
1395
1415
|
if (message.stepRetries !== undefined) {
|
|
@@ -1504,7 +1524,7 @@ exports.WorkflowEvent = {
|
|
|
1504
1524
|
if (message.eventPayload !== '') {
|
|
1505
1525
|
obj.eventPayload = message.eventPayload;
|
|
1506
1526
|
}
|
|
1507
|
-
if (message.hangup
|
|
1527
|
+
if (message.hangup !== false) {
|
|
1508
1528
|
obj.hangup = message.hangup;
|
|
1509
1529
|
}
|
|
1510
1530
|
if (message.stepRetries !== undefined) {
|
package/protoc/events/events.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v1.178.0
|
|
5
|
+
// protoc v3.19.1
|
|
6
|
+
// source: events/events.proto
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v1.178.0
|
|
5
|
+
// protoc v3.19.1
|
|
6
|
+
// source: google/protobuf/timestamp.proto
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -99,6 +104,9 @@ function longToNumber(long) {
|
|
|
99
104
|
if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
|
|
100
105
|
throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
|
|
101
106
|
}
|
|
107
|
+
if (long.lt(globalThis.Number.MIN_SAFE_INTEGER)) {
|
|
108
|
+
throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER');
|
|
109
|
+
}
|
|
102
110
|
return long.toNumber();
|
|
103
111
|
}
|
|
104
112
|
if (_m0.util.Long !== Long) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CallContext, type CallOptions } from 'nice-grpc-common';
|
|
2
2
|
import * as _m0 from 'protobufjs/minimal';
|
|
3
3
|
export declare const protobufPackage = "";
|
|
4
4
|
export declare enum ConcurrencyLimitStrategy {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v1.178.0
|
|
5
|
+
// protoc v3.19.1
|
|
6
|
+
// source: workflows/workflows.proto
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/step.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare class Context<T, K> {
|
|
|
97
97
|
putStream(data: string | Uint8Array): Promise<void>;
|
|
98
98
|
spawnWorkflow<P = unknown, Q = unknown>(workflowName: string, input: Q, key?: string): ChildWorkflowRef<P>;
|
|
99
99
|
}
|
|
100
|
-
export type StepRunFunction<T, K> = (ctx: Context<T, K>) => Promise<NextStep> | NextStep | void;
|
|
100
|
+
export type StepRunFunction<T, K> = (ctx: Context<T, K>) => Promise<NextStep | void> | NextStep | void;
|
|
101
101
|
export interface CreateStep<T, K> extends z.infer<typeof CreateStepSchema> {
|
|
102
102
|
run: StepRunFunction<T, K>;
|
|
103
103
|
}
|
package/step.js
CHANGED
|
@@ -225,7 +225,8 @@ class Context {
|
|
|
225
225
|
}
|
|
226
226
|
spawnWorkflow(workflowName, input, key) {
|
|
227
227
|
const { workflowRunId, stepRunId } = this.action;
|
|
228
|
-
const
|
|
228
|
+
const name = this.client.config.namespace + workflowName;
|
|
229
|
+
const childWorkflowRunIdPromise = this.client.admin.run_workflow(name, input, {
|
|
229
230
|
parentId: workflowRunId,
|
|
230
231
|
parentStepRunId: stepRunId,
|
|
231
232
|
childKey: key,
|