@hatchet-dev/typescript-sdk 1.2.0 → 1.3.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.
@@ -1,3 +1,164 @@
1
+ export declare enum V1LogLineLevel {
2
+ DEBUG = "DEBUG",
3
+ INFO = "INFO",
4
+ WARN = "WARN",
5
+ ERROR = "ERROR"
6
+ }
7
+ export declare enum V1TaskRunStatus {
8
+ PENDING = "PENDING",
9
+ RUNNING = "RUNNING",
10
+ COMPLETED = "COMPLETED",
11
+ FAILED = "FAILED",
12
+ CANCELLED = "CANCELLED"
13
+ }
14
+ export declare enum V1TaskStatus {
15
+ QUEUED = "QUEUED",
16
+ RUNNING = "RUNNING",
17
+ COMPLETED = "COMPLETED",
18
+ CANCELLED = "CANCELLED",
19
+ FAILED = "FAILED"
20
+ }
21
+ export declare enum WebhookWorkerRequestMethod {
22
+ GET = "GET",
23
+ POST = "POST",
24
+ PUT = "PUT"
25
+ }
26
+ export declare enum LogLineOrderByDirection {
27
+ Asc = "asc",
28
+ Desc = "desc"
29
+ }
30
+ export declare enum LogLineOrderByField {
31
+ CreatedAt = "createdAt"
32
+ }
33
+ export declare enum LogLineLevel {
34
+ DEBUG = "DEBUG",
35
+ INFO = "INFO",
36
+ WARN = "WARN",
37
+ ERROR = "ERROR"
38
+ }
39
+ export declare enum PullRequestState {
40
+ Open = "open",
41
+ Closed = "closed"
42
+ }
43
+ export declare enum WorkerRuntimeSDKs {
44
+ GOLANG = "GOLANG",
45
+ PYTHON = "PYTHON",
46
+ TYPESCRIPT = "TYPESCRIPT"
47
+ }
48
+ export declare enum StepRunEventSeverity {
49
+ INFO = "INFO",
50
+ WARNING = "WARNING",
51
+ CRITICAL = "CRITICAL"
52
+ }
53
+ export declare enum StepRunEventReason {
54
+ REQUEUED_NO_WORKER = "REQUEUED_NO_WORKER",
55
+ REQUEUED_RATE_LIMIT = "REQUEUED_RATE_LIMIT",
56
+ SCHEDULING_TIMED_OUT = "SCHEDULING_TIMED_OUT",
57
+ ASSIGNED = "ASSIGNED",
58
+ STARTED = "STARTED",
59
+ ACKNOWLEDGED = "ACKNOWLEDGED",
60
+ FINISHED = "FINISHED",
61
+ FAILED = "FAILED",
62
+ RETRYING = "RETRYING",
63
+ CANCELLED = "CANCELLED",
64
+ TIMEOUT_REFRESHED = "TIMEOUT_REFRESHED",
65
+ REASSIGNED = "REASSIGNED",
66
+ TIMED_OUT = "TIMED_OUT",
67
+ SLOT_RELEASED = "SLOT_RELEASED",
68
+ RETRIED_BY_USER = "RETRIED_BY_USER",
69
+ WORKFLOW_RUN_GROUP_KEY_SUCCEEDED = "WORKFLOW_RUN_GROUP_KEY_SUCCEEDED",
70
+ WORKFLOW_RUN_GROUP_KEY_FAILED = "WORKFLOW_RUN_GROUP_KEY_FAILED"
71
+ }
72
+ export declare enum StepRunStatus {
73
+ PENDING = "PENDING",
74
+ PENDING_ASSIGNMENT = "PENDING_ASSIGNMENT",
75
+ ASSIGNED = "ASSIGNED",
76
+ RUNNING = "RUNNING",
77
+ SUCCEEDED = "SUCCEEDED",
78
+ FAILED = "FAILED",
79
+ CANCELLED = "CANCELLED",
80
+ CANCELLING = "CANCELLING",
81
+ BACKOFF = "BACKOFF"
82
+ }
83
+ export declare enum JobRunStatus {
84
+ PENDING = "PENDING",
85
+ RUNNING = "RUNNING",
86
+ SUCCEEDED = "SUCCEEDED",
87
+ FAILED = "FAILED",
88
+ CANCELLED = "CANCELLED",
89
+ BACKOFF = "BACKOFF"
90
+ }
91
+ export declare enum WorkflowKind {
92
+ FUNCTION = "FUNCTION",
93
+ DURABLE = "DURABLE",
94
+ DAG = "DAG"
95
+ }
96
+ export declare enum WorkflowRunStatus {
97
+ PENDING = "PENDING",
98
+ RUNNING = "RUNNING",
99
+ SUCCEEDED = "SUCCEEDED",
100
+ FAILED = "FAILED",
101
+ CANCELLED = "CANCELLED",
102
+ QUEUED = "QUEUED",
103
+ BACKOFF = "BACKOFF"
104
+ }
105
+ export declare enum WorkflowRunOrderByDirection {
106
+ ASC = "ASC",
107
+ DESC = "DESC"
108
+ }
109
+ export declare enum WorkflowRunOrderByField {
110
+ CreatedAt = "createdAt",
111
+ StartedAt = "startedAt",
112
+ FinishedAt = "finishedAt",
113
+ Duration = "duration"
114
+ }
115
+ export declare enum CronWorkflowsOrderByField {
116
+ Name = "name",
117
+ CreatedAt = "createdAt"
118
+ }
119
+ export declare enum ScheduledRunStatus {
120
+ PENDING = "PENDING",
121
+ RUNNING = "RUNNING",
122
+ SUCCEEDED = "SUCCEEDED",
123
+ FAILED = "FAILED",
124
+ CANCELLED = "CANCELLED",
125
+ QUEUED = "QUEUED",
126
+ SCHEDULED = "SCHEDULED"
127
+ }
128
+ export declare enum ScheduledWorkflowsOrderByField {
129
+ TriggerAt = "triggerAt",
130
+ CreatedAt = "createdAt"
131
+ }
132
+ export declare enum RateLimitOrderByDirection {
133
+ Asc = "asc",
134
+ Desc = "desc"
135
+ }
136
+ export declare enum RateLimitOrderByField {
137
+ Key = "key",
138
+ Value = "value",
139
+ LimitValue = "limitValue"
140
+ }
141
+ export declare enum EventOrderByDirection {
142
+ Asc = "asc",
143
+ Desc = "desc"
144
+ }
145
+ export declare enum EventOrderByField {
146
+ CreatedAt = "createdAt"
147
+ }
148
+ export declare enum TenantResource {
149
+ WORKER = "WORKER",
150
+ WORKER_SLOT = "WORKER_SLOT",
151
+ EVENT = "EVENT",
152
+ WORKFLOW_RUN = "WORKFLOW_RUN",
153
+ TASK_RUN = "TASK_RUN",
154
+ CRON = "CRON",
155
+ SCHEDULE = "SCHEDULE"
156
+ }
157
+ export declare enum TenantMemberRole {
158
+ OWNER = "OWNER",
159
+ ADMIN = "ADMIN",
160
+ MEMBER = "MEMBER"
161
+ }
1
162
  export interface APIMeta {
2
163
  auth?: APIMetaAuth;
3
164
  /**
@@ -114,13 +275,13 @@ export interface APIResourceMeta {
114
275
  /**
115
276
  * the time that this resource was created
116
277
  * @format date-time
117
- * @example "2022-12-13T20:06:48.888Z"
278
+ * @example "2022-12-13T15:06:48.888358-05:00"
118
279
  */
119
280
  createdAt: string;
120
281
  /**
121
282
  * the time that this resource was last updated
122
283
  * @format date-time
123
- * @example "2022-12-13T20:06:48.888Z"
284
+ * @example "2022-12-13T15:06:48.888358-05:00"
124
285
  */
125
286
  updatedAt: string;
126
287
  }
@@ -205,20 +366,6 @@ export interface TenantMemberList {
205
366
  pagination?: PaginationResponse;
206
367
  rows?: TenantMember[];
207
368
  }
208
- export declare enum TenantMemberRole {
209
- OWNER = "OWNER",
210
- ADMIN = "ADMIN",
211
- MEMBER = "MEMBER"
212
- }
213
- export declare enum TenantResource {
214
- WORKER = "WORKER",
215
- WORKER_SLOT = "WORKER_SLOT",
216
- EVENT = "EVENT",
217
- WORKFLOW_RUN = "WORKFLOW_RUN",
218
- TASK_RUN = "TASK_RUN",
219
- CRON = "CRON",
220
- SCHEDULE = "SCHEDULE"
221
- }
222
369
  export interface TenantResourceLimit {
223
370
  metadata: APIResourceMeta;
224
371
  /** The resource associated with this limit. */
@@ -432,13 +579,6 @@ export interface EventWorkflowRunSummary {
432
579
  */
433
580
  cancelled?: number;
434
581
  }
435
- export declare enum EventOrderByField {
436
- CreatedAt = "createdAt"
437
- }
438
- export declare enum EventOrderByDirection {
439
- Asc = "asc",
440
- Desc = "desc"
441
- }
442
582
  export type EventSearch = string;
443
583
  export interface EventKeyList {
444
584
  pagination?: PaginationResponse;
@@ -466,7 +606,7 @@ export interface RateLimit {
466
606
  /**
467
607
  * The last time the rate limit was refilled.
468
608
  * @format date-time
469
- * @example "2022-12-13T20:06:48.888Z"
609
+ * @example "2022-12-13T15:06:48.888358-05:00"
470
610
  */
471
611
  lastRefill: string;
472
612
  }
@@ -474,15 +614,6 @@ export interface RateLimitList {
474
614
  pagination?: PaginationResponse;
475
615
  rows?: RateLimit[];
476
616
  }
477
- export declare enum RateLimitOrderByField {
478
- Key = "key",
479
- Value = "value",
480
- LimitValue = "limitValue"
481
- }
482
- export declare enum RateLimitOrderByDirection {
483
- Asc = "asc",
484
- Desc = "desc"
485
- }
486
617
  export interface ReplayEventRequest {
487
618
  eventIds: string[];
488
619
  }
@@ -716,19 +847,6 @@ export interface ScheduledWorkflowsList {
716
847
  rows?: ScheduledWorkflows[];
717
848
  pagination?: PaginationResponse;
718
849
  }
719
- export declare enum ScheduledWorkflowsOrderByField {
720
- TriggerAt = "triggerAt",
721
- CreatedAt = "createdAt"
722
- }
723
- export declare enum ScheduledRunStatus {
724
- PENDING = "PENDING",
725
- RUNNING = "RUNNING",
726
- SUCCEEDED = "SUCCEEDED",
727
- FAILED = "FAILED",
728
- CANCELLED = "CANCELLED",
729
- QUEUED = "QUEUED",
730
- SCHEDULED = "SCHEDULED"
731
- }
732
850
  export interface CronWorkflows {
733
851
  metadata: APIResourceMeta;
734
852
  tenantId: string;
@@ -752,20 +870,6 @@ export interface CronWorkflowsList {
752
870
  rows?: CronWorkflows[];
753
871
  pagination?: PaginationResponse;
754
872
  }
755
- export declare enum CronWorkflowsOrderByField {
756
- Name = "name",
757
- CreatedAt = "createdAt"
758
- }
759
- export declare enum WorkflowRunOrderByField {
760
- CreatedAt = "createdAt",
761
- StartedAt = "startedAt",
762
- FinishedAt = "finishedAt",
763
- Duration = "duration"
764
- }
765
- export declare enum WorkflowRunOrderByDirection {
766
- ASC = "ASC",
767
- DESC = "DESC"
768
- }
769
873
  export interface WorkflowRunsMetrics {
770
874
  counts?: WorkflowRunsMetricsCounts;
771
875
  }
@@ -777,44 +881,11 @@ export interface WorkflowRunsMetricsCounts {
777
881
  QUEUED?: number;
778
882
  CANCELLED?: number;
779
883
  }
780
- export declare enum WorkflowRunStatus {
781
- PENDING = "PENDING",
782
- RUNNING = "RUNNING",
783
- SUCCEEDED = "SUCCEEDED",
784
- FAILED = "FAILED",
785
- CANCELLED = "CANCELLED",
786
- QUEUED = "QUEUED",
787
- BACKOFF = "BACKOFF"
788
- }
789
884
  export type WorkflowRunStatusList = WorkflowRunStatus[];
790
- export declare enum WorkflowKind {
791
- FUNCTION = "FUNCTION",
792
- DURABLE = "DURABLE",
793
- DAG = "DAG"
794
- }
795
885
  export type WorkflowKindList = WorkflowKind[];
796
886
  export interface WorkflowRunsCancelRequest {
797
887
  workflowRunIds: string[];
798
888
  }
799
- export declare enum JobRunStatus {
800
- PENDING = "PENDING",
801
- RUNNING = "RUNNING",
802
- SUCCEEDED = "SUCCEEDED",
803
- FAILED = "FAILED",
804
- CANCELLED = "CANCELLED",
805
- BACKOFF = "BACKOFF"
806
- }
807
- export declare enum StepRunStatus {
808
- PENDING = "PENDING",
809
- PENDING_ASSIGNMENT = "PENDING_ASSIGNMENT",
810
- ASSIGNED = "ASSIGNED",
811
- RUNNING = "RUNNING",
812
- SUCCEEDED = "SUCCEEDED",
813
- FAILED = "FAILED",
814
- CANCELLED = "CANCELLED",
815
- CANCELLING = "CANCELLING",
816
- BACKOFF = "BACKOFF"
817
- }
818
889
  export interface JobRun {
819
890
  metadata: APIResourceMeta;
820
891
  tenantId: string;
@@ -877,30 +948,6 @@ export interface StepRun {
877
948
  cancelledReason?: string;
878
949
  cancelledError?: string;
879
950
  }
880
- export declare enum StepRunEventReason {
881
- REQUEUED_NO_WORKER = "REQUEUED_NO_WORKER",
882
- REQUEUED_RATE_LIMIT = "REQUEUED_RATE_LIMIT",
883
- SCHEDULING_TIMED_OUT = "SCHEDULING_TIMED_OUT",
884
- ASSIGNED = "ASSIGNED",
885
- STARTED = "STARTED",
886
- ACKNOWLEDGED = "ACKNOWLEDGED",
887
- FINISHED = "FINISHED",
888
- FAILED = "FAILED",
889
- RETRYING = "RETRYING",
890
- CANCELLED = "CANCELLED",
891
- TIMEOUT_REFRESHED = "TIMEOUT_REFRESHED",
892
- REASSIGNED = "REASSIGNED",
893
- TIMED_OUT = "TIMED_OUT",
894
- SLOT_RELEASED = "SLOT_RELEASED",
895
- RETRIED_BY_USER = "RETRIED_BY_USER",
896
- WORKFLOW_RUN_GROUP_KEY_SUCCEEDED = "WORKFLOW_RUN_GROUP_KEY_SUCCEEDED",
897
- WORKFLOW_RUN_GROUP_KEY_FAILED = "WORKFLOW_RUN_GROUP_KEY_FAILED"
898
- }
899
- export declare enum StepRunEventSeverity {
900
- INFO = "INFO",
901
- WARNING = "WARNING",
902
- CRITICAL = "CRITICAL"
903
- }
904
951
  export interface StepRunEvent {
905
952
  id: number;
906
953
  /** @format date-time */
@@ -954,11 +1001,6 @@ export interface WorkerRuntimeInfo {
954
1001
  os?: string;
955
1002
  runtimeExtra?: string;
956
1003
  }
957
- export declare enum WorkerRuntimeSDKs {
958
- GOLANG = "GOLANG",
959
- PYTHON = "PYTHON",
960
- TYPESCRIPT = "TYPESCRIPT"
961
- }
962
1004
  export interface WorkerList {
963
1005
  pagination?: PaginationResponse;
964
1006
  rows?: Worker[];
@@ -1010,13 +1052,13 @@ export interface Worker {
1010
1052
  /**
1011
1053
  * The time this worker last sent a heartbeat.
1012
1054
  * @format date-time
1013
- * @example "2022-12-13T20:06:48.888Z"
1055
+ * @example "2022-12-13T15:06:48.888358-05:00"
1014
1056
  */
1015
1057
  lastHeartbeatAt?: string;
1016
1058
  /**
1017
1059
  * The time this worker last sent a heartbeat.
1018
1060
  * @format date-time
1019
- * @example "2022-12-13T20:06:48.888Z"
1061
+ * @example "2022-12-13T15:06:48.888358-05:00"
1020
1062
  */
1021
1063
  lastListenerEstablished?: string;
1022
1064
  /** The actions this worker can perform. */
@@ -1146,10 +1188,6 @@ export interface PullRequest {
1146
1188
  pullRequestBaseBranch: string;
1147
1189
  pullRequestState: PullRequestState;
1148
1190
  }
1149
- export declare enum PullRequestState {
1150
- Open = "open",
1151
- Closed = "closed"
1152
- }
1153
1191
  export interface LogLine {
1154
1192
  /**
1155
1193
  * The creation date of the log line.
@@ -1161,23 +1199,10 @@ export interface LogLine {
1161
1199
  /** The log metadata. */
1162
1200
  metadata: object;
1163
1201
  }
1164
- export declare enum LogLineLevel {
1165
- DEBUG = "DEBUG",
1166
- INFO = "INFO",
1167
- WARN = "WARN",
1168
- ERROR = "ERROR"
1169
- }
1170
1202
  export interface LogLineList {
1171
1203
  pagination?: PaginationResponse;
1172
1204
  rows?: LogLine[];
1173
1205
  }
1174
- export declare enum LogLineOrderByField {
1175
- CreatedAt = "createdAt"
1176
- }
1177
- export declare enum LogLineOrderByDirection {
1178
- Asc = "asc",
1179
- Desc = "desc"
1180
- }
1181
1206
  export type LogLineSearch = string;
1182
1207
  export type LogLineLevelField = LogLineLevel[];
1183
1208
  export interface SNSIntegration {
@@ -1233,11 +1258,6 @@ export interface WebhookWorker {
1233
1258
  /** The webhook url. */
1234
1259
  url: string;
1235
1260
  }
1236
- export declare enum WebhookWorkerRequestMethod {
1237
- GET = "GET",
1238
- POST = "POST",
1239
- PUT = "PUT"
1240
- }
1241
1261
  export interface WebhookWorkerRequest {
1242
1262
  /**
1243
1263
  * The date and time the request was created.
@@ -1296,7 +1316,7 @@ export interface V1WorkflowRunDisplayNameList {
1296
1316
  export interface V1TaskSummary {
1297
1317
  metadata: APIResourceMeta;
1298
1318
  /** The action ID of the task. */
1299
- actionId: string;
1319
+ actionId?: string;
1300
1320
  /** Additional metadata for the task run. */
1301
1321
  additionalMetadata?: object;
1302
1322
  /** The list of children tasks */
@@ -1396,13 +1416,6 @@ export interface V1TaskEventList {
1396
1416
  taskDisplayName?: string;
1397
1417
  }[];
1398
1418
  }
1399
- export declare enum V1TaskStatus {
1400
- QUEUED = "QUEUED",
1401
- RUNNING = "RUNNING",
1402
- COMPLETED = "COMPLETED",
1403
- CANCELLED = "CANCELLED",
1404
- FAILED = "FAILED"
1405
- }
1406
1419
  export type V1TaskRunMetrics = {
1407
1420
  status: V1TaskStatus;
1408
1421
  count: number;
@@ -1509,18 +1522,13 @@ export interface V1WorkflowRunDetails {
1509
1522
  }[];
1510
1523
  tasks: V1TaskSummary[];
1511
1524
  }
1512
- export declare enum V1TaskRunStatus {
1513
- PENDING = "PENDING",
1514
- RUNNING = "RUNNING",
1515
- COMPLETED = "COMPLETED",
1516
- FAILED = "FAILED",
1517
- CANCELLED = "CANCELLED"
1518
- }
1519
1525
  export interface V1TriggerWorkflowRunRequest {
1520
1526
  /** The name of the workflow. */
1521
1527
  workflowName: string;
1522
1528
  input: object;
1523
1529
  additionalMetadata?: object;
1530
+ /** The priority of the workflow run. */
1531
+ priority?: number;
1524
1532
  }
1525
1533
  export interface V1LogLine {
1526
1534
  /**
@@ -1533,12 +1541,6 @@ export interface V1LogLine {
1533
1541
  /** The log metadata. */
1534
1542
  metadata: object;
1535
1543
  }
1536
- export declare enum V1LogLineLevel {
1537
- DEBUG = "DEBUG",
1538
- INFO = "INFO",
1539
- WARN = "WARN",
1540
- ERROR = "ERROR"
1541
- }
1542
1544
  export interface V1LogLineList {
1543
1545
  pagination?: PaginationResponse;
1544
1546
  rows?: V1LogLine[];
@@ -11,112 +11,69 @@
11
11
  * ---------------------------------------------------------------
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.V1LogLineLevel = exports.V1TaskRunStatus = exports.V1TaskStatus = exports.WebhookWorkerRequestMethod = exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.WorkerRuntimeSDKs = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowKind = exports.WorkflowRunStatus = exports.WorkflowRunOrderByDirection = exports.WorkflowRunOrderByField = exports.CronWorkflowsOrderByField = exports.ScheduledRunStatus = exports.ScheduledWorkflowsOrderByField = exports.RateLimitOrderByDirection = exports.RateLimitOrderByField = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantResource = exports.TenantMemberRole = void 0;
15
- var TenantMemberRole;
16
- (function (TenantMemberRole) {
17
- TenantMemberRole["OWNER"] = "OWNER";
18
- TenantMemberRole["ADMIN"] = "ADMIN";
19
- TenantMemberRole["MEMBER"] = "MEMBER";
20
- })(TenantMemberRole || (exports.TenantMemberRole = TenantMemberRole = {}));
21
- var TenantResource;
22
- (function (TenantResource) {
23
- TenantResource["WORKER"] = "WORKER";
24
- TenantResource["WORKER_SLOT"] = "WORKER_SLOT";
25
- TenantResource["EVENT"] = "EVENT";
26
- TenantResource["WORKFLOW_RUN"] = "WORKFLOW_RUN";
27
- TenantResource["TASK_RUN"] = "TASK_RUN";
28
- TenantResource["CRON"] = "CRON";
29
- TenantResource["SCHEDULE"] = "SCHEDULE";
30
- })(TenantResource || (exports.TenantResource = TenantResource = {}));
31
- var EventOrderByField;
32
- (function (EventOrderByField) {
33
- EventOrderByField["CreatedAt"] = "createdAt";
34
- })(EventOrderByField || (exports.EventOrderByField = EventOrderByField = {}));
35
- var EventOrderByDirection;
36
- (function (EventOrderByDirection) {
37
- EventOrderByDirection["Asc"] = "asc";
38
- EventOrderByDirection["Desc"] = "desc";
39
- })(EventOrderByDirection || (exports.EventOrderByDirection = EventOrderByDirection = {}));
40
- var RateLimitOrderByField;
41
- (function (RateLimitOrderByField) {
42
- RateLimitOrderByField["Key"] = "key";
43
- RateLimitOrderByField["Value"] = "value";
44
- RateLimitOrderByField["LimitValue"] = "limitValue";
45
- })(RateLimitOrderByField || (exports.RateLimitOrderByField = RateLimitOrderByField = {}));
46
- var RateLimitOrderByDirection;
47
- (function (RateLimitOrderByDirection) {
48
- RateLimitOrderByDirection["Asc"] = "asc";
49
- RateLimitOrderByDirection["Desc"] = "desc";
50
- })(RateLimitOrderByDirection || (exports.RateLimitOrderByDirection = RateLimitOrderByDirection = {}));
51
- var ScheduledWorkflowsOrderByField;
52
- (function (ScheduledWorkflowsOrderByField) {
53
- ScheduledWorkflowsOrderByField["TriggerAt"] = "triggerAt";
54
- ScheduledWorkflowsOrderByField["CreatedAt"] = "createdAt";
55
- })(ScheduledWorkflowsOrderByField || (exports.ScheduledWorkflowsOrderByField = ScheduledWorkflowsOrderByField = {}));
56
- var ScheduledRunStatus;
57
- (function (ScheduledRunStatus) {
58
- ScheduledRunStatus["PENDING"] = "PENDING";
59
- ScheduledRunStatus["RUNNING"] = "RUNNING";
60
- ScheduledRunStatus["SUCCEEDED"] = "SUCCEEDED";
61
- ScheduledRunStatus["FAILED"] = "FAILED";
62
- ScheduledRunStatus["CANCELLED"] = "CANCELLED";
63
- ScheduledRunStatus["QUEUED"] = "QUEUED";
64
- ScheduledRunStatus["SCHEDULED"] = "SCHEDULED";
65
- })(ScheduledRunStatus || (exports.ScheduledRunStatus = ScheduledRunStatus = {}));
66
- var CronWorkflowsOrderByField;
67
- (function (CronWorkflowsOrderByField) {
68
- CronWorkflowsOrderByField["Name"] = "name";
69
- CronWorkflowsOrderByField["CreatedAt"] = "createdAt";
70
- })(CronWorkflowsOrderByField || (exports.CronWorkflowsOrderByField = CronWorkflowsOrderByField = {}));
71
- var WorkflowRunOrderByField;
72
- (function (WorkflowRunOrderByField) {
73
- WorkflowRunOrderByField["CreatedAt"] = "createdAt";
74
- WorkflowRunOrderByField["StartedAt"] = "startedAt";
75
- WorkflowRunOrderByField["FinishedAt"] = "finishedAt";
76
- WorkflowRunOrderByField["Duration"] = "duration";
77
- })(WorkflowRunOrderByField || (exports.WorkflowRunOrderByField = WorkflowRunOrderByField = {}));
78
- var WorkflowRunOrderByDirection;
79
- (function (WorkflowRunOrderByDirection) {
80
- WorkflowRunOrderByDirection["ASC"] = "ASC";
81
- WorkflowRunOrderByDirection["DESC"] = "DESC";
82
- })(WorkflowRunOrderByDirection || (exports.WorkflowRunOrderByDirection = WorkflowRunOrderByDirection = {}));
83
- var WorkflowRunStatus;
84
- (function (WorkflowRunStatus) {
85
- WorkflowRunStatus["PENDING"] = "PENDING";
86
- WorkflowRunStatus["RUNNING"] = "RUNNING";
87
- WorkflowRunStatus["SUCCEEDED"] = "SUCCEEDED";
88
- WorkflowRunStatus["FAILED"] = "FAILED";
89
- WorkflowRunStatus["CANCELLED"] = "CANCELLED";
90
- WorkflowRunStatus["QUEUED"] = "QUEUED";
91
- WorkflowRunStatus["BACKOFF"] = "BACKOFF";
92
- })(WorkflowRunStatus || (exports.WorkflowRunStatus = WorkflowRunStatus = {}));
93
- var WorkflowKind;
94
- (function (WorkflowKind) {
95
- WorkflowKind["FUNCTION"] = "FUNCTION";
96
- WorkflowKind["DURABLE"] = "DURABLE";
97
- WorkflowKind["DAG"] = "DAG";
98
- })(WorkflowKind || (exports.WorkflowKind = WorkflowKind = {}));
99
- var JobRunStatus;
100
- (function (JobRunStatus) {
101
- JobRunStatus["PENDING"] = "PENDING";
102
- JobRunStatus["RUNNING"] = "RUNNING";
103
- JobRunStatus["SUCCEEDED"] = "SUCCEEDED";
104
- JobRunStatus["FAILED"] = "FAILED";
105
- JobRunStatus["CANCELLED"] = "CANCELLED";
106
- JobRunStatus["BACKOFF"] = "BACKOFF";
107
- })(JobRunStatus || (exports.JobRunStatus = JobRunStatus = {}));
108
- var StepRunStatus;
109
- (function (StepRunStatus) {
110
- StepRunStatus["PENDING"] = "PENDING";
111
- StepRunStatus["PENDING_ASSIGNMENT"] = "PENDING_ASSIGNMENT";
112
- StepRunStatus["ASSIGNED"] = "ASSIGNED";
113
- StepRunStatus["RUNNING"] = "RUNNING";
114
- StepRunStatus["SUCCEEDED"] = "SUCCEEDED";
115
- StepRunStatus["FAILED"] = "FAILED";
116
- StepRunStatus["CANCELLED"] = "CANCELLED";
117
- StepRunStatus["CANCELLING"] = "CANCELLING";
118
- StepRunStatus["BACKOFF"] = "BACKOFF";
119
- })(StepRunStatus || (exports.StepRunStatus = StepRunStatus = {}));
14
+ exports.TenantMemberRole = exports.TenantResource = exports.EventOrderByField = exports.EventOrderByDirection = exports.RateLimitOrderByField = exports.RateLimitOrderByDirection = exports.ScheduledWorkflowsOrderByField = exports.ScheduledRunStatus = exports.CronWorkflowsOrderByField = exports.WorkflowRunOrderByField = exports.WorkflowRunOrderByDirection = exports.WorkflowRunStatus = exports.WorkflowKind = exports.JobRunStatus = exports.StepRunStatus = exports.StepRunEventReason = exports.StepRunEventSeverity = exports.WorkerRuntimeSDKs = exports.PullRequestState = exports.LogLineLevel = exports.LogLineOrderByField = exports.LogLineOrderByDirection = exports.WebhookWorkerRequestMethod = exports.V1TaskStatus = exports.V1TaskRunStatus = exports.V1LogLineLevel = void 0;
15
+ var V1LogLineLevel;
16
+ (function (V1LogLineLevel) {
17
+ V1LogLineLevel["DEBUG"] = "DEBUG";
18
+ V1LogLineLevel["INFO"] = "INFO";
19
+ V1LogLineLevel["WARN"] = "WARN";
20
+ V1LogLineLevel["ERROR"] = "ERROR";
21
+ })(V1LogLineLevel || (exports.V1LogLineLevel = V1LogLineLevel = {}));
22
+ var V1TaskRunStatus;
23
+ (function (V1TaskRunStatus) {
24
+ V1TaskRunStatus["PENDING"] = "PENDING";
25
+ V1TaskRunStatus["RUNNING"] = "RUNNING";
26
+ V1TaskRunStatus["COMPLETED"] = "COMPLETED";
27
+ V1TaskRunStatus["FAILED"] = "FAILED";
28
+ V1TaskRunStatus["CANCELLED"] = "CANCELLED";
29
+ })(V1TaskRunStatus || (exports.V1TaskRunStatus = V1TaskRunStatus = {}));
30
+ var V1TaskStatus;
31
+ (function (V1TaskStatus) {
32
+ V1TaskStatus["QUEUED"] = "QUEUED";
33
+ V1TaskStatus["RUNNING"] = "RUNNING";
34
+ V1TaskStatus["COMPLETED"] = "COMPLETED";
35
+ V1TaskStatus["CANCELLED"] = "CANCELLED";
36
+ V1TaskStatus["FAILED"] = "FAILED";
37
+ })(V1TaskStatus || (exports.V1TaskStatus = V1TaskStatus = {}));
38
+ var WebhookWorkerRequestMethod;
39
+ (function (WebhookWorkerRequestMethod) {
40
+ WebhookWorkerRequestMethod["GET"] = "GET";
41
+ WebhookWorkerRequestMethod["POST"] = "POST";
42
+ WebhookWorkerRequestMethod["PUT"] = "PUT";
43
+ })(WebhookWorkerRequestMethod || (exports.WebhookWorkerRequestMethod = WebhookWorkerRequestMethod = {}));
44
+ var LogLineOrderByDirection;
45
+ (function (LogLineOrderByDirection) {
46
+ LogLineOrderByDirection["Asc"] = "asc";
47
+ LogLineOrderByDirection["Desc"] = "desc";
48
+ })(LogLineOrderByDirection || (exports.LogLineOrderByDirection = LogLineOrderByDirection = {}));
49
+ var LogLineOrderByField;
50
+ (function (LogLineOrderByField) {
51
+ LogLineOrderByField["CreatedAt"] = "createdAt";
52
+ })(LogLineOrderByField || (exports.LogLineOrderByField = LogLineOrderByField = {}));
53
+ var LogLineLevel;
54
+ (function (LogLineLevel) {
55
+ LogLineLevel["DEBUG"] = "DEBUG";
56
+ LogLineLevel["INFO"] = "INFO";
57
+ LogLineLevel["WARN"] = "WARN";
58
+ LogLineLevel["ERROR"] = "ERROR";
59
+ })(LogLineLevel || (exports.LogLineLevel = LogLineLevel = {}));
60
+ var PullRequestState;
61
+ (function (PullRequestState) {
62
+ PullRequestState["Open"] = "open";
63
+ PullRequestState["Closed"] = "closed";
64
+ })(PullRequestState || (exports.PullRequestState = PullRequestState = {}));
65
+ var WorkerRuntimeSDKs;
66
+ (function (WorkerRuntimeSDKs) {
67
+ WorkerRuntimeSDKs["GOLANG"] = "GOLANG";
68
+ WorkerRuntimeSDKs["PYTHON"] = "PYTHON";
69
+ WorkerRuntimeSDKs["TYPESCRIPT"] = "TYPESCRIPT";
70
+ })(WorkerRuntimeSDKs || (exports.WorkerRuntimeSDKs = WorkerRuntimeSDKs = {}));
71
+ var StepRunEventSeverity;
72
+ (function (StepRunEventSeverity) {
73
+ StepRunEventSeverity["INFO"] = "INFO";
74
+ StepRunEventSeverity["WARNING"] = "WARNING";
75
+ StepRunEventSeverity["CRITICAL"] = "CRITICAL";
76
+ })(StepRunEventSeverity || (exports.StepRunEventSeverity = StepRunEventSeverity = {}));
120
77
  var StepRunEventReason;
121
78
  (function (StepRunEventReason) {
122
79
  StepRunEventReason["REQUEUED_NO_WORKER"] = "REQUEUED_NO_WORKER";
@@ -137,65 +94,108 @@ var StepRunEventReason;
137
94
  StepRunEventReason["WORKFLOW_RUN_GROUP_KEY_SUCCEEDED"] = "WORKFLOW_RUN_GROUP_KEY_SUCCEEDED";
138
95
  StepRunEventReason["WORKFLOW_RUN_GROUP_KEY_FAILED"] = "WORKFLOW_RUN_GROUP_KEY_FAILED";
139
96
  })(StepRunEventReason || (exports.StepRunEventReason = StepRunEventReason = {}));
140
- var StepRunEventSeverity;
141
- (function (StepRunEventSeverity) {
142
- StepRunEventSeverity["INFO"] = "INFO";
143
- StepRunEventSeverity["WARNING"] = "WARNING";
144
- StepRunEventSeverity["CRITICAL"] = "CRITICAL";
145
- })(StepRunEventSeverity || (exports.StepRunEventSeverity = StepRunEventSeverity = {}));
146
- var WorkerRuntimeSDKs;
147
- (function (WorkerRuntimeSDKs) {
148
- WorkerRuntimeSDKs["GOLANG"] = "GOLANG";
149
- WorkerRuntimeSDKs["PYTHON"] = "PYTHON";
150
- WorkerRuntimeSDKs["TYPESCRIPT"] = "TYPESCRIPT";
151
- })(WorkerRuntimeSDKs || (exports.WorkerRuntimeSDKs = WorkerRuntimeSDKs = {}));
152
- var PullRequestState;
153
- (function (PullRequestState) {
154
- PullRequestState["Open"] = "open";
155
- PullRequestState["Closed"] = "closed";
156
- })(PullRequestState || (exports.PullRequestState = PullRequestState = {}));
157
- var LogLineLevel;
158
- (function (LogLineLevel) {
159
- LogLineLevel["DEBUG"] = "DEBUG";
160
- LogLineLevel["INFO"] = "INFO";
161
- LogLineLevel["WARN"] = "WARN";
162
- LogLineLevel["ERROR"] = "ERROR";
163
- })(LogLineLevel || (exports.LogLineLevel = LogLineLevel = {}));
164
- var LogLineOrderByField;
165
- (function (LogLineOrderByField) {
166
- LogLineOrderByField["CreatedAt"] = "createdAt";
167
- })(LogLineOrderByField || (exports.LogLineOrderByField = LogLineOrderByField = {}));
168
- var LogLineOrderByDirection;
169
- (function (LogLineOrderByDirection) {
170
- LogLineOrderByDirection["Asc"] = "asc";
171
- LogLineOrderByDirection["Desc"] = "desc";
172
- })(LogLineOrderByDirection || (exports.LogLineOrderByDirection = LogLineOrderByDirection = {}));
173
- var WebhookWorkerRequestMethod;
174
- (function (WebhookWorkerRequestMethod) {
175
- WebhookWorkerRequestMethod["GET"] = "GET";
176
- WebhookWorkerRequestMethod["POST"] = "POST";
177
- WebhookWorkerRequestMethod["PUT"] = "PUT";
178
- })(WebhookWorkerRequestMethod || (exports.WebhookWorkerRequestMethod = WebhookWorkerRequestMethod = {}));
179
- var V1TaskStatus;
180
- (function (V1TaskStatus) {
181
- V1TaskStatus["QUEUED"] = "QUEUED";
182
- V1TaskStatus["RUNNING"] = "RUNNING";
183
- V1TaskStatus["COMPLETED"] = "COMPLETED";
184
- V1TaskStatus["CANCELLED"] = "CANCELLED";
185
- V1TaskStatus["FAILED"] = "FAILED";
186
- })(V1TaskStatus || (exports.V1TaskStatus = V1TaskStatus = {}));
187
- var V1TaskRunStatus;
188
- (function (V1TaskRunStatus) {
189
- V1TaskRunStatus["PENDING"] = "PENDING";
190
- V1TaskRunStatus["RUNNING"] = "RUNNING";
191
- V1TaskRunStatus["COMPLETED"] = "COMPLETED";
192
- V1TaskRunStatus["FAILED"] = "FAILED";
193
- V1TaskRunStatus["CANCELLED"] = "CANCELLED";
194
- })(V1TaskRunStatus || (exports.V1TaskRunStatus = V1TaskRunStatus = {}));
195
- var V1LogLineLevel;
196
- (function (V1LogLineLevel) {
197
- V1LogLineLevel["DEBUG"] = "DEBUG";
198
- V1LogLineLevel["INFO"] = "INFO";
199
- V1LogLineLevel["WARN"] = "WARN";
200
- V1LogLineLevel["ERROR"] = "ERROR";
201
- })(V1LogLineLevel || (exports.V1LogLineLevel = V1LogLineLevel = {}));
97
+ var StepRunStatus;
98
+ (function (StepRunStatus) {
99
+ StepRunStatus["PENDING"] = "PENDING";
100
+ StepRunStatus["PENDING_ASSIGNMENT"] = "PENDING_ASSIGNMENT";
101
+ StepRunStatus["ASSIGNED"] = "ASSIGNED";
102
+ StepRunStatus["RUNNING"] = "RUNNING";
103
+ StepRunStatus["SUCCEEDED"] = "SUCCEEDED";
104
+ StepRunStatus["FAILED"] = "FAILED";
105
+ StepRunStatus["CANCELLED"] = "CANCELLED";
106
+ StepRunStatus["CANCELLING"] = "CANCELLING";
107
+ StepRunStatus["BACKOFF"] = "BACKOFF";
108
+ })(StepRunStatus || (exports.StepRunStatus = StepRunStatus = {}));
109
+ var JobRunStatus;
110
+ (function (JobRunStatus) {
111
+ JobRunStatus["PENDING"] = "PENDING";
112
+ JobRunStatus["RUNNING"] = "RUNNING";
113
+ JobRunStatus["SUCCEEDED"] = "SUCCEEDED";
114
+ JobRunStatus["FAILED"] = "FAILED";
115
+ JobRunStatus["CANCELLED"] = "CANCELLED";
116
+ JobRunStatus["BACKOFF"] = "BACKOFF";
117
+ })(JobRunStatus || (exports.JobRunStatus = JobRunStatus = {}));
118
+ var WorkflowKind;
119
+ (function (WorkflowKind) {
120
+ WorkflowKind["FUNCTION"] = "FUNCTION";
121
+ WorkflowKind["DURABLE"] = "DURABLE";
122
+ WorkflowKind["DAG"] = "DAG";
123
+ })(WorkflowKind || (exports.WorkflowKind = WorkflowKind = {}));
124
+ var WorkflowRunStatus;
125
+ (function (WorkflowRunStatus) {
126
+ WorkflowRunStatus["PENDING"] = "PENDING";
127
+ WorkflowRunStatus["RUNNING"] = "RUNNING";
128
+ WorkflowRunStatus["SUCCEEDED"] = "SUCCEEDED";
129
+ WorkflowRunStatus["FAILED"] = "FAILED";
130
+ WorkflowRunStatus["CANCELLED"] = "CANCELLED";
131
+ WorkflowRunStatus["QUEUED"] = "QUEUED";
132
+ WorkflowRunStatus["BACKOFF"] = "BACKOFF";
133
+ })(WorkflowRunStatus || (exports.WorkflowRunStatus = WorkflowRunStatus = {}));
134
+ var WorkflowRunOrderByDirection;
135
+ (function (WorkflowRunOrderByDirection) {
136
+ WorkflowRunOrderByDirection["ASC"] = "ASC";
137
+ WorkflowRunOrderByDirection["DESC"] = "DESC";
138
+ })(WorkflowRunOrderByDirection || (exports.WorkflowRunOrderByDirection = WorkflowRunOrderByDirection = {}));
139
+ var WorkflowRunOrderByField;
140
+ (function (WorkflowRunOrderByField) {
141
+ WorkflowRunOrderByField["CreatedAt"] = "createdAt";
142
+ WorkflowRunOrderByField["StartedAt"] = "startedAt";
143
+ WorkflowRunOrderByField["FinishedAt"] = "finishedAt";
144
+ WorkflowRunOrderByField["Duration"] = "duration";
145
+ })(WorkflowRunOrderByField || (exports.WorkflowRunOrderByField = WorkflowRunOrderByField = {}));
146
+ var CronWorkflowsOrderByField;
147
+ (function (CronWorkflowsOrderByField) {
148
+ CronWorkflowsOrderByField["Name"] = "name";
149
+ CronWorkflowsOrderByField["CreatedAt"] = "createdAt";
150
+ })(CronWorkflowsOrderByField || (exports.CronWorkflowsOrderByField = CronWorkflowsOrderByField = {}));
151
+ var ScheduledRunStatus;
152
+ (function (ScheduledRunStatus) {
153
+ ScheduledRunStatus["PENDING"] = "PENDING";
154
+ ScheduledRunStatus["RUNNING"] = "RUNNING";
155
+ ScheduledRunStatus["SUCCEEDED"] = "SUCCEEDED";
156
+ ScheduledRunStatus["FAILED"] = "FAILED";
157
+ ScheduledRunStatus["CANCELLED"] = "CANCELLED";
158
+ ScheduledRunStatus["QUEUED"] = "QUEUED";
159
+ ScheduledRunStatus["SCHEDULED"] = "SCHEDULED";
160
+ })(ScheduledRunStatus || (exports.ScheduledRunStatus = ScheduledRunStatus = {}));
161
+ var ScheduledWorkflowsOrderByField;
162
+ (function (ScheduledWorkflowsOrderByField) {
163
+ ScheduledWorkflowsOrderByField["TriggerAt"] = "triggerAt";
164
+ ScheduledWorkflowsOrderByField["CreatedAt"] = "createdAt";
165
+ })(ScheduledWorkflowsOrderByField || (exports.ScheduledWorkflowsOrderByField = ScheduledWorkflowsOrderByField = {}));
166
+ var RateLimitOrderByDirection;
167
+ (function (RateLimitOrderByDirection) {
168
+ RateLimitOrderByDirection["Asc"] = "asc";
169
+ RateLimitOrderByDirection["Desc"] = "desc";
170
+ })(RateLimitOrderByDirection || (exports.RateLimitOrderByDirection = RateLimitOrderByDirection = {}));
171
+ var RateLimitOrderByField;
172
+ (function (RateLimitOrderByField) {
173
+ RateLimitOrderByField["Key"] = "key";
174
+ RateLimitOrderByField["Value"] = "value";
175
+ RateLimitOrderByField["LimitValue"] = "limitValue";
176
+ })(RateLimitOrderByField || (exports.RateLimitOrderByField = RateLimitOrderByField = {}));
177
+ var EventOrderByDirection;
178
+ (function (EventOrderByDirection) {
179
+ EventOrderByDirection["Asc"] = "asc";
180
+ EventOrderByDirection["Desc"] = "desc";
181
+ })(EventOrderByDirection || (exports.EventOrderByDirection = EventOrderByDirection = {}));
182
+ var EventOrderByField;
183
+ (function (EventOrderByField) {
184
+ EventOrderByField["CreatedAt"] = "createdAt";
185
+ })(EventOrderByField || (exports.EventOrderByField = EventOrderByField = {}));
186
+ var TenantResource;
187
+ (function (TenantResource) {
188
+ TenantResource["WORKER"] = "WORKER";
189
+ TenantResource["WORKER_SLOT"] = "WORKER_SLOT";
190
+ TenantResource["EVENT"] = "EVENT";
191
+ TenantResource["WORKFLOW_RUN"] = "WORKFLOW_RUN";
192
+ TenantResource["TASK_RUN"] = "TASK_RUN";
193
+ TenantResource["CRON"] = "CRON";
194
+ TenantResource["SCHEDULE"] = "SCHEDULE";
195
+ })(TenantResource || (exports.TenantResource = TenantResource = {}));
196
+ var TenantMemberRole;
197
+ (function (TenantMemberRole) {
198
+ TenantMemberRole["OWNER"] = "OWNER";
199
+ TenantMemberRole["ADMIN"] = "ADMIN";
200
+ TenantMemberRole["MEMBER"] = "MEMBER";
201
+ })(TenantMemberRole || (exports.TenantMemberRole = TenantMemberRole = {}));
@@ -190,6 +190,8 @@ class V0Worker {
190
190
  ...(workflow.onCrons || []),
191
191
  ...(((_v = workflow.on) === null || _v === void 0 ? void 0 : _v.cron) ? [workflow.on.cron] : []),
192
192
  ];
193
+ const concurrencyArr = Array.isArray(concurrency) ? concurrency : [];
194
+ const concurrencySolo = !Array.isArray(concurrency) ? concurrency : undefined;
193
195
  const registeredWorkflow = this.client.admin.putWorkflowV1({
194
196
  name: workflow.name,
195
197
  description: workflow.description || '',
@@ -197,7 +199,7 @@ class V0Worker {
197
199
  eventTriggers,
198
200
  cronTriggers,
199
201
  sticky: workflow.sticky,
200
- concurrency,
202
+ concurrencyArr,
201
203
  onFailureTask,
202
204
  defaultPriority: workflow.defaultPriority,
203
205
  tasks: [...workflow._tasks, ...workflow._durableTasks].map((task) => {
@@ -230,6 +232,7 @@ class V0Worker {
230
232
  : [],
231
233
  });
232
234
  }),
235
+ concurrency: concurrencySolo,
233
236
  });
234
237
  this.registeredWorkflowPromises.push(registeredWorkflow);
235
238
  yield registeredWorkflow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -71,6 +71,7 @@ export interface TriggerWorkflowRunRequest {
71
71
  workflowName: string;
72
72
  input: Uint8Array;
73
73
  additionalMetadata: Uint8Array;
74
+ priority?: number | undefined;
74
75
  }
75
76
  export interface TriggerWorkflowRunResponse {
76
77
  externalId: string;
@@ -89,7 +90,7 @@ export interface CreateWorkflowVersionRequest {
89
90
  cronTriggers: string[];
90
91
  /** (required) the workflow jobs */
91
92
  tasks: CreateTaskOpts[];
92
- /** (optional) the workflow concurrency options */
93
+ /** Deprecated: use concurrency_arr instead */
93
94
  concurrency: Concurrency | undefined;
94
95
  /** (optional) the input for the cron trigger */
95
96
  cronInput?: string | undefined;
@@ -99,6 +100,8 @@ export interface CreateWorkflowVersionRequest {
99
100
  sticky?: StickyStrategy | undefined;
100
101
  /** (optional) the default priority for the workflow */
101
102
  defaultPriority?: number | undefined;
103
+ /** (optional) the workflow concurrency options */
104
+ concurrencyArr: Concurrency[];
102
105
  }
103
106
  export interface Concurrency {
104
107
  /** (required) the expression to use for concurrency */
@@ -609,7 +609,12 @@ exports.ReplayTasksResponse = {
609
609
  },
610
610
  };
611
611
  function createBaseTriggerWorkflowRunRequest() {
612
- return { workflowName: '', input: new Uint8Array(0), additionalMetadata: new Uint8Array(0) };
612
+ return {
613
+ workflowName: '',
614
+ input: new Uint8Array(0),
615
+ additionalMetadata: new Uint8Array(0),
616
+ priority: undefined,
617
+ };
613
618
  }
614
619
  exports.TriggerWorkflowRunRequest = {
615
620
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -622,6 +627,9 @@ exports.TriggerWorkflowRunRequest = {
622
627
  if (message.additionalMetadata.length !== 0) {
623
628
  writer.uint32(26).bytes(message.additionalMetadata);
624
629
  }
630
+ if (message.priority !== undefined) {
631
+ writer.uint32(32).int32(message.priority);
632
+ }
625
633
  return writer;
626
634
  },
627
635
  decode(input, length) {
@@ -652,6 +660,13 @@ exports.TriggerWorkflowRunRequest = {
652
660
  message.additionalMetadata = reader.bytes();
653
661
  continue;
654
662
  }
663
+ case 4: {
664
+ if (tag !== 32) {
665
+ break;
666
+ }
667
+ message.priority = reader.int32();
668
+ continue;
669
+ }
655
670
  }
656
671
  if ((tag & 7) === 4 || tag === 0) {
657
672
  break;
@@ -667,6 +682,7 @@ exports.TriggerWorkflowRunRequest = {
667
682
  additionalMetadata: isSet(object.additionalMetadata)
668
683
  ? bytesFromBase64(object.additionalMetadata)
669
684
  : new Uint8Array(0),
685
+ priority: isSet(object.priority) ? globalThis.Number(object.priority) : undefined,
670
686
  };
671
687
  },
672
688
  toJSON(message) {
@@ -680,17 +696,21 @@ exports.TriggerWorkflowRunRequest = {
680
696
  if (message.additionalMetadata.length !== 0) {
681
697
  obj.additionalMetadata = base64FromBytes(message.additionalMetadata);
682
698
  }
699
+ if (message.priority !== undefined) {
700
+ obj.priority = Math.round(message.priority);
701
+ }
683
702
  return obj;
684
703
  },
685
704
  create(base) {
686
705
  return exports.TriggerWorkflowRunRequest.fromPartial(base !== null && base !== void 0 ? base : {});
687
706
  },
688
707
  fromPartial(object) {
689
- var _a, _b, _c;
708
+ var _a, _b, _c, _d;
690
709
  const message = createBaseTriggerWorkflowRunRequest();
691
710
  message.workflowName = (_a = object.workflowName) !== null && _a !== void 0 ? _a : '';
692
711
  message.input = (_b = object.input) !== null && _b !== void 0 ? _b : new Uint8Array(0);
693
712
  message.additionalMetadata = (_c = object.additionalMetadata) !== null && _c !== void 0 ? _c : new Uint8Array(0);
713
+ message.priority = (_d = object.priority) !== null && _d !== void 0 ? _d : undefined;
694
714
  return message;
695
715
  },
696
716
  };
@@ -759,6 +779,7 @@ function createBaseCreateWorkflowVersionRequest() {
759
779
  onFailureTask: undefined,
760
780
  sticky: undefined,
761
781
  defaultPriority: undefined,
782
+ concurrencyArr: [],
762
783
  };
763
784
  }
764
785
  exports.CreateWorkflowVersionRequest = {
@@ -796,6 +817,9 @@ exports.CreateWorkflowVersionRequest = {
796
817
  if (message.defaultPriority !== undefined) {
797
818
  writer.uint32(88).int32(message.defaultPriority);
798
819
  }
820
+ for (const v of message.concurrencyArr) {
821
+ exports.Concurrency.encode(v, writer.uint32(98).fork()).join();
822
+ }
799
823
  return writer;
800
824
  },
801
825
  decode(input, length) {
@@ -882,6 +906,13 @@ exports.CreateWorkflowVersionRequest = {
882
906
  message.defaultPriority = reader.int32();
883
907
  continue;
884
908
  }
909
+ case 12: {
910
+ if (tag !== 98) {
911
+ break;
912
+ }
913
+ message.concurrencyArr.push(exports.Concurrency.decode(reader, reader.uint32()));
914
+ continue;
915
+ }
885
916
  }
886
917
  if ((tag & 7) === 4 || tag === 0) {
887
918
  break;
@@ -913,10 +944,13 @@ exports.CreateWorkflowVersionRequest = {
913
944
  defaultPriority: isSet(object.defaultPriority)
914
945
  ? globalThis.Number(object.defaultPriority)
915
946
  : undefined,
947
+ concurrencyArr: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.concurrencyArr)
948
+ ? object.concurrencyArr.map((e) => exports.Concurrency.fromJSON(e))
949
+ : [],
916
950
  };
917
951
  },
918
952
  toJSON(message) {
919
- var _a, _b, _c;
953
+ var _a, _b, _c, _d;
920
954
  const obj = {};
921
955
  if (message.name !== '') {
922
956
  obj.name = message.name;
@@ -951,13 +985,16 @@ exports.CreateWorkflowVersionRequest = {
951
985
  if (message.defaultPriority !== undefined) {
952
986
  obj.defaultPriority = Math.round(message.defaultPriority);
953
987
  }
988
+ if ((_d = message.concurrencyArr) === null || _d === void 0 ? void 0 : _d.length) {
989
+ obj.concurrencyArr = message.concurrencyArr.map((e) => exports.Concurrency.toJSON(e));
990
+ }
954
991
  return obj;
955
992
  },
956
993
  create(base) {
957
994
  return exports.CreateWorkflowVersionRequest.fromPartial(base !== null && base !== void 0 ? base : {});
958
995
  },
959
996
  fromPartial(object) {
960
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
997
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
961
998
  const message = createBaseCreateWorkflowVersionRequest();
962
999
  message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
963
1000
  message.description = (_b = object.description) !== null && _b !== void 0 ? _b : '';
@@ -976,6 +1013,7 @@ exports.CreateWorkflowVersionRequest = {
976
1013
  : undefined;
977
1014
  message.sticky = (_h = object.sticky) !== null && _h !== void 0 ? _h : undefined;
978
1015
  message.defaultPriority = (_j = object.defaultPriority) !== null && _j !== void 0 ? _j : undefined;
1016
+ message.concurrencyArr = ((_k = object.concurrencyArr) === null || _k === void 0 ? void 0 : _k.map((e) => exports.Concurrency.fromPartial(e))) || [];
979
1017
  return message;
980
1018
  },
981
1019
  };
@@ -60,6 +60,11 @@ class HatchetClient {
60
60
  logConstructor = hatchet_logger_1.DEFAULT_LOGGER;
61
61
  }
62
62
  const clientConfig = Object.assign(Object.assign({}, valid), { logger: logConstructor });
63
+ if (clientConfig.namespace) {
64
+ clientConfig.namespace = clientConfig.namespace.endsWith('_')
65
+ ? clientConfig.namespace.slice(0, -1)
66
+ : clientConfig.namespace;
67
+ }
63
68
  this.tenantId = clientConfig.tenant_id;
64
69
  this._api = (0, rest_1.default)(clientConfig.api_url, clientConfig.token, axiosConfig);
65
70
  this._v0 = new hatchet_client_1.InternalHatchetClient(clientConfig, options, axiosConfig, this.runs);
@@ -3,7 +3,7 @@ import { Context, DurableContext } from '../step';
3
3
  import { CronWorkflows, ScheduledWorkflows } from '../clients/rest/generated/data-contracts';
4
4
  import { Workflow as WorkflowV0 } from '../workflow';
5
5
  import { IHatchetClient } from './client/client.interface';
6
- import { CreateWorkflowTaskOpts, CreateOnFailureTaskOpts, TaskConcurrency, TaskFn, CreateWorkflowDurableTaskOpts, CreateBaseTaskOpts, CreateOnSuccessTaskOpts, DurableTaskFn } from './task';
6
+ import { CreateWorkflowTaskOpts, CreateOnFailureTaskOpts, TaskFn, CreateWorkflowDurableTaskOpts, CreateBaseTaskOpts, CreateOnSuccessTaskOpts, Concurrency, DurableTaskFn } from './task';
7
7
  import { Duration } from './client/duration';
8
8
  import { MetricsClient } from './client/features/metrics';
9
9
  import { InputType, OutputType, UnknownInputType, JsonObject } from './types';
@@ -69,7 +69,10 @@ export type CreateBaseWorkflowOpts = {
69
69
  * (optional) event config for the workflow.
70
70
  */
71
71
  onEvents?: string[];
72
- concurrency?: TaskConcurrency;
72
+ /**
73
+ * (optional) concurrency config for the workflow.
74
+ */
75
+ concurrency?: Concurrency | Concurrency[];
73
76
  /**
74
77
  * (optional) the priority for the workflow.
75
78
  * values: Priority.LOW, Priority.MEDIUM, Priority.HIGH (1, 2, or 3 )
@@ -134,7 +137,7 @@ export type TaskDefaults = {
134
137
  /**
135
138
  * (optional) the concurrency options for the task.
136
139
  */
137
- concurrency?: TaskConcurrency | TaskConcurrency[];
140
+ concurrency?: Concurrency | Concurrency[];
138
141
  };
139
142
  /**
140
143
  * Internal definition of a workflow and its tasks.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
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
+ const workflow_1 = require("./workflow");
13
+ function main() {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const res = yield workflow_1.multiConcurrency.run([
16
+ {
17
+ Message: 'Hello World',
18
+ GroupKey: 'A',
19
+ },
20
+ {
21
+ Message: 'Goodbye Moon',
22
+ GroupKey: 'A',
23
+ },
24
+ {
25
+ Message: 'Hello World B',
26
+ GroupKey: 'B',
27
+ },
28
+ ]);
29
+ // eslint-disable-next-line no-console
30
+ console.log(res[0]['to-lower'].TransformedMessage);
31
+ // eslint-disable-next-line no-console
32
+ console.log(res[1]['to-lower'].TransformedMessage);
33
+ // eslint-disable-next-line no-console
34
+ console.log(res[2]['to-lower'].TransformedMessage);
35
+ });
36
+ }
37
+ if (require.main === module) {
38
+ main().then(() => process.exit(0));
39
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
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
+ const hatchet_client_1 = require("../hatchet-client");
13
+ const workflow_1 = require("./workflow");
14
+ function main() {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const worker = yield hatchet_client_1.hatchet.worker('simple-concurrency-worker', {
17
+ workflows: [workflow_1.multiConcurrency],
18
+ });
19
+ yield worker.start();
20
+ });
21
+ }
22
+ if (require.main === module) {
23
+ main();
24
+ }
@@ -0,0 +1,11 @@
1
+ type SimpleInput = {
2
+ Message: string;
3
+ GroupKey: string;
4
+ };
5
+ type SimpleOutput = {
6
+ 'to-lower': {
7
+ TransformedMessage: string;
8
+ };
9
+ };
10
+ export declare const multiConcurrency: import("../..").WorkflowDeclaration<SimpleInput, SimpleOutput>;
11
+ export {};
@@ -0,0 +1,43 @@
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.multiConcurrency = void 0;
13
+ const workflow_1 = require("../../../workflow");
14
+ const hatchet_client_1 = require("../hatchet-client");
15
+ const sleep = (ms) => new Promise((resolve) => {
16
+ setTimeout(resolve, ms);
17
+ });
18
+ // ❓ Concurrency Strategy With Key
19
+ exports.multiConcurrency = hatchet_client_1.hatchet.workflow({
20
+ name: 'simple-concurrency',
21
+ concurrency: [
22
+ {
23
+ maxRuns: 1,
24
+ limitStrategy: workflow_1.ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN,
25
+ expression: 'input.GroupKey',
26
+ },
27
+ {
28
+ maxRuns: 1,
29
+ limitStrategy: workflow_1.ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN,
30
+ expression: 'input.UserId',
31
+ },
32
+ ],
33
+ });
34
+ // !!
35
+ exports.multiConcurrency.task({
36
+ name: 'to-lower',
37
+ fn: (input) => __awaiter(void 0, void 0, void 0, function* () {
38
+ yield sleep(Math.floor(Math.random() * (1000 - 200 + 1)) + 200);
39
+ return {
40
+ TransformedMessage: input.Message.toLowerCase(),
41
+ };
42
+ }),
43
+ });
package/v1/task.d.ts CHANGED
@@ -6,7 +6,7 @@ import { InputType, OutputType, UnknownInputType } from './types';
6
6
  /**
7
7
  * Options for configuring the concurrency for a task.
8
8
  */
9
- export type TaskConcurrency = {
9
+ export type Concurrency = {
10
10
  /**
11
11
  * required the CEL expression to use for concurrency
12
12
  *
@@ -29,6 +29,10 @@ export type TaskConcurrency = {
29
29
  */
30
30
  limitStrategy?: ConcurrencyLimitStrategy;
31
31
  };
32
+ /**
33
+ * @deprecated use Concurrency instead
34
+ */
35
+ export type TaskConcurrency = Concurrency;
32
36
  export declare class NonRetryableError extends Error {
33
37
  constructor(message?: string);
34
38
  }
@@ -97,7 +101,7 @@ export type CreateBaseTaskOpts<I extends InputType = UnknownInputType, O extends
97
101
  /**
98
102
  * (optional) the concurrency options for the task
99
103
  */
100
- concurrency?: TaskConcurrency | TaskConcurrency[];
104
+ concurrency?: Concurrency | Concurrency[];
101
105
  };
102
106
  export type CreateWorkflowTaskOpts<I extends InputType = UnknownInputType, O extends OutputType = void, C extends TaskFn<I, O> | DurableTaskFn<I, O> = TaskFn<I, O>> = CreateBaseTaskOpts<I, O, C> & {
103
107
  /**
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const HATCHET_VERSION = "1.2.0";
1
+ export declare const HATCHET_VERSION = "1.3.1";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HATCHET_VERSION = void 0;
4
- exports.HATCHET_VERSION = '1.2.0';
4
+ exports.HATCHET_VERSION = '1.3.1';