@dbos-inc/dbos-sdk 0.8.45-preview → 0.8.46-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/applications/delete-app.js +1 -2
- package/dist/packages/dbos-cloud/applications/delete-app.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js +5 -7
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.js +1 -2
- package/dist/packages/dbos-cloud/applications/get-app-logs.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/applications/list-apps.js +1 -2
- package/dist/packages/dbos-cloud/applications/list-apps.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/register-app.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/applications/register-app.js +1 -2
- package/dist/packages/dbos-cloud/applications/register-app.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/update-app.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/applications/update-app.js +1 -2
- package/dist/packages/dbos-cloud/applications/update-app.js.map +1 -1
- package/dist/packages/dbos-cloud/cloudutils.d.ts +7 -0
- package/dist/packages/dbos-cloud/cloudutils.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/cloudutils.js +44 -3
- package/dist/packages/dbos-cloud/cloudutils.js.map +1 -1
- package/dist/packages/dbos-cloud/login.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/login.js +3 -4
- package/dist/packages/dbos-cloud/login.js.map +1 -1
- package/dist/packages/dbos-cloud/register.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/register.js +1 -2
- package/dist/packages/dbos-cloud/register.js.map +1 -1
- package/dist/packages/dbos-cloud/userdb.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/userdb.js +3 -4
- package/dist/packages/dbos-cloud/userdb.js.map +1 -1
- package/dist/src/context.d.ts +1 -0
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/httpServer/server.d.ts +2 -1
- package/dist/src/httpServer/server.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.d.ts +2 -1
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/utils.d.ts +0 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +3 -12
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/delete-app.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/delete-app.js +1 -2
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/delete-app.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/deploy-app-code.js +5 -7
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/get-app-logs.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/get-app-logs.js +1 -2
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/get-app-logs.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/list-apps.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/list-apps.js +1 -2
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/list-apps.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/register-app.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/register-app.js +1 -2
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/register-app.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/update-app.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/update-app.js +1 -2
- package/packages/dbos-cloud/dist/packages/dbos-cloud/applications/update-app.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/cloudutils.d.ts +7 -0
- package/packages/dbos-cloud/dist/packages/dbos-cloud/cloudutils.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/cloudutils.js +44 -3
- package/packages/dbos-cloud/dist/packages/dbos-cloud/cloudutils.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/login.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/login.js +3 -4
- package/packages/dbos-cloud/dist/packages/dbos-cloud/login.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/register.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/register.js +1 -2
- package/packages/dbos-cloud/dist/packages/dbos-cloud/register.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.js +3 -4
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.js.map +1 -1
- package/packages/dbos-cloud/dist/src/utils.d.ts +0 -1
- package/packages/dbos-cloud/dist/src/utils.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/src/utils.js +3 -12
- package/packages/dbos-cloud/dist/src/utils.js.map +1 -1
- package/packages/dbos-cloud/package.json +1 -1
- package/packages/dbos-openapi/package.json +1 -1
- package/packages/dbos-cloud/dist/schemas/system_db_schema.d.ts +0 -34
- package/packages/dbos-cloud/dist/schemas/system_db_schema.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/schemas/system_db_schema.js +0 -77
- package/packages/dbos-cloud/dist/schemas/system_db_schema.js.map +0 -1
- package/packages/dbos-cloud/dist/schemas/user_db_schema.d.ts +0 -11
- package/packages/dbos-cloud/dist/schemas/user_db_schema.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/schemas/user_db_schema.js +0 -16
- package/packages/dbos-cloud/dist/schemas/user_db_schema.js.map +0 -1
- package/packages/dbos-cloud/dist/src/communicator.d.ts +0 -25
- package/packages/dbos-cloud/dist/src/communicator.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/communicator.js +0 -26
- package/packages/dbos-cloud/dist/src/communicator.js.map +0 -1
- package/packages/dbos-cloud/dist/src/context.d.ts +0 -64
- package/packages/dbos-cloud/dist/src/context.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/context.js +0 -96
- package/packages/dbos-cloud/dist/src/context.js.map +0 -1
- package/packages/dbos-cloud/dist/src/data_validation.d.ts +0 -3
- package/packages/dbos-cloud/dist/src/data_validation.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/data_validation.js +0 -168
- package/packages/dbos-cloud/dist/src/data_validation.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-executor.d.ts +0 -102
- package/packages/dbos-cloud/dist/src/dbos-executor.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-executor.js +0 -631
- package/packages/dbos-cloud/dist/src/dbos-executor.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/applicationVersion.d.ts +0 -3
- package/packages/dbos-cloud/dist/src/dbos-runtime/applicationVersion.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/applicationVersion.js +0 -13
- package/packages/dbos-cloud/dist/src/dbos-runtime/applicationVersion.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.d.ts +0 -8
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.js +0 -61
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/config.d.ts +0 -29
- package/packages/dbos-cloud/dist/src/dbos-runtime/config.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/config.js +0 -111
- package/packages/dbos-cloud/dist/src/dbos-runtime/config.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/debug.d.ts +0 -4
- package/packages/dbos-cloud/dist/src/dbos-runtime/debug.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/debug.js +0 -21
- package/packages/dbos-cloud/dist/src/dbos-runtime/debug.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/init.d.ts +0 -7
- package/packages/dbos-cloud/dist/src/dbos-runtime/init.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/init.js +0 -51
- package/packages/dbos-cloud/dist/src/dbos-runtime/init.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.d.ts +0 -3
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.js +0 -175
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.js.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/runtime.d.ts +0 -28
- package/packages/dbos-cloud/dist/src/dbos-runtime/runtime.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/runtime.js +0 -95
- package/packages/dbos-cloud/dist/src/dbos-runtime/runtime.js.map +0 -1
- package/packages/dbos-cloud/dist/src/debugger/debug_workflow.d.ts +0 -38
- package/packages/dbos-cloud/dist/src/debugger/debug_workflow.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/debugger/debug_workflow.js +0 -211
- package/packages/dbos-cloud/dist/src/debugger/debug_workflow.js.map +0 -1
- package/packages/dbos-cloud/dist/src/decorators.d.ts +0 -118
- package/packages/dbos-cloud/dist/src/decorators.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/decorators.js +0 -467
- package/packages/dbos-cloud/dist/src/decorators.js.map +0 -1
- package/packages/dbos-cloud/dist/src/error.d.ts +0 -47
- package/packages/dbos-cloud/dist/src/error.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/error.js +0 -171
- package/packages/dbos-cloud/dist/src/error.js.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/handler.d.ts +0 -54
- package/packages/dbos-cloud/dist/src/httpServer/handler.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/handler.js +0 -175
- package/packages/dbos-cloud/dist/src/httpServer/handler.js.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/handlerTypes.d.ts +0 -11
- package/packages/dbos-cloud/dist/src/httpServer/handlerTypes.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/handlerTypes.js +0 -19
- package/packages/dbos-cloud/dist/src/httpServer/handlerTypes.js.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/middleware.d.ts +0 -56
- package/packages/dbos-cloud/dist/src/httpServer/middleware.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/middleware.js +0 -57
- package/packages/dbos-cloud/dist/src/httpServer/middleware.js.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/server.d.ts +0 -45
- package/packages/dbos-cloud/dist/src/httpServer/server.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/httpServer/server.js +0 -253
- package/packages/dbos-cloud/dist/src/httpServer/server.js.map +0 -1
- package/packages/dbos-cloud/dist/src/system_database.d.ts +0 -91
- package/packages/dbos-cloud/dist/src/system_database.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/system_database.js +0 -462
- package/packages/dbos-cloud/dist/src/system_database.js.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/collector.d.ts +0 -16
- package/packages/dbos-cloud/dist/src/telemetry/collector.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/collector.js +0 -65
- package/packages/dbos-cloud/dist/src/telemetry/collector.js.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/exporters.d.ts +0 -15
- package/packages/dbos-cloud/dist/src/telemetry/exporters.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/exporters.js +0 -59
- package/packages/dbos-cloud/dist/src/telemetry/exporters.js.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/index.d.ts +0 -11
- package/packages/dbos-cloud/dist/src/telemetry/index.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/index.js +0 -19
- package/packages/dbos-cloud/dist/src/telemetry/index.js.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/logs.d.ts +0 -47
- package/packages/dbos-cloud/dist/src/telemetry/logs.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/logs.js +0 -195
- package/packages/dbos-cloud/dist/src/telemetry/logs.js.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/traces.d.ts +0 -14
- package/packages/dbos-cloud/dist/src/telemetry/traces.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/telemetry/traces.js +0 -52
- package/packages/dbos-cloud/dist/src/telemetry/traces.js.map +0 -1
- package/packages/dbos-cloud/dist/src/transaction.d.ts +0 -29
- package/packages/dbos-cloud/dist/src/transaction.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/transaction.js +0 -27
- package/packages/dbos-cloud/dist/src/transaction.js.map +0 -1
- package/packages/dbos-cloud/dist/src/user_database.d.ts +0 -132
- package/packages/dbos-cloud/dist/src/user_database.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/user_database.js +0 -332
- package/packages/dbos-cloud/dist/src/user_database.js.map +0 -1
- package/packages/dbos-cloud/dist/src/workflow.d.ts +0 -195
- package/packages/dbos-cloud/dist/src/workflow.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/workflow.js +0 -498
- package/packages/dbos-cloud/dist/src/workflow.js.map +0 -1
@@ -1,77 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.systemDBSchema = void 0;
|
4
|
-
exports.systemDBSchema = `
|
5
|
-
CREATE SCHEMA IF NOT EXISTS dbos;
|
6
|
-
|
7
|
-
CREATE TABLE IF NOT EXISTS dbos.operation_outputs (
|
8
|
-
workflow_uuid TEXT NOT NULL,
|
9
|
-
function_id INT NOT NULL,
|
10
|
-
output TEXT,
|
11
|
-
error TEXT,
|
12
|
-
PRIMARY KEY (workflow_uuid, function_id)
|
13
|
-
);
|
14
|
-
|
15
|
-
CREATE TABLE IF NOT EXISTS dbos.workflow_inputs (
|
16
|
-
workflow_uuid TEXT PRIMARY KEY NOT NULL,
|
17
|
-
inputs TEXT NOT NULL
|
18
|
-
);
|
19
|
-
|
20
|
-
CREATE TABLE IF NOT EXISTS dbos.workflow_status (
|
21
|
-
workflow_uuid TEXT PRIMARY KEY,
|
22
|
-
status TEXT,
|
23
|
-
name TEXT,
|
24
|
-
authenticated_user TEXT,
|
25
|
-
assumed_role TEXT,
|
26
|
-
authenticated_roles TEXT,
|
27
|
-
request TEXT,
|
28
|
-
output TEXT,
|
29
|
-
error TEXT,
|
30
|
-
executor_id TEXT
|
31
|
-
);
|
32
|
-
|
33
|
-
CREATE TABLE IF NOT EXISTS dbos.notifications (
|
34
|
-
destination_uuid TEXT NOT NULL,
|
35
|
-
topic TEXT,
|
36
|
-
message TEXT NOT NULL,
|
37
|
-
created_at_epoch_ms BIGINT NOT NULL DEFAULT (EXTRACT(EPOCH FROM now())*1000)::bigint
|
38
|
-
);
|
39
|
-
|
40
|
-
CREATE TABLE IF NOT EXISTS dbos.workflow_events (
|
41
|
-
workflow_uuid TEXT NOT NULL,
|
42
|
-
key TEXT NOT NULL,
|
43
|
-
value TEXT NOT NULL,
|
44
|
-
PRIMARY KEY (workflow_uuid, key)
|
45
|
-
);
|
46
|
-
|
47
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_topic ON dbos.notifications (destination_uuid, topic);
|
48
|
-
|
49
|
-
CREATE OR REPLACE FUNCTION dbos.notifications_function() RETURNS TRIGGER AS $$
|
50
|
-
DECLARE
|
51
|
-
payload text := NEW.destination_uuid || '::' || NEW.topic;
|
52
|
-
BEGIN
|
53
|
-
-- Publish a notification for all keys
|
54
|
-
PERFORM pg_notify('dbos_notifications_channel', payload);
|
55
|
-
RETURN NEW;
|
56
|
-
END;
|
57
|
-
$$ LANGUAGE plpgsql;
|
58
|
-
|
59
|
-
CREATE OR REPLACE TRIGGER dbos_notifications_trigger
|
60
|
-
AFTER INSERT ON dbos.notifications
|
61
|
-
FOR EACH ROW EXECUTE FUNCTION dbos.notifications_function();
|
62
|
-
|
63
|
-
CREATE OR REPLACE FUNCTION dbos.workflow_events_function() RETURNS TRIGGER AS $$
|
64
|
-
DECLARE
|
65
|
-
payload text := NEW.workflow_uuid || '::' || NEW.key;
|
66
|
-
BEGIN
|
67
|
-
-- Publish a notification for all keys
|
68
|
-
PERFORM pg_notify('dbos_workflow_events_channel', payload);
|
69
|
-
RETURN NEW;
|
70
|
-
END;
|
71
|
-
$$ LANGUAGE plpgsql;
|
72
|
-
|
73
|
-
CREATE OR REPLACE TRIGGER dbos_workflow_events_trigger
|
74
|
-
AFTER INSERT ON dbos.workflow_events
|
75
|
-
FOR EACH ROW EXECUTE FUNCTION dbos.workflow_events_function();
|
76
|
-
`;
|
77
|
-
//# sourceMappingURL=system_db_schema.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"system_db_schema.js","sourceRoot":"","sources":["../../../../schemas/system_db_schema.ts"],"names":[],"mappings":";;;AAqCa,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE7B,CAAC"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
export interface transaction_outputs {
|
2
|
-
workflow_uuid: string;
|
3
|
-
function_id: number;
|
4
|
-
output: string;
|
5
|
-
error: string;
|
6
|
-
txn_id: string;
|
7
|
-
txn_snapshot: string;
|
8
|
-
}
|
9
|
-
export declare const createUserDBSchema = "CREATE SCHEMA IF NOT EXISTS dbos;";
|
10
|
-
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 PRIMARY KEY (workflow_uuid, function_id)\n );\n";
|
11
|
-
//# sourceMappingURL=user_db_schema.d.ts.map
|
@@ -1 +0,0 @@
|
|
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,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AAEtE,eAAO,MAAM,YAAY,2QAUxB,CAAC"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.userDBSchema = exports.createUserDBSchema = void 0;
|
4
|
-
exports.createUserDBSchema = `CREATE SCHEMA IF NOT EXISTS dbos;`;
|
5
|
-
exports.userDBSchema = `
|
6
|
-
CREATE TABLE IF NOT EXISTS dbos.transaction_outputs (
|
7
|
-
workflow_uuid TEXT NOT NULL,
|
8
|
-
function_id INT NOT NULL,
|
9
|
-
output TEXT,
|
10
|
-
error TEXT,
|
11
|
-
txn_id TEXT,
|
12
|
-
txn_snapshot TEXT NOT NULL,
|
13
|
-
PRIMARY KEY (workflow_uuid, function_id)
|
14
|
-
);
|
15
|
-
`;
|
16
|
-
//# sourceMappingURL=user_db_schema.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"user_db_schema.js","sourceRoot":"","sources":["../../../../schemas/user_db_schema.ts"],"names":[],"mappings":";;;AASa,QAAA,kBAAkB,GAAG,mCAAmC,CAAC;AAEzD,QAAA,YAAY,GAAG;;;;;;;;;;CAU3B,CAAC"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
2
|
-
import { GlobalLogger as Logger } from "./telemetry/logs";
|
3
|
-
import { WorkflowContextImpl } from "./workflow";
|
4
|
-
import { DBOSContext, DBOSContextImpl } from "./context";
|
5
|
-
import { WorkflowContextDebug } from "./debugger/debug_workflow";
|
6
|
-
export type Communicator<T extends any[], R> = (ctxt: CommunicatorContext, ...args: T) => Promise<R>;
|
7
|
-
export interface CommunicatorConfig {
|
8
|
-
retriesAllowed?: boolean;
|
9
|
-
intervalSeconds?: number;
|
10
|
-
maxAttempts?: number;
|
11
|
-
backoffRate?: number;
|
12
|
-
}
|
13
|
-
export interface CommunicatorContext extends DBOSContext {
|
14
|
-
readonly retriesAllowed: boolean;
|
15
|
-
readonly maxAttempts: number;
|
16
|
-
}
|
17
|
-
export declare class CommunicatorContextImpl extends DBOSContextImpl implements CommunicatorContext {
|
18
|
-
readonly functionID: number;
|
19
|
-
readonly retriesAllowed: boolean;
|
20
|
-
readonly intervalSeconds: number;
|
21
|
-
readonly maxAttempts: number;
|
22
|
-
readonly backoffRate: number;
|
23
|
-
constructor(workflowContext: WorkflowContextImpl | WorkflowContextDebug, functionID: number, span: Span, logger: Logger, params: CommunicatorConfig, commName: string);
|
24
|
-
}
|
25
|
-
//# sourceMappingURL=communicator.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"communicator.d.ts","sourceRoot":"","sources":["../../../../src/communicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAErG,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IAEtD,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,qBAAa,uBAAwB,SAAQ,eAAgB,YAAW,mBAAmB;IACzF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAGjB,eAAe,EAAE,mBAAmB,GAAG,oBAAoB,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM;CAYtK"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.CommunicatorContextImpl = void 0;
|
4
|
-
const context_1 = require("./context");
|
5
|
-
class CommunicatorContextImpl extends context_1.DBOSContextImpl {
|
6
|
-
functionID;
|
7
|
-
retriesAllowed;
|
8
|
-
intervalSeconds;
|
9
|
-
maxAttempts;
|
10
|
-
backoffRate;
|
11
|
-
// TODO: Validate the parameters.
|
12
|
-
constructor(workflowContext, functionID, span, logger, params, commName) {
|
13
|
-
super(commName, span, logger, workflowContext);
|
14
|
-
this.functionID = functionID;
|
15
|
-
this.retriesAllowed = params.retriesAllowed ?? true;
|
16
|
-
this.intervalSeconds = params.intervalSeconds ?? 1;
|
17
|
-
this.maxAttempts = params.maxAttempts ?? 3;
|
18
|
-
this.backoffRate = params.backoffRate ?? 2;
|
19
|
-
if (workflowContext.applicationConfig) {
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
21
|
-
this.applicationConfig = workflowContext.applicationConfig;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
exports.CommunicatorContextImpl = CommunicatorContextImpl;
|
26
|
-
//# sourceMappingURL=communicator.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"communicator.js","sourceRoot":"","sources":["../../../../src/communicator.ts"],"names":[],"mappings":";;;AAGA,uCAAyD;AAmBzD,MAAa,uBAAwB,SAAQ,yBAAe;IACjD,UAAU,CAAS;IACnB,cAAc,CAAU;IACxB,eAAe,CAAS;IACxB,WAAW,CAAS;IACpB,WAAW,CAAS;IAE7B,iCAAiC;IACjC,YAAY,eAA2D,EAAE,UAAkB,EAAE,IAAU,EAAE,MAAc,EAAE,MAA0B,EAAE,QAAgB;QACnK,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;QACpD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;QAC3C,IAAI,eAAe,CAAC,iBAAiB,EAAE,CAAC;YACtC,mEAAmE;YACnE,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;QAC7D,CAAC;IACH,CAAC;CACF;AApBD,0DAoBC"}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
/// <reference types="node/http" />
|
4
|
-
/// <reference types="@koa/bodyparser/dist/body-parser" />
|
5
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
6
|
-
import { GlobalLogger as Logger, Logger as DBOSLogger } from "./telemetry/logs";
|
7
|
-
import { IncomingHttpHeaders } from "http";
|
8
|
-
import { ParsedUrlQuery } from "querystring";
|
9
|
-
import { DBOSExecutor } from "./dbos-executor";
|
10
|
-
export interface HTTPRequest {
|
11
|
-
readonly headers?: IncomingHttpHeaders;
|
12
|
-
readonly rawHeaders?: string[];
|
13
|
-
readonly params?: unknown;
|
14
|
-
readonly body?: unknown;
|
15
|
-
readonly rawBody?: string;
|
16
|
-
readonly query?: ParsedUrlQuery;
|
17
|
-
readonly querystring?: string;
|
18
|
-
readonly url?: string;
|
19
|
-
readonly ip?: string;
|
20
|
-
readonly requestID?: string;
|
21
|
-
}
|
22
|
-
export interface DBOSContext {
|
23
|
-
readonly request: HTTPRequest;
|
24
|
-
readonly workflowUUID: string;
|
25
|
-
readonly authenticatedUser: string;
|
26
|
-
readonly authenticatedRoles: string[];
|
27
|
-
readonly assumedRole: string;
|
28
|
-
readonly logger: DBOSLogger;
|
29
|
-
readonly span: Span;
|
30
|
-
getConfig<T>(key: string): T | undefined;
|
31
|
-
getConfig<T>(key: string, defaultValue: T): T;
|
32
|
-
}
|
33
|
-
export declare class DBOSContextImpl implements DBOSContext {
|
34
|
-
readonly operationName: string;
|
35
|
-
readonly span: Span;
|
36
|
-
request: HTTPRequest;
|
37
|
-
authenticatedUser: string;
|
38
|
-
authenticatedRoles: string[];
|
39
|
-
assumedRole: string;
|
40
|
-
workflowUUID: string;
|
41
|
-
executorID: string;
|
42
|
-
readonly logger: DBOSLogger;
|
43
|
-
constructor(operationName: string, span: Span, logger: Logger, parentCtx?: DBOSContextImpl);
|
44
|
-
/*** Application configuration ***/
|
45
|
-
applicationConfig?: any;
|
46
|
-
getConfig<T>(key: string): T | undefined;
|
47
|
-
getConfig<T>(key: string, defaultValue: T): T;
|
48
|
-
}
|
49
|
-
/**
|
50
|
-
* TODO : move logger and application, getConfig to a BaseContext which is at the root of all contexts
|
51
|
-
*/
|
52
|
-
export declare class InitContext {
|
53
|
-
readonly dbosExec: DBOSExecutor;
|
54
|
-
readonly logger: Logger;
|
55
|
-
private userDatabase;
|
56
|
-
private application;
|
57
|
-
constructor(dbosExec: DBOSExecutor);
|
58
|
-
createUserSchema(): Promise<void>;
|
59
|
-
dropUserSchema(): Promise<void>;
|
60
|
-
queryUserDB<R>(sql: string, ...params: unknown[]): Promise<R[]>;
|
61
|
-
getConfig<T>(key: string): T | undefined;
|
62
|
-
getConfig<T>(key: string, defaultValue: T): T;
|
63
|
-
}
|
64
|
-
//# sourceMappingURL=context.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/context.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,MAAM,WAAW,WAAW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M,EAAE,CAAM;IAClC,WAAW,EAAE,MAAM,CAAM;IACzB,YAAY,EAAE,MAAM,CAAM;IAC1B,UAAU,EAAE,MAAM,CAAW;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;gBAEP,aAAa,EAAE,MAAM,EAAW,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,eAAe;IAY5G,mCAAmC;IAEnC,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IACxC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC;CAmB9C;AAGD;;GAEG;AACH,qBAAa,WAAW;IASV,QAAQ,CAAC,QAAQ,EAAE,YAAY;IAP3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO,CAAC,WAAW,CAAM;gBAEJ,QAAQ,EAAE,YAAY;IAO3C,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAK/D,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IACxC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC;CAmB9C"}
|
@@ -1,96 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InitContext = exports.DBOSContextImpl = void 0;
|
4
|
-
const logs_1 = require("./telemetry/logs");
|
5
|
-
const lodash_1 = require("lodash");
|
6
|
-
const error_1 = require("./error");
|
7
|
-
class DBOSContextImpl {
|
8
|
-
operationName;
|
9
|
-
span;
|
10
|
-
request = {}; // Raw incoming HTTP request.
|
11
|
-
authenticatedUser = ""; // The user that has been authenticated
|
12
|
-
authenticatedRoles = []; // All roles the user has according to authentication
|
13
|
-
assumedRole = ""; // Role in use - that user has and provided authorization to current function
|
14
|
-
workflowUUID = ""; // Workflow UUID. Empty for HandlerContexts.
|
15
|
-
executorID = "local"; // Executor ID. Gathered from request headers and "local" otherwise
|
16
|
-
logger; // Wrapper around the global logger for this context.
|
17
|
-
constructor(operationName, span, logger, parentCtx) {
|
18
|
-
this.operationName = operationName;
|
19
|
-
this.span = span;
|
20
|
-
if (parentCtx) {
|
21
|
-
this.request = parentCtx.request;
|
22
|
-
this.authenticatedUser = parentCtx.authenticatedUser;
|
23
|
-
this.authenticatedRoles = parentCtx.authenticatedRoles;
|
24
|
-
this.assumedRole = parentCtx.assumedRole;
|
25
|
-
this.workflowUUID = parentCtx.workflowUUID;
|
26
|
-
this.executorID = parentCtx.executorID;
|
27
|
-
}
|
28
|
-
this.logger = new logs_1.Logger(logger, this);
|
29
|
-
}
|
30
|
-
/*** Application configuration ***/
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
32
|
-
applicationConfig;
|
33
|
-
getConfig(key, defaultValue) {
|
34
|
-
// If there is no application config at all, or the key is missing, return the default value or undefined.
|
35
|
-
if (!this.applicationConfig || !(0, lodash_1.has)(this.applicationConfig, key)) {
|
36
|
-
if (defaultValue) {
|
37
|
-
return defaultValue;
|
38
|
-
}
|
39
|
-
return undefined;
|
40
|
-
}
|
41
|
-
// If the key is found and the default value is provided, check whether the value is of the same type.
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
43
|
-
const value = (0, lodash_1.get)(this.applicationConfig, key);
|
44
|
-
if (defaultValue && typeof value !== typeof defaultValue) {
|
45
|
-
throw new error_1.DBOSConfigKeyTypeError(key, typeof defaultValue, typeof value);
|
46
|
-
}
|
47
|
-
return value;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
exports.DBOSContextImpl = DBOSContextImpl;
|
51
|
-
/**
|
52
|
-
* TODO : move logger and application, getConfig to a BaseContext which is at the root of all contexts
|
53
|
-
*/
|
54
|
-
class InitContext {
|
55
|
-
dbosExec;
|
56
|
-
logger;
|
57
|
-
// All private Not exposed
|
58
|
-
userDatabase;
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
60
|
-
application;
|
61
|
-
constructor(dbosExec) {
|
62
|
-
this.dbosExec = dbosExec;
|
63
|
-
this.logger = dbosExec.logger;
|
64
|
-
this.userDatabase = dbosExec.userDatabase;
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
66
|
-
this.application = dbosExec.config.application;
|
67
|
-
}
|
68
|
-
createUserSchema() {
|
69
|
-
return this.userDatabase.createSchema();
|
70
|
-
}
|
71
|
-
dropUserSchema() {
|
72
|
-
return this.userDatabase.dropSchema();
|
73
|
-
}
|
74
|
-
queryUserDB(sql, ...params) {
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
76
|
-
return this.userDatabase.query(sql, ...params);
|
77
|
-
}
|
78
|
-
getConfig(key, defaultValue) {
|
79
|
-
// If there is no application config at all, or the key is missing, return the default value or undefined.
|
80
|
-
if (!this.application || !(0, lodash_1.has)(this.application, key)) {
|
81
|
-
if (defaultValue) {
|
82
|
-
return defaultValue;
|
83
|
-
}
|
84
|
-
return undefined;
|
85
|
-
}
|
86
|
-
// If the key is found and the default value is provided, check whether the value is of the same type.
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
88
|
-
const value = (0, lodash_1.get)(this.dbosExec.config.application, key);
|
89
|
-
if (defaultValue && typeof value !== typeof defaultValue) {
|
90
|
-
throw new error_1.DBOSConfigKeyTypeError(key, typeof defaultValue, typeof value);
|
91
|
-
}
|
92
|
-
return value;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
exports.InitContext = InitContext;
|
96
|
-
//# sourceMappingURL=context.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/context.ts"],"names":[],"mappings":";;;AACA,2CAAgF;AAChF,mCAAkC;AAKlC,mCAAiD;AA8BjD,MAAa,eAAe;IASL;IAAgC;IARrD,OAAO,GAAgB,EAAE,CAAC,CAAU,6BAA6B;IACjE,iBAAiB,GAAW,EAAE,CAAC,CAAK,uCAAuC;IAC3E,kBAAkB,GAAa,EAAE,CAAC,CAAE,qDAAqD;IACzF,WAAW,GAAW,EAAE,CAAC,CAAW,6EAA6E;IACjH,YAAY,GAAW,EAAE,CAAC,CAAU,4CAA4C;IAChF,UAAU,GAAW,OAAO,CAAC,CAAO,mEAAmE;IAC9F,MAAM,CAAa,CAAM,qDAAqD;IAEvF,YAAqB,aAAqB,EAAW,IAAU,EAAE,MAAc,EAAE,SAA2B;QAAvF,kBAAa,GAAb,aAAa,CAAQ;QAAW,SAAI,GAAJ,IAAI,CAAM;QAC7D,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;YACjC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;YACrD,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC,kBAAkB,CAAC;YACvD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;YACzC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;YAC3C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,aAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,mCAAmC;IACnC,8DAA8D;IAC9D,iBAAiB,CAAO;IAGxB,SAAS,CAAI,GAAW,EAAE,YAAgB;QACxC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AAM,CAAC,CAAC;IACjD,CAAC;IAID,SAAS,CAAI,GAAW,EAAE,YAAgB;QACxC,0GAA0G;QAC1G,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAA,YAAG,EAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;YACrD,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,YAAY,CAAC;YACtB,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,sGAAsG;QACtG,mEAAmE;QACnE,MAAM,KAAK,GAAG,IAAA,YAAG,EAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACzD,IAAI,YAAY,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzD,MAAM,IAAI,8BAAsB,CAAC,GAAG,EAAE,OAAO,YAAY,EAAE,OAAO,KAAK,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO,KAAU,CAAC;IACpB,CAAC;CACF;AAjDD,kCAiDC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"data_validation.d.ts","sourceRoot":"","sources":["../../../../src/data_validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAsB,MAAM,cAAc,CAAC;AAI1E,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,IAAI,QA4KrG"}
|
@@ -1,168 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.validateMethodArgs = void 0;
|
4
|
-
const decorators_1 = require("./decorators");
|
5
|
-
const error_1 = require("./error");
|
6
|
-
function validateMethodArgs(methReg, args) {
|
7
|
-
let opCtx = undefined;
|
8
|
-
const validationError = (msg) => {
|
9
|
-
const err = new error_1.DBOSDataValidationError(msg);
|
10
|
-
opCtx?.span.addEvent("DataValidationError", { message: err.message });
|
11
|
-
return err;
|
12
|
-
};
|
13
|
-
// Input validation
|
14
|
-
methReg.args.forEach((argDescriptor, idx) => {
|
15
|
-
if (idx === 0) {
|
16
|
-
// Context, may find a more robust way.
|
17
|
-
opCtx = args[idx];
|
18
|
-
return;
|
19
|
-
}
|
20
|
-
// Do we have an arg at all
|
21
|
-
if (idx >= args.length) {
|
22
|
-
if (argDescriptor.required === decorators_1.ArgRequiredOptions.REQUIRED ||
|
23
|
-
argDescriptor.required === decorators_1.ArgRequiredOptions.DEFAULT && methReg.defaults?.defaultArgRequired === decorators_1.ArgRequiredOptions.REQUIRED) {
|
24
|
-
throw validationError(`Insufficient number of arguments calling ${methReg.name} - ${args.length}/${methReg.args.length}`);
|
25
|
-
}
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
let argValue = args[idx];
|
29
|
-
// So... there is such a thing as "undefined", and another thing called "null"
|
30
|
-
// We will fold this to "undefined" for our APIs. It's just a rule of ours.
|
31
|
-
if (argValue === null) {
|
32
|
-
argValue = undefined;
|
33
|
-
args[idx] = undefined;
|
34
|
-
}
|
35
|
-
if (argValue === undefined && (argDescriptor.required === decorators_1.ArgRequiredOptions.REQUIRED ||
|
36
|
-
(argDescriptor.required === decorators_1.ArgRequiredOptions.DEFAULT && methReg.defaults?.defaultArgRequired === decorators_1.ArgRequiredOptions.REQUIRED))) {
|
37
|
-
throw validationError(`Missing required argument ${argDescriptor.name} of ${methReg.name}`);
|
38
|
-
}
|
39
|
-
if (argValue === undefined) {
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
if (argValue instanceof String) {
|
43
|
-
argValue = argValue.toString();
|
44
|
-
args[idx] = argValue;
|
45
|
-
}
|
46
|
-
if (argValue instanceof Boolean) {
|
47
|
-
argValue = argValue.valueOf();
|
48
|
-
args[idx] = argValue;
|
49
|
-
}
|
50
|
-
if (argValue instanceof Number) {
|
51
|
-
argValue = argValue.valueOf();
|
52
|
-
args[idx] = argValue;
|
53
|
-
}
|
54
|
-
if (argValue instanceof BigInt) { // ES2020+
|
55
|
-
argValue = argValue.valueOf();
|
56
|
-
args[idx] = argValue;
|
57
|
-
}
|
58
|
-
// Maybe look into https://www.npmjs.com/package/validator
|
59
|
-
// We could support emails and other validations too with something like that...
|
60
|
-
if (argDescriptor.dataType.dataType === 'text' || argDescriptor.dataType.dataType === 'varchar') {
|
61
|
-
if ((typeof argValue !== 'string')) {
|
62
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and should be a string`);
|
63
|
-
}
|
64
|
-
if (argDescriptor.dataType.length > 0) {
|
65
|
-
if (argValue.length > argDescriptor.dataType.length) {
|
66
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' with maximum length ${argDescriptor.dataType.length} but has length ${argValue.length}`);
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
if (argDescriptor.dataType.dataType === 'boolean') {
|
71
|
-
if (typeof argValue !== 'boolean') {
|
72
|
-
if (typeof argValue == 'number') {
|
73
|
-
if (argValue === 0 || argValue === 1) {
|
74
|
-
argValue = (argValue != 0 ? true : false);
|
75
|
-
args[idx] = argValue;
|
76
|
-
}
|
77
|
-
else {
|
78
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and may be a number (0 or 1) convertible to boolean, but was ${argValue}.`);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
else if (typeof argValue == 'string') {
|
82
|
-
if (argValue.toLowerCase() === 't' || argValue.toLowerCase() === 'true' || argValue === '1') {
|
83
|
-
argValue = true;
|
84
|
-
args[idx] = argValue;
|
85
|
-
}
|
86
|
-
else if (argValue.toLowerCase() === 'f' || argValue.toLowerCase() === 'false' || argValue === '0') {
|
87
|
-
argValue = false;
|
88
|
-
args[idx] = argValue;
|
89
|
-
}
|
90
|
-
else {
|
91
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and may be a string convertible to boolean, but was ${argValue}.`);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
else {
|
95
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and should be a boolean`);
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}
|
99
|
-
if (argDescriptor.dataType.dataType === 'decimal') {
|
100
|
-
// Range check precision and scale... wishing there was a bigdecimal
|
101
|
-
// Floats don't really permit us to check the scale.
|
102
|
-
if (typeof argValue !== 'number') {
|
103
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and should be a number`);
|
104
|
-
}
|
105
|
-
let prec = argDescriptor.dataType.precision;
|
106
|
-
if (prec > 0) {
|
107
|
-
if (argDescriptor.dataType.scale > 0) {
|
108
|
-
prec = prec - argDescriptor.dataType.scale;
|
109
|
-
}
|
110
|
-
if (Math.abs(argValue) >= Math.exp(prec)) {
|
111
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is out of range for type '${argDescriptor.dataType.formatAsString()}`);
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
if (argDescriptor.dataType.dataType === 'double' || argDescriptor.dataType.dataType === 'integer') {
|
116
|
-
if (typeof argValue !== 'number') {
|
117
|
-
if (typeof argValue === 'string') {
|
118
|
-
const n = parseFloat(argValue);
|
119
|
-
if (isNaN(n)) {
|
120
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and should be a number`);
|
121
|
-
}
|
122
|
-
argValue = n;
|
123
|
-
args[idx] = argValue;
|
124
|
-
}
|
125
|
-
else if (typeof argValue === 'bigint') {
|
126
|
-
// Hum, maybe we should allow bigint as a type, number won't even do 64-bit.
|
127
|
-
argValue = Number(argValue).valueOf();
|
128
|
-
args[idx] = argValue;
|
129
|
-
}
|
130
|
-
else {
|
131
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' and should be a number`);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
if (argDescriptor.dataType.dataType === 'integer') {
|
135
|
-
if (!Number.isInteger(argValue)) {
|
136
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' but has a fractional part`);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
if (argDescriptor.dataType.dataType === 'timestamp') {
|
141
|
-
if (!(argValue instanceof Date)) {
|
142
|
-
if (typeof argValue == 'string') {
|
143
|
-
const d = Date.parse(argValue);
|
144
|
-
if (isNaN(d)) {
|
145
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' but is a string that will not parse as Date`);
|
146
|
-
}
|
147
|
-
argValue = new Date(d);
|
148
|
-
args[idx] = argValue;
|
149
|
-
}
|
150
|
-
else {
|
151
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' but is not a date or time`);
|
152
|
-
}
|
153
|
-
}
|
154
|
-
}
|
155
|
-
if (argDescriptor.dataType.dataType === 'uuid') {
|
156
|
-
// This validation is loose. A tighter one would be:
|
157
|
-
// /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/
|
158
|
-
// That matches UUID version 1-5.
|
159
|
-
if (!/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(String(argValue))) {
|
160
|
-
throw validationError(`Argument ${argDescriptor.name} of ${methReg.name} is marked as type '${argDescriptor.dataType.dataType}' but is not a valid UUID`);
|
161
|
-
}
|
162
|
-
}
|
163
|
-
// JSON can be anything. We can validate it against a schema at some later version...
|
164
|
-
});
|
165
|
-
return args;
|
166
|
-
}
|
167
|
-
exports.validateMethodArgs = validateMethodArgs;
|
168
|
-
//# sourceMappingURL=data_validation.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"data_validation.js","sourceRoot":"","sources":["../../../../src/data_validation.ts"],"names":[],"mappings":";;;AAAA,6CAA0E;AAE1E,mCAAkD;AAElD,SAAgB,kBAAkB,CAAyB,OAA+B,EAAE,IAAU;IAElG,IAAI,KAAK,GAAiC,SAAS,CAAC;IAEpD,MAAM,eAAe,GAAG,CAAC,GAAU,EAAE,EAAE;QACnC,MAAM,GAAG,GAAG,IAAI,+BAAuB,CAAC,GAAG,CAAC,CAAC;QAC7C,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACtE,OAAO,GAAG,CAAC;IACf,CAAC,CAAA;IAED,mBAAmB;IACnB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE;QACxC,IAAI,GAAG,KAAK,CAAC,EACb,CAAC;YACC,uCAAuC;YACvC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAoB,CAAC;YACrC,OAAO;QACT,CAAC;QAED,2BAA2B;QAC3B,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACvB,IAAI,aAAa,CAAC,QAAQ,KAAK,+BAAkB,CAAC,QAAQ;gBACvD,aAAa,CAAC,QAAQ,KAAK,+BAAkB,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,kBAAkB,KAAK,+BAAkB,CAAC,QAAQ,EAChI,CAAC;gBACC,MAAM,eAAe,CAAC,4CAA4C,OAAO,CAAC,IAAI,MAAM,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC5H,CAAC;YACD,OAAO;QACT,CAAC;QAED,IAAI,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AAC,IAAI,OAAO,OAAO,CAAC,IAAI,uBAAuB,aAAa,CAAC,QAAQ,CAAC,QAAQ,6BAA6B,CAAC,CAAC;gBAC9J,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,aAAa,CAAC,QAAQ,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YAC/C,qDAAqD;YACrD,+FAA+F;YAC/F,iCAAiC;YACjC,IAAI,CAAC,+EAA+E,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;gBAC5G,MAAM,eAAe,CAAC,YAAY,aAAa,CAAC,IAAI,OAAO,OAAO,CAAC,IAAI,uBAAuB,aAAa,CAAC,QAAQ,CAAC,QAAQ,2BAA2B,CAAC,CAAC;YAC5J,CAAC;QACH,CAAC;QACD,sFAAsF;IAC1F,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AAChB,CAAC;AA5KD,gDA4KC"}
|
@@ -1,102 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { Workflow, WorkflowConfig, WorkflowHandle, WorkflowParams, BufferedResult } from './workflow';
|
3
|
-
import { Transaction, TransactionConfig } from './transaction';
|
4
|
-
import { CommunicatorConfig, Communicator } from './communicator';
|
5
|
-
import { TelemetryCollector } from './telemetry/collector';
|
6
|
-
import { Tracer } from './telemetry/traces';
|
7
|
-
import { GlobalLogger as Logger } from './telemetry/logs';
|
8
|
-
import { TelemetryConfig } from './telemetry';
|
9
|
-
import { PoolConfig } from 'pg';
|
10
|
-
import { SystemDatabase } from './system_database';
|
11
|
-
import { UserDatabase, UserDatabaseName } from './user_database';
|
12
|
-
import { MethodRegistrationBase } from './decorators';
|
13
|
-
export interface DBOSNull {
|
14
|
-
}
|
15
|
-
export declare const dbosNull: DBOSNull;
|
16
|
-
export declare const DBOSExecutorIDHeader = "dbos-executor-id";
|
17
|
-
export interface DBOSConfig {
|
18
|
-
readonly poolConfig: PoolConfig;
|
19
|
-
readonly userDbclient?: UserDatabaseName;
|
20
|
-
readonly telemetry?: TelemetryConfig;
|
21
|
-
readonly system_database: string;
|
22
|
-
readonly observability_database?: string;
|
23
|
-
readonly application?: any;
|
24
|
-
readonly dbClientMetadata?: any;
|
25
|
-
readonly debugProxy?: string;
|
26
|
-
}
|
27
|
-
interface WorkflowInfo {
|
28
|
-
workflow: Workflow<any, any>;
|
29
|
-
config: WorkflowConfig;
|
30
|
-
}
|
31
|
-
interface TransactionInfo {
|
32
|
-
transaction: Transaction<any, any>;
|
33
|
-
config: TransactionConfig;
|
34
|
-
}
|
35
|
-
interface CommunicatorInfo {
|
36
|
-
communicator: Communicator<any, any>;
|
37
|
-
config: CommunicatorConfig;
|
38
|
-
}
|
39
|
-
export declare const OperationType: {
|
40
|
-
readonly HANDLER: "handler";
|
41
|
-
readonly WORKFLOW: "workflow";
|
42
|
-
readonly TRANSACTION: "transaction";
|
43
|
-
readonly COMMUNICATOR: "communicator";
|
44
|
-
};
|
45
|
-
export declare class DBOSExecutor {
|
46
|
-
#private;
|
47
|
-
readonly config: DBOSConfig;
|
48
|
-
initialized: boolean;
|
49
|
-
userDatabase: UserDatabase;
|
50
|
-
readonly systemDatabase: SystemDatabase;
|
51
|
-
static readonly tempWorkflowName = "temp_workflow";
|
52
|
-
readonly workflowInfoMap: Map<string, WorkflowInfo>;
|
53
|
-
readonly transactionInfoMap: Map<string, TransactionInfo>;
|
54
|
-
readonly communicatorInfoMap: Map<string, CommunicatorInfo>;
|
55
|
-
readonly registeredOperations: Array<MethodRegistrationBase>;
|
56
|
-
readonly pendingWorkflowMap: Map<string, Promise<unknown>>;
|
57
|
-
readonly workflowResultBuffer: Map<string, Map<number, BufferedResult>>;
|
58
|
-
readonly telemetryCollector: TelemetryCollector;
|
59
|
-
readonly flushBufferIntervalMs: number;
|
60
|
-
readonly flushBufferID: NodeJS.Timeout;
|
61
|
-
static readonly defaultNotificationTimeoutSec = 60;
|
62
|
-
readonly debugMode: boolean;
|
63
|
-
static systemDBSchemaName: string;
|
64
|
-
readonly logger: Logger;
|
65
|
-
readonly tracer: Tracer;
|
66
|
-
entities: Function[];
|
67
|
-
constructor(config: DBOSConfig, systemDatabase?: SystemDatabase);
|
68
|
-
configureDbClient(): void;
|
69
|
-
init(...classes: object[]): Promise<void>;
|
70
|
-
destroy(): Promise<void>;
|
71
|
-
workflow<T extends any[], R>(wf: Workflow<T, R>, params: WorkflowParams, ...args: T): Promise<WorkflowHandle<R>>;
|
72
|
-
internalWorkflow<T extends any[], R>(wf: Workflow<T, R>, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
|
73
|
-
/**
|
74
|
-
* DEBUG MODE workflow execution, skipping all the recording
|
75
|
-
*/
|
76
|
-
debugWorkflow<T extends any[], R>(wf: Workflow<T, R>, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
|
77
|
-
transaction<T extends any[], R>(txn: Transaction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
|
78
|
-
external<T extends any[], R>(commFn: Communicator<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
|
79
|
-
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
80
|
-
/**
|
81
|
-
* Wait for a workflow to emit an event, then return its value.
|
82
|
-
*/
|
83
|
-
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
84
|
-
/**
|
85
|
-
* Retrieve a handle for a workflow UUID.
|
86
|
-
*/
|
87
|
-
retrieveWorkflow<R>(workflowUUID: string): WorkflowHandle<R>;
|
88
|
-
/**
|
89
|
-
* A recovery process that by default runs during executor init time.
|
90
|
-
* It runs to completion all pending workflows that were executing when the previous executor failed.
|
91
|
-
*/
|
92
|
-
recoverPendingWorkflows(executorIDs?: string[]): Promise<WorkflowHandle<any>[]>;
|
93
|
-
executeWorkflowUUID(workflowUUID: string): Promise<WorkflowHandle<unknown>>;
|
94
|
-
/**
|
95
|
-
* Periodically flush the workflow output buffer to the system database.
|
96
|
-
*/
|
97
|
-
flushWorkflowBuffers(): Promise<void>;
|
98
|
-
flushWorkflowResultBuffer(): Promise<void>;
|
99
|
-
logRegisteredHTTPUrls(): void;
|
100
|
-
}
|
101
|
-
export {};
|
102
|
-
//# sourceMappingURL=dbos-executor.d.ts.map
|