@hatchet-dev/typescript-sdk 1.5.4 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clients/event/event-client.d.ts +10 -1
- package/clients/event/event-client.js +13 -1
- package/clients/hatchet-client/hatchet-client.js +1 -1
- package/clients/rest/generated/Api.d.ts +117 -2
- package/clients/rest/generated/Api.js +60 -1
- package/clients/rest/generated/data-contracts.d.ts +169 -1
- package/package.json +1 -1
- package/protoc/events/events.d.ts +5 -0
- package/protoc/events/events.js +56 -3
- package/v1/client/client.d.ts +7 -0
- package/v1/client/client.js +11 -0
- package/v1/client/features/filters.d.ts +21 -0
- package/v1/client/features/filters.js +59 -0
- package/v1/client/features/runs.d.ts +7 -0
- package/v1/client/features/runs.js +1 -0
- package/v1/client/features/workflows.js +1 -1
- package/v1/client/worker/context.d.ts +5 -0
- package/v1/client/worker/context.js +8 -0
- package/v1/examples/on_event/event.js +1 -0
- package/v1/examples/on_event/workflow.d.ts +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -3,6 +3,8 @@ import { EventsServiceClient } from '../../protoc/events/events';
|
|
|
3
3
|
import { ClientConfig } from '../hatchet-client/client-config';
|
|
4
4
|
import { Logger } from '../../util/logger';
|
|
5
5
|
import { retrier } from '../../util/retrier';
|
|
6
|
+
import { HatchetClient } from '../../v1';
|
|
7
|
+
import { LegacyHatchetClient } from '../hatchet-client';
|
|
6
8
|
export declare enum LogLevel {
|
|
7
9
|
INFO = "INFO",
|
|
8
10
|
WARN = "WARN",
|
|
@@ -11,19 +13,26 @@ export declare enum LogLevel {
|
|
|
11
13
|
}
|
|
12
14
|
export interface PushEventOptions {
|
|
13
15
|
additionalMetadata?: Record<string, string>;
|
|
16
|
+
priority?: number;
|
|
17
|
+
scope?: string;
|
|
14
18
|
}
|
|
15
19
|
export interface EventWithMetadata<T> {
|
|
16
20
|
payload: T;
|
|
17
21
|
additionalMetadata?: Record<string, any>;
|
|
22
|
+
priority?: number;
|
|
23
|
+
scope?: string;
|
|
18
24
|
}
|
|
19
25
|
export declare class EventClient {
|
|
20
26
|
config: ClientConfig;
|
|
21
27
|
client: EventsServiceClient;
|
|
22
28
|
retrier: typeof retrier;
|
|
29
|
+
api: HatchetClient['api'];
|
|
30
|
+
tenantId: string;
|
|
23
31
|
logger: Logger;
|
|
24
|
-
constructor(config: ClientConfig, channel: Channel, factory: ClientFactory);
|
|
32
|
+
constructor(config: ClientConfig, channel: Channel, factory: ClientFactory, hatchetClient: LegacyHatchetClient);
|
|
25
33
|
push<T>(type: string, input: T, options?: PushEventOptions): Promise<import("../../protoc/events/events").Event>;
|
|
26
34
|
bulkPush<T>(type: string, inputs: EventWithMetadata<T>[], options?: PushEventOptions): Promise<import("../../protoc/events/events").Events>;
|
|
27
35
|
putLog(stepRunId: string, log: string, level?: LogLevel, taskRetryCount?: number, metadata?: Record<string, any>): Promise<void>;
|
|
28
36
|
putStream(stepRunId: string, data: string | Uint8Array): Promise<void>;
|
|
37
|
+
list(opts?: Parameters<typeof this.api.v1EventList>[1]): Promise<import("../rest/generated/data-contracts").V1EventList>;
|
|
29
38
|
}
|
|
@@ -25,11 +25,13 @@ var LogLevel;
|
|
|
25
25
|
LogLevel["DEBUG"] = "DEBUG";
|
|
26
26
|
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
27
27
|
class EventClient {
|
|
28
|
-
constructor(config, channel, factory) {
|
|
28
|
+
constructor(config, channel, factory, hatchetClient) {
|
|
29
29
|
this.config = config;
|
|
30
30
|
this.client = factory.create(events_1.EventsServiceDefinition, channel);
|
|
31
31
|
this.logger = config.logger(`Dispatcher`, config.log_level);
|
|
32
32
|
this.retrier = retrier_1.retrier;
|
|
33
|
+
this.api = hatchetClient.api;
|
|
34
|
+
this.tenantId = config.tenant_id;
|
|
33
35
|
}
|
|
34
36
|
push(type, input, options = {}) {
|
|
35
37
|
var _a;
|
|
@@ -41,6 +43,8 @@ class EventClient {
|
|
|
41
43
|
additionalMetadata: options.additionalMetadata
|
|
42
44
|
? JSON.stringify(options.additionalMetadata)
|
|
43
45
|
: undefined,
|
|
46
|
+
priority: options.priority,
|
|
47
|
+
scope: options.scope,
|
|
44
48
|
};
|
|
45
49
|
try {
|
|
46
50
|
const e = this.retrier(() => __awaiter(this, void 0, void 0, function* () { return this.client.push(req); }), this.logger);
|
|
@@ -68,6 +72,8 @@ class EventClient {
|
|
|
68
72
|
}
|
|
69
73
|
return undefined;
|
|
70
74
|
})(),
|
|
75
|
+
priority: input.priority,
|
|
76
|
+
scope: input.scope,
|
|
71
77
|
};
|
|
72
78
|
});
|
|
73
79
|
const req = {
|
|
@@ -130,5 +136,11 @@ class EventClient {
|
|
|
130
136
|
});
|
|
131
137
|
});
|
|
132
138
|
}
|
|
139
|
+
list(opts) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
const { data } = yield this.api.v1EventList(this.tenantId, opts);
|
|
142
|
+
return data;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
133
145
|
}
|
|
134
146
|
exports.EventClient = EventClient;
|
|
@@ -56,7 +56,7 @@ class LegacyHatchetClient {
|
|
|
56
56
|
const clientFactory = (0, nice_grpc_1.createClientFactory)().use((0, grpc_helpers_1.addTokenMiddleware)(this.config.token));
|
|
57
57
|
this.tenantId = this.config.tenant_id;
|
|
58
58
|
this.api = (0, rest_1.default)(this.config.api_url, this.config.token, axiosOpts);
|
|
59
|
-
this.event = new event_client_1.EventClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory);
|
|
59
|
+
this.event = new event_client_1.EventClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this);
|
|
60
60
|
this.dispatcher = new dispatcher_client_1.DispatcherClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory);
|
|
61
61
|
this.listener = new child_listener_client_1.RunListenerClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this.api);
|
|
62
62
|
this.admin = new admin_client_1.AdminClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this.api, this.tenantId, this.listener, this.runs);
|
|
@@ -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, V1DagChildren, V1LogLineList, V1ReplayTaskRequest, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TriggerWorkflowRunRequest, 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, V1CancelTaskRequest, V1CreateFilterRequest, V1DagChildren, V1EventList, V1Filter, V1FilterList, V1LogLineList, V1ReplayTaskRequest, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TaskTimingList, V1TriggerWorkflowRunRequest, 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
|
/**
|
|
@@ -10,7 +10,10 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
10
10
|
* @request GET:/api/v1/stable/tasks/{task}
|
|
11
11
|
* @secure
|
|
12
12
|
*/
|
|
13
|
-
v1TaskGet: (task: string,
|
|
13
|
+
v1TaskGet: (task: string, query?: {
|
|
14
|
+
/** The attempt number */
|
|
15
|
+
attempt?: number;
|
|
16
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskSummary, any>>;
|
|
14
17
|
/**
|
|
15
18
|
* @description List events for a task
|
|
16
19
|
*
|
|
@@ -134,6 +137,13 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
134
137
|
* @maxLength 36
|
|
135
138
|
*/
|
|
136
139
|
parent_task_external_id?: string;
|
|
140
|
+
/**
|
|
141
|
+
* The external id of the event that triggered the workflow run
|
|
142
|
+
* @format uuid
|
|
143
|
+
* @minLength 36
|
|
144
|
+
* @maxLength 36
|
|
145
|
+
*/
|
|
146
|
+
triggering_event_external_id?: string;
|
|
137
147
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskSummaryList, any>>;
|
|
138
148
|
/**
|
|
139
149
|
* @description Lists displayable names of workflow runs for a tenant
|
|
@@ -189,6 +199,22 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
189
199
|
*/
|
|
190
200
|
limit?: number;
|
|
191
201
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskEventList, any>>;
|
|
202
|
+
/**
|
|
203
|
+
* @description Get the timings for a workflow run
|
|
204
|
+
*
|
|
205
|
+
* @tags Workflow Runs
|
|
206
|
+
* @name V1WorkflowRunGetTimings
|
|
207
|
+
* @summary List timings for a workflow run
|
|
208
|
+
* @request GET:/api/v1/stable/workflow-runs/{v1-workflow-run}/task-timings
|
|
209
|
+
* @secure
|
|
210
|
+
*/
|
|
211
|
+
v1WorkflowRunGetTimings: (v1WorkflowRun: string, query?: {
|
|
212
|
+
/**
|
|
213
|
+
* The depth to retrieve children
|
|
214
|
+
* @format int64
|
|
215
|
+
*/
|
|
216
|
+
depth?: number;
|
|
217
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskTimingList, any>>;
|
|
192
218
|
/**
|
|
193
219
|
* @description Get a summary of task run metrics for a tenant
|
|
194
220
|
*
|
|
@@ -204,6 +230,11 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
204
230
|
* @format date-time
|
|
205
231
|
*/
|
|
206
232
|
since: string;
|
|
233
|
+
/**
|
|
234
|
+
* The end time to get metrics for
|
|
235
|
+
* @format date-time
|
|
236
|
+
*/
|
|
237
|
+
until?: string;
|
|
207
238
|
/** The workflow id to find runs for */
|
|
208
239
|
workflow_ids?: string[];
|
|
209
240
|
/**
|
|
@@ -213,6 +244,13 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
213
244
|
* @maxLength 36
|
|
214
245
|
*/
|
|
215
246
|
parent_task_external_id?: string;
|
|
247
|
+
/**
|
|
248
|
+
* The id of the event that triggered the task
|
|
249
|
+
* @format uuid
|
|
250
|
+
* @minLength 36
|
|
251
|
+
* @maxLength 36
|
|
252
|
+
*/
|
|
253
|
+
triggering_event_external_id?: string;
|
|
216
254
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskRunMetrics, any>>;
|
|
217
255
|
/**
|
|
218
256
|
* @description Get a minute by minute breakdown of task metrics for a tenant
|
|
@@ -237,6 +275,83 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
237
275
|
*/
|
|
238
276
|
finishedBefore?: string;
|
|
239
277
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskPointMetrics, any>>;
|
|
278
|
+
/**
|
|
279
|
+
* @description Lists all events for a tenant.
|
|
280
|
+
*
|
|
281
|
+
* @tags Event
|
|
282
|
+
* @name V1EventList
|
|
283
|
+
* @summary List events
|
|
284
|
+
* @request GET:/api/v1/stable/tenants/{tenant}/events
|
|
285
|
+
* @secure
|
|
286
|
+
*/
|
|
287
|
+
v1EventList: (tenant: string, query?: {
|
|
288
|
+
/**
|
|
289
|
+
* The number to skip
|
|
290
|
+
* @format int64
|
|
291
|
+
*/
|
|
292
|
+
offset?: number;
|
|
293
|
+
/**
|
|
294
|
+
* The number to limit by
|
|
295
|
+
* @format int64
|
|
296
|
+
*/
|
|
297
|
+
limit?: number;
|
|
298
|
+
/** A list of keys to filter by */
|
|
299
|
+
keys?: EventKey[];
|
|
300
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1EventList, any>>;
|
|
301
|
+
/**
|
|
302
|
+
* @description Lists all filters for a tenant.
|
|
303
|
+
*
|
|
304
|
+
* @tags Filter
|
|
305
|
+
* @name V1FilterList
|
|
306
|
+
* @summary List filters
|
|
307
|
+
* @request GET:/api/v1/stable/tenants/{tenant}/filters
|
|
308
|
+
* @secure
|
|
309
|
+
*/
|
|
310
|
+
v1FilterList: (tenant: string, query?: {
|
|
311
|
+
/**
|
|
312
|
+
* The number to skip
|
|
313
|
+
* @format int64
|
|
314
|
+
*/
|
|
315
|
+
offset?: number;
|
|
316
|
+
/**
|
|
317
|
+
* The number to limit by
|
|
318
|
+
* @format int64
|
|
319
|
+
*/
|
|
320
|
+
limit?: number;
|
|
321
|
+
/** The workflow ids to filter by */
|
|
322
|
+
workflowIds?: string[];
|
|
323
|
+
/** The scopes to subset candidate filters by */
|
|
324
|
+
scopes?: string[];
|
|
325
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1FilterList, any>>;
|
|
326
|
+
/**
|
|
327
|
+
* @description Create a new filter
|
|
328
|
+
*
|
|
329
|
+
* @tags Filter
|
|
330
|
+
* @name V1FilterCreate
|
|
331
|
+
* @summary Create a filter
|
|
332
|
+
* @request POST:/api/v1/stable/tenants/{tenant}/filters
|
|
333
|
+
* @secure
|
|
334
|
+
*/
|
|
335
|
+
v1FilterCreate: (tenant: string, data: V1CreateFilterRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1Filter, any>>;
|
|
336
|
+
/**
|
|
337
|
+
* @description Get a filter by its id
|
|
338
|
+
*
|
|
339
|
+
* @tags Filter
|
|
340
|
+
* @name V1FilterGet
|
|
341
|
+
* @summary Get a filter
|
|
342
|
+
* @request GET:/api/v1/stable/tenants/{tenant}/filters/{v1-filter}
|
|
343
|
+
* @secure
|
|
344
|
+
*/
|
|
345
|
+
v1FilterGet: (tenant: string, v1Filter: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1Filter, any>>;
|
|
346
|
+
/**
|
|
347
|
+
* @description Delete a filter
|
|
348
|
+
*
|
|
349
|
+
* @tags Filter
|
|
350
|
+
* @name V1FilterDelete
|
|
351
|
+
* @request DELETE:/api/v1/stable/tenants/{tenant}/filters/{v1-filter}
|
|
352
|
+
* @secure
|
|
353
|
+
*/
|
|
354
|
+
v1FilterDelete: (tenant: string, v1Filter: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1Filter, any>>;
|
|
240
355
|
/**
|
|
241
356
|
* @description Gets the readiness status
|
|
242
357
|
*
|
|
@@ -25,7 +25,7 @@ class Api extends http_client_1.HttpClient {
|
|
|
25
25
|
* @request GET:/api/v1/stable/tasks/{task}
|
|
26
26
|
* @secure
|
|
27
27
|
*/
|
|
28
|
-
this.v1TaskGet = (task, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tasks/${task}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
28
|
+
this.v1TaskGet = (task, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tasks/${task}`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
29
29
|
/**
|
|
30
30
|
* @description List events for a task
|
|
31
31
|
*
|
|
@@ -126,6 +126,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
126
126
|
* @secure
|
|
127
127
|
*/
|
|
128
128
|
this.v1WorkflowRunTaskEventsList = (v1WorkflowRun, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/workflow-runs/${v1WorkflowRun}/task-events`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
129
|
+
/**
|
|
130
|
+
* @description Get the timings for a workflow run
|
|
131
|
+
*
|
|
132
|
+
* @tags Workflow Runs
|
|
133
|
+
* @name V1WorkflowRunGetTimings
|
|
134
|
+
* @summary List timings for a workflow run
|
|
135
|
+
* @request GET:/api/v1/stable/workflow-runs/{v1-workflow-run}/task-timings
|
|
136
|
+
* @secure
|
|
137
|
+
*/
|
|
138
|
+
this.v1WorkflowRunGetTimings = (v1WorkflowRun, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/workflow-runs/${v1WorkflowRun}/task-timings`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
129
139
|
/**
|
|
130
140
|
* @description Get a summary of task run metrics for a tenant
|
|
131
141
|
*
|
|
@@ -146,6 +156,55 @@ class Api extends http_client_1.HttpClient {
|
|
|
146
156
|
* @secure
|
|
147
157
|
*/
|
|
148
158
|
this.v1TaskGetPointMetrics = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/task-point-metrics`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
159
|
+
/**
|
|
160
|
+
* @description Lists all events for a tenant.
|
|
161
|
+
*
|
|
162
|
+
* @tags Event
|
|
163
|
+
* @name V1EventList
|
|
164
|
+
* @summary List events
|
|
165
|
+
* @request GET:/api/v1/stable/tenants/{tenant}/events
|
|
166
|
+
* @secure
|
|
167
|
+
*/
|
|
168
|
+
this.v1EventList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/events`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
169
|
+
/**
|
|
170
|
+
* @description Lists all filters for a tenant.
|
|
171
|
+
*
|
|
172
|
+
* @tags Filter
|
|
173
|
+
* @name V1FilterList
|
|
174
|
+
* @summary List filters
|
|
175
|
+
* @request GET:/api/v1/stable/tenants/{tenant}/filters
|
|
176
|
+
* @secure
|
|
177
|
+
*/
|
|
178
|
+
this.v1FilterList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/filters`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
179
|
+
/**
|
|
180
|
+
* @description Create a new filter
|
|
181
|
+
*
|
|
182
|
+
* @tags Filter
|
|
183
|
+
* @name V1FilterCreate
|
|
184
|
+
* @summary Create a filter
|
|
185
|
+
* @request POST:/api/v1/stable/tenants/{tenant}/filters
|
|
186
|
+
* @secure
|
|
187
|
+
*/
|
|
188
|
+
this.v1FilterCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/filters`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
189
|
+
/**
|
|
190
|
+
* @description Get a filter by its id
|
|
191
|
+
*
|
|
192
|
+
* @tags Filter
|
|
193
|
+
* @name V1FilterGet
|
|
194
|
+
* @summary Get a filter
|
|
195
|
+
* @request GET:/api/v1/stable/tenants/{tenant}/filters/{v1-filter}
|
|
196
|
+
* @secure
|
|
197
|
+
*/
|
|
198
|
+
this.v1FilterGet = (tenant, v1Filter, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/filters/${v1Filter}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
199
|
+
/**
|
|
200
|
+
* @description Delete a filter
|
|
201
|
+
*
|
|
202
|
+
* @tags Filter
|
|
203
|
+
* @name V1FilterDelete
|
|
204
|
+
* @request DELETE:/api/v1/stable/tenants/{tenant}/filters/{v1-filter}
|
|
205
|
+
* @secure
|
|
206
|
+
*/
|
|
207
|
+
this.v1FilterDelete = (tenant, v1Filter, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/filters/${v1Filter}`, method: 'DELETE', secure: true, format: 'json' }, params));
|
|
149
208
|
/**
|
|
150
209
|
* @description Gets the readiness status
|
|
151
210
|
*
|
|
@@ -538,6 +538,13 @@ export interface CreateEventRequest {
|
|
|
538
538
|
data: object;
|
|
539
539
|
/** Additional metadata for the event. */
|
|
540
540
|
additionalMetadata?: object;
|
|
541
|
+
/**
|
|
542
|
+
* The priority of the event.
|
|
543
|
+
* @format int32
|
|
544
|
+
*/
|
|
545
|
+
priority?: number;
|
|
546
|
+
/** The scope for event filtering. */
|
|
547
|
+
scope?: string;
|
|
541
548
|
}
|
|
542
549
|
export interface BulkCreateEventRequest {
|
|
543
550
|
events: CreateEventRequest[];
|
|
@@ -592,6 +599,70 @@ export interface EventList {
|
|
|
592
599
|
pagination?: PaginationResponse;
|
|
593
600
|
rows?: Event[];
|
|
594
601
|
}
|
|
602
|
+
export interface V1EventList {
|
|
603
|
+
pagination?: PaginationResponse;
|
|
604
|
+
rows?: {
|
|
605
|
+
metadata: APIResourceMeta;
|
|
606
|
+
/** The key for the event. */
|
|
607
|
+
key: string;
|
|
608
|
+
/** The tenant associated with this event. */
|
|
609
|
+
tenant?: Tenant;
|
|
610
|
+
/** The ID of the tenant associated with this event. */
|
|
611
|
+
tenantId: string;
|
|
612
|
+
/** The workflow run summary for this event. */
|
|
613
|
+
workflowRunSummary: {
|
|
614
|
+
/**
|
|
615
|
+
* The number of running runs.
|
|
616
|
+
* @format int64
|
|
617
|
+
*/
|
|
618
|
+
running: number;
|
|
619
|
+
/**
|
|
620
|
+
* The number of queued runs.
|
|
621
|
+
* @format int64
|
|
622
|
+
*/
|
|
623
|
+
queued: number;
|
|
624
|
+
/**
|
|
625
|
+
* The number of succeeded runs.
|
|
626
|
+
* @format int64
|
|
627
|
+
*/
|
|
628
|
+
succeeded: number;
|
|
629
|
+
/**
|
|
630
|
+
* The number of failed runs.
|
|
631
|
+
* @format int64
|
|
632
|
+
*/
|
|
633
|
+
failed: number;
|
|
634
|
+
/**
|
|
635
|
+
* The number of cancelled runs.
|
|
636
|
+
* @format int64
|
|
637
|
+
*/
|
|
638
|
+
cancelled: number;
|
|
639
|
+
};
|
|
640
|
+
/** Additional metadata for the event. */
|
|
641
|
+
additionalMetadata?: object;
|
|
642
|
+
}[];
|
|
643
|
+
}
|
|
644
|
+
export interface V1FilterList {
|
|
645
|
+
pagination?: PaginationResponse;
|
|
646
|
+
rows?: V1Filter[];
|
|
647
|
+
}
|
|
648
|
+
export interface V1Filter {
|
|
649
|
+
metadata: APIResourceMeta;
|
|
650
|
+
/** The ID of the tenant associated with this filter. */
|
|
651
|
+
tenantId: string;
|
|
652
|
+
/**
|
|
653
|
+
* The workflow id associated with this filter.
|
|
654
|
+
* @format uuid
|
|
655
|
+
* @minLength 36
|
|
656
|
+
* @maxLength 36
|
|
657
|
+
*/
|
|
658
|
+
workflowId: string;
|
|
659
|
+
/** The scope associated with this filter. Used for subsetting candidate filters at evaluation time */
|
|
660
|
+
scope: string;
|
|
661
|
+
/** The expression associated with this filter. */
|
|
662
|
+
expression: string;
|
|
663
|
+
/** Additional payload data associated with the filter */
|
|
664
|
+
payload: object;
|
|
665
|
+
}
|
|
595
666
|
export interface RateLimit {
|
|
596
667
|
/** The key for the rate limit. */
|
|
597
668
|
key: string;
|
|
@@ -633,6 +704,8 @@ export interface Workflow {
|
|
|
633
704
|
tags?: WorkflowTag[];
|
|
634
705
|
/** The jobs of the workflow. */
|
|
635
706
|
jobs?: Job[];
|
|
707
|
+
/** The tenant id of the workflow. */
|
|
708
|
+
tenantId: string;
|
|
636
709
|
}
|
|
637
710
|
export interface WorkflowUpdateRequest {
|
|
638
711
|
/** Whether the workflow is paused. */
|
|
@@ -1317,6 +1390,10 @@ export interface V1TaskSummary {
|
|
|
1317
1390
|
metadata: APIResourceMeta;
|
|
1318
1391
|
/** The action ID of the task. */
|
|
1319
1392
|
actionId?: string;
|
|
1393
|
+
/** The number of retries of the task. */
|
|
1394
|
+
retryCount?: number;
|
|
1395
|
+
/** The attempt number of the task. */
|
|
1396
|
+
attempt?: number;
|
|
1320
1397
|
/** Additional metadata for the task run. */
|
|
1321
1398
|
additionalMetadata?: object;
|
|
1322
1399
|
/** The list of children tasks */
|
|
@@ -1387,7 +1464,7 @@ export interface V1TaskSummary {
|
|
|
1387
1464
|
* The external ID of the workflow run
|
|
1388
1465
|
* @format uuid
|
|
1389
1466
|
*/
|
|
1390
|
-
workflowRunExternalId
|
|
1467
|
+
workflowRunExternalId: string;
|
|
1391
1468
|
/**
|
|
1392
1469
|
* The version ID of the workflow
|
|
1393
1470
|
* @format uuid
|
|
@@ -1414,6 +1491,10 @@ export interface V1TaskEventList {
|
|
|
1414
1491
|
/** @format uuid */
|
|
1415
1492
|
workerId?: string;
|
|
1416
1493
|
taskDisplayName?: string;
|
|
1494
|
+
/** The number of retries of the task. */
|
|
1495
|
+
retryCount?: number;
|
|
1496
|
+
/** The attempt number of the task. */
|
|
1497
|
+
attempt?: number;
|
|
1417
1498
|
}[];
|
|
1418
1499
|
}
|
|
1419
1500
|
export type V1TaskRunMetrics = {
|
|
@@ -1540,8 +1621,95 @@ export interface V1LogLine {
|
|
|
1540
1621
|
message: string;
|
|
1541
1622
|
/** The log metadata. */
|
|
1542
1623
|
metadata: object;
|
|
1624
|
+
/** The retry count of the log line. */
|
|
1625
|
+
retryCount?: number;
|
|
1626
|
+
/** The attempt number of the log line. */
|
|
1627
|
+
attempt?: number;
|
|
1628
|
+
/** The log level. */
|
|
1629
|
+
level?: V1LogLineLevel;
|
|
1543
1630
|
}
|
|
1544
1631
|
export interface V1LogLineList {
|
|
1545
1632
|
pagination?: PaginationResponse;
|
|
1546
1633
|
rows?: V1LogLine[];
|
|
1547
1634
|
}
|
|
1635
|
+
export interface V1TaskTiming {
|
|
1636
|
+
metadata: APIResourceMeta;
|
|
1637
|
+
/** The depth of the task in the waterfall. */
|
|
1638
|
+
depth: number;
|
|
1639
|
+
status: V1TaskStatus;
|
|
1640
|
+
/** The display name of the task run. */
|
|
1641
|
+
taskDisplayName: string;
|
|
1642
|
+
/**
|
|
1643
|
+
* The external ID of the task.
|
|
1644
|
+
* @format uuid
|
|
1645
|
+
* @minLength 36
|
|
1646
|
+
* @maxLength 36
|
|
1647
|
+
*/
|
|
1648
|
+
taskExternalId: string;
|
|
1649
|
+
/** The ID of the task. */
|
|
1650
|
+
taskId: number;
|
|
1651
|
+
/**
|
|
1652
|
+
* The timestamp the task was inserted.
|
|
1653
|
+
* @format date-time
|
|
1654
|
+
*/
|
|
1655
|
+
taskInsertedAt: string;
|
|
1656
|
+
/**
|
|
1657
|
+
* The ID of the tenant.
|
|
1658
|
+
* @format uuid
|
|
1659
|
+
* @minLength 36
|
|
1660
|
+
* @maxLength 36
|
|
1661
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
1662
|
+
*/
|
|
1663
|
+
tenantId: string;
|
|
1664
|
+
/**
|
|
1665
|
+
* The external ID of the parent task.
|
|
1666
|
+
* @format uuid
|
|
1667
|
+
* @minLength 36
|
|
1668
|
+
* @maxLength 36
|
|
1669
|
+
*/
|
|
1670
|
+
parentTaskExternalId?: string;
|
|
1671
|
+
/**
|
|
1672
|
+
* The timestamp the task run was queued.
|
|
1673
|
+
* @format date-time
|
|
1674
|
+
*/
|
|
1675
|
+
queuedAt?: string;
|
|
1676
|
+
/**
|
|
1677
|
+
* The timestamp the task run started.
|
|
1678
|
+
* @format date-time
|
|
1679
|
+
*/
|
|
1680
|
+
startedAt?: string;
|
|
1681
|
+
/**
|
|
1682
|
+
* The timestamp the task run finished.
|
|
1683
|
+
* @format date-time
|
|
1684
|
+
*/
|
|
1685
|
+
finishedAt?: string;
|
|
1686
|
+
/**
|
|
1687
|
+
* The external ID of the workflow run.
|
|
1688
|
+
* @format uuid
|
|
1689
|
+
*/
|
|
1690
|
+
workflowRunId?: string;
|
|
1691
|
+
/** The number of retries of the task. */
|
|
1692
|
+
retryCount?: number;
|
|
1693
|
+
/** The attempt number of the task. */
|
|
1694
|
+
attempt?: number;
|
|
1695
|
+
}
|
|
1696
|
+
export interface V1TaskTimingList {
|
|
1697
|
+
pagination: PaginationResponse;
|
|
1698
|
+
/** The list of task timings */
|
|
1699
|
+
rows: V1TaskTiming[];
|
|
1700
|
+
}
|
|
1701
|
+
export interface V1CreateFilterRequest {
|
|
1702
|
+
/**
|
|
1703
|
+
* The workflow id
|
|
1704
|
+
* @format uuid
|
|
1705
|
+
* @minLength 36
|
|
1706
|
+
* @maxLength 36
|
|
1707
|
+
*/
|
|
1708
|
+
workflowId: string;
|
|
1709
|
+
/** The expression for the filter */
|
|
1710
|
+
expression: string;
|
|
1711
|
+
/** The scope associated with this filter. Used for subsetting candidate filters at evaluation time */
|
|
1712
|
+
scope: string;
|
|
1713
|
+
/** The payload for the filter */
|
|
1714
|
+
payload?: object;
|
|
1715
|
+
}
|
package/package.json
CHANGED
|
@@ -14,6 +14,8 @@ export interface Event {
|
|
|
14
14
|
eventTimestamp: Date | undefined;
|
|
15
15
|
/** the payload for the event */
|
|
16
16
|
additionalMetadata?: string | undefined;
|
|
17
|
+
/** the scope associated with this filter. Used for subsetting candidate filters at evaluation time */
|
|
18
|
+
scope?: string | undefined;
|
|
17
19
|
}
|
|
18
20
|
export interface Events {
|
|
19
21
|
events: Event[];
|
|
@@ -58,6 +60,9 @@ export interface PushEventRequest {
|
|
|
58
60
|
eventTimestamp: Date | undefined;
|
|
59
61
|
/** metadata for the event */
|
|
60
62
|
additionalMetadata?: string | undefined;
|
|
63
|
+
priority?: number | undefined;
|
|
64
|
+
/** the scope associated with this filter. Used for subsetting candidate filters at evaluation time */
|
|
65
|
+
scope?: string | undefined;
|
|
61
66
|
}
|
|
62
67
|
export interface ReplayEventRequest {
|
|
63
68
|
/** the event id to replay */
|
package/protoc/events/events.js
CHANGED
|
@@ -18,6 +18,7 @@ function createBaseEvent() {
|
|
|
18
18
|
payload: '',
|
|
19
19
|
eventTimestamp: undefined,
|
|
20
20
|
additionalMetadata: undefined,
|
|
21
|
+
scope: undefined,
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
exports.Event = {
|
|
@@ -40,6 +41,9 @@ exports.Event = {
|
|
|
40
41
|
if (message.additionalMetadata !== undefined) {
|
|
41
42
|
writer.uint32(50).string(message.additionalMetadata);
|
|
42
43
|
}
|
|
44
|
+
if (message.scope !== undefined) {
|
|
45
|
+
writer.uint32(58).string(message.scope);
|
|
46
|
+
}
|
|
43
47
|
return writer;
|
|
44
48
|
},
|
|
45
49
|
decode(input, length) {
|
|
@@ -91,6 +95,13 @@ exports.Event = {
|
|
|
91
95
|
message.additionalMetadata = reader.string();
|
|
92
96
|
continue;
|
|
93
97
|
}
|
|
98
|
+
case 7: {
|
|
99
|
+
if (tag !== 58) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
message.scope = reader.string();
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
94
105
|
}
|
|
95
106
|
if ((tag & 7) === 4 || tag === 0) {
|
|
96
107
|
break;
|
|
@@ -111,6 +122,7 @@ exports.Event = {
|
|
|
111
122
|
additionalMetadata: isSet(object.additionalMetadata)
|
|
112
123
|
? globalThis.String(object.additionalMetadata)
|
|
113
124
|
: undefined,
|
|
125
|
+
scope: isSet(object.scope) ? globalThis.String(object.scope) : undefined,
|
|
114
126
|
};
|
|
115
127
|
},
|
|
116
128
|
toJSON(message) {
|
|
@@ -133,13 +145,16 @@ exports.Event = {
|
|
|
133
145
|
if (message.additionalMetadata !== undefined) {
|
|
134
146
|
obj.additionalMetadata = message.additionalMetadata;
|
|
135
147
|
}
|
|
148
|
+
if (message.scope !== undefined) {
|
|
149
|
+
obj.scope = message.scope;
|
|
150
|
+
}
|
|
136
151
|
return obj;
|
|
137
152
|
},
|
|
138
153
|
create(base) {
|
|
139
154
|
return exports.Event.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
140
155
|
},
|
|
141
156
|
fromPartial(object) {
|
|
142
|
-
var _a, _b, _c, _d, _e, _f;
|
|
157
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
143
158
|
const message = createBaseEvent();
|
|
144
159
|
message.tenantId = (_a = object.tenantId) !== null && _a !== void 0 ? _a : '';
|
|
145
160
|
message.eventId = (_b = object.eventId) !== null && _b !== void 0 ? _b : '';
|
|
@@ -147,6 +162,7 @@ exports.Event = {
|
|
|
147
162
|
message.payload = (_d = object.payload) !== null && _d !== void 0 ? _d : '';
|
|
148
163
|
message.eventTimestamp = (_e = object.eventTimestamp) !== null && _e !== void 0 ? _e : undefined;
|
|
149
164
|
message.additionalMetadata = (_f = object.additionalMetadata) !== null && _f !== void 0 ? _f : undefined;
|
|
165
|
+
message.scope = (_g = object.scope) !== null && _g !== void 0 ? _g : undefined;
|
|
150
166
|
return message;
|
|
151
167
|
},
|
|
152
168
|
};
|
|
@@ -576,7 +592,14 @@ exports.BulkPushEventRequest = {
|
|
|
576
592
|
},
|
|
577
593
|
};
|
|
578
594
|
function createBasePushEventRequest() {
|
|
579
|
-
return {
|
|
595
|
+
return {
|
|
596
|
+
key: '',
|
|
597
|
+
payload: '',
|
|
598
|
+
eventTimestamp: undefined,
|
|
599
|
+
additionalMetadata: undefined,
|
|
600
|
+
priority: undefined,
|
|
601
|
+
scope: undefined,
|
|
602
|
+
};
|
|
580
603
|
}
|
|
581
604
|
exports.PushEventRequest = {
|
|
582
605
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -592,6 +615,12 @@ exports.PushEventRequest = {
|
|
|
592
615
|
if (message.additionalMetadata !== undefined) {
|
|
593
616
|
writer.uint32(34).string(message.additionalMetadata);
|
|
594
617
|
}
|
|
618
|
+
if (message.priority !== undefined) {
|
|
619
|
+
writer.uint32(40).int32(message.priority);
|
|
620
|
+
}
|
|
621
|
+
if (message.scope !== undefined) {
|
|
622
|
+
writer.uint32(50).string(message.scope);
|
|
623
|
+
}
|
|
595
624
|
return writer;
|
|
596
625
|
},
|
|
597
626
|
decode(input, length) {
|
|
@@ -629,6 +658,20 @@ exports.PushEventRequest = {
|
|
|
629
658
|
message.additionalMetadata = reader.string();
|
|
630
659
|
continue;
|
|
631
660
|
}
|
|
661
|
+
case 5: {
|
|
662
|
+
if (tag !== 40) {
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
message.priority = reader.int32();
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
case 6: {
|
|
669
|
+
if (tag !== 50) {
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
message.scope = reader.string();
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
632
675
|
}
|
|
633
676
|
if ((tag & 7) === 4 || tag === 0) {
|
|
634
677
|
break;
|
|
@@ -647,6 +690,8 @@ exports.PushEventRequest = {
|
|
|
647
690
|
additionalMetadata: isSet(object.additionalMetadata)
|
|
648
691
|
? globalThis.String(object.additionalMetadata)
|
|
649
692
|
: undefined,
|
|
693
|
+
priority: isSet(object.priority) ? globalThis.Number(object.priority) : undefined,
|
|
694
|
+
scope: isSet(object.scope) ? globalThis.String(object.scope) : undefined,
|
|
650
695
|
};
|
|
651
696
|
},
|
|
652
697
|
toJSON(message) {
|
|
@@ -663,18 +708,26 @@ exports.PushEventRequest = {
|
|
|
663
708
|
if (message.additionalMetadata !== undefined) {
|
|
664
709
|
obj.additionalMetadata = message.additionalMetadata;
|
|
665
710
|
}
|
|
711
|
+
if (message.priority !== undefined) {
|
|
712
|
+
obj.priority = Math.round(message.priority);
|
|
713
|
+
}
|
|
714
|
+
if (message.scope !== undefined) {
|
|
715
|
+
obj.scope = message.scope;
|
|
716
|
+
}
|
|
666
717
|
return obj;
|
|
667
718
|
},
|
|
668
719
|
create(base) {
|
|
669
720
|
return exports.PushEventRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
670
721
|
},
|
|
671
722
|
fromPartial(object) {
|
|
672
|
-
var _a, _b, _c, _d;
|
|
723
|
+
var _a, _b, _c, _d, _e, _f;
|
|
673
724
|
const message = createBasePushEventRequest();
|
|
674
725
|
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
|
|
675
726
|
message.payload = (_b = object.payload) !== null && _b !== void 0 ? _b : '';
|
|
676
727
|
message.eventTimestamp = (_c = object.eventTimestamp) !== null && _c !== void 0 ? _c : undefined;
|
|
677
728
|
message.additionalMetadata = (_d = object.additionalMetadata) !== null && _d !== void 0 ? _d : undefined;
|
|
729
|
+
message.priority = (_e = object.priority) !== null && _e !== void 0 ? _e : undefined;
|
|
730
|
+
message.scope = (_f = object.scope) !== null && _f !== void 0 ? _f : undefined;
|
|
678
731
|
return message;
|
|
679
732
|
},
|
|
680
733
|
};
|
package/v1/client/client.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { RunsClient } from './features/runs';
|
|
|
14
14
|
import { InputType, OutputType, UnknownInputType, StrictWorkflowOutputType } from '../types';
|
|
15
15
|
import { RatelimitsClient } from './features';
|
|
16
16
|
import { AdminClient } from './admin';
|
|
17
|
+
import { FiltersClient } from './features/filters';
|
|
17
18
|
/**
|
|
18
19
|
* HatchetV1 implements the main client interface for interacting with the Hatchet workflow engine.
|
|
19
20
|
* It provides methods for creating and executing workflows, as well as managing workers.
|
|
@@ -162,6 +163,12 @@ export declare class HatchetClient implements IHatchetClient {
|
|
|
162
163
|
* @returns A metrics client instance
|
|
163
164
|
*/
|
|
164
165
|
get metrics(): MetricsClient;
|
|
166
|
+
private _filters;
|
|
167
|
+
/**
|
|
168
|
+
* Get the filters client for creating and managing filters
|
|
169
|
+
* @returns A filters client instance
|
|
170
|
+
*/
|
|
171
|
+
get filters(): FiltersClient;
|
|
165
172
|
private _ratelimits;
|
|
166
173
|
/**
|
|
167
174
|
* Get the rate limits client for creating and managing rate limits
|
package/v1/client/client.js
CHANGED
|
@@ -29,6 +29,7 @@ const workflows_1 = require("./features/workflows");
|
|
|
29
29
|
const runs_1 = require("./features/runs");
|
|
30
30
|
const features_1 = require("./features");
|
|
31
31
|
const admin_1 = require("./admin");
|
|
32
|
+
const filters_1 = require("./features/filters");
|
|
32
33
|
/**
|
|
33
34
|
* HatchetV1 implements the main client interface for interacting with the Hatchet workflow engine.
|
|
34
35
|
* It provides methods for creating and executing workflows, as well as managing workers.
|
|
@@ -224,6 +225,16 @@ class HatchetClient {
|
|
|
224
225
|
}
|
|
225
226
|
return this._metrics;
|
|
226
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the filters client for creating and managing filters
|
|
230
|
+
* @returns A filters client instance
|
|
231
|
+
*/
|
|
232
|
+
get filters() {
|
|
233
|
+
if (!this._filters) {
|
|
234
|
+
this._filters = new filters_1.FiltersClient(this);
|
|
235
|
+
}
|
|
236
|
+
return this._filters;
|
|
237
|
+
}
|
|
227
238
|
/**
|
|
228
239
|
* Get the rate limits client for creating and managing rate limits
|
|
229
240
|
* @returns A rate limits client instance
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HatchetClient } from '../client';
|
|
2
|
+
export type WorkflowIdScopePair = {
|
|
3
|
+
workflowId: string;
|
|
4
|
+
scope: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The filters client is a client for interacting with Hatchet's filters API.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FiltersClient {
|
|
10
|
+
tenantId: string;
|
|
11
|
+
api: HatchetClient['api'];
|
|
12
|
+
constructor(client: HatchetClient);
|
|
13
|
+
list(opts?: {
|
|
14
|
+
limit?: number;
|
|
15
|
+
offset?: number;
|
|
16
|
+
workflowIdsAndScopes?: WorkflowIdScopePair[];
|
|
17
|
+
}): Promise<import("../../../clients/rest/generated/data-contracts").V1FilterList>;
|
|
18
|
+
get(filterId: Parameters<typeof this.api.v1FilterGet>[1]): Promise<import("../../../clients/rest/generated/data-contracts").V1Filter>;
|
|
19
|
+
create(opts: Parameters<typeof this.api.v1FilterCreate>[1]): Promise<import("../../../clients/rest/generated/data-contracts").V1Filter>;
|
|
20
|
+
delete(filterId: Parameters<typeof this.api.v1FilterDelete>[1]): Promise<import("../../../clients/rest/generated/data-contracts").V1Filter>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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.FiltersClient = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* The filters client is a client for interacting with Hatchet's filters API.
|
|
15
|
+
*/
|
|
16
|
+
class FiltersClient {
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.tenantId = client.tenantId;
|
|
19
|
+
this.api = client.api;
|
|
20
|
+
}
|
|
21
|
+
list(opts) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const hasWorkflowIdsAndScopes = (opts === null || opts === void 0 ? void 0 : opts.workflowIdsAndScopes) !== undefined;
|
|
25
|
+
const workflowIds = hasWorkflowIdsAndScopes
|
|
26
|
+
? (_a = opts.workflowIdsAndScopes) === null || _a === void 0 ? void 0 : _a.map((pair) => pair.workflowId)
|
|
27
|
+
: undefined;
|
|
28
|
+
const scopes = hasWorkflowIdsAndScopes
|
|
29
|
+
? (_b = opts.workflowIdsAndScopes) === null || _b === void 0 ? void 0 : _b.map((pair) => pair.scope)
|
|
30
|
+
: undefined;
|
|
31
|
+
const { data } = yield this.api.v1FilterList(this.tenantId, {
|
|
32
|
+
limit: opts === null || opts === void 0 ? void 0 : opts.limit,
|
|
33
|
+
offset: opts === null || opts === void 0 ? void 0 : opts.offset,
|
|
34
|
+
workflowIds,
|
|
35
|
+
scopes,
|
|
36
|
+
});
|
|
37
|
+
return data;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
get(filterId) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const { data } = yield this.api.v1FilterGet(this.tenantId, filterId);
|
|
43
|
+
return data;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
create(opts) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const { data } = yield this.api.v1FilterCreate(this.tenantId, opts);
|
|
49
|
+
return data;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
delete(filterId) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const { data } = yield this.api.v1FilterDelete(this.tenantId, filterId);
|
|
55
|
+
return data;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.FiltersClient = FiltersClient;
|
|
@@ -45,6 +45,13 @@ export interface ListRunsOpts extends RunFilter {
|
|
|
45
45
|
* @maxLength 36
|
|
46
46
|
*/
|
|
47
47
|
parentTaskExternalId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The triggering event external id to filter by
|
|
50
|
+
* @format uuid
|
|
51
|
+
* @minLength 36
|
|
52
|
+
* @maxLength 36
|
|
53
|
+
*/
|
|
54
|
+
triggeringEventExternalId?: string;
|
|
48
55
|
}
|
|
49
56
|
/**
|
|
50
57
|
* RunsClient is used to list and manage runs
|
|
@@ -78,6 +78,7 @@ class RunsClient {
|
|
|
78
78
|
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; }))) || []),
|
|
79
79
|
additional_metadata: am,
|
|
80
80
|
only_tasks: opts.onlyTasks || false,
|
|
81
|
+
triggering_event_external_id: opts.triggeringEventExternalId,
|
|
81
82
|
};
|
|
82
83
|
});
|
|
83
84
|
}
|
|
@@ -67,6 +67,11 @@ export declare class Context<T, K = {}> {
|
|
|
67
67
|
* @returns The triggers for the current workflow.
|
|
68
68
|
*/
|
|
69
69
|
triggers(): TriggerData;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the payload from the filter that matched when triggering the event.
|
|
72
|
+
* @returns The payload.
|
|
73
|
+
*/
|
|
74
|
+
filterPayload(): Record<string, any>;
|
|
70
75
|
/**
|
|
71
76
|
* Determines if the workflow was triggered by an event.
|
|
72
77
|
* @returns True if the workflow was triggered by an event, otherwise false.
|
|
@@ -112,6 +112,14 @@ class Context {
|
|
|
112
112
|
triggers() {
|
|
113
113
|
return this.data.triggers;
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets the payload from the filter that matched when triggering the event.
|
|
117
|
+
* @returns The payload.
|
|
118
|
+
*/
|
|
119
|
+
filterPayload() {
|
|
120
|
+
var _a;
|
|
121
|
+
return ((_a = this.data.triggers) === null || _a === void 0 ? void 0 : _a.filter_payload) || {};
|
|
122
|
+
}
|
|
115
123
|
/**
|
|
116
124
|
* Determines if the workflow was triggered by an event.
|
|
117
125
|
* @returns True if the workflow was triggered by an event, otherwise false.
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HATCHET_VERSION = "1.
|
|
1
|
+
export declare const HATCHET_VERSION = "1.6.1";
|
package/version.js
CHANGED