@dbos-inc/dbos-sdk 1.12.13-preview.g7a8a447e44 → 1.13.5-preview

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/dbos-config.schema.json +2 -1
  2. package/dist/schemas/system_db_schema.d.ts +2 -0
  3. package/dist/schemas/system_db_schema.d.ts.map +1 -1
  4. package/dist/src/communicator.d.ts +1 -1
  5. package/dist/src/communicator.d.ts.map +1 -1
  6. package/dist/src/communicator.js.map +1 -1
  7. package/dist/src/context.d.ts +2 -0
  8. package/dist/src/context.d.ts.map +1 -1
  9. package/dist/src/context.js +3 -2
  10. package/dist/src/context.js.map +1 -1
  11. package/dist/src/dbos-executor.d.ts +27 -11
  12. package/dist/src/dbos-executor.d.ts.map +1 -1
  13. package/dist/src/dbos-executor.js +149 -58
  14. package/dist/src/dbos-executor.js.map +1 -1
  15. package/dist/src/dbos-runtime/config.d.ts +0 -1
  16. package/dist/src/dbos-runtime/config.d.ts.map +1 -1
  17. package/dist/src/dbos-runtime/config.js +2 -4
  18. package/dist/src/dbos-runtime/config.js.map +1 -1
  19. package/dist/src/debugger/debug_workflow.d.ts +14 -5
  20. package/dist/src/debugger/debug_workflow.d.ts.map +1 -1
  21. package/dist/src/debugger/debug_workflow.js +80 -23
  22. package/dist/src/debugger/debug_workflow.js.map +1 -1
  23. package/dist/src/decorators.d.ts +19 -2
  24. package/dist/src/decorators.d.ts.map +1 -1
  25. package/dist/src/decorators.js +104 -27
  26. package/dist/src/decorators.js.map +1 -1
  27. package/dist/src/httpServer/handler.d.ts +22 -15
  28. package/dist/src/httpServer/handler.d.ts.map +1 -1
  29. package/dist/src/httpServer/handler.js +44 -35
  30. package/dist/src/httpServer/handler.js.map +1 -1
  31. package/dist/src/httpServer/handlerTypes.d.ts +4 -1
  32. package/dist/src/httpServer/handlerTypes.d.ts.map +1 -1
  33. package/dist/src/httpServer/handlerTypes.js +3 -0
  34. package/dist/src/httpServer/handlerTypes.js.map +1 -1
  35. package/dist/src/httpServer/server.d.ts.map +1 -1
  36. package/dist/src/httpServer/server.js +36 -12
  37. package/dist/src/httpServer/server.js.map +1 -1
  38. package/dist/src/index.d.ts +1 -1
  39. package/dist/src/index.d.ts.map +1 -1
  40. package/dist/src/index.js +4 -1
  41. package/dist/src/index.js.map +1 -1
  42. package/dist/src/kafka/kafka.d.ts +2 -3
  43. package/dist/src/kafka/kafka.d.ts.map +1 -1
  44. package/dist/src/kafka/kafka.js +2 -13
  45. package/dist/src/kafka/kafka.js.map +1 -1
  46. package/dist/src/scheduler/scheduler.d.ts +4 -8
  47. package/dist/src/scheduler/scheduler.d.ts.map +1 -1
  48. package/dist/src/scheduler/scheduler.js +2 -9
  49. package/dist/src/scheduler/scheduler.js.map +1 -1
  50. package/dist/src/system_database.d.ts +4 -0
  51. package/dist/src/system_database.d.ts.map +1 -1
  52. package/dist/src/system_database.js +102 -34
  53. package/dist/src/system_database.js.map +1 -1
  54. package/dist/src/telemetry/logs.d.ts.map +1 -1
  55. package/dist/src/telemetry/logs.js +13 -10
  56. package/dist/src/telemetry/logs.js.map +1 -1
  57. package/dist/src/telemetry/traces.d.ts +1 -0
  58. package/dist/src/telemetry/traces.d.ts.map +1 -1
  59. package/dist/src/telemetry/traces.js +5 -2
  60. package/dist/src/telemetry/traces.js.map +1 -1
  61. package/dist/src/testing/testing_runtime.d.ts +9 -5
  62. package/dist/src/testing/testing_runtime.d.ts.map +1 -1
  63. package/dist/src/testing/testing_runtime.js +24 -12
  64. package/dist/src/testing/testing_runtime.js.map +1 -1
  65. package/dist/src/transaction.d.ts +1 -1
  66. package/dist/src/transaction.d.ts.map +1 -1
  67. package/dist/src/utils.d.ts +6 -12
  68. package/dist/src/utils.d.ts.map +1 -1
  69. package/dist/src/utils.js +30 -13
  70. package/dist/src/utils.js.map +1 -1
  71. package/dist/src/workflow.d.ts +46 -10
  72. package/dist/src/workflow.d.ts.map +1 -1
  73. package/dist/src/workflow.js +78 -26
  74. package/dist/src/workflow.js.map +1 -1
  75. package/dist/tsconfig.build.tsbuildinfo +1 -1
  76. package/migrations/20240517000000_status_class_config.js +18 -0
  77. package/package.json +2 -2
  78. package/dist/src/dbos-runtime/applicationVersion.d.ts +0 -3
  79. package/dist/src/dbos-runtime/applicationVersion.d.ts.map +0 -1
  80. package/dist/src/dbos-runtime/applicationVersion.js +0 -13
  81. package/dist/src/dbos-runtime/applicationVersion.js.map +0 -1
@@ -148,7 +148,8 @@
148
148
  "application": {},
149
149
  "env": {},
150
150
  "version": {
151
- "type": "string"
151
+ "type": "string",
152
+ "deprecated": true
152
153
  }
153
154
  },
154
155
  "required": [
@@ -2,6 +2,8 @@ export interface workflow_status {
2
2
  workflow_uuid: string;
3
3
  status: string;
4
4
  name: string;
5
+ class_name?: string;
6
+ config_name?: string;
5
7
  authenticated_user: string;
6
8
  output: string;
7
9
  error: string;
@@ -1 +1 @@
1
- {"version":3,"file":"system_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/system_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAA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AChB;AAED,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -3,7 +3,7 @@ import { GlobalLogger as Logger } from "./telemetry/logs";
3
3
  import { WorkflowContextImpl } from "./workflow";
4
4
  import { DBOSContext, DBOSContextImpl } from "./context";
5
5
  import { WorkflowContextDebug } from "./debugger/debug_workflow";
6
- export type Communicator<T extends any[], R> = (ctxt: CommunicatorContext, ...args: T) => Promise<R>;
6
+ export type Communicator<T extends unknown[], R> = (ctxt: CommunicatorContext, ...args: T) => Promise<R>;
7
7
  export interface CommunicatorConfig {
8
8
  retriesAllowed?: boolean;
9
9
  intervalSeconds?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"communicator.d.ts","sourceRoot":"","sources":["../../src/communicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAErG,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IAEtD,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC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AAC,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;IAC7D,CAAC;CACF;AAjBD,0DAiBC"}
1
+ {"version":3,"file":"communicator.js","sourceRoot":"","sources":["../../src/communicator.ts"],"names":[],"mappings":";;;AAGA,uCAAyD;AAkBzD,MAAa,uBAAwB,SAAQ,yBAAe;IACjD,UAAU,CAAS;IACnB,cAAc,CAAU;IACxB,eAAe,CAAS;IACxB,WAAW,CAAS;IACpB,WAAW,CAAS;IAE7B,iCAAiC;IACjC,YAAY,eAA2D,EAAE,UAAkB,EAAE,IAAU,EAAE,MAAc,EACpH,MAA0B,EAAE,QAAgB;QAE7C,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;QACpD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;IAC7D,CAAC;CACF;AAnBD,0DAmBC"}
@@ -38,6 +38,8 @@ export declare class DBOSContextImpl implements DBOSContext {
38
38
  assumedRole: string;
39
39
  workflowUUID: string;
40
40
  executorID: string;
41
+ applicationVersion: string;
42
+ applicationID: string;
41
43
  readonly logger: DBOSLogger;
42
44
  constructor(operationName: string, span: Span, logger: Logger, parentCtx?: DBOSContextImpl);
43
45
  /*** Application configuration ***/
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,IAAI,E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AE,YAAY;IAM3C,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAK/B,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAI/D,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IACxC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC;CAS9C"}
@@ -12,7 +12,9 @@ class DBOSContextImpl {
12
12
  authenticatedRoles = []; // All roles the user has according to authentication
13
13
  assumedRole = ""; // Role in use - that user has and provided authorization to current function
14
14
  workflowUUID = ""; // Workflow UUID. Empty for HandlerContexts.
15
- executorID = "local"; // Executor ID. Gathered from request headers and "local" otherwise
15
+ executorID = process.env.DBOS__VMID || "local"; // Executor ID. Gathered from the environment and "local" otherwise
16
+ applicationVersion = process.env.DBOS__APPVERSION || ""; // Application version. Gathered from the environment and empty otherwise
17
+ applicationID = process.env.DBOS__APPID || ""; // Application ID. Gathered from the environment and empty otherwise
16
18
  logger; // Wrapper around the global logger for this context.
17
19
  constructor(operationName, span, logger, parentCtx) {
18
20
  this.operationName = operationName;
@@ -23,7 +25,6 @@ class DBOSContextImpl {
23
25
  this.authenticatedRoles = parentCtx.authenticatedRoles;
24
26
  this.assumedRole = parentCtx.assumedRole;
25
27
  this.workflowUUID = parentCtx.workflowUUID;
26
- this.executorID = parentCtx.executorID;
27
28
  }
28
29
  this.logger = new logs_1.Logger(logger, this);
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";;;AACA,2CAAgF;AAChF,mCAA6B;AAK7B,mCAAiD;AA8BjD,MAAa,eAAe;IASL;IAAgC;IARrD,OAAO,GAAgB,EAAE,CAAC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,WAAW,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;QACvD,sGAAsG;QACtG,IAAI,KAAK,IAAI,YAAY,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YAClE,MAAM,IAAI,8BAAsB,CAAC,GAAG,EAAE,OAAO,YAAY,EAAE,OAAO,KAAK,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AArCD,kCAqCC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Workflow, WorkflowConfig, WorkflowHandle, WorkflowParams, BufferedResult } from './workflow';
2
+ import { Workflow, WorkflowConfig, WorkflowHandle, WorkflowParams, WorkflowStatus, BufferedResult } from './workflow';
3
3
  import { Transaction, TransactionConfig } from './transaction';
4
4
  import { CommunicatorConfig, Communicator } from './communicator';
5
5
  import { TelemetryCollector } from './telemetry/collector';
@@ -9,7 +9,7 @@ import { TelemetryConfig } from './telemetry';
9
9
  import { PoolConfig } from 'pg';
10
10
  import { SystemDatabase } from './system_database';
11
11
  import { UserDatabase, UserDatabaseName } from './user_database';
12
- import { MethodRegistrationBase } from './decorators';
12
+ import { MethodRegistrationBase, ConfiguredInstance } from './decorators';
13
13
  export interface DBOSNull {
14
14
  }
15
15
  export declare const dbosNull: DBOSNull;
@@ -29,20 +29,21 @@ export interface DBOSConfig {
29
29
  };
30
30
  }
31
31
  interface WorkflowInfo {
32
- workflow: Workflow<any, any>;
32
+ workflow: Workflow<unknown[], unknown>;
33
33
  config: WorkflowConfig;
34
34
  }
35
35
  interface TransactionInfo {
36
- transaction: Transaction<any, any>;
36
+ transaction: Transaction<unknown[], unknown>;
37
37
  config: TransactionConfig;
38
38
  }
39
39
  interface CommunicatorInfo {
40
- communicator: Communicator<any, any>;
40
+ communicator: Communicator<unknown[], unknown>;
41
41
  config: CommunicatorConfig;
42
42
  }
43
43
  interface InternalWorkflowParams extends WorkflowParams {
44
44
  readonly tempWfType?: string;
45
45
  readonly tempWfName?: string;
46
+ readonly tempWfClass?: string;
46
47
  }
47
48
  export declare const OperationType: {
48
49
  readonly HANDLER: "handler";
@@ -78,14 +79,29 @@ export declare class DBOSExecutor {
78
79
  configureDbClient(): void;
79
80
  init(...classes: object[]): Promise<void>;
80
81
  destroy(): Promise<void>;
81
- workflow<T extends any[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, ...args: T): Promise<WorkflowHandle<R>>;
82
- internalWorkflow<T extends any[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
82
+ getWorkflowInfo(wf: Workflow<unknown[], unknown>): WorkflowInfo | undefined;
83
+ getWorkflowInfoByStatus(wf: WorkflowStatus): {
84
+ wfInfo: WorkflowInfo | undefined;
85
+ configuredInst: ConfiguredInstance | null;
86
+ };
87
+ getTransactionInfo(tf: Transaction<unknown[], unknown>): TransactionInfo | undefined;
88
+ getTransactionInfoByNames(className: string, functionName: string, cfgName: string): {
89
+ txnInfo: TransactionInfo | undefined;
90
+ clsInst: ConfiguredInstance | null;
91
+ };
92
+ getCommunicatorInfo(cf: Communicator<unknown[], unknown>): CommunicatorInfo | undefined;
93
+ getCommunicatorInfoByNames(className: string, functionName: string, cfgName: string): {
94
+ commInfo: CommunicatorInfo | undefined;
95
+ clsInst: ConfiguredInstance | null;
96
+ };
97
+ workflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, ...args: T): Promise<WorkflowHandle<R>>;
98
+ internalWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
83
99
  /**
84
100
  * DEBUG MODE workflow execution, skipping all the recording
85
101
  */
86
- debugWorkflow<T extends any[], R>(wf: Workflow<T, R>, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
87
- transaction<T extends any[], R>(txn: Transaction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
88
- external<T extends any[], R>(commFn: Communicator<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
102
+ debugWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
103
+ transaction<T extends unknown[], R>(txn: Transaction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
104
+ external<T extends unknown[], R>(commFn: Communicator<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
89
105
  send<T>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
90
106
  /**
91
107
  * Wait for a workflow to emit an event, then return its value.
@@ -99,7 +115,7 @@ export declare class DBOSExecutor {
99
115
  * A recovery process that by default runs during executor init time.
100
116
  * It runs to completion all pending workflows that were executing when the previous executor failed.
101
117
  */
102
- recoverPendingWorkflows(executorIDs?: string[]): Promise<WorkflowHandle<any>[]>;
118
+ recoverPendingWorkflows(executorIDs?: string[]): Promise<WorkflowHandle<unknown>[]>;
103
119
  executeWorkflowUUID(workflowUUID: string): Promise<WorkflowHandle<unknown>>;
104
120
  /**
105
121
  * Periodically flush the workflow output buffer to the system database.
@@ -1 +1 @@
1
- {"version":3,"file":"dbos-executor.d.ts","sourceRoot":"","sources":["../../src/dbos-executor.ts"],"names":[],"mappings":";AAQA,OAAO,EAEL,QAAQ,EACR,cAAc,EAEd,cAAc,EACd,cAAc,EAKd,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,kB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O,CAAC,CAAC,CAAC;IAc5G,IAAI,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1G;;OAEG;IACG,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,GAAE,MAAmD,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAI5I;;OAEG;IACH,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAS5D;;;OAGG;IACG,uBAAuB,CAAC,WAAW,GAAE,MAAM,EAAc,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;IAuB9F,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAiFjF;;OAEG;IACG,oBAAoB;IAQpB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiDhD,qBAAqB;CAatB"}
@@ -191,19 +191,13 @@ class DBOSExecutor {
191
191
  this.registeredOperations.push(...registeredClassOperations);
192
192
  for (const ro of registeredClassOperations) {
193
193
  if (ro.workflowConfig) {
194
- const wf = ro.registeredFunction;
195
- this.#registerWorkflow(wf, { ...ro.workflowConfig });
196
- this.logger.debug(`Registered workflow ${ro.name}`);
194
+ this.#registerWorkflow(ro);
197
195
  }
198
196
  else if (ro.txnConfig) {
199
- const tx = ro.registeredFunction;
200
- this.#registerTransaction(tx, ro.txnConfig);
201
- this.logger.debug(`Registered transaction ${ro.name}`);
197
+ this.#registerTransaction(ro);
202
198
  }
203
199
  else if (ro.commConfig) {
204
- const comm = ro.registeredFunction;
205
- this.#registerCommunicator(comm, ro.commConfig);
206
- this.logger.debug(`Registered communicator ${ro.name}`);
200
+ this.#registerCommunicator(ro);
207
201
  }
208
202
  }
209
203
  }
@@ -242,6 +236,13 @@ class DBOSExecutor {
242
236
  this.initialized = true;
243
237
  // Only execute init code if under non-debug mode
244
238
  if (!this.debugMode) {
239
+ for (const cls of classes) {
240
+ // Init its configurations
241
+ const creg = (0, decorators_1.getOrCreateClassRegistration)(cls);
242
+ for (const [_cfgname, cfg] of creg.configuredInstances) {
243
+ await cfg.initialize(new context_1.InitContext(this));
244
+ }
245
+ }
245
246
  for (const v of this.registeredOperations) {
246
247
  const m = v;
247
248
  if (m.init === true) {
@@ -271,35 +272,112 @@ class DBOSExecutor {
271
272
  await this.logger.destroy();
272
273
  }
273
274
  /* WORKFLOW OPERATIONS */
274
- #registerWorkflow(wf, config = {}) {
275
- if (wf.name === DBOSExecutor.tempWorkflowName || this.workflowInfoMap.has(wf.name)) {
276
- throw new error_1.DBOSError(`Repeated workflow name: ${wf.name}`);
275
+ #registerWorkflow(ro) {
276
+ const wf = ro.registeredFunction;
277
+ if (wf.name === DBOSExecutor.tempWorkflowName) {
278
+ throw new error_1.DBOSError(`Unexpected use of reserved workflow name: ${wf.name}`);
279
+ }
280
+ const wfn = ro.className + '.' + ro.name;
281
+ if (this.workflowInfoMap.has(wfn)) {
282
+ throw new error_1.DBOSError(`Repeated workflow name: ${wfn}`);
277
283
  }
278
284
  const workflowInfo = {
279
285
  workflow: wf,
280
- config: config,
286
+ config: { ...ro.workflowConfig },
281
287
  };
282
- this.workflowInfoMap.set(wf.name, workflowInfo);
288
+ this.workflowInfoMap.set(wfn, workflowInfo);
289
+ this.logger.debug(`Registered workflow ${wfn}`);
283
290
  }
284
- #registerTransaction(txn, params = {}) {
285
- if (this.transactionInfoMap.has(txn.name)) {
286
- throw new error_1.DBOSError(`Repeated Transaction name: ${txn.name}`);
291
+ #registerTransaction(ro) {
292
+ const txf = ro.registeredFunction;
293
+ const tfn = ro.className + '.' + ro.name;
294
+ if (this.transactionInfoMap.has(tfn)) {
295
+ throw new error_1.DBOSError(`Repeated Transaction name: ${tfn}`);
287
296
  }
288
297
  const txnInfo = {
289
- transaction: txn,
290
- config: params,
298
+ transaction: txf,
299
+ config: { ...ro.txnConfig },
291
300
  };
292
- this.transactionInfoMap.set(txn.name, txnInfo);
301
+ this.transactionInfoMap.set(tfn, txnInfo);
302
+ this.logger.debug(`Registered transaction ${tfn}`);
293
303
  }
294
- #registerCommunicator(comm, params = {}) {
295
- if (this.communicatorInfoMap.has(comm.name)) {
296
- throw new error_1.DBOSError(`Repeated Commmunicator name: ${comm.name}`);
304
+ #registerCommunicator(ro) {
305
+ const comm = ro.registeredFunction;
306
+ const cfn = ro.className + '.' + ro.name;
307
+ if (this.communicatorInfoMap.has(cfn)) {
308
+ throw new error_1.DBOSError(`Repeated Commmunicator name: ${cfn}`);
297
309
  }
298
310
  const commInfo = {
299
311
  communicator: comm,
300
- config: params,
312
+ config: { ...ro.commConfig },
301
313
  };
302
- this.communicatorInfoMap.set(comm.name, commInfo);
314
+ this.communicatorInfoMap.set(cfn, commInfo);
315
+ this.logger.debug(`Registered communicator ${cfn}`);
316
+ }
317
+ getWorkflowInfo(wf) {
318
+ const wfname = (wf.name === DBOSExecutor.tempWorkflowName)
319
+ ? wf.name
320
+ : (0, decorators_1.getRegisteredMethodClassName)(wf) + '.' + wf.name;
321
+ return this.workflowInfoMap.get(wfname);
322
+ }
323
+ getWorkflowInfoByStatus(wf) {
324
+ const wfname = wf.workflowClassName + '.' + wf.workflowName;
325
+ let wfInfo = this.workflowInfoMap.get(wfname);
326
+ if (!wfInfo && !wf.workflowClassName) {
327
+ for (const [_wfn, wfr] of this.workflowInfoMap) {
328
+ if (wf.workflowName === wfr.workflow.name) {
329
+ if (wfInfo) {
330
+ throw new error_1.DBOSError(`Recovered workflow function name '${wf.workflowName}' is ambiguous. The ambiguous name was recently added; remove it and recover pending workflows before re-adding the new function.`);
331
+ }
332
+ else {
333
+ wfInfo = wfr;
334
+ }
335
+ }
336
+ }
337
+ }
338
+ return { wfInfo, configuredInst: (0, decorators_1.getConfiguredInstance)(wf.workflowClassName, wf.workflowConfigName) };
339
+ }
340
+ getTransactionInfo(tf) {
341
+ const tfname = (0, decorators_1.getRegisteredMethodClassName)(tf) + '.' + tf.name;
342
+ return this.transactionInfoMap.get(tfname);
343
+ }
344
+ getTransactionInfoByNames(className, functionName, cfgName) {
345
+ const tfname = className + '.' + functionName;
346
+ let txnInfo = this.transactionInfoMap.get(tfname);
347
+ if (!txnInfo && !className) {
348
+ for (const [_wfn, tfr] of this.transactionInfoMap) {
349
+ if (functionName === tfr.transaction.name) {
350
+ if (txnInfo) {
351
+ throw new error_1.DBOSError(`Recovered transaction function name '${functionName}' is ambiguous. The ambiguous name was recently added; remove it and recover pending workflows before re-adding the new function.`);
352
+ }
353
+ else {
354
+ txnInfo = tfr;
355
+ }
356
+ }
357
+ }
358
+ }
359
+ return { txnInfo, clsInst: (0, decorators_1.getConfiguredInstance)(className, cfgName) };
360
+ }
361
+ getCommunicatorInfo(cf) {
362
+ const cfname = (0, decorators_1.getRegisteredMethodClassName)(cf) + '.' + cf.name;
363
+ return this.communicatorInfoMap.get(cfname);
364
+ }
365
+ getCommunicatorInfoByNames(className, functionName, cfgName) {
366
+ const cfname = className + '.' + functionName;
367
+ let commInfo = this.communicatorInfoMap.get(cfname);
368
+ if (!commInfo && !className) {
369
+ for (const [_wfn, cfr] of this.communicatorInfoMap) {
370
+ if (functionName === cfr.communicator.name) {
371
+ if (commInfo) {
372
+ throw new error_1.DBOSError(`Recovered communicator function name '${functionName}' is ambiguous. The ambiguous name was recently added; remove it and recover pending workflows before re-adding the new function.`);
373
+ }
374
+ else {
375
+ commInfo = cfr;
376
+ }
377
+ }
378
+ }
379
+ }
380
+ return { commInfo, clsInst: (0, decorators_1.getConfiguredInstance)(className, cfgName) };
303
381
  }
304
382
  async workflow(wf, params, ...args) {
305
383
  if (this.debugMode) {
@@ -311,20 +389,18 @@ class DBOSExecutor {
311
389
  async internalWorkflow(wf, params, callerUUID, callerFunctionID, ...args) {
312
390
  const workflowUUID = params.workflowUUID ? params.workflowUUID : this.#generateUUID();
313
391
  const presetUUID = params.workflowUUID ? true : false;
314
- const wInfo = this.workflowInfoMap.get(wf.name);
392
+ const wInfo = this.getWorkflowInfo(wf);
315
393
  if (wInfo === undefined) {
316
394
  throw new error_1.DBOSNotRegisteredError(wf.name);
317
395
  }
318
396
  const wConfig = wInfo.config;
319
397
  const wCtxt = new workflow_1.WorkflowContextImpl(this, params.parentCtx, workflowUUID, wConfig, wf.name, presetUUID, params.tempWfType, params.tempWfName);
320
- // If running in DBOS Cloud, set the executor ID
321
- if (process.env.DBOS__VMID) {
322
- wCtxt.executorID = process.env.DBOS__VMID;
323
- }
324
398
  const internalStatus = {
325
399
  workflowUUID: workflowUUID,
326
400
  status: workflow_1.StatusString.PENDING,
327
401
  name: wf.name,
402
+ className: wCtxt.isTempWorkflow ? "" : (0, decorators_1.getRegisteredMethodClassName)(wf),
403
+ configName: params.configuredInstance?.name || "",
328
404
  authenticatedUser: wCtxt.authenticatedUser,
329
405
  output: undefined,
330
406
  error: "",
@@ -332,10 +408,13 @@ class DBOSExecutor {
332
408
  authenticatedRoles: wCtxt.authenticatedRoles,
333
409
  request: wCtxt.request,
334
410
  executorID: wCtxt.executorID,
335
- createdAt: Date.now() // Remember the start time of this workflow
411
+ applicationVersion: wCtxt.applicationVersion,
412
+ applicationID: wCtxt.applicationID,
413
+ createdAt: Date.now(), // Remember the start time of this workflow
336
414
  };
337
415
  if (wCtxt.isTempWorkflow) {
338
416
  internalStatus.name = `${DBOSExecutor.tempWorkflowName}-${wCtxt.tempWfOperationType}-${wCtxt.tempWfOperationName}`;
417
+ internalStatus.className = params.tempWfClass ?? "";
339
418
  }
340
419
  // Synchronously set the workflow's status to PENDING and record workflow inputs (for non single-transaction workflows).
341
420
  // We have to do it for all types of workflows because operation_outputs table has a foreign key constraint on workflow status table.
@@ -346,7 +425,7 @@ class DBOSExecutor {
346
425
  let result;
347
426
  // Execute the workflow.
348
427
  try {
349
- result = await wf(wCtxt, ...args);
428
+ result = await wf.call(params.configuredInstance, wCtxt, ...args);
350
429
  internalStatus.output = result;
351
430
  internalStatus.status = workflow_1.StatusString.SUCCESS;
352
431
  this.systemDatabase.bufferWorkflowOutput(workflowUUID, internalStatus);
@@ -367,7 +446,7 @@ class DBOSExecutor {
367
446
  if (wCtxt.isTempWorkflow) {
368
447
  internalStatus.name = `${DBOSExecutor.tempWorkflowName}-${wCtxt.tempWfOperationType}-${wCtxt.tempWfOperationName}`;
369
448
  }
370
- internalStatus.error = JSON.stringify((0, serialize_error_1.serializeError)(e));
449
+ internalStatus.error = utils_1.DBOSJSON.stringify((0, serialize_error_1.serializeError)(e));
371
450
  internalStatus.status = workflow_1.StatusString.ERROR;
372
451
  await this.systemDatabase.recordWorkflowError(workflowUUID, internalStatus);
373
452
  // TODO: Log errors, but not in the tests when they're expected.
@@ -412,7 +491,7 @@ class DBOSExecutor {
412
491
  throw new error_1.DBOSDebuggerError("Workflow UUID not found!");
413
492
  }
414
493
  const workflowUUID = params.workflowUUID;
415
- const wInfo = this.workflowInfoMap.get(wf.name);
494
+ const wInfo = this.getWorkflowInfo(wf);
416
495
  if (wInfo === undefined) {
417
496
  throw new error_1.DBOSDebuggerError("Workflow unregistered! " + wf.name);
418
497
  }
@@ -425,18 +504,18 @@ class DBOSExecutor {
425
504
  throw new error_1.DBOSDebuggerError("Workflow status or inputs not found! UUID: " + workflowUUID);
426
505
  }
427
506
  // Make sure we use the same input.
428
- if (JSON.stringify(args) !== JSON.stringify(recordedInputs)) {
429
- throw new error_1.DBOSDebuggerError(`Detect different input for the workflow UUID ${workflowUUID}!\n Received: ${JSON.stringify(args)}\n Original: ${JSON.stringify(recordedInputs)}`);
507
+ if (utils_1.DBOSJSON.stringify(args) !== utils_1.DBOSJSON.stringify(recordedInputs)) {
508
+ throw new error_1.DBOSDebuggerError(`Detect different input for the workflow UUID ${workflowUUID}!\n Received: ${utils_1.DBOSJSON.stringify(args)}\n Original: ${utils_1.DBOSJSON.stringify(recordedInputs)}`);
430
509
  }
431
- const workflowPromise = wf(wCtxt, ...args)
510
+ const workflowPromise = wf.call(params.configuredInstance, wCtxt, ...args)
432
511
  .then(async (result) => {
433
512
  // Check if the result is the same.
434
513
  const recordedResult = await this.systemDatabase.getWorkflowResult(workflowUUID);
435
514
  if (result === undefined && !recordedResult) {
436
515
  return result;
437
516
  }
438
- if (JSON.stringify(result) !== JSON.stringify(recordedResult)) {
439
- this.logger.error(`Detect different output for the workflow UUID ${workflowUUID}!\n Received: ${JSON.stringify(result)}\n Original: ${JSON.stringify(recordedResult)}`);
517
+ if (utils_1.DBOSJSON.stringify(result) !== utils_1.DBOSJSON.stringify(recordedResult)) {
518
+ this.logger.error(`Detect different output for the workflow UUID ${workflowUUID}!\n Received: ${utils_1.DBOSJSON.stringify(result)}\n Original: ${utils_1.DBOSJSON.stringify(recordedResult)}`);
440
519
  }
441
520
  return recordedResult; // Always return the recorded result.
442
521
  });
@@ -446,17 +525,27 @@ class DBOSExecutor {
446
525
  // Create a workflow and call transaction.
447
526
  const temp_workflow = async (ctxt, ...args) => {
448
527
  const ctxtImpl = ctxt;
449
- return await ctxtImpl.transaction(txn, ...args);
528
+ return await ctxtImpl.transaction(txn, params.configuredInstance ?? null, ...args);
450
529
  };
451
- return (await this.workflow(temp_workflow, { ...params, tempWfType: TempWorkflowType.transaction, tempWfName: txn.name }, ...args)).getResult();
530
+ return (await this.workflow(temp_workflow, {
531
+ ...params,
532
+ tempWfType: TempWorkflowType.transaction,
533
+ tempWfName: (0, decorators_1.getRegisteredMethodName)(txn),
534
+ tempWfClass: (0, decorators_1.getRegisteredMethodClassName)(txn),
535
+ }, ...args)).getResult();
452
536
  }
453
537
  async external(commFn, params, ...args) {
454
538
  // Create a workflow and call external.
455
539
  const temp_workflow = async (ctxt, ...args) => {
456
540
  const ctxtImpl = ctxt;
457
- return await ctxtImpl.external(commFn, ...args);
541
+ return await ctxtImpl.external(commFn, params.configuredInstance ?? null, ...args);
458
542
  };
459
- return (await this.workflow(temp_workflow, { ...params, tempWfType: TempWorkflowType.external, tempWfName: commFn.name }, ...args)).getResult();
543
+ return (await this.workflow(temp_workflow, {
544
+ ...params,
545
+ tempWfType: TempWorkflowType.external,
546
+ tempWfName: (0, decorators_1.getRegisteredMethodName)(commFn),
547
+ tempWfClass: (0, decorators_1.getRegisteredMethodClassName)(commFn),
548
+ }, ...args)).getResult();
460
549
  }
461
550
  async send(destinationUUID, message, topic, idempotencyKey) {
462
551
  // Create a workflow and call send.
@@ -464,7 +553,7 @@ class DBOSExecutor {
464
553
  return await ctxt.send(destinationUUID, message, topic);
465
554
  };
466
555
  const workflowUUID = idempotencyKey ? destinationUUID + idempotencyKey : undefined;
467
- return (await this.workflow(temp_workflow, { workflowUUID: workflowUUID, tempWfType: TempWorkflowType.send }, destinationUUID, message, topic)).getResult();
556
+ return (await this.workflow(temp_workflow, { workflowUUID: workflowUUID, tempWfType: TempWorkflowType.send, configuredInstance: null }, destinationUUID, message, topic)).getResult();
468
557
  }
469
558
  /**
470
559
  * Wait for a workflow to emit an event, then return its value.
@@ -516,54 +605,56 @@ class DBOSExecutor {
516
605
  throw new error_1.DBOSError(`Failed to find inputs for workflow UUID: ${workflowUUID}`);
517
606
  }
518
607
  const parentCtx = this.#getRecoveryContext(workflowUUID, wfStatus);
519
- const wfInfo = this.workflowInfoMap.get(wfStatus.workflowName);
608
+ const { wfInfo, configuredInst } = this.getWorkflowInfoByStatus(wfStatus);
520
609
  if (wfInfo) {
521
610
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
522
- return this.workflow(wfInfo.workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx ?? undefined }, ...inputs);
611
+ return this.workflow(wfInfo.workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx, configuredInstance: configuredInst }, ...inputs);
523
612
  }
524
613
  // Should be temporary workflows. Parse the name of the workflow.
525
614
  const wfName = wfStatus.workflowName;
526
615
  const nameArr = wfName.split("-");
527
616
  if (!nameArr[0].startsWith(DBOSExecutor.tempWorkflowName)) {
617
+ // CB - Doesn't this happen if the user changed the function name in their code?
528
618
  throw new error_1.DBOSError(`This should never happen! Cannot find workflow info for a non-temporary workflow! UUID ${workflowUUID}, name ${wfName}`);
529
619
  }
530
620
  let temp_workflow;
621
+ let clsinst = null;
531
622
  if (nameArr[1] === TempWorkflowType.transaction) {
532
- const txnInfo = this.transactionInfoMap.get(nameArr[2]);
623
+ const { txnInfo, clsInst } = this.getTransactionInfoByNames(wfStatus.workflowClassName, nameArr[2], wfStatus.workflowConfigName);
533
624
  if (!txnInfo) {
534
625
  this.logger.error(`Cannot find transaction info for UUID ${workflowUUID}, name ${nameArr[2]}`);
535
626
  throw new error_1.DBOSNotRegisteredError(nameArr[2]);
536
627
  }
537
628
  temp_workflow = async (ctxt, ...args) => {
538
629
  const ctxtImpl = ctxt;
539
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument
540
- return await ctxtImpl.transaction(txnInfo.transaction, ...args);
630
+ return await ctxtImpl.transaction(txnInfo.transaction, clsInst, ...args);
541
631
  };
632
+ clsinst = clsInst;
542
633
  }
543
634
  else if (nameArr[1] === TempWorkflowType.external) {
544
- const commInfo = this.communicatorInfoMap.get(nameArr[2]);
635
+ const { commInfo, clsInst } = this.getCommunicatorInfoByNames(wfStatus.workflowClassName, nameArr[2], wfStatus.workflowConfigName);
545
636
  if (!commInfo) {
546
637
  this.logger.error(`Cannot find communicator info for UUID ${workflowUUID}, name ${nameArr[2]}`);
547
638
  throw new error_1.DBOSNotRegisteredError(nameArr[2]);
548
639
  }
549
640
  temp_workflow = async (ctxt, ...args) => {
550
641
  const ctxtImpl = ctxt;
551
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument
552
- return await ctxtImpl.external(commInfo.communicator, ...args);
642
+ return await ctxtImpl.external(commInfo.communicator, clsInst, ...args);
553
643
  };
644
+ clsinst = clsInst;
554
645
  }
555
646
  else if (nameArr[1] === TempWorkflowType.send) {
556
647
  temp_workflow = async (ctxt, ...args) => {
557
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
558
- return await ctxt.send(args[0], args[1], args[2]);
648
+ return await ctxt.send(args[0], args[1], args[2]); // id, value, topic
559
649
  };
650
+ clsinst = null;
560
651
  }
561
652
  else {
562
653
  this.logger.error(`Unrecognized temporary workflow! UUID ${workflowUUID}, name ${wfName}`);
563
654
  throw new error_1.DBOSNotRegisteredError(wfName);
564
655
  }
565
656
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
566
- return this.workflow(temp_workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx ?? undefined }, ...inputs);
657
+ return this.workflow(temp_workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx ?? undefined, configuredInstance: clsinst }, ...inputs);
567
658
  }
568
659
  // NOTE: this creates a new span, it does not inherit the span from the original workflow
569
660
  #getRecoveryContext(workflowUUID, status) {
@@ -615,7 +706,7 @@ class DBOSExecutor {
615
706
  sqlStmt += ", ";
616
707
  }
617
708
  sqlStmt += `($${paramCnt++}, $${paramCnt++}, $${paramCnt++}, $${paramCnt++}, null, $${paramCnt++}, $${paramCnt++})`;
618
- values.push(workflowUUID, funcID, JSON.stringify(output), JSON.stringify(null), txnSnapshot, createdAt);
709
+ values.push(workflowUUID, funcID, utils_1.DBOSJSON.stringify(output), utils_1.DBOSJSON.stringify(null), txnSnapshot, createdAt);
619
710
  }
620
711
  batchUUIDs.push(workflowUUID);
621
712
  finishedCnt++;
@@ -647,10 +738,10 @@ class DBOSExecutor {
647
738
  this.registeredOperations.forEach((registeredOperation) => {
648
739
  const ro = registeredOperation;
649
740
  if (ro.apiURL) {
650
- this.logger.info(" " + ro.apiType.padEnd(4) + " : " + ro.apiURL);
741
+ this.logger.info(" " + ro.apiType.padEnd(6) + " : " + ro.apiURL);
651
742
  const roles = ro.getRequiredRoles();
652
743
  if (roles.length > 0) {
653
- this.logger.info(" Required Roles: " + JSON.stringify(roles));
744
+ this.logger.info(" Required Roles: " + utils_1.DBOSJSON.stringify(roles));
654
745
  }
655
746
  }
656
747
  });