@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,171 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DBOSDebuggerError = exports.DBOSConfigKeyTypeError = exports.DBOSUndefinedDecoratorInputError = exports.DBOSNotAuthorizedError = exports.DBOSResponseError = exports.DuplicateWorkflowEventError = exports.DBOSDataValidationError = exports.DBOSPostgresExporterError = exports.DBOSNotRegisteredError = exports.DBOSWorkflowConflictUUIDError = exports.DBOSTopicPermissionDeniedError = exports.DBOSInitializationError = exports.DBOSWorkflowPermissionDeniedError = exports.DBOSError = exports.isClientError = void 0;
|
4
|
-
const pg_1 = require("pg");
|
5
|
-
function formatPgDatabaseError(err) {
|
6
|
-
let msg = "";
|
7
|
-
if (err.severity) {
|
8
|
-
msg = msg.concat(`severity: ${err.severity} \n`);
|
9
|
-
}
|
10
|
-
if (err.code) {
|
11
|
-
msg = msg.concat(`code: ${err.code} \n`);
|
12
|
-
}
|
13
|
-
if (err.detail) {
|
14
|
-
msg = msg.concat(`detail: ${err.detail} \n`);
|
15
|
-
}
|
16
|
-
if (err.hint) {
|
17
|
-
msg = msg.concat(`hint: ${err.hint} \n`);
|
18
|
-
}
|
19
|
-
if (err.position) {
|
20
|
-
msg = msg.concat(`position: ${err.position} \n`);
|
21
|
-
}
|
22
|
-
if (err.internalPosition) {
|
23
|
-
msg = msg.concat(`internalPosition: ${err.internalPosition} \n`);
|
24
|
-
}
|
25
|
-
if (err.internalQuery) {
|
26
|
-
msg = msg.concat(`internalQuery: ${err.internalQuery} \n`);
|
27
|
-
}
|
28
|
-
if (err.where) {
|
29
|
-
msg = msg.concat(`where: ${err.where} \n`);
|
30
|
-
}
|
31
|
-
if (err.schema) {
|
32
|
-
msg = msg.concat(`schema: ${err.schema} \n`);
|
33
|
-
}
|
34
|
-
if (err.table) {
|
35
|
-
msg = msg.concat(`table: ${err.table} \n`);
|
36
|
-
}
|
37
|
-
if (err.column) {
|
38
|
-
msg = msg.concat(`column: ${err.column} \n`);
|
39
|
-
}
|
40
|
-
if (err.dataType) {
|
41
|
-
msg = msg.concat(`dataType: ${err.dataType} \n`);
|
42
|
-
}
|
43
|
-
if (err.constraint) {
|
44
|
-
msg = msg.concat(`constraint: ${err.constraint} \n`);
|
45
|
-
}
|
46
|
-
if (err.file) {
|
47
|
-
msg = msg.concat(`file: ${err.file} \n`);
|
48
|
-
}
|
49
|
-
if (err.line) {
|
50
|
-
msg = msg.concat(`line: ${err.line} \n`);
|
51
|
-
}
|
52
|
-
return msg;
|
53
|
-
}
|
54
|
-
// Return if the error is caused by client request or by server internal.
|
55
|
-
function isClientError(dbosErrorCode) {
|
56
|
-
return (dbosErrorCode === DataValidationError) || (dbosErrorCode === WorkflowPermissionDeniedError) || (dbosErrorCode === TopicPermissionDeniedError) || (dbosErrorCode === ConflictingUUIDError) || (dbosErrorCode === NotRegisteredError);
|
57
|
-
}
|
58
|
-
exports.isClientError = isClientError;
|
59
|
-
class DBOSError extends Error {
|
60
|
-
dbosErrorCode;
|
61
|
-
// TODO: define a better coding system.
|
62
|
-
constructor(msg, dbosErrorCode = 1) {
|
63
|
-
super(msg);
|
64
|
-
this.dbosErrorCode = dbosErrorCode;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
exports.DBOSError = DBOSError;
|
68
|
-
const WorkflowPermissionDeniedError = 2;
|
69
|
-
class DBOSWorkflowPermissionDeniedError extends DBOSError {
|
70
|
-
constructor(runAs, workflowName) {
|
71
|
-
const msg = `Subject ${runAs} does not have permission to run workflow ${workflowName}`;
|
72
|
-
super(msg, WorkflowPermissionDeniedError);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
exports.DBOSWorkflowPermissionDeniedError = DBOSWorkflowPermissionDeniedError;
|
76
|
-
const InitializationError = 3;
|
77
|
-
class DBOSInitializationError extends DBOSError {
|
78
|
-
constructor(msg) {
|
79
|
-
super(msg, InitializationError);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
exports.DBOSInitializationError = DBOSInitializationError;
|
83
|
-
const TopicPermissionDeniedError = 4;
|
84
|
-
class DBOSTopicPermissionDeniedError extends DBOSError {
|
85
|
-
constructor(destinationUUID, workflowUUID, functionID, runAs) {
|
86
|
-
const msg = `Subject ${runAs} does not have permission on destination UUID ${destinationUUID}.` + `(workflow UUID: ${workflowUUID}, function ID: ${functionID})`;
|
87
|
-
super(msg, TopicPermissionDeniedError);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
exports.DBOSTopicPermissionDeniedError = DBOSTopicPermissionDeniedError;
|
91
|
-
const ConflictingUUIDError = 5;
|
92
|
-
class DBOSWorkflowConflictUUIDError extends DBOSError {
|
93
|
-
constructor(workflowUUID) {
|
94
|
-
super(`Conflicting UUID ${workflowUUID}`, ConflictingUUIDError);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
exports.DBOSWorkflowConflictUUIDError = DBOSWorkflowConflictUUIDError;
|
98
|
-
const NotRegisteredError = 6;
|
99
|
-
class DBOSNotRegisteredError extends DBOSError {
|
100
|
-
constructor(name) {
|
101
|
-
const msg = `Operation (Name: ${name}) not registered`;
|
102
|
-
super(msg, NotRegisteredError);
|
103
|
-
}
|
104
|
-
}
|
105
|
-
exports.DBOSNotRegisteredError = DBOSNotRegisteredError;
|
106
|
-
const PostgresExporterError = 7;
|
107
|
-
class DBOSPostgresExporterError extends DBOSError {
|
108
|
-
constructor(err) {
|
109
|
-
let msg = `PostgresExporter error: ${err.message} \n`;
|
110
|
-
if (err instanceof pg_1.DatabaseError) {
|
111
|
-
msg = msg.concat(formatPgDatabaseError(err));
|
112
|
-
}
|
113
|
-
super(msg, PostgresExporterError);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
exports.DBOSPostgresExporterError = DBOSPostgresExporterError;
|
117
|
-
const DataValidationError = 9;
|
118
|
-
class DBOSDataValidationError extends DBOSError {
|
119
|
-
constructor(msg) {
|
120
|
-
super(msg, DataValidationError);
|
121
|
-
}
|
122
|
-
}
|
123
|
-
exports.DBOSDataValidationError = DBOSDataValidationError;
|
124
|
-
const DuplicateWorkflowEvent = 10;
|
125
|
-
class DuplicateWorkflowEventError extends DBOSError {
|
126
|
-
constructor(workflowUUID, key) {
|
127
|
-
super(`Workflow ${workflowUUID} has already emitted an event with key ${key}`, DuplicateWorkflowEvent);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
exports.DuplicateWorkflowEventError = DuplicateWorkflowEventError;
|
131
|
-
// This error is thrown by applications.
|
132
|
-
const ResponseError = 11;
|
133
|
-
class DBOSResponseError extends DBOSError {
|
134
|
-
status;
|
135
|
-
constructor(msg, status = 500) {
|
136
|
-
super(msg, ResponseError);
|
137
|
-
this.status = status;
|
138
|
-
}
|
139
|
-
}
|
140
|
-
exports.DBOSResponseError = DBOSResponseError;
|
141
|
-
const NotAuthorizedError = 12;
|
142
|
-
class DBOSNotAuthorizedError extends DBOSError {
|
143
|
-
status;
|
144
|
-
constructor(msg, status = 403) {
|
145
|
-
super(msg, NotAuthorizedError);
|
146
|
-
this.status = status;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
exports.DBOSNotAuthorizedError = DBOSNotAuthorizedError;
|
150
|
-
const UndefinedDecoratorInputError = 13;
|
151
|
-
class DBOSUndefinedDecoratorInputError extends DBOSError {
|
152
|
-
constructor(decoratorName) {
|
153
|
-
super(`${decoratorName} received undefined input. Possible circular dependency?`, UndefinedDecoratorInputError);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
exports.DBOSUndefinedDecoratorInputError = DBOSUndefinedDecoratorInputError;
|
157
|
-
const ConfigKeyTypeError = 14;
|
158
|
-
class DBOSConfigKeyTypeError extends DBOSError {
|
159
|
-
constructor(configKey, expectedType, actualType) {
|
160
|
-
super(`${configKey} should be of type ${expectedType}, but got ${actualType}`, ConfigKeyTypeError);
|
161
|
-
}
|
162
|
-
}
|
163
|
-
exports.DBOSConfigKeyTypeError = DBOSConfigKeyTypeError;
|
164
|
-
const DebuggerError = 15;
|
165
|
-
class DBOSDebuggerError extends DBOSError {
|
166
|
-
constructor(msg) {
|
167
|
-
super("DEBUGGER: " + msg, DebuggerError);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
exports.DBOSDebuggerError = DBOS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AM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAa,sBAAuB,SAAQ,SAAS;IACjB;IAAlC,YAAY,GAAW,EAAW,SAAiB,GAAG;QACpD,KAAK,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;QADC,WAAM,GAAN,MAAM,CAAc;IAEtD,CAAC;CACF;AAJD,wDAIC;AAED,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,MAAa,gCAAiC,SAAQ,SAAS;IAC7D,YAAY,aAAqB;QAC/B,KAAK,CAAC,GAAG,aAAa,0DAA0D,EAAE,4BAA4B,CAAC,CAAC;IAClH,CAAC;CACF;AAJD,4EAIC;AAED,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAa,sBAAuB,SAAQ,SAAS;IACnD,YAAY,SAAiB,EAAE,YAAoB,EAAE,UAAkB;QACrE,KAAK,CAAC,GAAG,SAAS,sBAAsB,YAAY,aAAa,UAAU,EAAE,EAAE,kBAAkB,CAAC,CAAC;IACrG,CAAC;CACF;AAJD,wDAIC;AAED,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAa,iBAAkB,SAAQ,SAAS;IAC9C,YAAY,GAAW;QACrB,KAAK,CAAC,YAAY,GAAG,GAAG,EAAE,aAAa,CAAC,CAAC;IAC3C,CAAC;CACF;AAJD,8CAIC"}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import { MethodRegistration, MethodParameter, MethodRegistrationBase } from "../decorators";
|
2
|
-
import { DBOSExecutor } from "../dbos-executor";
|
3
|
-
import { DBOSContext, DBOSContextImpl } from "../context";
|
4
|
-
import Koa from "koa";
|
5
|
-
import { TailParameters, WorkflowHandle, WorkflowContext, WFInvokeFuncs } from "../workflow";
|
6
|
-
import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
7
|
-
import { APITypes, ArgSources } from "./handlerTypes";
|
8
|
-
type WFFunc = (ctxt: WorkflowContext, ...args: any[]) => Promise<any>;
|
9
|
-
export type InvokeFuncs<T> = WFInvokeFuncs<T> & HandlerWfFuncs<T>;
|
10
|
-
type HandlerWfFuncs<T> = {
|
11
|
-
[P in keyof T as T[P] extends WFFunc ? P : never]: T[P] extends WFFunc ? (...args: TailParameters<T[P]>) => Promise<WorkflowHandle<Awaited<ReturnType<T[P]>>>> : never;
|
12
|
-
};
|
13
|
-
export interface HandlerContext extends DBOSContext {
|
14
|
-
readonly koaContext: Koa.Context;
|
15
|
-
invoke<T extends object>(targetClass: T, workflowUUID?: string): InvokeFuncs<T>;
|
16
|
-
retrieveWorkflow<R>(workflowUUID: string): WorkflowHandle<R>;
|
17
|
-
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
18
|
-
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
19
|
-
}
|
20
|
-
export declare const RequestIDHeader = "x-request-id";
|
21
|
-
export declare class HandlerContextImpl extends DBOSContextImpl implements HandlerContext {
|
22
|
-
#private;
|
23
|
-
readonly koaContext: Koa.Context;
|
24
|
-
readonly W3CTraceContextPropagator: W3CTraceContextPropagator;
|
25
|
-
constructor(dbosExec: DBOSExecutor, koaContext: Koa.Context);
|
26
|
-
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
27
|
-
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
28
|
-
retrieveWorkflow<R>(workflowUUID: string): WorkflowHandle<R>;
|
29
|
-
/**
|
30
|
-
* Generate a proxy object for the provided class that wraps direct calls (i.e. OpClass.someMethod(param))
|
31
|
-
* to use WorkflowContext.Transaction(OpClass.someMethod, param);
|
32
|
-
*/
|
33
|
-
invoke<T extends object>(object: T, workflowUUID?: string): InvokeFuncs<T>;
|
34
|
-
}
|
35
|
-
export interface HandlerRegistrationBase extends MethodRegistrationBase {
|
36
|
-
apiType: APITypes;
|
37
|
-
apiURL: string;
|
38
|
-
args: HandlerParameter[];
|
39
|
-
}
|
40
|
-
export declare class HandlerRegistration<This, Args extends unknown[], Return> extends MethodRegistration<This, Args, Return> {
|
41
|
-
apiType: APITypes;
|
42
|
-
apiURL: string;
|
43
|
-
args: HandlerParameter[];
|
44
|
-
constructor(origFunc: (this: This, ...args: Args) => Promise<Return>);
|
45
|
-
}
|
46
|
-
export declare class HandlerParameter extends MethodParameter {
|
47
|
-
argSource: ArgSources;
|
48
|
-
constructor(idx: number, at: Function);
|
49
|
-
}
|
50
|
-
export declare function GetApi(url: string): <This, Ctx extends DBOSContext, Args extends unknown[], Return>(target: object, propertyKey: string, inDescriptor: TypedPropertyDescriptor<(this: This, ctx: Ctx, ...args: Args) => Promise<Return>>) => TypedPropertyDescriptor<(this: This, ctx: Ctx, ...args: Args) => Promise<Return>>;
|
51
|
-
export declare function PostApi(url: string): <This, Ctx extends DBOSContext, Args extends unknown[], Return>(target: object, propertyKey: string, inDescriptor: TypedPropertyDescriptor<(this: This, ctx: Ctx, ...args: Args) => Promise<Return>>) => TypedPropertyDescriptor<(this: This, ctx: Ctx, ...args: Args) => Promise<Return>>;
|
52
|
-
export declare function ArgSource(source: ArgSources): (target: object, propertyKey: string | symbol, parameterIndex: number) => void;
|
53
|
-
export {};
|
54
|
-
//# sourceMappingURL=handler.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../src/httpServer/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAA8D,sBAAsB,EAA2B,MAAM,eAAe,CAAC;AACjL,OAAO,EAAE,YAAY,EAAuC,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAY,cAAc,EAAE,cAAc,EAAkB,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;A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,MAAM,CAAE,SAAQ,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;IACnH,OAAO,EAAE,QAAQ,CAAgB;IACjC,MAAM,EAAE,MAAM,CAAM;IAEpB,IAAI,EAAE,gBAAgB,EAAE,CAAM;gBAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC;CAGrE;AAED,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,SAAS,EAAE,UAAU,CAAsB;gBAG/B,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ;CAGtC;AAMD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,2EAEtB,MAAM,eACD,MAAM,wLAWtB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,2EAEvB,MAAM,eACD,MAAM,wLAWtB;AAMD,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,YACjB,MAAM,eAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,UAMtF"}
|
@@ -1,175 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ArgSource = exports.PostApi = exports.GetApi = exports.HandlerParameter = exports.HandlerRegistration = exports.HandlerContextImpl = exports.RequestIDHeader = void 0;
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
5
|
-
const decorators_1 = require("../decorators");
|
6
|
-
const dbos_executor_1 = require("../dbos-executor");
|
7
|
-
const context_1 = require("../context");
|
8
|
-
const core_1 = require("@opentelemetry/core");
|
9
|
-
const api_1 = require("@opentelemetry/api");
|
10
|
-
const uuid_1 = require("uuid");
|
11
|
-
const handlerTypes_1 = require("./handlerTypes");
|
12
|
-
exports.RequestIDHeader = "x-request-id";
|
13
|
-
function getOrGenerateRequestID(ctx) {
|
14
|
-
const reqID = ctx.get(exports.RequestIDHeader);
|
15
|
-
if (reqID) {
|
16
|
-
return reqID;
|
17
|
-
}
|
18
|
-
const newID = (0, uuid_1.v4)();
|
19
|
-
ctx.set(exports.RequestIDHeader, newID);
|
20
|
-
return newID;
|
21
|
-
}
|
22
|
-
class HandlerContextImpl extends context_1.DBOSContextImpl {
|
23
|
-
koaContext;
|
24
|
-
#dbosExec;
|
25
|
-
W3CTraceContextPropagator;
|
26
|
-
constructor(dbosExec, koaContext) {
|
27
|
-
// Retrieve or generate the request ID
|
28
|
-
const requestID = getOrGenerateRequestID(koaContext);
|
29
|
-
// If present, retrieve the trace context from the request
|
30
|
-
const httpTracer = new core_1.W3CTraceContextPropagator();
|
31
|
-
const extractedSpanContext = api_1.trace.getSpanContext(httpTracer.extract(api_1.ROOT_CONTEXT, koaContext.request.headers, api_1.defaultTextMapGetter));
|
32
|
-
let span;
|
33
|
-
const spanAttributes = {
|
34
|
-
operationType: dbos_executor_1.OperationType.HANDLER,
|
35
|
-
requestID: requestID,
|
36
|
-
requestIP: koaContext.request.ip,
|
37
|
-
requestURL: koaContext.request.url,
|
38
|
-
requestMethod: koaContext.request.method,
|
39
|
-
};
|
40
|
-
if (extractedSpanContext === undefined) {
|
41
|
-
span = dbosExec.tracer.startSpan(koaContext.url, spanAttributes);
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
extractedSpanContext.isRemote = true;
|
45
|
-
span = dbosExec.tracer.startSpanWithContext(extractedSpanContext, koaContext.url, spanAttributes);
|
46
|
-
}
|
47
|
-
super(koaContext.url, span, dbosExec.logger);
|
48
|
-
this.koaContext = koaContext;
|
49
|
-
if (koaContext.request.headers && koaContext.request.headers[dbos_executor_1.DBOSExecutorIDHeader]) {
|
50
|
-
this.executorID = koaContext.request.headers[dbos_executor_1.DBOSExecutorIDHeader];
|
51
|
-
}
|
52
|
-
this.W3CTraceContextPropagator = httpTracer;
|
53
|
-
this.request = {
|
54
|
-
headers: koaContext.request.headers,
|
55
|
-
rawHeaders: koaContext.req.rawHeaders,
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
57
|
-
params: koaContext.params,
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
59
|
-
body: koaContext.request.body,
|
60
|
-
rawBody: koaContext.request.rawBody,
|
61
|
-
query: koaContext.request.query,
|
62
|
-
querystring: koaContext.request.querystring,
|
63
|
-
url: koaContext.request.url,
|
64
|
-
ip: koaContext.request.ip,
|
65
|
-
requestID: requestID,
|
66
|
-
};
|
67
|
-
if (dbosExec.config.application) {
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
69
|
-
this.applicationConfig = dbosExec.config.application;
|
70
|
-
}
|
71
|
-
this.#dbosExec = dbosExec;
|
72
|
-
}
|
73
|
-
///////////////////////
|
74
|
-
/* PUBLIC INTERFACE */
|
75
|
-
///////////////////////
|
76
|
-
async send(destinationUUID, message, topic, idempotencyKey) {
|
77
|
-
return this.#dbosExec.send(destinationUUID, message, topic, idempotencyKey);
|
78
|
-
}
|
79
|
-
async getEvent(workflowUUID, key, timeoutSeconds = dbos_executor_1.DBOSExecutor.defaultNotificationTimeoutSec) {
|
80
|
-
return this.#dbosExec.getEvent(workflowUUID, key, timeoutSeconds);
|
81
|
-
}
|
82
|
-
retrieveWorkflow(workflowUUID) {
|
83
|
-
return this.#dbosExec.retrieveWorkflow(workflowUUID);
|
84
|
-
}
|
85
|
-
/**
|
86
|
-
* Generate a proxy object for the provided class that wraps direct calls (i.e. OpClass.someMethod(param))
|
87
|
-
* to use WorkflowContext.Transaction(OpClass.someMethod, param);
|
88
|
-
*/
|
89
|
-
invoke(object, workflowUUID) {
|
90
|
-
const ops = (0, decorators_1.getRegisteredOperations)(object);
|
91
|
-
const proxy = {};
|
92
|
-
const params = { workflowUUID: workflowUUID, parentCtx: this };
|
93
|
-
for (const op of ops) {
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
95
|
-
proxy[op.name] = op.txnConfig
|
96
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
97
|
-
? (...args) => this.#transaction(op.registeredFunction, params, ...args)
|
98
|
-
: op.workflowConfig
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
100
|
-
? (...args) => this.#workflow(op.registeredFunction, params, ...args)
|
101
|
-
: op.commConfig
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
103
|
-
? (...args) => this.#external(op.registeredFunction, params, ...args)
|
104
|
-
: undefined;
|
105
|
-
}
|
106
|
-
return proxy;
|
107
|
-
}
|
108
|
-
//////////////////////
|
109
|
-
/* PRIVATE METHODS */
|
110
|
-
/////////////////////
|
111
|
-
async #workflow(wf, params, ...args) {
|
112
|
-
return this.#dbosExec.workflow(wf, params, ...args);
|
113
|
-
}
|
114
|
-
async #transaction(txn, params, ...args) {
|
115
|
-
return this.#dbosExec.transaction(txn, params, ...args);
|
116
|
-
}
|
117
|
-
async #external(commFn, params, ...args) {
|
118
|
-
return this.#dbosExec.external(commFn, params, ...args);
|
119
|
-
}
|
120
|
-
}
|
121
|
-
exports.HandlerContextImpl = HandlerContextImpl;
|
122
|
-
class HandlerRegistration extends decorators_1.MethodRegistration {
|
123
|
-
apiType = handlerTypes_1.APITypes.GET;
|
124
|
-
apiURL = "";
|
125
|
-
args = [];
|
126
|
-
constructor(origFunc) {
|
127
|
-
super(origFunc);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
exports.HandlerRegistration = HandlerRegistration;
|
131
|
-
class HandlerParameter extends decorators_1.MethodParameter {
|
132
|
-
argSource = handlerTypes_1.ArgSources.DEFAULT;
|
133
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
134
|
-
constructor(idx, at) {
|
135
|
-
super(idx, at);
|
136
|
-
}
|
137
|
-
}
|
138
|
-
exports.HandlerParameter = HandlerParameter;
|
139
|
-
/////////////////////////
|
140
|
-
/* ENDPOINT DECORATORS */
|
141
|
-
/////////////////////////
|
142
|
-
function GetApi(url) {
|
143
|
-
function apidec(target, propertyKey, inDescriptor) {
|
144
|
-
const { descriptor, registration } = (0, decorators_1.registerAndWrapFunction)(target, propertyKey, inDescriptor);
|
145
|
-
const handlerRegistration = registration;
|
146
|
-
handlerRegistration.apiURL = url;
|
147
|
-
handlerRegistration.apiType = handlerTypes_1.APITypes.GET;
|
148
|
-
return descriptor;
|
149
|
-
}
|
150
|
-
return apidec;
|
151
|
-
}
|
152
|
-
exports.GetApi = GetApi;
|
153
|
-
function PostApi(url) {
|
154
|
-
function apidec(target, propertyKey, inDescriptor) {
|
155
|
-
const { descriptor, registration } = (0, decorators_1.registerAndWrapFunction)(target, propertyKey, inDescriptor);
|
156
|
-
const handlerRegistration = registration;
|
157
|
-
handlerRegistration.apiURL = url;
|
158
|
-
handlerRegistration.apiType = handlerTypes_1.APITypes.POST;
|
159
|
-
return descriptor;
|
160
|
-
}
|
161
|
-
return apidec;
|
162
|
-
}
|
163
|
-
exports.PostApi = PostApi;
|
164
|
-
///////////////////////////////////
|
165
|
-
/* ENDPOINT PARAMETER DECORATORS */
|
166
|
-
///////////////////////////////////
|
167
|
-
function ArgSource(source) {
|
168
|
-
return function (target, propertyKey, parameterIndex) {
|
169
|
-
const existingParameters = (0, decorators_1.getOrCreateMethodArgsRegistration)(target, propertyKey);
|
170
|
-
const curParam = existingParameters[parameterIndex];
|
171
|
-
curParam.argSource = source;
|
172
|
-
};
|
173
|
-
}
|
174
|
-
exports.ArgSource = ArgSource;
|
175
|
-
//# sourceMappingURL=handler.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../../src/httpServer/handler.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,8CAAiL;AACjL,oDAAqF;AACrF,wCAA0D;AAI1D,8CAAgE;AAChE,4CAA+E;AAE/E,+BAAoC;AAEpC,iDAAsD;AAkBzC,QAAA,eAAe,GAAG,cAAc,CAAC;AAC9C,SAAS,sBAAsB,CAAC,GAAgB;IAC9C,MAAM,KAAK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0,0 @@
|
|
1
|
-
{"version":3,"file":"handlerTypes.d.ts","sourceRoot":"","sources":["../../../../../src/httpServer/handlerTypes.ts"],"names":[],"mappings":"AAKA,oBAAY,QAAQ;IAClB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AACD,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ"}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
//////////////////////////
|
3
|
-
/* REGISTRATION OBJECTS */
|
4
|
-
//////////////////////////
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.ArgSources = exports.APITypes = void 0;
|
7
|
-
var APITypes;
|
8
|
-
(function (APITypes) {
|
9
|
-
APITypes["GET"] = "GET";
|
10
|
-
APITypes["POST"] = "POST";
|
11
|
-
})(APITypes || (exports.APITypes = APITypes = {}));
|
12
|
-
var ArgSources;
|
13
|
-
(function (ArgSources) {
|
14
|
-
ArgSources["DEFAULT"] = "DEFAULT";
|
15
|
-
ArgSources["BODY"] = "BODY";
|
16
|
-
ArgSources["QUERY"] = "QUERY";
|
17
|
-
ArgSources["URL"] = "URL";
|
18
|
-
})(ArgSources || (exports.ArgSources = ArgSources = {}));
|
19
|
-
//# sourceMappingURL=handlerTypes.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"handlerTypes.js","sourceRoot":"","sources":["../../../../../src/httpServer/handlerTypes.ts"],"names":[],"mappings":";AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,0BAA0B;;;AAE1B,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,yBAAa,CAAA;AACf,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AACD,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,yBAAW,CAAA;AACb,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB"}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
import Koa from "koa";
|
2
|
-
import { ClassRegistration, RegistrationDefaults } from "../decorators";
|
3
|
-
import { UserDatabaseClient } from "../user_database";
|
4
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
5
|
-
import { Logger as DBOSLogger } from "../telemetry/logs";
|
6
|
-
import { OpenAPIV3 as OpenApi3 } from 'openapi-types';
|
7
|
-
export interface MiddlewareContext {
|
8
|
-
readonly koaContext: Koa.Context;
|
9
|
-
readonly name: string;
|
10
|
-
readonly requiredRole: string[];
|
11
|
-
readonly logger: DBOSLogger;
|
12
|
-
readonly span: Span;
|
13
|
-
getConfig<T>(key: string, deflt: T | undefined): T | undefined;
|
14
|
-
query<C extends UserDatabaseClient, R, T extends unknown[]>(qry: (dbclient: C, ...args: T) => Promise<R>, ...args: T): Promise<R>;
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* Authentication middleware that executes before a request reaches a function.
|
18
|
-
* This is expected to:
|
19
|
-
* - Validate the request found in the handler context and extract auth information from the request.
|
20
|
-
* - Map the HTTP request to the user identity and roles defined in app.
|
21
|
-
* If this succeeds, return the current authenticated user and a list of roles.
|
22
|
-
* If any step fails, throw an error.
|
23
|
-
*/
|
24
|
-
export type DBOSHttpAuthMiddleware = (ctx: MiddlewareContext) => Promise<DBOSHttpAuthReturn | void>;
|
25
|
-
export interface DBOSHttpAuthReturn {
|
26
|
-
authenticatedUser: string;
|
27
|
-
authenticatedRoles: string[];
|
28
|
-
}
|
29
|
-
export interface MiddlewareDefaults extends RegistrationDefaults {
|
30
|
-
koaMiddlewares?: Koa.Middleware[];
|
31
|
-
authMiddleware?: DBOSHttpAuthMiddleware;
|
32
|
-
}
|
33
|
-
export declare class MiddlewareClassRegistration<CT extends {
|
34
|
-
new (...args: unknown[]): object;
|
35
|
-
}> extends ClassRegistration<CT> implements MiddlewareDefaults {
|
36
|
-
authMiddleware?: DBOSHttpAuthMiddleware;
|
37
|
-
koaMiddlewares?: Koa.Middleware[];
|
38
|
-
constructor(ctor: CT);
|
39
|
-
}
|
40
|
-
/**
|
41
|
-
* Define an authentication function for each endpoint in this class.
|
42
|
-
*/
|
43
|
-
export declare function Authentication(authMiddleware: DBOSHttpAuthMiddleware): <T extends new (...args: unknown[]) => object>(ctor: T) => void;
|
44
|
-
/**
|
45
|
-
* Define Koa middleware that is applied in order to each endpoint in this class.
|
46
|
-
*/
|
47
|
-
export declare function KoaMiddleware(...koaMiddleware: Koa.Middleware[]): <T extends new (...args: unknown[]) => object>(ctor: T) => void;
|
48
|
-
type SecurityScheme = Exclude<OpenApi3.SecuritySchemeObject, OpenApi3.OAuth2SecurityScheme>;
|
49
|
-
/**
|
50
|
-
* Declare an OpenApi Security Scheme (https://spec.openapis.org/oas/v3.0.3#security-scheme-object
|
51
|
-
* for the methods of a class. Note, this decorator is only used in OpenApi generation and does not
|
52
|
-
* affect runtime behavior of the app.
|
53
|
-
*/
|
54
|
-
export declare function OpenApiSecurityScheme(securityScheme: SecurityScheme): <T extends new (...args: unknown[]) => object>(_ctor: T) => void;
|
55
|
-
export {};
|
56
|
-
//# sourceMappingURL=middleware.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../../../src/httpServer/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAgC,MAAM,eAAe,CAAC;AAGtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGtD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC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I,EAAE,EAAE;CAGrB;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,sBAAsB,4BAI1B,OAAO,EAAE,KAAG,MAAM,mBAK5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,aAAa,EAAE,GAAG,CAAC,UAAU,EAAE,4BAMrB,OAAO,EAAE,KAAG,MAAM,mBAK5D;AAOD,KAAK,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAE5F;;;;GAIG;AAEH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,cAAc,4BACxB,OAAO,EAAE,KAAG,MAAM,oBAC7D"}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.OpenApiSecurityScheme = exports.KoaMiddleware = exports.Authentication = exports.MiddlewareClassRegistration = void 0;
|
4
|
-
const decorators_1 = require("../decorators");
|
5
|
-
const error_1 = require("../error");
|
6
|
-
class MiddlewareClassRegistration extends decorators_1.ClassRegistration {
|
7
|
-
authMiddleware;
|
8
|
-
koaMiddlewares;
|
9
|
-
constructor(ctor) {
|
10
|
-
super(ctor);
|
11
|
-
}
|
12
|
-
}
|
13
|
-
exports.MiddlewareClassRegistration = MiddlewareClassRegistration;
|
14
|
-
/////////////////////////////////
|
15
|
-
/* MIDDLEWARE CLASS DECORATORS */
|
16
|
-
/////////////////////////////////
|
17
|
-
/**
|
18
|
-
* Define an authentication function for each endpoint in this class.
|
19
|
-
*/
|
20
|
-
function Authentication(authMiddleware) {
|
21
|
-
if (authMiddleware === undefined) {
|
22
|
-
throw new error_1.DBOSUndefinedDecoratorInputError("Authentication");
|
23
|
-
}
|
24
|
-
function clsdec(ctor) {
|
25
|
-
const clsreg = (0, decorators_1.getOrCreateClassRegistration)(ctor);
|
26
|
-
clsreg.authMiddleware = authMiddleware;
|
27
|
-
}
|
28
|
-
return clsdec;
|
29
|
-
}
|
30
|
-
exports.Authentication = Authentication;
|
31
|
-
/**
|
32
|
-
* Define Koa middleware that is applied in order to each endpoint in this class.
|
33
|
-
*/
|
34
|
-
function KoaMiddleware(...koaMiddleware) {
|
35
|
-
koaMiddleware.forEach((i) => {
|
36
|
-
if (i === undefined) {
|
37
|
-
throw new error_1.DBOSUndefinedDecoratorInputError("KoaMiddleware");
|
38
|
-
}
|
39
|
-
});
|
40
|
-
function clsdec(ctor) {
|
41
|
-
const clsreg = (0, decorators_1.getOrCreateClassRegistration)(ctor);
|
42
|
-
clsreg.koaMiddlewares = koaMiddleware;
|
43
|
-
}
|
44
|
-
return clsdec;
|
45
|
-
}
|
46
|
-
exports.KoaMiddleware = KoaMiddleware;
|
47
|
-
/**
|
48
|
-
* Declare an OpenApi Security Scheme (https://spec.openapis.org/oas/v3.0.3#security-scheme-object
|
49
|
-
* for the methods of a class. Note, this decorator is only used in OpenApi generation and does not
|
50
|
-
* affect runtime behavior of the app.
|
51
|
-
*/
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
53
|
-
function OpenApiSecurityScheme(securityScheme) {
|
54
|
-
return function (_ctor) { };
|
55
|
-
}
|
56
|
-
exports.OpenApiSecurityScheme = OpenApiSecurityScheme;
|
57
|
-
//# sourceMappingURL=middleware.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../../../src/httpServer/middleware.ts"],"names":[],"mappings":";;;AACA,8CAAsG;AACtG,oCAA4D;AA2C5D,MAAa,2BAA4E,SAAQ,8BAAqB;IACpH,cAAc,CAA0B;IACxC,cAAc,CAAoB;IAElC,YAAY,IAAQ;QAClB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF;AAPD,kEAOC;AAED,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AAEjC;;GAEG;AACH,SAAgB,cAAc,CAAC,cAAsC;IACnE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,wCAAgC,CAAC,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IACD,SAAS,MAAM,CAAgD,IAAO;QACpE,MAAM,MAAM,GAAG,IAAA,yCAA4B,EAAC,IAAI,CAAmC,CAAC;QACpF,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,wCASC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,GAAG,aAA+B;IAC9D,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,wCAAgC,CAAC,eAAe,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;IACH,SAAS,MAAM,CAAgD,IAAO;QACpE,MAAM,MAAM,GAAG,IAAA,yCAA4B,EAAC,IAAI,CAAmC,CAAC;QACpF,MAAM,CAAC,cAAc,GAAG,aAAa,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,sCAWC;AASD;;;;GAIG;AACH,6DAA6D;AAC7D,SAAgB,qBAAqB,CAAC,cAA8B;IAClE,OAAO,UAAyD,KAAQ,IAAI,CAAC,CAAA;AAC/E,CAAC;AAFD,sDAEC"}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
/// <reference types="koa__router" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
/// <reference types="node/http" />
|
4
|
-
/// <reference types="@koa/bodyparser/dist/body-parser" />
|
5
|
-
import Koa from 'koa';
|
6
|
-
import Router from '@koa/router';
|
7
|
-
import { DBOSExecutor } from "../dbos-executor";
|
8
|
-
import { GlobalLogger as Logger } from "../telemetry/logs";
|
9
|
-
export declare const WorkflowUUIDHeader = "dbos-workflowuuid";
|
10
|
-
export declare const WorkflowRecoveryUrl = "/dbos-workflow-recovery";
|
11
|
-
export declare const HealthUrl = "/dbos-healthz";
|
12
|
-
export declare class DBOSHttpServer {
|
13
|
-
readonly dbosExec: DBOSExecutor;
|
14
|
-
readonly app: Koa;
|
15
|
-
readonly router: Router;
|
16
|
-
readonly logger: Logger;
|
17
|
-
/**
|
18
|
-
* Create a Koa app.
|
19
|
-
* @param dbosExec User pass in an DBOS workflow executor instance.
|
20
|
-
* TODO: maybe call dbosExec.init() somewhere in this class?
|
21
|
-
*/
|
22
|
-
constructor(dbosExec: DBOSExecutor, config?: {
|
23
|
-
koa?: Koa;
|
24
|
-
router?: Router;
|
25
|
-
});
|
26
|
-
/**
|
27
|
-
* Register HTTP endpoints and attach to the app. Then start the server at the given port.
|
28
|
-
* @param port
|
29
|
-
*/
|
30
|
-
listen(port: number): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
31
|
-
/**
|
32
|
-
* Health check endpoint.
|
33
|
-
*/
|
34
|
-
static registerHealthEndpoint(dbosExec: DBOSExecutor, router: Router): void;
|
35
|
-
/**
|
36
|
-
* Register workflow recovery endpoint.
|
37
|
-
* Receives a list of executor IDs and returns a list of workflowUUIDs.
|
38
|
-
*/
|
39
|
-
static registerRecoveryEndpoint(dbosExec: DBOSExecutor, router: Router): void;
|
40
|
-
/**
|
41
|
-
* Register decorated functions as HTTP endpoints.
|
42
|
-
*/
|
43
|
-
static registerDecoratedEndpoints(dbosExec: DBOSExecutor, router: Router): void;
|
44
|
-
}
|
45
|
-
//# sourceMappingURL=server.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../src/httpServer/server.ts"],"names":[],"mappings":";;;;AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,MAAM,MAAM,aAAa,CAAC;AAiBjC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAK3D,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,mBAAmB,4BAA4B,CAAA;AAC5D,eAAO,MAAM,SAAS,kBAAkB,CAAA;AAExC,qBAAa,cAAc;IAUb,QAAQ,CAAC,QAAQ,EAAE,YAAY;IAT3C,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;OAIG;gBACkB,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAE;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAwBxF;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM;IAOnB;;OAEG;IACD,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAWtE;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAmBtE;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;CA8KzE"}
|