@dbos-inc/dbos-sdk 0.7.18-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dbos-config.schema.json +121 -0
- package/dbos-test-config.yaml +16 -0
- package/dist/schemas/system_db_schema.d.ts +34 -0
- package/dist/schemas/system_db_schema.d.ts.map +1 -0
- package/dist/schemas/system_db_schema.js +75 -0
- package/dist/schemas/system_db_schema.js.map +1 -0
- package/dist/schemas/user_db_schema.d.ts +11 -0
- package/dist/schemas/user_db_schema.d.ts.map +1 -0
- package/dist/schemas/user_db_schema.js +16 -0
- package/dist/schemas/user_db_schema.js.map +1 -0
- package/dist/src/cloud-cli/applications/configure.d.ts +2 -0
- package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/configure.js +57 -0
- package/dist/src/cloud-cli/applications/configure.js.map +1 -0
- package/dist/src/cloud-cli/applications/delete-app.d.ts +2 -0
- package/dist/src/cloud-cli/applications/delete-app.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/delete-app.js +36 -0
- package/dist/src/cloud-cli/applications/delete-app.js.map +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts +2 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.js +64 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -0
- package/dist/src/cloud-cli/applications/get-app-logs.d.ts +2 -0
- package/dist/src/cloud-cli/applications/get-app-logs.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/get-app-logs.js +37 -0
- package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -0
- package/dist/src/cloud-cli/applications/index.d.ts +8 -0
- package/dist/src/cloud-cli/applications/index.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/index.js +18 -0
- package/dist/src/cloud-cli/applications/index.js.map +1 -0
- package/dist/src/cloud-cli/applications/list-apps.d.ts +2 -0
- package/dist/src/cloud-cli/applications/list-apps.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/list-apps.js +45 -0
- package/dist/src/cloud-cli/applications/list-apps.js.map +1 -0
- package/dist/src/cloud-cli/applications/register-app.d.ts +2 -0
- package/dist/src/cloud-cli/applications/register-app.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/register-app.js +41 -0
- package/dist/src/cloud-cli/applications/register-app.js.map +1 -0
- package/dist/src/cloud-cli/applications/types.d.ts +7 -0
- package/dist/src/cloud-cli/applications/types.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/types.js +3 -0
- package/dist/src/cloud-cli/applications/types.js.map +1 -0
- package/dist/src/cloud-cli/applications/update-app.d.ts +2 -0
- package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/update-app.js +42 -0
- package/dist/src/cloud-cli/applications/update-app.js.map +1 -0
- package/dist/src/cloud-cli/cli.d.ts +3 -0
- package/dist/src/cloud-cli/cli.d.ts.map +1 -0
- package/dist/src/cloud-cli/cli.js +148 -0
- package/dist/src/cloud-cli/cli.js.map +1 -0
- package/dist/src/cloud-cli/login.d.ts +7 -0
- package/dist/src/cloud-cli/login.d.ts.map +1 -0
- package/dist/src/cloud-cli/login.js +40 -0
- package/dist/src/cloud-cli/login.js.map +1 -0
- package/dist/src/cloud-cli/register.d.ts +2 -0
- package/dist/src/cloud-cli/register.d.ts.map +1 -0
- package/dist/src/cloud-cli/register.js +35 -0
- package/dist/src/cloud-cli/register.js.map +1 -0
- package/dist/src/cloud-cli/userdb.d.ts +4 -0
- package/dist/src/cloud-cli/userdb.d.ts.map +1 -0
- package/dist/src/cloud-cli/userdb.js +149 -0
- package/dist/src/cloud-cli/userdb.js.map +1 -0
- package/dist/src/cloud-cli/utils.d.ts +3 -0
- package/dist/src/cloud-cli/utils.d.ts.map +1 -0
- package/dist/src/cloud-cli/utils.js +17 -0
- package/dist/src/cloud-cli/utils.js.map +1 -0
- package/dist/src/communicator.d.ts +24 -0
- package/dist/src/communicator.d.ts.map +1 -0
- package/dist/src/communicator.js +26 -0
- package/dist/src/communicator.js.map +1 -0
- package/dist/src/context.d.ts +60 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +94 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/data_validation.d.ts +3 -0
- package/dist/src/data_validation.d.ts.map +1 -0
- package/dist/src/data_validation.js +168 -0
- package/dist/src/data_validation.js.map +1 -0
- package/dist/src/dbos-executor.d.ts +79 -0
- package/dist/src/dbos-executor.d.ts.map +1 -0
- package/dist/src/dbos-executor.js +408 -0
- package/dist/src/dbos-executor.js.map +1 -0
- package/dist/src/dbos-runtime/TypeParser.d.ts +33 -0
- package/dist/src/dbos-runtime/TypeParser.d.ts.map +1 -0
- package/dist/src/dbos-runtime/TypeParser.js +104 -0
- package/dist/src/dbos-runtime/TypeParser.js.map +1 -0
- package/dist/src/dbos-runtime/applicationVersion.d.ts +3 -0
- package/dist/src/dbos-runtime/applicationVersion.d.ts.map +1 -0
- package/dist/src/dbos-runtime/applicationVersion.js +13 -0
- package/dist/src/dbos-runtime/applicationVersion.js.map +1 -0
- package/dist/src/dbos-runtime/cli.d.ts +8 -0
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -0
- package/dist/src/dbos-runtime/cli.js +52 -0
- package/dist/src/dbos-runtime/cli.js.map +1 -0
- package/dist/src/dbos-runtime/config.d.ts +28 -0
- package/dist/src/dbos-runtime/config.d.ts.map +1 -0
- package/dist/src/dbos-runtime/config.js +111 -0
- package/dist/src/dbos-runtime/config.js.map +1 -0
- package/dist/src/dbos-runtime/init.d.ts +7 -0
- package/dist/src/dbos-runtime/init.d.ts.map +1 -0
- package/dist/src/dbos-runtime/init.js +51 -0
- package/dist/src/dbos-runtime/init.js.map +1 -0
- package/dist/src/dbos-runtime/openApi.d.ts +35 -0
- package/dist/src/dbos-runtime/openApi.d.ts.map +1 -0
- package/dist/src/dbos-runtime/openApi.js +595 -0
- package/dist/src/dbos-runtime/openApi.js.map +1 -0
- package/dist/src/dbos-runtime/runtime.d.ts +28 -0
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -0
- package/dist/src/dbos-runtime/runtime.js +96 -0
- package/dist/src/dbos-runtime/runtime.js.map +1 -0
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts +16 -0
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +1 -0
- package/dist/src/dbos-runtime/tsDiagUtil.js +72 -0
- package/dist/src/dbos-runtime/tsDiagUtil.js.map +1 -0
- package/dist/src/decorators.d.ts +118 -0
- package/dist/src/decorators.d.ts.map +1 -0
- package/dist/src/decorators.js +467 -0
- package/dist/src/decorators.js.map +1 -0
- package/dist/src/error.d.ts +44 -0
- package/dist/src/error.d.ts.map +1 -0
- package/dist/src/error.js +164 -0
- package/dist/src/error.js.map +1 -0
- package/dist/src/httpServer/handler.d.ts +62 -0
- package/dist/src/httpServer/handler.d.ts.map +1 -0
- package/dist/src/httpServer/handler.js +168 -0
- package/dist/src/httpServer/handler.js.map +1 -0
- package/dist/src/httpServer/middleware.d.ts +56 -0
- package/dist/src/httpServer/middleware.d.ts.map +1 -0
- package/dist/src/httpServer/middleware.js +57 -0
- package/dist/src/httpServer/middleware.js.map +1 -0
- package/dist/src/httpServer/server.d.ts +40 -0
- package/dist/src/httpServer/server.d.ts.map +1 -0
- package/dist/src/httpServer/server.js +231 -0
- package/dist/src/httpServer/server.js.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +75 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/provenance/provenance_daemon.d.ts +34 -0
- package/dist/src/provenance/provenance_daemon.d.ts.map +1 -0
- package/dist/src/provenance/provenance_daemon.js +86 -0
- package/dist/src/provenance/provenance_daemon.js.map +1 -0
- package/dist/src/system_database.d.ts +69 -0
- package/dist/src/system_database.d.ts.map +1 -0
- package/dist/src/system_database.js +384 -0
- package/dist/src/system_database.js.map +1 -0
- package/dist/src/telemetry/collector.d.ts +17 -0
- package/dist/src/telemetry/collector.d.ts.map +1 -0
- package/dist/src/telemetry/collector.js +77 -0
- package/dist/src/telemetry/collector.js.map +1 -0
- package/dist/src/telemetry/exporters.d.ts +29 -0
- package/dist/src/telemetry/exporters.d.ts.map +1 -0
- package/dist/src/telemetry/exporters.js +186 -0
- package/dist/src/telemetry/exporters.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +7 -0
- package/dist/src/telemetry/index.d.ts.map +1 -0
- package/dist/src/telemetry/index.js +3 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/logs.d.ts +25 -0
- package/dist/src/telemetry/logs.d.ts.map +1 -0
- package/dist/src/telemetry/logs.js +91 -0
- package/dist/src/telemetry/logs.js.map +1 -0
- package/dist/src/telemetry/signals.d.ts +30 -0
- package/dist/src/telemetry/signals.d.ts.map +1 -0
- package/dist/src/telemetry/signals.js +11 -0
- package/dist/src/telemetry/signals.js.map +1 -0
- package/dist/src/telemetry/traces.d.ts +17 -0
- package/dist/src/telemetry/traces.d.ts.map +1 -0
- package/dist/src/telemetry/traces.js +76 -0
- package/dist/src/telemetry/traces.js.map +1 -0
- package/dist/src/testing/testing_runtime.d.ts +76 -0
- package/dist/src/testing/testing_runtime.d.ts.map +1 -0
- package/dist/src/testing/testing_runtime.js +147 -0
- package/dist/src/testing/testing_runtime.js.map +1 -0
- package/dist/src/transaction.d.ts +28 -0
- package/dist/src/transaction.d.ts.map +1 -0
- package/dist/src/transaction.js +27 -0
- package/dist/src/transaction.js.map +1 -0
- package/dist/src/user_database.d.ts +132 -0
- package/dist/src/user_database.d.ts.map +1 -0
- package/dist/src/user_database.js +324 -0
- package/dist/src/user_database.js.map +1 -0
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +35 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/src/workflow.d.ts +179 -0
- package/dist/src/workflow.d.ts.map +1 -0
- package/dist/src/workflow.js +446 -0
- package/dist/src/workflow.js.map +1 -0
- package/examples/hello/README.md +41 -0
- package/examples/hello/dbos-config.yaml +15 -0
- package/examples/hello/jest.config.js +8 -0
- package/examples/hello/knexfile.ts +23 -0
- package/examples/hello/migrations/create_dbos_hello_tables.ts +12 -0
- package/examples/hello/package.json +21 -0
- package/examples/hello/src/operations.test.ts +38 -0
- package/examples/hello/src/operations.ts +21 -0
- package/examples/hello/start_postgres_docker.sh +23 -0
- package/examples/hello/tsconfig.json +24 -0
- package/package.json +78 -0
@@ -0,0 +1,186 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PostgresExporter = exports.POSTGRES_EXPORTER = exports.JaegerExporter = exports.JAEGER_EXPORTER = void 0;
|
4
|
+
const pg_1 = require("pg");
|
5
|
+
const lodash_1 = require("lodash");
|
6
|
+
const decorators_1 = require("./../decorators");
|
7
|
+
const error_1 = require("./../error");
|
8
|
+
const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
|
9
|
+
const core_1 = require("@opentelemetry/core");
|
10
|
+
const traces_1 = require("./traces");
|
11
|
+
exports.JAEGER_EXPORTER = "JaegerExporter";
|
12
|
+
class JaegerExporter {
|
13
|
+
exporter;
|
14
|
+
constructor(endpoint = "http://localhost:4318/v1/traces") {
|
15
|
+
this.exporter = new exporter_trace_otlp_http_1.OTLPTraceExporter({
|
16
|
+
url: endpoint,
|
17
|
+
});
|
18
|
+
}
|
19
|
+
async export(rawSignals) {
|
20
|
+
// Note: it is not compatible with provenance signal.
|
21
|
+
const signals = rawSignals;
|
22
|
+
return await new Promise((resolve) => {
|
23
|
+
const exportSpans = [];
|
24
|
+
signals.forEach((signal) => {
|
25
|
+
if (signal.traceSpan) {
|
26
|
+
exportSpans.push(signal.traceSpan);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
this.exporter.export(exportSpans, (results) => {
|
30
|
+
if (results.code !== core_1.ExportResultCode.SUCCESS) {
|
31
|
+
console.warn(`Jaeger export failed`);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
resolve();
|
35
|
+
});
|
36
|
+
}
|
37
|
+
}
|
38
|
+
exports.JaegerExporter = JaegerExporter;
|
39
|
+
exports.POSTGRES_EXPORTER = "PostgresExporter";
|
40
|
+
class PostgresExporter {
|
41
|
+
poolConfig;
|
42
|
+
observabilityDBName;
|
43
|
+
pgClient;
|
44
|
+
constructor(poolConfig, observabilityDBName = "dbos_observability") {
|
45
|
+
this.poolConfig = poolConfig;
|
46
|
+
this.observabilityDBName = observabilityDBName;
|
47
|
+
const pgClientConfig = { ...poolConfig };
|
48
|
+
pgClientConfig.database = this.observabilityDBName;
|
49
|
+
this.pgClient = new pg_1.Client(pgClientConfig);
|
50
|
+
}
|
51
|
+
static getPGDataType(t) {
|
52
|
+
if (t.dataType === "double") {
|
53
|
+
return "double precision"; // aka "float8"
|
54
|
+
}
|
55
|
+
return t.formatAsString();
|
56
|
+
}
|
57
|
+
async init(registeredOperations = []) {
|
58
|
+
const pgSystemClient = new pg_1.Client(this.poolConfig);
|
59
|
+
await pgSystemClient.connect();
|
60
|
+
// First check if the log database exists using pgSystemClient.
|
61
|
+
const dbExists = await pgSystemClient.query(`SELECT FROM pg_database WHERE datname = '${this.observabilityDBName}'`);
|
62
|
+
if (dbExists.rows.length === 0) {
|
63
|
+
// Create the logs backend database
|
64
|
+
await pgSystemClient.query(`CREATE DATABASE ${this.observabilityDBName}`);
|
65
|
+
}
|
66
|
+
await pgSystemClient.end();
|
67
|
+
// Connect the exporter client
|
68
|
+
await this.pgClient.connect();
|
69
|
+
// Configure tables for registered workflows
|
70
|
+
for (const registeredOperation of registeredOperations) {
|
71
|
+
const tableName = `signal_${registeredOperation.name}`;
|
72
|
+
let createSignalTableQuery = `CREATE TABLE IF NOT EXISTS ${tableName} (
|
73
|
+
workflow_uuid TEXT NOT NULL,
|
74
|
+
function_name TEXT NOT NULL,
|
75
|
+
run_as TEXT NOT NULL,
|
76
|
+
timestamp BIGINT NOT NULL,
|
77
|
+
transaction_id TEXT DEFAULT NULL,
|
78
|
+
trace_id TEXT DEFAULT NULL,
|
79
|
+
trace_span JSONB DEFAULT NULL,\n`;
|
80
|
+
for (const arg of registeredOperation.args) {
|
81
|
+
if (arg.logMask === decorators_1.LogMasks.SKIP) {
|
82
|
+
continue;
|
83
|
+
}
|
84
|
+
else if (arg.logMask === decorators_1.LogMasks.HASH) {
|
85
|
+
const row = `${arg.name} VARCHAR(64) DEFAULT NULL,\n`;
|
86
|
+
createSignalTableQuery = createSignalTableQuery.concat(row);
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
const row = `${arg.name} ${PostgresExporter.getPGDataType(arg.dataType)} DEFAULT NULL,\n`;
|
90
|
+
createSignalTableQuery = createSignalTableQuery.concat(row);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
// Trim last comma and line feed
|
94
|
+
createSignalTableQuery = createSignalTableQuery.slice(0, -2).concat("\n);");
|
95
|
+
await this.pgClient.query(createSignalTableQuery);
|
96
|
+
// Create a table for provenance logs.
|
97
|
+
// TODO: create a secondary index.
|
98
|
+
}
|
99
|
+
await this.pgClient.query(`CREATE TABLE IF NOT EXISTS provenance_logs (
|
100
|
+
transaction_id TEXT NOT NULL,
|
101
|
+
kind TEXT,
|
102
|
+
schema_name TEXT,
|
103
|
+
table_name TEXT,
|
104
|
+
columnnames TEXT,
|
105
|
+
columntypes TEXT,
|
106
|
+
columnvalues TEXT
|
107
|
+
);`);
|
108
|
+
}
|
109
|
+
async destroy() {
|
110
|
+
await this.pgClient.end();
|
111
|
+
}
|
112
|
+
process(signals) {
|
113
|
+
const groupByFunctionName = new Map(Object.entries((0, lodash_1.groupBy)(signals, ({ operationName }) => operationName)));
|
114
|
+
const queries = [];
|
115
|
+
for (const [operationName, signals] of groupByFunctionName) {
|
116
|
+
const tableName = `signal_${operationName}`;
|
117
|
+
const query = `
|
118
|
+
INSERT INTO ${tableName}
|
119
|
+
SELECT * FROM jsonb_to_recordset($1::jsonb) AS tmp (workflow_uuid text, function_name text, run_as text, timestamp bigint, transaction_id text, trace_id text, trace_span json)
|
120
|
+
`;
|
121
|
+
const values = JSON.stringify(signals.map((signal) => {
|
122
|
+
return {
|
123
|
+
workflow_uuid: signal.workflowUUID,
|
124
|
+
function_name: signal.operationName,
|
125
|
+
run_as: signal.runAs,
|
126
|
+
timestamp: signal.timestamp,
|
127
|
+
transaction_id: signal.transactionID,
|
128
|
+
trace_id: signal.traceID,
|
129
|
+
trace_span: signal.traceSpan ? (0, traces_1.spanToString)(signal.traceSpan) : null,
|
130
|
+
};
|
131
|
+
}));
|
132
|
+
queries.push({
|
133
|
+
name: `insert-${tableName}`,
|
134
|
+
text: query,
|
135
|
+
values: [values],
|
136
|
+
});
|
137
|
+
}
|
138
|
+
return queries;
|
139
|
+
}
|
140
|
+
processProvenance(signals) {
|
141
|
+
const query = `
|
142
|
+
INSERT INTO provenance_logs
|
143
|
+
SELECT * FROM jsonb_to_recordset($1::jsonb) AS tmp (
|
144
|
+
transaction_id text, kind text, schema_name text, table_name text,
|
145
|
+
columnnames text, columntypes text, columnvalues text);
|
146
|
+
`;
|
147
|
+
const values = JSON.stringify(signals.map((signal) => {
|
148
|
+
return {
|
149
|
+
transaction_id: signal.provTransactionID,
|
150
|
+
kind: signal.kind,
|
151
|
+
schema_name: signal.schema,
|
152
|
+
table_name: signal.table,
|
153
|
+
columnnames: signal.columnnames,
|
154
|
+
columntypes: signal.columntypes,
|
155
|
+
columnvalues: signal.columnvalues
|
156
|
+
};
|
157
|
+
}));
|
158
|
+
return { name: `insert-provenance-log`, text: query, values: [values] };
|
159
|
+
}
|
160
|
+
async export(signals) {
|
161
|
+
const results = [];
|
162
|
+
// Find all telemetry signals and process.
|
163
|
+
const telemetrySignals = signals.filter(obj => obj.workflowUUID !== undefined);
|
164
|
+
if (telemetrySignals.length > 0) {
|
165
|
+
const queries = this.process(telemetrySignals);
|
166
|
+
for (const query of queries) {
|
167
|
+
results.push(this.pgClient.query(query));
|
168
|
+
}
|
169
|
+
}
|
170
|
+
// Find all provenance signals and process.
|
171
|
+
const provenanceSignals = signals.filter((obj) => obj.provTransactionID !== undefined);
|
172
|
+
if (provenanceSignals.length > 0) {
|
173
|
+
const provQuery = this.processProvenance(provenanceSignals);
|
174
|
+
results.push(this.pgClient.query(provQuery));
|
175
|
+
}
|
176
|
+
try {
|
177
|
+
// We do await here so we can catch and format PostgresExporter specific errors
|
178
|
+
return await Promise.all(results);
|
179
|
+
}
|
180
|
+
catch (err) {
|
181
|
+
throw new error_1.DBOSPostgresExporterError(err);
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
exports.PostgresExporter = PostgresExporter;
|
186
|
+
//# sourceMappingURL=exporters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"exporters.js","sourceRoot":"","sources":["../../../src/telemetry/exporters.ts"],"names":[],"mappings":";;;AAAA,2BAAuE;AACvE,mCAAiC;AACjC,gDAAiF;AACjF,sCAAuD;AAEvD,sFAA4E;AAE5E,8CAAqE;AACrE,qCAAwC;AAS3B,QAAA,eAAe,GAAG,gBAAgB,CAAC;AAChD,MAAa,cAAc;IACR,QAAQ,CAAoB;IAC7C,YAAY,WAAmB,iCAAiC;QAC9D,IAAI,CAAC,QAAQ,GAAG,IAAI,4CAAiB,CAAC;YACpC,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAwB;QACnC,qDAAqD;QACrD,MAAM,OAAO,GAAG,UAA+B,CAAC;QAChD,OAAO,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACzC,MAAM,WAAW,GAAmB,EAAE,CAAC;YACvC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,MAAM,CAAC,SAAS,EAAE;oBACpB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;iBACpC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,CAAuB,CAAC;QACnI,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;YAC5D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;SAC9C;QACD,IAAI;YACF,+EAA+E;YAC/E,OAAO,MAAM,OAAO,CAAC,GAAG,CAAmB,OAAO,CAAC,CAAC;SACrD;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,iCAAyB,CAAC,GAAY,CAAC,CAAC;SACnD;IACH,CAAC;CACF;AA7JD,4CA6JC"}
|
@@ -0,0 +1 @@
|
|
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,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { Logger as IWinstonLogger } from "winston";
|
2
|
+
import { DBOSContext } from "../context";
|
3
|
+
export interface LoggerConfig {
|
4
|
+
logLevel?: string;
|
5
|
+
silent?: boolean;
|
6
|
+
addContextMetadata?: boolean;
|
7
|
+
}
|
8
|
+
export interface WinstonLogger extends IWinstonLogger {
|
9
|
+
addContextMetadata: boolean;
|
10
|
+
}
|
11
|
+
export declare class Logger {
|
12
|
+
private readonly globalLogger;
|
13
|
+
private readonly ctx;
|
14
|
+
readonly metadata: object;
|
15
|
+
constructor(globalLogger: WinstonLogger, ctx: DBOSContext);
|
16
|
+
info(message: string): void;
|
17
|
+
debug(message: string): void;
|
18
|
+
warn(message: string): void;
|
19
|
+
emerg(message: string): void;
|
20
|
+
alert(message: string): void;
|
21
|
+
crit(message: string): void;
|
22
|
+
error(inputError: any): void;
|
23
|
+
}
|
24
|
+
export declare function createGlobalLogger(config?: LoggerConfig): WinstonLogger;
|
25
|
+
//# sourceMappingURL=logs.d.ts.map
|
@@ -0,0 +1 @@
|
|
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;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAGD,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAKD,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAiB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAD9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAM;gBACF,YAAY,EAAE,aAAa,EAAmB,GAAG,EAAE,WAAW;IAW3F,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,KAAK,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;CAY7B;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,aAAa,CAYvE"}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createGlobalLogger = exports.Logger = void 0;
|
4
|
+
const winston_1 = require("winston");
|
5
|
+
const applicationVersion_1 = require("../dbos-runtime/applicationVersion");
|
6
|
+
/* This is a wrapper around a global Winston logger. It holds a reference to the global logger.
|
7
|
+
* This class is expected to be instantiated by new DBOSContext such that they can share context information.
|
8
|
+
**/
|
9
|
+
class Logger {
|
10
|
+
globalLogger;
|
11
|
+
ctx;
|
12
|
+
// Eventually this object will implement one of our TelemetrySignal interface
|
13
|
+
metadata = {};
|
14
|
+
constructor(globalLogger, ctx) {
|
15
|
+
this.globalLogger = globalLogger;
|
16
|
+
this.ctx = ctx;
|
17
|
+
if (this.globalLogger.addContextMetadata) {
|
18
|
+
this.metadata = {
|
19
|
+
workflowUUID: this.ctx.workflowUUID,
|
20
|
+
authenticatedUser: this.ctx.authenticatedUser,
|
21
|
+
traceId: this.ctx.span.spanContext().traceId,
|
22
|
+
spanId: this.ctx.span.spanContext().spanId,
|
23
|
+
};
|
24
|
+
}
|
25
|
+
}
|
26
|
+
info(message) {
|
27
|
+
this.globalLogger.info(message, this.metadata);
|
28
|
+
}
|
29
|
+
debug(message) {
|
30
|
+
this.globalLogger.debug(message, this.metadata);
|
31
|
+
}
|
32
|
+
warn(message) {
|
33
|
+
this.globalLogger.warn(message, this.metadata);
|
34
|
+
}
|
35
|
+
emerg(message) {
|
36
|
+
this.globalLogger.emerg(message, this.metadata);
|
37
|
+
}
|
38
|
+
alert(message) {
|
39
|
+
this.globalLogger.alert(message, this.metadata);
|
40
|
+
}
|
41
|
+
crit(message) {
|
42
|
+
this.globalLogger.crit(message, this.metadata);
|
43
|
+
}
|
44
|
+
// We give users the same interface (message: string argument) but create an error to get a stack trace
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
error(inputError) {
|
47
|
+
if (inputError instanceof Error) {
|
48
|
+
this.globalLogger.error(inputError.message, { ...this.metadata, stack: inputError.stack, cause: inputError.cause });
|
49
|
+
}
|
50
|
+
else if (typeof inputError === "string") {
|
51
|
+
const e = new Error();
|
52
|
+
this.globalLogger.error(inputError, { ...this.metadata, stack: e.stack });
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
// If this is neither a string nor an error, we just log it as is an ommit the context
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
57
|
+
this.globalLogger.error(inputError.toString());
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
exports.Logger = Logger;
|
62
|
+
function createGlobalLogger(config) {
|
63
|
+
const logger = (0, winston_1.createLogger)({
|
64
|
+
format: consoleFormat,
|
65
|
+
transports: [
|
66
|
+
new winston_1.transports.Console({
|
67
|
+
level: config?.logLevel || "info",
|
68
|
+
}),
|
69
|
+
],
|
70
|
+
silent: config?.silent || false,
|
71
|
+
});
|
72
|
+
logger.addContextMetadata = config?.addContextMetadata || false;
|
73
|
+
return logger;
|
74
|
+
}
|
75
|
+
exports.createGlobalLogger = createGlobalLogger;
|
76
|
+
const consoleFormat = winston_1.format.combine(winston_1.format.errors({ stack: true }), winston_1.format.timestamp(), winston_1.format.colorize(),
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
+
winston_1.format.printf((info) => {
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
80
|
+
const { timestamp, level, message, stack, ...args } = info;
|
81
|
+
const applicationVersion = (0, applicationVersion_1.getApplicationVersion)();
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
83
|
+
const ts = timestamp.slice(0, 19).replace("T", " ");
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
85
|
+
const formattedStack = stack?.split("\n").slice(1).join("\n");
|
86
|
+
const messageString = typeof message === "string" ? message : JSON.stringify(message);
|
87
|
+
const versionString = applicationVersion ? ` [version ${applicationVersion}]` : "";
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
89
|
+
return `${ts}${versionString} [${level}]: ${messageString} ${Object.keys(args).length ? "\n" + JSON.stringify(args, null, 2) : ""} ${stack ? "\n" + formattedStack : ""}`;
|
90
|
+
}));
|
91
|
+
//# sourceMappingURL=logs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/telemetry/logs.ts"],"names":[],"mappings":";;;AAAA,qCAAqF;AACrF,2EAA2E;AAc3E;;IAEI;AACJ,MAAa,MAAM;IAGY;IAA8C;IAF3E,6EAA6E;IACpE,QAAQ,GAAW,EAAE,CAAC;IAC/B,YAA6B,YAA2B,EAAmB,GAAgB;QAA9D,iBAAY,GAAZ,YAAY,CAAe;QAAmB,QAAG,GAAH,GAAG,CAAa;QACzF,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;YACxC,IAAI,CAAC,QAAQ,GAAG;gBACd,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY;gBACnC,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB;gBAC7C,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO;gBAC5C,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM;aAC3C,CAAC;SACH;IACH,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,OAAe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AAS,CAAC,OAAO,CAAC,CAAC;IAC9F,MAAM,aAAa,GAAG,kBAAkB,CAAC,CAAC,CAAC,aAAa,kBAAkB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACnF,iEAAiE;IACjE,OAAO,GAAG,EAAE,GAAG,aAAa,KAAK,KAAK,MAAM,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5K,CAAC,CAAC,CACH,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { ReadableSpan } from "@opentelemetry/sdk-trace-base";
|
2
|
+
import { ValuesOf } from "../utils";
|
3
|
+
export type DBOSSignal = TelemetrySignal | ProvenanceSignal;
|
4
|
+
export declare const LogSeverity: {
|
5
|
+
readonly Debug: "DEBUG";
|
6
|
+
readonly Info: "INFO";
|
7
|
+
readonly Warn: "WARN";
|
8
|
+
readonly Error: "ERROR";
|
9
|
+
readonly Log: "LOG";
|
10
|
+
};
|
11
|
+
export type LogSeverity = ValuesOf<typeof LogSeverity>;
|
12
|
+
export interface TelemetrySignal {
|
13
|
+
workflowUUID: string;
|
14
|
+
operationName: string;
|
15
|
+
runAs: string;
|
16
|
+
timestamp: number;
|
17
|
+
transactionID?: string;
|
18
|
+
traceID?: string;
|
19
|
+
traceSpan?: ReadableSpan;
|
20
|
+
}
|
21
|
+
export interface ProvenanceSignal {
|
22
|
+
provTransactionID: string;
|
23
|
+
kind: string;
|
24
|
+
schema: string;
|
25
|
+
table: string;
|
26
|
+
columnnames: string[];
|
27
|
+
columntypes: string[];
|
28
|
+
columnvalues: string[];
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=signals.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../../src/telemetry/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE5D,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.LogSeverity = void 0;
|
4
|
+
exports.LogSeverity = {
|
5
|
+
Debug: "DEBUG",
|
6
|
+
Info: "INFO",
|
7
|
+
Warn: "WARN",
|
8
|
+
Error: "ERROR",
|
9
|
+
Log: "LOG",
|
10
|
+
};
|
11
|
+
//# sourceMappingURL=signals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../src/telemetry/signals.ts"],"names":[],"mappings":";;;AAKa,QAAA,WAAW,GAAG;IACzB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;CACF,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ReadableSpan, Span } from "@opentelemetry/sdk-trace-base";
|
2
|
+
import { Attributes, SpanContext } from "@opentelemetry/api";
|
3
|
+
import { TelemetryCollector } from "./collector";
|
4
|
+
export interface TracerConfig {
|
5
|
+
enabled?: boolean;
|
6
|
+
endpoint?: string;
|
7
|
+
}
|
8
|
+
export declare function spanToString(span: ReadableSpan): string;
|
9
|
+
export declare class Tracer {
|
10
|
+
private readonly telemetryCollector;
|
11
|
+
private readonly tracer;
|
12
|
+
constructor(telemetryCollector: TelemetryCollector);
|
13
|
+
startSpanWithContext(spanContext: SpanContext, name: string, attributes?: Attributes): Span;
|
14
|
+
startSpan(name: string, attributes?: Attributes, parentSpan?: Span): Span;
|
15
|
+
endSpan(span: Span): void;
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=traces.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../../src/telemetry/traces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAsB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAevD;AAED,qBAAa,MAAM;IAEL,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAD/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAChB,kBAAkB,EAAE,kBAAkB;IASnE,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;CAoBnB"}
|
@@ -0,0 +1,76 @@
|
|
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 = exports.spanToString = 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 core_1 = require("@opentelemetry/core");
|
11
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
12
|
+
function spanToString(span) {
|
13
|
+
return JSON.stringify({
|
14
|
+
name: span.name,
|
15
|
+
kind: span.kind,
|
16
|
+
traceId: span.spanContext().traceId,
|
17
|
+
spanId: span.spanContext().spanId,
|
18
|
+
traceFlags: span.spanContext().traceFlags,
|
19
|
+
traceState: span.spanContext().traceState?.serialize(),
|
20
|
+
parentSpanId: span.parentSpanId,
|
21
|
+
start: (0, core_1.hrTimeToMicroseconds)(span.startTime),
|
22
|
+
duration: (0, core_1.hrTimeToMicroseconds)(span.duration),
|
23
|
+
attributes: span.attributes,
|
24
|
+
status: span.status,
|
25
|
+
events: span.events,
|
26
|
+
});
|
27
|
+
}
|
28
|
+
exports.spanToString = spanToString;
|
29
|
+
class Tracer {
|
30
|
+
telemetryCollector;
|
31
|
+
tracer;
|
32
|
+
constructor(telemetryCollector) {
|
33
|
+
this.telemetryCollector = telemetryCollector;
|
34
|
+
this.tracer = new sdk_trace_base_1.BasicTracerProvider({
|
35
|
+
resource: new resources_1.Resource({
|
36
|
+
[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: "dbos",
|
37
|
+
}),
|
38
|
+
});
|
39
|
+
this.tracer.register();
|
40
|
+
}
|
41
|
+
startSpanWithContext(spanContext, name, attributes) {
|
42
|
+
const tracer = api_1.default.trace.getTracer("dbos-tracer");
|
43
|
+
const ctx = api_1.default.trace.setSpanContext(api_1.default.context.active(), spanContext);
|
44
|
+
return tracer.startSpan(name, { startTime: Date.now(), attributes: attributes }, ctx);
|
45
|
+
}
|
46
|
+
startSpan(name, attributes, parentSpan) {
|
47
|
+
const tracer = api_1.default.trace.getTracer("dbos-tracer");
|
48
|
+
if (parentSpan) {
|
49
|
+
const ctx = api_1.default.trace.setSpan(api_1.default.context.active(), parentSpan);
|
50
|
+
return tracer.startSpan(name, { startTime: Date.now(), attributes: attributes }, ctx);
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
return tracer.startSpan(name, { attributes: attributes });
|
54
|
+
}
|
55
|
+
}
|
56
|
+
endSpan(span) {
|
57
|
+
span.end(Date.now());
|
58
|
+
const workflowUUID = span.attributes.workflowUUID;
|
59
|
+
const operationName = span.attributes.operationName;
|
60
|
+
const runAs = span.attributes.runAs;
|
61
|
+
const transactionID = span.attributes.transaction_id;
|
62
|
+
const traceID = span.spanContext().traceId;
|
63
|
+
const signal = {
|
64
|
+
workflowUUID,
|
65
|
+
operationName,
|
66
|
+
runAs,
|
67
|
+
timestamp: Date.now(),
|
68
|
+
traceID,
|
69
|
+
transactionID: transactionID,
|
70
|
+
traceSpan: span,
|
71
|
+
};
|
72
|
+
this.telemetryCollector.push(signal);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
exports.Tracer = Tracer;
|
76
|
+
//# sourceMappingURL=traces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AAC,UAAU,CAAC,cAAwB,CAAC;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;QAE3C,MAAM,MAAM,GAAoB;YAC9B,YAAY;YACZ,aAAa;YACb,KAAK;YACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO;YACP,aAAa,EAAE,aAAa;YAC5B,SAAS,EAAE,IAAoB;SAChC,CAAC;QAEF,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACF;AA/CD,wBA+CC"}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { IncomingMessage } from "http";
|
4
|
+
import { HTTPRequest } from "../context";
|
5
|
+
import { InvokeFuncs } from "../httpServer/handler";
|
6
|
+
import { DBOSExecutor, DBOSConfig } from "../dbos-executor";
|
7
|
+
import { WorkflowHandle } from "../workflow";
|
8
|
+
import { Http2ServerRequest, Http2ServerResponse } from "http2";
|
9
|
+
import { ServerResponse } from "http";
|
10
|
+
import { SystemDatabase } from "../system_database";
|
11
|
+
/**
|
12
|
+
* Create a testing runtime. Warn: this function will drop the existing system DB and create a clean new one. Don't run tests against your production database!
|
13
|
+
*/
|
14
|
+
export declare function createTestingRuntime(userClasses: object[], configFilePath?: string): Promise<TestingRuntime>;
|
15
|
+
export interface WorkflowInvokeParams {
|
16
|
+
readonly authenticatedUser?: string;
|
17
|
+
readonly authenticatedRoles?: string[];
|
18
|
+
readonly request?: HTTPRequest;
|
19
|
+
}
|
20
|
+
export interface TestingRuntime {
|
21
|
+
invoke<T extends object>(targetClass: T, workflowUUID?: string, params?: WorkflowInvokeParams): InvokeFuncs<T>;
|
22
|
+
retrieveWorkflow<R>(workflowUUID: string): WorkflowHandle<R>;
|
23
|
+
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
24
|
+
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
25
|
+
getHandlersCallback(): (req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse) => Promise<void>;
|
26
|
+
getConfig<T>(key: string): T | undefined;
|
27
|
+
getConfig<T>(key: string, defaultValue: T): T;
|
28
|
+
queryUserDB<R>(sql: string, ...params: any[]): Promise<R[]>;
|
29
|
+
createUserSchema(): Promise<void>;
|
30
|
+
dropUserSchema(): Promise<void>;
|
31
|
+
destroy(): Promise<void>;
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* For internal unit tests which allows us to provide different system DB and control its behavior.
|
35
|
+
*/
|
36
|
+
export declare function createInternalTestRuntime(userClasses: object[], testConfig: DBOSConfig, systemDB?: SystemDatabase): Promise<TestingRuntime>;
|
37
|
+
/**
|
38
|
+
* This class provides a runtime to test Opeorn functions in unit tests.
|
39
|
+
*/
|
40
|
+
export declare class TestingRuntimeImpl implements TestingRuntime {
|
41
|
+
#private;
|
42
|
+
/**
|
43
|
+
* Initialize the testing runtime by loading user functions specified in classes and using the specified config.
|
44
|
+
* This should be the first function call before any subsequent calls.
|
45
|
+
*/
|
46
|
+
init(userClasses: object[], testConfig?: DBOSConfig, systemDB?: SystemDatabase): Promise<void>;
|
47
|
+
/**
|
48
|
+
* Release resources after tests.
|
49
|
+
*/
|
50
|
+
destroy(): Promise<void>;
|
51
|
+
/**
|
52
|
+
* Get Application Configuration.
|
53
|
+
*/
|
54
|
+
getConfig<T>(key: string): T | undefined;
|
55
|
+
getConfig<T>(key: string, defaultValue: T): T;
|
56
|
+
/**
|
57
|
+
* Generate a proxy object for the provided class that wraps direct calls (i.e. OpClass.someMethod(param))
|
58
|
+
* to invoke workflows, transactions, and communicators;
|
59
|
+
*/
|
60
|
+
invoke<T extends object>(object: T, workflowUUID?: string, params?: WorkflowInvokeParams): InvokeFuncs<T>;
|
61
|
+
/**
|
62
|
+
* Return a request handler callback for node's native http/http2 server, which includes all registered HTTP endpoints.
|
63
|
+
*/
|
64
|
+
getHandlersCallback(): (req: IncomingMessage | Http2ServerRequest, res: Http2ServerResponse | ServerResponse<IncomingMessage>) => Promise<void>;
|
65
|
+
send<T extends NonNullable<any>>(destinationUUID: string, message: T, topic?: string, idempotencyKey?: string): Promise<void>;
|
66
|
+
getEvent<T extends NonNullable<any>>(workflowUUID: string, key: string, timeoutSeconds?: number): Promise<T | null>;
|
67
|
+
retrieveWorkflow<R>(workflowUUID: string): WorkflowHandle<R>;
|
68
|
+
queryUserDB<R>(sql: string, ...params: any[]): Promise<R[]>;
|
69
|
+
createUserSchema(): Promise<void>;
|
70
|
+
dropUserSchema(): Promise<void>;
|
71
|
+
/**
|
72
|
+
* For internal tests use only -- return the workflow executor object.
|
73
|
+
*/
|
74
|
+
getDBOSExec(): DBOSExecutor;
|
75
|
+
}
|
76
|
+
//# sourceMappingURL=testing_runtime.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"testing_runtime.d.ts","sourceRoot":"","sources":["../../../src/testing/testing_runtime.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAY,cAAc,EAAkB,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,cAAc,GAAE,MAA2B,GAAG,OAAO,CAAC,cAAc,CAAC,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