From 9334317d7ad85c1b3fe035033205c616bee59f62 Mon Sep 17 00:00:00 2001 From: maxdml Date: Wed, 11 Dec 2024 11:59:08 -0800 Subject: [PATCH] import DBOS entrypoints if specified --- src/dbos.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dbos.ts b/src/dbos.ts index a648c824..b7e922b3 100644 --- a/src/dbos.ts +++ b/src/dbos.ts @@ -22,7 +22,7 @@ import { DBOSExecutorContext } from "./eventreceiver"; import { DLogger, GlobalLogger } from "./telemetry/logs"; import { DBOSExecutorNotInitializedError, DBOSInvalidWorkflowTransitionError } from "./error"; import { parseConfigFile } from "./dbos-runtime/config"; -import { DBOSRuntimeConfig } from "./dbos-runtime/runtime"; +import { DBOSRuntime, DBOSRuntimeConfig } from "./dbos-runtime/runtime"; import { DBOSScheduler, ScheduledArgs, SchedulerConfig, SchedulerRegistrationBase } from "./scheduler/scheduler"; import { configureInstance, getOrCreateClassRegistration, getRegisteredOperations, MethodRegistration, registerAndWrapContextFreeFunction, registerFunctionWrapper } from "./decorators"; import { sleepms } from "./utils"; @@ -148,6 +148,11 @@ export class DBOS { DBOS.dbosConfig = dbosConfig; DBOS.runtimeConfig = runtimeConfig; } + + if (DBOS.runtimeConfig && DBOS.runtimeConfig.entrypoints.length > 0) { + await DBOSRuntime.loadClasses(DBOS.runtimeConfig.entrypoints); + } + DBOSExecutor.globalInstance = new DBOSExecutor(DBOS.dbosConfig); const executor: DBOSExecutor = DBOSExecutor.globalInstance; await executor.init();