@hatchet-dev/typescript-sdk 1.19.2-alpha.0 → 1.19.2-alpha.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.
- package/package.json +1 -1
- package/v1/declaration.js +12 -14
- package/v1/parent-run-context-vars.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
package/v1/declaration.js
CHANGED
|
@@ -64,11 +64,6 @@ class BaseWorkflowDeclaration {
|
|
|
64
64
|
throw UNBOUND_ERR;
|
|
65
65
|
}
|
|
66
66
|
const parentRunContext = parent_run_context_vars_1.parentRunContextManager.getContext();
|
|
67
|
-
// Snapshot the child index BEFORE incrementing — getContext() returns a mutable
|
|
68
|
-
// reference, so any later increment would corrupt this value.
|
|
69
|
-
const childIndex = parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.childIndex;
|
|
70
|
-
const inputCount = Array.isArray(input) ? input.length : 1;
|
|
71
|
-
parent_run_context_vars_1.parentRunContextManager.incrementChildIndex(inputCount);
|
|
72
67
|
if (!parentRunContext && ((options === null || options === void 0 ? void 0 : options.childKey) || (options === null || options === void 0 ? void 0 : options.sticky))) {
|
|
73
68
|
this.client.admin.logger.warn('ignoring childKey or sticky because run is not being spawned from a parent task');
|
|
74
69
|
}
|
|
@@ -82,19 +77,22 @@ class BaseWorkflowDeclaration {
|
|
|
82
77
|
: undefined,
|
|
83
78
|
warn: (message) => this.client.admin.logger.warn(message),
|
|
84
79
|
});
|
|
85
|
-
|
|
80
|
+
// Snapshot the base child index before incrementing. We use 1-based child
|
|
81
|
+
// indices because Context.spawnIndex occupies the 0-based range.
|
|
82
|
+
const baseChildIndex = parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.childIndex;
|
|
83
|
+
const inputCount = Array.isArray(input) ? input.length : 1;
|
|
84
|
+
parent_run_context_vars_1.parentRunContextManager.incrementChildIndex(inputCount);
|
|
85
|
+
const childIndexForRun = baseChildIndex != null ? baseChildIndex + 1 : undefined;
|
|
86
|
+
const runOpts = Object.assign(Object.assign({}, (options !== null && options !== void 0 ? options : {})), { parentId: parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.parentId, parentTaskRunExternalId: parentRunContext === null || parentRunContext === void 0 ? void 0 : parentRunContext.parentTaskRunExternalId, childIndex: childIndexForRun, 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 });
|
|
86
87
|
if (Array.isArray(input)) {
|
|
87
88
|
let resp = [];
|
|
88
89
|
for (let i = 0; i < input.length; i += 500) {
|
|
89
90
|
const batch = input.slice(i, i + 500);
|
|
90
|
-
const batchResp = yield this.client.admin.runWorkflows(batch.map((inp, batchIdx) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
options: Object.assign(Object.assign({}, runOpts), { childIndex: ((_a = runOpts.childIndex) !== null && _a !== void 0 ? _a : 0) + i + batchIdx }),
|
|
96
|
-
});
|
|
97
|
-
}));
|
|
91
|
+
const batchResp = yield this.client.admin.runWorkflows(batch.map((inp, batchIdx) => ({
|
|
92
|
+
workflowName: this.definition.name,
|
|
93
|
+
input: inp,
|
|
94
|
+
options: Object.assign(Object.assign({}, runOpts), { childIndex: (childIndexForRun !== null && childIndexForRun !== void 0 ? childIndexForRun : 0) + i + batchIdx }),
|
|
95
|
+
})));
|
|
98
96
|
resp = resp.concat(batchResp);
|
|
99
97
|
}
|
|
100
98
|
const res = [];
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HATCHET_VERSION = "1.19.2-alpha.
|
|
1
|
+
export declare const HATCHET_VERSION = "1.19.2-alpha.1";
|
package/version.js
CHANGED