@hatchet-dev/typescript-sdk 1.13.1 → 1.14.0

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.
Files changed (245) hide show
  1. package/clients/dispatcher/dispatcher-client.d.ts +1 -1
  2. package/clients/dispatcher/heartbeat/heartbeat-controller.js +13 -1
  3. package/clients/dispatcher/heartbeat/heartbeat-worker.js +4 -3
  4. package/clients/event/event-client.d.ts +1 -2
  5. package/clients/event/event-client.js +2 -2
  6. package/clients/hatchet-client/client-config.d.ts +15 -5
  7. package/clients/hatchet-client/client-config.js +3 -0
  8. package/clients/hatchet-client/hatchet-logger.js +1 -0
  9. package/clients/hatchet-client/index.d.ts +1 -1
  10. package/clients/hatchet-client/index.js +1 -1
  11. package/clients/listeners/durable-listener/durable-listener-client.d.ts +6 -0
  12. package/clients/listeners/durable-listener/durable-listener-client.js +8 -0
  13. package/clients/listeners/durable-listener/pooled-durable-listener-client.d.ts +9 -2
  14. package/clients/listeners/durable-listener/pooled-durable-listener-client.js +67 -15
  15. package/clients/listeners/run-listener/child-listener-client.js +1 -0
  16. package/clients/listeners/run-listener/pooled-child-listener-client.d.ts +10 -2
  17. package/clients/listeners/run-listener/pooled-child-listener-client.js +63 -7
  18. package/clients/rest/api.js +10 -2
  19. package/clients/rest/generated/Api.d.ts +2 -2
  20. package/clients/rest/generated/data-contracts.d.ts +6 -0
  21. package/index.d.ts +2 -3
  22. package/index.js +2 -3
  23. package/{examples → legacy/examples}/affinity-workers.js +2 -2
  24. package/{examples → legacy/examples}/bulk-fanout-trigger.js +1 -1
  25. package/{examples → legacy/examples}/bulk-fanout-worker.js +1 -1
  26. package/{examples → legacy/examples}/bulk-trigger.js +1 -1
  27. package/{examples → legacy/examples}/byo-logger.js +1 -1
  28. package/{examples → legacy/examples}/concurrency/cancel-in-progress/concurrency-event.js +1 -1
  29. package/{examples → legacy/examples}/concurrency/cancel-in-progress/concurrency-worker.js +1 -1
  30. package/{examples → legacy/examples}/concurrency/group-round-robin/concurrency-event.js +1 -1
  31. package/{examples → legacy/examples}/concurrency/group-round-robin/concurrency-worker-expression.js +2 -2
  32. package/{examples → legacy/examples}/concurrency/group-round-robin/concurrency-worker-key-fn.js +2 -2
  33. package/{examples → legacy/examples}/crons/cron-worker.d.ts +1 -1
  34. package/{examples → legacy/examples}/crons/cron-worker.js +1 -1
  35. package/{examples → legacy/examples}/crons/programatic-crons.js +1 -1
  36. package/{examples → legacy/examples}/dag-worker.js +1 -1
  37. package/{examples → legacy/examples}/example-event-with-results.js +2 -2
  38. package/{examples → legacy/examples}/example-event.js +1 -1
  39. package/{examples → legacy/examples}/fanout-worker.js +1 -1
  40. package/{examples → legacy/examples}/logger.js +1 -1
  41. package/{examples → legacy/examples}/manual-trigger.js +1 -1
  42. package/{examples → legacy/examples}/multi-workflow.js +1 -1
  43. package/{examples → legacy/examples}/namespaced-worker.js +1 -1
  44. package/{examples → legacy/examples}/on-failure.js +1 -1
  45. package/{examples → legacy/examples}/rate-limit/events.js +1 -1
  46. package/{examples → legacy/examples}/rate-limit/worker.js +2 -2
  47. package/{examples → legacy/examples}/retries-with-backoff.js +1 -1
  48. package/{examples → legacy/examples}/retries-worker.js +1 -1
  49. package/{examples → legacy/examples}/scheduled-runs/programatic-schedules.js +1 -1
  50. package/{examples → legacy/examples}/simple-worker.d.ts +1 -1
  51. package/{examples → legacy/examples}/simple-worker.js +1 -1
  52. package/{examples → legacy/examples}/sticky-trigger.js +1 -1
  53. package/{examples → legacy/examples}/sticky-worker-with-check.js +2 -2
  54. package/{examples → legacy/examples}/sticky-worker.js +2 -2
  55. package/{examples → legacy/examples}/stream-by-additional-meta.js +2 -2
  56. package/legacy/legacy-client.d.ts +30 -0
  57. package/legacy/legacy-client.js +67 -0
  58. package/legacy/legacy-transformer.d.ts +38 -0
  59. package/legacy/legacy-transformer.js +181 -0
  60. package/legacy/step.d.ts +429 -0
  61. package/legacy/step.js +662 -0
  62. package/legacy/workflow.d.ts +488 -0
  63. package/legacy/workflow.js +72 -0
  64. package/package.json +2 -2
  65. package/step.d.ts +1 -430
  66. package/step.js +6 -647
  67. package/util/abort-error.d.ts +38 -0
  68. package/util/abort-error.js +58 -0
  69. package/util/hatchet-promise/hatchet-promise.d.ts +8 -1
  70. package/util/hatchet-promise/hatchet-promise.js +3 -2
  71. package/util/logger/index.d.ts +1 -0
  72. package/util/logger/index.js +1 -0
  73. package/util/logger/task-run-log.d.ts +3 -0
  74. package/util/logger/task-run-log.js +20 -0
  75. package/util/sleep.d.ts +5 -2
  76. package/util/sleep.js +27 -4
  77. package/util/workflow-run-ref.d.ts +7 -1
  78. package/util/workflow-run-ref.js +5 -3
  79. package/v1/client/admin.d.ts +8 -1
  80. package/v1/client/admin.js +22 -6
  81. package/v1/client/client.d.ts +36 -18
  82. package/v1/client/client.interface.d.ts +9 -2
  83. package/v1/client/client.js +47 -27
  84. package/v1/client/features/crons.d.ts +3 -3
  85. package/v1/client/features/crons.js +2 -2
  86. package/v1/client/features/schedules.js +2 -2
  87. package/v1/client/features/workflows.d.ts +5 -5
  88. package/v1/client/features/workflows.js +7 -8
  89. package/v1/client/worker/context.d.ts +49 -10
  90. package/v1/client/worker/context.js +92 -20
  91. package/v1/client/worker/deprecated/legacy-v1-worker.d.ts +3 -3
  92. package/v1/client/worker/deprecated/legacy-v1-worker.js +2 -2
  93. package/v1/client/worker/deprecated/legacy-worker.js +9 -7
  94. package/v1/client/worker/slot-utils.d.ts +3 -3
  95. package/v1/client/worker/worker-internal.d.ts +7 -16
  96. package/v1/client/worker/worker-internal.js +225 -209
  97. package/v1/client/worker/worker.d.ts +18 -18
  98. package/v1/client/worker/worker.js +45 -30
  99. package/v1/declaration.d.ts +28 -7
  100. package/v1/declaration.js +56 -6
  101. package/v1/examples/__e2e__/harness.d.ts +19 -0
  102. package/v1/examples/__e2e__/harness.js +70 -0
  103. package/v1/examples/affinity/affinity-workers.js +4 -4
  104. package/v1/examples/bulk_fanout/workflow.d.ts +9 -0
  105. package/v1/examples/bulk_fanout/workflow.js +34 -0
  106. package/v1/examples/bulk_operations/workflow.d.ts +3 -0
  107. package/v1/examples/bulk_operations/workflow.js +44 -0
  108. package/v1/examples/cancellation/cancellation-workflow.d.ts +2 -0
  109. package/v1/examples/cancellation/cancellation-workflow.js +69 -0
  110. package/v1/examples/cancellation/run.js +53 -0
  111. package/v1/examples/cancellation/worker.d.ts +1 -0
  112. package/v1/examples/cancellation/worker.js +29 -0
  113. package/v1/examples/concurrency-types.d.ts +5 -0
  114. package/v1/examples/concurrency-types.js +2 -0
  115. package/v1/examples/concurrency_cancel_in_progress/workflow.d.ts +9 -0
  116. package/v1/examples/concurrency_cancel_in_progress/workflow.js +45 -0
  117. package/v1/examples/concurrency_cancel_newest/workflow.d.ts +9 -0
  118. package/v1/examples/concurrency_cancel_newest/workflow.js +45 -0
  119. package/v1/examples/concurrency_limit_rr/load.d.ts +1 -0
  120. package/v1/examples/concurrency_limit_rr/load.js +54 -0
  121. package/v1/examples/concurrency_limit_rr/run.d.ts +1 -0
  122. package/v1/examples/concurrency_limit_rr/run.js +39 -0
  123. package/v1/examples/concurrency_limit_rr/worker.d.ts +1 -0
  124. package/v1/examples/concurrency_limit_rr/worker.js +24 -0
  125. package/v1/examples/concurrency_limit_rr/workflow.d.ts +12 -0
  126. package/v1/examples/concurrency_limit_rr/workflow.js +62 -0
  127. package/v1/examples/concurrency_multiple_keys/workflow.d.ts +12 -0
  128. package/v1/examples/concurrency_multiple_keys/workflow.js +42 -0
  129. package/v1/examples/concurrency_workflow_level/workflow.d.ts +13 -0
  130. package/v1/examples/concurrency_workflow_level/workflow.js +49 -0
  131. package/v1/examples/conditions/complex-workflow.d.ts +1 -0
  132. package/v1/examples/conditions/complex-workflow.js +107 -0
  133. package/v1/examples/conditions/event.d.ts +1 -0
  134. package/v1/examples/conditions/event.js +28 -0
  135. package/v1/examples/conditions/run.d.ts +1 -0
  136. package/v1/examples/conditions/run.js +25 -0
  137. package/v1/examples/conditions/worker.d.ts +1 -0
  138. package/v1/examples/conditions/worker.js +24 -0
  139. package/v1/examples/conditions/workflow.d.ts +11 -0
  140. package/v1/examples/conditions/workflow.js +41 -0
  141. package/v1/examples/durable/workflow.d.ts +7 -0
  142. package/v1/examples/durable/workflow.js +116 -0
  143. package/v1/examples/durable_event/event.d.ts +1 -0
  144. package/v1/examples/durable_event/event.js +28 -0
  145. package/v1/examples/durable_event/run.d.ts +1 -0
  146. package/v1/examples/durable_event/run.js +30 -0
  147. package/v1/examples/durable_event/worker.d.ts +1 -0
  148. package/v1/examples/durable_event/worker.js +24 -0
  149. package/v1/examples/durable_event/workflow.d.ts +6 -0
  150. package/v1/examples/durable_event/workflow.js +46 -0
  151. package/v1/examples/durable_sleep/event.d.ts +1 -0
  152. package/v1/examples/durable_sleep/event.js +28 -0
  153. package/v1/examples/durable_sleep/run.d.ts +1 -0
  154. package/v1/examples/durable_sleep/run.js +30 -0
  155. package/v1/examples/durable_sleep/worker.d.ts +1 -0
  156. package/v1/examples/durable_sleep/worker.js +24 -0
  157. package/v1/examples/durable_sleep/workflow.d.ts +1 -0
  158. package/v1/examples/durable_sleep/workflow.js +31 -0
  159. package/v1/examples/e2e-worker.d.ts +1 -0
  160. package/v1/examples/e2e-worker.js +82 -0
  161. package/v1/examples/events/event.d.ts +1 -0
  162. package/v1/examples/events/event.js +53 -0
  163. package/v1/examples/events/filter.d.ts +1 -0
  164. package/v1/examples/events/filter.js +32 -0
  165. package/v1/examples/events/worker.d.ts +1 -0
  166. package/v1/examples/events/worker.js +24 -0
  167. package/v1/examples/events/workflow.d.ts +19 -0
  168. package/v1/examples/events/workflow.js +60 -0
  169. package/v1/examples/high-memory/workflow-with-child.js +1 -1
  170. package/v1/examples/logger/byo-logger.d.ts +1 -0
  171. package/v1/examples/logger/byo-logger.js +73 -0
  172. package/v1/examples/logger/logger.d.ts +1 -0
  173. package/v1/examples/logger/logger.js +46 -0
  174. package/v1/examples/logger/workflow.d.ts +2 -0
  175. package/v1/examples/logger/workflow.js +38 -0
  176. package/v1/examples/multiple_wf_concurrency/workflow.js +3 -3
  177. package/v1/examples/on_failure/workflow.d.ts +1 -0
  178. package/v1/examples/on_failure/workflow.js +12 -7
  179. package/v1/examples/priority/workflow.js +1 -1
  180. package/v1/examples/retries/workflow.js +2 -2
  181. package/v1/examples/return_exceptions/workflow.d.ts +6 -0
  182. package/v1/examples/return_exceptions/workflow.js +22 -0
  183. package/v1/examples/run_details/workflow.d.ts +4 -0
  184. package/v1/examples/run_details/workflow.js +65 -0
  185. package/v1/examples/simple/e2e-workflows.d.ts +14 -0
  186. package/v1/examples/simple/e2e-workflows.js +27 -0
  187. package/v1/examples/simple/enqueue.js +2 -2
  188. package/v1/examples/sticky/workflow.js +2 -2
  189. package/v1/examples/timeout/run.d.ts +1 -0
  190. package/v1/examples/timeout/run.js +30 -0
  191. package/v1/examples/timeout/worker.d.ts +1 -0
  192. package/v1/examples/timeout/worker.js +25 -0
  193. package/v1/examples/timeout/workflow.d.ts +10 -0
  194. package/v1/examples/timeout/workflow.js +56 -0
  195. package/v1/examples/webhooks/workflow.d.ts +5 -0
  196. package/v1/examples/webhooks/workflow.js +23 -0
  197. package/v1/index.d.ts +1 -0
  198. package/v1/index.js +1 -0
  199. package/v1/parent-run-context-vars.d.ts +6 -0
  200. package/v1/parent-run-context-vars.js +3 -0
  201. package/v1/task.d.ts +22 -7
  202. package/v1/task.js +4 -1
  203. package/version.d.ts +1 -1
  204. package/version.js +1 -1
  205. package/workflow.d.ts +3 -491
  206. package/workflow.js +12 -62
  207. package/clients/hatchet-client/hatchet-client.d.ts +0 -35
  208. package/clients/hatchet-client/hatchet-client.js +0 -108
  209. package/clients/worker/handler.d.ts +0 -50
  210. package/clients/worker/handler.js +0 -214
  211. package/clients/worker/index.d.ts +0 -1
  212. package/clients/worker/index.js +0 -17
  213. package/clients/worker/worker.d.ts +0 -59
  214. package/clients/worker/worker.js +0 -568
  215. package/examples/webhooks.js +0 -45
  216. /package/{examples → legacy/examples}/affinity-workers.d.ts +0 -0
  217. /package/{examples → legacy/examples}/bulk-fanout-trigger.d.ts +0 -0
  218. /package/{examples → legacy/examples}/bulk-fanout-worker.d.ts +0 -0
  219. /package/{examples → legacy/examples}/bulk-trigger.d.ts +0 -0
  220. /package/{examples → legacy/examples}/byo-logger.d.ts +0 -0
  221. /package/{examples → legacy/examples}/concurrency/cancel-in-progress/concurrency-event.d.ts +0 -0
  222. /package/{examples → legacy/examples}/concurrency/cancel-in-progress/concurrency-worker.d.ts +0 -0
  223. /package/{examples → legacy/examples}/concurrency/group-round-robin/concurrency-event.d.ts +0 -0
  224. /package/{examples → legacy/examples}/concurrency/group-round-robin/concurrency-worker-expression.d.ts +0 -0
  225. /package/{examples → legacy/examples}/concurrency/group-round-robin/concurrency-worker-key-fn.d.ts +0 -0
  226. /package/{examples → legacy/examples}/crons/programatic-crons.d.ts +0 -0
  227. /package/{examples → legacy/examples}/dag-worker.d.ts +0 -0
  228. /package/{examples → legacy/examples}/example-event-with-results.d.ts +0 -0
  229. /package/{examples → legacy/examples}/example-event.d.ts +0 -0
  230. /package/{examples → legacy/examples}/fanout-worker.d.ts +0 -0
  231. /package/{examples → legacy/examples}/logger.d.ts +0 -0
  232. /package/{examples → legacy/examples}/manual-trigger.d.ts +0 -0
  233. /package/{examples → legacy/examples}/multi-workflow.d.ts +0 -0
  234. /package/{examples → legacy/examples}/namespaced-worker.d.ts +0 -0
  235. /package/{examples → legacy/examples}/on-failure.d.ts +0 -0
  236. /package/{examples → legacy/examples}/rate-limit/events.d.ts +0 -0
  237. /package/{examples → legacy/examples}/rate-limit/worker.d.ts +0 -0
  238. /package/{examples → legacy/examples}/retries-with-backoff.d.ts +0 -0
  239. /package/{examples → legacy/examples}/retries-worker.d.ts +0 -0
  240. /package/{examples → legacy/examples}/scheduled-runs/programatic-schedules.d.ts +0 -0
  241. /package/{examples → legacy/examples}/sticky-trigger.d.ts +0 -0
  242. /package/{examples → legacy/examples}/sticky-worker-with-check.d.ts +0 -0
  243. /package/{examples → legacy/examples}/sticky-worker.d.ts +0 -0
  244. /package/{examples → legacy/examples}/stream-by-additional-meta.d.ts +0 -0
  245. /package/{examples/webhooks.d.ts → v1/examples/cancellation/run.d.ts} +0 -0
package/workflow.d.ts CHANGED
@@ -1,491 +1,3 @@
1
- import * as z from 'zod';
2
- import { CreateStep } from './step';
3
- import { ConcurrencyLimitStrategy as PbConcurrencyLimitStrategy, StickyStrategy as PbStickyStrategy } from './protoc/workflows';
4
- declare const StepsSchema: z.ZodArray<z.ZodObject<{
5
- name: z.ZodString;
6
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
- timeout: z.ZodOptional<z.ZodString>;
8
- retries: z.ZodOptional<z.ZodNumber>;
9
- rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
10
- key: z.ZodOptional<z.ZodString>;
11
- staticKey: z.ZodOptional<z.ZodString>;
12
- dynamicKey: z.ZodOptional<z.ZodString>;
13
- units: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
14
- limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
15
- duration: z.ZodOptional<z.ZodNativeEnum<typeof import("./protoc/workflows").RateLimitDuration>>;
16
- }, "strip", z.ZodTypeAny, {
17
- units: string | number;
18
- key?: string | undefined;
19
- staticKey?: string | undefined;
20
- dynamicKey?: string | undefined;
21
- limit?: string | number | undefined;
22
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
23
- }, {
24
- units: string | number;
25
- key?: string | undefined;
26
- staticKey?: string | undefined;
27
- dynamicKey?: string | undefined;
28
- limit?: string | number | undefined;
29
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
30
- }>, "many">>;
31
- worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
32
- value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
33
- required: z.ZodOptional<z.ZodBoolean>;
34
- weight: z.ZodOptional<z.ZodNumber>;
35
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("./protoc/workflows").WorkerLabelComparator>>;
36
- }, "strip", z.ZodTypeAny, {
37
- value: string | number;
38
- required?: boolean | undefined;
39
- weight?: number | undefined;
40
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
41
- }, {
42
- value: string | number;
43
- required?: boolean | undefined;
44
- weight?: number | undefined;
45
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
46
- }>]>>>>>;
47
- backoff: z.ZodOptional<z.ZodObject<{
48
- factor: z.ZodOptional<z.ZodNumber>;
49
- maxSeconds: z.ZodOptional<z.ZodNumber>;
50
- }, "strip", z.ZodTypeAny, {
51
- factor?: number | undefined;
52
- maxSeconds?: number | undefined;
53
- }, {
54
- factor?: number | undefined;
55
- maxSeconds?: number | undefined;
56
- }>>;
57
- }, "strip", z.ZodTypeAny, {
58
- name: string;
59
- timeout?: string | undefined;
60
- parents?: string[] | undefined;
61
- retries?: number | undefined;
62
- rate_limits?: {
63
- units: string | number;
64
- key?: string | undefined;
65
- staticKey?: string | undefined;
66
- dynamicKey?: string | undefined;
67
- limit?: string | number | undefined;
68
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
69
- }[] | undefined;
70
- worker_labels?: Record<string, string | number | {
71
- value: string | number;
72
- required?: boolean | undefined;
73
- weight?: number | undefined;
74
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
75
- } | undefined> | undefined;
76
- backoff?: {
77
- factor?: number | undefined;
78
- maxSeconds?: number | undefined;
79
- } | undefined;
80
- }, {
81
- name: string;
82
- timeout?: string | undefined;
83
- parents?: string[] | undefined;
84
- retries?: number | undefined;
85
- rate_limits?: {
86
- units: string | number;
87
- key?: string | undefined;
88
- staticKey?: string | undefined;
89
- dynamicKey?: string | undefined;
90
- limit?: string | number | undefined;
91
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
92
- }[] | undefined;
93
- worker_labels?: Record<string, string | number | {
94
- value: string | number;
95
- required?: boolean | undefined;
96
- weight?: number | undefined;
97
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
98
- } | undefined> | undefined;
99
- backoff?: {
100
- factor?: number | undefined;
101
- maxSeconds?: number | undefined;
102
- } | undefined;
103
- }>, "many">;
104
- export type Steps = z.infer<typeof StepsSchema>;
105
- export declare const ConcurrencyLimitStrategy: typeof PbConcurrencyLimitStrategy;
106
- export declare const WorkflowConcurrency: z.ZodObject<{
107
- name: z.ZodString;
108
- maxRuns: z.ZodOptional<z.ZodNumber>;
109
- limitStrategy: z.ZodOptional<z.ZodNativeEnum<typeof PbConcurrencyLimitStrategy>>;
110
- expression: z.ZodOptional<z.ZodString>;
111
- }, "strip", z.ZodTypeAny, {
112
- name: string;
113
- maxRuns?: number | undefined;
114
- limitStrategy?: PbConcurrencyLimitStrategy | undefined;
115
- expression?: string | undefined;
116
- }, {
117
- name: string;
118
- maxRuns?: number | undefined;
119
- limitStrategy?: PbConcurrencyLimitStrategy | undefined;
120
- expression?: string | undefined;
121
- }>;
122
- export declare const HatchetTimeoutSchema: z.ZodString;
123
- export declare const StickyStrategy: typeof PbStickyStrategy;
124
- export declare const CreateWorkflowSchema: z.ZodObject<{
125
- id: z.ZodString;
126
- description: z.ZodString;
127
- version: z.ZodOptional<z.ZodString>;
128
- /**
129
- * sticky will attempt to run all steps for workflow on the same worker
130
- */
131
- sticky: z.ZodOptional<z.ZodNativeEnum<typeof PbStickyStrategy>>;
132
- scheduleTimeout: z.ZodOptional<z.ZodString>;
133
- /**
134
- * @deprecated Workflow timeout is deprecated. Use step timeouts instead.
135
- */
136
- timeout: z.ZodOptional<z.ZodString>;
137
- on: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
138
- cron: z.ZodString;
139
- event: z.ZodUndefined;
140
- }, "strip", z.ZodTypeAny, {
141
- cron: string;
142
- event?: undefined;
143
- }, {
144
- cron: string;
145
- event?: undefined;
146
- }>, z.ZodObject<{
147
- cron: z.ZodUndefined;
148
- event: z.ZodString;
149
- }, "strip", z.ZodTypeAny, {
150
- event: string;
151
- cron?: undefined;
152
- }, {
153
- event: string;
154
- cron?: undefined;
155
- }>]>>;
156
- steps: z.ZodArray<z.ZodObject<{
157
- name: z.ZodString;
158
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
159
- timeout: z.ZodOptional<z.ZodString>;
160
- retries: z.ZodOptional<z.ZodNumber>;
161
- rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
- key: z.ZodOptional<z.ZodString>;
163
- staticKey: z.ZodOptional<z.ZodString>;
164
- dynamicKey: z.ZodOptional<z.ZodString>;
165
- units: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
166
- limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
167
- duration: z.ZodOptional<z.ZodNativeEnum<typeof import("./protoc/workflows").RateLimitDuration>>;
168
- }, "strip", z.ZodTypeAny, {
169
- units: string | number;
170
- key?: string | undefined;
171
- staticKey?: string | undefined;
172
- dynamicKey?: string | undefined;
173
- limit?: string | number | undefined;
174
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
175
- }, {
176
- units: string | number;
177
- key?: string | undefined;
178
- staticKey?: string | undefined;
179
- dynamicKey?: string | undefined;
180
- limit?: string | number | undefined;
181
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
182
- }>, "many">>;
183
- worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
184
- value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
185
- required: z.ZodOptional<z.ZodBoolean>;
186
- weight: z.ZodOptional<z.ZodNumber>;
187
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("./protoc/workflows").WorkerLabelComparator>>;
188
- }, "strip", z.ZodTypeAny, {
189
- value: string | number;
190
- required?: boolean | undefined;
191
- weight?: number | undefined;
192
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
193
- }, {
194
- value: string | number;
195
- required?: boolean | undefined;
196
- weight?: number | undefined;
197
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
198
- }>]>>>>>;
199
- backoff: z.ZodOptional<z.ZodObject<{
200
- factor: z.ZodOptional<z.ZodNumber>;
201
- maxSeconds: z.ZodOptional<z.ZodNumber>;
202
- }, "strip", z.ZodTypeAny, {
203
- factor?: number | undefined;
204
- maxSeconds?: number | undefined;
205
- }, {
206
- factor?: number | undefined;
207
- maxSeconds?: number | undefined;
208
- }>>;
209
- }, "strip", z.ZodTypeAny, {
210
- name: string;
211
- timeout?: string | undefined;
212
- parents?: string[] | undefined;
213
- retries?: number | undefined;
214
- rate_limits?: {
215
- units: string | number;
216
- key?: string | undefined;
217
- staticKey?: string | undefined;
218
- dynamicKey?: string | undefined;
219
- limit?: string | number | undefined;
220
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
221
- }[] | undefined;
222
- worker_labels?: Record<string, string | number | {
223
- value: string | number;
224
- required?: boolean | undefined;
225
- weight?: number | undefined;
226
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
227
- } | undefined> | undefined;
228
- backoff?: {
229
- factor?: number | undefined;
230
- maxSeconds?: number | undefined;
231
- } | undefined;
232
- }, {
233
- name: string;
234
- timeout?: string | undefined;
235
- parents?: string[] | undefined;
236
- retries?: number | undefined;
237
- rate_limits?: {
238
- units: string | number;
239
- key?: string | undefined;
240
- staticKey?: string | undefined;
241
- dynamicKey?: string | undefined;
242
- limit?: string | number | undefined;
243
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
244
- }[] | undefined;
245
- worker_labels?: Record<string, string | number | {
246
- value: string | number;
247
- required?: boolean | undefined;
248
- weight?: number | undefined;
249
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
250
- } | undefined> | undefined;
251
- backoff?: {
252
- factor?: number | undefined;
253
- maxSeconds?: number | undefined;
254
- } | undefined;
255
- }>, "many">;
256
- onFailure: z.ZodOptional<z.ZodObject<{
257
- name: z.ZodString;
258
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
259
- timeout: z.ZodOptional<z.ZodString>;
260
- retries: z.ZodOptional<z.ZodNumber>;
261
- rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
262
- key: z.ZodOptional<z.ZodString>;
263
- staticKey: z.ZodOptional<z.ZodString>;
264
- dynamicKey: z.ZodOptional<z.ZodString>;
265
- units: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
266
- limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
267
- duration: z.ZodOptional<z.ZodNativeEnum<typeof import("./protoc/workflows").RateLimitDuration>>;
268
- }, "strip", z.ZodTypeAny, {
269
- units: string | number;
270
- key?: string | undefined;
271
- staticKey?: string | undefined;
272
- dynamicKey?: string | undefined;
273
- limit?: string | number | undefined;
274
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
275
- }, {
276
- units: string | number;
277
- key?: string | undefined;
278
- staticKey?: string | undefined;
279
- dynamicKey?: string | undefined;
280
- limit?: string | number | undefined;
281
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
282
- }>, "many">>;
283
- worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
284
- value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
285
- required: z.ZodOptional<z.ZodBoolean>;
286
- weight: z.ZodOptional<z.ZodNumber>;
287
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("./protoc/workflows").WorkerLabelComparator>>;
288
- }, "strip", z.ZodTypeAny, {
289
- value: string | number;
290
- required?: boolean | undefined;
291
- weight?: number | undefined;
292
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
293
- }, {
294
- value: string | number;
295
- required?: boolean | undefined;
296
- weight?: number | undefined;
297
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
298
- }>]>>>>>;
299
- backoff: z.ZodOptional<z.ZodObject<{
300
- factor: z.ZodOptional<z.ZodNumber>;
301
- maxSeconds: z.ZodOptional<z.ZodNumber>;
302
- }, "strip", z.ZodTypeAny, {
303
- factor?: number | undefined;
304
- maxSeconds?: number | undefined;
305
- }, {
306
- factor?: number | undefined;
307
- maxSeconds?: number | undefined;
308
- }>>;
309
- }, "strip", z.ZodTypeAny, {
310
- name: string;
311
- timeout?: string | undefined;
312
- parents?: string[] | undefined;
313
- retries?: number | undefined;
314
- rate_limits?: {
315
- units: string | number;
316
- key?: string | undefined;
317
- staticKey?: string | undefined;
318
- dynamicKey?: string | undefined;
319
- limit?: string | number | undefined;
320
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
321
- }[] | undefined;
322
- worker_labels?: Record<string, string | number | {
323
- value: string | number;
324
- required?: boolean | undefined;
325
- weight?: number | undefined;
326
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
327
- } | undefined> | undefined;
328
- backoff?: {
329
- factor?: number | undefined;
330
- maxSeconds?: number | undefined;
331
- } | undefined;
332
- }, {
333
- name: string;
334
- timeout?: string | undefined;
335
- parents?: string[] | undefined;
336
- retries?: number | undefined;
337
- rate_limits?: {
338
- units: string | number;
339
- key?: string | undefined;
340
- staticKey?: string | undefined;
341
- dynamicKey?: string | undefined;
342
- limit?: string | number | undefined;
343
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
344
- }[] | undefined;
345
- worker_labels?: Record<string, string | number | {
346
- value: string | number;
347
- required?: boolean | undefined;
348
- weight?: number | undefined;
349
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
350
- } | undefined> | undefined;
351
- backoff?: {
352
- factor?: number | undefined;
353
- maxSeconds?: number | undefined;
354
- } | undefined;
355
- }>>;
356
- }, "strip", z.ZodTypeAny, {
357
- id: string;
358
- description: string;
359
- steps: {
360
- name: string;
361
- timeout?: string | undefined;
362
- parents?: string[] | undefined;
363
- retries?: number | undefined;
364
- rate_limits?: {
365
- units: string | number;
366
- key?: string | undefined;
367
- staticKey?: string | undefined;
368
- dynamicKey?: string | undefined;
369
- limit?: string | number | undefined;
370
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
371
- }[] | undefined;
372
- worker_labels?: Record<string, string | number | {
373
- value: string | number;
374
- required?: boolean | undefined;
375
- weight?: number | undefined;
376
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
377
- } | undefined> | undefined;
378
- backoff?: {
379
- factor?: number | undefined;
380
- maxSeconds?: number | undefined;
381
- } | undefined;
382
- }[];
383
- version?: string | undefined;
384
- timeout?: string | undefined;
385
- sticky?: PbStickyStrategy | undefined;
386
- scheduleTimeout?: string | undefined;
387
- on?: {
388
- cron: string;
389
- event?: undefined;
390
- } | {
391
- event: string;
392
- cron?: undefined;
393
- } | undefined;
394
- onFailure?: {
395
- name: string;
396
- timeout?: string | undefined;
397
- parents?: string[] | undefined;
398
- retries?: number | undefined;
399
- rate_limits?: {
400
- units: string | number;
401
- key?: string | undefined;
402
- staticKey?: string | undefined;
403
- dynamicKey?: string | undefined;
404
- limit?: string | number | undefined;
405
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
406
- }[] | undefined;
407
- worker_labels?: Record<string, string | number | {
408
- value: string | number;
409
- required?: boolean | undefined;
410
- weight?: number | undefined;
411
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
412
- } | undefined> | undefined;
413
- backoff?: {
414
- factor?: number | undefined;
415
- maxSeconds?: number | undefined;
416
- } | undefined;
417
- } | undefined;
418
- }, {
419
- id: string;
420
- description: string;
421
- steps: {
422
- name: string;
423
- timeout?: string | undefined;
424
- parents?: string[] | undefined;
425
- retries?: number | undefined;
426
- rate_limits?: {
427
- units: string | number;
428
- key?: string | undefined;
429
- staticKey?: string | undefined;
430
- dynamicKey?: string | undefined;
431
- limit?: string | number | undefined;
432
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
433
- }[] | undefined;
434
- worker_labels?: Record<string, string | number | {
435
- value: string | number;
436
- required?: boolean | undefined;
437
- weight?: number | undefined;
438
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
439
- } | undefined> | undefined;
440
- backoff?: {
441
- factor?: number | undefined;
442
- maxSeconds?: number | undefined;
443
- } | undefined;
444
- }[];
445
- version?: string | undefined;
446
- timeout?: string | undefined;
447
- sticky?: PbStickyStrategy | undefined;
448
- scheduleTimeout?: string | undefined;
449
- on?: {
450
- cron: string;
451
- event?: undefined;
452
- } | {
453
- event: string;
454
- cron?: undefined;
455
- } | undefined;
456
- onFailure?: {
457
- name: string;
458
- timeout?: string | undefined;
459
- parents?: string[] | undefined;
460
- retries?: number | undefined;
461
- rate_limits?: {
462
- units: string | number;
463
- key?: string | undefined;
464
- staticKey?: string | undefined;
465
- dynamicKey?: string | undefined;
466
- limit?: string | number | undefined;
467
- duration?: import("./protoc/workflows").RateLimitDuration | undefined;
468
- }[] | undefined;
469
- worker_labels?: Record<string, string | number | {
470
- value: string | number;
471
- required?: boolean | undefined;
472
- weight?: number | undefined;
473
- comparator?: import("./protoc/workflows").WorkerLabelComparator | undefined;
474
- } | undefined> | undefined;
475
- backoff?: {
476
- factor?: number | undefined;
477
- maxSeconds?: number | undefined;
478
- } | undefined;
479
- } | undefined;
480
- }>;
481
- /**
482
- * @deprecated Use client.workflow instead (TODO link to migration doc)
483
- */
484
- export interface Workflow extends z.infer<typeof CreateWorkflowSchema> {
485
- concurrency?: z.infer<typeof WorkflowConcurrency> & {
486
- key?: (ctx: any) => string;
487
- };
488
- steps: CreateStep<any, any>[];
489
- onFailure?: CreateStep<any, any>;
490
- }
491
- export {};
1
+ import { ConcurrencyLimitStrategy, StickyStrategy } from './v1';
2
+ export * from './legacy/workflow';
3
+ export { ConcurrencyLimitStrategy, StickyStrategy };
package/workflow.js CHANGED
@@ -10,66 +10,16 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
35
16
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.CreateWorkflowSchema = exports.StickyStrategy = exports.HatchetTimeoutSchema = exports.WorkflowConcurrency = exports.ConcurrencyLimitStrategy = void 0;
37
- const z = __importStar(require("zod"));
38
- const step_1 = require("./step");
39
- const workflows_1 = require("./protoc/workflows");
40
- const CronConfigSchema = z.object({
41
- cron: z.string(),
42
- event: z.undefined(),
43
- });
44
- const EventConfigSchema = z.object({
45
- cron: z.undefined(),
46
- event: z.string(),
47
- });
48
- const OnConfigSchema = z.union([CronConfigSchema, EventConfigSchema]).optional();
49
- const StepsSchema = z.array(step_1.CreateStepSchema);
50
- exports.ConcurrencyLimitStrategy = workflows_1.ConcurrencyLimitStrategy;
51
- exports.WorkflowConcurrency = z.object({
52
- name: z.string(),
53
- maxRuns: z.number().optional(),
54
- limitStrategy: z.nativeEnum(exports.ConcurrencyLimitStrategy).optional(),
55
- expression: z.string().optional(),
56
- });
57
- exports.HatchetTimeoutSchema = z.string();
58
- exports.StickyStrategy = workflows_1.StickyStrategy;
59
- exports.CreateWorkflowSchema = z.object({
60
- id: z.string(),
61
- description: z.string(),
62
- version: z.string().optional(),
63
- /**
64
- * sticky will attempt to run all steps for workflow on the same worker
65
- */
66
- sticky: z.nativeEnum(exports.StickyStrategy).optional(),
67
- scheduleTimeout: z.string().optional(),
68
- /**
69
- * @deprecated Workflow timeout is deprecated. Use step timeouts instead.
70
- */
71
- timeout: exports.HatchetTimeoutSchema.optional(),
72
- on: OnConfigSchema,
73
- steps: StepsSchema,
74
- onFailure: step_1.CreateStepSchema === null || step_1.CreateStepSchema === void 0 ? void 0 : step_1.CreateStepSchema.optional(),
75
- });
17
+ exports.StickyStrategy = exports.ConcurrencyLimitStrategy = void 0;
18
+ const v1_1 = require("./v1");
19
+ Object.defineProperty(exports, "ConcurrencyLimitStrategy", { enumerable: true, get: function () { return v1_1.ConcurrencyLimitStrategy; } });
20
+ Object.defineProperty(exports, "StickyStrategy", { enumerable: true, get: function () { return v1_1.StickyStrategy; } });
21
+ __exportStar(require("./legacy/workflow"), exports);
22
+ console.warn('\x1b[31mDeprecation warning: The v0 sdk, including the workflow module has been deprecated and has been removed in release v1.14.0.\x1b[0m');
23
+ console.warn('\x1b[31mPlease migrate to v1 SDK instead: https://docs.hatchet.run/home/v1-sdk-improvements\x1b[0m');
24
+ console.warn('ConcurrencyLimitStrategy, StickyStrategy have been moved to @hatchet-dev/typescript-sdk/v1');
25
+ console.warn('--------------------------------');
@@ -1,35 +0,0 @@
1
- import { EventClient } from '../event/event-client';
2
- import { DispatcherClient } from '../dispatcher/dispatcher-client';
3
- import { AdminClient } from '../admin/admin-client';
4
- import { ChannelCredentials } from 'nice-grpc';
5
- import { Workflow as V0Workflow } from '../../workflow';
6
- import { V0Worker, WorkerOpts } from '../worker';
7
- import { AxiosRequestConfig } from 'axios';
8
- import { Logger } from '../../util/logger';
9
- import { RunsClient } from '../../v1';
10
- import { ClientConfig } from './client-config';
11
- import { RunListenerClient } from '../listeners/run-listener/child-listener-client';
12
- import { Api } from '../rest/generated/Api';
13
- import { DurableListenerClient } from '../listeners/durable-listener/durable-listener-client';
14
- export interface HatchetClientOptions {
15
- config_path?: string;
16
- credentials?: ChannelCredentials;
17
- }
18
- export declare class LegacyHatchetClient {
19
- config: ClientConfig;
20
- credentials: ChannelCredentials;
21
- event: EventClient;
22
- dispatcher: DispatcherClient;
23
- admin: AdminClient;
24
- api: Api;
25
- runs: RunsClient | undefined;
26
- listener: RunListenerClient;
27
- tenantId: string;
28
- durableListener: DurableListenerClient;
29
- logger: Logger;
30
- constructor(config?: Partial<ClientConfig>, options?: HatchetClientOptions, axiosOpts?: AxiosRequestConfig, runs?: RunsClient, listener?: RunListenerClient);
31
- static init(config?: Partial<ClientConfig>, options?: HatchetClientOptions, axiosConfig?: AxiosRequestConfig): LegacyHatchetClient;
32
- run(workflow: string | V0Workflow): Promise<V0Worker>;
33
- worker(workflow: string | V0Workflow, opts?: Omit<WorkerOpts, 'name'> | number): Promise<V0Worker>;
34
- webhooks(workflows: Array<V0Workflow>): import("../worker/handler").WebhookHandler;
35
- }