@hatchet-dev/typescript-sdk 1.0.0-alpha0 → 1.0.0-alpha2
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/admin/admin-client.d.ts +15 -20
- package/clients/admin/admin-client.js +21 -17
- package/clients/hatchet-client/hatchet-client.d.ts +5 -4
- package/clients/hatchet-client/hatchet-client.js +6 -4
- package/clients/hatchet-client/hatchet-logger.js +16 -1
- package/clients/listeners/durable-listener/durable-listener-client.d.ts +25 -0
- package/clients/listeners/durable-listener/durable-listener-client.js +30 -0
- package/clients/listeners/durable-listener/pooled-durable-listener-client.d.ts +43 -0
- package/clients/listeners/durable-listener/pooled-durable-listener-client.js +241 -0
- package/clients/{listener/listener-client.d.ts → listeners/run-listener/child-listener-client.d.ts} +8 -8
- package/clients/{listener/listener-client.js → listeners/run-listener/child-listener-client.js} +8 -19
- package/clients/{listener/child-listener-client.d.ts → listeners/run-listener/pooled-child-listener-client.d.ts} +5 -5
- package/clients/{listener/child-listener-client.js → listeners/run-listener/pooled-child-listener-client.js} +5 -5
- package/clients/rest/generated/Api.d.ts +49 -2
- package/clients/rest/generated/Api.js +30 -0
- package/clients/rest/generated/data-contracts.d.ts +88 -82
- package/clients/rest/generated/data-contracts.js +8 -1
- package/clients/worker/worker.d.ts +5 -1
- package/clients/worker/worker.js +198 -13
- package/examples/affinity-workers.js +5 -1
- package/examples/api.js +1 -1
- package/examples/bulk-fanout-worker.js +1 -1
- package/examples/byo-logger.js +4 -0
- package/examples/concurrency/cancel-in-progress/concurrency-event.js +2 -2
- package/examples/concurrency/group-round-robin/concurrency-event.js +1 -1
- package/examples/crons/programatic-crons.js +4 -4
- package/examples/dag-worker.js +0 -1
- package/examples/example-event.js +2 -2
- package/examples/logger.js +2 -0
- package/examples/on-failure.js +1 -1
- package/examples/rate-limit/events.js +3 -3
- package/examples/scheduled-runs/programatic-schedules.js +4 -4
- package/examples/sticky-worker-with-check.js +2 -2
- package/examples/sticky-worker.js +5 -0
- package/index.d.ts +1 -2
- package/index.js +1 -2
- package/package.json +2 -2
- package/protoc/dispatcher/dispatcher.d.ts +2 -0
- package/protoc/dispatcher/dispatcher.js +1 -1
- package/protoc/events/events.js +1 -1
- package/protoc/google/protobuf/timestamp.js +1 -1
- package/protoc/v1/dispatcher.d.ts +77 -0
- package/protoc/v1/dispatcher.js +341 -0
- package/protoc/v1/shared/condition.d.ts +59 -0
- package/protoc/v1/shared/condition.js +549 -0
- package/protoc/v1/workflows.d.ts +263 -0
- package/protoc/v1/workflows.js +1823 -0
- package/protoc/workflows/workflows.js +1 -1
- package/step.d.ts +179 -53
- package/step.js +208 -64
- package/util/sleep.d.ts +7 -0
- package/util/sleep.js +7 -0
- package/util/workflow-run-ref.d.ts +8 -2
- package/util/workflow-run-ref.js +13 -0
- package/v1/client/client.d.ts +126 -7
- package/v1/client/client.interface.d.ts +9 -1
- package/v1/client/client.js +148 -17
- package/v1/client/duration.d.ts +7 -0
- package/v1/client/duration.js +2 -0
- package/v1/client/features/index.d.ts +5 -0
- package/v1/client/features/index.js +21 -0
- package/v1/client/features/metrics.d.ts +14 -0
- package/v1/client/features/metrics.js +45 -0
- package/v1/client/features/ratelimits.d.ts +20 -0
- package/v1/client/features/ratelimits.js +40 -0
- package/v1/client/features/runs.d.ts +15 -0
- package/v1/client/features/runs.js +60 -0
- package/v1/client/features/workers.d.ts +14 -0
- package/v1/client/features/workers.js +56 -0
- package/v1/client/features/workflows.d.ts +17 -0
- package/v1/client/features/workflows.js +93 -0
- package/v1/client/worker.d.ts +25 -15
- package/v1/client/worker.js +77 -42
- package/v1/conditions/base.d.ts +18 -0
- package/v1/conditions/base.js +18 -0
- package/v1/conditions/index.d.ts +31 -0
- package/v1/conditions/index.js +91 -0
- package/v1/conditions/parent-condition.d.ts +40 -0
- package/v1/conditions/parent-condition.js +36 -0
- package/v1/conditions/sleep-condition.d.ts +47 -0
- package/v1/conditions/sleep-condition.js +38 -0
- package/v1/conditions/transformer.d.ts +5 -0
- package/v1/conditions/transformer.js +52 -0
- package/v1/conditions/user-event-condition.d.ts +50 -0
- package/v1/conditions/user-event-condition.js +39 -0
- package/v1/declaration.d.ts +309 -0
- package/v1/declaration.js +296 -0
- package/v1/examples/child_workflows/worker.js +2 -2
- package/v1/examples/child_workflows/workflow.d.ts +2 -2
- package/v1/examples/child_workflows/workflow.js +5 -3
- package/v1/examples/concurrency-rr/load.js +2 -2
- package/v1/examples/concurrency-rr/worker.js +2 -2
- package/v1/examples/concurrency-rr/workflow.d.ts +1 -1
- package/v1/examples/concurrency-rr/workflow.js +2 -3
- package/v1/examples/dag/worker.js +2 -2
- package/v1/examples/dag/workflow.d.ts +1 -1
- package/v1/examples/dag/workflow.js +3 -3
- package/v1/examples/dag_match_condition/event.js +28 -0
- package/v1/examples/dag_match_condition/run.d.ts +1 -0
- package/v1/examples/dag_match_condition/run.js +25 -0
- package/v1/examples/dag_match_condition/worker.d.ts +1 -0
- package/{examples/playground.js → v1/examples/dag_match_condition/worker.js} +7 -22
- package/v1/examples/dag_match_condition/workflow.d.ts +11 -0
- package/v1/examples/dag_match_condition/workflow.js +41 -0
- package/v1/examples/deep/worker.js +2 -2
- package/v1/examples/deep/workflow.d.ts +6 -6
- package/v1/examples/deep/workflow.js +7 -7
- package/v1/examples/durable-sleep/event.d.ts +1 -0
- package/v1/examples/durable-sleep/event.js +28 -0
- package/v1/examples/durable-sleep/run.d.ts +1 -0
- package/v1/examples/durable-sleep/run.js +30 -0
- package/v1/examples/durable-sleep/worker.d.ts +1 -0
- package/v1/examples/durable-sleep/worker.js +24 -0
- package/v1/examples/durable-sleep/workflow.d.ts +1 -0
- package/v1/examples/durable-sleep/workflow.js +37 -0
- package/v1/examples/inferred-typing/run.d.ts +1 -0
- package/v1/examples/inferred-typing/run.js +41 -0
- package/v1/examples/inferred-typing/worker.d.ts +1 -0
- package/v1/examples/inferred-typing/worker.js +24 -0
- package/v1/examples/inferred-typing/workflow.d.ts +15 -0
- package/v1/examples/inferred-typing/workflow.js +44 -0
- package/v1/examples/legacy/run.js +2 -2
- package/v1/examples/legacy/worker.js +2 -2
- package/v1/examples/on_cron/worker.d.ts +1 -0
- package/v1/examples/on_cron/worker.js +24 -0
- package/v1/examples/on_cron/workflow.d.ts +10 -0
- package/v1/examples/on_cron/workflow.js +21 -0
- package/v1/examples/on_event/event.js +3 -2
- package/v1/examples/on_event/worker.js +2 -2
- package/v1/examples/on_event/workflow.d.ts +4 -4
- package/v1/examples/on_event/workflow.js +6 -3
- package/v1/examples/on_event copy/event.d.ts +1 -0
- package/v1/examples/on_event copy/event.js +26 -0
- package/v1/examples/on_event copy/worker.d.ts +1 -0
- package/v1/examples/on_event copy/worker.js +24 -0
- package/v1/examples/on_event copy/workflow.d.ts +16 -0
- package/v1/examples/on_event copy/workflow.js +35 -0
- package/v1/examples/on_failure/run.d.ts +1 -0
- package/v1/examples/on_failure/run.js +29 -0
- package/v1/examples/on_failure/worker.d.ts +1 -0
- package/v1/examples/on_failure/worker.js +24 -0
- package/v1/examples/on_failure/workflow.d.ts +1 -0
- package/v1/examples/on_failure/workflow.js +31 -0
- package/v1/examples/on_success/run.d.ts +1 -0
- package/v1/examples/on_success/run.js +31 -0
- package/v1/examples/on_success/worker.d.ts +1 -0
- package/v1/examples/on_success/worker.js +24 -0
- package/v1/examples/on_success/workflow.d.ts +4 -0
- package/v1/examples/on_success/workflow.js +59 -0
- package/v1/examples/simple/client-run.d.ts +1 -0
- package/v1/examples/simple/client-run.js +16 -0
- package/v1/examples/simple/cron.js +6 -2
- package/v1/examples/simple/delay.js +2 -2
- package/v1/examples/simple/enqueue.d.ts +1 -0
- package/v1/examples/simple/enqueue.js +43 -0
- package/v1/examples/simple/run.js +8 -3
- package/v1/examples/simple/schedule.js +11 -5
- package/v1/examples/simple/stub-workflow.d.ts +9 -0
- package/v1/examples/simple/stub-workflow.js +17 -0
- package/v1/examples/simple/worker.js +7 -2
- package/v1/examples/simple/workflow.d.ts +4 -3
- package/v1/examples/simple/workflow.js +5 -5
- package/v1/index.d.ts +5 -0
- package/v1/index.js +20 -0
- package/v1/task.d.ts +143 -13
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/v1/workflow.d.ts +0 -152
- package/v1/workflow.js +0 -145
- /package/{examples/playground.d.ts → v1/examples/dag_match_condition/event.d.ts} +0 -0
- /package/v1/examples/{client.d.ts → hatchet-client.d.ts} +0 -0
- /package/v1/examples/{client.js → hatchet-client.js} +0 -0
package/clients/worker/worker.js
CHANGED
|
@@ -25,6 +25,7 @@ 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
|
+
const transformer_1 = require("../../v1/conditions/transformer");
|
|
28
29
|
const step_1 = require("../../step");
|
|
29
30
|
class V0Worker {
|
|
30
31
|
constructor(client, options) {
|
|
@@ -61,6 +62,7 @@ class V0Worker {
|
|
|
61
62
|
? Object.assign(Object.assign({}, this.action_registry), { [`${workflow.id}:${workflow.concurrency.name.toLowerCase()}`]: workflow.concurrency.key }) : Object.assign({}, this.action_registry);
|
|
62
63
|
}
|
|
63
64
|
getHandler(workflows) {
|
|
65
|
+
// TODO v1
|
|
64
66
|
for (const workflow of workflows) {
|
|
65
67
|
const wf = Object.assign(Object.assign({}, workflow), { id: this.client.config.namespace + workflow.id });
|
|
66
68
|
this.registerActions(wf);
|
|
@@ -80,6 +82,163 @@ class V0Worker {
|
|
|
80
82
|
return this.registerWorkflow(initWorkflow);
|
|
81
83
|
});
|
|
82
84
|
}
|
|
85
|
+
registerDurableActionsV1(workflow) {
|
|
86
|
+
const newActions = workflow._durableTasks.reduce((acc, task) => {
|
|
87
|
+
acc[`${workflow.name}:${task.name.toLowerCase()}`] = (ctx) => task.fn(ctx.workflowInput(), ctx);
|
|
88
|
+
return acc;
|
|
89
|
+
}, {});
|
|
90
|
+
this.action_registry = Object.assign(Object.assign({}, this.action_registry), newActions);
|
|
91
|
+
}
|
|
92
|
+
registerActionsV1(workflow) {
|
|
93
|
+
const newActions = workflow._tasks.reduce((acc, task) => {
|
|
94
|
+
acc[`${workflow.name}:${task.name.toLowerCase()}`] = (ctx) => task.fn(ctx.workflowInput(), ctx);
|
|
95
|
+
return acc;
|
|
96
|
+
}, {});
|
|
97
|
+
const onFailureFn = workflow.onFailure
|
|
98
|
+
? typeof workflow.onFailure === 'function'
|
|
99
|
+
? workflow.onFailure
|
|
100
|
+
: workflow.onFailure.fn
|
|
101
|
+
: undefined;
|
|
102
|
+
const onFailureAction = onFailureFn
|
|
103
|
+
? {
|
|
104
|
+
[onFailureTaskName(workflow)]: (ctx) => onFailureFn(ctx.workflowInput(), ctx),
|
|
105
|
+
}
|
|
106
|
+
: {};
|
|
107
|
+
this.action_registry = Object.assign(Object.assign(Object.assign({}, this.action_registry), newActions), onFailureAction);
|
|
108
|
+
}
|
|
109
|
+
registerWorkflowV1(initWorkflow) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
112
|
+
// patch the namespace
|
|
113
|
+
const workflow = Object.assign(Object.assign({}, initWorkflow.definition), { name: (this.client.config.namespace + initWorkflow.definition.name).toLowerCase() });
|
|
114
|
+
try {
|
|
115
|
+
const { concurrency } = workflow;
|
|
116
|
+
let onFailureTask;
|
|
117
|
+
if (workflow.onFailure && typeof workflow.onFailure === 'function') {
|
|
118
|
+
onFailureTask = {
|
|
119
|
+
readableId: 'on-failure-task',
|
|
120
|
+
action: onFailureTaskName(workflow),
|
|
121
|
+
timeout: '60s',
|
|
122
|
+
inputs: '{}',
|
|
123
|
+
parents: [],
|
|
124
|
+
retries: 0,
|
|
125
|
+
rateLimits: [],
|
|
126
|
+
workerLabels: {},
|
|
127
|
+
concurrency: [],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (workflow.onFailure && typeof workflow.onFailure === 'object') {
|
|
131
|
+
const onFailure = workflow.onFailure;
|
|
132
|
+
onFailureTask = {
|
|
133
|
+
readableId: 'on-failure-task',
|
|
134
|
+
action: onFailureTaskName(workflow),
|
|
135
|
+
timeout: onFailure.executionTimeout || ((_a = workflow.taskDefaults) === null || _a === void 0 ? void 0 : _a.executionTimeout) || '60s',
|
|
136
|
+
scheduleTimeout: onFailure.scheduleTimeout || ((_b = workflow.taskDefaults) === null || _b === void 0 ? void 0 : _b.scheduleTimeout),
|
|
137
|
+
inputs: '{}',
|
|
138
|
+
parents: [],
|
|
139
|
+
retries: onFailure.retries || ((_c = workflow.taskDefaults) === null || _c === void 0 ? void 0 : _c.retries) || 0,
|
|
140
|
+
rateLimits: (0, step_1.mapRateLimit)(onFailure.rateLimits || ((_d = workflow.taskDefaults) === null || _d === void 0 ? void 0 : _d.rateLimits)),
|
|
141
|
+
workerLabels: toPbWorkerLabel(onFailure.workerLabels || ((_e = workflow.taskDefaults) === null || _e === void 0 ? void 0 : _e.workerLabels)),
|
|
142
|
+
concurrency: [],
|
|
143
|
+
backoffFactor: ((_f = onFailure.backoff) === null || _f === void 0 ? void 0 : _f.factor) || ((_h = (_g = workflow.taskDefaults) === null || _g === void 0 ? void 0 : _g.backoff) === null || _h === void 0 ? void 0 : _h.factor),
|
|
144
|
+
backoffMaxSeconds: ((_j = onFailure.backoff) === null || _j === void 0 ? void 0 : _j.maxSeconds) || ((_l = (_k = workflow.taskDefaults) === null || _k === void 0 ? void 0 : _k.backoff) === null || _l === void 0 ? void 0 : _l.maxSeconds),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
let onSuccessTask;
|
|
148
|
+
if (workflow.onSuccess && typeof workflow.onSuccess === 'function') {
|
|
149
|
+
const parents = getLeaves(workflow._tasks);
|
|
150
|
+
onSuccessTask = {
|
|
151
|
+
name: 'on-success-task',
|
|
152
|
+
fn: workflow.onSuccess,
|
|
153
|
+
timeout: '60s',
|
|
154
|
+
parents,
|
|
155
|
+
retries: 0,
|
|
156
|
+
rateLimits: [],
|
|
157
|
+
workerLabels: {},
|
|
158
|
+
concurrency: [],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (workflow.onSuccess && typeof workflow.onSuccess === 'object') {
|
|
162
|
+
const onSuccess = workflow.onSuccess;
|
|
163
|
+
const parents = getLeaves(workflow._tasks);
|
|
164
|
+
onSuccessTask = {
|
|
165
|
+
name: 'on-success-task',
|
|
166
|
+
fn: onSuccess.fn,
|
|
167
|
+
timeout: onSuccess.executionTimeout || ((_m = workflow.taskDefaults) === null || _m === void 0 ? void 0 : _m.executionTimeout) || '60s',
|
|
168
|
+
scheduleTimeout: onSuccess.scheduleTimeout || ((_o = workflow.taskDefaults) === null || _o === void 0 ? void 0 : _o.scheduleTimeout),
|
|
169
|
+
parents,
|
|
170
|
+
retries: onSuccess.retries || ((_p = workflow.taskDefaults) === null || _p === void 0 ? void 0 : _p.retries) || 0,
|
|
171
|
+
rateLimits: onSuccess.rateLimits || ((_q = workflow.taskDefaults) === null || _q === void 0 ? void 0 : _q.rateLimits),
|
|
172
|
+
workerLabels: onSuccess.workerLabels || ((_r = workflow.taskDefaults) === null || _r === void 0 ? void 0 : _r.workerLabels),
|
|
173
|
+
concurrency: onSuccess.concurrency || ((_s = workflow.taskDefaults) === null || _s === void 0 ? void 0 : _s.concurrency),
|
|
174
|
+
backoff: onSuccess.backoff || ((_t = workflow.taskDefaults) === null || _t === void 0 ? void 0 : _t.backoff),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (onSuccessTask) {
|
|
178
|
+
workflow._tasks.push(onSuccessTask);
|
|
179
|
+
}
|
|
180
|
+
// cron and event triggers
|
|
181
|
+
if (workflow.on) {
|
|
182
|
+
this.logger.warn(`\`on\` for event and cron triggers is deprecated and will be removed soon, use \`onEvents\` and \`onCrons\` instead for ${workflow.name}`);
|
|
183
|
+
}
|
|
184
|
+
const eventTriggers = [
|
|
185
|
+
...(workflow.onEvents || []),
|
|
186
|
+
...(((_u = workflow.on) === null || _u === void 0 ? void 0 : _u.event) ? [workflow.on.event] : []),
|
|
187
|
+
];
|
|
188
|
+
const cronTriggers = [
|
|
189
|
+
...(workflow.onCrons || []),
|
|
190
|
+
...(((_v = workflow.on) === null || _v === void 0 ? void 0 : _v.cron) ? [workflow.on.cron] : []),
|
|
191
|
+
];
|
|
192
|
+
const registeredWorkflow = this.client.admin.putWorkflowV1({
|
|
193
|
+
name: workflow.name,
|
|
194
|
+
description: workflow.description || '',
|
|
195
|
+
version: workflow.version || '',
|
|
196
|
+
eventTriggers,
|
|
197
|
+
cronTriggers,
|
|
198
|
+
sticky: workflow.sticky,
|
|
199
|
+
concurrency,
|
|
200
|
+
onFailureTask,
|
|
201
|
+
tasks: [...workflow._tasks, ...workflow._durableTasks].map((task) => {
|
|
202
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
203
|
+
return ({
|
|
204
|
+
readableId: task.name,
|
|
205
|
+
action: `${workflow.name}:${task.name}`,
|
|
206
|
+
timeout: task.executionTimeout ||
|
|
207
|
+
task.timeout ||
|
|
208
|
+
((_a = workflow.taskDefaults) === null || _a === void 0 ? void 0 : _a.executionTimeout) ||
|
|
209
|
+
'60s',
|
|
210
|
+
scheduleTimeout: task.scheduleTimeout || ((_b = workflow.taskDefaults) === null || _b === void 0 ? void 0 : _b.scheduleTimeout),
|
|
211
|
+
inputs: '{}',
|
|
212
|
+
parents: (_d = (_c = task.parents) === null || _c === void 0 ? void 0 : _c.map((p) => p.name)) !== null && _d !== void 0 ? _d : [],
|
|
213
|
+
userData: '{}',
|
|
214
|
+
retries: task.retries || ((_e = workflow.taskDefaults) === null || _e === void 0 ? void 0 : _e.retries) || 0,
|
|
215
|
+
rateLimits: (0, step_1.mapRateLimit)(task.rateLimits || ((_f = workflow.taskDefaults) === null || _f === void 0 ? void 0 : _f.rateLimits)),
|
|
216
|
+
workerLabels: toPbWorkerLabel(task.workerLabels || ((_g = workflow.taskDefaults) === null || _g === void 0 ? void 0 : _g.workerLabels)),
|
|
217
|
+
backoffFactor: ((_h = task.backoff) === null || _h === void 0 ? void 0 : _h.factor) || ((_k = (_j = workflow.taskDefaults) === null || _j === void 0 ? void 0 : _j.backoff) === null || _k === void 0 ? void 0 : _k.factor),
|
|
218
|
+
backoffMaxSeconds: ((_l = task.backoff) === null || _l === void 0 ? void 0 : _l.maxSeconds) || ((_o = (_m = workflow.taskDefaults) === null || _m === void 0 ? void 0 : _m.backoff) === null || _o === void 0 ? void 0 : _o.maxSeconds),
|
|
219
|
+
conditions: (0, transformer_1.taskConditionsToPb)(task),
|
|
220
|
+
concurrency: task.concurrency
|
|
221
|
+
? Array.isArray(task.concurrency)
|
|
222
|
+
? task.concurrency
|
|
223
|
+
: [task.concurrency]
|
|
224
|
+
: ((_p = workflow.taskDefaults) === null || _p === void 0 ? void 0 : _p.concurrency)
|
|
225
|
+
? Array.isArray(workflow.taskDefaults.concurrency)
|
|
226
|
+
? workflow.taskDefaults.concurrency
|
|
227
|
+
: [workflow.taskDefaults.concurrency]
|
|
228
|
+
: [],
|
|
229
|
+
});
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
this.registeredWorkflowPromises.push(registeredWorkflow);
|
|
233
|
+
yield registeredWorkflow;
|
|
234
|
+
this.workflow_registry.push(workflow);
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
throw new hatchet_error_1.default(`Could not register workflow: ${e.message}`);
|
|
238
|
+
}
|
|
239
|
+
this.registerActionsV1(workflow);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
83
242
|
registerWorkflow(initWorkflow) {
|
|
84
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
244
|
var _a, _b, _c;
|
|
@@ -170,7 +329,8 @@ class V0Worker {
|
|
|
170
329
|
return __awaiter(this, void 0, void 0, function* () {
|
|
171
330
|
const { actionId } = action;
|
|
172
331
|
try {
|
|
173
|
-
|
|
332
|
+
// Note: we always use a DurableContext since its a superset of the Context class
|
|
333
|
+
const context = new step_1.DurableContext(action, this.client, this);
|
|
174
334
|
this.contexts[action.stepRunId] = context;
|
|
175
335
|
const step = this.action_registry[actionId];
|
|
176
336
|
if (!step) {
|
|
@@ -187,8 +347,6 @@ class V0Worker {
|
|
|
187
347
|
// Send the action event to the dispatcher
|
|
188
348
|
const event = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_COMPLETED, result || null);
|
|
189
349
|
yield this.client.dispatcher.sendStepActionEvent(event);
|
|
190
|
-
// delete the run from the futures
|
|
191
|
-
delete this.futures[action.stepRunId];
|
|
192
350
|
}
|
|
193
351
|
catch (actionEventError) {
|
|
194
352
|
this.logger.error(`Could not send completed action event: ${actionEventError.message || actionEventError}`);
|
|
@@ -202,6 +360,11 @@ class V0Worker {
|
|
|
202
360
|
}
|
|
203
361
|
this.logger.error(`Could not send action event: ${actionEventError.message || actionEventError}`);
|
|
204
362
|
}
|
|
363
|
+
finally {
|
|
364
|
+
// delete the run from the futures
|
|
365
|
+
delete this.futures[action.stepRunId];
|
|
366
|
+
delete this.contexts[action.stepRunId];
|
|
367
|
+
}
|
|
205
368
|
});
|
|
206
369
|
const failure = (error) => __awaiter(this, void 0, void 0, function* () {
|
|
207
370
|
this.logger.error(`Step run ${action.stepRunId} failed: ${error.message}`);
|
|
@@ -215,12 +378,15 @@ class V0Worker {
|
|
|
215
378
|
stack: error === null || error === void 0 ? void 0 : error.stack,
|
|
216
379
|
});
|
|
217
380
|
yield this.client.dispatcher.sendStepActionEvent(event);
|
|
218
|
-
// delete the run from the futures
|
|
219
|
-
delete this.futures[action.stepRunId];
|
|
220
381
|
}
|
|
221
382
|
catch (e) {
|
|
222
383
|
this.logger.error(`Could not send action event: ${e.message}`);
|
|
223
384
|
}
|
|
385
|
+
finally {
|
|
386
|
+
// delete the run from the futures
|
|
387
|
+
delete this.futures[action.stepRunId];
|
|
388
|
+
delete this.contexts[action.stepRunId];
|
|
389
|
+
}
|
|
224
390
|
});
|
|
225
391
|
const future = new hatchet_promise_1.default((() => __awaiter(this, void 0, void 0, function* () {
|
|
226
392
|
let result;
|
|
@@ -279,12 +445,15 @@ class V0Worker {
|
|
|
279
445
|
this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
|
|
280
446
|
this.logger.error(`Could not send action event: ${e.message}`);
|
|
281
447
|
});
|
|
282
|
-
// delete the run from the futures
|
|
283
|
-
delete this.futures[key];
|
|
284
448
|
}
|
|
285
449
|
catch (e) {
|
|
286
450
|
this.logger.error(`Could not send action event: ${e.message}`);
|
|
287
451
|
}
|
|
452
|
+
finally {
|
|
453
|
+
// delete the run from the futures
|
|
454
|
+
delete this.futures[key];
|
|
455
|
+
delete this.contexts[key];
|
|
456
|
+
}
|
|
288
457
|
};
|
|
289
458
|
const failure = (error) => {
|
|
290
459
|
this.logger.error(`Step run ${key} failed: ${error.message}`);
|
|
@@ -294,12 +463,15 @@ class V0Worker {
|
|
|
294
463
|
this.client.dispatcher.sendGroupKeyActionEvent(event).catch((e) => {
|
|
295
464
|
this.logger.error(`Could not send action event: ${e.message}`);
|
|
296
465
|
});
|
|
297
|
-
// delete the run from the futures
|
|
298
|
-
delete this.futures[key];
|
|
299
466
|
}
|
|
300
467
|
catch (e) {
|
|
301
468
|
this.logger.error(`Could not send action event: ${e.message}`);
|
|
302
469
|
}
|
|
470
|
+
finally {
|
|
471
|
+
// delete the run from the futures
|
|
472
|
+
delete this.futures[key];
|
|
473
|
+
delete this.contexts[key];
|
|
474
|
+
}
|
|
303
475
|
};
|
|
304
476
|
const future = new hatchet_promise_1.default(run().then(success).catch(failure));
|
|
305
477
|
this.futures[key] = future;
|
|
@@ -344,14 +516,13 @@ class V0Worker {
|
|
|
344
516
|
}
|
|
345
517
|
handleCancelStepRun(action) {
|
|
346
518
|
return __awaiter(this, void 0, void 0, function* () {
|
|
519
|
+
const { stepRunId } = action;
|
|
347
520
|
try {
|
|
348
521
|
this.logger.info(`Cancelling step run ${action.stepRunId}`);
|
|
349
|
-
const { stepRunId } = action;
|
|
350
522
|
const future = this.futures[stepRunId];
|
|
351
523
|
const context = this.contexts[stepRunId];
|
|
352
524
|
if (context && context.controller) {
|
|
353
525
|
context.controller.abort('Cancelled by worker');
|
|
354
|
-
delete this.contexts[stepRunId];
|
|
355
526
|
}
|
|
356
527
|
if (future) {
|
|
357
528
|
future.promise.catch(() => {
|
|
@@ -359,12 +530,15 @@ class V0Worker {
|
|
|
359
530
|
});
|
|
360
531
|
future.cancel('Cancelled by worker');
|
|
361
532
|
yield future.promise;
|
|
362
|
-
delete this.futures[stepRunId];
|
|
363
533
|
}
|
|
364
534
|
}
|
|
365
535
|
catch (e) {
|
|
366
536
|
this.logger.error('Could not cancel step run: ', e);
|
|
367
537
|
}
|
|
538
|
+
finally {
|
|
539
|
+
delete this.futures[stepRunId];
|
|
540
|
+
delete this.contexts[stepRunId];
|
|
541
|
+
}
|
|
368
542
|
});
|
|
369
543
|
}
|
|
370
544
|
stop() {
|
|
@@ -398,6 +572,9 @@ class V0Worker {
|
|
|
398
572
|
var _a, e_1, _b, _c;
|
|
399
573
|
// ensure all workflows are registered
|
|
400
574
|
yield Promise.all(this.registeredWorkflowPromises);
|
|
575
|
+
if (Object.keys(this.action_registry).length === 0) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
401
578
|
try {
|
|
402
579
|
this.listener = yield this.client.dispatcher.getActionListener({
|
|
403
580
|
workerName: this.name,
|
|
@@ -427,7 +604,6 @@ class V0Worker {
|
|
|
427
604
|
}
|
|
428
605
|
}
|
|
429
606
|
catch (e) {
|
|
430
|
-
// TODO TEMP this needs to be handled better
|
|
431
607
|
if (this.killing) {
|
|
432
608
|
this.logger.info(`Exiting worker, ignoring error: ${e.message}`);
|
|
433
609
|
return;
|
|
@@ -501,3 +677,12 @@ function toPbWorkerLabel(in_) {
|
|
|
501
677
|
} });
|
|
502
678
|
}, {});
|
|
503
679
|
}
|
|
680
|
+
function onFailureTaskName(workflow) {
|
|
681
|
+
return `${workflow.name}:on-failure-task`;
|
|
682
|
+
}
|
|
683
|
+
function getLeaves(tasks) {
|
|
684
|
+
return tasks.filter((task) => isLeafTask(task, tasks));
|
|
685
|
+
}
|
|
686
|
+
function isLeafTask(task, allTasks) {
|
|
687
|
+
return !allTasks.some((t) => { var _a; return (_a = t.parents) === null || _a === void 0 ? void 0 : _a.some((p) => p.name === task.name); });
|
|
688
|
+
}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const workflows_1 = require("../protoc/workflows");
|
|
16
16
|
const sdk_1 = __importDefault(require("../sdk"));
|
|
17
17
|
const hatchet = sdk_1.default.init();
|
|
18
|
+
// ❓ AffinityWorkflow
|
|
18
19
|
const workflow = {
|
|
19
20
|
id: 'affinity-workflow',
|
|
20
21
|
description: 'test',
|
|
@@ -26,7 +27,7 @@ const workflow = {
|
|
|
26
27
|
// eslint-disable-next-line no-plusplus
|
|
27
28
|
for (let i = 0; i < 50; i++) {
|
|
28
29
|
const result = yield ctx.spawnWorkflow(childWorkflow.id, {});
|
|
29
|
-
results.push(result.
|
|
30
|
+
results.push(result.output);
|
|
30
31
|
}
|
|
31
32
|
console.log('Spawned 50 child workflows');
|
|
32
33
|
console.log('Results:', yield Promise.all(results));
|
|
@@ -35,6 +36,7 @@ const workflow = {
|
|
|
35
36
|
},
|
|
36
37
|
],
|
|
37
38
|
};
|
|
39
|
+
// ‼️
|
|
38
40
|
const childWorkflow = {
|
|
39
41
|
id: 'child-affinity-workflow',
|
|
40
42
|
description: 'test',
|
|
@@ -70,12 +72,14 @@ const childWorkflow = {
|
|
|
70
72
|
};
|
|
71
73
|
function main() {
|
|
72
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
// ❓ AffinityWorker
|
|
73
76
|
const worker1 = yield hatchet.worker('affinity-worker-1', {
|
|
74
77
|
labels: {
|
|
75
78
|
model: 'abc',
|
|
76
79
|
memory: 1024,
|
|
77
80
|
},
|
|
78
81
|
});
|
|
82
|
+
// ‼️
|
|
79
83
|
yield worker1.registerWorkflow(workflow);
|
|
80
84
|
yield worker1.registerWorkflow(childWorkflow);
|
|
81
85
|
worker1.start();
|
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.
|
|
52
|
+
worker.nonDurable.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' };
|
|
@@ -32,7 +32,7 @@ const parentWorkflow = {
|
|
|
32
32
|
options: { additionalMetadata: { childKey: 'childValue' } },
|
|
33
33
|
}));
|
|
34
34
|
const spawnedWorkflows = yield ctx.spawnWorkflows(workflowRequests);
|
|
35
|
-
const results = yield Promise.all(spawnedWorkflows.map((workflowRef) => workflowRef.
|
|
35
|
+
const results = yield Promise.all(spawnedWorkflows.map((workflowRef) => workflowRef.output.then((result) => {
|
|
36
36
|
ctx.log('spawned workflow result:');
|
|
37
37
|
return result;
|
|
38
38
|
})));
|
package/examples/byo-logger.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
16
16
|
const pino_1 = __importDefault(require("pino"));
|
|
17
17
|
const sdk_1 = __importDefault(require("../sdk"));
|
|
18
|
+
// ❓ Create Pino logger
|
|
18
19
|
const logger = (0, pino_1.default)();
|
|
19
20
|
class PinoLogger {
|
|
20
21
|
constructor(context, logLevel = 'DEBUG') {
|
|
@@ -41,6 +42,8 @@ const hatchet = sdk_1.default.init({
|
|
|
41
42
|
log_level: 'DEBUG',
|
|
42
43
|
logger: (ctx, level) => new PinoLogger(ctx, level),
|
|
43
44
|
});
|
|
45
|
+
// !!
|
|
46
|
+
// ❓ Use the logger
|
|
44
47
|
const sleep = (ms) => new Promise((resolve) => {
|
|
45
48
|
setTimeout(resolve, ms);
|
|
46
49
|
});
|
|
@@ -64,6 +67,7 @@ const workflow = {
|
|
|
64
67
|
},
|
|
65
68
|
],
|
|
66
69
|
};
|
|
70
|
+
// !!
|
|
67
71
|
function main() {
|
|
68
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
73
|
const worker = yield hatchet.worker('byo-logger-worker', 1);
|
|
@@ -19,7 +19,7 @@ const sleep = (ms) => new Promise((resolve) => {
|
|
|
19
19
|
});
|
|
20
20
|
function main() {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
hatchet.
|
|
22
|
+
hatchet.events.push('concurrency:create', {
|
|
23
23
|
data: 'event 1',
|
|
24
24
|
userId: 'user1',
|
|
25
25
|
});
|
|
@@ -28,7 +28,7 @@ function main() {
|
|
|
28
28
|
// before that will cancel
|
|
29
29
|
// the first run and run the second event
|
|
30
30
|
yield sleep(1000);
|
|
31
|
-
hatchet.
|
|
31
|
+
hatchet.events.push('concurrency:create', {
|
|
32
32
|
data: 'event 2',
|
|
33
33
|
userId: 'user1',
|
|
34
34
|
});
|
|
@@ -21,7 +21,7 @@ function main() {
|
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
// ? Create
|
|
23
23
|
// You can create dynamic cron triggers programmatically via the API
|
|
24
|
-
const createdCron = yield hatchet.
|
|
24
|
+
const createdCron = yield hatchet.crons.create(cron_worker_1.simpleCronWorkflow, // workflow object or string workflow id
|
|
25
25
|
{
|
|
26
26
|
name: 'customer-a-daily-report', // friendly name for the cron trigger
|
|
27
27
|
expression: '0 12 * * *', // every day at noon
|
|
@@ -36,16 +36,16 @@ function main() {
|
|
|
36
36
|
// !!
|
|
37
37
|
// ? Get
|
|
38
38
|
// You can get a specific cron trigger by passing in the cron trigger id
|
|
39
|
-
const cron = yield hatchet.
|
|
39
|
+
const cron = yield hatchet.crons.get(id);
|
|
40
40
|
// !!
|
|
41
41
|
// ? Delete
|
|
42
42
|
// You can delete a cron trigger by passing the cron object
|
|
43
43
|
// or a cron Id to the delete method
|
|
44
|
-
yield hatchet.
|
|
44
|
+
yield hatchet.crons.delete(cron);
|
|
45
45
|
// !!
|
|
46
46
|
// ? List
|
|
47
47
|
// You can list all cron triggers by passing in a query object
|
|
48
|
-
const cronList = yield hatchet.
|
|
48
|
+
const cronList = yield hatchet.crons.list({
|
|
49
49
|
offset: 0,
|
|
50
50
|
limit: 10,
|
|
51
51
|
});
|
package/examples/dag-worker.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const sdk_1 = __importDefault(require("../sdk"));
|
|
7
7
|
const hatchet = sdk_1.default.init();
|
|
8
8
|
// Push a single event (example)
|
|
9
|
-
hatchet.
|
|
9
|
+
hatchet.events.push('user:create', {
|
|
10
10
|
test: 'test',
|
|
11
11
|
});
|
|
12
12
|
// Example events to be pushed in bulk
|
|
@@ -25,7 +25,7 @@ const events = [
|
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
27
|
// Bulk push the events and compare the keys
|
|
28
|
-
hatchet.
|
|
28
|
+
hatchet.events
|
|
29
29
|
.bulkPush('user:create:bulk', events)
|
|
30
30
|
.then((result) => {
|
|
31
31
|
const returnedEvents = result.events;
|
package/examples/logger.js
CHANGED
|
@@ -19,6 +19,7 @@ const hatchet = sdk_1.default.init({
|
|
|
19
19
|
const sleep = (ms) => new Promise((resolve) => {
|
|
20
20
|
setTimeout(resolve, ms);
|
|
21
21
|
});
|
|
22
|
+
// ❓ Logger
|
|
22
23
|
const workflow = {
|
|
23
24
|
id: 'logger-example',
|
|
24
25
|
description: 'test',
|
|
@@ -40,6 +41,7 @@ const workflow = {
|
|
|
40
41
|
},
|
|
41
42
|
],
|
|
42
43
|
};
|
|
44
|
+
// ‼️
|
|
43
45
|
function main() {
|
|
44
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
47
|
const worker = yield hatchet.worker('logger-worker', 1);
|
package/examples/on-failure.js
CHANGED
|
@@ -41,7 +41,7 @@ const workflow = {
|
|
|
41
41
|
// 👀 we can do things like perform cleanup logic
|
|
42
42
|
// or notify a user here
|
|
43
43
|
// 👀 you can access the error from the failed step(s) like this
|
|
44
|
-
console.log(ctx.
|
|
44
|
+
console.log(ctx.errors());
|
|
45
45
|
return { onFailure: 'step' };
|
|
46
46
|
}),
|
|
47
47
|
},
|
|
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const sdk_1 = __importDefault(require("../../sdk"));
|
|
7
7
|
const hatchet = sdk_1.default.init();
|
|
8
|
-
hatchet.
|
|
8
|
+
hatchet.events.push('rate-limit:create', {
|
|
9
9
|
test: '1',
|
|
10
10
|
});
|
|
11
|
-
hatchet.
|
|
11
|
+
hatchet.events.push('rate-limit:create', {
|
|
12
12
|
test: '2',
|
|
13
13
|
});
|
|
14
|
-
hatchet.
|
|
14
|
+
hatchet.events.push('rate-limit:create', {
|
|
15
15
|
test: '3',
|
|
16
16
|
});
|
|
@@ -21,7 +21,7 @@ function main() {
|
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
// ? Create
|
|
23
23
|
// You can create dynamic scheduled runs programmatically via the API
|
|
24
|
-
const createdScheduledRun = yield hatchet.
|
|
24
|
+
const createdScheduledRun = yield hatchet.schedules.create(simple_worker_1.simpleWorkflow, // workflow object or string workflow id
|
|
25
25
|
{
|
|
26
26
|
triggerAt: new Date(Date.now() + 1000 * 60 * 60 * 24), // 24 hours from now
|
|
27
27
|
input: {
|
|
@@ -35,16 +35,16 @@ function main() {
|
|
|
35
35
|
// !!
|
|
36
36
|
// ? Get
|
|
37
37
|
// You can get a specific scheduled run by passing in the scheduled run id
|
|
38
|
-
const scheduledRun = yield hatchet.
|
|
38
|
+
const scheduledRun = yield hatchet.schedules.get(id);
|
|
39
39
|
// !!
|
|
40
40
|
// ? Delete
|
|
41
41
|
// You can delete a scheduled run by passing the scheduled run object
|
|
42
42
|
// or a scheduled run Id to the delete method
|
|
43
|
-
yield hatchet.
|
|
43
|
+
yield hatchet.schedules.delete(scheduledRun);
|
|
44
44
|
// !!
|
|
45
45
|
// ? List
|
|
46
46
|
// You can list all scheduled runs by passing in a query object
|
|
47
|
-
const scheduledRunList = yield hatchet.
|
|
47
|
+
const scheduledRunList = yield hatchet.schedules.list({
|
|
48
48
|
offset: 0,
|
|
49
49
|
limit: 10,
|
|
50
50
|
});
|
|
@@ -28,9 +28,9 @@ const workflow = {
|
|
|
28
28
|
// eslint-disable-next-line no-plusplus
|
|
29
29
|
for (let i = 0; i < count; i++) {
|
|
30
30
|
const result = yield ctx.spawnWorkflow(childWorkflow, {}, { sticky: true });
|
|
31
|
-
results.push(result.
|
|
31
|
+
results.push(result.output);
|
|
32
32
|
const result2 = yield ctx.spawnWorkflow(softChildWorkflow, {}, { sticky: true });
|
|
33
|
-
results.push(result2.
|
|
33
|
+
results.push(result2.output);
|
|
34
34
|
}
|
|
35
35
|
console.log('Spawned ', count, ' child workflows of each type');
|
|
36
36
|
console.log('Results:', yield Promise.all(results));
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const sdk_1 = __importDefault(require("../sdk"));
|
|
16
16
|
const workflow_1 = require("../workflow");
|
|
17
17
|
const hatchet = sdk_1.default.init();
|
|
18
|
+
// ❓ StickyWorker
|
|
18
19
|
const workflow = {
|
|
19
20
|
id: 'sticky-workflow',
|
|
20
21
|
description: 'test',
|
|
@@ -35,9 +36,12 @@ const workflow = {
|
|
|
35
36
|
},
|
|
36
37
|
],
|
|
37
38
|
};
|
|
39
|
+
// ‼️
|
|
40
|
+
// ❓ StickyChild
|
|
38
41
|
const childWorkflow = {
|
|
39
42
|
id: 'child-sticky-workflow',
|
|
40
43
|
description: 'test',
|
|
44
|
+
// 👀 Specify a sticky strategy when declaring the workflow
|
|
41
45
|
sticky: workflow_1.StickyStrategy.HARD,
|
|
42
46
|
steps: [
|
|
43
47
|
{
|
|
@@ -58,6 +62,7 @@ const childWorkflow = {
|
|
|
58
62
|
},
|
|
59
63
|
],
|
|
60
64
|
};
|
|
65
|
+
// ‼️
|
|
61
66
|
function main() {
|
|
62
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
68
|
const worker1 = yield hatchet.worker('sticky-worker-1');
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ 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
|
|
9
|
-
export * from './v1/client/worker';
|
|
8
|
+
export * from './v1';
|
|
10
9
|
export default Hatchet;
|
|
11
10
|
export { Hatchet };
|
package/index.js
CHANGED
|
@@ -23,6 +23,5 @@ __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
|
-
__exportStar(require("./v1
|
|
27
|
-
__exportStar(require("./v1/client/worker"), exports);
|
|
26
|
+
__exportStar(require("./v1"), exports);
|
|
28
27
|
exports.default = client_1.HatchetClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-alpha2",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "https://github.com/hatchet-dev/hatchet-typescript.git"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "echo 'build hatchet sdk with `
|
|
18
|
+
"build": "echo 'build hatchet sdk with `npm run tsc:build` to ensure it is not build during the publish step' && exit 0",
|
|
19
19
|
"prepare": "npm run build",
|
|
20
20
|
"dump-version": "node -e \"console.log('export const HATCHET_VERSION = \\'' + require('./package.json').version + '\\';');\" > src/version.ts",
|
|
21
21
|
"tsc:build": "npm run dump-version && tsc && resolve-tspaths",
|