@hatchet-dev/typescript-sdk 1.9.1 → 1.9.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/rest/generated/Api.d.ts +23 -3
- package/clients/rest/generated/Api.js +22 -2
- package/clients/rest/generated/data-contracts.d.ts +37 -1
- package/clients/rest/generated/data-contracts.js +7 -1
- package/package.json +1 -1
- package/v1/client/client.d.ts +7 -0
- package/v1/client/client.interface.d.ts +2 -0
- package/v1/client/client.js +11 -0
- package/v1/client/features/cel.d.ts +31 -0
- package/v1/client/features/cel.js +61 -0
- package/v1/client/features/runs.d.ts +4 -2
- package/v1/client/features/runs.js +4 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AcceptInviteRequest, APIErrors, APIMeta, BulkCreateEventRequest, BulkCreateEventResponse, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, ListAPIMetaIntegration, ListAPITokensResponse, ListSlackWebhooks, ListSNSIntegrations, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, ScheduleWorkflowRunRequest, SNSIntegration, StepRun, StepRunArchiveList, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, V1CancelTaskRequest, V1CreateFilterRequest, V1DagChildren, V1EventList, V1Filter, V1FilterList, V1LogLineList, V1ReplayTaskRequest, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TaskTimingList, V1TriggerWorkflowRunRequest, V1UpdateFilterRequest, V1WorkflowRunDetails, V1WorkflowRunDisplayNameList, WebhookWorkerCreated, WebhookWorkerCreateRequest, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunsCancelRequest, WorkflowRunShape, WorkflowRunsMetrics, WorkflowRunStatus, WorkflowRunStatusList, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
|
|
1
|
+
import { AcceptInviteRequest, APIErrors, APIMeta, BulkCreateEventRequest, BulkCreateEventResponse, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, ListAPIMetaIntegration, ListAPITokensResponse, ListSlackWebhooks, ListSNSIntegrations, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, ScheduleWorkflowRunRequest, SNSIntegration, StepRun, StepRunArchiveList, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, V1CancelledTasks, V1CancelTaskRequest, V1CELDebugRequest, V1CELDebugResponse, V1CreateFilterRequest, V1DagChildren, V1EventList, V1Filter, V1FilterList, V1LogLineList, V1ReplayedTasks, V1ReplayTaskRequest, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TaskTimingList, V1TriggerWorkflowRunRequest, V1UpdateFilterRequest, V1WorkflowRunDetails, V1WorkflowRunDisplayNameList, WebhookWorkerCreated, WebhookWorkerCreateRequest, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunsCancelRequest, WorkflowRunShape, WorkflowRunsMetrics, WorkflowRunStatus, WorkflowRunStatusList, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
|
|
2
2
|
import { HttpClient, RequestParams } from './http-client';
|
|
3
3
|
export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
4
|
/**
|
|
@@ -54,7 +54,7 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
54
54
|
* @request POST:/api/v1/stable/tenants/{tenant}/tasks/cancel
|
|
55
55
|
* @secure
|
|
56
56
|
*/
|
|
57
|
-
v1TaskCancel: (tenant: string, data: V1CancelTaskRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<
|
|
57
|
+
v1TaskCancel: (tenant: string, data: V1CancelTaskRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1CancelledTasks, any>>;
|
|
58
58
|
/**
|
|
59
59
|
* @description Replay tasks
|
|
60
60
|
*
|
|
@@ -64,7 +64,7 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
64
64
|
* @request POST:/api/v1/stable/tenants/{tenant}/tasks/replay
|
|
65
65
|
* @secure
|
|
66
66
|
*/
|
|
67
|
-
v1TaskReplay: (tenant: string, data: V1ReplayTaskRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<
|
|
67
|
+
v1TaskReplay: (tenant: string, data: V1ReplayTaskRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1ReplayedTasks, any>>;
|
|
68
68
|
/**
|
|
69
69
|
* @description Lists all tasks that belong a specific list of dags
|
|
70
70
|
*
|
|
@@ -403,6 +403,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
403
403
|
* @secure
|
|
404
404
|
*/
|
|
405
405
|
v1FilterUpdate: (tenant: string, v1Filter: string, data: V1UpdateFilterRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1Filter, any>>;
|
|
406
|
+
/**
|
|
407
|
+
* @description Evaluate a CEL expression against provided input data.
|
|
408
|
+
*
|
|
409
|
+
* @tags CEL
|
|
410
|
+
* @name V1CelDebug
|
|
411
|
+
* @summary Debug a CEL expression
|
|
412
|
+
* @request POST:/api/v1/stable/tenants/{tenant}/cel/debug
|
|
413
|
+
* @secure
|
|
414
|
+
*/
|
|
415
|
+
v1CelDebug: (tenant: string, data: V1CELDebugRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1CELDebugResponse, any>>;
|
|
406
416
|
/**
|
|
407
417
|
* @description Gets the readiness status
|
|
408
418
|
*
|
|
@@ -1674,4 +1684,14 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
1674
1684
|
/** @example "1.0.0" */
|
|
1675
1685
|
version: string;
|
|
1676
1686
|
}, any>>;
|
|
1687
|
+
/**
|
|
1688
|
+
* @description Get the prometheus metrics for the tenant
|
|
1689
|
+
*
|
|
1690
|
+
* @tags Tenant
|
|
1691
|
+
* @name TenantGetPrometheusMetrics
|
|
1692
|
+
* @summary Get prometheus metrics
|
|
1693
|
+
* @request GET:/api/v1/tenants/{tenant}/prometheus-metrics
|
|
1694
|
+
* @secure
|
|
1695
|
+
*/
|
|
1696
|
+
tenantGetPrometheusMetrics: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<string, any>>;
|
|
1677
1697
|
}
|
|
@@ -55,7 +55,7 @@ class Api extends http_client_1.HttpClient {
|
|
|
55
55
|
* @request POST:/api/v1/stable/tenants/{tenant}/tasks/cancel
|
|
56
56
|
* @secure
|
|
57
57
|
*/
|
|
58
|
-
this.v1TaskCancel = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/tasks/cancel`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json }, params));
|
|
58
|
+
this.v1TaskCancel = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/tasks/cancel`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
59
59
|
/**
|
|
60
60
|
* @description Replay tasks
|
|
61
61
|
*
|
|
@@ -65,7 +65,7 @@ class Api extends http_client_1.HttpClient {
|
|
|
65
65
|
* @request POST:/api/v1/stable/tenants/{tenant}/tasks/replay
|
|
66
66
|
* @secure
|
|
67
67
|
*/
|
|
68
|
-
this.v1TaskReplay = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/tasks/replay`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json }, params));
|
|
68
|
+
this.v1TaskReplay = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/tasks/replay`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
69
69
|
/**
|
|
70
70
|
* @description Lists all tasks that belong a specific list of dags
|
|
71
71
|
*
|
|
@@ -234,6 +234,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
234
234
|
* @secure
|
|
235
235
|
*/
|
|
236
236
|
this.v1FilterUpdate = (tenant, v1Filter, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/filters/${v1Filter}`, method: 'PATCH', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
237
|
+
/**
|
|
238
|
+
* @description Evaluate a CEL expression against provided input data.
|
|
239
|
+
*
|
|
240
|
+
* @tags CEL
|
|
241
|
+
* @name V1CelDebug
|
|
242
|
+
* @summary Debug a CEL expression
|
|
243
|
+
* @request POST:/api/v1/stable/tenants/{tenant}/cel/debug
|
|
244
|
+
* @secure
|
|
245
|
+
*/
|
|
246
|
+
this.v1CelDebug = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/cel/debug`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
237
247
|
/**
|
|
238
248
|
* @description Gets the readiness status
|
|
239
249
|
*
|
|
@@ -1164,6 +1174,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
1164
1174
|
* @request GET:/api/v1/version
|
|
1165
1175
|
*/
|
|
1166
1176
|
this.infoGetVersion = (params = {}) => this.request(Object.assign({ path: `/api/v1/version`, method: 'GET', format: 'json' }, params));
|
|
1177
|
+
/**
|
|
1178
|
+
* @description Get the prometheus metrics for the tenant
|
|
1179
|
+
*
|
|
1180
|
+
* @tags Tenant
|
|
1181
|
+
* @name TenantGetPrometheusMetrics
|
|
1182
|
+
* @summary Get prometheus metrics
|
|
1183
|
+
* @request GET:/api/v1/tenants/{tenant}/prometheus-metrics
|
|
1184
|
+
* @secure
|
|
1185
|
+
*/
|
|
1186
|
+
this.tenantGetPrometheusMetrics = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/prometheus-metrics`, method: 'GET', secure: true }, params));
|
|
1167
1187
|
}
|
|
1168
1188
|
}
|
|
1169
1189
|
exports.Api = Api;
|
|
@@ -1092,7 +1092,7 @@ export interface SemaphoreSlots {
|
|
|
1092
1092
|
* @format uuid
|
|
1093
1093
|
*/
|
|
1094
1094
|
workflowRunId: string;
|
|
1095
|
-
status
|
|
1095
|
+
status?: StepRunStatus;
|
|
1096
1096
|
}
|
|
1097
1097
|
export interface RecentStepRuns {
|
|
1098
1098
|
metadata: APIResourceMeta;
|
|
@@ -1484,6 +1484,11 @@ export interface V1TaskSummary {
|
|
|
1484
1484
|
*/
|
|
1485
1485
|
workflowVersionId?: string;
|
|
1486
1486
|
workflowConfig?: object;
|
|
1487
|
+
/**
|
|
1488
|
+
* The external ID of the parent task.
|
|
1489
|
+
* @format uuid
|
|
1490
|
+
*/
|
|
1491
|
+
parentTaskExternalId?: string;
|
|
1487
1492
|
}
|
|
1488
1493
|
export interface V1DagChildren {
|
|
1489
1494
|
/** @format uuid */
|
|
@@ -1511,6 +1516,14 @@ export interface V1TaskEventList {
|
|
|
1511
1516
|
attempt?: number;
|
|
1512
1517
|
}[];
|
|
1513
1518
|
}
|
|
1519
|
+
export interface V1ReplayedTasks {
|
|
1520
|
+
/** The list of task external ids that were replayed */
|
|
1521
|
+
ids?: string[];
|
|
1522
|
+
}
|
|
1523
|
+
export interface V1CancelledTasks {
|
|
1524
|
+
/** The list of task external ids that were cancelled */
|
|
1525
|
+
ids?: string[];
|
|
1526
|
+
}
|
|
1514
1527
|
export declare enum V1TaskStatus {
|
|
1515
1528
|
QUEUED = "QUEUED",
|
|
1516
1529
|
RUNNING = "RUNNING",
|
|
@@ -1756,3 +1769,26 @@ export interface V1UpdateFilterRequest {
|
|
|
1756
1769
|
/** The payload for the filter */
|
|
1757
1770
|
payload?: object;
|
|
1758
1771
|
}
|
|
1772
|
+
export interface V1CELDebugRequest {
|
|
1773
|
+
/** The CEL expression to evaluate */
|
|
1774
|
+
expression: string;
|
|
1775
|
+
/** The input, which simulates the workflow run input */
|
|
1776
|
+
input: object;
|
|
1777
|
+
/** The filter payload, which simulates a payload set on a previous-created filter */
|
|
1778
|
+
filterPayload?: object;
|
|
1779
|
+
/** Additional metadata, which simulates metadata that could be sent with an event or a workflow run */
|
|
1780
|
+
additionalMetadata?: object;
|
|
1781
|
+
}
|
|
1782
|
+
export interface V1CELDebugResponse {
|
|
1783
|
+
/** The status of the CEL evaluation */
|
|
1784
|
+
status: V1CELDebugResponseStatus;
|
|
1785
|
+
/** The result of the CEL expression evaluation, if successful */
|
|
1786
|
+
output?: boolean;
|
|
1787
|
+
/** The error message if the evaluation failed */
|
|
1788
|
+
error?: string;
|
|
1789
|
+
}
|
|
1790
|
+
/** The status of the CEL evaluation */
|
|
1791
|
+
export declare enum V1CELDebugResponseStatus {
|
|
1792
|
+
SUCCESS = "SUCCESS",
|
|
1793
|
+
ERROR = "ERROR"
|
|
1794
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* ---------------------------------------------------------------
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.V1LogLineLevel = exports.V1TaskRunStatus = exports.V1TaskStatus = exports.WebhookWorkerRequestMethod = exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.WorkerRuntimeSDKs = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowKind = exports.WorkflowRunStatus = exports.WorkflowRunOrderByDirection = exports.WorkflowRunOrderByField = exports.CronWorkflowsOrderByField = exports.ScheduledRunStatus = exports.ScheduledWorkflowsOrderByField = exports.RateLimitOrderByDirection = exports.RateLimitOrderByField = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantResource = exports.TenantMemberRole = void 0;
|
|
14
|
+
exports.V1CELDebugResponseStatus = exports.V1LogLineLevel = exports.V1TaskRunStatus = exports.V1TaskStatus = exports.WebhookWorkerRequestMethod = exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.WorkerRuntimeSDKs = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowKind = exports.WorkflowRunStatus = exports.WorkflowRunOrderByDirection = exports.WorkflowRunOrderByField = exports.CronWorkflowsOrderByField = exports.ScheduledRunStatus = exports.ScheduledWorkflowsOrderByField = exports.RateLimitOrderByDirection = exports.RateLimitOrderByField = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantResource = exports.TenantMemberRole = void 0;
|
|
15
15
|
var TenantMemberRole;
|
|
16
16
|
(function (TenantMemberRole) {
|
|
17
17
|
TenantMemberRole["OWNER"] = "OWNER";
|
|
@@ -199,3 +199,9 @@ var V1LogLineLevel;
|
|
|
199
199
|
V1LogLineLevel["WARN"] = "WARN";
|
|
200
200
|
V1LogLineLevel["ERROR"] = "ERROR";
|
|
201
201
|
})(V1LogLineLevel || (exports.V1LogLineLevel = V1LogLineLevel = {}));
|
|
202
|
+
/** The status of the CEL evaluation */
|
|
203
|
+
var V1CELDebugResponseStatus;
|
|
204
|
+
(function (V1CELDebugResponseStatus) {
|
|
205
|
+
V1CELDebugResponseStatus["SUCCESS"] = "SUCCESS";
|
|
206
|
+
V1CELDebugResponseStatus["ERROR"] = "ERROR";
|
|
207
|
+
})(V1CELDebugResponseStatus || (exports.V1CELDebugResponseStatus = V1CELDebugResponseStatus = {}));
|
package/package.json
CHANGED
package/v1/client/client.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { AdminClient } from './admin';
|
|
|
18
18
|
import { FiltersClient } from './features/filters';
|
|
19
19
|
import { ScheduleClient } from './features/schedules';
|
|
20
20
|
import { CronClient } from './features/crons';
|
|
21
|
+
import { CELClient } from './features/cel';
|
|
21
22
|
import { TenantClient } from './features/tenant';
|
|
22
23
|
/**
|
|
23
24
|
* HatchetV1 implements the main client interface for interacting with the Hatchet workflow engine.
|
|
@@ -129,6 +130,12 @@ export declare class HatchetClient implements IHatchetClient {
|
|
|
129
130
|
* @returns A promise that resolves with the workflow result
|
|
130
131
|
*/
|
|
131
132
|
run<I extends InputType = UnknownInputType, O extends OutputType = void>(workflow: BaseWorkflowDeclaration<I, O> | string | V0Workflow, input: I, options?: RunOpts): Promise<O>;
|
|
133
|
+
private _cel;
|
|
134
|
+
/**
|
|
135
|
+
* Get the CEL client for debugging CEL expressions
|
|
136
|
+
* @returns A CEL client instance
|
|
137
|
+
*/
|
|
138
|
+
get cel(): CELClient;
|
|
132
139
|
private _crons;
|
|
133
140
|
/**
|
|
134
141
|
* Get the cron client for creating and managing cron workflow runs
|
|
@@ -6,8 +6,10 @@ import { WorkflowsClient } from './features/workflows';
|
|
|
6
6
|
import { AdminClient } from './admin';
|
|
7
7
|
import { ScheduleClient } from './features/schedules';
|
|
8
8
|
import { CronClient } from './features/crons';
|
|
9
|
+
import { CELClient } from './features/cel';
|
|
9
10
|
export interface IHatchetClient {
|
|
10
11
|
_v0: LegacyHatchetClient;
|
|
12
|
+
cel: CELClient;
|
|
11
13
|
metrics: MetricsClient;
|
|
12
14
|
runs: RunsClient;
|
|
13
15
|
workflows: WorkflowsClient;
|
package/v1/client/client.js
CHANGED
|
@@ -35,6 +35,7 @@ const admin_1 = require("./admin");
|
|
|
35
35
|
const filters_1 = require("./features/filters");
|
|
36
36
|
const schedules_1 = require("./features/schedules");
|
|
37
37
|
const crons_1 = require("./features/crons");
|
|
38
|
+
const cel_1 = require("./features/cel");
|
|
38
39
|
const tenant_1 = require("./features/tenant");
|
|
39
40
|
/**
|
|
40
41
|
* HatchetV1 implements the main client interface for interacting with the Hatchet workflow engine.
|
|
@@ -191,6 +192,16 @@ class HatchetClient {
|
|
|
191
192
|
return run.output;
|
|
192
193
|
});
|
|
193
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Get the CEL client for debugging CEL expressions
|
|
197
|
+
* @returns A CEL client instance
|
|
198
|
+
*/
|
|
199
|
+
get cel() {
|
|
200
|
+
if (!this._cel) {
|
|
201
|
+
this._cel = new cel_1.CELClient(this);
|
|
202
|
+
}
|
|
203
|
+
return this._cel;
|
|
204
|
+
}
|
|
194
205
|
/**
|
|
195
206
|
* Get the cron client for creating and managing cron workflow runs
|
|
196
207
|
* @returns A cron client instance
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { V1CELDebugResponseStatus } from '../../../clients/rest/generated/data-contracts';
|
|
2
|
+
import { HatchetClient } from '../client';
|
|
3
|
+
export type DebugCELInput = {
|
|
4
|
+
expression: string;
|
|
5
|
+
input: Record<string, any>;
|
|
6
|
+
additionalMetadata?: Record<string, string>;
|
|
7
|
+
filterPayload?: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
export type CELEvaluationResult = {
|
|
10
|
+
status: V1CELDebugResponseStatus.SUCCESS;
|
|
11
|
+
output: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
status: V1CELDebugResponseStatus.ERROR;
|
|
14
|
+
error: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Client for debugging CEL expressions.
|
|
18
|
+
*/
|
|
19
|
+
export declare class CELClient {
|
|
20
|
+
api: HatchetClient['api'];
|
|
21
|
+
tenantId: string;
|
|
22
|
+
constructor(client: HatchetClient);
|
|
23
|
+
/**
|
|
24
|
+
* Debug a CEL expression with the provided input, filter payload, and optional metadata. Useful for testing and validating CEL expressions and debugging issues in production.
|
|
25
|
+
*
|
|
26
|
+
* @param input - The input data to evaluate the CEL expression against.
|
|
27
|
+
* @returns A promise that resolves to the evaluation result, which can either be a success with an output or an error with a message.
|
|
28
|
+
* @throws Will throw an error if the input is invalid or the API call fails.
|
|
29
|
+
*/
|
|
30
|
+
debug(input: DebugCELInput): Promise<CELEvaluationResult>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CELClient = void 0;
|
|
13
|
+
const axios_1 = require("axios");
|
|
14
|
+
const data_contracts_1 = require("../../../clients/rest/generated/data-contracts");
|
|
15
|
+
/**
|
|
16
|
+
* Client for debugging CEL expressions.
|
|
17
|
+
*/
|
|
18
|
+
class CELClient {
|
|
19
|
+
constructor(client) {
|
|
20
|
+
this.api = client.api;
|
|
21
|
+
this.tenantId = client.tenantId;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Debug a CEL expression with the provided input, filter payload, and optional metadata. Useful for testing and validating CEL expressions and debugging issues in production.
|
|
25
|
+
*
|
|
26
|
+
* @param input - The input data to evaluate the CEL expression against.
|
|
27
|
+
* @returns A promise that resolves to the evaluation result, which can either be a success with an output or an error with a message.
|
|
28
|
+
* @throws Will throw an error if the input is invalid or the API call fails.
|
|
29
|
+
*/
|
|
30
|
+
debug(input) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
var _a;
|
|
33
|
+
try {
|
|
34
|
+
const response = yield this.api.v1CelDebug(this.tenantId, input);
|
|
35
|
+
if (response.data.status === data_contracts_1.V1CELDebugResponseStatus.ERROR) {
|
|
36
|
+
if (!response.data.error) {
|
|
37
|
+
throw new Error('No error message received from CEL debug API.');
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
status: data_contracts_1.V1CELDebugResponseStatus.ERROR,
|
|
41
|
+
error: response.data.error,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (response.data.output === undefined) {
|
|
45
|
+
throw new Error('No output received from CEL debug API.');
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
status: data_contracts_1.V1CELDebugResponseStatus.SUCCESS,
|
|
49
|
+
output: response.data.output,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
if (err instanceof axios_1.AxiosError) {
|
|
54
|
+
throw new Error(JSON.stringify((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.errors));
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.CELClient = CELClient;
|
|
@@ -53,6 +53,8 @@ export interface ListRunsOpts extends RunFilter {
|
|
|
53
53
|
* @maxLength 36
|
|
54
54
|
*/
|
|
55
55
|
triggeringEventExternalId?: string;
|
|
56
|
+
/** A flag for whether or not to include the input and output payloads in the response. Defaults to `true` if unset. */
|
|
57
|
+
includePayloads?: boolean;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* RunsClient is used to list and manage runs
|
|
@@ -66,8 +68,8 @@ export declare class RunsClient {
|
|
|
66
68
|
get<T = any>(run: string | WorkflowRunRef<T>): Promise<import("../../../clients/rest/generated/data-contracts").V1WorkflowRunDetails>;
|
|
67
69
|
get_status<T = any>(run: string | WorkflowRunRef<T>): Promise<V1TaskStatus>;
|
|
68
70
|
list(opts?: Partial<ListRunsOpts>): Promise<import("../../../clients/rest/generated/data-contracts").V1TaskSummaryList>;
|
|
69
|
-
cancel(opts: CancelRunOpts): Promise<import("axios").AxiosResponse<
|
|
70
|
-
replay(opts: ReplayRunOpts): Promise<import("axios").AxiosResponse<
|
|
71
|
+
cancel(opts: CancelRunOpts): Promise<import("axios").AxiosResponse<import("../../../clients/rest/generated/data-contracts").V1CancelledTasks, any>>;
|
|
72
|
+
replay(opts: ReplayRunOpts): Promise<import("axios").AxiosResponse<import("../../../clients/rest/generated/data-contracts").V1ReplayedTasks, any>>;
|
|
71
73
|
private prepareFilter;
|
|
72
74
|
private prepareListFilter;
|
|
73
75
|
runRef<T extends Record<string, any> = any>(id: string): WorkflowRunRef<T>;
|
|
@@ -102,6 +102,8 @@ class RunsClient {
|
|
|
102
102
|
var _a, _b;
|
|
103
103
|
const am = Object.entries(opts.additionalMetadata || {}).map(([key, value]) => `${key}:${value}`);
|
|
104
104
|
return {
|
|
105
|
+
offset: opts.offset,
|
|
106
|
+
limit: opts.limit,
|
|
105
107
|
// default to 1 hour ago
|
|
106
108
|
since: opts.since
|
|
107
109
|
? opts.since.toISOString()
|
|
@@ -112,7 +114,9 @@ class RunsClient {
|
|
|
112
114
|
workflow_ids: yield Promise.all(((_b = opts.workflowNames) === null || _b === void 0 ? void 0 : _b.map((name) => __awaiter(this, void 0, void 0, function* () { return (yield this.workflows.get(name)).metadata.id; }))) || []),
|
|
113
115
|
additional_metadata: am,
|
|
114
116
|
only_tasks: opts.onlyTasks || false,
|
|
117
|
+
parent_task_external_id: opts.parentTaskExternalId,
|
|
115
118
|
triggering_event_external_id: opts.triggeringEventExternalId,
|
|
119
|
+
include_payloads: opts.includePayloads,
|
|
116
120
|
};
|
|
117
121
|
});
|
|
118
122
|
}
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HATCHET_VERSION = "1.9.
|
|
1
|
+
export declare const HATCHET_VERSION = "1.9.3";
|
package/version.js
CHANGED