@hatchet-dev/typescript-sdk 1.10.8 → 1.12.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.
- package/clients/admin/admin-client.d.ts +38 -0
- package/clients/admin/admin-client.js +19 -6
- package/clients/dispatcher/action-listener.d.ts +6 -2
- package/clients/dispatcher/action-listener.js +2 -2
- package/clients/dispatcher/dispatcher-client.d.ts +8 -2
- package/clients/dispatcher/dispatcher-client.js +18 -4
- package/clients/event/event-client.d.ts +2 -2
- package/clients/event/event-client.js +4 -4
- package/clients/hatchet-client/hatchet-logger.js +2 -2
- package/clients/rest/generated/data-contracts.d.ts +13 -1
- package/clients/worker/worker.js +11 -11
- package/examples/webhooks.d.ts +1 -0
- package/examples/webhooks.js +45 -0
- package/package.json +1 -1
- package/protoc/dispatcher/dispatcher.d.ts +25 -25
- package/protoc/dispatcher/dispatcher.js +109 -95
- package/protoc/events/events.d.ts +4 -4
- package/protoc/events/events.js +20 -16
- package/protoc/v1/workflows.d.ts +7 -7
- package/protoc/workflows/workflows.d.ts +22 -22
- package/protoc/workflows/workflows.js +18 -18
- package/step.d.ts +1 -1
- package/step.js +19 -19
- package/util/workflow-run-ref.js +1 -1
- package/v1/client/admin.d.ts +30 -0
- package/v1/client/admin.js +21 -6
- package/v1/client/client.d.ts +8 -1
- package/v1/client/client.js +12 -1
- package/v1/client/features/metrics.d.ts +16 -5
- package/v1/client/features/metrics.js +13 -14
- package/v1/client/features/runs.d.ts +9 -1
- package/v1/client/features/runs.js +4 -2
- package/v1/client/features/webhooks.d.ts +28 -0
- package/v1/client/features/webhooks.js +97 -0
- package/v1/client/worker/context.d.ts +1 -1
- package/v1/client/worker/context.js +23 -23
- package/v1/client/worker/worker-internal.d.ts +2 -2
- package/v1/client/worker/worker-internal.js +25 -25
- package/v1/declaration.d.ts +2 -2
- package/v1/declaration.js +24 -10
- package/v1/parent-run-context-vars.d.ts +4 -1
- package/v1/parent-run-context-vars.js +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/v1/declaration.d.ts
CHANGED
|
@@ -266,14 +266,14 @@ export declare class BaseWorkflowDeclaration<I extends InputType = UnknownInputT
|
|
|
266
266
|
* @returns A promise that resolves with the workflow metrics.
|
|
267
267
|
* @throws Error if the workflow is not bound to a Hatchet client.
|
|
268
268
|
*/
|
|
269
|
-
metrics(opts?: Parameters<MetricsClient['
|
|
269
|
+
metrics(opts?: Omit<Parameters<MetricsClient['getTaskStatusMetrics']>[0], 'workflows'>): Promise<import("./client/features/metrics").TaskStatusMetrics>;
|
|
270
270
|
/**
|
|
271
271
|
* Get queue metrics for the workflow.
|
|
272
272
|
* @param opts Optional configuration for the metrics request.
|
|
273
273
|
* @returns A promise that resolves with the workflow metrics.
|
|
274
274
|
* @throws Error if the workflow is not bound to a Hatchet client.
|
|
275
275
|
*/
|
|
276
|
-
|
|
276
|
+
taskStatusMetrics(opts?: Omit<Parameters<MetricsClient['getTaskStatusMetrics']>[0], 'workflows'>): Promise<import("./client/features/metrics").TaskStatusMetrics>;
|
|
277
277
|
/**
|
|
278
278
|
* Get the current state of the workflow.
|
|
279
279
|
* @returns A promise that resolves with the workflow state.
|
package/v1/declaration.js
CHANGED
|
@@ -48,7 +48,7 @@ class BaseWorkflowDeclaration {
|
|
|
48
48
|
if (!parentRunContext && ((options === null || options === void 0 ? void 0 : options.childKey) || (options === null || options === void 0 ? void 0 : options.sticky))) {
|
|
49
49
|
this.client.admin.logger.warn('ignoring childKey or sticky because run is not being spawned from a parent task');
|
|
50
50
|
}
|
|
51
|
-
const runOpts = Object.assign(Object.assign({}, options), { parentId: parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.parentId,
|
|
51
|
+
const runOpts = Object.assign(Object.assign({}, options), { parentId: parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.parentId, parentTaskRunExternalId: parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.parentTaskRunExternalId, childIndex: parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.childIndex, sticky: (options === null || options === void 0 ? void 0 : options.sticky) ? parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.desiredWorkerId : undefined, childKey: options === null || options === void 0 ? void 0 : options.childKey });
|
|
52
52
|
if (Array.isArray(input)) {
|
|
53
53
|
let resp = [];
|
|
54
54
|
for (let i = 0; i < input.length; i += 500) {
|
|
@@ -166,10 +166,17 @@ class BaseWorkflowDeclaration {
|
|
|
166
166
|
* @throws Error if the workflow is not bound to a Hatchet client.
|
|
167
167
|
*/
|
|
168
168
|
metrics(opts) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
if (!this.client) {
|
|
171
|
+
throw UNBOUND_ERR;
|
|
172
|
+
}
|
|
173
|
+
const workflow = yield this.client.workflows.get(this.definition.name);
|
|
174
|
+
return this.client.metrics.getTaskStatusMetrics({
|
|
175
|
+
since: (opts === null || opts === void 0 ? void 0 : opts.since) || new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
|
|
176
|
+
until: (opts === null || opts === void 0 ? void 0 : opts.until) || new Date().toISOString(),
|
|
177
|
+
workflow_ids: [workflow.metadata.id],
|
|
178
|
+
});
|
|
179
|
+
});
|
|
173
180
|
}
|
|
174
181
|
/**
|
|
175
182
|
* Get queue metrics for the workflow.
|
|
@@ -177,11 +184,18 @@ class BaseWorkflowDeclaration {
|
|
|
177
184
|
* @returns A promise that resolves with the workflow metrics.
|
|
178
185
|
* @throws Error if the workflow is not bound to a Hatchet client.
|
|
179
186
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
taskStatusMetrics(opts) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
if (!this.client) {
|
|
190
|
+
throw UNBOUND_ERR;
|
|
191
|
+
}
|
|
192
|
+
const workflow = yield this.client.workflows.get(this.definition.name);
|
|
193
|
+
return this.client.metrics.getTaskStatusMetrics({
|
|
194
|
+
since: (opts === null || opts === void 0 ? void 0 : opts.since) || new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
|
|
195
|
+
until: (opts === null || opts === void 0 ? void 0 : opts.until) || new Date().toISOString(),
|
|
196
|
+
workflow_ids: [workflow.metadata.id],
|
|
197
|
+
});
|
|
198
|
+
});
|
|
185
199
|
}
|
|
186
200
|
/**
|
|
187
201
|
* Get the current state of the workflow.
|
|
@@ -14,6 +14,7 @@ class ParentRunContextManager {
|
|
|
14
14
|
const parentRunContext = this.getContext();
|
|
15
15
|
if (parentRunContext) {
|
|
16
16
|
parentRunContext.parentId = opts.parentId;
|
|
17
|
+
parentRunContext.parentTaskRunExternalId = opts.parentTaskRunExternalId;
|
|
17
18
|
parentRunContext.childIndex = ((_a = parentRunContext.childIndex) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
18
19
|
this.setContext(parentRunContext);
|
|
19
20
|
}
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HATCHET_VERSION = "1.
|
|
1
|
+
export declare const HATCHET_VERSION = "1.12.0";
|
package/version.js
CHANGED