fix: serial-registration (#1574)

* fix: serial-registration

* fix case

* release ver
This commit is contained in:
Gabe Ruttner
2025-04-18 10:54:22 -04:00
committed by GitHub
parent 0ec8f830b9
commit 4e42beecc6
2 changed files with 16 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@hatchet-dev/typescript-sdk",
"version": "1.3.1",
"version": "1.3.2",
"description": "Background task orchestration & visibility for developers",
"types": "dist/index.d.ts",
"files": [

View File

@@ -87,29 +87,25 @@ export class Worker {
* @returns Array of registered workflow promises
*/
async registerWorkflows(workflows?: Array<BaseWorkflowDeclaration<any, any> | V0Workflow>) {
return Promise.all(
workflows?.map(async (wf) => {
if (wf instanceof BaseWorkflowDeclaration) {
// TODO check if tenant is V1
const register = this.nonDurable.registerWorkflowV1(wf);
for (const wf of workflows || []) {
if (wf instanceof BaseWorkflowDeclaration) {
// TODO check if tenant is V1
await this.nonDurable.registerWorkflowV1(wf);
if (wf.definition._durableTasks.length > 0) {
if (!this.durable) {
this.durable = await this._v0.worker(`${this.name}-durable`, {
...this.config,
maxRuns: this.config.durableSlots || DEFAULT_DURABLE_SLOTS,
});
}
this.durable.registerDurableActionsV1(wf.definition);
if (wf.definition._durableTasks.length > 0) {
if (!this.durable) {
this.durable = await this._v0.worker(`${this.name}-durable`, {
...this.config,
maxRuns: this.config.durableSlots || DEFAULT_DURABLE_SLOTS,
});
}
return register;
this.durable.registerDurableActionsV1(wf.definition);
}
} else {
// fallback to v0 client for backwards compatibility
return this.nonDurable.registerWorkflow(wf);
}) || []
);
await this.nonDurable.registerWorkflow(wf);
}
}
}
/**