@dbos-inc/dbos-sdk 2.8.12-preview → 2.8.17-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/dist/schemas/system_db_schema.d.ts +1 -0
- package/dist/schemas/system_db_schema.d.ts.map +1 -1
- package/dist/schemas/user_db_schema.d.ts +1 -0
- package/dist/schemas/user_db_schema.d.ts.map +1 -1
- package/dist/schemas/user_db_schema.js.map +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +7 -6
- package/dist/src/client.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +7 -4
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +126 -63
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +10 -0
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/dbos-runtime/config.d.ts.map +1 -1
- package/dist/src/dbos-runtime/config.js +4 -19
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos-runtime/docker_pg_helper.d.ts +21 -0
- package/dist/src/dbos-runtime/docker_pg_helper.d.ts.map +1 -0
- package/dist/src/dbos-runtime/docker_pg_helper.js +137 -0
- package/dist/src/dbos-runtime/docker_pg_helper.js.map +1 -0
- package/dist/src/dbos-runtime/migrate.d.ts.map +1 -1
- package/dist/src/dbos-runtime/migrate.js +1 -2
- package/dist/src/dbos-runtime/migrate.js.map +1 -1
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
- package/dist/src/dbos-runtime/runtime.js +0 -2
- 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 +14 -16
- package/dist/src/dbos-runtime/workflow_management.js.map +1 -1
- package/dist/src/dbos.d.ts +1 -0
- package/dist/src/dbos.d.ts.map +1 -1
- package/dist/src/dbos.js +41 -22
- package/dist/src/dbos.js.map +1 -1
- package/dist/src/error.d.ts +7 -0
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +15 -1
- 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/server.d.ts.map +1 -1
- package/dist/src/httpServer/server.js +8 -19
- package/dist/src/httpServer/server.js.map +1 -1
- package/dist/src/system_database.d.ts +84 -52
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +187 -290
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/workflow.d.ts +3 -2
- package/dist/src/workflow.d.ts.map +1 -1
- package/dist/src/workflow.js +36 -26
- package/dist/src/workflow.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/dbos-runtime/db_connection.d.ts +0 -10
- package/dist/src/dbos-runtime/db_connection.d.ts.map +0 -1
- package/dist/src/dbos-runtime/db_connection.js +0 -59
- package/dist/src/dbos-runtime/db_connection.js.map +0 -1
- package/dist/src/dbos-runtime/db_wizard.d.ts +0 -3
- package/dist/src/dbos-runtime/db_wizard.d.ts.map +0 -1
- package/dist/src/dbos-runtime/db_wizard.js +0 -170
- package/dist/src/dbos-runtime/db_wizard.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"system_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/system_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,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,CAAC;CAChC;AAGD,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC"}
|
@@ -5,6 +5,7 @@ export interface transaction_outputs {
|
|
5
5
|
error: string | null;
|
6
6
|
txn_id: string | null;
|
7
7
|
txn_snapshot: string;
|
8
|
+
function_name: string;
|
8
9
|
}
|
9
10
|
export declare const createUserDBSchema = "CREATE SCHEMA IF NOT EXISTS dbos;";
|
10
11
|
export declare const userDBSchema = "\n CREATE TABLE IF NOT EXISTS dbos.transaction_outputs (\n workflow_uuid TEXT NOT NULL,\n function_id INT NOT NULL,\n output TEXT,\n error TEXT,\n txn_id TEXT,\n txn_snapshot TEXT NOT NULL,\n created_at BIGINT NOT NULL DEFAULT (EXTRACT(EPOCH FROM now())*1000)::bigint,\n function_name TEXT NOT NULL DEFAULT '',\n PRIMARY KEY (workflow_uuid, function_id)\n );\n";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/user_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"user_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/user_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AAEtE,eAAO,MAAM,YAAY,0YAYxB,CAAC;AAEF,eAAO,MAAM,WAAW,oHAEvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,iNAO7B,CAAC;AAEF,eAAO,MAAM,cAAc,wGAG1B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user_db_schema.js","sourceRoot":"","sources":["../../schemas/user_db_schema.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"user_db_schema.js","sourceRoot":"","sources":["../../schemas/user_db_schema.ts"],"names":[],"mappings":";;;AAUa,QAAA,kBAAkB,GAAG,mCAAmC,CAAC;AAEzD,QAAA,YAAY,GAAG;;;;;;;;;;;;CAY3B,CAAC;AAEW,QAAA,WAAW,GAAG;;CAE1B,CAAC;AAEW,QAAA,iBAAiB,GAAG;;;;;;;CAOhC,CAAC;AAEW,QAAA,cAAc,GAAG;;;CAG7B,CAAC"}
|
package/dist/src/client.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,cAAc,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,cAAc,EAAE,MAAM,YAAY,CAAC;AAI3E;;;GAGG;AACH,UAAU,cAAc;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAA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
7
|
const workflow_1 = require("./workflow");
|
8
8
|
const config_1 = require("./dbos-runtime/config");
|
9
|
+
const utils_1 = require("./utils");
|
9
10
|
/**
|
10
11
|
* DBOSClient is the main entry point for interacting with the DBOS system.
|
11
12
|
*/
|
@@ -64,8 +65,8 @@ class DBOSClient {
|
|
64
65
|
workflowConfigName: '',
|
65
66
|
queueName: queueName,
|
66
67
|
authenticatedUser: '',
|
67
|
-
output:
|
68
|
-
error:
|
68
|
+
output: null,
|
69
|
+
error: null,
|
69
70
|
assumedRole: '',
|
70
71
|
authenticatedRoles: [],
|
71
72
|
request: {},
|
@@ -96,8 +97,8 @@ class DBOSClient {
|
|
96
97
|
workflowClassName: '',
|
97
98
|
workflowConfigName: '',
|
98
99
|
authenticatedUser: '',
|
99
|
-
output:
|
100
|
-
error:
|
100
|
+
output: null,
|
101
|
+
error: null,
|
101
102
|
assumedRole: '',
|
102
103
|
authenticatedRoles: [],
|
103
104
|
request: {},
|
@@ -107,7 +108,7 @@ class DBOSClient {
|
|
107
108
|
maxRetries: 50,
|
108
109
|
};
|
109
110
|
await this.systemDatabase.initWorkflowStatus(internalStatus, [destinationID, message, topic]);
|
110
|
-
await this.systemDatabase.send(internalStatus.workflowUUID, 0, destinationID, message, topic);
|
111
|
+
await this.systemDatabase.send(internalStatus.workflowUUID, 0, destinationID, utils_1.DBOSJSON.stringify(message), topic);
|
111
112
|
}
|
112
113
|
/**
|
113
114
|
* Retrieves an event published by workflowID for a given key.
|
@@ -117,7 +118,7 @@ class DBOSClient {
|
|
117
118
|
* @returns A Promise that resolves with the event payload.
|
118
119
|
*/
|
119
120
|
async getEvent(workflowID, key, timeoutSeconds) {
|
120
|
-
return await this.systemDatabase.getEvent(workflowID, key, timeoutSeconds ?? 60);
|
121
|
+
return utils_1.DBOSJSON.parse(await this.systemDatabase.getEvent(workflowID, key, timeoutSeconds ?? 60));
|
121
122
|
}
|
122
123
|
/**
|
123
124
|
* Retrieves a single workflow by its id.
|
package/dist/src/client.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AACA,uDAAmG;AACnG,2CAA0D;AAC1D,+BAAoC;AACpC,yCAA2E;AAC3E,kDAAsE;AA+
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AACA,uDAAmG;AACnG,2CAA0D;AAC1D,+BAAoC;AACpC,yCAA2E;AAC3E,kDAAsE;AACtE,mCAAmC;AA+BnC;;GAEG;AACH,MAAa,UAAU;IACJ,MAAM,CAAS;IACf,cAAc,CAAiB;IAEhD,YAAoB,WAAmB,EAAE,cAAuB;QAC9D,MAAM,QAAQ,GAAG,IAAA,sBAAa,EAAC,WAAW,CAAC,CAAC;QAE5C,MAAM,UAAU,GAAe;YAC7B,IAAI,EAAE,QAAQ,CAAC,QAAQ;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,QAAQ;YACvB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,QAAQ,EAAE,QAAQ,CAAC,WAAW;YAC9B,GAAG,EAAE,IAAA,uBAAc,EAAC,QAAQ,CAAC;YAC7B,uBAAuB,EAAE,QAAQ,CAAC,uBAAuB;SAC1D,CAAC;QAEF,cAAc,KAAK,GAAG,QAAQ,CAAC,WAAW,WAAW,CAAC;QAEtD,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,wCAAsB,CAAC,UAAU,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,cAAuB;QAC9D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAC3D,MAAM,MAAM,CAAC,c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|
|
6
6
|
import { GlobalLogger as Logger } from './telemetry/logs';
|
7
7
|
import { TelemetryConfig } from './telemetry';
|
8
8
|
import { Pool, PoolClient, PoolConfig } from 'pg';
|
9
|
-
import { SystemDatabase } from './system_database';
|
9
|
+
import { SystemDatabase, SystemDatabaseStoredResult } from './system_database';
|
10
10
|
import { UserDatabase, UserDatabaseName } from './user_database';
|
11
11
|
import { MethodRegistrationBase, ConfiguredInstance } from './decorators';
|
12
12
|
import { step_info } from '../schemas/system_db_schema';
|
@@ -151,8 +151,9 @@ export declare class DBOSExecutor implements DBOSExecutorContext {
|
|
151
151
|
};
|
152
152
|
getProcedureClassName<T extends unknown[], R>(pf: StoredProcedure<T, R>): string;
|
153
153
|
getProcedureInfo<T extends unknown[], R>(pf: StoredProcedure<T, R>): ProcedureRegInfo | undefined;
|
154
|
+
static reviveResultOrError<R = unknown>(r: SystemDatabaseStoredResult, success?: boolean): R;
|
154
155
|
workflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, ...args: T): Promise<WorkflowHandle<R>>;
|
155
|
-
internalWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams,
|
156
|
+
internalWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, callerID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
|
156
157
|
getTransactions(workflowUUID: string): Promise<step_info[]>;
|
157
158
|
transaction<T extends unknown[], R>(txn: Transaction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
|
158
159
|
startTransactionTempWF<T extends unknown[], R>(txn: Transaction<T, R>, params: InternalWorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
|
@@ -177,7 +178,8 @@ export declare class DBOSExecutor implements DBOSExecutorContext {
|
|
177
178
|
* Retrieve a handle for a workflow UUID.
|
178
179
|
*/
|
179
180
|
retrieveWorkflow<R>(workflowID: string): WorkflowHandle<R>;
|
180
|
-
|
181
|
+
runAsStep<T>(callback: () => Promise<T>, functionName: string, workflowID?: string, functionID?: number): Promise<T>;
|
182
|
+
getWorkflowStatus(workflowID: string, callerID?: string, callerFN?: number): Promise<WorkflowStatus | null>;
|
181
183
|
getWorkflows(input: GetWorkflowsInput): Promise<GetWorkflowsOutput>;
|
182
184
|
getWorkflowQueue(input: GetWorkflowQueueInput): Promise<GetWorkflowQueueOutput>;
|
183
185
|
queryUserDB(sql: string, params?: unknown[]): Promise<unknown[]>;
|
@@ -189,10 +191,11 @@ export declare class DBOSExecutor implements DBOSExecutorContext {
|
|
189
191
|
recoverPendingWorkflows(executorIDs?: string[]): Promise<WorkflowHandle<unknown>[]>;
|
190
192
|
initEventReceivers(): Promise<void>;
|
191
193
|
deactivateEventReceivers(): Promise<void>;
|
192
|
-
executeWorkflowUUID(
|
194
|
+
executeWorkflowUUID(workflowID: string, startNewWorkflow?: boolean): Promise<WorkflowHandle<unknown>>;
|
193
195
|
getEventDispatchState(svc: string, wfn: string, key: string): Promise<DBOSEventReceiverState | undefined>;
|
194
196
|
upsertEventDispatchState(state: DBOSEventReceiverState): Promise<DBOSEventReceiverState>;
|
195
197
|
cancelWorkflow(workflowID: string): Promise<void>;
|
198
|
+
getWorkflowSteps(workflowID: string): Promise<step_info[]>;
|
196
199
|
listWorkflowSteps(workflowID: string): Promise<step_info[]>;
|
197
200
|
resumeWorkflow(workflowID: string): Promise<WorkflowHandle<unknown>>;
|
198
201
|
logRegisteredHTTPUrls(): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dbos-executor.d.ts","sourceRoot":"","sources":["../../src/dbos-executor.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"dbos-executor.d.ts","sourceRoot":"","sources":["../../src/dbos-executor.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,QAAQ,EACR,cAAc,EAEd,cAAc,EACd,cAAc,EAEd,mBAAmB,EACnB,cAAc,EAGd,qBAAqB,EACrB,sBAAsB,EACvB,MA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GAAE,OAAe,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IA+G5G,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAGzG,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAexF,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjD,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAa1D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAW3D,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAM1E,qBAAqB;IAcrB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAS1D;;;;;;OAMG;IACH,iBAAiB,IAAI,MAAM;CAU5B"}
|
@@ -542,30 +542,38 @@ class DBOSExecutor {
|
|
542
542
|
return this.procedureInfoMap.get(pfName);
|
543
543
|
}
|
544
544
|
// TODO: getProcedureInfoByNames??
|
545
|
+
static reviveResultOrError(r, success) {
|
546
|
+
if (success === true || !r.err) {
|
547
|
+
return utils_1.DBOSJSON.parse(r.res ?? null);
|
548
|
+
}
|
549
|
+
else {
|
550
|
+
throw (0, serialize_error_1.deserializeError)(utils_1.DBOSJSON.parse(r.err));
|
551
|
+
}
|
552
|
+
}
|
545
553
|
async workflow(wf, params, ...args) {
|
546
554
|
return this.internalWorkflow(wf, params, undefined, undefined, ...args);
|
547
555
|
}
|
548
556
|
// If callerUUID and functionID are set, it means the workflow is invoked from within a workflow.
|
549
|
-
async internalWorkflow(wf, params,
|
550
|
-
const
|
551
|
-
const
|
557
|
+
async internalWorkflow(wf, params, callerID, callerFunctionID, ...args) {
|
558
|
+
const workflowID = params.workflowUUID ? params.workflowUUID : this.#generateUUID();
|
559
|
+
const presetID = params.workflowUUID ? true : false;
|
552
560
|
const wInfo = this.getWorkflowInfo(wf);
|
553
561
|
if (wInfo === undefined) {
|
554
562
|
throw new error_1.DBOSNotRegisteredError(wf.name);
|
555
563
|
}
|
556
564
|
const wConfig = wInfo.config;
|
557
565
|
const passContext = wInfo.registration?.passContext ?? true;
|
558
|
-
const wCtxt = new workflow_1.WorkflowContextImpl(this, params.parentCtx,
|
566
|
+
const wCtxt = new workflow_1.WorkflowContextImpl(this, params.parentCtx, workflowID, wConfig, wf.name, presetID, params.tempWfType, params.tempWfName);
|
559
567
|
const internalStatus = {
|
560
|
-
workflowUUID:
|
568
|
+
workflowUUID: workflowID,
|
561
569
|
status: params.queueName !== undefined ? workflow_1.StatusString.ENQUEUED : workflow_1.StatusString.PENDING,
|
562
570
|
workflowName: wf.name,
|
563
571
|
workflowClassName: wCtxt.isTempWorkflow ? '' : (0, decorators_1.getRegisteredMethodClassName)(wf),
|
564
572
|
workflowConfigName: params.configuredInstance?.name || '',
|
565
573
|
queueName: params.queueName,
|
566
574
|
authenticatedUser: wCtxt.authenticatedUser,
|
567
|
-
output:
|
568
|
-
error:
|
575
|
+
output: null,
|
576
|
+
error: null,
|
569
577
|
assumedRole: wCtxt.assumedRole,
|
570
578
|
authenticatedRoles: wCtxt.authenticatedRoles,
|
571
579
|
request: wCtxt.request,
|
@@ -583,28 +591,31 @@ class DBOSExecutor {
|
|
583
591
|
// Synchronously set the workflow's status to PENDING and record workflow inputs.
|
584
592
|
// We have to do it for all types of workflows because operation_outputs table has a foreign key constraint on workflow status table.
|
585
593
|
if (this.isDebugging) {
|
586
|
-
const wfStatus = await this.systemDatabase.getWorkflowStatus(
|
587
|
-
const wfInputs = await this.systemDatabase.getWorkflowInputs(
|
594
|
+
const wfStatus = await this.systemDatabase.getWorkflowStatus(workflowID);
|
595
|
+
const wfInputs = await this.systemDatabase.getWorkflowInputs(workflowID);
|
588
596
|
if (!wfStatus || !wfInputs) {
|
589
|
-
throw new error_1.DBOSDebuggerError(`Failed to find inputs for workflow UUID ${
|
597
|
+
throw new error_1.DBOSDebuggerError(`Failed to find inputs for workflow UUID ${workflowID}`);
|
590
598
|
}
|
591
599
|
// Make sure we use the same input.
|
592
600
|
if (utils_1.DBOSJSON.stringify(args) !== utils_1.DBOSJSON.stringify(wfInputs)) {
|
593
|
-
throw new error_1.DBOSDebuggerError(`Detected different inputs for workflow UUID ${
|
601
|
+
throw new error_1.DBOSDebuggerError(`Detected different inputs for workflow UUID ${workflowID}.\n Received: ${utils_1.DBOSJSON.stringify(args)}\n Original: ${utils_1.DBOSJSON.stringify(wfInputs)}`);
|
594
602
|
}
|
595
603
|
status = wfStatus.status;
|
596
604
|
}
|
597
605
|
else {
|
598
606
|
// TODO: Make this transactional (and with the queue step below)
|
599
|
-
if (callerFunctionID !== undefined &&
|
600
|
-
const
|
601
|
-
if (
|
602
|
-
return new workflow_1.RetrievedHandle(this.systemDatabase,
|
607
|
+
if (callerFunctionID !== undefined && callerID !== undefined) {
|
608
|
+
const cr = await this.systemDatabase.getOperationResult(callerID, callerFunctionID);
|
609
|
+
if (cr.res !== undefined) {
|
610
|
+
return new workflow_1.RetrievedHandle(this.systemDatabase, cr.res.child, callerID, callerFunctionID);
|
603
611
|
}
|
604
612
|
}
|
605
613
|
const ires = await this.systemDatabase.initWorkflowStatus(internalStatus, args);
|
606
|
-
if (callerFunctionID !== undefined &&
|
607
|
-
await this.systemDatabase.
|
614
|
+
if (callerFunctionID !== undefined && callerID !== undefined) {
|
615
|
+
await this.systemDatabase.recordOperationResult(callerID, callerFunctionID, {
|
616
|
+
childWfId: workflowID,
|
617
|
+
functionName: internalStatus.workflowName,
|
618
|
+
}, true);
|
608
619
|
}
|
609
620
|
args = ires.args;
|
610
621
|
status = ires.status;
|
@@ -621,9 +632,9 @@ class DBOSExecutor {
|
|
621
632
|
return await callPromise;
|
622
633
|
});
|
623
634
|
if (this.isDebugging) {
|
624
|
-
const recordedResult = await this.systemDatabase.
|
635
|
+
const recordedResult = DBOSExecutor.reviveResultOrError((await this.systemDatabase.awaitWorkflowResult(workflowID)));
|
625
636
|
if (!resultsMatch(recordedResult, callResult)) {
|
626
|
-
this.logger.error(`Detect different output for the workflow UUID ${
|
637
|
+
this.logger.error(`Detect different output for the workflow UUID ${workflowID}!\n Received: ${utils_1.DBOSJSON.stringify(callResult)}\n Original: ${utils_1.DBOSJSON.stringify(recordedResult)}`);
|
627
638
|
}
|
628
639
|
result = recordedResult;
|
629
640
|
}
|
@@ -636,23 +647,20 @@ class DBOSExecutor {
|
|
636
647
|
}
|
637
648
|
return utils_1.DBOSJSON.stringify(recordedResult) === utils_1.DBOSJSON.stringify(callResult);
|
638
649
|
}
|
639
|
-
internalStatus.output = result;
|
650
|
+
internalStatus.output = utils_1.DBOSJSON.stringify(result);
|
640
651
|
internalStatus.status = workflow_1.StatusString.SUCCESS;
|
641
652
|
if (internalStatus.queueName && !this.isDebugging) {
|
642
|
-
|
643
|
-
// But waiting this long is for concurrency control anyway,
|
644
|
-
// so it is probably done enough.
|
645
|
-
await this.systemDatabase.dequeueWorkflow(workflowUUID, this.#getQueueByName(internalStatus.queueName));
|
653
|
+
await this.systemDatabase.dequeueWorkflow(workflowID, this.#getQueueByName(internalStatus.queueName));
|
646
654
|
}
|
647
655
|
if (!this.isDebugging) {
|
648
|
-
await this.systemDatabase.recordWorkflowOutput(
|
656
|
+
await this.systemDatabase.recordWorkflowOutput(workflowID, internalStatus);
|
649
657
|
}
|
650
658
|
wCtxt.span.setStatus({ code: api_1.SpanStatusCode.OK });
|
651
659
|
}
|
652
660
|
catch (err) {
|
653
661
|
if (err instanceof error_1.DBOSWorkflowConflictUUIDError) {
|
654
662
|
// Retrieve the handle and wait for the result.
|
655
|
-
const retrievedHandle = this.retrieveWorkflow(
|
663
|
+
const retrievedHandle = this.retrieveWorkflow(workflowID);
|
656
664
|
result = await retrievedHandle.getResult();
|
657
665
|
wCtxt.span.setAttribute('cached', true);
|
658
666
|
wCtxt.span.setStatus({ code: api_1.SpanStatusCode.OK });
|
@@ -661,10 +669,10 @@ class DBOSExecutor {
|
|
661
669
|
internalStatus.error = err.message;
|
662
670
|
internalStatus.status = workflow_1.StatusString.CANCELLED;
|
663
671
|
if (!this.isDebugging) {
|
664
|
-
await this.systemDatabase.setWorkflowStatus(
|
672
|
+
await this.systemDatabase.setWorkflowStatus(workflowID, workflow_1.StatusString.CANCELLED, false);
|
665
673
|
}
|
666
674
|
wCtxt.span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: err.message });
|
667
|
-
this.logger.info(`Cancelled workflow ${
|
675
|
+
this.logger.info(`Cancelled workflow ${workflowID}`);
|
668
676
|
throw err;
|
669
677
|
}
|
670
678
|
else {
|
@@ -678,10 +686,10 @@ class DBOSExecutor {
|
|
678
686
|
internalStatus.error = utils_1.DBOSJSON.stringify((0, serialize_error_1.serializeError)(e));
|
679
687
|
internalStatus.status = workflow_1.StatusString.ERROR;
|
680
688
|
if (internalStatus.queueName && !this.isDebugging) {
|
681
|
-
await this.systemDatabase.dequeueWorkflow(
|
689
|
+
await this.systemDatabase.dequeueWorkflow(workflowID, this.#getQueueByName(internalStatus.queueName));
|
682
690
|
}
|
683
691
|
if (!this.isDebugging) {
|
684
|
-
await this.systemDatabase.recordWorkflowError(
|
692
|
+
await this.systemDatabase.recordWorkflowError(workflowID, internalStatus);
|
685
693
|
}
|
686
694
|
// TODO: Log errors, but not in the tests when they're expected.
|
687
695
|
wCtxt.span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: e.message });
|
@@ -703,17 +711,17 @@ class DBOSExecutor {
|
|
703
711
|
})
|
704
712
|
.finally(() => {
|
705
713
|
// Remove itself from pending workflow map.
|
706
|
-
this.pendingWorkflowMap.delete(
|
714
|
+
this.pendingWorkflowMap.delete(workflowID);
|
707
715
|
});
|
708
|
-
this.pendingWorkflowMap.set(
|
716
|
+
this.pendingWorkflowMap.set(workflowID, awaitWorkflowPromise);
|
709
717
|
// Return the normal handle that doesn't capture errors.
|
710
|
-
return new workflow_1.InvokedHandle(this.systemDatabase, workflowPromise,
|
718
|
+
return new workflow_1.InvokedHandle(this.systemDatabase, workflowPromise, workflowID, wf.name, callerID, callerFunctionID);
|
711
719
|
}
|
712
720
|
else {
|
713
721
|
if (params.queueName && status === 'ENQUEUED' && !this.isDebugging) {
|
714
|
-
await this.systemDatabase.enqueueWorkflow(
|
722
|
+
await this.systemDatabase.enqueueWorkflow(workflowID, this.#getQueueByName(params.queueName).name);
|
715
723
|
}
|
716
|
-
return new workflow_1.RetrievedHandle(this.systemDatabase,
|
724
|
+
return new workflow_1.RetrievedHandle(this.systemDatabase, workflowID, callerID, callerFunctionID);
|
717
725
|
}
|
718
726
|
}
|
719
727
|
#getQueueByName(name) {
|
@@ -736,14 +744,23 @@ class DBOSExecutor {
|
|
736
744
|
* Otherwise, return DBOSNull.
|
737
745
|
* Also return the transaction snapshot and id information of the original or current transaction.
|
738
746
|
*/
|
739
|
-
async #checkExecution(query, workflowUUID, funcID) {
|
740
|
-
const rows = await query(
|
747
|
+
async #checkExecution(query, workflowUUID, funcID, funcName) {
|
748
|
+
const rows = await query(`(SELECT output, error, txn_snapshot, txn_id, function_name, true as recorded
|
749
|
+
FROM dbos.transaction_outputs
|
750
|
+
WHERE workflow_uuid=$1 AND function_id=$2
|
751
|
+
UNION ALL
|
752
|
+
SELECT null as output, null as error, pg_current_snapshot()::text as txn_snapshot,
|
753
|
+
null as txn_id, '' as function_name, false as recorded
|
754
|
+
) ORDER BY recorded`, [workflowUUID, funcID]);
|
741
755
|
if (rows.length === 0 || rows.length > 2) {
|
742
756
|
const returnedRows = JSON.stringify(rows);
|
743
757
|
this.logger.error('Unexpected! This should never happen. Returned rows: ' + returnedRows);
|
744
758
|
throw new error_1.DBOSError('This should never happen. Returned rows: ' + returnedRows);
|
745
759
|
}
|
746
760
|
if (rows.length === 2) {
|
761
|
+
if (rows[1].function_name !== funcName) {
|
762
|
+
throw new error_1.DBOSUnexpectedStepError(workflowUUID, funcID, funcName, rows[0].function_name);
|
763
|
+
}
|
747
764
|
const { txn_snapshot, txn_id } = rows[1];
|
748
765
|
const error = utils_1.DBOSJSON.parse(rows[1].error);
|
749
766
|
if (error) {
|
@@ -858,7 +875,7 @@ class DBOSExecutor {
|
|
858
875
|
let prevResult = exports.dbosNull;
|
859
876
|
const queryFunc = (sql, args) => this.userDatabase.queryWithClient(client, sql, ...args);
|
860
877
|
if (wfCtx.presetUUID) {
|
861
|
-
const executionResult = await this.#checkExecution(queryFunc, workflowUUID, funcId);
|
878
|
+
const executionResult = await this.#checkExecution(queryFunc, workflowUUID, funcId, txn.name);
|
862
879
|
prevResult = executionResult.result;
|
863
880
|
txn_snapshot = executionResult.txn_snapshot;
|
864
881
|
if (prevResult !== exports.dbosNull) {
|
@@ -941,7 +958,7 @@ class DBOSExecutor {
|
|
941
958
|
}
|
942
959
|
catch (err) {
|
943
960
|
const e = err;
|
944
|
-
if (!this.debugMode) {
|
961
|
+
if (!this.debugMode && !(e instanceof error_1.DBOSUnexpectedStepError)) {
|
945
962
|
if (this.userDatabase.isRetriableTransactionError(err)) {
|
946
963
|
// serialization_failure in PostgreSQL
|
947
964
|
span.addEvent('TXN SERIALIZATION FAILURE', { retryWaitMillis: retryWaitMillis }, performance.now());
|
@@ -1026,7 +1043,7 @@ class DBOSExecutor {
|
|
1026
1043
|
let prevResult = exports.dbosNull;
|
1027
1044
|
const queryFunc = (sql, args) => this.procedurePool.query(sql, args).then((v) => v.rows);
|
1028
1045
|
if (wfCtx.presetUUID) {
|
1029
|
-
const executionResult = await this.#checkExecution(queryFunc, wfCtx.workflowUUID, funcId);
|
1046
|
+
const executionResult = await this.#checkExecution(queryFunc, wfCtx.workflowUUID, funcId, wfCtx.operationName);
|
1030
1047
|
prevResult = executionResult.result;
|
1031
1048
|
txn_snapshot = executionResult.txn_snapshot;
|
1032
1049
|
if (prevResult !== exports.dbosNull) {
|
@@ -1239,8 +1256,12 @@ class DBOSExecutor {
|
|
1239
1256
|
}, wfCtx.span);
|
1240
1257
|
const ctxt = new step_1.StepContextImpl(wfCtx, funcID, span, this.logger, commInfo.config, stepFn.name);
|
1241
1258
|
// Check if this execution previously happened, returning its original result if it did.
|
1242
|
-
const
|
1243
|
-
if (
|
1259
|
+
const checkr = await this.systemDatabase.getOperationResult(wfCtx.workflowUUID, ctxt.functionID);
|
1260
|
+
if (checkr.res !== undefined) {
|
1261
|
+
if (checkr.res.functionName !== ctxt.operationName) {
|
1262
|
+
throw new error_1.DBOSUnexpectedStepError(ctxt.workflowUUID, ctxt.functionID, ctxt.operationName, checkr.res.functionName ?? '?');
|
1263
|
+
}
|
1264
|
+
const check = DBOSExecutor.reviveResultOrError(checkr.res);
|
1244
1265
|
ctxt.span.setAttribute('cached', true);
|
1245
1266
|
ctxt.span.setStatus({ code: api_1.SpanStatusCode.OK });
|
1246
1267
|
this.tracer.endSpan(ctxt.span);
|
@@ -1318,14 +1339,20 @@ class DBOSExecutor {
|
|
1318
1339
|
if (result === exports.dbosNull) {
|
1319
1340
|
// Record the error, then throw it.
|
1320
1341
|
err = err === exports.dbosNull ? new error_1.DBOSMaxStepRetriesError(stepFn.name, ctxt.maxAttempts, errors) : err;
|
1321
|
-
await this.systemDatabase.
|
1342
|
+
await this.systemDatabase.recordOperationResult(wfCtx.workflowUUID, ctxt.functionID, {
|
1343
|
+
serialError: utils_1.DBOSJSON.stringify((0, serialize_error_1.serializeError)(err)),
|
1344
|
+
functionName: ctxt.operationName,
|
1345
|
+
}, true);
|
1322
1346
|
ctxt.span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: err.message });
|
1323
1347
|
this.tracer.endSpan(ctxt.span);
|
1324
1348
|
throw err;
|
1325
1349
|
}
|
1326
1350
|
else {
|
1327
1351
|
// Record the execution and return.
|
1328
|
-
await this.systemDatabase.
|
1352
|
+
await this.systemDatabase.recordOperationResult(wfCtx.workflowUUID, ctxt.functionID, {
|
1353
|
+
serialOutput: utils_1.DBOSJSON.stringify(result),
|
1354
|
+
functionName: ctxt.operationName,
|
1355
|
+
}, true);
|
1329
1356
|
ctxt.span.setStatus({ code: api_1.SpanStatusCode.OK });
|
1330
1357
|
this.tracer.endSpan(ctxt.span);
|
1331
1358
|
return result;
|
@@ -1347,7 +1374,7 @@ class DBOSExecutor {
|
|
1347
1374
|
* Wait for a workflow to emit an event, then return its value.
|
1348
1375
|
*/
|
1349
1376
|
async getEvent(workflowUUID, key, timeoutSeconds = DBOSExecutor.defaultNotificationTimeoutSec) {
|
1350
|
-
return this.systemDatabase.getEvent(workflowUUID, key, timeoutSeconds);
|
1377
|
+
return utils_1.DBOSJSON.parse(await this.systemDatabase.getEvent(workflowUUID, key, timeoutSeconds));
|
1351
1378
|
}
|
1352
1379
|
/**
|
1353
1380
|
* Retrieve a handle for a workflow UUID.
|
@@ -1355,8 +1382,32 @@ class DBOSExecutor {
|
|
1355
1382
|
retrieveWorkflow(workflowID) {
|
1356
1383
|
return new workflow_1.RetrievedHandle(this.systemDatabase, workflowID);
|
1357
1384
|
}
|
1358
|
-
|
1359
|
-
|
1385
|
+
async runAsStep(callback, functionName, workflowID, functionID) {
|
1386
|
+
if (workflowID !== undefined && functionID !== undefined) {
|
1387
|
+
const res = await this.systemDatabase.getOperationResult(workflowID, functionID);
|
1388
|
+
if (res.res !== undefined) {
|
1389
|
+
if (res.res.functionName !== functionName) {
|
1390
|
+
throw new error_1.DBOSUnexpectedStepError(workflowID, functionID, functionName, res.res.functionName);
|
1391
|
+
}
|
1392
|
+
return DBOSExecutor.reviveResultOrError(res.res);
|
1393
|
+
}
|
1394
|
+
}
|
1395
|
+
try {
|
1396
|
+
const output = await callback();
|
1397
|
+
if (workflowID !== undefined && functionID !== undefined) {
|
1398
|
+
await this.systemDatabase.recordOperationResult(workflowID, functionID, { serialOutput: utils_1.DBOSJSON.stringify(output), functionName }, true);
|
1399
|
+
}
|
1400
|
+
return output;
|
1401
|
+
}
|
1402
|
+
catch (e) {
|
1403
|
+
if (workflowID !== undefined && functionID !== undefined) {
|
1404
|
+
await this.systemDatabase.recordOperationResult(workflowID, functionID, { serialError: utils_1.DBOSJSON.stringify((0, serialize_error_1.serializeError)(e)), functionName }, false);
|
1405
|
+
}
|
1406
|
+
throw e;
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
getWorkflowStatus(workflowID, callerID, callerFN) {
|
1410
|
+
return this.systemDatabase.getWorkflowStatus(workflowID, callerID, callerFN);
|
1360
1411
|
}
|
1361
1412
|
getWorkflows(input) {
|
1362
1413
|
return this.systemDatabase.getWorkflows(input);
|
@@ -1473,20 +1524,20 @@ class DBOSExecutor {
|
|
1473
1524
|
this.logger.warn(`Error destroying wf queue runner: ${e.message}`);
|
1474
1525
|
}
|
1475
1526
|
}
|
1476
|
-
async executeWorkflowUUID(
|
1477
|
-
const wfStatus = await this.systemDatabase.getWorkflowStatus(
|
1478
|
-
const inputs = await this.systemDatabase.getWorkflowInputs(
|
1527
|
+
async executeWorkflowUUID(workflowID, startNewWorkflow = false) {
|
1528
|
+
const wfStatus = await this.systemDatabase.getWorkflowStatus(workflowID);
|
1529
|
+
const inputs = await this.systemDatabase.getWorkflowInputs(workflowID);
|
1479
1530
|
if (!inputs || !wfStatus) {
|
1480
|
-
this.logger.error(`Failed to find inputs for workflowUUID: ${
|
1481
|
-
throw new error_1.DBOSError(`Failed to find inputs for workflow UUID: ${
|
1531
|
+
this.logger.error(`Failed to find inputs for workflowUUID: ${workflowID}`);
|
1532
|
+
throw new error_1.DBOSError(`Failed to find inputs for workflow UUID: ${workflowID}`);
|
1482
1533
|
}
|
1483
|
-
const parentCtx = this.#getRecoveryContext(
|
1534
|
+
const parentCtx = this.#getRecoveryContext(workflowID, wfStatus);
|
1484
1535
|
const { wfInfo, configuredInst } = this.getWorkflowInfoByStatus(wfStatus);
|
1485
1536
|
// If starting a new workflow, assign a new UUID. Otherwise, use the workflow's original UUID.
|
1486
|
-
const
|
1537
|
+
const workflowStartID = startNewWorkflow ? undefined : workflowID;
|
1487
1538
|
if (wfInfo) {
|
1488
1539
|
return this.workflow(wfInfo.workflow, {
|
1489
|
-
workflowUUID:
|
1540
|
+
workflowUUID: workflowStartID,
|
1490
1541
|
parentCtx: parentCtx,
|
1491
1542
|
configuredInstance: configuredInst,
|
1492
1543
|
queueName: wfStatus.queueName,
|
@@ -1500,17 +1551,17 @@ class DBOSExecutor {
|
|
1500
1551
|
const nameArr = wfName.split('-');
|
1501
1552
|
if (!nameArr[0].startsWith(DBOSExecutor.tempWorkflowName)) {
|
1502
1553
|
// CB - Doesn't this happen if the user changed the function name in their code?
|
1503
|
-
throw new error_1.DBOSError(`This should never happen! Cannot find workflow info for a non-temporary workflow! UUID ${
|
1554
|
+
throw new error_1.DBOSError(`This should never happen! Cannot find workflow info for a non-temporary workflow! UUID ${workflowID}, name ${wfName}`);
|
1504
1555
|
}
|
1505
1556
|
let temp_workflow;
|
1506
1557
|
if (nameArr[1] === exports.TempWorkflowType.transaction) {
|
1507
1558
|
const { txnInfo, clsInst } = this.getTransactionInfoByNames(wfStatus.workflowClassName, nameArr[2], wfStatus.workflowConfigName);
|
1508
1559
|
if (!txnInfo) {
|
1509
|
-
this.logger.error(`Cannot find transaction info for UUID ${
|
1560
|
+
this.logger.error(`Cannot find transaction info for UUID ${workflowID}, name ${nameArr[2]}`);
|
1510
1561
|
throw new error_1.DBOSNotRegisteredError(nameArr[2]);
|
1511
1562
|
}
|
1512
1563
|
return await this.startTransactionTempWF(txnInfo.transaction, {
|
1513
|
-
workflowUUID:
|
1564
|
+
workflowUUID: workflowStartID,
|
1514
1565
|
parentCtx: parentCtx ?? undefined,
|
1515
1566
|
configuredInstance: clsInst,
|
1516
1567
|
queueName: wfStatus.queueName,
|
@@ -1522,11 +1573,11 @@ class DBOSExecutor {
|
|
1522
1573
|
else if (nameArr[1] === exports.TempWorkflowType.step) {
|
1523
1574
|
const { commInfo, clsInst } = this.getStepInfoByNames(wfStatus.workflowClassName, nameArr[2], wfStatus.workflowConfigName);
|
1524
1575
|
if (!commInfo) {
|
1525
|
-
this.logger.error(`Cannot find step info for UUID ${
|
1576
|
+
this.logger.error(`Cannot find step info for UUID ${workflowID}, name ${nameArr[2]}`);
|
1526
1577
|
throw new error_1.DBOSNotRegisteredError(nameArr[2]);
|
1527
1578
|
}
|
1528
1579
|
return await this.startStepTempWF(commInfo.step, {
|
1529
|
-
workflowUUID:
|
1580
|
+
workflowUUID: workflowStartID,
|
1530
1581
|
parentCtx: parentCtx ?? undefined,
|
1531
1582
|
configuredInstance: clsInst,
|
1532
1583
|
queueName: wfStatus.queueName, // Probably null
|
@@ -1540,7 +1591,7 @@ class DBOSExecutor {
|
|
1540
1591
|
return await ctxt.send(args[0], args[1], args[2]); // id, value, topic
|
1541
1592
|
};
|
1542
1593
|
return this.workflow(temp_workflow, {
|
1543
|
-
workflowUUID:
|
1594
|
+
workflowUUID: workflowStartID,
|
1544
1595
|
parentCtx: parentCtx ?? undefined,
|
1545
1596
|
tempWfType: exports.TempWorkflowType.send,
|
1546
1597
|
queueName: wfStatus.queueName,
|
@@ -1550,7 +1601,7 @@ class DBOSExecutor {
|
|
1550
1601
|
...inputs);
|
1551
1602
|
}
|
1552
1603
|
else {
|
1553
|
-
this.logger.error(`Unrecognized temporary workflow! UUID ${
|
1604
|
+
this.logger.error(`Unrecognized temporary workflow! UUID ${workflowID}, name ${wfName}`);
|
1554
1605
|
throw new error_1.DBOSNotRegisteredError(wfName);
|
1555
1606
|
}
|
1556
1607
|
}
|
@@ -1575,8 +1626,20 @@ class DBOSExecutor {
|
|
1575
1626
|
this.logger.info(`Cancelling workflow ${workflowID}`);
|
1576
1627
|
this.workflowCancellationMap.set(workflowID, true);
|
1577
1628
|
}
|
1629
|
+
async getWorkflowSteps(workflowID) {
|
1630
|
+
const outputs = await this.systemDatabase.getAllOperationResults(workflowID);
|
1631
|
+
return outputs.map((row) => {
|
1632
|
+
return {
|
1633
|
+
function_id: row.function_id,
|
1634
|
+
function_name: row.function_name ?? '<unknown>',
|
1635
|
+
child_workflow_id: row.child_workflow_id,
|
1636
|
+
output: row.output !== null ? utils_1.DBOSJSON.parse(row.output) : null,
|
1637
|
+
error: row.error !== null ? (0, serialize_error_1.deserializeError)(utils_1.DBOSJSON.parse(row.error)) : null,
|
1638
|
+
};
|
1639
|
+
});
|
1640
|
+
}
|
1578
1641
|
async listWorkflowSteps(workflowID) {
|
1579
|
-
const steps = await this.
|
1642
|
+
const steps = await this.getWorkflowSteps(workflowID);
|
1580
1643
|
const transactions = await this.getTransactions(workflowID);
|
1581
1644
|
const merged = [...steps, ...transactions];
|
1582
1645
|
merged.sort((a, b) => a.function_id - b.function_id);
|