From 71ac039dd51eb23a5a6747836af47abba5bd9371 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 12 Sep 2024 15:45:33 +1000 Subject: [PATCH] Pass workflow id into SchemaManager when using it inside workflow --- src/SchemaManager.ts | 6 +++--- src/workflows/StatefulWorkflow.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SchemaManager.ts b/src/SchemaManager.ts index 5f6b634..c85d8c8 100644 --- a/src/SchemaManager.ts +++ b/src/SchemaManager.ts @@ -39,9 +39,9 @@ export class SchemaManager extends EventEmitter { * Returns the singleton instance of SchemaManager. * @returns The SchemaManager instance. */ - public static getInstance(): SchemaManager { + public static getInstance(workflowId?: string): SchemaManager { if (!this.instance) { - this.instance = new SchemaManager(); + this.instance = new SchemaManager(workflowId); } return this.instance; } @@ -66,7 +66,7 @@ export class SchemaManager extends EventEmitter { /** * Private constructor to enforce singleton pattern. */ - private constructor() { + private constructor(protected workflowId?: string) { super(); } diff --git a/src/workflows/StatefulWorkflow.ts b/src/workflows/StatefulWorkflow.ts index fc96949..a184c61 100644 --- a/src/workflows/StatefulWorkflow.ts +++ b/src/workflows/StatefulWorkflow.ts @@ -84,7 +84,7 @@ export type PendingChange = { }; export abstract class StatefulWorkflow extends Workflow { - private schemaManager = SchemaManager.getInstance(); + private schemaManager = SchemaManager.getInstance(workflow.workflowInfo().workflowId); private schema: Schema; protected async condition(): Promise {