@dbos-inc/dbos-sdk 3.0.55-preview → 3.0.56-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/src/dbos-executor.d.ts +8 -0
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +31 -0
- 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 +0 -13
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/dbos-runtime/config.d.ts +1 -2
- package/dist/src/dbos-runtime/config.d.ts.map +1 -1
- package/dist/src/dbos-runtime/config.js +0 -9
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos.d.ts.map +1 -1
- package/dist/src/dbos.js +1 -2
- package/dist/src/dbos.js.map +1 -1
- package/dist/src/index.d.ts +1 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
- package/dist/src/dbos-runtime/debug.d.ts +0 -4
- package/dist/src/dbos-runtime/debug.d.ts.map +0 -1
- package/dist/src/dbos-runtime/debug.js +0 -49
- package/dist/src/dbos-runtime/debug.js.map +0 -1
- package/dist/src/dbos-runtime/runtime.d.ts +0 -16
- package/dist/src/dbos-runtime/runtime.d.ts.map +0 -1
- package/dist/src/dbos-runtime/runtime.js +0 -67
- package/dist/src/dbos-runtime/runtime.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dbos-inc/dbos-sdk",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.56-preview",
|
4
4
|
"description": "A Typescript framework built on the database",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -42,7 +42,6 @@
|
|
42
42
|
"@types/koa": "^2.15.0",
|
43
43
|
"@types/koa__cors": "^5.0.0",
|
44
44
|
"@types/koa__router": "^12.0.4",
|
45
|
-
"@types/lodash": "^4.14.202",
|
46
45
|
"@types/node": "^20.19.1",
|
47
46
|
"@types/pg": "^8.11.2",
|
48
47
|
"@types/supertest": "^6.0.2",
|
@@ -80,7 +79,6 @@
|
|
80
79
|
"commander": "12.0.0",
|
81
80
|
"knex": "3.1.0",
|
82
81
|
"koa": "^2.15.4",
|
83
|
-
"lodash": "4.17.21",
|
84
82
|
"pg": "8.11.3",
|
85
83
|
"pg-protocol": "^1.6.1",
|
86
84
|
"reflect-metadata": "^0.2.2",
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import { DBOSConfigInternal } from '../dbos-executor';
|
2
|
-
import { DBOSRuntimeConfig } from './runtime';
|
3
|
-
export declare function debugWorkflow(dbosConfig: DBOSConfigInternal, runtimeConfig: DBOSRuntimeConfig, workflowUUID: string): Promise<void>;
|
4
|
-
//# sourceMappingURL=debug.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EAAe,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE3D,wBAAsB,aAAa,CACjC,UAAU,EAAE,kBAAkB,EAC9B,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,MAAM,iBAyCrB"}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.debugWorkflow = void 0;
|
4
|
-
const dbos_executor_1 = require("../dbos-executor");
|
5
|
-
const error_1 = require("../error");
|
6
|
-
const logs_1 = require("../telemetry/logs");
|
7
|
-
const runtime_1 = require("./runtime");
|
8
|
-
async function debugWorkflow(dbosConfig, runtimeConfig, workflowUUID) {
|
9
|
-
const logger = new logs_1.GlobalLogger();
|
10
|
-
try {
|
11
|
-
const dbosExec = new dbos_executor_1.DBOSExecutor(dbosConfig, { debugMode: true });
|
12
|
-
dbosExec.logger.debug(`Loading classes from entrypoints: ${JSON.stringify(runtimeConfig.entrypoints)}`);
|
13
|
-
await runtime_1.DBOSRuntime.loadClasses(runtimeConfig.entrypoints);
|
14
|
-
await dbosExec.init();
|
15
|
-
// Invoke the workflow in debug mode.
|
16
|
-
const handle = await dbosExec.executeWorkflowUUID(workflowUUID);
|
17
|
-
await handle.getResult();
|
18
|
-
// Destroy testing runtime.
|
19
|
-
await dbosExec.destroy();
|
20
|
-
}
|
21
|
-
catch (e) {
|
22
|
-
const errorLabel = `Debug mode error`;
|
23
|
-
logger.error(`${errorLabel}: ${e.message}`);
|
24
|
-
if (e instanceof AggregateError) {
|
25
|
-
console.error(e.errors);
|
26
|
-
for (const err of e.errors) {
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
28
|
-
if (err.code && err.code === 'ECONNREFUSED') {
|
29
|
-
const url = new URL(dbosConfig.databaseUrl);
|
30
|
-
console.error('\x1b[31m%s\x1b[0m', `Is database running at ${url.hostname} ?`);
|
31
|
-
break;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
else if (e instanceof error_1.DBOSFailLoadOperationsError) {
|
36
|
-
console.error('\x1b[31m%s\x1b[0m', 'Did you compile this application? Hint: run `npm run build` and try again');
|
37
|
-
}
|
38
|
-
else if (e instanceof error_1.DBOSNotRegisteredError) {
|
39
|
-
console.error('\x1b[31m%s\x1b[0m', 'Did you modify this application? Hint: make sure the above function exists in your application, then run `npm run build` to re-compile and try again');
|
40
|
-
}
|
41
|
-
else if (e instanceof error_1.DBOSInitializationError) {
|
42
|
-
console.error('\x1b[31m%s\x1b[0m', 'Please check your configuration file and try again');
|
43
|
-
}
|
44
|
-
process.exit(1);
|
45
|
-
}
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
exports.debugWorkflow = debugWorkflow;
|
49
|
-
//# sourceMapping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K,cAAc,EAAE,CAAC;oBAC5C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;oBAC5C,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,0BAA0B,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;oBAC/E,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,CAAC,YAAY,mCAA2B,EAAE,CAAC;YACpD,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,2EAA2E,CAAC,CAAC;QAClH,CAAC;aAAM,IAAI,CAAC,YAAY,8BAAsB,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CACX,mBAAmB,EACnB,sJAAsJ,CACvJ,CAAC;QACJ,CAAC;aAAM,IAAI,CAAC,YAAY,+BAAuB,EAAE,CAAC;YAChD,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,oDAAoD,CAAC,CAAC;QAC3F,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO;AACT,CAAC;AA5CD,sCA4CC"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
export interface DBOSRuntimeConfig {
|
2
|
-
entrypoints: string[];
|
3
|
-
port: number;
|
4
|
-
admin_port: number;
|
5
|
-
runAdminServer: boolean;
|
6
|
-
start: string[];
|
7
|
-
setup: string[];
|
8
|
-
}
|
9
|
-
export declare const defaultEntryPoint = "dist/operations.js";
|
10
|
-
export declare class DBOSRuntime {
|
11
|
-
/**
|
12
|
-
* Load an application's workflow functions from the compiled JS files.
|
13
|
-
*/
|
14
|
-
static loadClasses(entrypoints: string[]): Promise<object[]>;
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=runtime.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/runtime.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AACD,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,qBAAa,WAAW;IACtB;;OAEG;WACU,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAwBnE"}
|
@@ -1,67 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.DBOSRuntime = exports.defaultEntryPoint = void 0;
|
30
|
-
const fs = __importStar(require("fs"));
|
31
|
-
const lodash_1 = require("lodash");
|
32
|
-
const error_1 = require("../error");
|
33
|
-
const node_path_1 = __importDefault(require("node:path"));
|
34
|
-
const url_1 = require("url");
|
35
|
-
exports.defaultEntryPoint = 'dist/operations.js';
|
36
|
-
class DBOSRuntime {
|
37
|
-
/**
|
38
|
-
* Load an application's workflow functions from the compiled JS files.
|
39
|
-
*/
|
40
|
-
static async loadClasses(entrypoints) {
|
41
|
-
const allClasses = [];
|
42
|
-
for (const entrypoint of entrypoints) {
|
43
|
-
const operations = node_path_1.default.isAbsolute(entrypoint) ? entrypoint : node_path_1.default.join(process.cwd(), entrypoint);
|
44
|
-
let exports;
|
45
|
-
if (fs.existsSync(operations)) {
|
46
|
-
const operationsURL = (0, url_1.pathToFileURL)(operations).href;
|
47
|
-
exports = (await import(operationsURL));
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
throw new error_1.DBOSFailLoadOperationsError(`Failed to load operations from the entrypoint ${entrypoint}`);
|
51
|
-
}
|
52
|
-
const classes = [];
|
53
|
-
for (const key in exports) {
|
54
|
-
if ((0, lodash_1.isObject)(exports[key])) {
|
55
|
-
classes.push(exports[key]);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
allClasses.push(...classes);
|
59
|
-
}
|
60
|
-
if (allClasses.length === 0) {
|
61
|
-
throw new error_1.DBOSFailLoadOperationsError('operations not found');
|
62
|
-
}
|
63
|
-
return allClasses;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
exports.DBOSRuntime = DBOSRuntime;
|
67
|
-
//# sourceMappingURL=runtime.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/dbos-runtime/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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