@hatchet-dev/typescript-sdk 0.20.1 → 0.20.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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HatchetLogger = exports.DEFAULT_LOGGER = void 0;
4
+ /* eslint-disable no-console */
4
5
  const logger_1 = require("../../util/logger");
5
6
  const DEFAULT_LOGGER = (context, logLevel) => new HatchetLogger(context, logLevel);
6
7
  exports.DEFAULT_LOGGER = DEFAULT_LOGGER;
@@ -9,7 +10,7 @@ class HatchetLogger {
9
10
  this.logLevel = logLevel;
10
11
  this.context = context;
11
12
  }
12
- log(level, message, color) {
13
+ log(level, message, color = '37') {
13
14
  if (logger_1.LogLevelEnum[level] >= logger_1.LogLevelEnum[this.logLevel]) {
14
15
  const time = new Date().toLocaleString('en-US', {
15
16
  month: '2-digit',
@@ -20,7 +21,22 @@ class HatchetLogger {
20
21
  second: '2-digit',
21
22
  });
22
23
  // eslint-disable-next-line no-console
23
- console.log(`🪓 ${process.pid} | ${time} ${color && `\x1b[${color}m`} [${level}/${this.context}] ${message}\x1b[0m`);
24
+ // eslint-disable-next-line prefer-destructuring
25
+ let print = console.log;
26
+ if (level === 'ERROR') {
27
+ print = console.error;
28
+ }
29
+ if (level === 'WARN') {
30
+ print = console.warn;
31
+ }
32
+ if (level === 'INFO') {
33
+ print = console.info;
34
+ }
35
+ if (level === 'DEBUG') {
36
+ print = console.debug;
37
+ }
38
+ // eslint-disable-next-line no-console
39
+ print(`🪓 ${process.pid} | ${time} ${color && `\x1b[${color || ''}m`} [${level}/${this.context}] ${message}\x1b[0m`);
24
40
  }
25
41
  }
26
42
  debug(message) {
@@ -92,6 +92,7 @@ const workflowStatusMap = {
92
92
  [data_contracts_1.WorkflowRunStatus.PENDING]: undefined,
93
93
  [data_contracts_1.WorkflowRunStatus.RUNNING]: undefined,
94
94
  [data_contracts_1.WorkflowRunStatus.QUEUED]: undefined,
95
+ [data_contracts_1.WorkflowRunStatus.BACKOFF]: undefined,
95
96
  };
96
97
  class RunEventListener {
97
98
  constructor(client) {
@@ -1,6 +1,195 @@
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, 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, V1DagChildren, V1ReplayTaskRequest, V1Task, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummaryList, V1WorkflowRunDetails, 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
+ /**
5
+ * @description Get a task by id
6
+ *
7
+ * @tags Task
8
+ * @name V1TaskGet
9
+ * @summary Get a task
10
+ * @request GET:/api/v1/stable/tasks/{task}
11
+ * @secure
12
+ */
13
+ v1TaskGet: (task: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1Task, any>>;
14
+ /**
15
+ * @description List events for a task
16
+ *
17
+ * @tags Task
18
+ * @name V1TaskEventList
19
+ * @summary List events for a task
20
+ * @request GET:/api/v1/stable/tasks/{task}/task-events
21
+ * @secure
22
+ */
23
+ v1TaskEventList: (task: string, query?: {
24
+ /**
25
+ * The number to skip
26
+ * @format int64
27
+ */
28
+ offset?: number;
29
+ /**
30
+ * The number to limit by
31
+ * @format int64
32
+ */
33
+ limit?: number;
34
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskEventList, any>>;
35
+ /**
36
+ * @description Cancel tasks
37
+ *
38
+ * @tags Task
39
+ * @name V1TaskCancel
40
+ * @summary Cancel tasks
41
+ * @request POST:/api/v1/stable/tenants/{tenant}/tasks/cancel
42
+ * @secure
43
+ */
44
+ v1TaskCancel: (tenant: string, data: V1CancelTaskRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
45
+ /**
46
+ * @description Replay tasks
47
+ *
48
+ * @tags Task
49
+ * @name V1TaskReplay
50
+ * @summary Replay tasks
51
+ * @request POST:/api/v1/stable/tenants/{tenant}/tasks/replay
52
+ * @secure
53
+ */
54
+ v1TaskReplay: (tenant: string, data: V1ReplayTaskRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
55
+ /**
56
+ * @description Lists all tasks that belong a specific list of dags
57
+ *
58
+ * @tags Task
59
+ * @name V1DagListTasks
60
+ * @summary List tasks
61
+ * @request GET:/api/v1/stable/dags/tasks
62
+ * @secure
63
+ */
64
+ v1DagListTasks: (query: {
65
+ /** The external id of the DAG */
66
+ dag_ids: string[];
67
+ /**
68
+ * The tenant id
69
+ * @format uuid
70
+ * @minLength 36
71
+ * @maxLength 36
72
+ */
73
+ tenant: string;
74
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1DagChildren[], any>>;
75
+ /**
76
+ * @description Lists workflow runs for a tenant.
77
+ *
78
+ * @tags Workflow Runs
79
+ * @name V1WorkflowRunList
80
+ * @summary List workflow runs
81
+ * @request GET:/api/v1/stable/tenants/{tenant}/workflow-runs
82
+ * @secure
83
+ */
84
+ v1WorkflowRunList: (tenant: string, query: {
85
+ /**
86
+ * The number to skip
87
+ * @format int64
88
+ */
89
+ offset?: number;
90
+ /**
91
+ * The number to limit by
92
+ * @format int64
93
+ */
94
+ limit?: number;
95
+ /** A list of statuses to filter by */
96
+ statuses?: V1TaskStatus[];
97
+ /**
98
+ * The earliest date to filter by
99
+ * @format date-time
100
+ */
101
+ since: string;
102
+ /**
103
+ * The latest date to filter by
104
+ * @format date-time
105
+ */
106
+ until?: string;
107
+ /** Additional metadata k-v pairs to filter by */
108
+ additional_metadata?: string[];
109
+ /** The workflow ids to find runs for */
110
+ workflow_ids?: string[];
111
+ /**
112
+ * The worker id to filter by
113
+ * @format uuid
114
+ * @minLength 36
115
+ * @maxLength 36
116
+ */
117
+ worker_id?: string;
118
+ /** Whether to include DAGs or only to include tasks */
119
+ only_tasks: boolean;
120
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskSummaryList, any>>;
121
+ /**
122
+ * @description Get a workflow run and its metadata to display on the "detail" page
123
+ *
124
+ * @tags Workflow Runs
125
+ * @name V1WorkflowRunGet
126
+ * @summary List tasks
127
+ * @request GET:/api/v1/stable/workflow-runs/{v1-workflow-run}
128
+ * @secure
129
+ */
130
+ v1WorkflowRunGet: (v1WorkflowRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1WorkflowRunDetails, any>>;
131
+ /**
132
+ * @description List all tasks for a workflow run
133
+ *
134
+ * @tags Workflow Runs
135
+ * @name V1WorkflowRunTaskEventsList
136
+ * @summary List tasks
137
+ * @request GET:/api/v1/stable/workflow-runs/{v1-workflow-run}/task-events
138
+ * @secure
139
+ */
140
+ v1WorkflowRunTaskEventsList: (v1WorkflowRun: string, query?: {
141
+ /**
142
+ * The number to skip
143
+ * @format int64
144
+ */
145
+ offset?: number;
146
+ /**
147
+ * The number to limit by
148
+ * @format int64
149
+ */
150
+ limit?: number;
151
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskEventList, any>>;
152
+ /**
153
+ * @description Get a summary of task run metrics for a tenant
154
+ *
155
+ * @tags Task
156
+ * @name V1TaskListStatusMetrics
157
+ * @summary Get task metrics
158
+ * @request GET:/api/v1/stable/tenants/{tenant}/task-metrics
159
+ * @secure
160
+ */
161
+ v1TaskListStatusMetrics: (tenant: string, query: {
162
+ /**
163
+ * The start time to get metrics for
164
+ * @format date-time
165
+ */
166
+ since: string;
167
+ /** The workflow id to find runs for */
168
+ workflow_ids?: string[];
169
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskRunMetrics, any>>;
170
+ /**
171
+ * @description Get a minute by minute breakdown of task metrics for a tenant
172
+ *
173
+ * @tags Task
174
+ * @name V1TaskGetPointMetrics
175
+ * @summary Get task point metrics
176
+ * @request GET:/api/v1/stable/tenants/{tenant}/task-point-metrics
177
+ * @secure
178
+ */
179
+ v1TaskGetPointMetrics: (tenant: string, query?: {
180
+ /**
181
+ * The time after the task was created
182
+ * @format date-time
183
+ * @example "2021-01-01T00:00:00Z"
184
+ */
185
+ createdAfter?: string;
186
+ /**
187
+ * The time before the task was completed
188
+ * @format date-time
189
+ * @example "2021-01-01T00:00:00Z"
190
+ */
191
+ finishedBefore?: string;
192
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskPointMetrics, any>>;
4
193
  /**
5
194
  * @description Gets the readiness status
6
195
  *
@@ -1247,4 +1436,15 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
1247
1436
  * @secure
1248
1437
  */
1249
1438
  monitoringPostRunProbe: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
1439
+ /**
1440
+ * @description Get the version of the server
1441
+ *
1442
+ * @name InfoGetVersion
1443
+ * @summary We return the version for the currently running server
1444
+ * @request GET:/api/v1/version
1445
+ */
1446
+ infoGetVersion: (params?: RequestParams) => Promise<import("axios").AxiosResponse<{
1447
+ /** @example "1.0.0" */
1448
+ version: string;
1449
+ }, any>>;
1250
1450
  }
@@ -15,6 +15,106 @@ const http_client_1 = require("./http-client");
15
15
  class Api extends http_client_1.HttpClient {
16
16
  constructor() {
17
17
  super(...arguments);
18
+ /**
19
+ * @description Get a task by id
20
+ *
21
+ * @tags Task
22
+ * @name V1TaskGet
23
+ * @summary Get a task
24
+ * @request GET:/api/v1/stable/tasks/{task}
25
+ * @secure
26
+ */
27
+ this.v1TaskGet = (task, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tasks/${task}`, method: 'GET', secure: true, format: 'json' }, params));
28
+ /**
29
+ * @description List events for a task
30
+ *
31
+ * @tags Task
32
+ * @name V1TaskEventList
33
+ * @summary List events for a task
34
+ * @request GET:/api/v1/stable/tasks/{task}/task-events
35
+ * @secure
36
+ */
37
+ this.v1TaskEventList = (task, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tasks/${task}/task-events`, method: 'GET', query: query, secure: true, format: 'json' }, params));
38
+ /**
39
+ * @description Cancel tasks
40
+ *
41
+ * @tags Task
42
+ * @name V1TaskCancel
43
+ * @summary Cancel tasks
44
+ * @request POST:/api/v1/stable/tenants/{tenant}/tasks/cancel
45
+ * @secure
46
+ */
47
+ 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));
48
+ /**
49
+ * @description Replay tasks
50
+ *
51
+ * @tags Task
52
+ * @name V1TaskReplay
53
+ * @summary Replay tasks
54
+ * @request POST:/api/v1/stable/tenants/{tenant}/tasks/replay
55
+ * @secure
56
+ */
57
+ 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));
58
+ /**
59
+ * @description Lists all tasks that belong a specific list of dags
60
+ *
61
+ * @tags Task
62
+ * @name V1DagListTasks
63
+ * @summary List tasks
64
+ * @request GET:/api/v1/stable/dags/tasks
65
+ * @secure
66
+ */
67
+ this.v1DagListTasks = (query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/dags/tasks`, method: 'GET', query: query, secure: true, format: 'json' }, params));
68
+ /**
69
+ * @description Lists workflow runs for a tenant.
70
+ *
71
+ * @tags Workflow Runs
72
+ * @name V1WorkflowRunList
73
+ * @summary List workflow runs
74
+ * @request GET:/api/v1/stable/tenants/{tenant}/workflow-runs
75
+ * @secure
76
+ */
77
+ this.v1WorkflowRunList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/workflow-runs`, method: 'GET', query: query, secure: true, format: 'json' }, params));
78
+ /**
79
+ * @description Get a workflow run and its metadata to display on the "detail" page
80
+ *
81
+ * @tags Workflow Runs
82
+ * @name V1WorkflowRunGet
83
+ * @summary List tasks
84
+ * @request GET:/api/v1/stable/workflow-runs/{v1-workflow-run}
85
+ * @secure
86
+ */
87
+ this.v1WorkflowRunGet = (v1WorkflowRun, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/workflow-runs/${v1WorkflowRun}`, method: 'GET', secure: true, format: 'json' }, params));
88
+ /**
89
+ * @description List all tasks for a workflow run
90
+ *
91
+ * @tags Workflow Runs
92
+ * @name V1WorkflowRunTaskEventsList
93
+ * @summary List tasks
94
+ * @request GET:/api/v1/stable/workflow-runs/{v1-workflow-run}/task-events
95
+ * @secure
96
+ */
97
+ 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));
98
+ /**
99
+ * @description Get a summary of task run metrics for a tenant
100
+ *
101
+ * @tags Task
102
+ * @name V1TaskListStatusMetrics
103
+ * @summary Get task metrics
104
+ * @request GET:/api/v1/stable/tenants/{tenant}/task-metrics
105
+ * @secure
106
+ */
107
+ this.v1TaskListStatusMetrics = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/task-metrics`, method: 'GET', query: query, secure: true, format: 'json' }, params));
108
+ /**
109
+ * @description Get a minute by minute breakdown of task metrics for a tenant
110
+ *
111
+ * @tags Task
112
+ * @name V1TaskGetPointMetrics
113
+ * @summary Get task point metrics
114
+ * @request GET:/api/v1/stable/tenants/{tenant}/task-point-metrics
115
+ * @secure
116
+ */
117
+ 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));
18
118
  /**
19
119
  * @description Gets the readiness status
20
120
  *
@@ -927,6 +1027,14 @@ class Api extends http_client_1.HttpClient {
927
1027
  * @secure
928
1028
  */
929
1029
  this.monitoringPostRunProbe = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/monitoring/${tenant}/probe`, method: 'POST', secure: true }, params));
1030
+ /**
1031
+ * @description Get the version of the server
1032
+ *
1033
+ * @name InfoGetVersion
1034
+ * @summary We return the version for the currently running server
1035
+ * @request GET:/api/v1/version
1036
+ */
1037
+ this.infoGetVersion = (params = {}) => this.request(Object.assign({ path: `/api/v1/version`, method: 'GET', format: 'json' }, params));
930
1038
  }
931
1039
  }
932
1040
  exports.Api = Api;