@dbos-inc/dbos-sdk 2.1.9-preview → 2.1.12-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/compose.yaml +19 -0
- package/dist/src/dbos-executor.d.ts +0 -4
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +86 -75
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/procedure.d.ts +1 -2
- package/dist/src/procedure.d.ts.map +1 -1
- package/dist/src/procedure.js.map +1 -1
- package/dist/src/step.d.ts +1 -2
- package/dist/src/step.d.ts.map +1 -1
- package/dist/src/step.js.map +1 -1
- package/dist/src/transaction.d.ts +1 -2
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/transaction.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/debugger/debug_workflow.d.ts +0 -56
- package/dist/src/debugger/debug_workflow.d.ts.map +0 -1
- package/dist/src/debugger/debug_workflow.js +0 -388
- package/dist/src/debugger/debug_workflow.js.map +0 -1
package/package.json
CHANGED
@@ -1,56 +0,0 @@
|
|
1
|
-
import { DBOSExecutor } from "../dbos-executor";
|
2
|
-
import { Transaction } from "../transaction";
|
3
|
-
import { StepFunction } from "../step";
|
4
|
-
import { UserDatabaseClient } from "../user_database";
|
5
|
-
import { DBOSContextImpl } from "../context";
|
6
|
-
import { ConfiguredInstance } from "../decorators";
|
7
|
-
import { WFInvokeFuncs, WfInvokeWfs, WfInvokeWfsAsync, Workflow, WorkflowConfig, WorkflowContext, WorkflowHandle } from "../workflow";
|
8
|
-
import { InvokeFuncsInst } from "../httpServer/handler";
|
9
|
-
import { StoredProcedure } from "../procedure";
|
10
|
-
import { PoolClient } from "pg";
|
11
|
-
import { WorkflowQueue } from "../wfqueue";
|
12
|
-
interface RecordedResult<R> {
|
13
|
-
output: R;
|
14
|
-
txn_snapshot: string;
|
15
|
-
txn_id: string;
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* Context used for debugging a workflow
|
19
|
-
*/
|
20
|
-
export declare class WorkflowContextDebug extends DBOSContextImpl implements WorkflowContext {
|
21
|
-
#private;
|
22
|
-
readonly workflowConfig: WorkflowConfig;
|
23
|
-
functionID: number;
|
24
|
-
readonly isTempWorkflow: boolean;
|
25
|
-
constructor(dbosExec: DBOSExecutor, parentCtx: DBOSContextImpl | undefined, workflowUUID: string, workflowConfig: WorkflowConfig, workflowName: string);
|
26
|
-
functionIDGetIncrement(): number;
|
27
|
-
invoke<T extends object>(object: T | ConfiguredInstance): WFInvokeFuncs<T> | InvokeFuncsInst<T>;
|
28
|
-
checkTxExecution<R>(client: UserDatabaseClient, funcID: number): Promise<RecordedResult<R> | Error>;
|
29
|
-
checkProcExecution<R>(client: PoolClient, funcID: number): Promise<RecordedResult<R> | Error>;
|
30
|
-
/**
|
31
|
-
* Execute a transactional function in debug mode.
|
32
|
-
* If a debug proxy is provided, it connects to a debug proxy and everything should be read-only.
|
33
|
-
*/
|
34
|
-
transaction<T extends unknown[], R>(txn: Transaction<T, R>, clsinst: ConfiguredInstance | null, ...args: T): Promise<R>;
|
35
|
-
procedure<T extends unknown[], R>(proc: StoredProcedure<T, R>, ...args: T): Promise<R>;
|
36
|
-
external<T extends unknown[], R>(stepFn: StepFunction<T, R>, _clsinst: ConfiguredInstance | null, ..._args: T): Promise<R>;
|
37
|
-
startChildWorkflow<T extends any[], R>(wf: Workflow<T, R>, ...args: T): Promise<WorkflowHandle<R>>;
|
38
|
-
invokeChildWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, ...args: T): Promise<R>;
|
39
|
-
/**
|
40
|
-
* Generate a proxy object for the provided class that wraps direct calls (i.e. OpClass.someMethod(param))
|
41
|
-
* to use WorkflowContext.Transaction(OpClass.someMethod, param);
|
42
|
-
*/
|
43
|
-
proxyInvokeWF<T extends object>(object: T, workflowUUID: string | undefined, asyncWf: boolean, configuredInstance: ConfiguredInstance | null, queue?: WorkflowQueue): WfInvokeWfsAsync<T>;
|
44
|
-
startWorkflow<T extends object>(target: T, workflowUUID?: string, queue?: WorkflowQueue): WfInvokeWfsAsync<T>;
|
45
|
-
invokeWorkflow<T extends object>(target: T, workflowUUID?: string): WfInvokeWfs<T>;
|
46
|
-
childWorkflow<T extends any[], R>(wf: Workflow<T, R>, ...args: T): Promise<WorkflowHandle<R>>;
|
47
|
-
send<T>(_destinationUUID: string, _message: T, _topic?: string | undefined): Promise<void>;
|
48
|
-
recv<T>(_topic?: string | undefined, _timeoutSeconds?: number | undefined): Promise<T | null>;
|
49
|
-
setEvent<T>(_key: string, _value: T): Promise<void>;
|
50
|
-
getEvent<T>(_workflowUUID: string, _key: string, _timeoutSeconds?: number | undefined): Promise<T | null>;
|
51
|
-
retrieveWorkflow<R>(targetUUID: string): WorkflowHandle<R>;
|
52
|
-
sleepms(_: number): Promise<void>;
|
53
|
-
sleep(s: number): Promise<void>;
|
54
|
-
}
|
55
|
-
export {};
|
56
|
-
//# sourceMappingURL=debug_workflow.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"debug_workflow.d.ts","sourceRoot":"","sources":["../../../src/debugger/debug_workflow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAqC,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAkB,WAAW,EAA0B,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAA6B,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAA2B,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,eAAe,EAA8B,MAAM,cAAc,CAAC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S5E,aAAa,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAI7F,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1F,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAc7F,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnD,QAAQ,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAa/G,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAMpD,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtC"}
|
@@ -1,388 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.WorkflowContextDebug = void 0;
|
7
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
8
|
-
const dbos_executor_1 = require("../dbos-executor");
|
9
|
-
const transaction_1 = require("../transaction");
|
10
|
-
const error_1 = require("../error");
|
11
|
-
const serialize_error_1 = require("serialize-error");
|
12
|
-
const context_1 = require("../context");
|
13
|
-
const decorators_1 = require("../decorators");
|
14
|
-
const utils_1 = require("../utils");
|
15
|
-
const procedure_1 = require("../procedure");
|
16
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
17
|
-
/**
|
18
|
-
* Context used for debugging a workflow
|
19
|
-
*/
|
20
|
-
class WorkflowContextDebug extends context_1.DBOSContextImpl {
|
21
|
-
workflowConfig;
|
22
|
-
functionID = 0;
|
23
|
-
#dbosExec;
|
24
|
-
isTempWorkflow;
|
25
|
-
constructor(dbosExec, parentCtx, workflowUUID, workflowConfig, workflowName) {
|
26
|
-
const span = dbosExec.tracer.startSpan(workflowName, {
|
27
|
-
operationUUID: workflowUUID,
|
28
|
-
operationType: dbos_executor_1.OperationType.WORKFLOW,
|
29
|
-
authenticatedUser: parentCtx?.authenticatedUser ?? "",
|
30
|
-
authenticatedRoles: parentCtx?.authenticatedRoles ?? [],
|
31
|
-
assumedRole: parentCtx?.assumedRole ?? "",
|
32
|
-
}, parentCtx?.span);
|
33
|
-
super(workflowName, span, dbosExec.logger, parentCtx);
|
34
|
-
this.workflowConfig = workflowConfig;
|
35
|
-
this.workflowUUID = workflowUUID;
|
36
|
-
this.#dbosExec = dbosExec;
|
37
|
-
this.isTempWorkflow = dbos_executor_1.DBOSExecutor.tempWorkflowName === workflowName;
|
38
|
-
this.applicationConfig = dbosExec.config.application;
|
39
|
-
}
|
40
|
-
functionIDGetIncrement() {
|
41
|
-
return this.functionID++;
|
42
|
-
}
|
43
|
-
invoke(object) {
|
44
|
-
if (typeof object === 'function') {
|
45
|
-
const ops = (0, decorators_1.getRegisteredOperations)(object);
|
46
|
-
const proxy = {};
|
47
|
-
for (const op of ops) {
|
48
|
-
proxy[op.name] = op.txnConfig
|
49
|
-
? (...args) => this.transaction(op.registeredFunction, null, ...args)
|
50
|
-
: op.commConfig
|
51
|
-
? (...args) => this.external(op.registeredFunction, null, ...args)
|
52
|
-
: op.procConfig
|
53
|
-
? (...args) => this.procedure(op.registeredFunction, ...args)
|
54
|
-
: undefined;
|
55
|
-
}
|
56
|
-
return proxy;
|
57
|
-
}
|
58
|
-
else {
|
59
|
-
const targetInst = object;
|
60
|
-
const ops = (0, decorators_1.getRegisteredOperations)(targetInst);
|
61
|
-
const proxy = {};
|
62
|
-
for (const op of ops) {
|
63
|
-
proxy[op.name] = op.txnConfig
|
64
|
-
? (...args) => this.transaction(op.registeredFunction, targetInst, ...args)
|
65
|
-
: op.commConfig
|
66
|
-
? (...args) => this.external(op.registeredFunction, targetInst, ...args)
|
67
|
-
: undefined;
|
68
|
-
}
|
69
|
-
return proxy;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
async #checkExecution(queryFunc, funcID) {
|
73
|
-
// Note: we read the recorded snapshot and transaction ID!
|
74
|
-
const query = "SELECT output, error, txn_snapshot, txn_id FROM dbos.transaction_outputs WHERE workflow_uuid=$1 AND function_id=$2";
|
75
|
-
const rows = await queryFunc(query, [this.workflowUUID, funcID]);
|
76
|
-
if (rows.length === 0 || rows.length > 1) {
|
77
|
-
this.logger.error("Unexpected! This should never happen during debug. Found incorrect rows for transaction output. Returned rows: " + rows.toString() + `. WorkflowUUID ${this.workflowUUID}, function ID ${funcID}`);
|
78
|
-
throw new error_1.DBOSDebuggerError(`This should never happen during debug. Found incorrect rows for transaction output. Returned ${rows.length} rows: ` + rows.toString());
|
79
|
-
}
|
80
|
-
if (utils_1.DBOSJSON.parse(rows[0].error) !== null) {
|
81
|
-
return (0, serialize_error_1.deserializeError)(utils_1.DBOSJSON.parse(rows[0].error));
|
82
|
-
}
|
83
|
-
const res = {
|
84
|
-
output: utils_1.DBOSJSON.parse(rows[0].output),
|
85
|
-
txn_snapshot: rows[0].txn_snapshot,
|
86
|
-
txn_id: rows[0].txn_id,
|
87
|
-
};
|
88
|
-
if (this.#dbosExec.debugProxy) {
|
89
|
-
// Send a signal to the debug proxy.
|
90
|
-
await queryFunc(`--proxy:${res.txn_id ?? ''}:${res.txn_snapshot}`, []);
|
91
|
-
}
|
92
|
-
return res;
|
93
|
-
}
|
94
|
-
async checkTxExecution(client, funcID) {
|
95
|
-
const func = (sql, args) => this.#dbosExec.userDatabase.queryWithClient(client, sql, ...args);
|
96
|
-
return this.#checkExecution(func, funcID);
|
97
|
-
}
|
98
|
-
async checkProcExecution(client, funcID) {
|
99
|
-
const func = (sql, args) => client.query(sql, args).then(v => v.rows);
|
100
|
-
return this.#checkExecution(func, funcID);
|
101
|
-
}
|
102
|
-
/**
|
103
|
-
* Execute a transactional function in debug mode.
|
104
|
-
* If a debug proxy is provided, it connects to a debug proxy and everything should be read-only.
|
105
|
-
*/
|
106
|
-
async transaction(txn, clsinst, ...args) {
|
107
|
-
const txnInfo = this.#dbosExec.getTransactionInfo(txn);
|
108
|
-
if (txnInfo === undefined) {
|
109
|
-
throw new error_1.DBOSDebuggerError(`Transaction ${txn.name} not registered!`);
|
110
|
-
}
|
111
|
-
// const readOnly = true; // TODO: eventually, this transaction must be read-only.
|
112
|
-
const funcID = this.functionIDGetIncrement();
|
113
|
-
const span = this.#dbosExec.tracer.startSpan(txn.name, {
|
114
|
-
operationUUID: this.workflowUUID,
|
115
|
-
operationType: dbos_executor_1.OperationType.TRANSACTION,
|
116
|
-
authenticatedUser: this.authenticatedUser,
|
117
|
-
authenticatedRoles: this.authenticatedRoles,
|
118
|
-
assumedRole: this.assumedRole,
|
119
|
-
readOnly: txnInfo.config.readOnly ?? false, // For now doing as in src/workflow.ts:272
|
120
|
-
isolationLevel: txnInfo.config.isolationLevel,
|
121
|
-
}, this.span);
|
122
|
-
let check;
|
123
|
-
const wrappedTransaction = async (client) => {
|
124
|
-
// Original result must exist during replay.
|
125
|
-
const tCtxt = new transaction_1.TransactionContextImpl(this.#dbosExec.userDatabase.getName(), client, this, span, this.#dbosExec.logger, funcID, txn.name);
|
126
|
-
check = await this.checkTxExecution(client, funcID);
|
127
|
-
if (check instanceof Error) {
|
128
|
-
if (this.#dbosExec.debugProxy) {
|
129
|
-
this.logger.warn(`original transaction ${txn.name} failed with error: ${check.message}`);
|
130
|
-
}
|
131
|
-
else {
|
132
|
-
throw check; // In direct mode, directly throw the error.
|
133
|
-
}
|
134
|
-
}
|
135
|
-
if (!this.#dbosExec.debugProxy) {
|
136
|
-
// Direct mode skips execution and return the recorded result.
|
137
|
-
return check.output;
|
138
|
-
}
|
139
|
-
// If we have a proxy, then execute the user's transaction.
|
140
|
-
let cresult;
|
141
|
-
await (0, context_1.runWithTransactionContext)(tCtxt, async () => {
|
142
|
-
cresult = await txn.call(clsinst, tCtxt, ...args);
|
143
|
-
});
|
144
|
-
const result = cresult;
|
145
|
-
return result;
|
146
|
-
};
|
147
|
-
let result;
|
148
|
-
try {
|
149
|
-
result = await this.#dbosExec.userDatabase.transaction(wrappedTransaction, txnInfo.config);
|
150
|
-
}
|
151
|
-
catch (e) {
|
152
|
-
result = e;
|
153
|
-
}
|
154
|
-
check = check;
|
155
|
-
result = result;
|
156
|
-
if (check instanceof Error) {
|
157
|
-
throw check;
|
158
|
-
}
|
159
|
-
// If returned nothing and the recorded value is also null/undefined, we just return it
|
160
|
-
if (result === undefined && !check.output) {
|
161
|
-
return result;
|
162
|
-
}
|
163
|
-
if (utils_1.DBOSJSON.stringify(check.output) !== utils_1.DBOSJSON.stringify(result)) {
|
164
|
-
this.logger.error(`Detected different transaction output than the original one!\n Result: ${utils_1.DBOSJSON.stringify(result)}\n Original: ${utils_1.DBOSJSON.stringify(check.output)}`);
|
165
|
-
}
|
166
|
-
return check.output; // Always return the recorded result.
|
167
|
-
}
|
168
|
-
async procedure(proc, ...args) {
|
169
|
-
const procInfo = this.#dbosExec.getProcedureInfo(proc);
|
170
|
-
if (procInfo === undefined) {
|
171
|
-
throw new error_1.DBOSDebuggerError(proc.name);
|
172
|
-
}
|
173
|
-
const funcId = this.functionIDGetIncrement();
|
174
|
-
const span = this.#dbosExec.tracer.startSpan(proc.name, {
|
175
|
-
operationUUID: this.workflowUUID,
|
176
|
-
operationType: dbos_executor_1.OperationType.PROCEDURE,
|
177
|
-
authenticatedUser: this.authenticatedUser,
|
178
|
-
assumedRole: this.assumedRole,
|
179
|
-
authenticatedRoles: this.authenticatedRoles,
|
180
|
-
readOnly: procInfo.config.readOnly ?? false,
|
181
|
-
isolationLevel: procInfo.config.isolationLevel ?? transaction_1.IsolationLevel.Serializable,
|
182
|
-
}, this.span);
|
183
|
-
let check;
|
184
|
-
const wrappedProcedure = async (client) => {
|
185
|
-
check = await this.checkProcExecution(client, funcId);
|
186
|
-
const procCtxt = new procedure_1.StoredProcedureContextImpl(client, this, span, this.#dbosExec.logger, funcId, proc.name);
|
187
|
-
if (check instanceof Error) {
|
188
|
-
if (this.#dbosExec.debugProxy) {
|
189
|
-
this.logger.warn(`original procedure ${proc.name} failed with error: ${check.message}`);
|
190
|
-
}
|
191
|
-
else {
|
192
|
-
throw check; // In direct mode, directly throw the error.
|
193
|
-
}
|
194
|
-
}
|
195
|
-
if (!this.#dbosExec.debugProxy) {
|
196
|
-
// Direct mode skips execution and return the recorded result.
|
197
|
-
return check.output;
|
198
|
-
}
|
199
|
-
// If we have a proxy, then execute the user's transaction.
|
200
|
-
const result = await proc(procCtxt, ...args);
|
201
|
-
return result;
|
202
|
-
};
|
203
|
-
let result;
|
204
|
-
try {
|
205
|
-
result = await this.#dbosExec.invokeStoredProcFunction(wrappedProcedure, procInfo.config);
|
206
|
-
}
|
207
|
-
catch (e) {
|
208
|
-
result = e;
|
209
|
-
}
|
210
|
-
check = check;
|
211
|
-
result = result;
|
212
|
-
if (check instanceof Error) {
|
213
|
-
throw check;
|
214
|
-
}
|
215
|
-
// If returned nothing and the recorded value is also null/undefined, we just return it
|
216
|
-
if (result === undefined && !check.output) {
|
217
|
-
return result;
|
218
|
-
}
|
219
|
-
try {
|
220
|
-
node_assert_1.default.deepStrictEqual(result, check.output);
|
221
|
-
}
|
222
|
-
catch {
|
223
|
-
this.logger.error(`Detected different transaction output than the original one!\n Result: ${JSON.stringify(result)}\n Original: ${JSON.stringify(check.output)}`);
|
224
|
-
}
|
225
|
-
return check.output; // Always return the recorded result.
|
226
|
-
}
|
227
|
-
async external(stepFn, _clsinst, ..._args) {
|
228
|
-
const commConfig = this.#dbosExec.getStepInfo(stepFn);
|
229
|
-
if (commConfig === undefined) {
|
230
|
-
throw new error_1.DBOSDebuggerError(`Step ${stepFn.name} not registered!`);
|
231
|
-
}
|
232
|
-
const funcID = this.functionIDGetIncrement();
|
233
|
-
// FIXME: we do not create a span for the replay step. Do we want to?
|
234
|
-
// Original result must exist during replay.
|
235
|
-
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, funcID);
|
236
|
-
if (check === dbos_executor_1.dbosNull) {
|
237
|
-
throw new error_1.DBOSDebuggerError(`Cannot find recorded step output for ${stepFn.name}. Shouldn't happen in debug mode!`);
|
238
|
-
}
|
239
|
-
this.logger.debug("Use recorded step output.");
|
240
|
-
return check;
|
241
|
-
}
|
242
|
-
// Invoke the debugWorkflow() function instead.
|
243
|
-
async startChildWorkflow(wf, ...args) {
|
244
|
-
const funcId = this.functionIDGetIncrement();
|
245
|
-
const childUUID = this.workflowUUID + "-" + funcId;
|
246
|
-
return this.#dbosExec.debugWorkflow(wf, { parentCtx: this, workflowUUID: childUUID }, this.workflowUUID, funcId, ...args);
|
247
|
-
}
|
248
|
-
async invokeChildWorkflow(wf, ...args) {
|
249
|
-
return this.startChildWorkflow(wf, ...args).then((handle) => handle.getResult());
|
250
|
-
}
|
251
|
-
/**
|
252
|
-
* Generate a proxy object for the provided class that wraps direct calls (i.e. OpClass.someMethod(param))
|
253
|
-
* to use WorkflowContext.Transaction(OpClass.someMethod, param);
|
254
|
-
*/
|
255
|
-
proxyInvokeWF(object, workflowUUID, asyncWf, configuredInstance, queue) {
|
256
|
-
const ops = (0, decorators_1.getRegisteredOperations)(object);
|
257
|
-
const proxy = {};
|
258
|
-
const funcId = this.functionIDGetIncrement();
|
259
|
-
const childUUID = workflowUUID || (this.workflowUUID + "-" + funcId);
|
260
|
-
const params = { workflowUUID: childUUID, parentCtx: this, configuredInstance, queueName: queue?.name };
|
261
|
-
for (const op of ops) {
|
262
|
-
if (asyncWf) {
|
263
|
-
proxy[op.name] = op.workflowConfig
|
264
|
-
? (...args) => this.#dbosExec.debugWorkflow(op.registeredFunction, params, this.workflowUUID, funcId, ...args)
|
265
|
-
: undefined;
|
266
|
-
}
|
267
|
-
else {
|
268
|
-
proxy[op.name] = op.workflowConfig
|
269
|
-
? (...args) => this.#dbosExec.debugWorkflow(op.registeredFunction, params, this.workflowUUID, funcId, ...args)
|
270
|
-
.then((handle) => handle.getResult())
|
271
|
-
: undefined;
|
272
|
-
}
|
273
|
-
}
|
274
|
-
return proxy;
|
275
|
-
}
|
276
|
-
startWorkflow(target, workflowUUID, queue) {
|
277
|
-
if (typeof target === 'function') {
|
278
|
-
return this.proxyInvokeWF(target, workflowUUID, true, null, queue);
|
279
|
-
}
|
280
|
-
else {
|
281
|
-
return this.proxyInvokeWF(target, workflowUUID, true, target, queue);
|
282
|
-
}
|
283
|
-
}
|
284
|
-
invokeWorkflow(target, workflowUUID) {
|
285
|
-
if (typeof target === 'function') {
|
286
|
-
return this.proxyInvokeWF(target, workflowUUID, false, null);
|
287
|
-
}
|
288
|
-
else {
|
289
|
-
return this.proxyInvokeWF(target, workflowUUID, false, target);
|
290
|
-
}
|
291
|
-
}
|
292
|
-
async childWorkflow(wf, ...args) {
|
293
|
-
return this.startChildWorkflow(wf, ...args);
|
294
|
-
}
|
295
|
-
async send(_destinationUUID, _message, _topic) {
|
296
|
-
const functionID = this.functionIDGetIncrement();
|
297
|
-
// Original result must exist during replay.
|
298
|
-
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
299
|
-
if (check === dbos_executor_1.dbosNull) {
|
300
|
-
throw new error_1.DBOSDebuggerError(`Cannot find recorded send. Shouldn't happen in debug mode!`);
|
301
|
-
}
|
302
|
-
this.logger.debug("Use recorded send output.");
|
303
|
-
return;
|
304
|
-
}
|
305
|
-
async recv(_topic, _timeoutSeconds) {
|
306
|
-
const functionID = this.functionIDGetIncrement();
|
307
|
-
//Increment once more to account for the timeoutFunctionID created by workflow
|
308
|
-
this.functionIDGetIncrement();
|
309
|
-
// Original result must exist during replay.
|
310
|
-
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
311
|
-
if (check === dbos_executor_1.dbosNull) {
|
312
|
-
throw new error_1.DBOSDebuggerError(`Cannot find recorded recv. Shouldn't happen in debug mode!`);
|
313
|
-
}
|
314
|
-
this.logger.debug("Use recorded recv output.");
|
315
|
-
return check;
|
316
|
-
}
|
317
|
-
async setEvent(_key, _value) {
|
318
|
-
const functionID = this.functionIDGetIncrement();
|
319
|
-
// Original result must exist during replay.
|
320
|
-
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
321
|
-
if (check === dbos_executor_1.dbosNull) {
|
322
|
-
throw new error_1.DBOSDebuggerError(`Cannot find recorded setEvent. Shouldn't happen in debug mode!`);
|
323
|
-
}
|
324
|
-
this.logger.debug("Use recorded setEvent output.");
|
325
|
-
}
|
326
|
-
async getEvent(_workflowUUID, _key, _timeoutSeconds) {
|
327
|
-
const functionID = this.functionIDGetIncrement();
|
328
|
-
//take into account the extra functionID increment from workflow
|
329
|
-
this.functionIDGetIncrement();
|
330
|
-
// Original result must exist during replay.
|
331
|
-
const check = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID);
|
332
|
-
if (check === dbos_executor_1.dbosNull) {
|
333
|
-
throw new error_1.DBOSDebuggerError(`Cannot find recorded getEvent. Shouldn't happen in debug mode!`);
|
334
|
-
}
|
335
|
-
this.logger.debug("Use recorded getEvent output.");
|
336
|
-
return check;
|
337
|
-
}
|
338
|
-
retrieveWorkflow(targetUUID) {
|
339
|
-
// TODO: write a proper test for this.
|
340
|
-
const functionID = this.functionIDGetIncrement();
|
341
|
-
return new RetrievedHandleDebug(this.#dbosExec.systemDatabase, targetUUID, this.workflowUUID, functionID);
|
342
|
-
}
|
343
|
-
async sleepms(_) {
|
344
|
-
// Need to increment function ID for faithful replay.
|
345
|
-
this.functionIDGetIncrement();
|
346
|
-
return Promise.resolve();
|
347
|
-
}
|
348
|
-
async sleep(s) {
|
349
|
-
return this.sleepms(s * 1000);
|
350
|
-
}
|
351
|
-
}
|
352
|
-
exports.WorkflowContextDebug = WorkflowContextDebug;
|
353
|
-
/**
|
354
|
-
* The handle returned when retrieving a workflow with Debug workflow's retrieve
|
355
|
-
*/
|
356
|
-
class RetrievedHandleDebug {
|
357
|
-
systemDatabase;
|
358
|
-
workflowUUID;
|
359
|
-
callerUUID;
|
360
|
-
callerFunctionID;
|
361
|
-
constructor(systemDatabase, workflowUUID, callerUUID, callerFunctionID) {
|
362
|
-
this.systemDatabase = systemDatabase;
|
363
|
-
this.workflowUUID = workflowUUID;
|
364
|
-
this.callerUUID = callerUUID;
|
365
|
-
this.callerFunctionID = callerFunctionID;
|
366
|
-
}
|
367
|
-
getWorkflowUUID() {
|
368
|
-
return this.workflowUUID;
|
369
|
-
}
|
370
|
-
get workflowID() {
|
371
|
-
return this.workflowUUID;
|
372
|
-
}
|
373
|
-
async getStatus() {
|
374
|
-
// Must use original result.
|
375
|
-
const check = await this.systemDatabase.checkOperationOutput(this.callerUUID, this.callerFunctionID);
|
376
|
-
if (check === dbos_executor_1.dbosNull) {
|
377
|
-
throw new error_1.DBOSDebuggerError(`Cannot find recorded workflow status. Shouldn't happen in debug mode!`);
|
378
|
-
}
|
379
|
-
return check;
|
380
|
-
}
|
381
|
-
async getResult() {
|
382
|
-
return await this.systemDatabase.getWorkflowResult(this.workflowUUID);
|
383
|
-
}
|
384
|
-
async getWorkflowInputs() {
|
385
|
-
return await this.systemDatabase.getWorkflowInputs(this.workflowUUID);
|
386
|
-
}
|
387
|
-
}
|
388
|
-
//# sourceMappingURL=debug_workflow.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"debug_workflow.js","sourceRoot":"","sources":["../../../src/debugger/debug_workflow.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,oDAAmF;AAEnF,gDAAqF;AAErF,oCAA6C;AAC7C,qDAAmD;AAInD,wCAAwE;AACxE,8CAA4E;AAG5E,oCAAoC;AACpC,4CAA2E;AAE3E,8DAAiC;AAWjC;;GAEG;AACH,MAAa,oBAAqB,SAAQ,yBAAe;IAKoD;IAJ3G,UAAU,GAAW,CAAC,CAAC;IACd,SAAS,CAAC;IACV,cAAc,CAAU;IAEjC,YAAY,QAAsB,EAAE,SAAsC,EAAE,YAAoB,EAAW,cAA8B,EACvI,YAAoB;QACpB,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,CACpC,YAAY,EACZ;YACE,aAAa,EAAE,YAAY;YAC3B,aAAa,EAAE,6BAAa,CAAC,QAAQ;YACrC,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,IAAI,EAAE;YACrD,kBAAkB,EAAE,SAAS,EAAE,kBAAkB,IAAI,EAAE;YACvD,WAAW,EAAE,SAAS,EAAE,WAAW,IAAI,EAAE;SAC1C,EACD,SAAS,EAAE,IAAI,CAChB,CAAC;QACF,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAbmD,mBAAc,GAAd,cAAc,CAAgB;QAcvI,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,4BAAY,CAAC,gBAAgB,KAAK,YAAY,CAAC;QACrE,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;IACvD,CAAC;IAED,sBAAsB;QACpB,OAAO,IAAI,CAAC,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