@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,59 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TelemetryExporter = void 0;
|
4
|
-
const _1 = require("./");
|
5
|
-
const exporter_trace_otlp_proto_1 = require("@opentelemetry/exporter-trace-otlp-proto");
|
6
|
-
const exporter_logs_otlp_proto_1 = require("@opentelemetry/exporter-logs-otlp-proto");
|
7
|
-
const core_1 = require("@opentelemetry/core");
|
8
|
-
class TelemetryExporter {
|
9
|
-
tracesExporter;
|
10
|
-
logsExporter;
|
11
|
-
constructor(config) {
|
12
|
-
if (config.tracesEndpoint) {
|
13
|
-
this.tracesExporter = new exporter_trace_otlp_proto_1.OTLPTraceExporter({
|
14
|
-
url: config.tracesEndpoint,
|
15
|
-
});
|
16
|
-
console.log(`Traces will be exported to ${config.tracesEndpoint}`);
|
17
|
-
}
|
18
|
-
if (config.logsEndpoint) {
|
19
|
-
this.logsExporter = new exporter_logs_otlp_proto_1.OTLPLogExporter({
|
20
|
-
url: config.logsEndpoint,
|
21
|
-
});
|
22
|
-
console.log(`Logs will be exported to ${config.logsEndpoint}`);
|
23
|
-
}
|
24
|
-
}
|
25
|
-
async export(signals) {
|
26
|
-
return await new Promise((resolve) => {
|
27
|
-
// Sort out traces and logs
|
28
|
-
const exportSpans = [];
|
29
|
-
const exportLogs = [];
|
30
|
-
signals.forEach((signal) => {
|
31
|
-
if ((0, _1.isTraceSignal)(signal)) {
|
32
|
-
exportSpans.push(signal);
|
33
|
-
}
|
34
|
-
if ((0, _1.isLogSignal)(signal)) {
|
35
|
-
exportLogs.push(signal);
|
36
|
-
}
|
37
|
-
});
|
38
|
-
if (exportSpans.length > 0 && this.tracesExporter) {
|
39
|
-
this.tracesExporter.export(exportSpans, (results) => {
|
40
|
-
if (results.code !== core_1.ExportResultCode.SUCCESS) {
|
41
|
-
console.warn(`Trace export failed: ${results.code}`);
|
42
|
-
console.warn(results);
|
43
|
-
}
|
44
|
-
});
|
45
|
-
}
|
46
|
-
if (exportLogs.length > 0 && this.logsExporter) {
|
47
|
-
this.logsExporter.export(exportLogs, (results) => {
|
48
|
-
if (results.code !== core_1.ExportResultCode.SUCCESS) {
|
49
|
-
console.warn(`Log export failed: ${results.code}`);
|
50
|
-
console.warn(results);
|
51
|
-
}
|
52
|
-
});
|
53
|
-
}
|
54
|
-
resolve();
|
55
|
-
});
|
56
|
-
}
|
57
|
-
}
|
58
|
-
exports.TelemetryExporter = TelemetryExporter;
|
59
|
-
//# sourceMappingURL=exporters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"exporters.js","sourceRoot":"","sources":["../../../../../src/telemetry/exporters.ts"],"names":[],"mappings":";;;AACA,yBAAgD;AAChD,wFAA6E;AAC7E,sFAA0E;AAG1E,8CAAqE;AAWrE,MAAa,iBAAiB;IACX,cAAc,CAAqB;IACnC,YAAY,CAAmB;IAChD,YAAY,MAA0B;QACpC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,6CAAiB,CAAC;gBAC1C,GAAG,EAAE,MAAM,CAAC,cAAc;aAC3B,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,8BAA8B,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,IAAI,0CAAe,CAAC;gBACtC,GAAG,EAAE,MAAM,CAAC,YAAY;aACzB,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,4BAA4B,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAA0B;QACrC,OAAO,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACzC,2BAA2B;YAC3B,MAAM,WAAW,GAAmB,EAAE,CAAC;YACvC,MAAM,UAAU,GAAwB,EAAE,CAAC;YAC3C,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,IAAA,gBAAa,EAAC,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etry/sdk-trace-base";
|
4
|
-
import { LogRecord } from "@opentelemetry/api-logs";
|
5
|
-
export declare function isTraceSignal(signal: any): signal is Span;
|
6
|
-
export declare function isLogSignal(signal: any): signal is LogRecord;
|
7
|
-
export interface TelemetryConfig {
|
8
|
-
logs?: LoggerConfig;
|
9
|
-
OTLPExporter?: OTLPExporterConfig;
|
10
|
-
}
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,IAAI,CAIzD;AAGD,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,SAAS,CAI5D;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC"}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isLogSignal = exports.isTraceSignal = void 0;
|
4
|
-
// We could implement our own types and avoid having `any`, but this has likely little value
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6
|
-
function isTraceSignal(signal) {
|
7
|
-
// Span is an interface that has a property 'kind'
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
9
|
-
return signal && 'kind' in signal;
|
10
|
-
}
|
11
|
-
exports.isTraceSignal = isTraceSignal;
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
13
|
-
function isLogSignal(signal) {
|
14
|
-
// LogRecord is an interface that has a property 'severityText' and 'severityNumber'
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
16
|
-
return signal && 'severityText' in signal && 'severityNumber' in signal;
|
17
|
-
}
|
18
|
-
exports.isLogSignal = isLogSignal;
|
19
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/telemetry/index.ts"],"names":[],"mappings":";;;AAKA,4FAA4F;AAC5F,8DAA8D;AAC9D,SAAgB,aAAa,CAAC,MAAW;IACvC,kDAAkD;IAClD,+DAA+D;IAC/D,OAAO,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC;AACpC,CAAC;AAJD,sCAIC;AAED,8DAA8D;AAC9D,SAAgB,WAAW,CAAC,MAAW;IACrC,oFAAoF;IACpF,+DAA+D;IAC/D,OAAO,MAAM,IAAI,cAAc,IAAI,MAAM,IAAI,gBAAgB,IAAI,MAAM,CAAC;AAC1E,CAAC;AAJD,kCAIC"}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { Logger as IWinstonLogger } from "winston";
|
2
|
-
import { DBOSContextImpl } from "../context";
|
3
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
4
|
-
import { TelemetryCollector } from "./collector";
|
5
|
-
/*****************/
|
6
|
-
/*****************/
|
7
|
-
export interface LoggerConfig {
|
8
|
-
logLevel?: string;
|
9
|
-
silent?: boolean;
|
10
|
-
addContextMetadata?: boolean;
|
11
|
-
}
|
12
|
-
type ContextualMetadata = {
|
13
|
-
includeContextMetadata: boolean;
|
14
|
-
span: Span;
|
15
|
-
};
|
16
|
-
interface StackTrace {
|
17
|
-
stack?: string;
|
18
|
-
}
|
19
|
-
export interface IGlobalLogger extends IWinstonLogger {
|
20
|
-
readonly addContextMetadata: boolean;
|
21
|
-
readonly logger: IWinstonLogger;
|
22
|
-
readonly telemetryCollector: TelemetryCollector;
|
23
|
-
}
|
24
|
-
export declare class GlobalLogger {
|
25
|
-
private readonly telemetryCollector?;
|
26
|
-
private readonly logger;
|
27
|
-
readonly addContextMetadata: boolean;
|
28
|
-
constructor(telemetryCollector?: TelemetryCollector | undefined, config?: LoggerConfig);
|
29
|
-
info(logEntry: any, metadata?: ContextualMetadata): void;
|
30
|
-
debug(logEntry: any, metadata?: ContextualMetadata): void;
|
31
|
-
warn(logEntry: any, metadata?: ContextualMetadata): void;
|
32
|
-
error(inputError: any, metadata?: ContextualMetadata & StackTrace): void;
|
33
|
-
}
|
34
|
-
/******************/
|
35
|
-
/******************/
|
36
|
-
export declare class Logger {
|
37
|
-
private readonly globalLogger;
|
38
|
-
readonly ctx: DBOSContextImpl;
|
39
|
-
readonly metadata: ContextualMetadata;
|
40
|
-
constructor(globalLogger: GlobalLogger, ctx: DBOSContextImpl);
|
41
|
-
info(logEntry: any): void;
|
42
|
-
debug(logEntry: any): void;
|
43
|
-
warn(logEntry: any): void;
|
44
|
-
error(inputError: any): void;
|
45
|
-
}
|
46
|
-
export {};
|
47
|
-
//# sourceMappingURL=logs.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../../../src/telemetry/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,MAAM,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAGrF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,mBAAmB;AAEnB,mBAAmB;AAEnB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,KAAK,kBAAkB,GAA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QAAQ,EAAE,GAAG,GAAG,IAAI;IAUzB,KAAK,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;CAU7B"}
|
@@ -1,195 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Logger = exports.GlobalLogger = void 0;
|
4
|
-
const winston_1 = require("winston");
|
5
|
-
const TransportStream = require("winston-transport");
|
6
|
-
const applicationVersion_1 = require("../dbos-runtime/applicationVersion");
|
7
|
-
const api_logs_1 = require("@opentelemetry/api-logs");
|
8
|
-
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
9
|
-
class GlobalLogger {
|
10
|
-
telemetryCollector;
|
11
|
-
logger;
|
12
|
-
addContextMetadata;
|
13
|
-
constructor(telemetryCollector, config) {
|
14
|
-
this.telemetryCollector = telemetryCollector;
|
15
|
-
const winstonTransports = [];
|
16
|
-
winstonTransports.push(new winston_1.transports.Console({
|
17
|
-
format: consoleFormat,
|
18
|
-
level: config?.logLevel || "info",
|
19
|
-
silent: config?.silent || false,
|
20
|
-
}));
|
21
|
-
// Only enable the OTLP transport if we have a telemetry collector and an exporter
|
22
|
-
if (this.telemetryCollector?.exporter) {
|
23
|
-
winstonTransports.push(new OTLPLogQueueTransport(this.telemetryCollector));
|
24
|
-
}
|
25
|
-
this.logger = (0, winston_1.createLogger)({ transports: winstonTransports });
|
26
|
-
this.addContextMetadata = config?.addContextMetadata || false;
|
27
|
-
}
|
28
|
-
// We use this form of winston logging methods: `(message: string, ...meta: any[])`. See node_modules/winston/index.d.ts
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
-
info(logEntry, metadata) {
|
31
|
-
if (typeof logEntry === "string") {
|
32
|
-
this.logger.info(logEntry, metadata);
|
33
|
-
}
|
34
|
-
else {
|
35
|
-
this.logger.info(JSON.stringify(logEntry), metadata);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
39
|
-
debug(logEntry, metadata) {
|
40
|
-
if (typeof logEntry === "string") {
|
41
|
-
this.logger.debug(logEntry, metadata);
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
this.logger.debug(JSON.stringify(logEntry), metadata);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
48
|
-
warn(logEntry, metadata) {
|
49
|
-
if (typeof logEntry === "string") {
|
50
|
-
this.logger.warn(logEntry, metadata);
|
51
|
-
}
|
52
|
-
else {
|
53
|
-
this.logger.warn(JSON.stringify(logEntry), metadata);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
// metadata can have both ContextualMetadata and the error stack trace
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
58
|
-
error(inputError, metadata) {
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
60
|
-
this.logger.error(inputError, metadata);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
exports.GlobalLogger = GlobalLogger;
|
64
|
-
/******************/
|
65
|
-
/* CONTEXT LOGGER */
|
66
|
-
/******************/
|
67
|
-
// Wrapper around our global logger. Expected to be instantiated by a new contexts so they can inject contextual metadata
|
68
|
-
class Logger {
|
69
|
-
globalLogger;
|
70
|
-
ctx;
|
71
|
-
metadata;
|
72
|
-
constructor(globalLogger, ctx) {
|
73
|
-
this.globalLogger = globalLogger;
|
74
|
-
this.ctx = ctx;
|
75
|
-
this.metadata = {
|
76
|
-
span: ctx.span,
|
77
|
-
includeContextMetadata: this.globalLogger.addContextMetadata,
|
78
|
-
};
|
79
|
-
}
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
81
|
-
info(logEntry) {
|
82
|
-
if (typeof logEntry === "string") {
|
83
|
-
this.globalLogger.info(logEntry, this.metadata);
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
this.globalLogger.info(JSON.stringify(logEntry), this.metadata);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
90
|
-
debug(logEntry) {
|
91
|
-
if (typeof logEntry === "string") {
|
92
|
-
this.globalLogger.debug(logEntry, this.metadata);
|
93
|
-
}
|
94
|
-
else {
|
95
|
-
this.globalLogger.debug(JSON.stringify(logEntry), this.metadata);
|
96
|
-
}
|
97
|
-
}
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
99
|
-
warn(logEntry) {
|
100
|
-
if (typeof logEntry === "string") {
|
101
|
-
this.globalLogger.warn(logEntry, this.metadata);
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
this.globalLogger.warn(JSON.stringify(logEntry), this.metadata);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
// We give users the same interface (message: string argument) but create an error to get a stack trace
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
109
|
-
error(inputError) {
|
110
|
-
if (inputError instanceof Error) {
|
111
|
-
this.globalLogger.error(inputError.message, { ...this.metadata, stack: inputError.stack });
|
112
|
-
}
|
113
|
-
else if (typeof inputError === "string") {
|
114
|
-
this.globalLogger.error(inputError, { ...this.metadata, stack: new Error().stack });
|
115
|
-
}
|
116
|
-
else {
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
118
|
-
this.globalLogger.error(JSON.stringify(inputError), { ...this.metadata, stack: new Error().stack });
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
122
|
-
exports.Logger = Logger;
|
123
|
-
/***********************/
|
124
|
-
/* FORMAT & TRANSPORTS */
|
125
|
-
/***********************/
|
126
|
-
const consoleFormat = winston_1.format.combine(winston_1.format.errors({ stack: true }), winston_1.format.timestamp(), winston_1.format.colorize(), winston_1.format.printf((info) => {
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
128
|
-
const { timestamp, level, message, stack } = info;
|
129
|
-
const applicationVersion = (0, applicationVersion_1.getApplicationVersion)();
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
131
|
-
const ts = timestamp.slice(0, 19).replace("T", " ");
|
132
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
133
|
-
const formattedStack = stack?.split("\n").slice(1).join("\n");
|
134
|
-
const messageString = typeof message === "string" ? message : JSON.stringify(message);
|
135
|
-
const fullMessageString = `${messageString}${info.includeContextMetadata ? ` ${JSON.stringify(info.span?.attributes)}` : ""}`;
|
136
|
-
const versionString = applicationVersion ? ` [version ${applicationVersion}]` : "";
|
137
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
138
|
-
return `${ts}${versionString} [${level}]: ${fullMessageString} ${stack ? "\n" + formattedStack : ""}`;
|
139
|
-
}));
|
140
|
-
class OTLPLogQueueTransport extends TransportStream {
|
141
|
-
telemetryCollector;
|
142
|
-
name = "OTLPLogQueueTransport";
|
143
|
-
otelLogger;
|
144
|
-
applicationID;
|
145
|
-
executorID;
|
146
|
-
constructor(telemetryCollector) {
|
147
|
-
super();
|
148
|
-
this.telemetryCollector = telemetryCollector;
|
149
|
-
// not sure if we need a more explicit name here
|
150
|
-
const loggerProvider = new sdk_logs_1.LoggerProvider();
|
151
|
-
this.otelLogger = loggerProvider.getLogger("default");
|
152
|
-
this.applicationID = process.env.DBOS__APPID || process.env.APPID || "APP_ID_NOT_DEFINED"; // TODO: Remove APPID
|
153
|
-
this.executorID = process.env.DBOS__VMID || process.env.VMID || "VM_ID_NOT_DEFINED"; // TODO: Remove VMID
|
154
|
-
const logRecordProcessor = {
|
155
|
-
forceFlush: async () => {
|
156
|
-
// no-op
|
157
|
-
},
|
158
|
-
onEmit(logRecord) {
|
159
|
-
telemetryCollector.push(logRecord);
|
160
|
-
},
|
161
|
-
shutdown: async () => {
|
162
|
-
// no-op
|
163
|
-
},
|
164
|
-
};
|
165
|
-
loggerProvider.addLogRecordProcessor(logRecordProcessor);
|
166
|
-
}
|
167
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
168
|
-
log(info, callback) {
|
169
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
170
|
-
const { level, message, stack, span } = info;
|
171
|
-
const levelToSeverityNumber = {
|
172
|
-
error: api_logs_1.SeverityNumber.ERROR,
|
173
|
-
warn: api_logs_1.SeverityNumber.WARN,
|
174
|
-
info: api_logs_1.SeverityNumber.INFO,
|
175
|
-
debug: api_logs_1.SeverityNumber.DEBUG,
|
176
|
-
};
|
177
|
-
// Ideally we want to give the spanContext to the logRecord,
|
178
|
-
// But there seems to some dependency bugs in opentelemetry-js
|
179
|
-
// (span.getValue(SPAN_KEY) undefined when we pass the context, as commented bellow)
|
180
|
-
// So for now we get the traceId and spanId directly from the context and pass them through the logRecord attributes
|
181
|
-
this.otelLogger.emit({
|
182
|
-
severityNumber: levelToSeverityNumber[level],
|
183
|
-
severityText: level,
|
184
|
-
body: message,
|
185
|
-
timestamp: new Date().getTime(), // So far I don't see a major difference between this and observedTimestamp
|
186
|
-
observedTimestamp: new Date().getTime(),
|
187
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
188
|
-
attributes: { ...span?.attributes, traceId: span?.spanContext()?.traceId, spanId: span?.spanContext()?.spanId, stack, applicationID: this.applicationID, executorID: this.executorID },
|
189
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
190
|
-
// context: span?.spanContext() || undefined,
|
191
|
-
});
|
192
|
-
callback();
|
193
|
-
}
|
194
|
-
}
|
195
|
-
//# sourceMappingURL=logs.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../../../src/telemetry/logs.ts"],"names":[],"mappings":";;;AA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|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
2
|
-
import { Attributes, SpanContext } from "@opentelemetry/api";
|
3
|
-
import { TelemetryCollector } from "./collector";
|
4
|
-
export declare class Tracer {
|
5
|
-
private readonly telemetryCollector;
|
6
|
-
private readonly tracer;
|
7
|
-
readonly applicationID: string;
|
8
|
-
readonly executorID: string;
|
9
|
-
constructor(telemetryCollector: TelemetryCollector);
|
10
|
-
startSpanWithContext(spanContext: SpanContext, name: string, attributes?: Attributes): Span;
|
11
|
-
startSpan(name: string, attributes?: Attributes, parentSpan?: Span): Span;
|
12
|
-
endSpan(span: Span): void;
|
13
|
-
}
|
14
|
-
//# sourceMappingURL=traces.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../../../../src/telemetry/traces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAsB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,MAAM;IAIL,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAH/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBACC,kBAAkB,EAAE,kBAAkB;IAWnE,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IAM3F,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI;IAUzE,OAAO,CAAC,IAAI,EAAE,IAAI;CAQnB"}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Tracer = void 0;
|
7
|
-
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
8
|
-
const resources_1 = require("@opentelemetry/resources");
|
9
|
-
const api_1 = __importDefault(require("@opentelemetry/api"));
|
10
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
11
|
-
class Tracer {
|
12
|
-
telemetryCollector;
|
13
|
-
tracer;
|
14
|
-
applicationID;
|
15
|
-
executorID;
|
16
|
-
constructor(telemetryCollector) {
|
17
|
-
this.telemetryCollector = telemetryCollector;
|
18
|
-
this.tracer = new sdk_trace_base_1.BasicTracerProvider({
|
19
|
-
resource: new resources_1.Resource({
|
20
|
-
[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: "dbos",
|
21
|
-
}),
|
22
|
-
});
|
23
|
-
this.tracer.register();
|
24
|
-
this.applicationID = process.env.DBOS__APPID || process.env.APPID || "APP_ID_NOT_DEFINED"; // TODO: Remove APPID
|
25
|
-
this.executorID = process.env.DBOS__VMID || process.env.VMID || "VM_ID_NOT_DEFINED"; // TODO: Remove VMID
|
26
|
-
}
|
27
|
-
startSpanWithContext(spanContext, name, attributes) {
|
28
|
-
const tracer = api_1.default.trace.getTracer("dbos-tracer");
|
29
|
-
const ctx = api_1.default.trace.setSpanContext(api_1.default.context.active(), spanContext);
|
30
|
-
return tracer.startSpan(name, { startTime: Date.now(), attributes: attributes }, ctx);
|
31
|
-
}
|
32
|
-
startSpan(name, attributes, parentSpan) {
|
33
|
-
const tracer = api_1.default.trace.getTracer("dbos-tracer");
|
34
|
-
if (parentSpan) {
|
35
|
-
const ctx = api_1.default.trace.setSpan(api_1.default.context.active(), parentSpan);
|
36
|
-
return tracer.startSpan(name, { startTime: Date.now(), attributes: attributes }, ctx);
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
return tracer.startSpan(name, { attributes: attributes });
|
40
|
-
}
|
41
|
-
}
|
42
|
-
endSpan(span) {
|
43
|
-
span.end(Date.now());
|
44
|
-
span.attributes.applicationID = this.applicationID;
|
45
|
-
if (!("executorID" in span.attributes)) {
|
46
|
-
span.attributes.executorID = this.executorID;
|
47
|
-
}
|
48
|
-
this.telemetryCollector.push(span);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
exports.Tracer = Tracer;
|
52
|
-
//# sourceMappingURL=traces.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"traces.js","sourceRoot":"","sources":["../../../../../src/telemetry/traces.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwF;AACxF,wDAAoD;AACpD,6DAA4E;AAC5E,8EAAiF;AAGjF,MAAa,MAAM;IAIY;IAHZ,MAAM,CAAsB;IACpC,aAAa,CAAS;IACtB,UAAU,CAAS;IAC5B,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACjE,IAAI,CAAC,MAAM,GAAG,IAAI,oCAAmB,CAAC;YACpC,QAAQ,EAAE,IAAI,oBAAQ,CAAC;gBACrB,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,MAAM;aAClD,CAAC;SACH,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAK,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,oBAAoB,CAAC,CAAC,qBAAqB;QACjH,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,mBAAmB,CAAC,CAAC,oBAAoB;IAC3G,CAAC;IAED,oBAAoB,CAAC,WAAwB,EAAE,IAAY,EAAE,UAAuB;QAClF,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK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CAAC,CAAC;IACrD,CAAC;CACF;AAvCD,wBAuCC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { UserDatabaseName, UserDatabaseClient } from "./user_database";
|
2
|
-
import { WorkflowContextImpl } from "./workflow";
|
3
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
4
|
-
import { DBOSContext, DBOSContextImpl } from "./context";
|
5
|
-
import { ValuesOf } from "./utils";
|
6
|
-
import { GlobalLogger as Logger } from "./telemetry/logs";
|
7
|
-
import { WorkflowContextDebug } from "./debugger/debug_workflow";
|
8
|
-
export type Transaction<T extends any[], R> = (ctxt: TransactionContext<any>, ...args: T) => Promise<R>;
|
9
|
-
export interface TransactionConfig {
|
10
|
-
isolationLevel?: IsolationLevel;
|
11
|
-
readOnly?: boolean;
|
12
|
-
}
|
13
|
-
export declare const IsolationLevel: {
|
14
|
-
readonly ReadUncommitted: "READ UNCOMMITTED";
|
15
|
-
readonly ReadCommitted: "READ COMMITTED";
|
16
|
-
readonly RepeatableRead: "REPEATABLE READ";
|
17
|
-
readonly Serializable: "SERIALIZABLE";
|
18
|
-
};
|
19
|
-
export type IsolationLevel = ValuesOf<typeof IsolationLevel>;
|
20
|
-
export interface TransactionContext<T extends UserDatabaseClient> extends DBOSContext {
|
21
|
-
readonly client: T;
|
22
|
-
}
|
23
|
-
export declare class TransactionContextImpl<T extends UserDatabaseClient> extends DBOSContextImpl implements TransactionContext<T> {
|
24
|
-
readonly clientKind: UserDatabaseName;
|
25
|
-
readonly client: T;
|
26
|
-
readonly functionID: number;
|
27
|
-
constructor(clientKind: UserDatabaseName, client: T, workflowContext: WorkflowContextImpl | WorkflowContextDebug, span: Span, logger: Logger, functionID: number, operationName: string);
|
28
|
-
}
|
29
|
-
//# sourceMappingURL=transaction.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE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AE,MAAM,EACL,UAAU,EAAE,MAAM,EAC3B,aAAa,EAAE,MAAM;CAQxB"}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TransactionContextImpl = exports.IsolationLevel = void 0;
|
4
|
-
const context_1 = require("./context");
|
5
|
-
exports.IsolationLevel = {
|
6
|
-
ReadUncommitted: "READ UNCOMMITTED",
|
7
|
-
ReadCommitted: "READ COMMITTED",
|
8
|
-
RepeatableRead: "REPEATABLE READ",
|
9
|
-
Serializable: "SERIALIZABLE",
|
10
|
-
};
|
11
|
-
class TransactionContextImpl extends context_1.DBOSContextImpl {
|
12
|
-
clientKind;
|
13
|
-
client;
|
14
|
-
functionID;
|
15
|
-
constructor(clientKind, client, workflowContext, span, logger, functionID, operationName) {
|
16
|
-
super(operationName, span, logger, workflowContext);
|
17
|
-
this.clientKind = clientKind;
|
18
|
-
this.client = client;
|
19
|
-
this.functionID = functionID;
|
20
|
-
if (workflowContext.applicationConfig) {
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
22
|
-
this.applicationConfig = workflowContext.applicationConfig;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
exports.TransactionContextImpl = TransactionContextImpl;
|
27
|
-
//# sourceMappingURL=transaction.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../../src/transaction.ts"],"names":[],"mappings":";;;AAIA,uCAAyD;AAa5C,QAAA,cAAc,GAAG;IAC5B,eAAe,EAAE,kBAAkB;IACnC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,YAAY,EAAE,cAAc;CACpB,CAAC;AAOX,MAAa,sBAAqD,SAAQ,yBAAe;IAE5E;IACA;IAIA;IANX,YACW,UAA4B,EAC5B,MAAS,EAClB,eAA2D,EAC3D,IAAU,EACV,MAAc,EACL,UAAkB,EAC3B,aAAqB;QAErB,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAR3C,eAAU,GAAV,UAAU,CAAkB;QAC5B,WAAM,GAAN,MAAM,CAAG;QAIT,eAAU,GAAV,UAAU,CAAQ;QAI3B,IAAI,eAAe,CAAC,iBAAiB,EAAE,CAAC;YACtC,mEAAmE;YACnE,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;QAC7D,CAAC;IACH,CAAC;CACF;AAhBD,wDAgBC"}
|
@@ -1,132 +0,0 @@
|
|
1
|
-
import { Pool, PoolConfig, PoolClient } from "pg";
|
2
|
-
import { IsolationLevel, TransactionConfig } from "./transaction";
|
3
|
-
import { ValuesOf } from "./utils";
|
4
|
-
import { Knex } from "knex";
|
5
|
-
export interface UserDatabase {
|
6
|
-
init(debugMode?: boolean): Promise<void>;
|
7
|
-
destroy(): Promise<void>;
|
8
|
-
getName(): UserDatabaseName;
|
9
|
-
transaction<R, T extends unknown[]>(transactionFunction: UserDatabaseTransaction<R, T>, config: TransactionConfig, ...args: T): Promise<R>;
|
10
|
-
queryFunction<C extends UserDatabaseClient, R, T extends unknown[]>(queryFunction: UserDatabaseQuery<C, R, T>, ...params: T): Promise<R>;
|
11
|
-
query<R, T extends unknown[]>(sql: string, ...params: T): Promise<R[]>;
|
12
|
-
queryWithClient<R, T extends unknown[] = unknown[]>(client: UserDatabaseClient, sql: string, ...params: T): Promise<R[]>;
|
13
|
-
isRetriableTransactionError(error: unknown): boolean;
|
14
|
-
isKeyConflictError(error: unknown): boolean;
|
15
|
-
createSchema(): Promise<void>;
|
16
|
-
dropSchema(): Promise<void>;
|
17
|
-
}
|
18
|
-
type UserDatabaseQuery<C extends UserDatabaseClient, R, T extends unknown[]> = (ctxt: C, ...args: T) => Promise<R>;
|
19
|
-
type UserDatabaseTransaction<R, T extends unknown[]> = (ctxt: UserDatabaseClient, ...args: T) => Promise<R>;
|
20
|
-
export type UserDatabaseClient = PoolClient | PrismaClient | TypeORMEntityManager | Knex;
|
21
|
-
export declare const UserDatabaseName: {
|
22
|
-
readonly PGNODE: "pg-node";
|
23
|
-
readonly PRISMA: "prisma";
|
24
|
-
readonly TYPEORM: "typeorm";
|
25
|
-
readonly KNEX: "knex";
|
26
|
-
};
|
27
|
-
export type UserDatabaseName = ValuesOf<typeof UserDatabaseName>;
|
28
|
-
/**
|
29
|
-
* node-postgres user data access interface
|
30
|
-
*/
|
31
|
-
export declare class PGNodeUserDatabase implements UserDatabase {
|
32
|
-
readonly poolConfig: PoolConfig;
|
33
|
-
readonly pool: Pool;
|
34
|
-
constructor(poolConfig: PoolConfig);
|
35
|
-
init(debugMode?: boolean): Promise<void>;
|
36
|
-
destroy(): Promise<void>;
|
37
|
-
getName(): "pg-node";
|
38
|
-
transaction<R, T extends unknown[]>(txn: UserDatabaseTransaction<R, T>, config: TransactionConfig, ...args: T): Promise<R>;
|
39
|
-
queryFunction<C extends UserDatabaseClient, R, T extends unknown[]>(func: UserDatabaseQuery<C, R, T>, ...args: T): Promise<R>;
|
40
|
-
query<R, T extends unknown[]>(sql: string, ...params: T): Promise<R[]>;
|
41
|
-
queryWithClient<R, T extends unknown[]>(client: UserDatabaseClient, sql: string, ...params: T): Promise<R[]>;
|
42
|
-
getPostgresErrorCode(error: unknown): string | null;
|
43
|
-
isRetriableTransactionError(error: unknown): boolean;
|
44
|
-
isKeyConflictError(error: unknown): boolean;
|
45
|
-
createSchema(): Promise<void>;
|
46
|
-
dropSchema(): Promise<void>;
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
* Prisma user data access interface
|
50
|
-
*/
|
51
|
-
export interface PrismaClient {
|
52
|
-
$queryRawUnsafe<R, T extends unknown[]>(query: string, ...params: T): Promise<R[]>;
|
53
|
-
$transaction<R>(fn: (prisma: unknown) => Promise<R>, options?: {
|
54
|
-
maxWait?: number;
|
55
|
-
timeout?: number;
|
56
|
-
isolationLevel?: unknown;
|
57
|
-
}): Promise<R>;
|
58
|
-
$disconnect(): Promise<void>;
|
59
|
-
}
|
60
|
-
export declare class PrismaUserDatabase implements UserDatabase {
|
61
|
-
readonly prisma: PrismaClient;
|
62
|
-
constructor(prisma: PrismaClient);
|
63
|
-
init(debugMode?: boolean): Promise<void>;
|
64
|
-
destroy(): Promise<void>;
|
65
|
-
getName(): "prisma";
|
66
|
-
transaction<R, T extends unknown[]>(transaction: UserDatabaseTransaction<R, T>, config: TransactionConfig, ...args: T): Promise<R>;
|
67
|
-
queryFunction<C extends UserDatabaseClient, R, T extends unknown[]>(func: UserDatabaseQuery<C, R, T>, ...args: T): Promise<R>;
|
68
|
-
query<R, T extends unknown[]>(sql: string, ...params: T): Promise<R[]>;
|
69
|
-
queryWithClient<R, T extends unknown[]>(client: UserDatabaseClient, sql: string, ...params: T): Promise<R[]>;
|
70
|
-
getPostgresErrorCode(error: unknown): string | null;
|
71
|
-
isRetriableTransactionError(error: unknown): boolean;
|
72
|
-
isKeyConflictError(error: unknown): boolean;
|
73
|
-
createSchema(): Promise<void>;
|
74
|
-
dropSchema(): Promise<void>;
|
75
|
-
}
|
76
|
-
export interface TypeORMDataSource {
|
77
|
-
readonly isInitialized: boolean;
|
78
|
-
readonly manager: TypeORMEntityManager;
|
79
|
-
initialize(): Promise<this>;
|
80
|
-
query<R = unknown>(query: string): Promise<R>;
|
81
|
-
destroy(): Promise<void>;
|
82
|
-
synchronize(): Promise<void>;
|
83
|
-
dropDatabase(): Promise<void>;
|
84
|
-
}
|
85
|
-
export interface TypeORMEntityManager {
|
86
|
-
query<R, T extends unknown[]>(query: string, parameters?: T): Promise<R>;
|
87
|
-
transaction<R>(isolationLevel: IsolationLevel, runinTransaction: (entityManager: TypeORMEntityManager) => Promise<R>): Promise<R>;
|
88
|
-
}
|
89
|
-
export interface QueryFailedError<T> {
|
90
|
-
driverError: T;
|
91
|
-
}
|
92
|
-
/**
|
93
|
-
* TypeORM user data access interface
|
94
|
-
*/
|
95
|
-
export declare class TypeORMDatabase implements UserDatabase {
|
96
|
-
readonly ds: TypeORMDataSource;
|
97
|
-
readonly dataSource: TypeORMDataSource;
|
98
|
-
constructor(ds: TypeORMDataSource);
|
99
|
-
init(debugMode?: boolean): Promise<void>;
|
100
|
-
destroy(): Promise<void>;
|
101
|
-
getName(): "typeorm";
|
102
|
-
transaction<R, T extends unknown[]>(txn: UserDatabaseTransaction<R, T>, config: TransactionConfig, ...args: T): Promise<R>;
|
103
|
-
queryFunction<C extends UserDatabaseClient, R, T extends unknown[]>(func: UserDatabaseQuery<C, R, T>, ...args: T): Promise<R>;
|
104
|
-
query<R>(sql: string, ...params: unknown[]): Promise<R[]>;
|
105
|
-
queryWithClient<R, T extends unknown[]>(client: UserDatabaseClient, sql: string, ...params: T): Promise<R[]>;
|
106
|
-
getPostgresErrorCode(error: unknown): string | null;
|
107
|
-
isRetriableTransactionError(error: unknown): boolean;
|
108
|
-
isKeyConflictError(error: unknown): boolean;
|
109
|
-
createSchema(): Promise<void>;
|
110
|
-
dropSchema(): Promise<void>;
|
111
|
-
}
|
112
|
-
/**
|
113
|
-
* Knex user data access interface
|
114
|
-
*/
|
115
|
-
export declare class KnexUserDatabase implements UserDatabase {
|
116
|
-
readonly knex: Knex;
|
117
|
-
constructor(knex: Knex);
|
118
|
-
init(debugMode?: boolean): Promise<void>;
|
119
|
-
destroy(): Promise<void>;
|
120
|
-
getName(): "knex";
|
121
|
-
transaction<R, T extends unknown[]>(transactionFunction: UserDatabaseTransaction<R, T>, config: TransactionConfig, ...args: T): Promise<R>;
|
122
|
-
queryFunction<C extends UserDatabaseClient, R, T extends unknown[]>(func: UserDatabaseQuery<C, R, T>, ...args: T): Promise<R>;
|
123
|
-
query<R, T extends unknown[]>(sql: string, ...params: T): Promise<R[]>;
|
124
|
-
queryWithClient<R, T extends unknown[]>(client: Knex, sql: string, ...uparams: T): Promise<R[]>;
|
125
|
-
getPostgresErrorCode(error: unknown): string | null;
|
126
|
-
isRetriableTransactionError(error: unknown): boolean;
|
127
|
-
isKeyConflictError(error: unknown): boolean;
|
128
|
-
createSchema(): Promise<void>;
|
129
|
-
dropSchema(): Promise<void>;
|
130
|
-
}
|
131
|
-
export {};
|
132
|
-
//# sourceMappingURL=user_database.d.ts.map
|