@dbos-inc/dbos-sdk 4.28.14-preview → 5.0.2

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 (97) hide show
  1. package/CONTRIBUTING.md +38 -5
  2. package/README.md +9 -9
  3. package/dbos-config.schema.json +2 -49
  4. package/dist/dbos-config.schema.json +2 -49
  5. package/dist/schemas/system_db_schema.d.ts +0 -12
  6. package/dist/schemas/system_db_schema.d.ts.map +1 -1
  7. package/dist/schemas/system_db_schema.js.map +1 -1
  8. package/dist/src/cli/cli.d.ts +1 -3
  9. package/dist/src/cli/cli.d.ts.map +1 -1
  10. package/dist/src/cli/cli.js +9 -36
  11. package/dist/src/cli/cli.js.map +1 -1
  12. package/dist/src/client.d.ts +6 -88
  13. package/dist/src/client.d.ts.map +1 -1
  14. package/dist/src/client.js +10 -52
  15. package/dist/src/client.js.map +1 -1
  16. package/dist/src/conductor/conductor.d.ts +0 -1
  17. package/dist/src/conductor/conductor.d.ts.map +1 -1
  18. package/dist/src/conductor/conductor.js +3 -21
  19. package/dist/src/conductor/conductor.js.map +1 -1
  20. package/dist/src/conductor/protocol.d.ts +60 -135
  21. package/dist/src/conductor/protocol.d.ts.map +1 -1
  22. package/dist/src/conductor/protocol.js +1 -348
  23. package/dist/src/conductor/protocol.js.map +1 -1
  24. package/dist/src/config.d.ts +2 -11
  25. package/dist/src/config.d.ts.map +1 -1
  26. package/dist/src/config.js +17 -68
  27. package/dist/src/config.js.map +1 -1
  28. package/dist/src/context.d.ts +0 -5
  29. package/dist/src/context.d.ts.map +1 -1
  30. package/dist/src/context.js +0 -3
  31. package/dist/src/context.js.map +1 -1
  32. package/dist/src/datasource.d.ts +2 -4
  33. package/dist/src/datasource.d.ts.map +1 -1
  34. package/dist/src/datasource.js +11 -19
  35. package/dist/src/datasource.js.map +1 -1
  36. package/dist/src/dbos-executor.d.ts +9 -21
  37. package/dist/src/dbos-executor.d.ts.map +1 -1
  38. package/dist/src/dbos-executor.js +16 -37
  39. package/dist/src/dbos-executor.js.map +1 -1
  40. package/dist/src/dbos.d.ts +9 -20
  41. package/dist/src/dbos.d.ts.map +1 -1
  42. package/dist/src/dbos.js +58 -75
  43. package/dist/src/dbos.js.map +1 -1
  44. package/dist/src/debouncer.d.ts.map +1 -1
  45. package/dist/src/debouncer.js +11 -15
  46. package/dist/src/debouncer.js.map +1 -1
  47. package/dist/src/debugpoint.d.ts +0 -15
  48. package/dist/src/debugpoint.d.ts.map +1 -1
  49. package/dist/src/debugpoint.js +6 -38
  50. package/dist/src/debugpoint.js.map +1 -1
  51. package/dist/src/decorators.d.ts +3 -26
  52. package/dist/src/decorators.d.ts.map +1 -1
  53. package/dist/src/decorators.js +28 -72
  54. package/dist/src/decorators.js.map +1 -1
  55. package/dist/src/enqueue_options.d.ts +1 -1
  56. package/dist/src/enqueue_workflow.js +2 -2
  57. package/dist/src/enqueue_workflow.js.map +1 -1
  58. package/dist/src/index.d.ts +2 -2
  59. package/dist/src/index.d.ts.map +1 -1
  60. package/dist/src/index.js +1 -3
  61. package/dist/src/index.js.map +1 -1
  62. package/dist/src/scheduler/crontab.d.ts +0 -1
  63. package/dist/src/scheduler/crontab.d.ts.map +1 -1
  64. package/dist/src/scheduler/crontab.js +1 -2
  65. package/dist/src/scheduler/crontab.js.map +1 -1
  66. package/dist/src/serialization.d.ts.map +1 -1
  67. package/dist/src/serialization.js +0 -4
  68. package/dist/src/serialization.js.map +1 -1
  69. package/dist/src/sysdb_migrations/migration_runner.d.ts +1 -5
  70. package/dist/src/sysdb_migrations/migration_runner.d.ts.map +1 -1
  71. package/dist/src/sysdb_migrations/migration_runner.js +11 -30
  72. package/dist/src/sysdb_migrations/migration_runner.js.map +1 -1
  73. package/dist/src/system_database.d.ts +3 -13
  74. package/dist/src/system_database.d.ts.map +1 -1
  75. package/dist/src/system_database.js +3 -20
  76. package/dist/src/system_database.js.map +1 -1
  77. package/dist/src/telemetry/logs.d.ts +0 -1
  78. package/dist/src/telemetry/logs.d.ts.map +1 -1
  79. package/dist/src/telemetry/logs.js +0 -4
  80. package/dist/src/telemetry/logs.js.map +1 -1
  81. package/dist/src/telemetry/traces.d.ts +2 -3
  82. package/dist/src/telemetry/traces.d.ts.map +1 -1
  83. package/dist/src/telemetry/traces.js +3 -16
  84. package/dist/src/telemetry/traces.js.map +1 -1
  85. package/dist/src/utils.d.ts +0 -5
  86. package/dist/src/utils.d.ts.map +1 -1
  87. package/dist/src/utils.js +2 -17
  88. package/dist/src/utils.js.map +1 -1
  89. package/dist/src/workflow.d.ts +6 -21
  90. package/dist/src/workflow.d.ts.map +1 -1
  91. package/dist/src/workflow.js +11 -38
  92. package/dist/src/workflow.js.map +1 -1
  93. package/dist/src/workflow_management.d.ts.map +1 -1
  94. package/dist/src/workflow_management.js +5 -6
  95. package/dist/src/workflow_management.js.map +1 -1
  96. package/dist/tsconfig.tsbuildinfo +1 -1
  97. package/package.json +2 -3
@@ -693,9 +693,6 @@ class SystemDatabase {
693
693
  client.release();
694
694
  }
695
695
  }
696
- getSerializer() {
697
- return this.serializer;
698
- }
699
696
  // ==================== Application Ownership ====================
700
697
  /**
701
698
  * A predicate matching rows owned by these applications plus unclaimed ones, which belong to
@@ -1260,7 +1257,7 @@ class SystemDatabase {
1260
1257
  }
1261
1258
  // Insert a patchmarker
1262
1259
  const dn = Date.now();
1263
- await this.pool.query(`INSERT INTO ${this.schemaName}.operation_outputs
1260
+ await this.pool.query(`INSERT INTO "${this.schemaName}".operation_outputs
1264
1261
  (workflow_uuid, function_id, output, error, function_name, child_workflow_id, started_at_epoch_ms, completed_at_epoch_ms, application_name, retention_timestamp)
1265
1262
  VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, (EXTRACT(EPOCH FROM now()) * 1000)::bigint)
1266
1263
  ON CONFLICT DO NOTHING;`, [workflowID, functionID, null, null, patchName, null, dn, dn, this.appName ?? null]);
@@ -1942,11 +1939,9 @@ class SystemDatabase {
1942
1939
  }
1943
1940
  if (this.workflowEventsMap.map.size > 0) {
1944
1941
  this.logger.warn('Workflow events map is not empty - shutdown is not clean.');
1945
- //throw new Error('Workflow events map is not empty - shutdown is not clean.');
1946
1942
  }
1947
1943
  if (this.notificationsMap.map.size > 0) {
1948
1944
  this.logger.warn('Message notification map is not empty - shutdown is not clean.');
1949
- //throw new Error('Message notification map is not empty - shutdown is not clean.');
1950
1945
  }
1951
1946
  }
1952
1947
  /**
@@ -1962,11 +1957,6 @@ class SystemDatabase {
1962
1957
  }
1963
1958
  return this.pollLimiter.runExclusive(query);
1964
1959
  }
1965
- /**
1966
- * Cancellation check for use inside polling wait loops: the status read runs
1967
- * under the polling limiter so it counts against the same concurrency budget
1968
- * as the rest of the loop's reads.
1969
- */
1970
1960
  /** Cancellation check for polling waits: goes through the limiter so readers cannot starve the pool. */
1971
1961
  async checkIfCanceledLimited(workflowID) {
1972
1962
  await this.#pollWithLimiter(() => this.#checkIfCanceled(this.pool, workflowID));
@@ -3178,13 +3168,6 @@ class SystemDatabase {
3178
3168
  // Unset scopes to this application, as on every other observability query.
3179
3169
  whereClauses.push(this.#observabilityFilter('application_name', input.applicationName, params));
3180
3170
  paramIdx = params.length + 1;
3181
- // Only workflows that are actively enqueued.
3182
- if (input.queuesOnly) {
3183
- whereClauses.push(`queue_name IS NOT NULL`);
3184
- whereClauses.push(`status IN ($${paramIdx}, $${paramIdx + 1}, $${paramIdx + 2})`);
3185
- params.push(workflow_1.StatusString.ENQUEUED, workflow_1.StatusString.PENDING, workflow_1.StatusString.DELAYED);
3186
- paramIdx += 3;
3187
- }
3188
3171
  if (input.wasForkedFrom !== undefined) {
3189
3172
  whereClauses.push(`was_forked_from = $${paramIdx}`);
3190
3173
  params.push(input.wasForkedFrom);
@@ -4356,13 +4339,13 @@ class SystemDatabase {
4356
4339
  const result = await client.query(`UPDATE "${this.schemaName}".workflow_status ${setClause} ${whereClause}`, args);
4357
4340
  const throwOnFailure = options.throwOnFailure ?? true;
4358
4341
  if (throwOnFailure && result.rowCount !== 1) {
4359
- throw new error_1.DBOSWorkflowConflictError(`Attempt to record transition of nonexistent workflow ${workflowID}`);
4342
+ throw new error_1.DBOSNonExistentWorkflowError(`Attempt to record transition of nonexistent workflow ${workflowID}`);
4360
4343
  }
4361
4344
  return result.rowCount ?? 0;
4362
4345
  }
4363
4346
  async recordOperationResultInternal(client, workflowID, functionID, functionName, checkConflict, startTimeEpochMs, endTimeEpochMs, options = {}) {
4364
4347
  try {
4365
- const out = await client.query(`INSERT INTO ${this.schemaName}.operation_outputs
4348
+ const out = await client.query(`INSERT INTO "${this.schemaName}".operation_outputs
4366
4349
  (workflow_uuid, function_id, output, error, function_name, child_workflow_id, started_at_epoch_ms, completed_at_epoch_ms, serialization, application_name, retention_timestamp)
4367
4350
  VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, (EXTRACT(EPOCH FROM now()) * 1000)::bigint)
4368
4351
  ON CONFLICT (workflow_uuid, function_id) DO UPDATE