@dbos-inc/dbos-sdk 0.7.25-preview → 0.8.12-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/configure.js +12 -2
- package/dist/src/cloud-cli/applications/configure.js.map +1 -1
- package/dist/src/cloud-cli/applications/delete-app.js +1 -1
- package/dist/src/cloud-cli/applications/delete-app.js.map +1 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.js +10 -2
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -1
- package/dist/src/cloud-cli/applications/get-app-logs.js +1 -1
- package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -1
- package/dist/src/cloud-cli/applications/list-apps.js +1 -1
- package/dist/src/cloud-cli/applications/list-apps.js.map +1 -1
- package/dist/src/cloud-cli/applications/register-app.js +1 -1
- package/dist/src/cloud-cli/applications/register-app.js.map +1 -1
- package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/update-app.js +3 -2
- package/dist/src/cloud-cli/applications/update-app.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/login.d.ts.map +1 -1
- package/dist/src/cloud-cli/login.js +3 -2
- package/dist/src/cloud-cli/login.js.map +1 -1
- package/dist/src/cloud-cli/register.js +1 -1
- package/dist/src/cloud-cli/register.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 +102 -8
- package/dist/src/cloud-cli/userdb.js.map +1 -1
- package/dist/src/communicator.d.ts +3 -2
- package/dist/src/communicator.d.ts.map +1 -1
- package/dist/src/communicator.js.map +1 -1
- package/dist/src/context.d.ts +3 -3
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +8 -8
- package/dist/src/context.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +19 -7
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +186 -67
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts +0 -1
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +14 -2
- 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 +0 -1
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos-runtime/debug.d.ts +4 -0
- package/dist/src/dbos-runtime/debug.d.ts.map +1 -0
- package/dist/src/dbos-runtime/debug.js +23 -0
- package/dist/src/dbos-runtime/debug.js.map +1 -0
- package/dist/src/dbos-runtime/runtime.d.ts +2 -2
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
- package/dist/src/dbos-runtime/runtime.js +20 -21
- package/dist/src/dbos-runtime/runtime.js.map +1 -1
- package/dist/src/debugger/debug_workflow.d.ts +8 -8
- package/dist/src/debugger/debug_workflow.d.ts.map +1 -1
- package/dist/src/debugger/debug_workflow.js +107 -36
- package/dist/src/debugger/debug_workflow.js.map +1 -1
- package/dist/src/httpServer/handler.d.ts +1 -1
- package/dist/src/httpServer/handler.d.ts.map +1 -1
- package/dist/src/httpServer/handler.js +14 -14
- package/dist/src/httpServer/handler.js.map +1 -1
- package/dist/src/httpServer/server.d.ts +4 -4
- package/dist/src/httpServer/server.d.ts.map +1 -1
- package/dist/src/httpServer/server.js +17 -17
- package/dist/src/httpServer/server.js.map +1 -1
- package/dist/src/{dbos-runtime → staticAnalysis}/TypeParser.d.ts +4 -0
- package/dist/src/staticAnalysis/TypeParser.d.ts.map +1 -0
- package/dist/src/{dbos-runtime → staticAnalysis}/TypeParser.js +34 -1
- package/dist/src/staticAnalysis/TypeParser.js.map +1 -0
- package/dist/src/{dbos-runtime → staticAnalysis}/openApi.d.ts.map +1 -1
- package/dist/src/{dbos-runtime → staticAnalysis}/openApi.js +1 -31
- package/dist/src/staticAnalysis/openApi.js.map +1 -0
- package/dist/src/staticAnalysis/tsDiagUtil.d.ts.map +1 -0
- package/dist/src/staticAnalysis/tsDiagUtil.js.map +1 -0
- package/dist/src/system_database.d.ts +22 -9
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +44 -42
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/telemetry/collector.d.ts +5 -5
- package/dist/src/telemetry/collector.d.ts.map +1 -1
- package/dist/src/telemetry/collector.js +5 -17
- package/dist/src/telemetry/collector.js.map +1 -1
- package/dist/src/telemetry/exporters.d.ts +11 -24
- package/dist/src/telemetry/exporters.d.ts.map +1 -1
- package/dist/src/telemetry/exporters.js +42 -129
- package/dist/src/telemetry/exporters.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +6 -2
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +16 -0
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/logs.d.ts +35 -11
- package/dist/src/telemetry/logs.d.ts.map +1 -1
- package/dist/src/telemetry/logs.js +158 -53
- package/dist/src/telemetry/logs.js.map +1 -1
- package/dist/src/telemetry/traces.d.ts +1 -6
- package/dist/src/telemetry/traces.d.ts.map +1 -1
- package/dist/src/telemetry/traces.js +2 -34
- package/dist/src/telemetry/traces.js.map +1 -1
- package/dist/src/testing/testing_runtime.d.ts +1 -1
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.js +8 -2
- package/dist/src/testing/testing_runtime.js.map +1 -1
- package/dist/src/transaction.d.ts +1 -1
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/workflow.d.ts +16 -1
- package/dist/src/workflow.d.ts.map +1 -1
- package/dist/src/workflow.js +103 -61
- 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 +3 -2
- package/dist/src/dbos-runtime/TypeParser.d.ts.map +0 -1
- package/dist/src/dbos-runtime/TypeParser.js.map +0 -1
- package/dist/src/dbos-runtime/openApi.js.map +0 -1
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +0 -1
- package/dist/src/dbos-runtime/tsDiagUtil.js.map +0 -1
- package/dist/src/telemetry/signals.d.ts +0 -20
- package/dist/src/telemetry/signals.d.ts.map +0 -1
- package/dist/src/telemetry/signals.js +0 -11
- package/dist/src/telemetry/signals.js.map +0 -1
- /package/dist/src/{dbos-runtime → staticAnalysis}/openApi.d.ts +0 -0
- /package/dist/src/{dbos-runtime → staticAnalysis}/tsDiagUtil.d.ts +0 -0
- /package/dist/src/{dbos-runtime → staticAnalysis}/tsDiagUtil.js +0 -0
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.TypeParser = void 0;
|
6
|
+
exports.findPackageInfo = exports.TypeParser = void 0;
|
7
7
|
const typescript_1 = __importDefault(require("typescript"));
|
8
8
|
const tsDiagUtil_1 = require("./tsDiagUtil");
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
10
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
9
11
|
function isStaticMethod(node) {
|
10
12
|
const mods = node.modifiers ?? [];
|
11
13
|
return mods.some(m => m.kind === typescript_1.default.SyntaxKind.StaticKeyword);
|
@@ -101,4 +103,35 @@ class TypeParser {
|
|
101
103
|
}
|
102
104
|
}
|
103
105
|
exports.TypeParser = TypeParser;
|
106
|
+
async function findPackageInfo(entrypoints) {
|
107
|
+
for (const entrypoint of entrypoints) {
|
108
|
+
let dirname = node_path_1.default.dirname(entrypoint);
|
109
|
+
while (dirname !== '/') {
|
110
|
+
try {
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
112
|
+
const packageJson = JSON.parse(await promises_1.default.readFile(node_path_1.default.join(dirname, 'package.json'), { encoding: 'utf-8' }));
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
114
|
+
const name = packageJson.name ?? "unknown";
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
116
|
+
const version = packageJson.version;
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
118
|
+
const isPrivate = packageJson.private ?? false;
|
119
|
+
return {
|
120
|
+
name,
|
121
|
+
version: version
|
122
|
+
? version
|
123
|
+
: isPrivate ? "private" : "unknown"
|
124
|
+
};
|
125
|
+
}
|
126
|
+
catch (error) {
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
128
|
+
if (error.code !== 'ENOENT')
|
129
|
+
throw error;
|
130
|
+
}
|
131
|
+
dirname = node_path_1.default.dirname(dirname);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
return { name: "unknown", version: "unknown" };
|
135
|
+
}
|
136
|
+
exports.findPackageInfo = findPackageInfo;
|
104
137
|
//# sourceMappingURL=TypeParser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TypeParser.js","sourceRoot":"","sources":["../../../src/staticAnalysis/TypeParser.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,6CAAgE;AAChE,0DAA6B;AAC7B,gEAAkC;AA+BlC,SAAS,cAAc,CAAC,IAA0B;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAChE,CAAC;AAED,MAAa,UAAU;IACZ,QAAQ,CAAa;IAC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AO,KAAK,EAAE;gBACd,0GAA0G;gBAC1G,IAAK,KAAa,CAAC,IAAI,KAAK,QAAQ;oBAAE,MAAM,KAAK,CAAC;aACnD;YACD,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SACjC;KACF;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC;AA5BD,0CA4BC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"openApi.d.ts","sourceRoot":"","sources":["../../../src/
|
1
|
+
{"version":3,"file":"openApi.d.ts","sourceRoot":"","sources":["../../../src/staticAnalysis/openApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,UAAU,EAEV,SAAS,EACT,aAAa,EAEd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAQL,MAAM,EAKP,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKtD,UAAU,gBAAgB;IAAG,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;CAAE;AAqD5D,qBAAa,gBAAgB;;IAQf,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;IAFxC,IAAI,KAAK,6BAAgC;gBAEpB,OAAO,EAAE,EAAE,CAAC,OAAO;IAWxC,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,GAAG,SAAS;IAmCtG,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAG,gBAAgB,EAAE,YAAY,EAAE,SAAS,MAAM,EAAE,EAA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AAE,MAAM,GAAG,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,eAAe,GAAG,SAAS;IAyHvF,uBAAuB,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS;IAkB9E,mBAAmB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,UAAU,GAAG,cAAc,GAAG,SAAS;CAwErE;AAED,KAAK,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAE5F,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC,CAchG"}
|
@@ -8,8 +8,6 @@ const typescript_1 = __importDefault(require("typescript"));
|
|
8
8
|
const TypeParser_1 = require("./TypeParser");
|
9
9
|
const handler_1 = require("../httpServer/handler");
|
10
10
|
const ts_json_schema_generator_1 = require("ts-json-schema-generator");
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
12
|
-
const promises_1 = __importDefault(require("node:fs/promises"));
|
13
11
|
const tsDiagUtil_1 = require("./tsDiagUtil");
|
14
12
|
function isValid(value) { return value !== undefined; }
|
15
13
|
// ts-json-schema-generator does not support BigInt, so OpenApiGenerator needs a custom type, formatter and parser for it
|
@@ -550,34 +548,6 @@ class OpenApiGenerator {
|
|
550
548
|
}
|
551
549
|
}
|
552
550
|
exports.OpenApiGenerator = OpenApiGenerator;
|
553
|
-
async function findPackageInfo(entrypoint) {
|
554
|
-
let dirname = node_path_1.default.dirname(entrypoint);
|
555
|
-
while (dirname !== '/') {
|
556
|
-
try {
|
557
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
558
|
-
const packageJson = JSON.parse(await promises_1.default.readFile(node_path_1.default.join(dirname, 'package.json'), { encoding: 'utf-8' }));
|
559
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
560
|
-
const name = packageJson.name ?? "unknown";
|
561
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
562
|
-
const version = packageJson.version;
|
563
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
564
|
-
const isPrivate = packageJson.private ?? false;
|
565
|
-
return {
|
566
|
-
name,
|
567
|
-
version: version
|
568
|
-
? version
|
569
|
-
: isPrivate ? "private" : "unknown"
|
570
|
-
};
|
571
|
-
}
|
572
|
-
catch (error) {
|
573
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
574
|
-
if (error.code !== 'ENOENT')
|
575
|
-
throw error;
|
576
|
-
}
|
577
|
-
dirname = node_path_1.default.dirname(dirname);
|
578
|
-
}
|
579
|
-
return { name: "unknown", version: "unknown" };
|
580
|
-
}
|
581
551
|
async function generateOpenApi(entrypoint) {
|
582
552
|
const program = typescript_1.default.createProgram([entrypoint], {});
|
583
553
|
const parser = new TypeParser_1.TypeParser(program);
|
@@ -585,7 +555,7 @@ async function generateOpenApi(entrypoint) {
|
|
585
555
|
(0, tsDiagUtil_1.logDiagnostics)(parser.diags);
|
586
556
|
if (!classes || classes.length === 0)
|
587
557
|
return undefined;
|
588
|
-
const { name, version } = await findPackageInfo(entrypoint);
|
558
|
+
const { name, version } = await (0, TypeParser_1.findPackageInfo)([entrypoint]);
|
589
559
|
const generator = new OpenApiGenerator(program);
|
590
560
|
const openapi = generator.generate(classes, name, version);
|
591
561
|
(0, tsDiagUtil_1.logDiagnostics)(generator.diags);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"openApi.js","sourceRoot":"","sources":["../../../src/staticAnalysis/openApi.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,6CAOsB;AAEtB,mDAA6D;AAE7D,uEAakC;AAGlC,6CAAgF;AAEhF,SAAS,OAAO,CAAI,KAAoB,IAAgB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;AAIrF,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G,CAAC,EAAE;QACpB,MAAM,UAAU,GAA6B;YAC3C,mBAAmB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE;YACvD,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO;YAChC,oBAAoB,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,yBAAyB;gBAC1E,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE;SACtC,CAAA;QAED,MAAM,IAAI,GAAG,EAAE,CAAC,oCAAoC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACxE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAZD,wCAYC;AAED,MAAa,oBAAoB;IACtB,MAAM,GAAG,IAAI,KAAK,EAAiB,CAAC;IAC7C,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAkC,CAAC,CAAC,CAAC;IAE/D,KAAK,CAAC,OAAe,EAAE,IAAc;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,IAAc;QAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC;CACF;AAXD,oDAWC"}
|
@@ -2,17 +2,17 @@ import { DBOSNull } from "./dbos-executor";
|
|
2
2
|
import { Pool, PoolClient, PoolConfig } from "pg";
|
3
3
|
import { WorkflowStatus } from "./workflow";
|
4
4
|
import { HTTPRequest } from "./context";
|
5
|
-
import { Logger } from "
|
6
|
-
export declare const DBOSExecutorIDHeader = "dbos-executor-id";
|
5
|
+
import { GlobalLogger as Logger } from "./telemetry/logs";
|
7
6
|
export interface SystemDatabase {
|
8
7
|
init(): Promise<void>;
|
9
8
|
destroy(): Promise<void>;
|
10
9
|
checkWorkflowOutput<R>(workflowUUID: string): Promise<DBOSNull | R>;
|
11
|
-
initWorkflowStatus<T extends any[]>(
|
12
|
-
bufferWorkflowOutput
|
10
|
+
initWorkflowStatus<T extends any[]>(bufferedStatus: WorkflowStatusInternal, args: T): Promise<T>;
|
11
|
+
bufferWorkflowOutput(workflowUUID: string, status: WorkflowStatusInternal): void;
|
13
12
|
flushWorkflowStatusBuffer(): Promise<Array<string>>;
|
14
|
-
recordWorkflowError(workflowUUID: string,
|
13
|
+
recordWorkflowError(workflowUUID: string, status: WorkflowStatusInternal): Promise<void>;
|
15
14
|
getPendingWorkflows(executorID: string): Promise<Array<string>>;
|
15
|
+
setWorkflowInputs<T extends any[]>(workflowUUID: string, args: T): Promise<void>;
|
16
16
|
getWorkflowInputs<T extends any[]>(workflowUUID: string): Promise<T | null>;
|
17
17
|
checkOperationOutput<R>(workflowUUID: string, functionID: number): Promise<DBOSNull | R>;
|
18
18
|
recordOperationOutput<R>(workflowUUID: string, functionID: number, output: R): Promise<void>;
|
@@ -24,6 +24,18 @@ export interface SystemDatabase {
|
|
24
24
|
setEvent<T extends NonNullable<any>>(workflowUUID: string, functionID: number, key: string, value: T): Promise<void>;
|
25
25
|
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds: number, callerUUID?: string, functionID?: number): Promise<T | null>;
|
26
26
|
}
|
27
|
+
export interface WorkflowStatusInternal {
|
28
|
+
workflowUUID: string;
|
29
|
+
status: string;
|
30
|
+
name: string;
|
31
|
+
authenticatedUser: string;
|
32
|
+
output: unknown;
|
33
|
+
error: string;
|
34
|
+
assumedRole: string;
|
35
|
+
authenticatedRoles: string[];
|
36
|
+
request: HTTPRequest;
|
37
|
+
executorID: string;
|
38
|
+
}
|
27
39
|
export declare class PostgresSystemDatabase implements SystemDatabase {
|
28
40
|
readonly pgPoolConfig: PoolConfig;
|
29
41
|
readonly systemDatabaseName: string;
|
@@ -32,19 +44,20 @@ export declare class PostgresSystemDatabase implements SystemDatabase {
|
|
32
44
|
notificationsClient: PoolClient | null;
|
33
45
|
readonly notificationsMap: Record<string, () => void>;
|
34
46
|
readonly workflowEventsMap: Record<string, () => void>;
|
35
|
-
readonly workflowStatusBuffer: Map<string,
|
47
|
+
readonly workflowStatusBuffer: Map<string, WorkflowStatusInternal>;
|
36
48
|
constructor(pgPoolConfig: PoolConfig, systemDatabaseName: string, logger: Logger);
|
37
49
|
init(): Promise<void>;
|
38
50
|
destroy(): Promise<void>;
|
39
51
|
checkWorkflowOutput<R>(workflowUUID: string): Promise<DBOSNull | R>;
|
40
|
-
initWorkflowStatus<T extends any[]>(
|
41
|
-
bufferWorkflowOutput
|
52
|
+
initWorkflowStatus<T extends any[]>(initStatus: WorkflowStatusInternal, args: T): Promise<T>;
|
53
|
+
bufferWorkflowOutput(workflowUUID: string, status: WorkflowStatusInternal): void;
|
42
54
|
/**
|
43
55
|
* Flush the workflow output buffer to the database.
|
44
56
|
*/
|
45
57
|
flushWorkflowStatusBuffer(): Promise<string[]>;
|
46
|
-
recordWorkflowError(workflowUUID: string,
|
58
|
+
recordWorkflowError(workflowUUID: string, status: WorkflowStatusInternal): Promise<void>;
|
47
59
|
getPendingWorkflows(executorID: string): Promise<Array<string>>;
|
60
|
+
setWorkflowInputs<T extends any[]>(workflowUUID: string, args: T): Promise<void>;
|
48
61
|
getWorkflowInputs<T extends any[]>(workflowUUID: string): Promise<T | null>;
|
49
62
|
checkOperationOutput<R>(workflowUUID: string, functionID: number): Promise<DBOSNull | R>;
|
50
63
|
recordOperationOutput<R>(workflowUUID: string, functionID: number, output: R): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"system_database.d.ts","sourceRoot":"","sources":["../../src/system_database.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,QAAQ,EA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,CAAC,cAAc,GAAG,IAAI,CAAC;IA6BjH,iBAAiB,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAkB5D;;;OAGG;IACG,sBAAsB;CAiB7B"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.PostgresSystemDatabase =
|
4
|
+
exports.PostgresSystemDatabase = void 0;
|
5
5
|
const serialize_error_1 = require("serialize-error");
|
6
6
|
const dbos_executor_1 = require("./dbos-executor");
|
7
7
|
const pg_1 = require("pg");
|
@@ -9,7 +9,6 @@ const error_1 = require("./error");
|
|
9
9
|
const workflow_1 = require("./workflow");
|
10
10
|
const system_db_schema_1 = require("../schemas/system_db_schema");
|
11
11
|
const utils_1 = require("./utils");
|
12
|
-
exports.DBOSExecutorIDHeader = "dbos-executor-id";
|
13
12
|
class PostgresSystemDatabase {
|
14
13
|
pgPoolConfig;
|
15
14
|
systemDatabaseName;
|
@@ -31,10 +30,14 @@ class PostgresSystemDatabase {
|
|
31
30
|
const pgSystemClient = new pg_1.Client(this.pgPoolConfig);
|
32
31
|
await pgSystemClient.connect();
|
33
32
|
// Create the system database and load tables.
|
34
|
-
const dbExists = await pgSystemClient.query(`SELECT FROM pg_database WHERE datname = '${this.systemDatabaseName}'`);
|
35
|
-
if (dbExists.rows.
|
33
|
+
const dbExists = await pgSystemClient.query(`SELECT EXISTS (SELECT FROM pg_database WHERE datname = '${this.systemDatabaseName}')`);
|
34
|
+
if (!dbExists.rows[0].exists) {
|
36
35
|
// Create the DBOS system database.
|
37
36
|
await pgSystemClient.query(`CREATE DATABASE "${this.systemDatabaseName}"`);
|
37
|
+
}
|
38
|
+
// Check if the system schema exist.
|
39
|
+
const schemaExists = await this.pool.query(`SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'workflow_status')`);
|
40
|
+
if (!schemaExists.rows[0].exists) {
|
38
41
|
// Load the DBOS system schemas.
|
39
42
|
await this.pool.query(system_db_schema_1.systemDBSchema);
|
40
43
|
}
|
@@ -49,7 +52,7 @@ class PostgresSystemDatabase {
|
|
49
52
|
await this.pool.end();
|
50
53
|
}
|
51
54
|
async checkWorkflowOutput(workflowUUID) {
|
52
|
-
const { rows } = await this.pool.query(
|
55
|
+
const { rows } = await this.pool.query(`SELECT status, output, error FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status WHERE workflow_uuid=$1`, [workflowUUID]);
|
53
56
|
if (rows.length === 0 || rows[0].status === workflow_1.StatusString.PENDING) {
|
54
57
|
return dbos_executor_1.dbosNull;
|
55
58
|
}
|
@@ -60,17 +63,13 @@ class PostgresSystemDatabase {
|
|
60
63
|
return JSON.parse(rows[0].output);
|
61
64
|
}
|
62
65
|
}
|
63
|
-
async initWorkflowStatus(
|
64
|
-
|
65
|
-
|
66
|
-
executorID = request.headers[exports.DBOSExecutorIDHeader];
|
67
|
-
}
|
68
|
-
await this.pool.query(`INSERT INTO workflow_status (workflow_uuid, status, name, authenticated_user, assumed_role, authenticated_roles, request, output, executor_id) VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9) ON CONFLICT (workflow_uuid) DO NOTHING`, [workflowUUID, workflow_1.StatusString.PENDING, name, authenticatedUser, assumedRole, JSON.stringify(authenticatedRoles), JSON.stringify(request), null, executorID]);
|
69
|
-
const { rows } = await this.pool.query(`INSERT INTO workflow_inputs (workflow_uuid, inputs) VALUES($1, $2) ON CONFLICT (workflow_uuid) DO UPDATE SET workflow_uuid = excluded.workflow_uuid RETURNING inputs`, [workflowUUID, JSON.stringify(args)]);
|
66
|
+
async initWorkflowStatus(initStatus, args) {
|
67
|
+
await this.pool.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status (workflow_uuid, status, name, authenticated_user, assumed_role, authenticated_roles, request, output, executor_id) VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9) ON CONFLICT (workflow_uuid) DO NOTHING`, [initStatus.workflowUUID, initStatus.status, initStatus.name, initStatus.authenticatedUser, initStatus.assumedRole, JSON.stringify(initStatus.authenticatedRoles), JSON.stringify(initStatus.request), null, initStatus.executorID]);
|
68
|
+
const { rows } = await this.pool.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_inputs (workflow_uuid, inputs) VALUES($1, $2) ON CONFLICT (workflow_uuid) DO UPDATE SET workflow_uuid = excluded.workflow_uuid RETURNING inputs`, [initStatus.workflowUUID, JSON.stringify(args)]);
|
70
69
|
return JSON.parse(rows[0].inputs);
|
71
70
|
}
|
72
|
-
bufferWorkflowOutput(workflowUUID,
|
73
|
-
this.workflowStatusBuffer.set(workflowUUID,
|
71
|
+
bufferWorkflowOutput(workflowUUID, status) {
|
72
|
+
this.workflowStatusBuffer.set(workflowUUID, status);
|
74
73
|
}
|
75
74
|
/**
|
76
75
|
* Flush the workflow output buffer to the database.
|
@@ -81,15 +80,16 @@ class PostgresSystemDatabase {
|
|
81
80
|
try {
|
82
81
|
const client = await this.pool.connect();
|
83
82
|
await client.query("BEGIN");
|
84
|
-
for (const [workflowUUID,
|
85
|
-
await client.query(`INSERT INTO workflow_status (workflow_uuid, status, output) VALUES($1, $2, $3) ON CONFLICT (workflow_uuid)
|
86
|
-
DO UPDATE SET status=EXCLUDED.status, output=EXCLUDED.output;`, [workflowUUID,
|
83
|
+
for (const [workflowUUID, status] of localBuffer) {
|
84
|
+
await client.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status (workflow_uuid, status, name, authenticated_user, assumed_role, authenticated_roles, request, output, executor_id) VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9) ON CONFLICT (workflow_uuid)
|
85
|
+
DO UPDATE SET status=EXCLUDED.status, output=EXCLUDED.output;`, [workflowUUID, status.status, status.name, status.authenticatedUser, status.assumedRole, JSON.stringify(status.authenticatedRoles), JSON.stringify(status.request), JSON.stringify(status.output), status.executorID]);
|
87
86
|
}
|
88
87
|
await client.query("COMMIT");
|
89
88
|
client.release();
|
90
89
|
}
|
91
90
|
catch (error) {
|
92
|
-
|
91
|
+
error.message = `Error flushing workflow buffer: ${error.message}`;
|
92
|
+
this.logger.error(error);
|
93
93
|
// If there is a failure in flushing the buffer, return items to the global buffer for retrying later.
|
94
94
|
for (const [workflowUUID, output] of localBuffer) {
|
95
95
|
if (!this.workflowStatusBuffer.has(workflowUUID)) {
|
@@ -99,24 +99,26 @@ class PostgresSystemDatabase {
|
|
99
99
|
}
|
100
100
|
return Array.from(localBuffer.keys());
|
101
101
|
}
|
102
|
-
async recordWorkflowError(workflowUUID,
|
103
|
-
|
104
|
-
|
105
|
-
DO UPDATE SET status=EXCLUDED.status, error=EXCLUDED.error;`, [workflowUUID, workflow_1.StatusString.ERROR, serialErr]);
|
102
|
+
async recordWorkflowError(workflowUUID, status) {
|
103
|
+
await this.pool.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status (workflow_uuid, status, name, authenticated_user, assumed_role, authenticated_roles, request, error, executor_id) VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9) ON CONFLICT (workflow_uuid)
|
104
|
+
DO UPDATE SET status=EXCLUDED.status, error=EXCLUDED.error;`, [workflowUUID, workflow_1.StatusString.ERROR, status.name, status.authenticatedUser, status.assumedRole, JSON.stringify(status.authenticatedRoles), JSON.stringify(status.request), status.error, status.executorID]);
|
106
105
|
}
|
107
106
|
async getPendingWorkflows(executorID) {
|
108
|
-
const { rows } = await this.pool.query(`SELECT workflow_uuid FROM workflow_status WHERE status=$1 AND executor_id=$2`, [workflow_1.StatusString.PENDING, executorID]);
|
107
|
+
const { rows } = await this.pool.query(`SELECT workflow_uuid FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status WHERE status=$1 AND executor_id=$2`, [workflow_1.StatusString.PENDING, executorID]);
|
109
108
|
return rows.map(i => i.workflow_uuid);
|
110
109
|
}
|
110
|
+
async setWorkflowInputs(workflowUUID, args) {
|
111
|
+
await this.pool.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_inputs (workflow_uuid, inputs) VALUES($1, $2) ON CONFLICT (workflow_uuid) DO NOTHING`, [workflowUUID, JSON.stringify(args)]);
|
112
|
+
}
|
111
113
|
async getWorkflowInputs(workflowUUID) {
|
112
|
-
const { rows } = await this.pool.query(`SELECT inputs FROM workflow_inputs WHERE workflow_uuid=$1`, [workflowUUID]);
|
114
|
+
const { rows } = await this.pool.query(`SELECT inputs FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_inputs WHERE workflow_uuid=$1`, [workflowUUID]);
|
113
115
|
if (rows.length === 0) {
|
114
116
|
return null;
|
115
117
|
}
|
116
118
|
return JSON.parse(rows[0].inputs);
|
117
119
|
}
|
118
120
|
async checkOperationOutput(workflowUUID, functionID) {
|
119
|
-
const { rows } = await this.pool.query(
|
121
|
+
const { rows } = await this.pool.query(`SELECT output, error FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs WHERE workflow_uuid=$1 AND function_id=$2`, [workflowUUID, functionID]);
|
120
122
|
if (rows.length === 0) {
|
121
123
|
return dbos_executor_1.dbosNull;
|
122
124
|
}
|
@@ -130,7 +132,7 @@ class PostgresSystemDatabase {
|
|
130
132
|
async recordOperationOutput(workflowUUID, functionID, output) {
|
131
133
|
const serialOutput = JSON.stringify(output);
|
132
134
|
try {
|
133
|
-
await this.pool.query(
|
135
|
+
await this.pool.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs (workflow_uuid, function_id, output) VALUES ($1, $2, $3);`, [workflowUUID, functionID, serialOutput]);
|
134
136
|
}
|
135
137
|
catch (error) {
|
136
138
|
const err = error;
|
@@ -146,7 +148,7 @@ class PostgresSystemDatabase {
|
|
146
148
|
async recordOperationError(workflowUUID, functionID, error) {
|
147
149
|
const serialErr = JSON.stringify((0, serialize_error_1.serializeError)(error));
|
148
150
|
try {
|
149
|
-
await this.pool.query(
|
151
|
+
await this.pool.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs (workflow_uuid, function_id, error) VALUES ($1, $2, $3);`, [workflowUUID, functionID, serialErr]);
|
150
152
|
}
|
151
153
|
catch (error) {
|
152
154
|
const err = error;
|
@@ -164,7 +166,7 @@ class PostgresSystemDatabase {
|
|
164
166
|
*/
|
165
167
|
async recordNotificationOutput(client, workflowUUID, functionID, output) {
|
166
168
|
try {
|
167
|
-
await client.query(
|
169
|
+
await client.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs (workflow_uuid, function_id, output) VALUES ($1, $2, $3);`, [workflowUUID, functionID, JSON.stringify(output)]);
|
168
170
|
}
|
169
171
|
catch (error) {
|
170
172
|
await client.query("ROLLBACK");
|
@@ -184,13 +186,13 @@ class PostgresSystemDatabase {
|
|
184
186
|
topic = topic ?? this.nullTopic;
|
185
187
|
const client = await this.pool.connect();
|
186
188
|
await client.query("BEGIN ISOLATION LEVEL READ COMMITTED");
|
187
|
-
const { rows } = await client.query(
|
189
|
+
const { rows } = await client.query(`SELECT output FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs WHERE workflow_uuid=$1 AND function_id=$2`, [workflowUUID, functionID]);
|
188
190
|
if (rows.length > 0) {
|
189
191
|
await client.query("ROLLBACK");
|
190
192
|
client.release();
|
191
193
|
return;
|
192
194
|
}
|
193
|
-
await client.query(`INSERT INTO notifications (destination_uuid, topic, message) VALUES ($1, $2, $3);`, [destinationUUID, topic, JSON.stringify(message)]);
|
195
|
+
await client.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.notifications (destination_uuid, topic, message) VALUES ($1, $2, $3);`, [destinationUUID, topic, JSON.stringify(message)]);
|
194
196
|
await this.recordNotificationOutput(client, workflowUUID, functionID, undefined);
|
195
197
|
await client.query("COMMIT");
|
196
198
|
client.release();
|
@@ -198,7 +200,7 @@ class PostgresSystemDatabase {
|
|
198
200
|
async recv(workflowUUID, functionID, topic, timeoutSeconds = dbos_executor_1.DBOSExecutor.defaultNotificationTimeoutSec) {
|
199
201
|
topic = topic ?? this.nullTopic;
|
200
202
|
// First, check for previous executions.
|
201
|
-
const checkRows = (await this.pool.query(
|
203
|
+
const checkRows = (await this.pool.query(`SELECT output FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs WHERE workflow_uuid=$1 AND function_id=$2`, [workflowUUID, functionID])).rows;
|
202
204
|
if (checkRows.length > 0) {
|
203
205
|
return JSON.parse(checkRows[0].output);
|
204
206
|
}
|
@@ -217,7 +219,7 @@ class PostgresSystemDatabase {
|
|
217
219
|
});
|
218
220
|
const received = Promise.race([messagePromise, timeoutPromise]);
|
219
221
|
// Check if the key is already in the DB, then wait for the notification if it isn't.
|
220
|
-
const initRecvRows = (await this.pool.query(
|
222
|
+
const initRecvRows = (await this.pool.query(`SELECT topic FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.notifications WHERE destination_uuid=$1 AND topic=$2;`, [workflowUUID, topic])).rows;
|
221
223
|
if (initRecvRows.length === 0) {
|
222
224
|
await received;
|
223
225
|
}
|
@@ -227,14 +229,14 @@ class PostgresSystemDatabase {
|
|
227
229
|
await client.query(`BEGIN ISOLATION LEVEL READ COMMITTED`);
|
228
230
|
const finalRecvRows = (await client.query(`WITH oldest_entry AS (
|
229
231
|
SELECT destination_uuid, topic, message, created_at_epoch_ms
|
230
|
-
FROM notifications
|
232
|
+
FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.notifications
|
231
233
|
WHERE destination_uuid = $1
|
232
234
|
AND topic = $2
|
233
235
|
ORDER BY created_at_epoch_ms ASC
|
234
236
|
LIMIT 1
|
235
237
|
)
|
236
238
|
|
237
|
-
DELETE FROM notifications
|
239
|
+
DELETE FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.notifications
|
238
240
|
USING oldest_entry
|
239
241
|
WHERE notifications.destination_uuid = oldest_entry.destination_uuid
|
240
242
|
AND notifications.topic = oldest_entry.topic
|
@@ -252,13 +254,13 @@ class PostgresSystemDatabase {
|
|
252
254
|
async setEvent(workflowUUID, functionID, key, message) {
|
253
255
|
const client = await this.pool.connect();
|
254
256
|
await client.query("BEGIN ISOLATION LEVEL READ COMMITTED");
|
255
|
-
let { rows } = await client.query(
|
257
|
+
let { rows } = await client.query(`SELECT output FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs WHERE workflow_uuid=$1 AND function_id=$2`, [workflowUUID, functionID]);
|
256
258
|
if (rows.length > 0) {
|
257
259
|
await client.query("ROLLBACK");
|
258
260
|
client.release();
|
259
261
|
return;
|
260
262
|
}
|
261
|
-
({ rows } = await client.query(`INSERT INTO workflow_events (workflow_uuid, key, value) VALUES ($1, $2, $3) ON CONFLICT (workflow_uuid, key) DO NOTHING RETURNING workflow_uuid;`, [workflowUUID, key, JSON.stringify(message)]));
|
263
|
+
({ rows } = await client.query(`INSERT INTO ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_events (workflow_uuid, key, value) VALUES ($1, $2, $3) ON CONFLICT (workflow_uuid, key) DO NOTHING RETURNING workflow_uuid;`, [workflowUUID, key, JSON.stringify(message)]));
|
262
264
|
if (rows.length === 0) {
|
263
265
|
await client.query("ROLLBACK");
|
264
266
|
client.release();
|
@@ -271,7 +273,7 @@ class PostgresSystemDatabase {
|
|
271
273
|
async getEvent(workflowUUID, key, timeoutSeconds, callerUUID, functionID) {
|
272
274
|
// Check if the operation has been done before for OAOO (only do this inside a workflow).
|
273
275
|
if (callerUUID !== undefined && functionID !== undefined) {
|
274
|
-
const { rows } = await this.pool.query(
|
276
|
+
const { rows } = await this.pool.query(`SELECT output FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs WHERE workflow_uuid=$1 AND function_id=$2`, [callerUUID, functionID]);
|
275
277
|
if (rows.length > 0) {
|
276
278
|
return JSON.parse(rows[0].output);
|
277
279
|
}
|
@@ -290,7 +292,7 @@ class PostgresSystemDatabase {
|
|
290
292
|
});
|
291
293
|
const received = Promise.race([valuePromise, timeoutPromise]);
|
292
294
|
// Check if the key is already in the DB, then wait for the notification if it isn't.
|
293
|
-
const initRecvRows = (await this.pool.query(
|
295
|
+
const initRecvRows = (await this.pool.query(`SELECT key, value FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_events WHERE workflow_uuid=$1 AND key=$2;`, [workflowUUID, key])).rows;
|
294
296
|
if (initRecvRows.length === 0) {
|
295
297
|
await received;
|
296
298
|
}
|
@@ -302,7 +304,7 @@ class PostgresSystemDatabase {
|
|
302
304
|
}
|
303
305
|
else {
|
304
306
|
// Read it again from the database.
|
305
|
-
const finalRecvRows = (await this.pool.query(
|
307
|
+
const finalRecvRows = (await this.pool.query(`SELECT value FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_events WHERE workflow_uuid=$1 AND key=$2;`, [workflowUUID, key])).rows;
|
306
308
|
if (finalRecvRows.length > 0) {
|
307
309
|
value = JSON.parse(finalRecvRows[0].value);
|
308
310
|
}
|
@@ -316,12 +318,12 @@ class PostgresSystemDatabase {
|
|
316
318
|
async getWorkflowStatus(workflowUUID, callerUUID, functionID) {
|
317
319
|
// Check if the operation has been done before for OAOO (only do this inside a workflow).
|
318
320
|
if (callerUUID !== undefined && functionID !== undefined) {
|
319
|
-
const { rows } = await this.pool.query(
|
321
|
+
const { rows } = await this.pool.query(`SELECT output FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.operation_outputs WHERE workflow_uuid=$1 AND function_id=$2`, [callerUUID, functionID]);
|
320
322
|
if (rows.length > 0) {
|
321
323
|
return JSON.parse(rows[0].output);
|
322
324
|
}
|
323
325
|
}
|
324
|
-
const { rows } = await this.pool.query(
|
326
|
+
const { rows } = await this.pool.query(`SELECT status, name, authenticated_user, assumed_role, authenticated_roles, request FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status WHERE workflow_uuid=$1`, [workflowUUID]);
|
325
327
|
let value = null;
|
326
328
|
if (rows.length > 0) {
|
327
329
|
value = {
|
@@ -343,7 +345,7 @@ class PostgresSystemDatabase {
|
|
343
345
|
const pollingIntervalMs = 1000;
|
344
346
|
// eslint-disable-next-line no-constant-condition
|
345
347
|
while (true) {
|
346
|
-
const { rows } = await this.pool.query(
|
348
|
+
const { rows } = await this.pool.query(`SELECT status, output, error FROM ${dbos_executor_1.DBOSExecutor.systemDBSchemaName}.workflow_status WHERE workflow_uuid=$1`, [workflowUUID]);
|
347
349
|
if (rows.length > 0) {
|
348
350
|
const status = rows[0].status;
|
349
351
|
if (status === workflow_1.StatusString.SUCCESS) {
|