@dbos-inc/dbos-sdk 2.2.10-preview.g90e74a1e32 → 2.3.7-preview
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.
- package/.husky/pre-commit +1 -0
- package/.prettierignore +3 -0
- package/.prettierrc +9 -0
- package/CODE_OF_CONDUCT.md +24 -18
- package/CONTRIBUTING.md +12 -10
- package/README.md +2 -2
- package/compose.yaml +17 -17
- package/dbos-config.schema.json +4 -13
- package/dist/schemas/user_db_schema.d.ts.map +1 -1
- package/dist/schemas/user_db_schema.js.map +1 -1
- package/dist/src/context.d.ts +12 -12
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +9 -9
- package/dist/src/context.js.map +1 -1
- package/dist/src/data_validation.d.ts +1 -1
- package/dist/src/data_validation.d.ts.map +1 -1
- package/dist/src/data_validation.js +14 -8
- package/dist/src/data_validation.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +4 -2
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +131 -114
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts +3 -3
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +79 -38
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/authentication.d.ts +1 -1
- package/dist/src/dbos-runtime/cloudutils/authentication.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/authentication.js +14 -14
- package/dist/src/dbos-runtime/cloudutils/authentication.js.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/cloudutils.d.ts +2 -2
- package/dist/src/dbos-runtime/cloudutils/cloudutils.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/cloudutils.js +32 -32
- package/dist/src/dbos-runtime/cloudutils/cloudutils.js.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/databases.d.ts +2 -2
- package/dist/src/dbos-runtime/cloudutils/databases.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/databases.js +25 -21
- package/dist/src/dbos-runtime/cloudutils/databases.js.map +1 -1
- package/dist/src/dbos-runtime/commands.d.ts +1 -1
- package/dist/src/dbos-runtime/commands.js +9 -9
- package/dist/src/dbos-runtime/config.d.ts +7 -7
- package/dist/src/dbos-runtime/config.d.ts.map +1 -1
- package/dist/src/dbos-runtime/config.js +30 -23
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos-runtime/configure.d.ts.map +1 -1
- package/dist/src/dbos-runtime/configure.js.map +1 -1
- package/dist/src/dbos-runtime/db_connection.d.ts.map +1 -1
- package/dist/src/dbos-runtime/db_connection.js +2 -2
- package/dist/src/dbos-runtime/db_connection.js.map +1 -1
- package/dist/src/dbos-runtime/db_wizard.d.ts +1 -1
- package/dist/src/dbos-runtime/db_wizard.d.ts.map +1 -1
- package/dist/src/dbos-runtime/db_wizard.js +18 -18
- package/dist/src/dbos-runtime/db_wizard.js.map +1 -1
- package/dist/src/dbos-runtime/debug.d.ts +2 -2
- package/dist/src/dbos-runtime/debug.d.ts.map +1 -1
- package/dist/src/dbos-runtime/debug.js +4 -4
- package/dist/src/dbos-runtime/debug.js.map +1 -1
- package/dist/src/dbos-runtime/migrate.d.ts +2 -2
- package/dist/src/dbos-runtime/migrate.d.ts.map +1 -1
- package/dist/src/dbos-runtime/migrate.js +14 -10
- package/dist/src/dbos-runtime/migrate.js.map +1 -1
- package/dist/src/dbos-runtime/reset.d.ts +2 -2
- package/dist/src/dbos-runtime/reset.js +2 -2
- package/dist/src/dbos-runtime/reset.js.map +1 -1
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
- package/dist/src/dbos-runtime/runtime.js +4 -4
- package/dist/src/dbos-runtime/runtime.js.map +1 -1
- package/dist/src/dbos-runtime/workflow_management.d.ts +5 -4
- package/dist/src/dbos-runtime/workflow_management.d.ts.map +1 -1
- package/dist/src/dbos-runtime/workflow_management.js +34 -14
- package/dist/src/dbos-runtime/workflow_management.js.map +1 -1
- package/dist/src/dbos.d.ts +23 -23
- package/dist/src/dbos.d.ts.map +1 -1
- package/dist/src/dbos.js +59 -59
- package/dist/src/dbos.js.map +1 -1
- package/dist/src/debugpoint.d.ts.map +1 -1
- package/dist/src/debugpoint.js +4 -4
- package/dist/src/debugpoint.js.map +1 -1
- package/dist/src/decorators.d.ts +8 -8
- package/dist/src/decorators.d.ts.map +1 -1
- package/dist/src/decorators.js +36 -33
- package/dist/src/decorators.js.map +1 -1
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +6 -5
- package/dist/src/error.js.map +1 -1
- package/dist/src/eventreceiver.d.ts +1 -1
- package/dist/src/eventreceiver.d.ts.map +1 -1
- package/dist/src/httpServer/handler.d.ts +8 -8
- package/dist/src/httpServer/handler.d.ts.map +1 -1
- package/dist/src/httpServer/handler.js.map +1 -1
- package/dist/src/httpServer/handlerTypes.d.ts.map +1 -1
- package/dist/src/httpServer/handlerTypes.js.map +1 -1
- package/dist/src/httpServer/middleware.d.ts +9 -9
- package/dist/src/httpServer/middleware.d.ts.map +1 -1
- package/dist/src/httpServer/middleware.js +6 -6
- package/dist/src/httpServer/middleware.js.map +1 -1
- package/dist/src/httpServer/server.d.ts +2 -2
- package/dist/src/httpServer/server.d.ts.map +1 -1
- package/dist/src/httpServer/server.js +27 -33
- package/dist/src/httpServer/server.js.map +1 -1
- package/dist/src/index.d.ts +16 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/kafka/kafka.d.ts.map +1 -1
- package/dist/src/kafka/kafka.js +2 -2
- package/dist/src/kafka/kafka.js.map +1 -1
- package/dist/src/procedure.d.ts +6 -6
- package/dist/src/procedure.d.ts.map +1 -1
- package/dist/src/procedure.js.map +1 -1
- package/dist/src/scheduler/crontab.d.ts.map +1 -1
- package/dist/src/scheduler/crontab.js +54 -33
- package/dist/src/scheduler/crontab.js.map +1 -1
- package/dist/src/scheduler/scheduler.d.ts +3 -3
- package/dist/src/scheduler/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler/scheduler.js +7 -7
- package/dist/src/scheduler/scheduler.js.map +1 -1
- package/dist/src/step.d.ts +4 -4
- package/dist/src/step.d.ts.map +1 -1
- package/dist/src/step.js.map +1 -1
- package/dist/src/system_database.d.ts +16 -11
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +136 -56
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/telemetry/collector.d.ts +3 -3
- package/dist/src/telemetry/exporters.d.ts +1 -1
- package/dist/src/telemetry/exporters.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +5 -5
- package/dist/src/telemetry/logs.d.ts +4 -4
- package/dist/src/telemetry/logs.d.ts.map +1 -1
- package/dist/src/telemetry/logs.js +18 -18
- package/dist/src/telemetry/logs.js.map +1 -1
- package/dist/src/telemetry/traces.d.ts +3 -3
- package/dist/src/telemetry/traces.js +7 -7
- package/dist/src/testing/testing_runtime.d.ts +11 -11
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.js +15 -8
- package/dist/src/testing/testing_runtime.js.map +1 -1
- package/dist/src/transaction.d.ts +6 -6
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/transaction.js +4 -4
- package/dist/src/transaction.js.map +1 -1
- package/dist/src/user_database.d.ts +4 -4
- package/dist/src/user_database.d.ts.map +1 -1
- package/dist/src/user_database.js +45 -45
- package/dist/src/user_database.js.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +6 -12
- package/dist/src/utils.js.map +1 -1
- package/dist/src/wfqueue.d.ts +1 -1
- package/dist/src/wfqueue.d.ts.map +1 -1
- package/dist/src/wfqueue.js +5 -7
- package/dist/src/wfqueue.js.map +1 -1
- package/dist/src/workflow.d.ts +17 -10
- package/dist/src/workflow.d.ts.map +1 -1
- package/dist/src/workflow.js +19 -18
- package/dist/src/workflow.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/eslint.config.js +29 -27
- package/migrations/20240123182943_schema.js +7 -8
- package/migrations/20240123183021_tables.js +52 -48
- package/migrations/20240123183025_indexes.js +11 -14
- package/migrations/20240123183030_triggers.js +7 -8
- package/migrations/20240124015239_status_timestamp.js +12 -18
- package/migrations/20240201213211_replica_identity.js +8 -11
- package/migrations/20240205223925_foreign_keys.js +40 -18
- package/migrations/20240207192338_executor_id_index.js +8 -10
- package/migrations/20240430090000_tables.js +8 -10
- package/migrations/20240516004341_application_version.js +10 -12
- package/migrations/20240517000000_status_class_config.js +10 -14
- package/migrations/20240621000000_workflow_tries.js +8 -12
- package/migrations/20240924000000_workflowqueue.js +32 -23
- package/migrations/20241009150000_event_dispatch_kv.js +12 -14
- package/migrations/20252101000000_workflow_queues_executor_id.js +7 -9
- package/package.json +9 -2
- package/src/dbos-runtime/cloudutils/README.md +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/dbos-runtime/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4D;AAC5D,iDAAsD;AACtD,uCAAyB;AACzB,mCAAkC;AAClC,oCAAuD;AACvD,0DAA6B;AAE7B,6BAAoC;AACpC,sDAAuD;AACvD,wCAA2C;AAC3C,kCAA+B;AAC/B,2CAAwC;AAc3B,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,MAAa,WAAW;
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/dbos-runtime/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4D;AAC5D,iDAAsD;AACtD,uCAAyB;AACzB,mCAAkC;AAClC,oCAAuD;AACvD,0DAA6B;AAE7B,6BAAoC;AACpC,sDAAuD;AACvD,wCAA2C;AAC3C,kCAA+B;AAC/B,2CAAwC;AAc3B,QAAA,iB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AM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QAClF,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;YAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,uBAAa,CAAC,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,aAAa,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,GAAY,CAAC;YACvB,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,cAAc,IAAI,EAAE,EAAE,CAAC;YAC1D,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACnC,CAAC;QACD,MAAM,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC;CACF;AArHD,kCAqHC"}
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import { DBOSConfig, GetWorkflowsInput } from
|
2
|
-
import { WorkflowStatus } from
|
3
|
-
import { HTTPRequest } from
|
4
|
-
import { DBOSRuntimeConfig } from
|
1
|
+
import { DBOSConfig, GetWorkflowsInput } from '..';
|
2
|
+
import { GetQueuedWorkflowsInput, WorkflowStatus } from '../workflow';
|
3
|
+
import { HTTPRequest } from '../context';
|
4
|
+
import { DBOSRuntimeConfig } from './runtime';
|
5
5
|
export declare function listWorkflows(config: DBOSConfig, input: GetWorkflowsInput, getRequest: boolean): Promise<{}[]>;
|
6
|
+
export declare function listQueuedWorkflows(config: DBOSConfig, input: GetQueuedWorkflowsInput, getRequest: boolean): Promise<{}[]>;
|
6
7
|
export type WorkflowInformation = Omit<WorkflowStatus, 'request'> & {
|
7
8
|
workflowUUID: string;
|
8
9
|
input?: unknown[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"workflow_management.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/workflow_management.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAgB,MAAM,IAAI,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"workflow_management.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/workflow_management.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAgB,MAAM,IAAI,CAAC;AAGjE,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAe,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE3D,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,OAAO,iBAYpG;AAED,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,uBAAuB,EAAE,UAAU,EAAE,OAAO,iBAYhH;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,GAAG;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AA4BF,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,eAY9F;AAGD,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAW5E;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,iBAAiB,GAAG,IAAI,EACvC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,OAAO,oBAiB1B"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.reattemptWorkflow = exports.cancelWorkflow = exports.getWorkflow = exports.listWorkflows = void 0;
|
3
|
+
exports.reattemptWorkflow = exports.cancelWorkflow = exports.getWorkflow = exports.listQueuedWorkflows = exports.listWorkflows = void 0;
|
4
4
|
const winston_1 = require("winston");
|
5
5
|
const __1 = require("..");
|
6
6
|
const system_database_1 = require("../system_database");
|
@@ -14,8 +14,16 @@ async function listWorkflows(config, input, getRequest) {
|
|
14
14
|
return workflowInfos;
|
15
15
|
}
|
16
16
|
exports.listWorkflows = listWorkflows;
|
17
|
+
async function listQueuedWorkflows(config, input, getRequest) {
|
18
|
+
const systemDatabase = new system_database_1.PostgresSystemDatabase(config.poolConfig, config.system_database, (0, winston_1.createLogger)());
|
19
|
+
const workflowUUIDs = (await systemDatabase.getQueuedWorkflows(input)).workflowUUIDs.reverse(); // Reverse so most recent entries are printed last
|
20
|
+
const workflowInfos = await Promise.all(workflowUUIDs.map(async (i) => await getWorkflowInfo(systemDatabase, i, getRequest)));
|
21
|
+
await systemDatabase.destroy();
|
22
|
+
return workflowInfos;
|
23
|
+
}
|
24
|
+
exports.listQueuedWorkflows = listQueuedWorkflows;
|
17
25
|
async function getWorkflowInfo(systemDatabase, workflowUUID, getRequest) {
|
18
|
-
const info = await systemDatabase.getWorkflowStatus(workflowUUID);
|
26
|
+
const info = (await systemDatabase.getWorkflowStatus(workflowUUID));
|
19
27
|
info.workflowUUID = workflowUUID;
|
20
28
|
if (info === null) {
|
21
29
|
return {};
|
@@ -43,16 +51,24 @@ async function getWorkflowInfo(systemDatabase, workflowUUID, getRequest) {
|
|
43
51
|
}
|
44
52
|
async function getWorkflow(config, workflowUUID, getRequest) {
|
45
53
|
const systemDatabase = new system_database_1.PostgresSystemDatabase(config.poolConfig, config.system_database, (0, winston_1.createLogger)());
|
46
|
-
|
47
|
-
|
48
|
-
|
54
|
+
try {
|
55
|
+
const info = await getWorkflowInfo(systemDatabase, workflowUUID, getRequest);
|
56
|
+
return info;
|
57
|
+
}
|
58
|
+
finally {
|
59
|
+
await systemDatabase.destroy();
|
60
|
+
}
|
49
61
|
}
|
50
62
|
exports.getWorkflow = getWorkflow;
|
51
63
|
// Cancelling a workflow prevents it from being automatically recovered, but active executions are not halted.
|
52
64
|
async function cancelWorkflow(config, workflowUUID) {
|
53
65
|
const systemDatabase = new system_database_1.PostgresSystemDatabase(config.poolConfig, config.system_database, (0, winston_1.createLogger)());
|
54
|
-
|
55
|
-
|
66
|
+
try {
|
67
|
+
await systemDatabase.cancelWorkflow(workflowUUID);
|
68
|
+
}
|
69
|
+
finally {
|
70
|
+
await systemDatabase.destroy();
|
71
|
+
}
|
56
72
|
}
|
57
73
|
exports.cancelWorkflow = cancelWorkflow;
|
58
74
|
async function reattemptWorkflow(config, runtimeConfig, workflowUUID, startNewWorkflow) {
|
@@ -60,14 +76,18 @@ async function reattemptWorkflow(config, runtimeConfig, workflowUUID, startNewWo
|
|
60
76
|
if (runtimeConfig !== null) {
|
61
77
|
await runtime_1.DBOSRuntime.loadClasses(runtimeConfig.entrypoints);
|
62
78
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
79
|
+
try {
|
80
|
+
await dbosExec.init();
|
81
|
+
if (!startNewWorkflow) {
|
82
|
+
await dbosExec.systemDatabase.resumeWorkflow(workflowUUID);
|
83
|
+
}
|
84
|
+
const handle = await dbosExec.executeWorkflowUUID(workflowUUID, startNewWorkflow);
|
85
|
+
const output = await handle.getResult();
|
86
|
+
return output;
|
87
|
+
}
|
88
|
+
finally {
|
89
|
+
await dbosExec.destroy();
|
66
90
|
}
|
67
|
-
const handle = await dbosExec.executeWorkflowUUID(workflowUUID, startNewWorkflow);
|
68
|
-
const output = await handle.getResult();
|
69
|
-
await dbosExec.destroy();
|
70
|
-
return output;
|
71
91
|
}
|
72
92
|
exports.reattemptWorkflow = reattemptWorkflow;
|
73
93
|
//# sourceMappingURL=workflow_management.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"workflow_management.js","sourceRoot":"","sources":["../../../src/dbos-runtime/workflow_management.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,0BAAiE;AACjE,wDAA4E;AAI5E,oDAAgD;AAChD,uCAA2D;AAEpD,KAAK,UAAU,aAAa,CAAC,MAAkB,EAAE,KAAwB,EAAE,UAAmB;IACnG,MAAM,cAAc,GAAG,IAAI,wCAAsB,
|
1
|
+
{"version":3,"file":"workflow_management.js","sourceRoot":"","sources":["../../../src/dbos-runtime/workflow_management.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,0BAAiE;AACjE,wDAA4E;AAI5E,oDAAgD;AAChD,uCAA2D;AAEpD,KAAK,UAAU,aAAa,CAAC,MAAkB,EAAE,KAAwB,EAAE,UAAmB;IACnG,MAAM,cAAc,GAAG,IAAI,wCAAsB,CAC/C,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,eAAe,EACtB,IAAA,sBAAY,GAA6B,CAC1C,CAAC;IACF,MAAM,aAAa,GAAG,CAAC,MAAM,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,kDAAkD;IAC5I,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG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QACH,MAAM,cAAc,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;YAAS,CAAC;QACT,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;AACH,CAAC;AAXD,wCAWC;AAEM,KAAK,UAAU,iBAAiB,CACrC,MAAkB,EAClB,aAAuC,EACvC,YAAoB,EACpB,gBAAyB;IAEzB,MAAM,QAAQ,GAAG,IAAI,4BAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,qBAAW,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,MAAM,QAAQ,CAAC,cAAc,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC;AArBD,8CAqBC"}
|
package/dist/src/dbos.d.ts
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
3
|
/// <reference types="node/http" />
|
4
|
-
import { Span } from
|
5
|
-
import { HTTPRequest } from
|
6
|
-
import { DBOSConfig } from
|
7
|
-
import { GetWorkflowQueueInput, GetWorkflowQueueOutput, GetWorkflowsInput, GetWorkflowsOutput, WorkflowConfig } from
|
8
|
-
import { DBOSExecutorContext } from
|
9
|
-
import { DLogger } from
|
10
|
-
import { DBOSRuntimeConfig } from
|
11
|
-
import { ScheduledArgs, SchedulerConfig } from
|
12
|
-
import { MethodRegistration } from
|
13
|
-
import { DBOSHttpServer } from
|
14
|
-
import { Server } from
|
15
|
-
import { DrizzleClient, PrismaClient, TypeORMEntityManager, UserDatabaseClient } from
|
16
|
-
import { TransactionConfig } from
|
17
|
-
import Koa from
|
18
|
-
import { Application as ExpressApp } from
|
19
|
-
import { INestApplication } from
|
20
|
-
import { FastifyInstance } from
|
21
|
-
import { PoolClient } from
|
22
|
-
import { Knex } from
|
23
|
-
import { StepConfig } from
|
24
|
-
import { StepContext, StoredProcedureContext, TransactionContext, WorkflowHandle } from
|
25
|
-
import { ConfiguredInstance } from
|
26
|
-
import { StoredProcedureConfig } from
|
4
|
+
import { Span } from '@opentelemetry/sdk-trace-base';
|
5
|
+
import { HTTPRequest } from './context';
|
6
|
+
import { DBOSConfig } from './dbos-executor';
|
7
|
+
import { GetWorkflowQueueInput, GetWorkflowQueueOutput, GetWorkflowsInput, GetWorkflowsOutput, WorkflowConfig } from './workflow';
|
8
|
+
import { DBOSExecutorContext } from './eventreceiver';
|
9
|
+
import { DLogger } from './telemetry/logs';
|
10
|
+
import { DBOSRuntimeConfig } from './dbos-runtime/runtime';
|
11
|
+
import { ScheduledArgs, SchedulerConfig } from './scheduler/scheduler';
|
12
|
+
import { MethodRegistration } from './decorators';
|
13
|
+
import { DBOSHttpServer } from './httpServer/server';
|
14
|
+
import { Server } from 'http';
|
15
|
+
import { DrizzleClient, PrismaClient, TypeORMEntityManager, UserDatabaseClient } from './user_database';
|
16
|
+
import { TransactionConfig } from './transaction';
|
17
|
+
import Koa from 'koa';
|
18
|
+
import { Application as ExpressApp } from 'express';
|
19
|
+
import { INestApplication } from '@nestjs/common';
|
20
|
+
import { FastifyInstance } from 'fastify';
|
21
|
+
import { PoolClient } from 'pg';
|
22
|
+
import { Knex } from 'knex';
|
23
|
+
import { StepConfig } from './step';
|
24
|
+
import { StepContext, StoredProcedureContext, TransactionContext, WorkflowHandle } from '.';
|
25
|
+
import { ConfiguredInstance } from '.';
|
26
|
+
import { StoredProcedureConfig } from './procedure';
|
27
27
|
export interface DBOSHttpApps {
|
28
28
|
koaApp?: Koa;
|
29
29
|
expressApp?: ExpressApp;
|
package/dist/src/dbos.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dbos.d.ts","sourceRoot":"","sources":["../../src/dbos.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAKL,WAAW,EAIZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAwC,MAAM,iBAAiB,CAAC;AACnF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EAGf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAe,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAiB,aAAa,EAAE,eAAe,EAA6B,MAAM,uBAAuB,CAAC;AACjH,OAAO,
|
1
|
+
{"version":3,"file":"dbos.d.ts","sourceRoot":"","sources":["../../src/dbos.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAKL,WAAW,EAIZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAwC,MAAM,iBAAiB,CAAC;AACnF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EAGf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAe,iBAAiB,EA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executor.destroy();
|
78
78
|
process.exit(0);
|
79
|
-
return; // return for cases where process.exit is mocked
|
79
|
+
return; // return for cases where process.exit is mocked
|
80
80
|
}
|
81
81
|
dbos_executor_1.DBOSExecutor.globalInstance.scheduler = new scheduler_1.DBOSScheduler(dbos_executor_1.DBOSExecutor.globalInstance);
|
82
82
|
dbos_executor_1.DBOSExecutor.globalInstance.scheduler.initScheduler();
|
@@ -95,23 +95,23 @@ class DBOS {
|
|
95
95
|
}
|
96
96
|
if (httpApps) {
|
97
97
|
if (httpApps.koaApp) {
|
98
|
-
DBOS.logger.info(
|
98
|
+
DBOS.logger.info('Setting up Koa tracing middleware');
|
99
99
|
httpApps.koaApp.use(middleware_1.koaTracingMiddleware);
|
100
100
|
}
|
101
101
|
if (httpApps.expressApp) {
|
102
|
-
DBOS.logger.info(
|
102
|
+
DBOS.logger.info('Setting up Express tracing middleware');
|
103
103
|
httpApps.expressApp.use(middleware_1.expressTracingMiddleware);
|
104
104
|
}
|
105
105
|
if (httpApps.fastifyApp) {
|
106
106
|
// Fastify can use express or middie under the hood, for middlewares.
|
107
107
|
// Middie happens to have the same semantic than express.
|
108
108
|
// See https://fastify.dev/docs/latest/Reference/Middleware/
|
109
|
-
DBOS.logger.info(
|
109
|
+
DBOS.logger.info('Setting up Fastify tracing middleware');
|
110
110
|
httpApps.fastifyApp.use(middleware_1.expressTracingMiddleware);
|
111
111
|
}
|
112
112
|
if (httpApps.nestApp) {
|
113
113
|
// Nest.kj can use express or fastify under the hood. With fastify, Nest.js uses middie.
|
114
|
-
DBOS.logger.info(
|
114
|
+
DBOS.logger.info('Setting up NestJS tracing middleware');
|
115
115
|
httpApps.nestApp.use(middleware_1.expressTracingMiddleware);
|
116
116
|
}
|
117
117
|
}
|
@@ -197,7 +197,7 @@ class DBOS {
|
|
197
197
|
static get request() {
|
198
198
|
const r = DBOS.getRequest();
|
199
199
|
if (!r)
|
200
|
-
throw new error_1.DBOSError(
|
200
|
+
throw new error_1.DBOSError('`DBOS.request` accessed from outside of HTTP requests');
|
201
201
|
return r;
|
202
202
|
}
|
203
203
|
static getKoaContext() {
|
@@ -206,20 +206,20 @@ class DBOS {
|
|
206
206
|
static get koaContext() {
|
207
207
|
const r = DBOS.getKoaContext();
|
208
208
|
if (!r)
|
209
|
-
throw new error_1.DBOSError(
|
209
|
+
throw new error_1.DBOSError('`DBOS.koaContext` accessed from outside koa request');
|
210
210
|
return r;
|
211
211
|
}
|
212
212
|
static get workflowID() {
|
213
213
|
return (0, context_1.getCurrentDBOSContext)()?.workflowUUID;
|
214
214
|
}
|
215
215
|
static get authenticatedUser() {
|
216
|
-
return (0, context_1.getCurrentDBOSContext)()?.authenticatedUser ??
|
216
|
+
return (0, context_1.getCurrentDBOSContext)()?.authenticatedUser ?? '';
|
217
217
|
}
|
218
218
|
static get authenticatedRoles() {
|
219
219
|
return (0, context_1.getCurrentDBOSContext)()?.authenticatedRoles ?? [];
|
220
220
|
}
|
221
221
|
static get assumedRole() {
|
222
|
-
return (0, context_1.getCurrentDBOSContext)()?.assumedRole ??
|
222
|
+
return (0, context_1.getCurrentDBOSContext)()?.assumedRole ?? '';
|
223
223
|
}
|
224
224
|
static isInTransaction() {
|
225
225
|
return (0, context_1.getCurrentContextStore)()?.curTxFunctionId !== undefined;
|
@@ -237,7 +237,7 @@ class DBOS {
|
|
237
237
|
// sql session (various forms)
|
238
238
|
static get sqlClient() {
|
239
239
|
if (!DBOS.isInTransaction())
|
240
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
240
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid use of `DBOS.sqlClient` outside of a `transaction`');
|
241
241
|
const ctx = (0, context_1.assertCurrentDBOSContext)();
|
242
242
|
return ctx.client;
|
243
243
|
}
|
@@ -294,7 +294,7 @@ class DBOS {
|
|
294
294
|
static async sleepms(durationMS) {
|
295
295
|
if (DBOS.isWithinWorkflow() && !DBOS.isInStep()) {
|
296
296
|
if (DBOS.isInTransaction()) {
|
297
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
297
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `DBOS.sleep` inside a `transaction`');
|
298
298
|
}
|
299
299
|
return (0, context_1.getCurrentDBOSContext)().sleepms(durationMS);
|
300
300
|
}
|
@@ -390,12 +390,12 @@ class DBOS {
|
|
390
390
|
if (DBOS.isWithinWorkflow()) {
|
391
391
|
const wfctx = (0, context_1.assertCurrentWorkflowContext)();
|
392
392
|
const funcId = wfctx.functionIDGetIncrement();
|
393
|
-
wfId = wfId ||
|
393
|
+
wfId = wfId || wfctx.workflowUUID + '-' + funcId;
|
394
394
|
const wfParams = {
|
395
395
|
workflowUUID: wfId,
|
396
396
|
parentCtx: wfctx,
|
397
397
|
configuredInstance,
|
398
|
-
queueName: inParams?.queueName ?? pctx?.queueAssignedForWorkflows
|
398
|
+
queueName: inParams?.queueName ?? pctx?.queueAssignedForWorkflows,
|
399
399
|
};
|
400
400
|
for (const op of ops) {
|
401
401
|
proxy[op.name] = op.workflowConfig
|
@@ -410,7 +410,7 @@ class DBOS {
|
|
410
410
|
// If pctx has no span, e.g., has not been setup through `withTracedContext`, set up a parent span for the workflow here.
|
411
411
|
let span = pctx.span;
|
412
412
|
if (!span) {
|
413
|
-
span = DBOS.executor.tracer.startSpan(pctx.operationCaller ||
|
413
|
+
span = DBOS.executor.tracer.startSpan(pctx.operationCaller || 'startWorkflow', {
|
414
414
|
operationUUID: wfId,
|
415
415
|
operationType: pctx.operationType,
|
416
416
|
authenticatedUser: pctx.authenticatedUser,
|
@@ -418,12 +418,12 @@ class DBOS {
|
|
418
418
|
authenticatedRoles: pctx.authenticatedRoles,
|
419
419
|
});
|
420
420
|
}
|
421
|
-
parentCtx = new context_1.DBOSContextImpl(pctx.operationCaller ||
|
421
|
+
parentCtx = new context_1.DBOSContextImpl(pctx.operationCaller || 'startWorkflow', span, DBOS.logger);
|
422
422
|
parentCtx.request = pctx.request || {};
|
423
|
-
parentCtx.authenticatedUser = pctx.authenticatedUser ||
|
424
|
-
parentCtx.assumedRole = pctx.assumedRole ||
|
423
|
+
parentCtx.authenticatedUser = pctx.authenticatedUser || '';
|
424
|
+
parentCtx.assumedRole = pctx.assumedRole || '';
|
425
425
|
parentCtx.authenticatedRoles = pctx.authenticatedRoles || [];
|
426
|
-
parentCtx.workflowUUID = wfId ||
|
426
|
+
parentCtx.workflowUUID = wfId || '';
|
427
427
|
}
|
428
428
|
const wfParams = {
|
429
429
|
workflowUUID: wfId,
|
@@ -502,10 +502,10 @@ class DBOS {
|
|
502
502
|
static async send(destinationID, message, topic, idempotencyKey) {
|
503
503
|
if (DBOS.isWithinWorkflow()) {
|
504
504
|
if (!DBOS.isInWorkflow()) {
|
505
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
505
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `DBOS.send` inside a `step` or `transaction`');
|
506
506
|
}
|
507
507
|
if (idempotencyKey) {
|
508
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
508
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `DBOS.send` with an idempotency key from within a workflow');
|
509
509
|
}
|
510
510
|
return (0, context_1.getCurrentDBOSContext)().send(destinationID, message, topic);
|
511
511
|
}
|
@@ -514,25 +514,25 @@ class DBOS {
|
|
514
514
|
static async recv(topic, timeoutSeconds) {
|
515
515
|
if (DBOS.isWithinWorkflow()) {
|
516
516
|
if (!DBOS.isInWorkflow()) {
|
517
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
517
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `DBOS.setEvent` inside a `step` or `transaction`');
|
518
518
|
}
|
519
519
|
return (0, context_1.getCurrentDBOSContext)().recv(topic, timeoutSeconds);
|
520
520
|
}
|
521
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
521
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call `DBOS.recv` outside of a workflow'); // Only workflows can recv
|
522
522
|
}
|
523
523
|
static async setEvent(key, value) {
|
524
524
|
if (DBOS.isWithinWorkflow()) {
|
525
525
|
if (!DBOS.isInWorkflow()) {
|
526
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
526
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `DBOS.setEvent` inside a `step` or `transaction`');
|
527
527
|
}
|
528
528
|
return (0, context_1.getCurrentDBOSContext)().setEvent(key, value);
|
529
529
|
}
|
530
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
530
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call `DBOS.setEvent` outside of a workflow'); // Only workflows can set event
|
531
531
|
}
|
532
532
|
static async getEvent(workflowID, key, timeoutSeconds) {
|
533
533
|
if (DBOS.isWithinWorkflow()) {
|
534
534
|
if (!DBOS.isInWorkflow()) {
|
535
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
535
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to `DBOS.getEvent` inside a `step` or `transaction`');
|
536
536
|
}
|
537
537
|
return (0, context_1.getCurrentDBOSContext)().getEvent(workflowID, key, timeoutSeconds);
|
538
538
|
}
|
@@ -562,8 +562,8 @@ class DBOS {
|
|
562
562
|
}
|
563
563
|
else {
|
564
564
|
inst = this;
|
565
|
-
if (!(
|
566
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
565
|
+
if (!('name' in inst)) {
|
566
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call a `workflow` function on an object that is not a `ConfiguredInstance`');
|
567
567
|
}
|
568
568
|
}
|
569
569
|
let wfId = (0, context_1.getNextWFID)(undefined);
|
@@ -572,12 +572,12 @@ class DBOS {
|
|
572
572
|
if (DBOS.isWithinWorkflow()) {
|
573
573
|
const wfctx = (0, context_1.assertCurrentWorkflowContext)();
|
574
574
|
const funcId = wfctx.functionIDGetIncrement();
|
575
|
-
wfId = wfId ||
|
575
|
+
wfId = wfId || wfctx.workflowUUID + '-' + funcId;
|
576
576
|
const params = {
|
577
577
|
workflowUUID: wfId,
|
578
578
|
parentCtx: wfctx,
|
579
579
|
configuredInstance: inst,
|
580
|
-
queueName: pctx?.queueAssignedForWorkflows
|
580
|
+
queueName: pctx?.queueAssignedForWorkflows,
|
581
581
|
};
|
582
582
|
const cwfh = await dbos_executor_1.DBOSExecutor.globalInstance.internalWorkflow(registration.registeredFunction, params, wfctx.workflowUUID, funcId, ...rawArgs);
|
583
583
|
return await cwfh.getResult();
|
@@ -588,7 +588,7 @@ class DBOS {
|
|
588
588
|
// If pctx has no span, e.g., has not been setup through `withTracedContext`, set up a parent span for the workflow here.
|
589
589
|
let span = pctx.span;
|
590
590
|
if (!span) {
|
591
|
-
span = DBOS.executor.tracer.startSpan(pctx.operationCaller ||
|
591
|
+
span = DBOS.executor.tracer.startSpan(pctx.operationCaller || 'workflowCaller', {
|
592
592
|
operationUUID: wfId,
|
593
593
|
operationType: pctx.operationType,
|
594
594
|
authenticatedUser: pctx.authenticatedUser,
|
@@ -596,12 +596,12 @@ class DBOS {
|
|
596
596
|
authenticatedRoles: pctx.authenticatedRoles,
|
597
597
|
});
|
598
598
|
}
|
599
|
-
parentCtx = new context_1.DBOSContextImpl(pctx.operationCaller ||
|
599
|
+
parentCtx = new context_1.DBOSContextImpl(pctx.operationCaller || 'workflowCaller', span, DBOS.logger);
|
600
600
|
parentCtx.request = pctx.request || {};
|
601
|
-
parentCtx.authenticatedUser = pctx.authenticatedUser ||
|
602
|
-
parentCtx.assumedRole = pctx.assumedRole ||
|
601
|
+
parentCtx.authenticatedUser = pctx.authenticatedUser || '';
|
602
|
+
parentCtx.assumedRole = pctx.assumedRole || '';
|
603
603
|
parentCtx.authenticatedRoles = pctx.authenticatedRoles || [];
|
604
|
-
parentCtx.workflowUUID = wfId ||
|
604
|
+
parentCtx.workflowUUID = wfId || '';
|
605
605
|
}
|
606
606
|
const wfParams = {
|
607
607
|
workflowUUID: wfId,
|
@@ -614,7 +614,7 @@ class DBOS {
|
|
614
614
|
};
|
615
615
|
descriptor.value = invokeWrapper;
|
616
616
|
registration.wrappedFunction = invokeWrapper;
|
617
|
-
Object.defineProperty(invokeWrapper,
|
617
|
+
Object.defineProperty(invokeWrapper, 'name', {
|
618
618
|
value: registration.name,
|
619
619
|
});
|
620
620
|
(0, decorators_1.registerFunctionWrapper)(invokeWrapper, registration);
|
@@ -635,16 +635,16 @@ class DBOS {
|
|
635
635
|
}
|
636
636
|
else {
|
637
637
|
inst = this;
|
638
|
-
if (!(
|
639
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
638
|
+
if (!('name' in inst)) {
|
639
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call a `transaction` function on an object that is not a `ConfiguredInstance`');
|
640
640
|
}
|
641
641
|
}
|
642
642
|
if (DBOS.isWithinWorkflow()) {
|
643
643
|
if (DBOS.isInTransaction()) {
|
644
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
644
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to a `transaction` function from within a `transaction`');
|
645
645
|
}
|
646
646
|
if (DBOS.isInStep()) {
|
647
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
647
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to a `transaction` function from within a `step`');
|
648
648
|
}
|
649
649
|
const wfctx = (0, context_1.assertCurrentWorkflowContext)();
|
650
650
|
return await dbos_executor_1.DBOSExecutor.globalInstance.callTransactionFunction(registration.registeredFunction, inst ?? null, wfctx, ...rawArgs);
|
@@ -653,7 +653,7 @@ class DBOS {
|
|
653
653
|
const pctx = (0, context_1.getCurrentContextStore)();
|
654
654
|
let span = pctx?.span;
|
655
655
|
if (!span) {
|
656
|
-
span = DBOS.executor.tracer.startSpan(pctx?.operationCaller ||
|
656
|
+
span = DBOS.executor.tracer.startSpan(pctx?.operationCaller || 'transactionCaller', {
|
657
657
|
operationType: pctx?.operationType,
|
658
658
|
authenticatedUser: pctx?.authenticatedUser,
|
659
659
|
assumedRole: pctx?.assumedRole,
|
@@ -665,10 +665,10 @@ class DBOS {
|
|
665
665
|
parentCtx = pctx.ctx;
|
666
666
|
}
|
667
667
|
if (!parentCtx) {
|
668
|
-
parentCtx = new context_1.DBOSContextImpl(pctx?.operationCaller ||
|
668
|
+
parentCtx = new context_1.DBOSContextImpl(pctx?.operationCaller || 'workflowCaller', span, DBOS.logger);
|
669
669
|
parentCtx.request = pctx?.request || {};
|
670
|
-
parentCtx.authenticatedUser = pctx?.authenticatedUser ||
|
671
|
-
parentCtx.assumedRole = pctx?.assumedRole ||
|
670
|
+
parentCtx.authenticatedUser = pctx?.authenticatedUser || '';
|
671
|
+
parentCtx.assumedRole = pctx?.assumedRole || '';
|
672
672
|
parentCtx.authenticatedRoles = pctx?.authenticatedRoles || [];
|
673
673
|
}
|
674
674
|
const wfParams = {
|
@@ -680,7 +680,7 @@ class DBOS {
|
|
680
680
|
};
|
681
681
|
descriptor.value = invokeWrapper;
|
682
682
|
registration.wrappedFunction = invokeWrapper;
|
683
|
-
Object.defineProperty(invokeWrapper,
|
683
|
+
Object.defineProperty(invokeWrapper, 'name', {
|
684
684
|
value: registration.name,
|
685
685
|
});
|
686
686
|
return descriptor;
|
@@ -693,7 +693,7 @@ class DBOS {
|
|
693
693
|
registration.procConfig = config;
|
694
694
|
const invokeWrapper = async function (...rawArgs) {
|
695
695
|
if (typeof this !== 'function') {
|
696
|
-
throw new Error(
|
696
|
+
throw new Error('Stored procedures must be static');
|
697
697
|
}
|
698
698
|
if (DBOS.isWithinWorkflow()) {
|
699
699
|
const wfctx = (0, context_1.assertCurrentWorkflowContext)();
|
@@ -703,7 +703,7 @@ class DBOS {
|
|
703
703
|
const pctx = (0, context_1.getCurrentContextStore)();
|
704
704
|
let span = pctx?.span;
|
705
705
|
if (!span) {
|
706
|
-
span = DBOS.executor.tracer.startSpan(pctx?.operationCaller ||
|
706
|
+
span = DBOS.executor.tracer.startSpan(pctx?.operationCaller || 'transactionCaller', {
|
707
707
|
operationType: pctx?.operationType,
|
708
708
|
authenticatedUser: pctx?.authenticatedUser,
|
709
709
|
assumedRole: pctx?.assumedRole,
|
@@ -715,10 +715,10 @@ class DBOS {
|
|
715
715
|
parentCtx = pctx.ctx;
|
716
716
|
}
|
717
717
|
if (!parentCtx) {
|
718
|
-
parentCtx = new context_1.DBOSContextImpl(pctx?.operationCaller ||
|
718
|
+
parentCtx = new context_1.DBOSContextImpl(pctx?.operationCaller || 'workflowCaller', span, DBOS.logger);
|
719
719
|
parentCtx.request = pctx?.request || {};
|
720
|
-
parentCtx.authenticatedUser = pctx?.authenticatedUser ||
|
721
|
-
parentCtx.assumedRole = pctx?.assumedRole ||
|
720
|
+
parentCtx.authenticatedUser = pctx?.authenticatedUser || '';
|
721
|
+
parentCtx.assumedRole = pctx?.assumedRole || '';
|
722
722
|
parentCtx.authenticatedRoles = pctx?.authenticatedRoles || [];
|
723
723
|
}
|
724
724
|
const wfParams = {
|
@@ -729,7 +729,7 @@ class DBOS {
|
|
729
729
|
};
|
730
730
|
descriptor.value = invokeWrapper;
|
731
731
|
registration.wrappedFunction = invokeWrapper;
|
732
|
-
Object.defineProperty(invokeWrapper,
|
732
|
+
Object.defineProperty(invokeWrapper, 'name', {
|
733
733
|
value: registration.name,
|
734
734
|
});
|
735
735
|
return descriptor;
|
@@ -747,13 +747,13 @@ class DBOS {
|
|
747
747
|
}
|
748
748
|
else {
|
749
749
|
inst = this;
|
750
|
-
if (!(
|
751
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
750
|
+
if (!('name' in inst)) {
|
751
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Attempt to call a `step` function on an object that is not a `ConfiguredInstance`');
|
752
752
|
}
|
753
753
|
}
|
754
754
|
if (DBOS.isWithinWorkflow()) {
|
755
755
|
if (DBOS.isInTransaction()) {
|
756
|
-
throw new error_1.DBOSInvalidWorkflowTransitionError(
|
756
|
+
throw new error_1.DBOSInvalidWorkflowTransitionError('Invalid call to a `step` function from within a `transaction`');
|
757
757
|
}
|
758
758
|
if (DBOS.isInStep()) {
|
759
759
|
// There should probably be checks here about the compatibility of the StepConfig...
|
@@ -766,7 +766,7 @@ class DBOS {
|
|
766
766
|
const pctx = (0, context_1.getCurrentContextStore)();
|
767
767
|
let span = pctx?.span;
|
768
768
|
if (!span) {
|
769
|
-
span = DBOS.executor.tracer.startSpan(pctx?.operationCaller ||
|
769
|
+
span = DBOS.executor.tracer.startSpan(pctx?.operationCaller || 'transactionCaller', {
|
770
770
|
operationType: pctx?.operationType,
|
771
771
|
authenticatedUser: pctx?.authenticatedUser,
|
772
772
|
assumedRole: pctx?.assumedRole,
|
@@ -778,10 +778,10 @@ class DBOS {
|
|
778
778
|
parentCtx = pctx.ctx;
|
779
779
|
}
|
780
780
|
if (!parentCtx) {
|
781
|
-
parentCtx = new context_1.DBOSContextImpl(pctx?.operationCaller ||
|
781
|
+
parentCtx = new context_1.DBOSContextImpl(pctx?.operationCaller || 'workflowCaller', span, DBOS.logger);
|
782
782
|
parentCtx.request = pctx?.request || {};
|
783
|
-
parentCtx.authenticatedUser = pctx?.authenticatedUser ||
|
784
|
-
parentCtx.assumedRole = pctx?.assumedRole ||
|
783
|
+
parentCtx.authenticatedUser = pctx?.authenticatedUser || '';
|
784
|
+
parentCtx.assumedRole = pctx?.assumedRole || '';
|
785
785
|
parentCtx.authenticatedRoles = pctx?.authenticatedRoles || [];
|
786
786
|
}
|
787
787
|
const wfParams = {
|
@@ -793,7 +793,7 @@ class DBOS {
|
|
793
793
|
};
|
794
794
|
descriptor.value = invokeWrapper;
|
795
795
|
registration.wrappedFunction = invokeWrapper;
|
796
|
-
Object.defineProperty(invokeWrapper,
|
796
|
+
Object.defineProperty(invokeWrapper, 'name', {
|
797
797
|
value: registration.name,
|
798
798
|
});
|
799
799
|
return descriptor;
|
@@ -847,7 +847,7 @@ class DBOS {
|
|
847
847
|
}
|
848
848
|
return dbos_executor_1.DBOSExecutor.globalInstance.executeWorkflowUUID(workflowId, startNewWorkflow);
|
849
849
|
}
|
850
|
-
static async recoverPendingWorkflows(executorIDs = [
|
850
|
+
static async recoverPendingWorkflows(executorIDs = ['local']) {
|
851
851
|
if (!dbos_executor_1.DBOSExecutor.globalInstance) {
|
852
852
|
throw new error_1.DBOSExecutorNotInitializedError();
|
853
853
|
}
|