@hatchet-dev/typescript-sdk 0.20.2 → 1.0.0-alpha0
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/hatchet-client/features/cron-client.d.ts +0 -1
- package/clients/hatchet-client/features/cron-client.js +6 -3
- package/clients/hatchet-client/hatchet-client.d.ts +8 -7
- package/clients/hatchet-client/hatchet-client.js +9 -8
- package/clients/hatchet-client/hatchet-logger.js +2 -2
- package/clients/listener/listener-client.js +1 -0
- package/clients/rest/generated/Api.d.ts +201 -1
- package/clients/rest/generated/Api.js +108 -0
- package/clients/rest/generated/data-contracts.d.ts +270 -8
- package/clients/rest/generated/data-contracts.js +20 -1
- package/clients/worker/handler.d.ts +2 -2
- package/clients/worker/worker.d.ts +4 -4
- package/clients/worker/worker.js +3 -3
- package/examples/api.js +1 -1
- package/examples/example-event-with-results.js +1 -1
- package/examples/stream-by-additional-meta.js +1 -1
- package/index.d.ts +3 -1
- package/index.js +5 -3
- package/package.json +2 -2
- package/protoc/dispatcher/dispatcher.d.ts +2 -0
- package/protoc/dispatcher/dispatcher.js +17 -1
- package/protoc/workflows/v1-admin.d.ts +79 -0
- package/protoc/workflows/v1-admin.js +529 -0
- package/sdk.d.ts +1 -1
- package/sdk.js +2 -2
- package/step.d.ts +75 -9
- package/step.js +65 -2
- package/util/hatchet-promise/hatchet-promise.js +1 -0
- package/v1/client/client.d.ts +81 -0
- package/v1/client/client.interface.d.ts +4 -0
- package/v1/client/client.interface.js +2 -0
- package/v1/client/client.js +134 -0
- package/v1/client/worker.d.ts +82 -0
- package/v1/client/worker.js +125 -0
- package/v1/examples/child_workflows/run.d.ts +1 -0
- package/v1/examples/child_workflows/run.js +30 -0
- package/v1/examples/child_workflows/worker.d.ts +1 -0
- package/v1/examples/child_workflows/worker.js +24 -0
- package/v1/examples/child_workflows/workflow.d.ts +19 -0
- package/v1/examples/child_workflows/workflow.js +43 -0
- package/v1/examples/client.d.ts +2 -0
- package/v1/examples/client.js +5 -0
- package/v1/examples/concurrency-rr/load.d.ts +1 -0
- package/v1/examples/concurrency-rr/load.js +54 -0
- package/v1/examples/concurrency-rr/run.d.ts +1 -0
- package/v1/examples/concurrency-rr/run.js +39 -0
- package/v1/examples/concurrency-rr/worker.d.ts +1 -0
- package/v1/examples/concurrency-rr/worker.js +24 -0
- package/v1/examples/concurrency-rr/workflow.d.ts +11 -0
- package/v1/examples/concurrency-rr/workflow.js +35 -0
- package/v1/examples/dag/run.d.ts +1 -0
- package/v1/examples/dag/run.js +24 -0
- package/v1/examples/dag/worker.d.ts +1 -0
- package/v1/examples/dag/worker.js +24 -0
- package/v1/examples/dag/workflow.d.ts +11 -0
- package/v1/examples/dag/workflow.js +35 -0
- package/v1/examples/deep/run.d.ts +1 -0
- package/v1/examples/deep/run.js +28 -0
- package/v1/examples/deep/worker.d.ts +1 -0
- package/v1/examples/deep/worker.js +25 -0
- package/v1/examples/deep/workflow.d.ts +18 -0
- package/v1/examples/deep/workflow.js +110 -0
- package/v1/examples/legacy/run.d.ts +1 -0
- package/v1/examples/legacy/run.js +25 -0
- package/v1/examples/legacy/worker.d.ts +1 -0
- package/v1/examples/legacy/worker.js +24 -0
- package/v1/examples/legacy/workflow.d.ts +2 -0
- package/v1/examples/legacy/workflow.js +36 -0
- package/v1/examples/on_event/event.d.ts +1 -0
- package/v1/examples/on_event/event.js +25 -0
- package/v1/examples/on_event/worker.d.ts +1 -0
- package/v1/examples/on_event/worker.js +24 -0
- package/v1/examples/on_event/workflow.d.ts +17 -0
- package/v1/examples/on_event/workflow.js +33 -0
- package/v1/examples/simple/cron.d.ts +1 -0
- package/v1/examples/simple/cron.js +26 -0
- package/v1/examples/simple/delay.d.ts +1 -0
- package/v1/examples/simple/delay.js +27 -0
- package/v1/examples/simple/run.d.ts +1 -0
- package/v1/examples/simple/run.js +24 -0
- package/v1/examples/simple/schedule.d.ts +1 -0
- package/v1/examples/simple/schedule.js +27 -0
- package/v1/examples/simple/worker.d.ts +1 -0
- package/v1/examples/simple/worker.js +24 -0
- package/v1/examples/simple/workflow.d.ts +5 -0
- package/v1/examples/simple/workflow.js +15 -0
- package/v1/index.d.ts +0 -0
- package/v1/index.js +1 -0
- package/v1/task.d.ts +51 -0
- package/v1/task.js +2 -0
- package/v1/workflow.d.ts +152 -0
- package/v1/workflow.js +145 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/workflow.d.ts +3 -0
|
@@ -114,13 +114,13 @@ export interface APIResourceMeta {
|
|
|
114
114
|
/**
|
|
115
115
|
* the time that this resource was created
|
|
116
116
|
* @format date-time
|
|
117
|
-
* @example "2022-12-
|
|
117
|
+
* @example "2022-12-13T15:06:48.888358-05:00"
|
|
118
118
|
*/
|
|
119
119
|
createdAt: string;
|
|
120
120
|
/**
|
|
121
121
|
* the time that this resource was last updated
|
|
122
122
|
* @format date-time
|
|
123
|
-
* @example "2022-12-
|
|
123
|
+
* @example "2022-12-13T15:06:48.888358-05:00"
|
|
124
124
|
*/
|
|
125
125
|
updatedAt: string;
|
|
126
126
|
}
|
|
@@ -189,6 +189,8 @@ export interface Tenant {
|
|
|
189
189
|
analyticsOptOut?: boolean;
|
|
190
190
|
/** Whether to alert tenant members. */
|
|
191
191
|
alertMemberEmails?: boolean;
|
|
192
|
+
/** The version of the tenant. */
|
|
193
|
+
version: 'V0' | 'V1';
|
|
192
194
|
}
|
|
193
195
|
export interface TenantMember {
|
|
194
196
|
metadata: APIResourceMeta;
|
|
@@ -360,6 +362,8 @@ export interface UpdateTenantRequest {
|
|
|
360
362
|
enableTenantResourceLimitAlerts?: boolean;
|
|
361
363
|
/** The max frequency at which to alert. */
|
|
362
364
|
maxAlertingFrequency?: string;
|
|
365
|
+
/** The version of the tenant. */
|
|
366
|
+
version?: any;
|
|
363
367
|
}
|
|
364
368
|
export interface Event {
|
|
365
369
|
metadata: APIResourceMeta;
|
|
@@ -420,6 +424,11 @@ export interface EventWorkflowRunSummary {
|
|
|
420
424
|
* @format int64
|
|
421
425
|
*/
|
|
422
426
|
failed?: number;
|
|
427
|
+
/**
|
|
428
|
+
* The number of cancelled runs.
|
|
429
|
+
* @format int64
|
|
430
|
+
*/
|
|
431
|
+
cancelled?: number;
|
|
423
432
|
}
|
|
424
433
|
export declare enum EventOrderByField {
|
|
425
434
|
CreatedAt = "createdAt"
|
|
@@ -455,7 +464,7 @@ export interface RateLimit {
|
|
|
455
464
|
/**
|
|
456
465
|
* The last time the rate limit was refilled.
|
|
457
466
|
* @format date-time
|
|
458
|
-
* @example "2022-12-
|
|
467
|
+
* @example "2022-12-13T15:06:48.888358-05:00"
|
|
459
468
|
*/
|
|
460
469
|
lastRefill: string;
|
|
461
470
|
}
|
|
@@ -752,6 +761,7 @@ export interface WorkflowRunsMetricsCounts {
|
|
|
752
761
|
SUCCEEDED?: number;
|
|
753
762
|
FAILED?: number;
|
|
754
763
|
QUEUED?: number;
|
|
764
|
+
CANCELLED?: number;
|
|
755
765
|
}
|
|
756
766
|
export declare enum WorkflowRunStatus {
|
|
757
767
|
PENDING = "PENDING",
|
|
@@ -759,7 +769,8 @@ export declare enum WorkflowRunStatus {
|
|
|
759
769
|
SUCCEEDED = "SUCCEEDED",
|
|
760
770
|
FAILED = "FAILED",
|
|
761
771
|
CANCELLED = "CANCELLED",
|
|
762
|
-
QUEUED = "QUEUED"
|
|
772
|
+
QUEUED = "QUEUED",
|
|
773
|
+
BACKOFF = "BACKOFF"
|
|
763
774
|
}
|
|
764
775
|
export type WorkflowRunStatusList = WorkflowRunStatus[];
|
|
765
776
|
export declare enum WorkflowKind {
|
|
@@ -776,7 +787,8 @@ export declare enum JobRunStatus {
|
|
|
776
787
|
RUNNING = "RUNNING",
|
|
777
788
|
SUCCEEDED = "SUCCEEDED",
|
|
778
789
|
FAILED = "FAILED",
|
|
779
|
-
CANCELLED = "CANCELLED"
|
|
790
|
+
CANCELLED = "CANCELLED",
|
|
791
|
+
BACKOFF = "BACKOFF"
|
|
780
792
|
}
|
|
781
793
|
export declare enum StepRunStatus {
|
|
782
794
|
PENDING = "PENDING",
|
|
@@ -786,7 +798,8 @@ export declare enum StepRunStatus {
|
|
|
786
798
|
SUCCEEDED = "SUCCEEDED",
|
|
787
799
|
FAILED = "FAILED",
|
|
788
800
|
CANCELLED = "CANCELLED",
|
|
789
|
-
CANCELLING = "CANCELLING"
|
|
801
|
+
CANCELLING = "CANCELLING",
|
|
802
|
+
BACKOFF = "BACKOFF"
|
|
790
803
|
}
|
|
791
804
|
export interface JobRun {
|
|
792
805
|
metadata: APIResourceMeta;
|
|
@@ -983,13 +996,13 @@ export interface Worker {
|
|
|
983
996
|
/**
|
|
984
997
|
* The time this worker last sent a heartbeat.
|
|
985
998
|
* @format date-time
|
|
986
|
-
* @example "2022-12-
|
|
999
|
+
* @example "2022-12-13T15:06:48.888358-05:00"
|
|
987
1000
|
*/
|
|
988
1001
|
lastHeartbeatAt?: string;
|
|
989
1002
|
/**
|
|
990
1003
|
* The time this worker last sent a heartbeat.
|
|
991
1004
|
* @format date-time
|
|
992
|
-
* @example "2022-12-
|
|
1005
|
+
* @example "2022-12-13T15:06:48.888358-05:00"
|
|
993
1006
|
*/
|
|
994
1007
|
lastListenerEstablished?: string;
|
|
995
1008
|
/** The actions this worker can perform. */
|
|
@@ -1241,3 +1254,252 @@ export interface WebhookWorkerListResponse {
|
|
|
1241
1254
|
pagination?: PaginationResponse;
|
|
1242
1255
|
rows?: WebhookWorker[];
|
|
1243
1256
|
}
|
|
1257
|
+
export interface V1TaskSummaryList {
|
|
1258
|
+
pagination: PaginationResponse;
|
|
1259
|
+
/** The list of tasks */
|
|
1260
|
+
rows: V1TaskSummary[];
|
|
1261
|
+
}
|
|
1262
|
+
export interface V1TaskSummary {
|
|
1263
|
+
metadata: APIResourceMeta;
|
|
1264
|
+
/** The ID of the task. */
|
|
1265
|
+
taskId: number;
|
|
1266
|
+
/**
|
|
1267
|
+
* The external ID of the task.
|
|
1268
|
+
* @format uuid
|
|
1269
|
+
* @minLength 36
|
|
1270
|
+
* @maxLength 36
|
|
1271
|
+
*/
|
|
1272
|
+
taskExternalId: string;
|
|
1273
|
+
/**
|
|
1274
|
+
* The timestamp the task was inserted.
|
|
1275
|
+
* @format date-time
|
|
1276
|
+
*/
|
|
1277
|
+
taskInsertedAt: string;
|
|
1278
|
+
status: V1TaskStatus;
|
|
1279
|
+
/**
|
|
1280
|
+
* The timestamp the task run started.
|
|
1281
|
+
* @format date-time
|
|
1282
|
+
*/
|
|
1283
|
+
startedAt?: string;
|
|
1284
|
+
/**
|
|
1285
|
+
* The timestamp the task run finished.
|
|
1286
|
+
* @format date-time
|
|
1287
|
+
*/
|
|
1288
|
+
finishedAt?: string;
|
|
1289
|
+
/** The duration of the task run, in milliseconds. */
|
|
1290
|
+
duration?: number;
|
|
1291
|
+
/**
|
|
1292
|
+
* The ID of the tenant.
|
|
1293
|
+
* @format uuid
|
|
1294
|
+
* @minLength 36
|
|
1295
|
+
* @maxLength 36
|
|
1296
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
1297
|
+
*/
|
|
1298
|
+
tenantId: string;
|
|
1299
|
+
/** Additional metadata for the task run. */
|
|
1300
|
+
additionalMetadata?: object;
|
|
1301
|
+
/** The display name of the task run. */
|
|
1302
|
+
displayName: string;
|
|
1303
|
+
/** @format uuid */
|
|
1304
|
+
workflowId: string;
|
|
1305
|
+
/** The output of the task run (for the latest run) */
|
|
1306
|
+
output: object;
|
|
1307
|
+
/** The error message of the task run (for the latest run) */
|
|
1308
|
+
errorMessage?: string;
|
|
1309
|
+
/** The input of the task run. */
|
|
1310
|
+
input?: object;
|
|
1311
|
+
/** The type of the workflow (whether it's a DAG or a task) */
|
|
1312
|
+
type: 'DAG' | 'TASK';
|
|
1313
|
+
/**
|
|
1314
|
+
* The version ID of the workflow
|
|
1315
|
+
* @format uuid
|
|
1316
|
+
*/
|
|
1317
|
+
workflowVersionId?: string;
|
|
1318
|
+
/**
|
|
1319
|
+
* The timestamp the task was created.
|
|
1320
|
+
* @format date-time
|
|
1321
|
+
*/
|
|
1322
|
+
createdAt?: string;
|
|
1323
|
+
/** The list of children tasks */
|
|
1324
|
+
children?: V1TaskSummary[];
|
|
1325
|
+
}
|
|
1326
|
+
export interface V1DagChildren {
|
|
1327
|
+
/** @format uuid */
|
|
1328
|
+
dagId?: string;
|
|
1329
|
+
children?: V1TaskSummary[];
|
|
1330
|
+
}
|
|
1331
|
+
export interface V1Task {
|
|
1332
|
+
metadata: APIResourceMeta;
|
|
1333
|
+
/** The ID of the task. */
|
|
1334
|
+
taskId: number;
|
|
1335
|
+
/**
|
|
1336
|
+
* The timestamp the task was inserted.
|
|
1337
|
+
* @format date-time
|
|
1338
|
+
*/
|
|
1339
|
+
taskInsertedAt: string;
|
|
1340
|
+
status: V1TaskStatus;
|
|
1341
|
+
/**
|
|
1342
|
+
* The timestamp the task run started.
|
|
1343
|
+
* @format date-time
|
|
1344
|
+
*/
|
|
1345
|
+
startedAt?: string;
|
|
1346
|
+
/**
|
|
1347
|
+
* The timestamp the task run finished.
|
|
1348
|
+
* @format date-time
|
|
1349
|
+
*/
|
|
1350
|
+
finishedAt?: string;
|
|
1351
|
+
/** The duration of the task run, in milliseconds. */
|
|
1352
|
+
duration?: number;
|
|
1353
|
+
/**
|
|
1354
|
+
* The ID of the tenant.
|
|
1355
|
+
* @format uuid
|
|
1356
|
+
* @minLength 36
|
|
1357
|
+
* @maxLength 36
|
|
1358
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
1359
|
+
*/
|
|
1360
|
+
tenantId: string;
|
|
1361
|
+
/** Additional metadata for the task run. */
|
|
1362
|
+
additionalMetadata?: object;
|
|
1363
|
+
/** The display name of the task run. */
|
|
1364
|
+
displayName: string;
|
|
1365
|
+
/** @format uuid */
|
|
1366
|
+
workflowId: string;
|
|
1367
|
+
/** The input for the task run. */
|
|
1368
|
+
input: string;
|
|
1369
|
+
/** The output of the task run (for the latest run) */
|
|
1370
|
+
output?: string;
|
|
1371
|
+
/** The error message of the task run (for the latest run) */
|
|
1372
|
+
errorMessage?: string;
|
|
1373
|
+
/**
|
|
1374
|
+
* The external ID of the workflow run.
|
|
1375
|
+
* @format uuid
|
|
1376
|
+
* @minLength 36
|
|
1377
|
+
* @maxLength 36
|
|
1378
|
+
*/
|
|
1379
|
+
workflowRunExternalId?: string;
|
|
1380
|
+
}
|
|
1381
|
+
export interface V1TaskEventList {
|
|
1382
|
+
pagination?: PaginationResponse;
|
|
1383
|
+
rows?: {
|
|
1384
|
+
id: number;
|
|
1385
|
+
/** @format uuid */
|
|
1386
|
+
taskId: string;
|
|
1387
|
+
/** @format date-time */
|
|
1388
|
+
timestamp: string;
|
|
1389
|
+
eventType: 'REQUEUED_NO_WORKER' | 'REQUEUED_RATE_LIMIT' | 'SCHEDULING_TIMED_OUT' | 'ASSIGNED' | 'STARTED' | 'FINISHED' | 'FAILED' | 'RETRYING' | 'CANCELLED' | 'TIMED_OUT' | 'REASSIGNED' | 'SLOT_RELEASED' | 'TIMEOUT_REFRESHED' | 'RETRIED_BY_USER' | 'SENT_TO_WORKER' | 'RATE_LIMIT_ERROR' | 'ACKNOWLEDGED' | 'CREATED' | 'QUEUED' | 'SKIPPED';
|
|
1390
|
+
message: string;
|
|
1391
|
+
errorMessage?: string;
|
|
1392
|
+
output?: string;
|
|
1393
|
+
/** @format uuid */
|
|
1394
|
+
workerId?: string;
|
|
1395
|
+
taskDisplayName?: string;
|
|
1396
|
+
}[];
|
|
1397
|
+
}
|
|
1398
|
+
export declare enum V1TaskStatus {
|
|
1399
|
+
QUEUED = "QUEUED",
|
|
1400
|
+
RUNNING = "RUNNING",
|
|
1401
|
+
COMPLETED = "COMPLETED",
|
|
1402
|
+
CANCELLED = "CANCELLED",
|
|
1403
|
+
FAILED = "FAILED"
|
|
1404
|
+
}
|
|
1405
|
+
export type V1TaskRunMetrics = {
|
|
1406
|
+
status: V1TaskStatus;
|
|
1407
|
+
count: number;
|
|
1408
|
+
}[];
|
|
1409
|
+
export interface V1TaskPointMetric {
|
|
1410
|
+
/** @format date-time */
|
|
1411
|
+
time: string;
|
|
1412
|
+
SUCCEEDED: number;
|
|
1413
|
+
FAILED: number;
|
|
1414
|
+
}
|
|
1415
|
+
export interface V1TaskPointMetrics {
|
|
1416
|
+
results?: V1TaskPointMetric[];
|
|
1417
|
+
}
|
|
1418
|
+
export interface V1TaskFilter {
|
|
1419
|
+
/** @format date-time */
|
|
1420
|
+
since: string;
|
|
1421
|
+
/** @format date-time */
|
|
1422
|
+
until?: string;
|
|
1423
|
+
statuses?: V1TaskStatus[];
|
|
1424
|
+
workflowIds?: string[];
|
|
1425
|
+
additionalMetadata?: string[];
|
|
1426
|
+
}
|
|
1427
|
+
export interface V1CancelTaskRequest {
|
|
1428
|
+
/** A list of external IDs, which can refer to either task or workflow run external IDs */
|
|
1429
|
+
externalIds?: string[];
|
|
1430
|
+
filter?: V1TaskFilter;
|
|
1431
|
+
}
|
|
1432
|
+
export interface V1ReplayTaskRequest {
|
|
1433
|
+
/** A list of external IDs, which can refer to either task or workflow run external IDs */
|
|
1434
|
+
externalIds?: string[];
|
|
1435
|
+
filter?: V1TaskFilter;
|
|
1436
|
+
}
|
|
1437
|
+
export interface V1WorkflowRun {
|
|
1438
|
+
metadata: APIResourceMeta;
|
|
1439
|
+
status: V1TaskStatus;
|
|
1440
|
+
/**
|
|
1441
|
+
* The timestamp the task run started.
|
|
1442
|
+
* @format date-time
|
|
1443
|
+
*/
|
|
1444
|
+
startedAt?: string;
|
|
1445
|
+
/**
|
|
1446
|
+
* The timestamp the task run finished.
|
|
1447
|
+
* @format date-time
|
|
1448
|
+
*/
|
|
1449
|
+
finishedAt?: string;
|
|
1450
|
+
/** The duration of the task run, in milliseconds. */
|
|
1451
|
+
duration?: number;
|
|
1452
|
+
/**
|
|
1453
|
+
* The ID of the tenant.
|
|
1454
|
+
* @format uuid
|
|
1455
|
+
* @minLength 36
|
|
1456
|
+
* @maxLength 36
|
|
1457
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
1458
|
+
*/
|
|
1459
|
+
tenantId: string;
|
|
1460
|
+
/** Additional metadata for the task run. */
|
|
1461
|
+
additionalMetadata?: object;
|
|
1462
|
+
/** The display name of the task run. */
|
|
1463
|
+
displayName: string;
|
|
1464
|
+
/** @format uuid */
|
|
1465
|
+
workflowId: string;
|
|
1466
|
+
/** The output of the task run (for the latest run) */
|
|
1467
|
+
output: object;
|
|
1468
|
+
/** The error message of the task run (for the latest run) */
|
|
1469
|
+
errorMessage?: string;
|
|
1470
|
+
/**
|
|
1471
|
+
* The ID of the workflow version.
|
|
1472
|
+
* @format uuid
|
|
1473
|
+
*/
|
|
1474
|
+
workflowVersionId?: string;
|
|
1475
|
+
/** The input of the task run. */
|
|
1476
|
+
input: object;
|
|
1477
|
+
/**
|
|
1478
|
+
* The timestamp the task run was created.
|
|
1479
|
+
* @format date-time
|
|
1480
|
+
*/
|
|
1481
|
+
createdAt?: string;
|
|
1482
|
+
}
|
|
1483
|
+
export interface V1WorkflowRunDetails {
|
|
1484
|
+
run: V1WorkflowRun;
|
|
1485
|
+
/** The list of task events for the workflow run */
|
|
1486
|
+
taskEvents: any[];
|
|
1487
|
+
shape: {
|
|
1488
|
+
/**
|
|
1489
|
+
* @format uuid
|
|
1490
|
+
* @minLength 36
|
|
1491
|
+
* @maxLength 36
|
|
1492
|
+
*/
|
|
1493
|
+
taskExternalId: string;
|
|
1494
|
+
childrenExternalIds: string[];
|
|
1495
|
+
taskName: string;
|
|
1496
|
+
}[];
|
|
1497
|
+
tasks: V1TaskSummary[];
|
|
1498
|
+
}
|
|
1499
|
+
export declare enum V1TaskRunStatus {
|
|
1500
|
+
PENDING = "PENDING",
|
|
1501
|
+
RUNNING = "RUNNING",
|
|
1502
|
+
COMPLETED = "COMPLETED",
|
|
1503
|
+
FAILED = "FAILED",
|
|
1504
|
+
CANCELLED = "CANCELLED"
|
|
1505
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ---------------------------------------------------------------
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
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;
|
|
13
|
+
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
14
|
var TenantMemberRole;
|
|
15
15
|
(function (TenantMemberRole) {
|
|
16
16
|
TenantMemberRole["OWNER"] = "OWNER";
|
|
@@ -85,6 +85,7 @@ var WorkflowRunStatus;
|
|
|
85
85
|
WorkflowRunStatus["FAILED"] = "FAILED";
|
|
86
86
|
WorkflowRunStatus["CANCELLED"] = "CANCELLED";
|
|
87
87
|
WorkflowRunStatus["QUEUED"] = "QUEUED";
|
|
88
|
+
WorkflowRunStatus["BACKOFF"] = "BACKOFF";
|
|
88
89
|
})(WorkflowRunStatus || (exports.WorkflowRunStatus = WorkflowRunStatus = {}));
|
|
89
90
|
var WorkflowKind;
|
|
90
91
|
(function (WorkflowKind) {
|
|
@@ -99,6 +100,7 @@ var JobRunStatus;
|
|
|
99
100
|
JobRunStatus["SUCCEEDED"] = "SUCCEEDED";
|
|
100
101
|
JobRunStatus["FAILED"] = "FAILED";
|
|
101
102
|
JobRunStatus["CANCELLED"] = "CANCELLED";
|
|
103
|
+
JobRunStatus["BACKOFF"] = "BACKOFF";
|
|
102
104
|
})(JobRunStatus || (exports.JobRunStatus = JobRunStatus = {}));
|
|
103
105
|
var StepRunStatus;
|
|
104
106
|
(function (StepRunStatus) {
|
|
@@ -110,6 +112,7 @@ var StepRunStatus;
|
|
|
110
112
|
StepRunStatus["FAILED"] = "FAILED";
|
|
111
113
|
StepRunStatus["CANCELLED"] = "CANCELLED";
|
|
112
114
|
StepRunStatus["CANCELLING"] = "CANCELLING";
|
|
115
|
+
StepRunStatus["BACKOFF"] = "BACKOFF";
|
|
113
116
|
})(StepRunStatus || (exports.StepRunStatus = StepRunStatus = {}));
|
|
114
117
|
var StepRunEventReason;
|
|
115
118
|
(function (StepRunEventReason) {
|
|
@@ -170,3 +173,19 @@ var WebhookWorkerRequestMethod;
|
|
|
170
173
|
WebhookWorkerRequestMethod["POST"] = "POST";
|
|
171
174
|
WebhookWorkerRequestMethod["PUT"] = "PUT";
|
|
172
175
|
})(WebhookWorkerRequestMethod || (exports.WebhookWorkerRequestMethod = WebhookWorkerRequestMethod = {}));
|
|
176
|
+
var V1TaskStatus;
|
|
177
|
+
(function (V1TaskStatus) {
|
|
178
|
+
V1TaskStatus["QUEUED"] = "QUEUED";
|
|
179
|
+
V1TaskStatus["RUNNING"] = "RUNNING";
|
|
180
|
+
V1TaskStatus["COMPLETED"] = "COMPLETED";
|
|
181
|
+
V1TaskStatus["CANCELLED"] = "CANCELLED";
|
|
182
|
+
V1TaskStatus["FAILED"] = "FAILED";
|
|
183
|
+
})(V1TaskStatus || (exports.V1TaskStatus = V1TaskStatus = {}));
|
|
184
|
+
var V1TaskRunStatus;
|
|
185
|
+
(function (V1TaskRunStatus) {
|
|
186
|
+
V1TaskRunStatus["PENDING"] = "PENDING";
|
|
187
|
+
V1TaskRunStatus["RUNNING"] = "RUNNING";
|
|
188
|
+
V1TaskRunStatus["COMPLETED"] = "COMPLETED";
|
|
189
|
+
V1TaskRunStatus["FAILED"] = "FAILED";
|
|
190
|
+
V1TaskRunStatus["CANCELLED"] = "CANCELLED";
|
|
191
|
+
})(V1TaskRunStatus || (exports.V1TaskRunStatus = V1TaskRunStatus = {}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
2
|
import { Workflow } from '../../workflow';
|
|
3
|
-
import {
|
|
3
|
+
import { V0Worker } from './worker';
|
|
4
4
|
export interface HandlerOpts {
|
|
5
5
|
secret: string;
|
|
6
6
|
}
|
|
7
7
|
export declare class WebhookHandler {
|
|
8
8
|
private worker;
|
|
9
9
|
private workflows;
|
|
10
|
-
constructor(worker:
|
|
10
|
+
constructor(worker: V0Worker, workflows: Workflow[]);
|
|
11
11
|
/**
|
|
12
12
|
* Handles a request with a provided body, secret, and signature.
|
|
13
13
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InternalHatchetClient } from '../hatchet-client';
|
|
2
2
|
import { Action, ActionListener } from '../dispatcher/action-listener';
|
|
3
3
|
import { StepActionEvent, StepActionEventType, GroupKeyActionEvent, GroupKeyActionEventType } from '../../protoc/dispatcher';
|
|
4
4
|
import HatchetPromise from '../../util/hatchet-promise/hatchet-promise';
|
|
@@ -15,8 +15,8 @@ export interface WorkerOpts {
|
|
|
15
15
|
maxRuns?: number;
|
|
16
16
|
labels?: WorkerLabels;
|
|
17
17
|
}
|
|
18
|
-
export declare class
|
|
19
|
-
client:
|
|
18
|
+
export declare class V0Worker {
|
|
19
|
+
client: InternalHatchetClient;
|
|
20
20
|
name: string;
|
|
21
21
|
workerId: string | undefined;
|
|
22
22
|
killing: boolean;
|
|
@@ -30,7 +30,7 @@ export declare class Worker {
|
|
|
30
30
|
logger: Logger;
|
|
31
31
|
registeredWorkflowPromises: Array<Promise<any>>;
|
|
32
32
|
labels: WorkerLabels;
|
|
33
|
-
constructor(client:
|
|
33
|
+
constructor(client: InternalHatchetClient, options: {
|
|
34
34
|
name: string;
|
|
35
35
|
handleKill?: boolean;
|
|
36
36
|
maxRuns?: number;
|
package/clients/worker/worker.js
CHANGED
|
@@ -19,14 +19,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
22
|
+
exports.V0Worker = void 0;
|
|
23
23
|
const hatchet_error_1 = __importDefault(require("../../util/errors/hatchet-error"));
|
|
24
24
|
const dispatcher_1 = require("../../protoc/dispatcher");
|
|
25
25
|
const hatchet_promise_1 = __importDefault(require("../../util/hatchet-promise/hatchet-promise"));
|
|
26
26
|
const workflows_1 = require("../../protoc/workflows");
|
|
27
27
|
const handler_1 = require("./handler");
|
|
28
28
|
const step_1 = require("../../step");
|
|
29
|
-
class
|
|
29
|
+
class V0Worker {
|
|
30
30
|
constructor(client, options) {
|
|
31
31
|
this.workflow_registry = [];
|
|
32
32
|
this.futures = {};
|
|
@@ -468,7 +468,7 @@ class Worker {
|
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
exports.
|
|
471
|
+
exports.V0Worker = V0Worker;
|
|
472
472
|
function toPbWorkerLabel(in_) {
|
|
473
473
|
if (!in_) {
|
|
474
474
|
return {};
|
package/examples/api.js
CHANGED
|
@@ -49,7 +49,7 @@ function main() {
|
|
|
49
49
|
const { admin } = hatchet;
|
|
50
50
|
yield admin.putWorkflow(opts);
|
|
51
51
|
const worker = yield hatchet.worker('example-worker');
|
|
52
|
-
worker.registerAction('slack:example', (ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
worker.v0.registerAction('slack:example', (ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
const setData = ctx.userData();
|
|
54
54
|
console.log('executed step1!', setData);
|
|
55
55
|
return { step1: 'step1' };
|
|
@@ -27,7 +27,7 @@ function main() {
|
|
|
27
27
|
const ref = yield hatchet.admin.runWorkflow('simple-workflow', {
|
|
28
28
|
test: 'test',
|
|
29
29
|
});
|
|
30
|
-
const listener = yield hatchet.listener.stream(yield ref.getWorkflowRunId());
|
|
30
|
+
const listener = yield hatchet.v0.listener.stream(yield ref.getWorkflowRunId());
|
|
31
31
|
console.log('listening for events');
|
|
32
32
|
try {
|
|
33
33
|
for (var _d = true, listener_1 = __asyncValues(listener), listener_1_1; listener_1_1 = yield listener_1.next(), _a = listener_1_1.done, !_a; _d = true) {
|
|
@@ -34,7 +34,7 @@ function main() {
|
|
|
34
34
|
// and can have an arbitrary property name.
|
|
35
35
|
yield hatchet.admin.runWorkflow('parent-workflow', {}, { additionalMetadata: { [streamKey]: streamVal } });
|
|
36
36
|
// Stream all events for the additional meta key value
|
|
37
|
-
const stream = yield hatchet.listener.streamByAdditionalMeta(streamKey, streamVal);
|
|
37
|
+
const stream = yield hatchet.v0.listener.streamByAdditionalMeta(streamKey, streamVal);
|
|
38
38
|
try {
|
|
39
39
|
for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _a = stream_1_1.done, !_a; _d = true) {
|
|
40
40
|
_c = stream_1_1.value;
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { HatchetClient as Hatchet } from './
|
|
1
|
+
import { HatchetClient as Hatchet } from './v1/client/client';
|
|
2
2
|
export * from './workflow';
|
|
3
3
|
export * from './step';
|
|
4
4
|
export * from './clients/worker';
|
|
5
5
|
export * from './clients/rest';
|
|
6
6
|
export * from './clients/admin';
|
|
7
7
|
export * from './util/workflow-run-ref';
|
|
8
|
+
export * from './v1/client/client';
|
|
9
|
+
export * from './v1/client/worker';
|
|
8
10
|
export default Hatchet;
|
|
9
11
|
export { Hatchet };
|
package/index.js
CHANGED
|
@@ -15,12 +15,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Hatchet = void 0;
|
|
18
|
-
const
|
|
19
|
-
Object.defineProperty(exports, "Hatchet", { enumerable: true, get: function () { return
|
|
18
|
+
const client_1 = require("./v1/client/client");
|
|
19
|
+
Object.defineProperty(exports, "Hatchet", { enumerable: true, get: function () { return client_1.HatchetClient; } });
|
|
20
20
|
__exportStar(require("./workflow"), exports);
|
|
21
21
|
__exportStar(require("./step"), exports);
|
|
22
22
|
__exportStar(require("./clients/worker"), exports);
|
|
23
23
|
__exportStar(require("./clients/rest"), exports);
|
|
24
24
|
__exportStar(require("./clients/admin"), exports);
|
|
25
25
|
__exportStar(require("./util/workflow-run-ref"), exports);
|
|
26
|
-
exports
|
|
26
|
+
__exportStar(require("./v1/client/client"), exports);
|
|
27
|
+
__exportStar(require("./v1/client/worker"), exports);
|
|
28
|
+
exports.default = client_1.HatchetClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha0",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test:e2e": "jest --testMatch='**/*.e2e.ts'",
|
|
24
24
|
"test:unit:watch": "jest --testMatch='**/*.test.ts' --watch",
|
|
25
25
|
"generate": "pnpm run '/generate-.*/'",
|
|
26
|
-
"generate-api": "npx --yes swagger-cli bundle
|
|
26
|
+
"generate-api": "npx --yes swagger-cli bundle ../../api-contracts/openapi/openapi.yaml --outfile openapi.yaml --type yaml && npx swagger-typescript-api -p openapi.yaml -o src/clients/rest/generated -n hatchet.ts --modular --axios",
|
|
27
27
|
"generate-protoc": "./generate-protoc.sh",
|
|
28
28
|
"lint:check": "npm run eslint:check && npm run prettier:check",
|
|
29
29
|
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
|
|
@@ -205,6 +205,8 @@ export interface StepActionEvent {
|
|
|
205
205
|
eventType: StepActionEventType;
|
|
206
206
|
/** the event payload */
|
|
207
207
|
eventPayload: string;
|
|
208
|
+
/** the retry count */
|
|
209
|
+
retryCount?: number | undefined;
|
|
208
210
|
}
|
|
209
211
|
export interface ActionEventResponse {
|
|
210
212
|
/** the tenant id */
|
|
@@ -1736,6 +1736,7 @@ function createBaseStepActionEvent() {
|
|
|
1736
1736
|
eventTimestamp: undefined,
|
|
1737
1737
|
eventType: 0,
|
|
1738
1738
|
eventPayload: '',
|
|
1739
|
+
retryCount: undefined,
|
|
1739
1740
|
};
|
|
1740
1741
|
}
|
|
1741
1742
|
exports.StepActionEvent = {
|
|
@@ -1767,6 +1768,9 @@ exports.StepActionEvent = {
|
|
|
1767
1768
|
if (message.eventPayload !== '') {
|
|
1768
1769
|
writer.uint32(74).string(message.eventPayload);
|
|
1769
1770
|
}
|
|
1771
|
+
if (message.retryCount !== undefined) {
|
|
1772
|
+
writer.uint32(80).int32(message.retryCount);
|
|
1773
|
+
}
|
|
1770
1774
|
return writer;
|
|
1771
1775
|
},
|
|
1772
1776
|
decode(input, length) {
|
|
@@ -1839,6 +1843,13 @@ exports.StepActionEvent = {
|
|
|
1839
1843
|
message.eventPayload = reader.string();
|
|
1840
1844
|
continue;
|
|
1841
1845
|
}
|
|
1846
|
+
case 10: {
|
|
1847
|
+
if (tag !== 80) {
|
|
1848
|
+
break;
|
|
1849
|
+
}
|
|
1850
|
+
message.retryCount = reader.int32();
|
|
1851
|
+
continue;
|
|
1852
|
+
}
|
|
1842
1853
|
}
|
|
1843
1854
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1844
1855
|
break;
|
|
@@ -1860,6 +1871,7 @@ exports.StepActionEvent = {
|
|
|
1860
1871
|
: undefined,
|
|
1861
1872
|
eventType: isSet(object.eventType) ? stepActionEventTypeFromJSON(object.eventType) : 0,
|
|
1862
1873
|
eventPayload: isSet(object.eventPayload) ? globalThis.String(object.eventPayload) : '',
|
|
1874
|
+
retryCount: isSet(object.retryCount) ? globalThis.Number(object.retryCount) : undefined,
|
|
1863
1875
|
};
|
|
1864
1876
|
},
|
|
1865
1877
|
toJSON(message) {
|
|
@@ -1891,13 +1903,16 @@ exports.StepActionEvent = {
|
|
|
1891
1903
|
if (message.eventPayload !== '') {
|
|
1892
1904
|
obj.eventPayload = message.eventPayload;
|
|
1893
1905
|
}
|
|
1906
|
+
if (message.retryCount !== undefined) {
|
|
1907
|
+
obj.retryCount = Math.round(message.retryCount);
|
|
1908
|
+
}
|
|
1894
1909
|
return obj;
|
|
1895
1910
|
},
|
|
1896
1911
|
create(base) {
|
|
1897
1912
|
return exports.StepActionEvent.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1898
1913
|
},
|
|
1899
1914
|
fromPartial(object) {
|
|
1900
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1915
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1901
1916
|
const message = createBaseStepActionEvent();
|
|
1902
1917
|
message.workerId = (_a = object.workerId) !== null && _a !== void 0 ? _a : '';
|
|
1903
1918
|
message.jobId = (_b = object.jobId) !== null && _b !== void 0 ? _b : '';
|
|
@@ -1908,6 +1923,7 @@ exports.StepActionEvent = {
|
|
|
1908
1923
|
message.eventTimestamp = (_g = object.eventTimestamp) !== null && _g !== void 0 ? _g : undefined;
|
|
1909
1924
|
message.eventType = (_h = object.eventType) !== null && _h !== void 0 ? _h : 0;
|
|
1910
1925
|
message.eventPayload = (_j = object.eventPayload) !== null && _j !== void 0 ? _j : '';
|
|
1926
|
+
message.retryCount = (_k = object.retryCount) !== null && _k !== void 0 ? _k : undefined;
|
|
1911
1927
|
return message;
|
|
1912
1928
|
},
|
|
1913
1929
|
};
|