@dbos-inc/dbos-sdk 0.7.21-preview → 0.7.35
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.js +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -1
- package/dist/src/cloud-cli/cli.js +19 -7
- package/dist/src/cloud-cli/cli.js.map +1 -1
- package/dist/src/cloud-cli/userdb.d.ts +2 -0
- package/dist/src/cloud-cli/userdb.d.ts.map +1 -1
- package/dist/src/cloud-cli/userdb.js +78 -5
- package/dist/src/cloud-cli/userdb.js.map +1 -1
- package/dist/src/communicator.d.ts +2 -1
- package/dist/src/communicator.d.ts.map +1 -1
- package/dist/src/communicator.js.map +1 -1
- package/dist/src/context.d.ts +3 -2
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +7 -7
- package/dist/src/context.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +7 -1
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +110 -35
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts +1 -0
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +1 -0
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/dbos-runtime/config.d.ts +3 -0
- package/dist/src/dbos-runtime/config.d.ts.map +1 -1
- package/dist/src/dbos-runtime/config.js +1 -0
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos-runtime/runtime.d.ts +1 -1
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
- package/dist/src/dbos-runtime/runtime.js +9 -9
- package/dist/src/dbos-runtime/runtime.js.map +1 -1
- package/dist/src/debugger/debug_workflow.d.ts +38 -0
- package/dist/src/debugger/debug_workflow.d.ts.map +1 -0
- package/dist/src/debugger/debug_workflow.js +192 -0
- package/dist/src/debugger/debug_workflow.js.map +1 -0
- package/dist/src/error.d.ts +3 -0
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +8 -1
- package/dist/src/error.js.map +1 -1
- package/dist/src/httpServer/handler.d.ts +2 -1
- package/dist/src/httpServer/handler.d.ts.map +1 -1
- package/dist/src/httpServer/handler.js +27 -15
- package/dist/src/httpServer/handler.js.map +1 -1
- package/dist/src/httpServer/server.d.ts +3 -3
- package/dist/src/httpServer/server.d.ts.map +1 -1
- package/dist/src/httpServer/server.js +19 -17
- package/dist/src/httpServer/server.js.map +1 -1
- package/dist/src/system_database.d.ts +2 -0
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +9 -2
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/telemetry/collector.d.ts +2 -2
- package/dist/src/telemetry/collector.d.ts.map +1 -1
- package/dist/src/telemetry/collector.js.map +1 -1
- package/dist/src/telemetry/exporters.d.ts +5 -6
- package/dist/src/telemetry/exporters.d.ts.map +1 -1
- package/dist/src/telemetry/exporters.js +2 -42
- package/dist/src/telemetry/exporters.js.map +1 -1
- package/dist/src/telemetry/signals.d.ts +0 -10
- package/dist/src/telemetry/signals.d.ts.map +1 -1
- package/dist/src/telemetry/signals.js.map +1 -1
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.js +7 -1
- package/dist/src/testing/testing_runtime.js.map +1 -1
- package/dist/src/transaction.d.ts +2 -1
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/transaction.js.map +1 -1
- package/dist/src/workflow.d.ts +15 -2
- package/dist/src/workflow.d.ts.map +1 -1
- package/dist/src/workflow.js +92 -56
- package/dist/src/workflow.js.map +1 -1
- package/examples/hello/README.md +1 -1
- package/examples/hello/dbos-config.yaml +3 -0
- package/package.json +2 -2
- package/dist/src/provenance/provenance_daemon.d.ts +0 -34
- package/dist/src/provenance/provenance_daemon.d.ts.map +0 -1
- package/dist/src/provenance/provenance_daemon.js +0 -86
- package/dist/src/provenance/provenance_daemon.js.map +0 -1
@@ -0,0 +1,192 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.WorkflowContextDebug = void 0;
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
5
|
+
const dbos_executor_1 = require("../dbos-executor");
|
6
|
+
const transaction_1 = require("../transaction");
|
7
|
+
const error_1 = require("../error");
|
8
|
+
const serialize_error_1 = require("serialize-error");
|
9
|
+
const context_1 = require("../context");
|
10
|
+
const decorators_1 = require("../decorators");
|
11
|
+
/**
|
12
|
+
* Context used for debugging a workflow
|
13
|
+
*/
|
14
|
+
class WorkflowContextDebug extends context_1.DBOSContextImpl {
|
15
|
+
workflowConfig;
|
16
|
+
functionID = 0;
|
17
|
+
#dbosExec;
|
18
|
+
isTempWorkflow;
|
19
|
+
constructor(dbosExec, parentCtx, workflowUUID, workflowConfig, workflowName) {
|
20
|
+
const span = dbosExec.tracer.startSpan(workflowName, { workflowUUID: workflowUUID }, parentCtx?.span);
|
21
|
+
super(workflowName, span, dbosExec.logger, parentCtx);
|
22
|
+
this.workflowConfig = workflowConfig;
|
23
|
+
this.workflowUUID = workflowUUID;
|
24
|
+
this.#dbosExec = dbosExec;
|
25
|
+
this.isTempWorkflow = dbosExec.tempWorkflowName === workflowName;
|
26
|
+
if (dbosExec.config.application) {
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
28
|
+
this.applicationConfig = dbosExec.config.application;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
functionIDGetIncrement() {
|
32
|
+
return this.functionID++;
|
33
|
+
}
|
34
|
+
invoke(object) {
|
35
|
+
const ops = (0, decorators_1.getRegisteredOperations)(object);
|
36
|
+
const proxy = {};
|
37
|
+
for (const op of ops) {
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
39
|
+
proxy[op.name] = op.txnConfig
|
40
|
+
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
41
|
+
(...args) => this.transaction(op.registeredFunction, ...args)
|
42
|
+
: op.commConfig
|
43
|
+
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
44
|
+
(...args) => this.external(op.registeredFunction, ...args)
|
45
|
+
: undefined;
|
46
|
+
}
|
47
|
+
return proxy;
|
48
|
+
}
|
49
|
+
async checkExecution(client, funcID) {
|
50
|
+
// Note: we read the recorded snapshot and transaction ID!
|
51
|
+
const query = "SELECT output, error, txn_snapshot, txn_id FROM dbos.transaction_outputs WHERE workflow_uuid=$1 AND function_id=$2";
|
52
|
+
const rows = await this.#dbosExec.userDatabase.queryWithClient(client, query, this.workflowUUID, funcID);
|
53
|
+
if (rows.length === 0 || rows.length > 1) {
|
54
|
+
this.logger.error("Unexpected! This should never happen during debug. Returned rows: " + rows.toString() + `. WorkflowUUID ${this.workflowUUID}, function ID ${funcID}`);
|
55
|
+
throw new error_1.DBOSDebuggerError(`This should never happen during debug. Returned ${rows.length} rows: ` + rows.toString());
|
56
|
+
}
|
57
|
+
if (JSON.parse(rows[0].error) != null) {
|
58
|
+
throw (0, serialize_error_1.deserializeError)(JSON.parse(rows[0].error)); // We don't replay errors.
|
59
|
+
}
|
60
|
+
const res = {
|
61
|
+
output: JSON.parse(rows[0].output),
|
62
|
+
txn_snapshot: rows[0].txn_snapshot,
|
63
|
+
txn_id: rows[0].txn_id,
|
64
|
+
};
|
65
|
+
// Send a signal to the debug proxy.
|
66
|
+
// TODO: use the real command once the proxy is fully implemented.
|
67
|
+
await this.#dbosExec.userDatabase.queryWithClient(client, `--proxy:${res.txn_id}`);
|
68
|
+
return res;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Execute a transactional function in debug mode.
|
72
|
+
* It connects to a debug proxy and everything should be read-only.
|
73
|
+
*/
|
74
|
+
async transaction(txn, ...args) {
|
75
|
+
const config = this.#dbosExec.transactionConfigMap.get(txn.name);
|
76
|
+
if (config === undefined) {
|
77
|
+
throw new error_1.DBOSDebuggerError(`Transaction ${txn.name} not registered!`);
|
78
|
+
}
|
79
|
+
// const readOnly = true; // TODO: eventually, this transaction must be read-only.
|
80
|
+
const funcID = this.functionIDGetIncrement();
|
81
|
+
const span = this.#dbosExec.tracer.startSpan(txn.name, {}, this.span);
|
82
|
+
let check;
|
83
|
+
const wrappedTransaction = async (client) => {
|
84
|
+
// Original result must exist during replay.
|
85
|
+
const tCtxt = new transaction_1.TransactionContextImpl(this.#dbosExec.userDatabase.getName(), client, this, span, this.#dbosExec.logger, funcID, txn.name);
|
86
|
+
check = await this.checkExecution(client, funcID);
|
87
|
+
// Execute the user's transaction.
|
88
|
+
const result = await txn(tCtxt, ...args);
|
89
|
+
return result;
|
90
|
+
};
|
91
|
+
const result = await this.#dbosExec.userDatabase.transaction(wrappedTransaction, config);
|
92
|
+
if (JSON.stringify(check.output) !== JSON.stringify(result)) {
|
93
|
+
this.logger.error(`Detected different transaction output than the original one!\n Expected: ${JSON.stringify(result)}\n Received: ${JSON.stringify(check.output)}`);
|
94
|
+
}
|
95
|
+
return check.output; // Always return the recorded result.
|
96
|
+
}
|
97
|
+
async external(commFn, ..._args) {
|
98
|
+
const commConfig = this.#dbosExec.communicatorConfigMap.get(commFn.name);
|
99
|
+
if (commConfig === undefined) {
|
100
|
+
throw new error_1.DBOSDebuggerError(`Communicator ${commFn.name} not registered!`);
|
101
|
+
}
|
102
|
+
const funcID = this.functionIDGetIncrement();
|
103
|
+
// Original result must exist during replay.
|
104
|
+
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, funcID);
|
105
|
+
if (check === dbos_executor_1.dbosNull) {
|
106
|
+
throw new error_1.DBOSDebuggerError(`Cannot find recorded communicator output for ${commFn.name}. Shouldn't happen in debug mode!`);
|
107
|
+
}
|
108
|
+
this.logger.debug("Use recorded communicator output.");
|
109
|
+
return check;
|
110
|
+
}
|
111
|
+
// Invoke the debugWorkflow() function instead.
|
112
|
+
async childWorkflow(wf, ...args) {
|
113
|
+
const funcId = this.functionIDGetIncrement();
|
114
|
+
const childUUID = this.workflowUUID + "-" + funcId;
|
115
|
+
return this.#dbosExec.debugWorkflow(wf, { parentCtx: this, workflowUUID: childUUID }, this.workflowUUID, funcId, ...args);
|
116
|
+
}
|
117
|
+
async send(_destinationUUID, _message, _topic) {
|
118
|
+
const functionID = this.functionIDGetIncrement();
|
119
|
+
// Original result must exist during replay.
|
120
|
+
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
121
|
+
if (check === dbos_executor_1.dbosNull) {
|
122
|
+
throw new error_1.DBOSDebuggerError(`Cannot find recorded send. Shouldn't happen in debug mode!`);
|
123
|
+
}
|
124
|
+
this.logger.debug("Use recorded send output.");
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
async recv(_topic, _timeoutSeconds) {
|
128
|
+
const functionID = this.functionIDGetIncrement();
|
129
|
+
// Original result must exist during replay.
|
130
|
+
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
131
|
+
if (check === dbos_executor_1.dbosNull) {
|
132
|
+
throw new error_1.DBOSDebuggerError(`Cannot find recorded recv. Shouldn't happen in debug mode!`);
|
133
|
+
}
|
134
|
+
this.logger.debug("Use recorded recv output.");
|
135
|
+
return check;
|
136
|
+
}
|
137
|
+
async setEvent(_key, _value) {
|
138
|
+
const functionID = this.functionIDGetIncrement();
|
139
|
+
// Original result must exist during replay.
|
140
|
+
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
141
|
+
if (check === dbos_executor_1.dbosNull) {
|
142
|
+
throw new error_1.DBOSDebuggerError(`Cannot find recorded setEvent. Shouldn't happen in debug mode!`);
|
143
|
+
}
|
144
|
+
this.logger.debug("Use recorded setEvent output.");
|
145
|
+
}
|
146
|
+
async getEvent(_workflowUUID, _key, _timeoutSeconds) {
|
147
|
+
const functionID = this.functionIDGetIncrement();
|
148
|
+
// Original result must exist during replay.
|
149
|
+
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
150
|
+
if (check === dbos_executor_1.dbosNull) {
|
151
|
+
throw new error_1.DBOSDebuggerError(`Cannot find recorded getEvent. Shouldn't happen in debug mode!`);
|
152
|
+
}
|
153
|
+
this.logger.debug("Use recorded getEvent output.");
|
154
|
+
return check;
|
155
|
+
}
|
156
|
+
retrieveWorkflow(targetUUID) {
|
157
|
+
// TODO: write a proper test for this.
|
158
|
+
const functionID = this.functionIDGetIncrement();
|
159
|
+
return new RetrievedHandleDebug(this.#dbosExec.systemDatabase, targetUUID, this.workflowUUID, functionID);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
exports.WorkflowContextDebug = WorkflowContextDebug;
|
163
|
+
/**
|
164
|
+
* The handle returned when retrieving a workflow with Debug workflow's retrieve
|
165
|
+
*/
|
166
|
+
class RetrievedHandleDebug {
|
167
|
+
systemDatabase;
|
168
|
+
workflowUUID;
|
169
|
+
callerUUID;
|
170
|
+
callerFunctionID;
|
171
|
+
constructor(systemDatabase, workflowUUID, callerUUID, callerFunctionID) {
|
172
|
+
this.systemDatabase = systemDatabase;
|
173
|
+
this.workflowUUID = workflowUUID;
|
174
|
+
this.callerUUID = callerUUID;
|
175
|
+
this.callerFunctionID = callerFunctionID;
|
176
|
+
}
|
177
|
+
getWorkflowUUID() {
|
178
|
+
return this.workflowUUID;
|
179
|
+
}
|
180
|
+
async getStatus() {
|
181
|
+
// Must use original result.
|
182
|
+
const check = await this.systemDatabase.checkOperationOutput(this.callerUUID, this.callerFunctionID);
|
183
|
+
if (check === dbos_executor_1.dbosNull) {
|
184
|
+
throw new error_1.DBOSDebuggerError(`Cannot find recorded workflow status. Shouldn't happen in debug mode!`);
|
185
|
+
}
|
186
|
+
return check;
|
187
|
+
}
|
188
|
+
async getResult() {
|
189
|
+
return await this.systemDatabase.getWorkflowResult(this.workflowUUID);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
//# sourceMappingURL=debug_workflow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":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,EAAE,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAC5G,CAAC;CACF;AA5KD,oDA4KC;AAED;;GAEG;AACH,MAAM,oBAAoB;IACH;IAAyC;IAA+B;IAA6B;IAA1H,YAAqB,cAA8B,EAAW,YAAoB,EAAW,UAAkB,EAAW,gBAAwB;QAA7H,mBAAc,GAAd,cAAc,CAAgB;QAAW,iBAAY,GAAZ,YAAY,CAAQ;QAAW,eAAU,GAAV,UAAU,CAAQ;QAAW,qBAAgB,GAAhB,gBAAgB,CAAQ;IAAG,CAAC;IAEtJ,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,SAAS;QACb,4BAA4B;QAC5B,MAAM,KAAK,GAAqC,MAAM,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAwB,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC9J,IAAI,KAAK,KAAK,wBAAQ,EAAE;YACtB,MAAM,IAAI,yBAAiB,CAAC,uEAAuE,CAAC,CAAC;SACtG;QACD,OAAO,KAA8B,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
package/dist/src/error.d.ts
CHANGED
@@ -41,4 +41,7 @@ export declare class DBOSUndefinedDecoratorInputError extends DBOSError {
|
|
41
41
|
export declare class DBOSConfigKeyTypeError extends DBOSError {
|
42
42
|
constructor(configKey: string, expectedType: string, actualType: string);
|
43
43
|
}
|
44
|
+
export declare class DBOSDebuggerError extends DBOSError {
|
45
|
+
constructor(msg: string);
|
46
|
+
}
|
44
47
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/src/error.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/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Y;CAGvD;AAGD,qBAAa,gCAAiC,SAAQ,SAAS;gBACjD,aAAa,EAAE,MAAM;CAGlC;AAGD,qBAAa,sBAAuB,SAAQ,SAAS;gBACvC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAGxE;AAGD,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,GAAG,EAAE,MAAM;CAGxB"}
|
package/dist/src/error.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DBOSConfigKeyTypeError = exports.DBOSUndefinedDecoratorInputError = exports.DBOSNotAuthorizedError = exports.DBOSResponseError = exports.DuplicateWorkflowEventError = exports.DBOSDataValidationError = exports.DBOSPostgresExporterError = exports.DBOSNotRegisteredError = exports.DBOSWorkflowConflictUUIDError = exports.DBOSTopicPermissionDeniedError = exports.DBOSInitializationError = exports.DBOSWorkflowPermissionDeniedError = exports.DBOSError = exports.isClientError = void 0;
|
3
|
+
exports.DBOSDebuggerError = exports.DBOSConfigKeyTypeError = exports.DBOSUndefinedDecoratorInputError = exports.DBOSNotAuthorizedError = exports.DBOSResponseError = exports.DuplicateWorkflowEventError = exports.DBOSDataValidationError = exports.DBOSPostgresExporterError = exports.DBOSNotRegisteredError = exports.DBOSWorkflowConflictUUIDError = exports.DBOSTopicPermissionDeniedError = exports.DBOSInitializationError = exports.DBOSWorkflowPermissionDeniedError = exports.DBOSError = exports.isClientError = void 0;
|
4
4
|
const pg_1 = require("pg");
|
5
5
|
function formatPgDatabaseError(err) {
|
6
6
|
let msg = "";
|
@@ -161,4 +161,11 @@ class DBOSConfigKeyTypeError extends DBOSError {
|
|
161
161
|
}
|
162
162
|
}
|
163
163
|
exports.DBOSConfigKeyTypeError = DBOSConfigKeyTypeError;
|
164
|
+
const DebuggerError = 15;
|
165
|
+
class DBOSDebuggerError extends DBOSError {
|
166
|
+
constructor(msg) {
|
167
|
+
super("DEBUGGER: " + msg, DebuggerError);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
exports.DBOSDebuggerError = DBOSDebuggerError;
|
164
171
|
//# sourceMappingURL=error.js.map
|
package/dist/src/error.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";;;AAAA,2BAAmC;AAEnC,SAAS,qBAAqB,CAAC,GAAkB;IAC/C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC;KAClD;IACD,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC;KAC1C;IACD,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;KAC9C;IACD,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC;KAC1C;IACD,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC;KAClD;IACD,IAAI,GAAG,CAAC,gBAAgB,EAAE;QACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,qBAAqB,GAAG,CAAC,gBAAgB,KAAK,CAAC,CAAC;KAClE;IACD,IAAI,GAAG,CAAC,aAAa,EAAE;QACrB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,kBAAkB,GAAG,CAAC,aAAa,KAAK,CAAC,CAAC;KAC5D;IACD,IAAI,G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C,GAAG,EAAE,EAAE,sBAAsB,CAAC,CAAC;IACzG,CAAC;CACF;AAJD,kEAIC;AAED,wCAAwC;AACxC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAa,iBAAkB,SAAQ,SAAS;IACZ;IAAlC,YAAY,GAAW,EAAW,SAAiB,GAAG;QACpD,KAAK,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QADM,WAAM,GAAN,MAAM,CAAc;IAEtD,CAAC;CACF;AAJD,8CAIC;AAED,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAa,sBAAuB,SAAQ,SAAS;IACjB;IAAlC,YAAY,GAAW,EAAW,SAAiB,GAAG;QACpD,KAAK,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;QADC,WAAM,GAAN,MAAM,CAAc;IAEtD,CAAC;CACF;AAJD,wDAIC;AAED,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,MAAa,gCAAiC,SAAQ,SAAS;IAC7D,YAAY,aAAqB;QAC/B,KAAK,CAAC,GAAG,aAAa,0DAA0D,EAAE,4BAA4B,CAAC,CAAC;IAClH,CAAC;CACF;AAJD,4EAIC;AAED,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAa,sBAAuB,SAAQ,SAAS;IACnD,YAAY,SAAiB,EAAE,YAAoB,EAAE,UAAkB;QACrE,KAAK,CAAC,GAAG,SAAS,sBAAsB,YAAY,aAAa,UAAU,EAAE,EAAE,kBAAkB,CAAC,CAAC;IACrG,CAAC;CACF;AAJD,wDAIC;AAED,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAa,iBAAkB,SAAQ,SAAS;IAC9C,YAAY,GAAW;QACrB,KAAK,CAAC,YAAY,GAAG,GAAG,EAAE,aAAa,CAAC,CAAC;IAC3C,CAAC;CACF;AAJD,8CAIC"}
|
@@ -16,11 +16,12 @@ export interface HandlerContext extends DBOSContext {
|
|
16
16
|
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
17
17
|
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
18
18
|
}
|
19
|
+
export declare const RequestIDHeader = "x-request-id";
|
19
20
|
export declare class HandlerContextImpl extends DBOSContextImpl implements HandlerContext {
|
20
21
|
#private;
|
21
22
|
readonly koaContext: Koa.Context;
|
22
23
|
readonly W3CTraceContextPropagator: W3CTraceContextPropagator;
|
23
|
-
constructor(
|
24
|
+
constructor(dbosExec: DBOSExecutor, koaContext: Koa.Context);
|
24
25
|
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
25
26
|
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
26
27
|
retrieveWorkflow<R>(workflowUUID: string): WorkflowHandle<R>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/httpServer/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAA8D,sBAAsB,EAA2B,MAAM,eAAe,CAAC;AACjL,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAY,cAAc,EAAE,cAAc,EAAkB,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/httpServer/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAA8D,sBAAsB,EAA2B,MAAM,eAAe,CAAC;AACjL,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD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nB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,gBAAgB,EAAE,CAAC;CAC1B;AAED,qBAAa,mBAAmB,CAAC,IAAI,EAAE,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,CAAE,SAAQ,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;IACnH,OAAO,EAAE,QAAQ,CAAgB;IACjC,MAAM,EAAE,MAAM,CAAM;IAEpB,IAAI,EAAE,gBAAgB,EAAE,CAAM;gBAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC;CAGrE;AAED,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,SAAS,EAAE,UAAU,CAAsB;gBAG/B,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ;CAGtC;AAMD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,2EAEtB,MAAM,eACD,MAAM,wLAWtB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,2EAEvB,MAAM,eACD,MAAM,wLAWtB;AAMD,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,YACjB,MAAM,eAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,UAMtF"}
|
@@ -1,17 +1,28 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ArgSource = exports.PostApi = exports.GetApi = exports.HandlerParameter = exports.HandlerRegistration = exports.ArgSources = exports.APITypes = exports.HandlerContextImpl = void 0;
|
3
|
+
exports.ArgSource = exports.PostApi = exports.GetApi = exports.HandlerParameter = exports.HandlerRegistration = exports.ArgSources = exports.APITypes = exports.HandlerContextImpl = exports.RequestIDHeader = void 0;
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
5
5
|
const decorators_1 = require("../decorators");
|
6
6
|
const dbos_executor_1 = require("../dbos-executor");
|
7
7
|
const context_1 = require("../context");
|
8
8
|
const core_1 = require("@opentelemetry/core");
|
9
9
|
const api_1 = require("@opentelemetry/api");
|
10
|
+
const uuid_1 = require("uuid");
|
11
|
+
exports.RequestIDHeader = "x-request-id";
|
12
|
+
function getOrGenerateRequestID(ctx) {
|
13
|
+
const reqID = ctx.get(exports.RequestIDHeader);
|
14
|
+
if (reqID) {
|
15
|
+
return reqID;
|
16
|
+
}
|
17
|
+
const newID = (0, uuid_1.v4)();
|
18
|
+
ctx.set(exports.RequestIDHeader, newID);
|
19
|
+
return newID;
|
20
|
+
}
|
10
21
|
class HandlerContextImpl extends context_1.DBOSContextImpl {
|
11
22
|
koaContext;
|
12
|
-
#
|
23
|
+
#dbosExec;
|
13
24
|
W3CTraceContextPropagator;
|
14
|
-
constructor(
|
25
|
+
constructor(dbosExec, koaContext) {
|
15
26
|
// If present, retrieve the trace context from the request
|
16
27
|
const httpTracer = new core_1.W3CTraceContextPropagator();
|
17
28
|
const extractedSpanContext = api_1.trace.getSpanContext(httpTracer.extract(api_1.ROOT_CONTEXT, koaContext.request.headers, api_1.defaultTextMapGetter));
|
@@ -20,13 +31,13 @@ class HandlerContextImpl extends context_1.DBOSContextImpl {
|
|
20
31
|
operationName: koaContext.url,
|
21
32
|
};
|
22
33
|
if (extractedSpanContext === undefined) {
|
23
|
-
span =
|
34
|
+
span = dbosExec.tracer.startSpan(koaContext.url, spanAttributes);
|
24
35
|
}
|
25
36
|
else {
|
26
37
|
extractedSpanContext.isRemote = true;
|
27
|
-
span =
|
38
|
+
span = dbosExec.tracer.startSpanWithContext(extractedSpanContext, koaContext.url, spanAttributes);
|
28
39
|
}
|
29
|
-
super(koaContext.url, span,
|
40
|
+
super(koaContext.url, span, dbosExec.logger);
|
30
41
|
this.koaContext = koaContext;
|
31
42
|
this.W3CTraceContextPropagator = httpTracer;
|
32
43
|
this.request = {
|
@@ -41,24 +52,25 @@ class HandlerContextImpl extends context_1.DBOSContextImpl {
|
|
41
52
|
querystring: koaContext.request.querystring,
|
42
53
|
url: koaContext.request.url,
|
43
54
|
ip: koaContext.request.ip,
|
55
|
+
requestID: getOrGenerateRequestID(koaContext),
|
44
56
|
};
|
45
|
-
if (
|
57
|
+
if (dbosExec.config.application) {
|
46
58
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
47
|
-
this.applicationConfig =
|
59
|
+
this.applicationConfig = dbosExec.config.application;
|
48
60
|
}
|
49
|
-
this.#
|
61
|
+
this.#dbosExec = dbosExec;
|
50
62
|
}
|
51
63
|
///////////////////////
|
52
64
|
/* PUBLIC INTERFACE */
|
53
65
|
///////////////////////
|
54
66
|
async send(destinationUUID, message, topic, idempotencyKey) {
|
55
|
-
return this.#
|
67
|
+
return this.#dbosExec.send(destinationUUID, message, topic, idempotencyKey);
|
56
68
|
}
|
57
69
|
async getEvent(workflowUUID, key, timeoutSeconds = dbos_executor_1.DBOSExecutor.defaultNotificationTimeoutSec) {
|
58
|
-
return this.#
|
70
|
+
return this.#dbosExec.getEvent(workflowUUID, key, timeoutSeconds);
|
59
71
|
}
|
60
72
|
retrieveWorkflow(workflowUUID) {
|
61
|
-
return this.#
|
73
|
+
return this.#dbosExec.retrieveWorkflow(workflowUUID);
|
62
74
|
}
|
63
75
|
/**
|
64
76
|
* Generate a proxy object for the provided class that wraps direct calls (i.e. OpClass.someMethod(param))
|
@@ -87,13 +99,13 @@ class HandlerContextImpl extends context_1.DBOSContextImpl {
|
|
87
99
|
/* PRIVATE METHODS */
|
88
100
|
/////////////////////
|
89
101
|
async #workflow(wf, params, ...args) {
|
90
|
-
return this.#
|
102
|
+
return this.#dbosExec.workflow(wf, params, ...args);
|
91
103
|
}
|
92
104
|
async #transaction(txn, params, ...args) {
|
93
|
-
return this.#
|
105
|
+
return this.#dbosExec.transaction(txn, params, ...args);
|
94
106
|
}
|
95
107
|
async #external(commFn, params, ...args) {
|
96
|
-
return this.#
|
108
|
+
return this.#dbosExec.external(commFn, params, ...args);
|
97
109
|
}
|
98
110
|
}
|
99
111
|
exports.HandlerContextImpl = HandlerContextImpl;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/httpServer/handler.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,8CAAiL;AACjL,oDAAgD;AAChD,wCAA0D;AAI1D,8CAAgE;AAChE,4CAA+E;
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/httpServer/handler.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,8CAAiL;AACjL,oDAAgD;AAChD,wCAA0D;AAI1D,8CAAgE;AAChE,4CAA+E;AAE/E,+BAAoC;AAmBvB,QAAA,eAAe,GAAG,cAAc,CAAC;AAC9C,SAAS,sBAAsB,CAAC,GAAgB;IAC9C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,uBAAe,CAAC,CAAC;IACvC,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IACD,MAAM,KAAK,GAAG,IAAA,SAAM,GAAE,CAAC;IACvB,GAAG,CAAC,GAAG,CAAC,uBAAe,EAAE,KAAK,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAa,kBAAmB,SAAQ,yBAAe;IAIR;IAHpC,SAAS,CAAe;IACxB,yBAAyB,CAA4B;IAE9D,YAAY,QAAsB,EAAW,UAAuB;QAClE,0DAA0D;QAC1D,MAAM,UAAU,GAAG,IAAI,gCAAyB,EAAE,CAAC;QACnD,MAAM,oBAAoB,GAAG,WAAK,CAAC,cAAc,CAC7C,UAAU,CAAC,OAAO,CAAC,kBAAY,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,0BAAoB,CAAC,CACrF,CAAA;QACD,IAAI,IAAU,CAAC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,CAAC;QAE5C,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,0BAcC;AAED,mCAAmC;AACnC,mCAAmC;AACnC,mCAAmC;AAEnC,SAAgB,SAAS,CAAC,MAAkB;IAC1C,OAAO,UAAU,MAAc,EAAE,WAA4B,EAAE,cAAsB;QACnF,MAAM,kBAAkB,GAAG,IAAA,8CAAiC,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAElF,MAAM,QAAQ,GAAG,kBAAkB,CAAC,cAAc,CAAqB,CAAC;QACxE,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC;AAPD,8BAOC"}
|
@@ -16,7 +16,7 @@ export declare class DBOSHttpServer {
|
|
16
16
|
/**
|
17
17
|
* Create a Koa app.
|
18
18
|
* @param dbosExec User pass in an DBOS workflow executor instance.
|
19
|
-
* TODO: maybe call
|
19
|
+
* TODO: maybe call dbosExec.init() somewhere in this class?
|
20
20
|
*/
|
21
21
|
constructor(dbosExec: DBOSExecutor, config?: {
|
22
22
|
koa?: Koa;
|
@@ -31,10 +31,10 @@ export declare class DBOSHttpServer {
|
|
31
31
|
* Register workflow recovery endpoint.
|
32
32
|
* Receives a list of executor IDs and returns a list of workflowUUIDs.
|
33
33
|
*/
|
34
|
-
static registerRecoveryEndpoint(
|
34
|
+
static registerRecoveryEndpoint(dbosExec: DBOSExecutor, router: Router): void;
|
35
35
|
/**
|
36
36
|
* Register decorated functions as HTTP endpoints.
|
37
37
|
*/
|
38
|
-
static registerDecoratedEndpoints(
|
38
|
+
static registerDecoratedEndpoints(dbosExec: DBOSExecutor, router: Router): void;
|
39
39
|
}
|
40
40
|
//# sourceMappingURL=server.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/httpServer/server.ts"],"names":[],"mappings":";;;;AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,MAAM,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/httpServer/server.ts"],"names":[],"mappings":";;;;AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,MAAM,MAAM,aAAa,CAAC;AAkBjC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKjC,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,mBAAmB,4BAA4B,CAAA;AAE5D,qBAAa,cAAc;IAUb,QAAQ,CAAC,QAAQ,EAAE,YAAY;IAT3C,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;OAIG;gBACkB,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAE;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAuBxF;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM;IAOnB;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAmBtE;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;CAwKzE"}
|
@@ -21,7 +21,7 @@ class DBOSHttpServer {
|
|
21
21
|
/**
|
22
22
|
* Create a Koa app.
|
23
23
|
* @param dbosExec User pass in an DBOS workflow executor instance.
|
24
|
-
* TODO: maybe call
|
24
|
+
* TODO: maybe call dbosExec.init() somewhere in this class?
|
25
25
|
*/
|
26
26
|
constructor(dbosExec, config = {}) {
|
27
27
|
this.dbosExec = dbosExec;
|
@@ -57,44 +57,44 @@ class DBOSHttpServer {
|
|
57
57
|
* Register workflow recovery endpoint.
|
58
58
|
* Receives a list of executor IDs and returns a list of workflowUUIDs.
|
59
59
|
*/
|
60
|
-
static registerRecoveryEndpoint(
|
60
|
+
static registerRecoveryEndpoint(dbosExec, router) {
|
61
61
|
// Handler function that parses request for recovery.
|
62
62
|
const recoveryHandler = async (koaCtxt, koaNext) => {
|
63
63
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
64
64
|
const executorIDs = koaCtxt.request.body;
|
65
|
-
|
66
|
-
const recoverHandles = await
|
65
|
+
dbosExec.logger.info("Recovering workflows for executors: " + executorIDs.toString());
|
66
|
+
const recoverHandles = await dbosExec.recoverPendingWorkflows(executorIDs);
|
67
67
|
// Return a list of workflowUUIDs being recovered.
|
68
68
|
koaCtxt.body = await Promise.allSettled(recoverHandles.map((i) => i.getWorkflowUUID())).then((results) => results.filter((i) => i.status === "fulfilled").map((i) => i.value));
|
69
69
|
await koaNext();
|
70
70
|
};
|
71
71
|
router.post(exports.WorkflowRecoveryUrl, recoveryHandler);
|
72
|
-
|
72
|
+
dbosExec.logger.debug(`DBOS Server Registered Recovery POST ${exports.WorkflowRecoveryUrl}`);
|
73
73
|
}
|
74
74
|
/**
|
75
75
|
* Register decorated functions as HTTP endpoints.
|
76
76
|
*/
|
77
|
-
static registerDecoratedEndpoints(
|
77
|
+
static registerDecoratedEndpoints(dbosExec, router) {
|
78
78
|
// Register user declared endpoints, wrap around the endpoint with request parsing and response.
|
79
|
-
|
79
|
+
dbosExec.registeredOperations.forEach((registeredOperation) => {
|
80
80
|
const ro = registeredOperation;
|
81
81
|
if (ro.apiURL) {
|
82
82
|
// Ignore URL with "/dbos-workflow-recovery" prefix.
|
83
83
|
if (ro.apiURL.startsWith(exports.WorkflowRecoveryUrl)) {
|
84
|
-
|
84
|
+
dbosExec.logger.error(`Invalid URL: ${ro.apiURL} -- should not start with ${exports.WorkflowRecoveryUrl}!`);
|
85
85
|
return;
|
86
86
|
}
|
87
87
|
// Check if we need to apply any Koa middleware.
|
88
88
|
const defaults = ro.defaults;
|
89
89
|
if (defaults?.koaMiddlewares) {
|
90
90
|
defaults.koaMiddlewares.forEach((koaMiddleware) => {
|
91
|
-
|
91
|
+
dbosExec.logger.debug(`DBOS Server applying middleware ${koaMiddleware.name} to ${ro.apiURL}`);
|
92
92
|
router.use(ro.apiURL, koaMiddleware);
|
93
93
|
});
|
94
94
|
}
|
95
95
|
// Wrapper function that parses request and send response.
|
96
96
|
const wrappedHandler = async (koaCtxt, koaNext) => {
|
97
|
-
const oc = new handler_1.HandlerContextImpl(
|
97
|
+
const oc = new handler_1.HandlerContextImpl(dbosExec, koaCtxt);
|
98
98
|
try {
|
99
99
|
// Check for auth first
|
100
100
|
if (defaults?.authMiddleware) {
|
@@ -108,7 +108,7 @@ class DBOSHttpServer {
|
|
108
108
|
return oc.getConfig(key, def);
|
109
109
|
},
|
110
110
|
query: (query, ...args) => {
|
111
|
-
return
|
111
|
+
return dbosExec.userDatabase.queryFunction(query, ...args);
|
112
112
|
},
|
113
113
|
});
|
114
114
|
if (res) {
|
@@ -158,13 +158,13 @@ class DBOSHttpServer {
|
|
158
158
|
// - Otherwise, we return 500.
|
159
159
|
const wfParams = { parentCtx: oc, workflowUUID: headerWorkflowUUID };
|
160
160
|
if (ro.txnConfig) {
|
161
|
-
koaCtxt.body = await
|
161
|
+
koaCtxt.body = await dbosExec.transaction(ro.registeredFunction, wfParams, ...args);
|
162
162
|
}
|
163
163
|
else if (ro.workflowConfig) {
|
164
|
-
koaCtxt.body = await (await
|
164
|
+
koaCtxt.body = await (await dbosExec.workflow(ro.registeredFunction, wfParams, ...args)).getResult();
|
165
165
|
}
|
166
166
|
else if (ro.commConfig) {
|
167
|
-
koaCtxt.body = await
|
167
|
+
koaCtxt.body = await dbosExec.external(ro.registeredFunction, wfParams, ...args);
|
168
168
|
}
|
169
169
|
else {
|
170
170
|
// Directly invoke the handler code.
|
@@ -210,18 +210,20 @@ class DBOSHttpServer {
|
|
210
210
|
carrier.context.set(key, value);
|
211
211
|
},
|
212
212
|
});
|
213
|
-
|
213
|
+
dbosExec.tracer.endSpan(oc.span);
|
214
|
+
// Add requestID to response headers.
|
215
|
+
koaCtxt.set(handler_1.RequestIDHeader, oc.request.requestID);
|
214
216
|
await koaNext();
|
215
217
|
}
|
216
218
|
};
|
217
219
|
// Actually register the endpoint.
|
218
220
|
if (ro.apiType === handler_1.APITypes.GET) {
|
219
221
|
router.get(ro.apiURL, wrappedHandler);
|
220
|
-
|
222
|
+
dbosExec.logger.debug(`DBOS Server Registered GET ${ro.apiURL}`);
|
221
223
|
}
|
222
224
|
else if (ro.apiType === handler_1.APITypes.POST) {
|
223
225
|
router.post(ro.apiURL, wrappedHandler);
|
224
|
-
|
226
|
+
dbosExec.logger.debug(`DBOS Server Registered POST ${ro.apiURL}`);
|
225
227
|
}
|
226
228
|
}
|
227
229
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/httpServer/server.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,yDAAiC;AACjC,gDAA6C;AAC7C,qDAA6B;AAC7B,
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/httpServer/server.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,yDAAiC;AACjC,gDAA6C;AAC7C,qDAA6B;AAC7B,uCAMmB;AAGnB,oCAKkB;AAIlB,4CAAyE;AAG5D,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,mBAAmB,GAAG,yBAAyB,CAAA;AAE5D,MAAa,cAAc;IAUJ;IATZ,GAAG,CAAM;IACT,MAAM,CAAS;IACf,MAAM,CAAS;IAExB;;;;OAIG;IACH,YAAqB,QAAsB,EAAE,SAAyC,EAAE;QAAnE,aAAQ,GAAR,QAAQ,CAAc;QACzC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,MAAM,CAAC,MAAM,GAAG,IAAI,gBAAM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