@dbos-inc/dbos-sdk 3.5.8 → 3.5.44-preview.gc094fdab44

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.
Files changed (119) hide show
  1. package/README.md +0 -6
  2. package/dist/src/{httpServer/server.d.ts → adminserver.d.ts} +6 -15
  3. package/dist/src/adminserver.d.ts.map +1 -0
  4. package/dist/src/{httpServer/server.js → adminserver.js} +28 -311
  5. package/dist/src/adminserver.js.map +1 -0
  6. package/dist/src/{dbos-runtime → cli}/cli.d.ts +1 -1
  7. package/dist/src/cli/cli.d.ts.map +1 -0
  8. package/dist/src/{dbos-runtime → cli}/cli.js +3 -12
  9. package/dist/src/cli/cli.js.map +1 -0
  10. package/dist/src/cli/commands.d.ts.map +1 -0
  11. package/dist/src/cli/commands.js.map +1 -0
  12. package/dist/src/cli/docker_pg_helper.d.ts.map +1 -0
  13. package/dist/src/cli/docker_pg_helper.js.map +1 -0
  14. package/dist/src/cli/migrate.d.ts +3 -0
  15. package/dist/src/cli/migrate.d.ts.map +1 -0
  16. package/dist/src/{dbos-runtime → cli}/migrate.js +1 -29
  17. package/dist/src/cli/migrate.js.map +1 -0
  18. package/dist/src/client.d.ts +2 -4
  19. package/dist/src/client.d.ts.map +1 -1
  20. package/dist/src/client.js +6 -19
  21. package/dist/src/client.js.map +1 -1
  22. package/dist/src/conductor/conductor.js +1 -1
  23. package/dist/src/conductor/conductor.js.map +1 -1
  24. package/dist/src/{dbos-runtime/config.d.ts → config.d.ts} +2 -6
  25. package/dist/src/config.d.ts.map +1 -0
  26. package/dist/src/{dbos-runtime/config.js → config.js} +9 -43
  27. package/dist/src/config.js.map +1 -0
  28. package/dist/src/context.d.ts +0 -3
  29. package/dist/src/context.d.ts.map +1 -1
  30. package/dist/src/context.js.map +1 -1
  31. package/dist/src/dbos-executor.d.ts +2 -27
  32. package/dist/src/dbos-executor.d.ts.map +1 -1
  33. package/dist/src/dbos-executor.js +21 -787
  34. package/dist/src/dbos-executor.js.map +1 -1
  35. package/dist/src/dbos.d.ts +2 -196
  36. package/dist/src/dbos.d.ts.map +1 -1
  37. package/dist/src/dbos.js +11 -407
  38. package/dist/src/dbos.js.map +1 -1
  39. package/dist/src/decorators.d.ts +4 -38
  40. package/dist/src/decorators.d.ts.map +1 -1
  41. package/dist/src/decorators.js +9 -164
  42. package/dist/src/decorators.js.map +1 -1
  43. package/dist/src/error.d.ts +0 -8
  44. package/dist/src/error.d.ts.map +1 -1
  45. package/dist/src/error.js +1 -14
  46. package/dist/src/error.js.map +1 -1
  47. package/dist/src/index.d.ts +3 -12
  48. package/dist/src/index.d.ts.map +1 -1
  49. package/dist/src/index.js +1 -40
  50. package/dist/src/index.js.map +1 -1
  51. package/dist/src/utils.d.ts +1 -22
  52. package/dist/src/utils.d.ts.map +1 -1
  53. package/dist/src/utils.js +20 -172
  54. package/dist/src/utils.js.map +1 -1
  55. package/dist/src/wfqueue.d.ts +0 -2
  56. package/dist/src/wfqueue.d.ts.map +1 -1
  57. package/dist/src/wfqueue.js +1 -1
  58. package/dist/src/wfqueue.js.map +1 -1
  59. package/dist/src/workflow.d.ts +0 -8
  60. package/dist/src/workflow.d.ts.map +1 -1
  61. package/dist/src/workflow.js +0 -11
  62. package/dist/src/workflow.js.map +1 -1
  63. package/dist/src/{dbos-runtime/workflow_management.d.ts → workflow_management.d.ts} +4 -6
  64. package/dist/src/workflow_management.d.ts.map +1 -0
  65. package/dist/src/{dbos-runtime/workflow_management.js → workflow_management.js} +5 -26
  66. package/dist/src/workflow_management.js.map +1 -0
  67. package/dist/tsconfig.tsbuildinfo +1 -1
  68. package/package.json +4 -28
  69. package/dist/schemas/user_db_schema.d.ts +0 -15
  70. package/dist/schemas/user_db_schema.d.ts.map +0 -1
  71. package/dist/schemas/user_db_schema.js +0 -33
  72. package/dist/schemas/user_db_schema.js.map +0 -1
  73. package/dist/src/dbos-runtime/cli.d.ts.map +0 -1
  74. package/dist/src/dbos-runtime/cli.js.map +0 -1
  75. package/dist/src/dbos-runtime/commands.d.ts.map +0 -1
  76. package/dist/src/dbos-runtime/commands.js.map +0 -1
  77. package/dist/src/dbos-runtime/config.d.ts.map +0 -1
  78. package/dist/src/dbos-runtime/config.js.map +0 -1
  79. package/dist/src/dbos-runtime/docker_pg_helper.d.ts.map +0 -1
  80. package/dist/src/dbos-runtime/docker_pg_helper.js.map +0 -1
  81. package/dist/src/dbos-runtime/migrate.d.ts +0 -3
  82. package/dist/src/dbos-runtime/migrate.d.ts.map +0 -1
  83. package/dist/src/dbos-runtime/migrate.js.map +0 -1
  84. package/dist/src/dbos-runtime/workflow_management.d.ts.map +0 -1
  85. package/dist/src/dbos-runtime/workflow_management.js.map +0 -1
  86. package/dist/src/httpServer/handler.d.ts +0 -13
  87. package/dist/src/httpServer/handler.d.ts.map +0 -1
  88. package/dist/src/httpServer/handler.js +0 -25
  89. package/dist/src/httpServer/handler.js.map +0 -1
  90. package/dist/src/httpServer/handlerTypes.d.ts +0 -14
  91. package/dist/src/httpServer/handlerTypes.d.ts.map +0 -1
  92. package/dist/src/httpServer/handlerTypes.js +0 -22
  93. package/dist/src/httpServer/handlerTypes.js.map +0 -1
  94. package/dist/src/httpServer/middleware.d.ts +0 -74
  95. package/dist/src/httpServer/middleware.d.ts.map +0 -1
  96. package/dist/src/httpServer/middleware.js +0 -108
  97. package/dist/src/httpServer/middleware.js.map +0 -1
  98. package/dist/src/httpServer/server.d.ts.map +0 -1
  99. package/dist/src/httpServer/server.js.map +0 -1
  100. package/dist/src/paramdecorators.d.ts +0 -39
  101. package/dist/src/paramdecorators.d.ts.map +0 -1
  102. package/dist/src/paramdecorators.js +0 -365
  103. package/dist/src/paramdecorators.js.map +0 -1
  104. package/dist/src/procedure.d.ts +0 -18
  105. package/dist/src/procedure.d.ts.map +0 -1
  106. package/dist/src/procedure.js +0 -3
  107. package/dist/src/procedure.js.map +0 -1
  108. package/dist/src/transaction.d.ts +0 -19
  109. package/dist/src/transaction.d.ts.map +0 -1
  110. package/dist/src/transaction.js +0 -11
  111. package/dist/src/transaction.js.map +0 -1
  112. package/dist/src/user_database.d.ts +0 -176
  113. package/dist/src/user_database.d.ts.map +0 -1
  114. package/dist/src/user_database.js +0 -540
  115. package/dist/src/user_database.js.map +0 -1
  116. /package/dist/src/{dbos-runtime → cli}/commands.d.ts +0 -0
  117. /package/dist/src/{dbos-runtime → cli}/commands.js +0 -0
  118. /package/dist/src/{dbos-runtime → cli}/docker_pg_helper.d.ts +0 -0
  119. /package/dist/src/{dbos-runtime → cli}/docker_pg_helper.js +0 -0
package/dist/src/dbos.js CHANGED
@@ -3,39 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.InitContext = exports.DBOS = exports.runInternalStep = exports.getExecutor = void 0;
6
+ exports.DBOS = exports.runInternalStep = exports.getExecutor = void 0;
7
7
  const context_1 = require("./context");
8
8
  const dbos_executor_1 = require("./dbos-executor");
9
9
  const traces_1 = require("./telemetry/traces");
10
10
  const workflow_1 = require("./workflow");
11
11
  const logs_1 = require("./telemetry/logs");
12
12
  const error_1 = require("./error");
13
- const config_1 = require("./dbos-runtime/config");
13
+ const config_1 = require("./config");
14
14
  const scheduler_1 = require("./scheduler/scheduler");
15
15
  const decorators_1 = require("./decorators");
16
16
  const utils_1 = require("./utils");
17
- const server_1 = require("./httpServer/server");
18
- const user_database_1 = require("./user_database");
17
+ const adminserver_1 = require("./adminserver");
19
18
  const node_crypto_1 = require("node:crypto");
20
- const _1 = require(".");
21
- const _2 = require(".");
22
- const handlerTypes_1 = require("./httpServer/handlerTypes");
23
19
  const conductor_1 = require("./conductor/conductor");
24
20
  const system_database_1 = require("./system_database");
25
21
  const wfqueue_1 = require("./wfqueue");
26
22
  const authdecorators_1 = require("./authdecorators");
27
23
  const node_assert_1 = __importDefault(require("node:assert"));
28
24
  const api_1 = require("@opentelemetry/api");
29
- function httpApiDec(verb, url) {
30
- return function apidec(target, propertyKey, inDescriptor) {
31
- const { descriptor, registration } = (0, decorators_1.wrapDBOSFunctionAndRegisterDec)(target, propertyKey, inDescriptor);
32
- const handlerRegistration = registration;
33
- handlerRegistration.apiURL = url;
34
- handlerRegistration.apiType = verb;
35
- (0, _1.requestArgValidation)(registration);
36
- return descriptor;
37
- };
38
- }
39
25
  function getExecutor() {
40
26
  if (!dbos_executor_1.DBOSExecutor.globalInstance) {
41
27
  throw new error_1.DBOSExecutorNotInitializedError();
@@ -64,7 +50,6 @@ class DBOS {
64
50
  // Lifecycle
65
51
  ///////
66
52
  static adminServer = undefined;
67
- static appServer = undefined;
68
53
  static conductor = undefined;
69
54
  /**
70
55
  * Set configuration of `DBOS` prior to `launch`
@@ -74,26 +59,6 @@ class DBOS {
74
59
  (0, node_assert_1.default)(!DBOS.isInitialized(), 'Cannot call DBOS.setConfig after DBOS.launch');
75
60
  DBOS.#dbosConfig = config;
76
61
  }
77
- /**
78
- * Use ORMEntities to set up database schema.
79
- * Only relevant for TypeORM, and for testing purposes only, not production
80
- * @deprecated - use data source packages such as `@dbos-inc/typeorm-datasource`
81
- */
82
- static async createUserSchema() {
83
- return dbos_executor_1.DBOSExecutor.globalInstance?.createUserSchema();
84
- }
85
- /**
86
- * Use ORMEntities to drop database schema.
87
- * Only relevant for TypeORM, and for testing purposes only, not production
88
- * @deprecated - use data source packages such as `@dbos-inc/typeorm-datasource`
89
- */
90
- static async dropUserSchema() {
91
- return dbos_executor_1.DBOSExecutor.globalInstance?.dropUserSchema();
92
- }
93
- // Load files with DBOS classes (running their decorators)
94
- static async loadClasses(dbosEntrypointFiles) {
95
- return await dbos_executor_1.DBOSExecutor.loadClasses(dbosEntrypointFiles);
96
- }
97
62
  /**
98
63
  * Check if DBOS has been `launch`ed (and not `shutdown`)
99
64
  * @returns `true` if DBOS has been launched, or `false` otherwise
@@ -134,7 +99,6 @@ class DBOS {
134
99
  [internalConfig, runtimeConfig] = (0, config_1.overwriteConfigForDBOSCloud)(internalConfig, runtimeConfig, configFile);
135
100
  }
136
101
  DBOS.#port = runtimeConfig.port;
137
- DBOS.#userDbClient = internalConfig.userDbClient;
138
102
  dbos_executor_1.DBOSExecutor.createDebouncerWorkflow();
139
103
  dbos_executor_1.DBOSExecutor.createInternalQueue();
140
104
  dbos_executor_1.DBOSExecutor.globalInstance = new dbos_executor_1.DBOSExecutor(internalConfig, { debugMode });
@@ -166,9 +130,9 @@ class DBOS {
166
130
  // Start the DBOS admin server
167
131
  const logger = DBOS.logger;
168
132
  if (runtimeConfig.runAdminServer) {
169
- const adminApp = server_1.DBOSHttpServer.setupAdminApp(executor);
133
+ const adminApp = adminserver_1.DBOSAdminServer.setupAdminApp(executor);
170
134
  try {
171
- await server_1.DBOSHttpServer.checkPortAvailabilityIPv4Ipv6(runtimeConfig.admin_port, logger);
135
+ await adminserver_1.DBOSAdminServer.checkPortAvailabilityIPv4Ipv6(runtimeConfig.admin_port, logger);
172
136
  // Wrap the listen call in a promise to properly catch errors
173
137
  DBOS.adminServer = await new Promise((resolve, reject) => {
174
138
  const server = adminApp.listen(runtimeConfig?.admin_port, () => {
@@ -195,7 +159,6 @@ class DBOS {
195
159
  static logRegisteredEndpoints() {
196
160
  if (!dbos_executor_1.DBOSExecutor.globalInstance)
197
161
  return;
198
- dbos_executor_1.DBOSExecutor.globalInstance.logRegisteredHTTPUrls();
199
162
  wfqueue_1.wfQueueRunner.logRegisteredEndpoints(dbos_executor_1.DBOSExecutor.globalInstance);
200
163
  for (const lcl of (0, decorators_1.getLifecycleListeners)()) {
201
164
  lcl.logRegisteredEndpoints?.();
@@ -208,11 +171,6 @@ class DBOS {
208
171
  * Stops workflow processing and disconnects from databases
209
172
  */
210
173
  static async shutdown() {
211
- // Stop the app server
212
- if (DBOS.appServer) {
213
- DBOS.appServer.close();
214
- DBOS.appServer = undefined;
215
- }
216
174
  // Stop the admin server
217
175
  if (DBOS.adminServer) {
218
176
  DBOS.adminServer.close();
@@ -254,60 +212,18 @@ class DBOS {
254
212
  static get #executor() {
255
213
  return getExecutor();
256
214
  }
257
- /**
258
- * Creates a node.js HTTP handler for all entrypoints registered with `@DBOS.getApi`
259
- * and other decorators. The handler can be retrieved with `DBOS.getHTTPHandlersCallback()`.
260
- * This method does not start listening for requests. For that, call `DBOS.launchAppHTTPServer()`.
261
- * @deprecated - use `@dbos-inc/koa-serve`
262
- */
263
- static setUpHandlerCallback() {
264
- if (!dbos_executor_1.DBOSExecutor.globalInstance) {
265
- throw new error_1.DBOSExecutorNotInitializedError();
266
- }
267
- // Create the DBOS HTTP server
268
- // This may be a no-op if there are no registered endpoints
269
- const server = new server_1.DBOSHttpServer(dbos_executor_1.DBOSExecutor.globalInstance);
270
- return server;
271
- }
272
- /**
273
- * Creates a node.js HTTP handler for all entrypoints registered with `@DBOS.getApi`
274
- * and other decorators. This method also starts listening for requests, on the port
275
- * specified in the `DBOSRuntimeConfig`.
276
- * @deprecated - use `@dbos-inc/koa-serve`
277
- */
278
- static async launchAppHTTPServer() {
279
- const server = DBOS.setUpHandlerCallback();
280
- if (DBOS.#port) {
281
- // This will not listen if there's no decorated endpoint
282
- DBOS.appServer = await server.appListen(DBOS.#port);
283
- }
284
- }
285
- /**
286
- * Retrieves the HTTP handlers callback for DBOS HTTP.
287
- * (This is the one that handles the @DBOS.getApi, etc., methods.)
288
- * Useful for testing purposes, or to combine the DBOS service with other
289
- * node.js HTTP server frameworks.
290
- * @deprecated - use `@dbos-inc/koa-serve`
291
- */
292
- static getHTTPHandlersCallback() {
293
- if (!server_1.DBOSHttpServer.instance) {
294
- return undefined;
295
- }
296
- return server_1.DBOSHttpServer.instance.app.callback();
297
- }
298
215
  /** For unit testing of admin server (do not call) */
299
216
  static getAdminCallback() {
300
- if (!server_1.DBOSHttpServer.instance) {
217
+ if (!adminserver_1.DBOSAdminServer.instance) {
301
218
  return undefined;
302
219
  }
303
- return server_1.DBOSHttpServer.instance.adminApp.callback();
220
+ return adminserver_1.DBOSAdminServer.instance.adminApp.callback();
304
221
  }
305
222
  //////
306
223
  // Globals
307
224
  //////
308
225
  static #dbosConfig;
309
226
  static #port;
310
- static #userDbClient;
311
227
  //////
312
228
  // Context
313
229
  //////
@@ -350,27 +266,6 @@ class DBOS {
350
266
  throw new error_1.DBOSError('`DBOS.request` accessed from outside of HTTP requests');
351
267
  return r;
352
268
  }
353
- /**
354
- * Get the current Koa context (within `@DBOS.getApi` et al)
355
- * @deprecated - use `@dbos-inc/koa-serve`
356
- */
357
- static getKoaContext() {
358
- return (0, context_1.getCurrentContextStore)()?.koaContext;
359
- }
360
- /**
361
- * Get the current Koa context (within `@DBOS.getApi` et al)
362
- * @deprecated - use `@dbos-inc/koa-serve`
363
- */
364
- static get koaContext() {
365
- const r = DBOS.getKoaContext();
366
- if (!r)
367
- throw new error_1.DBOSError('`DBOS.koaContext` accessed from outside koa request');
368
- return r;
369
- }
370
- /** Get the current application version */
371
- static get applicationVersion() {
372
- return utils_1.globalParams.appVersion;
373
- }
374
269
  /** Get the current workflow ID */
375
270
  static get workflowID() {
376
271
  return (0, context_1.getCurrentContextStore)()?.workflowId;
@@ -406,10 +301,6 @@ class DBOS {
406
301
  static isInTransaction() {
407
302
  return (0, context_1.getCurrentContextStore)()?.curTxFunctionId !== undefined;
408
303
  }
409
- /** @returns true if called from within a stored procedure, false otherwise */
410
- static isInStoredProc() {
411
- return (0, context_1.getCurrentContextStore)()?.isInStoredProc ?? false;
412
- }
413
304
  /** @returns true if called from within a step, false otherwise */
414
305
  static isInStep() {
415
306
  return (0, context_1.getCurrentContextStore)()?.curStepFunctionId !== undefined;
@@ -427,111 +318,7 @@ class DBOS {
427
318
  * a step, transaction, or procedure, or false otherwise
428
319
  */
429
320
  static isInWorkflow() {
430
- return DBOS.isWithinWorkflow() && !DBOS.isInTransaction() && !DBOS.isInStep() && !DBOS.isInStoredProc();
431
- }
432
- // sql session (various forms)
433
- /**
434
- * @returns the current SQL client; only allowed within `@DBOS.transaction` functions
435
- * @deprecated - use data source packages such as:
436
- * `@dbos-inc/drizzle-datasource`
437
- * `@dbos-inc/knex-datasource`
438
- * `@dbos-inc/node-pg-datasource`
439
- * `@dbos-inc/postgres-datasource`
440
- * `@dbos-inc/prisma-datasource`
441
- * `@dbos-inc/typeorm-datasource`
442
- */
443
- static get sqlClient() {
444
- const c = (0, context_1.getCurrentContextStore)()?.sqlClient;
445
- if (!DBOS.isInTransaction() || !c)
446
- throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid use of `DBOS.sqlClient` outside of a `transaction`');
447
- return c;
448
- }
449
- /**
450
- * @returns the current PG SQL client;
451
- * only allowed within `@DBOS.transaction` functions when a `PGNODE` user database is in use
452
- * @deprecated - use data source packages such as `@dbos-inc/node-pg-datasource`
453
- */
454
- static get pgClient() {
455
- if (!DBOS.isInStoredProc() && DBOS.#userDbClient !== user_database_1.UserDatabaseName.PGNODE) {
456
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.pgClient' but client is configured with type '${DBOS.#userDbClient}'`);
457
- }
458
- return DBOS.sqlClient;
459
- }
460
- /**
461
- * @returns the current Knex SQL client;
462
- * only allowed within `@DBOS.transaction` functions when a `KNEX` user database is in use
463
- * @deprecated - use `@dbos-inc/knex-datasource` package
464
- */
465
- static get knexClient() {
466
- if (DBOS.isInStoredProc()) {
467
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.knexClient' from within a stored procedure`);
468
- }
469
- if (DBOS.#userDbClient !== user_database_1.UserDatabaseName.KNEX) {
470
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.knexClient' but client is configured with type '${DBOS.#userDbClient}'`);
471
- }
472
- return DBOS.sqlClient;
473
- }
474
- /**
475
- * @returns the current Prisma SQL client;
476
- * only allowed within `@DBOS.transaction` functions when a `PRISMA` user database is in use
477
- * @deprecated - use `@dbos-inc/prisma-datasource` package
478
- */
479
- static get prismaClient() {
480
- if (DBOS.isInStoredProc()) {
481
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.prismaClient' from within a stored procedure`);
482
- }
483
- if (DBOS.#userDbClient !== user_database_1.UserDatabaseName.PRISMA) {
484
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.prismaClient' but client is configured with type '${DBOS.#userDbClient}'`);
485
- }
486
- return DBOS.sqlClient;
487
- }
488
- /**
489
- * @returns the current TypeORM SQL client;
490
- * only allowed within `@DBOS.transaction` functions when the `TYPEORM` user database is in use
491
- * @deprecated - use `@dbos-inc/typeorm-datasource` package
492
- */
493
- static get typeORMClient() {
494
- if (DBOS.isInStoredProc()) {
495
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.typeORMClient' from within a stored procedure`);
496
- }
497
- if (DBOS.#userDbClient !== user_database_1.UserDatabaseName.TYPEORM) {
498
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.typeORMClient' but client is configured with type '${DBOS.#userDbClient}'`);
499
- }
500
- return DBOS.sqlClient;
501
- }
502
- /**
503
- * @returns the current Drizzle SQL client;
504
- * only allowed within `@DBOS.transaction` functions when the `DRIZZLE` user database is in use
505
- * @deprecated - use `@dbos-inc/drizzle-datasource` package
506
- */
507
- static get drizzleClient() {
508
- if (DBOS.isInStoredProc()) {
509
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.drizzleClient' from within a stored procedure`);
510
- }
511
- if (DBOS.#userDbClient !== user_database_1.UserDatabaseName.DRIZZLE) {
512
- throw new error_1.DBOSInvalidWorkflowTransitionError(`Requested 'DBOS.drizzleClient' but client is configured with type '${DBOS.#userDbClient}'`);
513
- }
514
- return DBOS.sqlClient;
515
- }
516
- /**
517
- * Query the current application database
518
- * @param sql - parameterized SQL statement (string) to execute
519
- * @param params - parameter values for `sql`
520
- * @template T - Type for the returned records
521
- * @returns Array of records returned by the SQL statement
522
- * @deprecated - use data source packages such as:
523
- * `@dbos-inc/drizzle-datasource`
524
- * `@dbos-inc/knex-datasource`
525
- * `@dbos-inc/node-pg-datasource`
526
- * `@dbos-inc/postgres-datasource`
527
- * `@dbos-inc/prisma-datasource`
528
- * `@dbos-inc/typeorm-datasource`
529
- */
530
- static async queryUserDB(sql, params) {
531
- if (DBOS.isWithinWorkflow() && !DBOS.isInStep()) {
532
- throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `queryUserDB` inside a `workflow`, without being in a `step`');
533
- }
534
- return DBOS.#executor.queryUserDB(sql, params);
321
+ return DBOS.isWithinWorkflow() && !DBOS.isInTransaction() && !DBOS.isInStep();
535
322
  }
536
323
  //////
537
324
  // Access to system DB, for event receivers etc.
@@ -634,19 +421,6 @@ class DBOS {
634
421
  }
635
422
  return DBOS.#executor.retrieveWorkflow(workflowID);
636
423
  }
637
- /**
638
- * Query the system database for all workflows matching the provided predicate
639
- * @param input - `GetWorkflowsInput` predicate for filtering returned workflows
640
- * @returns `GetWorkflowsOutput` listing the workflow IDs of matching workflows
641
- * @deprecated Use `DBOS.listWorkflows` instead
642
- */
643
- static async getWorkflows(input) {
644
- (0, decorators_1.ensureDBOSIsLaunched)('getWorkflows');
645
- return await runInternalStep(async () => {
646
- const wfs = await DBOS.#executor.listWorkflows(input);
647
- return { workflowUUIDs: wfs.map((wf) => wf.workflowID) };
648
- }, 'DBOS.getWorkflows');
649
- }
650
424
  /**
651
425
  * Query the system database for all workflows matching the provided predicate
652
426
  * @param input - `GetWorkflowsInput` predicate for filtering returned workflows
@@ -836,17 +610,6 @@ class DBOS {
836
610
  (0, decorators_1.ensureDBOSIsLaunched)('tracing');
837
611
  return DBOS.#withTopContext({ operationCaller: callerName }, callback);
838
612
  }
839
- /**
840
- * @deprecated
841
- * Use queue named `queueName` for any workflows started within the `callback`.
842
- * @param queueName - Name of queue upon which all workflows called or started within `callback` will be run
843
- * @param callback - Function to run, which would call or start workflows
844
- * @returns - Return value from `callback`
845
- */
846
- static async withWorkflowQueue(queueName, callback) {
847
- (0, decorators_1.ensureDBOSIsLaunched)('workflows');
848
- return DBOS.#withTopContext({ queueAssignedForWorkflows: queueName }, callback);
849
- }
850
613
  /**
851
614
  * Specify workflow timeout for any workflows started within the `callback`.
852
615
  * @param timeoutMS - timeout length for all workflows started within `callback` will be run
@@ -902,7 +665,7 @@ class DBOS {
902
665
  static startWorkflow(target, params) {
903
666
  (0, decorators_1.ensureDBOSIsLaunched)('workflows');
904
667
  const instance = typeof target === 'function' ? null : target;
905
- if (instance && typeof instance !== 'function' && !(instance instanceof _2.ConfiguredInstance)) {
668
+ if (instance && typeof instance !== 'function' && !(instance instanceof decorators_1.ConfiguredInstance)) {
906
669
  throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call `startWorkflow` on an object that is not a `ConfiguredInstance`');
907
670
  }
908
671
  const regOps = (0, decorators_1.getRegisteredOperations)(target);
@@ -1168,7 +931,7 @@ class DBOS {
1168
931
  const queueName = params.queueName ?? ppctx?.queueAssignedForWorkflows;
1169
932
  const timeoutMS = params.timeoutMS ?? ppctx?.workflowTimeoutMS;
1170
933
  const instance = $this === undefined || typeof $this === 'function' ? undefined : $this;
1171
- if (instance && !(instance instanceof _2.ConfiguredInstance)) {
934
+ if (instance && !(instance instanceof decorators_1.ConfiguredInstance)) {
1172
935
  throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call a `workflow` function on an object that is not a `ConfiguredInstance`');
1173
936
  }
1174
937
  // If this is called from within a workflow, this is a child workflow,
@@ -1206,10 +969,6 @@ class DBOS {
1206
969
  const func = regOP.registeredFunction;
1207
970
  return dbos_executor_1.DBOSExecutor.globalInstance.internalWorkflow(func, wfParams, workflowID, funcNum, ...args);
1208
971
  }
1209
- if (regOP.txnConfig) {
1210
- const func = regOP.registeredFunction;
1211
- return dbos_executor_1.DBOSExecutor.globalInstance.startTransactionTempWF(func, wfParams, workflowID, funcNum, ...args);
1212
- }
1213
972
  if (regOP.stepConfig) {
1214
973
  const func = regOP.registeredFunction;
1215
974
  return dbos_executor_1.DBOSExecutor.globalInstance.startStepTempWF(func, wfParams, workflowID, funcNum, ...args);
@@ -1236,95 +995,6 @@ class DBOS {
1236
995
  });
1237
996
  return invoker;
1238
997
  }
1239
- /**
1240
- * Decorator designating a method as a DBOS transaction, making SQL clients available.
1241
- * A durable execution checkpoint will be applied to to the underlying database transaction
1242
- * @see `DBOS.sqlClient`
1243
- * @param config - Configuration information for the transaction, particularly its isolation mode
1244
- * @deprecated - use data source packages such as:
1245
- * `@dbos-inc/drizzle-datasource`
1246
- * `@dbos-inc/knex-datasource`
1247
- * `@dbos-inc/node-pg-datasource`
1248
- * `@dbos-inc/postgres-datasource`
1249
- * `@dbos-inc/prisma-datasource`
1250
- * `@dbos-inc/typeorm-datasource`
1251
- */
1252
- static transaction(config = {}) {
1253
- function decorator(target, propertyKey, inDescriptor) {
1254
- const { descriptor, registration } = (0, decorators_1.wrapDBOSFunctionAndRegisterByUniqueNameDec)(target, propertyKey, inDescriptor);
1255
- registration.setTxnConfig(config);
1256
- const invokeWrapper = async function (...rawArgs) {
1257
- (0, decorators_1.ensureDBOSIsLaunched)('transactions');
1258
- let inst = undefined;
1259
- if (this === undefined || typeof this === 'function') {
1260
- // This is static
1261
- }
1262
- else {
1263
- inst = this;
1264
- if (!(inst instanceof _2.ConfiguredInstance)) {
1265
- throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call a `transaction` function on an object that is not a `ConfiguredInstance`');
1266
- }
1267
- }
1268
- if (DBOS.isWithinWorkflow()) {
1269
- if (DBOS.isInTransaction()) {
1270
- throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to a `transaction` function from within a `transaction`');
1271
- }
1272
- if (DBOS.isInStep()) {
1273
- throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to a `transaction` function from within a `step`');
1274
- }
1275
- return await dbos_executor_1.DBOSExecutor.globalInstance.callTransactionFunction(registration.registeredFunction, inst ?? null, ...rawArgs);
1276
- }
1277
- const wfId = (0, context_1.getNextWFID)(undefined);
1278
- const wfParams = {
1279
- configuredInstance: inst,
1280
- workflowUUID: wfId,
1281
- };
1282
- return await DBOS.#executor.runTransactionTempWF(registration.registeredFunction, wfParams, ...rawArgs);
1283
- };
1284
- descriptor.value = invokeWrapper;
1285
- registration.wrappedFunction = invokeWrapper;
1286
- (0, decorators_1.registerFunctionWrapper)(invokeWrapper, registration);
1287
- Object.defineProperty(invokeWrapper, 'name', {
1288
- value: registration.name,
1289
- });
1290
- return descriptor;
1291
- }
1292
- return decorator;
1293
- }
1294
- /**
1295
- * Decorator designating a method as a DBOS stored procedure.
1296
- * Within the procedure, `DBOS.sqlClient` is available for database operations.
1297
- * A durable execution checkpoint will be applied to to the underlying database transaction
1298
- * @param config - Configuration information for the stored procedure, particularly its execution mode
1299
- */
1300
- static storedProcedure(config = {}) {
1301
- function decorator(target, propertyKey, inDescriptor) {
1302
- const { descriptor, registration } = (0, decorators_1.wrapDBOSFunctionAndRegisterByUniqueNameDec)(target, propertyKey, inDescriptor);
1303
- registration.setProcConfig(config);
1304
- const invokeWrapper = async function (...rawArgs) {
1305
- (0, decorators_1.ensureDBOSIsLaunched)('stored procedures');
1306
- if (typeof this !== 'function') {
1307
- throw new Error('Stored procedures must be static');
1308
- }
1309
- if (DBOS.isWithinWorkflow()) {
1310
- return await dbos_executor_1.DBOSExecutor.globalInstance.callProcedureFunction(registration.registeredFunction, ...rawArgs);
1311
- }
1312
- const wfId = (0, context_1.getNextWFID)(undefined);
1313
- const wfParams = {
1314
- workflowUUID: wfId,
1315
- };
1316
- return await DBOS.#executor.runProcedureTempWF(registration.registeredFunction, wfParams, ...rawArgs);
1317
- };
1318
- descriptor.value = invokeWrapper;
1319
- registration.wrappedFunction = invokeWrapper;
1320
- (0, decorators_1.registerFunctionWrapper)(invokeWrapper, registration);
1321
- Object.defineProperty(invokeWrapper, 'name', {
1322
- value: registration.name,
1323
- });
1324
- return descriptor;
1325
- }
1326
- return decorator;
1327
- }
1328
998
  /**
1329
999
  * Decorator designating a method as a DBOS step.
1330
1000
  * A durable checkpoint will be made after the step completes
@@ -1345,7 +1015,7 @@ class DBOS {
1345
1015
  }
1346
1016
  else {
1347
1017
  inst = this;
1348
- if (!(inst instanceof _2.ConfiguredInstance)) {
1018
+ if (!(inst instanceof decorators_1.ConfiguredInstance)) {
1349
1019
  throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call a `step` function on an object that is not a `ConfiguredInstance`');
1350
1020
  }
1351
1021
  }
@@ -1437,51 +1107,6 @@ class DBOS {
1437
1107
  }
1438
1108
  return func();
1439
1109
  }
1440
- /**
1441
- * Register serialization recipe; this is used to save/retrieve objects from the DBOS system
1442
- * database. This includes workflow inputs, function return values, messages, and events.
1443
- */
1444
- static registerSerialization(serReg) {
1445
- if (DBOS.isInitialized()) {
1446
- throw new TypeError(`Serializers/deserializers should not be registered after DBOS.launch()`);
1447
- }
1448
- (0, utils_1.registerSerializationRecipe)(serReg);
1449
- }
1450
- /**
1451
- * Decorator indicating that the method is the target of HTTP GET operations for `url`
1452
- * @deprecated - use `@dbos-inc/koa-serve`
1453
- */
1454
- static getApi(url) {
1455
- return httpApiDec(handlerTypes_1.APITypes.GET, url);
1456
- }
1457
- /**
1458
- * Decorator indicating that the method is the target of HTTP POST operations for `url`
1459
- * @deprecated - use `@dbos-inc/koa-serve`
1460
- */
1461
- static postApi(url) {
1462
- return httpApiDec(handlerTypes_1.APITypes.POST, url);
1463
- }
1464
- /**
1465
- * Decorator indicating that the method is the target of HTTP PUT operations for `url`
1466
- * @deprecated - use `@dbos-inc/koa-serve`
1467
- */
1468
- static putApi(url) {
1469
- return httpApiDec(handlerTypes_1.APITypes.PUT, url);
1470
- }
1471
- /**
1472
- * Decorator indicating that the method is the target of HTTP PATCH operations for `url`
1473
- * @deprecated - use `@dbos-inc/koa-serve`
1474
- */
1475
- static patchApi(url) {
1476
- return httpApiDec(handlerTypes_1.APITypes.PATCH, url);
1477
- }
1478
- /**
1479
- * Decorator indicating that the method is the target of HTTP DELETE operations for `url`
1480
- * @deprecated - use `@dbos-inc/koa-serve`
1481
- */
1482
- static deleteApi(url) {
1483
- return httpApiDec(handlerTypes_1.APITypes.DELETE, url);
1484
- }
1485
1110
  /**
1486
1111
  * Decorate a class with the default list of required roles.
1487
1112
  * This class-level default can be overridden on a per-function basis with `requiredRole`.
@@ -1538,31 +1163,10 @@ class DBOS {
1538
1163
  static associateFunctionWithInfo(external, func, target) {
1539
1164
  return (0, decorators_1.associateMethodWithExternal)(external, target.ctorOrProto, target.className, target.name ?? func.name, func);
1540
1165
  }
1541
- /**
1542
- * Register information to be associated with a DBOS function
1543
- */
1544
- static associateParamWithInfo(external, func, target) {
1545
- return (0, decorators_1.associateParameterWithExternal)(external, target.ctorOrProto, target.className, target.name ?? func.name, func, target.param);
1546
- }
1547
1166
  /** Get registrations */
1548
1167
  static getAssociatedInfo(external, cls, funcName) {
1549
1168
  return (0, decorators_1.getRegistrationsForExternal)(external, cls, funcName);
1550
1169
  }
1551
1170
  }
1552
1171
  exports.DBOS = DBOS;
1553
- /** @deprecated */
1554
- class InitContext {
1555
- createUserSchema() {
1556
- DBOS.logger.warn('Schema synchronization is deprecated and unsafe for production use. Please use migrations instead: https://typeorm.io/migrations');
1557
- return DBOS.createUserSchema();
1558
- }
1559
- dropUserSchema() {
1560
- DBOS.logger.warn('Schema synchronization is deprecated and unsafe for production use. Please use migrations instead: https://typeorm.io/migrations');
1561
- return DBOS.dropUserSchema();
1562
- }
1563
- queryUserDB(sql, ...params) {
1564
- return DBOS.queryUserDB(sql, params);
1565
- }
1566
- }
1567
- exports.InitContext = InitContext;
1568
1172
  //# sourceMappingURL=dbos.js.map