callman-core 1.39.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/host/connections.d.ts +7 -0
- package/dist/host/connections.d.ts.map +1 -1
- package/dist/host/connections.js +8 -0
- package/dist/host/connections.js.map +1 -1
- package/dist/host/db/connectionMapping.d.ts +3 -0
- package/dist/host/db/connectionMapping.d.ts.map +1 -1
- package/dist/host/db/connectionMapping.js +3 -0
- package/dist/host/db/connectionMapping.js.map +1 -1
- package/dist/host/db/dbErrors.d.ts +9 -0
- package/dist/host/db/dbErrors.d.ts.map +1 -0
- package/dist/host/db/dbErrors.js +126 -0
- package/dist/host/db/dbErrors.js.map +1 -0
- package/dist/host/db/dbPool.d.ts +94 -0
- package/dist/host/db/dbPool.d.ts.map +1 -0
- package/dist/host/db/dbPool.js +258 -0
- package/dist/host/db/dbPool.js.map +1 -0
- package/dist/host/db/dbTimings.d.ts +13 -0
- package/dist/host/db/dbTimings.d.ts.map +1 -0
- package/dist/host/db/dbTimings.js +9 -0
- package/dist/host/db/dbTimings.js.map +1 -0
- package/dist/host/db/mongoAdapter.d.ts +2 -0
- package/dist/host/db/mongoAdapter.d.ts.map +1 -1
- package/dist/host/db/mongoAdapter.js +56 -5
- package/dist/host/db/mongoAdapter.js.map +1 -1
- package/dist/host/db/mssqlAdapter.d.ts +2 -0
- package/dist/host/db/mssqlAdapter.d.ts.map +1 -1
- package/dist/host/db/mssqlAdapter.js +75 -4
- package/dist/host/db/mssqlAdapter.js.map +1 -1
- package/dist/host/db/mysqlAdapter.d.ts +2 -0
- package/dist/host/db/mysqlAdapter.d.ts.map +1 -1
- package/dist/host/db/mysqlAdapter.js +85 -3
- package/dist/host/db/mysqlAdapter.js.map +1 -1
- package/dist/host/db/oracleAdapter.d.ts +2 -0
- package/dist/host/db/oracleAdapter.d.ts.map +1 -1
- package/dist/host/db/oracleAdapter.js +102 -1
- package/dist/host/db/oracleAdapter.js.map +1 -1
- package/dist/host/db/oracleConnectString.d.ts.map +1 -1
- package/dist/host/db/oracleConnectString.js +13 -4
- package/dist/host/db/oracleConnectString.js.map +1 -1
- package/dist/host/db/postgresAdapter.d.ts +2 -0
- package/dist/host/db/postgresAdapter.d.ts.map +1 -1
- package/dist/host/db/postgresAdapter.js +58 -1
- package/dist/host/db/postgresAdapter.js.map +1 -1
- package/dist/host/db/queryExecutor.d.ts +2 -0
- package/dist/host/db/queryExecutor.d.ts.map +1 -1
- package/dist/host/db/queryExecutor.js +6 -0
- package/dist/host/db/queryExecutor.js.map +1 -1
- package/dist/host/db/types.d.ts +16 -0
- package/dist/host/db/types.d.ts.map +1 -1
- package/dist/host/index.d.ts +3 -0
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +3 -0
- package/dist/host/index.js.map +1 -1
- package/dist/http/transportError.d.ts +15 -0
- package/dist/http/transportError.d.ts.map +1 -0
- package/dist/http/transportError.js +70 -0
- package/dist/http/transportError.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/request/executeRequest.d.ts.map +1 -1
- package/dist/request/executeRequest.js +3 -1
- package/dist/request/executeRequest.js.map +1 -1
- package/dist/request/httpTimings.d.ts +10 -0
- package/dist/request/httpTimings.d.ts.map +1 -0
- package/dist/request/httpTimings.js +131 -0
- package/dist/request/httpTimings.js.map +1 -0
- package/dist/runner/requestRunner.d.ts.map +1 -1
- package/dist/runner/requestRunner.js +6 -1
- package/dist/runner/requestRunner.js.map +1 -1
- package/dist/script/types.d.ts +5 -0
- package/dist/script/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist-cjs/host/connections.js +8 -0
- package/dist-cjs/host/connections.js.map +1 -1
- package/dist-cjs/host/db/connectionMapping.js +3 -0
- package/dist-cjs/host/db/connectionMapping.js.map +1 -1
- package/dist-cjs/host/db/dbErrors.js +130 -0
- package/dist-cjs/host/db/dbErrors.js.map +1 -0
- package/dist-cjs/host/db/dbPool.js +272 -0
- package/dist-cjs/host/db/dbPool.js.map +1 -0
- package/dist-cjs/host/db/dbTimings.js +14 -0
- package/dist-cjs/host/db/dbTimings.js.map +1 -0
- package/dist-cjs/host/db/mongoAdapter.js +56 -5
- package/dist-cjs/host/db/mongoAdapter.js.map +1 -1
- package/dist-cjs/host/db/mssqlAdapter.js +75 -4
- package/dist-cjs/host/db/mssqlAdapter.js.map +1 -1
- package/dist-cjs/host/db/mysqlAdapter.js +85 -3
- package/dist-cjs/host/db/mysqlAdapter.js.map +1 -1
- package/dist-cjs/host/db/oracleAdapter.js +102 -1
- package/dist-cjs/host/db/oracleAdapter.js.map +1 -1
- package/dist-cjs/host/db/oracleConnectString.js +13 -4
- package/dist-cjs/host/db/oracleConnectString.js.map +1 -1
- package/dist-cjs/host/db/postgresAdapter.js +58 -1
- package/dist-cjs/host/db/postgresAdapter.js.map +1 -1
- package/dist-cjs/host/db/queryExecutor.js +6 -0
- package/dist-cjs/host/db/queryExecutor.js.map +1 -1
- package/dist-cjs/host/index.js +13 -2
- package/dist-cjs/host/index.js.map +1 -1
- package/dist-cjs/http/transportError.js +75 -0
- package/dist-cjs/http/transportError.js.map +1 -0
- package/dist-cjs/index.js +4 -1
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/request/executeRequest.js +3 -1
- package/dist-cjs/request/executeRequest.js.map +1 -1
- package/dist-cjs/request/httpTimings.js +168 -0
- package/dist-cjs/request/httpTimings.js.map +1 -0
- package/dist-cjs/runner/requestRunner.js +6 -1
- package/dist-cjs/runner/requestRunner.js.map +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,13 @@ export interface DbConnectionRuntime {
|
|
|
18
18
|
password?: string;
|
|
19
19
|
ssl?: boolean;
|
|
20
20
|
trustServerCertificate?: boolean;
|
|
21
|
+
oracleConnectBy?: "serviceName" | "sid";
|
|
22
|
+
sid?: string;
|
|
23
|
+
authSource?: string;
|
|
24
|
+
sslMode?: "disable" | "require" | "verify-ca" | "verify-full";
|
|
25
|
+
caCert?: string;
|
|
26
|
+
clientCert?: string;
|
|
27
|
+
clientKey?: string;
|
|
21
28
|
}
|
|
22
29
|
export interface RedisConnectionRuntime {
|
|
23
30
|
kind: "redis";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/host/connections.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAEV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAEV,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,2BAA2B,EAC3B,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,sBAAsB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/host/connections.ts"],"names":[],"mappings":"AAOA,OAA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AoB,GAAU,OAAO;IAChD,WAAW,EAAE,oBAAoB,CAAC;IAClC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;IACjC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC;IACtB,OAAO,EAAE,qBAAqB,CAAC;CAChC,KAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAiBzC,CAAC;AAIF,eAAO,MAAM,wBAAwB,GAAU,OAAO;IACpD,WAAW,EAAE,oBAAoB,CAAC;IAClC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,EAAE,qBAAqB,CAAC;CAChC,KAAG,OAAO,CAAC,2BAA2B,EAAE,CAsBxC,CAAC;AAKF,eAAO,MAAM,gBAAgB,GAC1B,OAAO;IACN,WAAW,EAAE,oBAAoB,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,qBAAqB,CAAC;CAChC,MAEC,SAAS,MAAM,KACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAoBhE,CAAC;AAKJ,eAAO,MAAM,oBAAoB,GAC/B,SAAS,2BAA2B,EAAE,KACrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAwBxB,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAC/B,KAAK,2BAA2B,EAAE,EAClC,MAAM,2BAA2B,EAAE,KAClC,qBAGD,CAAC"}
|
package/dist/host/connections.js
CHANGED
|
@@ -22,6 +22,13 @@ const toDbConnectionInput = (runtime) => ({
|
|
|
22
22
|
password: runtime.password ?? "",
|
|
23
23
|
ssl: runtime.ssl,
|
|
24
24
|
trustServerCertificate: runtime.trustServerCertificate,
|
|
25
|
+
...(runtime.oracleConnectBy ? { oracleConnectBy: runtime.oracleConnectBy } : {}),
|
|
26
|
+
...(runtime.sid ? { sid: runtime.sid } : {}),
|
|
27
|
+
...(runtime.authSource ? { authSource: runtime.authSource } : {}),
|
|
28
|
+
...(runtime.sslMode ? { sslMode: runtime.sslMode } : {}),
|
|
29
|
+
...(runtime.caCert ? { caCert: runtime.caCert } : {}),
|
|
30
|
+
...(runtime.clientCert ? { clientCert: runtime.clientCert } : {}),
|
|
31
|
+
...(runtime.clientKey ? { clientKey: runtime.clientKey } : {}),
|
|
25
32
|
});
|
|
26
33
|
const toRedisConnectionInput = (runtime) => ({
|
|
27
34
|
id: runtime.id,
|
|
@@ -46,6 +53,7 @@ const toScriptDbResult = (result) => ({
|
|
|
46
53
|
rowCount: result.rowCount,
|
|
47
54
|
durationMs: result.durationMs,
|
|
48
55
|
executedAt: result.executedAt,
|
|
56
|
+
...(result.diagnosis ? { diagnosis: result.diagnosis } : {}),
|
|
49
57
|
});
|
|
50
58
|
const buildMissingConnectionResult = (input) => ({
|
|
51
59
|
success: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../../src/host/connections.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,SAAS;AAST,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../../src/host/connections.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,SAAS;AAST,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAmF/D,MAAM,mBAAmB,GAAG,CAAC,OAA4B,EAAqB,E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,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,4BAA4B,GAAI,OAAO;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,4BAA4B,CAAC;CACtC,KAAG,YAsBF,CAAC"}
|
|
@@ -21,6 +21,9 @@ export const databaseConfigToDbConnection = (input) => ({
|
|
|
21
21
|
port: input.config.port ?? 0,
|
|
22
22
|
database: input.config.database,
|
|
23
23
|
serviceName: input.config.serviceName,
|
|
24
|
+
...(input.config.oracleConnectBy ? { oracleConnectBy: input.config.oracleConnectBy } : {}),
|
|
25
|
+
...(input.config.sid ? { sid: input.config.sid } : {}),
|
|
26
|
+
...(input.config.authSource ? { authSource: input.config.authSource } : {}),
|
|
24
27
|
instanceName: input.config.instanceName,
|
|
25
28
|
username: input.config.username ?? "",
|
|
26
29
|
password: input.config.password ?? "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionMapping.js","sourceRoot":"","sources":["../../../src/host/db/connectionMapping.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,oBAAoB;AAMpB,MAAM,gBAAgB,GAA6C;IACjE,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"connectionMapping.js","sourceRoot":"","sources":["../../../src/host/db/connectionMapping.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,oBAAoB;AAMpB,MAAM,gBAAgB,GAA6C;IACjE,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,OAA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AQ,IAAI,EAAE;IACrC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IACrB,sBAAsB,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB;IAC3D,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;IAC7B,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;IAC3B,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;IACnC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS;CAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DbErrorDiagnosis {
|
|
2
|
+
/** The driver / OS code when there is one (ECONNREFUSED, ORA-12514, ELOGIN …). */
|
|
3
|
+
code?: string;
|
|
4
|
+
title: string;
|
|
5
|
+
hint: string;
|
|
6
|
+
}
|
|
7
|
+
/** A readable diagnosis of a database error, or null when the cause is not recognised. */
|
|
8
|
+
export declare const describeDbError: (error: unknown) => DbErrorDiagnosis | null;
|
|
9
|
+
//# sourceMappingURL=dbErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dbErrors.d.ts","sourceRoot":"","sources":["../../../src/host/db/dbErrors.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AA2HD,0FAA0F;AAC1F,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,gBAAgB,GAAG,IAMnE,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// What a database driver error actually means, in words a tester can act
|
|
2
|
+
// on: a short title, the likely cause and what to change. Pure (no driver
|
|
3
|
+
// imports), so hosts and the renderer can classify a raw message too. The
|
|
4
|
+
// raw text always stays next to it — this only adds the reading.
|
|
5
|
+
const textOf = (error) => {
|
|
6
|
+
if (typeof error === "string")
|
|
7
|
+
return error;
|
|
8
|
+
if (error && typeof error === "object") {
|
|
9
|
+
const record = error;
|
|
10
|
+
const own = typeof record.message === "string" ? record.message : "";
|
|
11
|
+
const cause = record.cause && typeof record.cause === "object" && typeof record.cause.message === "string" ? ` ${record.cause.message}` : "";
|
|
12
|
+
return `${own}${cause}`;
|
|
13
|
+
}
|
|
14
|
+
return String(error ?? "");
|
|
15
|
+
};
|
|
16
|
+
const codeOf = (error, text) => {
|
|
17
|
+
if (error && typeof error === "object") {
|
|
18
|
+
const record = error;
|
|
19
|
+
if (typeof record.code === "string" && record.code)
|
|
20
|
+
return record.code;
|
|
21
|
+
if (typeof record.errorNum === "number" && record.errorNum > 0)
|
|
22
|
+
return `ORA-${String(record.errorNum).padStart(5, "0")}`;
|
|
23
|
+
if (record.cause && typeof record.cause.code === "string")
|
|
24
|
+
return record.cause.code;
|
|
25
|
+
}
|
|
26
|
+
const match = text.match(/\b(ORA-\d{5}|NJS-\d{3}|DPI-\d{4}|E[A-Z_]{3,}|ER_[A-Z_]+)\b/);
|
|
27
|
+
return match?.[1];
|
|
28
|
+
};
|
|
29
|
+
const has = (text, ...needles) => needles.some((needle) => text.includes(needle));
|
|
30
|
+
const RULES = [
|
|
31
|
+
{
|
|
32
|
+
test: (code, text) => code === "NJS-138" || code === "DPI-1047" || has(text, "NJS-138", "DPI-1047"),
|
|
33
|
+
title: "This Oracle version needs the Oracle Instant Client",
|
|
34
|
+
hint: "Oracle 11g and older need the Instant Client. On the desktop, install it from the connection dialog; for runs on the Callman server, an admin installs it under Database drivers in the admin panel.",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
test: (code, text) => code === "ORA-12514" || has(text, "ORA-12514"),
|
|
38
|
+
title: "Oracle does not know this service name",
|
|
39
|
+
hint: "The listener is reachable but has no service with this name. Check the service name, or switch the connection to SID if the database is known by its SID.",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
test: (code, text) => code === "ORA-12505" || has(text, "ORA-12505"),
|
|
43
|
+
title: "Oracle does not know this SID",
|
|
44
|
+
hint: "The listener is reachable but has no instance with this SID. Check the SID, or switch the connection to service name.",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
test: (code, text) => code === "ORA-12541" || has(text, "ORA-12541"),
|
|
48
|
+
title: "No Oracle listener at this address",
|
|
49
|
+
hint: "Nothing answers as an Oracle listener on this host and port. Check the host and the port (often 1521).",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
test: (code, text) => code === "ORA-01017" || has(text, "ORA-01017"),
|
|
53
|
+
title: "Wrong user name or password",
|
|
54
|
+
hint: "Oracle rejected the credentials. Check the user name and password (passwords are case-sensitive from 11g on).",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
test: (code, text) => code === "EINSTLOOKUP" || /Port for .* not found|instance .* not found|Failed to get response from SQL Server Browser/i.test(text),
|
|
58
|
+
title: "SQL Server instance not found",
|
|
59
|
+
hint: "The named instance could not be looked up. The SQL Server Browser service must be running and UDP port 1434 open, or enter the instance's port and leave the instance name empty.",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
test: (code, text) => code === "ELOGIN" ||
|
|
63
|
+
code === "ER_ACCESS_DENIED_ERROR" ||
|
|
64
|
+
code === "28P01" ||
|
|
65
|
+
/password authentication failed|Login failed for user|Access denied for user|Authentication failed|bad auth/i.test(text),
|
|
66
|
+
title: "Wrong user name or password",
|
|
67
|
+
hint: "The database rejected the credentials. For MongoDB, set the Auth database when the user is defined in another database (often admin). For SQL Server Windows accounts, use a connection string with User Id=DOMAIN\\user.",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
test: (code, text) => code === "ER_BAD_DB_ERROR" || code === "3D000" || /database ".*" does not exist|Unknown database|Cannot open database/i.test(text),
|
|
71
|
+
title: "Database not found",
|
|
72
|
+
hint: "The server is reachable and the login works, but this database does not exist or the user cannot open it. Check the database name.",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
test: (_code, text) => /no pg_hba\.conf entry/i.test(text),
|
|
76
|
+
title: "PostgreSQL refused this client",
|
|
77
|
+
hint: "The server has no access rule for this address, user and database. If the rule requires SSL, turn on TLS; otherwise ask the DBA to allow the address the query runs from (the desktop or the Callman server).",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
test: (_code, text) => /does not support SSL|server does not support SSL|SSL is not enabled on the server|unable to establish SSL/i.test(text),
|
|
81
|
+
title: "The server does not accept encrypted connections",
|
|
82
|
+
hint: "Turn off Encrypt / TLS for this connection, or enable TLS on the database server.",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
test: (code, text) => ["SELF_SIGNED_CERT_IN_CHAIN", "DEPTH_ZERO_SELF_SIGNED_CERT", "UNABLE_TO_VERIFY_LEAF_SIGNATURE", "UNABLE_TO_GET_ISSUER_CERT_LOCALLY", "CERT_HAS_EXPIRED", "ERR_TLS_CERT_ALTNAME_INVALID"].includes(code ?? "") ||
|
|
86
|
+
/self[- ]signed certificate|certificate has expired|unable to verify the first certificate|Hostname\/IP does not match certificate/i.test(text),
|
|
87
|
+
title: "The server's certificate is not trusted",
|
|
88
|
+
hint: "The connection is encrypted but the certificate does not verify. Add the CA certificate (PostgreSQL), tick Trust server certificate (SQL Server, MongoDB), or set NODE_EXTRA_CA_CERTS to the company CA bundle.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
test: (code, text) => code === "ENOTFOUND" || code === "EAI_AGAIN" || /getaddrinfo (ENOTFOUND|EAI_AGAIN)/.test(text),
|
|
92
|
+
title: "Host name not found",
|
|
93
|
+
hint: "The host name does not resolve from where the query runs (the desktop or the Callman server). Check the name, or use the IP address.",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
test: (code, text) => code === "ECONNREFUSED" || /ECONNREFUSED|connection refused/i.test(text),
|
|
97
|
+
title: "Connection refused",
|
|
98
|
+
hint: "Nothing accepts connections on this host and port from where the query runs. Check the host and the port, and that the database listens for remote connections.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
test: (code, text) => code === "ECONNRESET" || code === "EPIPE" || /ECONNRESET|socket hang up|Connection lost|server closed the connection/i.test(text),
|
|
102
|
+
title: "The server closed the connection",
|
|
103
|
+
hint: "Often an encryption mismatch: the server may require Encrypt / TLS (turn it on) or not support it (turn it off). A firewall that resets connections looks the same.",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
test: (code, text) => ["ETIMEDOUT", "ETIMEOUT", "ESOCKETTIMEDOUT", "ORA-12170", "ORA-12535"].includes(code ?? "") ||
|
|
107
|
+
/ETIMEDOUT|timed out|timeout|Server selection timed out|Failed to connect to .* in \d+ms/i.test(text),
|
|
108
|
+
title: "No answer from the database (timeout)",
|
|
109
|
+
hint: "The address did not answer in time. A firewall or network rule probably drops traffic between where the query runs (the desktop or the Callman server) and the database port.",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
test: (code, text) => code === "EHOSTUNREACH" || code === "ENETUNREACH" || /EHOSTUNREACH|ENETUNREACH/.test(text),
|
|
113
|
+
title: "The database network is unreachable",
|
|
114
|
+
hint: "There is no route to this address from where the query runs. Check VPN, routing and firewall rules.",
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
/** A readable diagnosis of a database error, or null when the cause is not recognised. */
|
|
118
|
+
export const describeDbError = (error) => {
|
|
119
|
+
const text = textOf(error);
|
|
120
|
+
const code = codeOf(error, text);
|
|
121
|
+
const rule = RULES.find((entry) => entry.test(code, text));
|
|
122
|
+
if (!rule)
|
|
123
|
+
return null;
|
|
124
|
+
return { ...(code ? { code } : {}), title: rule.title, hint: rule.hint };
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=dbErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dbErrors.js","sourceRoot":"","sources":["../../../src/host/db/dbErrors.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,0EA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IAAI,CAAC,IAAI,CAAC;QAChH,KAAK,EAAE,qCAAqC;QAC5C,IAAI,EAAE,qGAAqG;KAC5G;CACF,CAAC;AAEF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAA2B,EAAE;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;AAC3E,CAAC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { DbConnection } from "./types.js";
|
|
2
|
+
export interface DbPoolSettings {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
/** Connections per database connection, per process. */
|
|
5
|
+
maxPerConnection: number;
|
|
6
|
+
/** Close a connection that sat idle this long. */
|
|
7
|
+
idleTimeoutMs: number;
|
|
8
|
+
/** Give up waiting for a free pooled connection after this long. */
|
|
9
|
+
acquireTimeoutMs: number;
|
|
10
|
+
/** Drop a whole pool that has not been used for this long. */
|
|
11
|
+
evictAfterMs: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DbPoolStats {
|
|
14
|
+
/** Short, non-secret id of the pool (hash of the connection identity). */
|
|
15
|
+
id: string;
|
|
16
|
+
type: DbConnection["type"];
|
|
17
|
+
/** host:port/database (user) — no credentials. */
|
|
18
|
+
target: string;
|
|
19
|
+
max: number;
|
|
20
|
+
open: number;
|
|
21
|
+
inUse: number;
|
|
22
|
+
idle: number;
|
|
23
|
+
waiting: number;
|
|
24
|
+
acquired: number;
|
|
25
|
+
destroyed: number;
|
|
26
|
+
acquireTimeouts: number;
|
|
27
|
+
avgAcquireMs: number;
|
|
28
|
+
maxAcquireMs: number;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
lastUsedAt: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DriverPoolHandle {
|
|
33
|
+
/** Driver-reported open/idle counts when available. */
|
|
34
|
+
stats: () => {
|
|
35
|
+
open?: number;
|
|
36
|
+
idle?: number;
|
|
37
|
+
waiting?: number;
|
|
38
|
+
};
|
|
39
|
+
close: () => Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* The driver's idle sockets/monitors keep the process alive and cannot be
|
|
42
|
+
* unref'd (MongoDB, SQL Server, Oracle): the pool is closed once it has sat
|
|
43
|
+
* idle for IDLE_POOL_CLOSE_MS so a short-lived host can exit.
|
|
44
|
+
*/
|
|
45
|
+
holdsProcess?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface PoolEntry<H extends DriverPoolHandle> {
|
|
48
|
+
key: string;
|
|
49
|
+
idleCloseTimer: ReturnType<typeof setTimeout> | null;
|
|
50
|
+
id: string;
|
|
51
|
+
type: DbConnection["type"];
|
|
52
|
+
target: string;
|
|
53
|
+
handle: H;
|
|
54
|
+
inFlight: number;
|
|
55
|
+
waiting: number;
|
|
56
|
+
acquired: number;
|
|
57
|
+
destroyed: number;
|
|
58
|
+
acquireTimeouts: number;
|
|
59
|
+
acquireMsTotal: number;
|
|
60
|
+
maxAcquireMs: number;
|
|
61
|
+
createdAt: number;
|
|
62
|
+
lastUsedAt: number;
|
|
63
|
+
}
|
|
64
|
+
export declare const configureDbPooling: (partial: Partial<DbPoolSettings>) => DbPoolSettings;
|
|
65
|
+
export declare const getDbPoolSettings: () => DbPoolSettings;
|
|
66
|
+
export declare const isDbPoolingEnabled: () => boolean;
|
|
67
|
+
/** Everything that decides WHICH database session a login yields. */
|
|
68
|
+
export declare const dbConnectionIdentity: (connection: DbConnection) => string;
|
|
69
|
+
/** The pool for `connection`, created once even under a burst of callers. */
|
|
70
|
+
export declare const getOrCreateDbPool: <H extends DriverPoolHandle>(connection: DbConnection, create: () => Promise<H>) => Promise<PoolEntry<H>>;
|
|
71
|
+
export declare class DbPoolAcquireTimeoutError extends Error {
|
|
72
|
+
constructor(target: string, timeoutMs: number);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Acquire through `acquire()` with accounting and a timeout. A connection that
|
|
76
|
+
* arrives after the timeout is handed to `discard` so it is never leaked.
|
|
77
|
+
*/
|
|
78
|
+
export declare const acquirePooled: <C>(entry: PoolEntry<DriverPoolHandle>, acquire: () => Promise<C>, discard: (connection: C) => void) => Promise<{
|
|
79
|
+
connection: C;
|
|
80
|
+
acquireMs: number;
|
|
81
|
+
}>;
|
|
82
|
+
/** Bookkeeping when a pooled connection goes back (or is destroyed). */
|
|
83
|
+
export declare const markReleased: (entry: PoolEntry<DriverPoolHandle>, destroyed: boolean) => void;
|
|
84
|
+
/**
|
|
85
|
+
* True when a statement changes the state of its SESSION (not just data), so
|
|
86
|
+
* the connection must not be handed to another run afterwards. Errs on the
|
|
87
|
+
* side of "yes": a destroyed connection only costs one fresh login.
|
|
88
|
+
*/
|
|
89
|
+
export declare const isSessionMutatingStatement: (query: unknown) => boolean;
|
|
90
|
+
export declare const getDbPoolStats: () => DbPoolStats[];
|
|
91
|
+
/** Close every pool (process shutdown). */
|
|
92
|
+
export declare const closeAllDbPools: () => Promise<void>;
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=dbPool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dbPool.d.ts","sourceRoot":"","sources":["../../../src/host/db/dbPool.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;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M,YAAY,GAAI,OAAO,SAAS,CAAC,gBAAgB,CAAC,EAAE,WAAW,OAAO,KAAG,IAKrF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,OAAO,KAAG,OAS3D,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,WAAW,EAqBzC,CAAC;AAEL,2CAA2C;AAC3C,eAAO,MAAM,eAAe,QAAa,OAAO,CAAC,IAAI,CASpD,CAAC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// Process-wide database connection pools for the scenario DB steps.
|
|
2
|
+
//
|
|
3
|
+
// Without pooling every DB step logs in, runs one statement and closes the
|
|
4
|
+
// connection again. Under a burst (hundreds of scenario runs at once) that is
|
|
5
|
+
// hundreds of simultaneous logins against the same database: the target runs
|
|
6
|
+
// out of connections (MySQL "Too many connections", Oracle ORA-12519) and the
|
|
7
|
+
// login cost dominates the step time. With pooling, steps that target the same
|
|
8
|
+
// connection share a bounded set of warm connections per process.
|
|
9
|
+
//
|
|
10
|
+
// ON by default for every Node host. A host turns it off with
|
|
11
|
+
// `configureDbPooling({ enabled: false })` (the Callman backend maps
|
|
12
|
+
// DB_POOL_ENABLED). Pools never keep a process alive on their own: idle
|
|
13
|
+
// sockets are unref'd where the driver allows it, and a short-lived host
|
|
14
|
+
// (a CLI) should still call `closeAllDbPools()` before it exits.
|
|
15
|
+
//
|
|
16
|
+
// Safety rules that keep pooled connections clean:
|
|
17
|
+
// • a statement that changes SESSION state (SET, USE, ALTER SESSION, BEGIN,
|
|
18
|
+
// temp tables, LOCK, …) gets its connection destroyed after use instead of
|
|
19
|
+
// returned, so no other run inherits the state;
|
|
20
|
+
// • a statement that FAILS destroys its connection too (state unknown);
|
|
21
|
+
// • pools are keyed by the full connection identity (credentials included),
|
|
22
|
+
// so an edited connection gets a new pool; the old one is evicted idle.
|
|
23
|
+
//
|
|
24
|
+
// Node-only (like every other adapter here). No node built-in is imported at
|
|
25
|
+
// module scope: this file is reachable from the renderer bundle via the host
|
|
26
|
+
// barrel and must stay inert there.
|
|
27
|
+
const DEFAULTS = {
|
|
28
|
+
enabled: true,
|
|
29
|
+
maxPerConnection: 10,
|
|
30
|
+
idleTimeoutMs: 60_000,
|
|
31
|
+
acquireTimeoutMs: 30_000,
|
|
32
|
+
evictAfterMs: 10 * 60_000,
|
|
33
|
+
};
|
|
34
|
+
let settings = { ...DEFAULTS };
|
|
35
|
+
const entries = new Map();
|
|
36
|
+
const creating = new Map();
|
|
37
|
+
let sweeper = null;
|
|
38
|
+
const SWEEP_INTERVAL_MS = 30_000;
|
|
39
|
+
const IDLE_POOL_CLOSE_MS = 10_000;
|
|
40
|
+
const cancelIdleClose = (entry) => {
|
|
41
|
+
if (entry.idleCloseTimer) {
|
|
42
|
+
clearTimeout(entry.idleCloseTimer);
|
|
43
|
+
entry.idleCloseTimer = null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const scheduleIdleClose = (entry) => {
|
|
47
|
+
if (!entry.handle.holdsProcess || entry.inFlight > 0 || entry.waiting > 0)
|
|
48
|
+
return;
|
|
49
|
+
cancelIdleClose(entry);
|
|
50
|
+
entry.idleCloseTimer = setTimeout(() => {
|
|
51
|
+
entry.idleCloseTimer = null;
|
|
52
|
+
if (entry.inFlight > 0 || entry.waiting > 0)
|
|
53
|
+
return;
|
|
54
|
+
if (entries.get(entry.key) === entry)
|
|
55
|
+
entries.delete(entry.key);
|
|
56
|
+
void entry.handle.close().catch(() => undefined);
|
|
57
|
+
}, IDLE_POOL_CLOSE_MS);
|
|
58
|
+
entry.idleCloseTimer.unref?.();
|
|
59
|
+
};
|
|
60
|
+
const sweep = async () => {
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
for (const [key, entry] of entries) {
|
|
63
|
+
if (entry.inFlight === 0 && entry.waiting === 0 && now - entry.lastUsedAt > settings.evictAfterMs) {
|
|
64
|
+
entries.delete(key);
|
|
65
|
+
await entry.handle.close().catch(() => undefined);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const ensureSweeper = () => {
|
|
70
|
+
if (sweeper || !settings.enabled)
|
|
71
|
+
return;
|
|
72
|
+
sweeper = setInterval(() => void sweep(), SWEEP_INTERVAL_MS);
|
|
73
|
+
sweeper.unref?.();
|
|
74
|
+
};
|
|
75
|
+
export const configureDbPooling = (partial) => {
|
|
76
|
+
settings = {
|
|
77
|
+
...settings,
|
|
78
|
+
...Object.fromEntries(Object.entries(partial).filter(([, value]) => value !== undefined)),
|
|
79
|
+
};
|
|
80
|
+
settings.maxPerConnection = Math.max(1, Math.floor(settings.maxPerConnection));
|
|
81
|
+
ensureSweeper();
|
|
82
|
+
return { ...settings };
|
|
83
|
+
};
|
|
84
|
+
export const getDbPoolSettings = () => ({ ...settings });
|
|
85
|
+
export const isDbPoolingEnabled = () => settings.enabled;
|
|
86
|
+
// FNV-1a over the identity string, two lanes → 16 hex chars. Only used as a
|
|
87
|
+
// display/stat id; the map itself is keyed by the full identity.
|
|
88
|
+
const shortHash = (text) => {
|
|
89
|
+
let a = 0x811c9dc5;
|
|
90
|
+
let b = 0x01000193;
|
|
91
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
92
|
+
const code = text.charCodeAt(index);
|
|
93
|
+
a = Math.imul(a ^ code, 0x01000193) >>> 0;
|
|
94
|
+
b = Math.imul(b ^ code, 0x811c9dc5) >>> 0;
|
|
95
|
+
}
|
|
96
|
+
return a.toString(16).padStart(8, "0") + b.toString(16).padStart(8, "0");
|
|
97
|
+
};
|
|
98
|
+
/** Everything that decides WHICH database session a login yields. */
|
|
99
|
+
export const dbConnectionIdentity = (connection) => {
|
|
100
|
+
const { id: _id, name: _name, ...rest } = connection;
|
|
101
|
+
const sorted = Object.keys(rest)
|
|
102
|
+
.sort()
|
|
103
|
+
.map((key) => [key, rest[key]]);
|
|
104
|
+
return JSON.stringify(sorted);
|
|
105
|
+
};
|
|
106
|
+
const describeTarget = (connection) => {
|
|
107
|
+
if (connection.connectionString?.trim()) {
|
|
108
|
+
return `${connection.type} (connection string)`;
|
|
109
|
+
}
|
|
110
|
+
const database = connection.database || connection.serviceName || connection.sid || "";
|
|
111
|
+
return `${connection.host}:${connection.port}${database ? `/${database}` : ""}${connection.username ? ` (${connection.username})` : ""}`;
|
|
112
|
+
};
|
|
113
|
+
/** The pool for `connection`, created once even under a burst of callers. */
|
|
114
|
+
export const getOrCreateDbPool = async (connection, create) => {
|
|
115
|
+
const key = dbConnectionIdentity(connection);
|
|
116
|
+
const existing = entries.get(key);
|
|
117
|
+
if (existing)
|
|
118
|
+
return existing;
|
|
119
|
+
const pending = creating.get(key);
|
|
120
|
+
if (pending)
|
|
121
|
+
return (await pending);
|
|
122
|
+
const promise = (async () => {
|
|
123
|
+
const handle = await create();
|
|
124
|
+
const now = Date.now();
|
|
125
|
+
const entry = {
|
|
126
|
+
key,
|
|
127
|
+
idleCloseTimer: null,
|
|
128
|
+
id: shortHash(key),
|
|
129
|
+
type: connection.type,
|
|
130
|
+
target: describeTarget(connection),
|
|
131
|
+
handle,
|
|
132
|
+
inFlight: 0,
|
|
133
|
+
waiting: 0,
|
|
134
|
+
acquired: 0,
|
|
135
|
+
destroyed: 0,
|
|
136
|
+
acquireTimeouts: 0,
|
|
137
|
+
acquireMsTotal: 0,
|
|
138
|
+
maxAcquireMs: 0,
|
|
139
|
+
createdAt: now,
|
|
140
|
+
lastUsedAt: now,
|
|
141
|
+
};
|
|
142
|
+
entries.set(key, entry);
|
|
143
|
+
ensureSweeper();
|
|
144
|
+
return entry;
|
|
145
|
+
})();
|
|
146
|
+
creating.set(key, promise);
|
|
147
|
+
try {
|
|
148
|
+
return (await promise);
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
creating.delete(key);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
export class DbPoolAcquireTimeoutError extends Error {
|
|
155
|
+
constructor(target, timeoutMs) {
|
|
156
|
+
super(`Timed out after ${timeoutMs} ms waiting for a pooled database connection to ${target} — every pooled connection is busy (raise DB_POOL_MAX_PER_CONNECTION or lower the load).`);
|
|
157
|
+
this.name = "DbPoolAcquireTimeoutError";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Acquire through `acquire()` with accounting and a timeout. A connection that
|
|
162
|
+
* arrives after the timeout is handed to `discard` so it is never leaked.
|
|
163
|
+
*/
|
|
164
|
+
export const acquirePooled = async (entry, acquire, discard) => {
|
|
165
|
+
const startedAt = performance.now();
|
|
166
|
+
cancelIdleClose(entry);
|
|
167
|
+
entry.waiting += 1;
|
|
168
|
+
entry.lastUsedAt = Date.now();
|
|
169
|
+
let timedOut = false;
|
|
170
|
+
let timer = null;
|
|
171
|
+
try {
|
|
172
|
+
const connection = await new Promise((resolve, reject) => {
|
|
173
|
+
timer = setTimeout(() => {
|
|
174
|
+
timedOut = true;
|
|
175
|
+
entry.acquireTimeouts += 1;
|
|
176
|
+
reject(new DbPoolAcquireTimeoutError(entry.target, settings.acquireTimeoutMs));
|
|
177
|
+
}, settings.acquireTimeoutMs);
|
|
178
|
+
acquire().then((value) => {
|
|
179
|
+
if (timedOut) {
|
|
180
|
+
discard(value);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
resolve(value);
|
|
184
|
+
}, (error) => {
|
|
185
|
+
if (!timedOut)
|
|
186
|
+
reject(error);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
const acquireMs = Math.round((performance.now() - startedAt) * 100) / 100;
|
|
190
|
+
entry.inFlight += 1;
|
|
191
|
+
entry.acquired += 1;
|
|
192
|
+
entry.acquireMsTotal += acquireMs;
|
|
193
|
+
entry.maxAcquireMs = Math.max(entry.maxAcquireMs, acquireMs);
|
|
194
|
+
return { connection, acquireMs };
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
if (timer)
|
|
198
|
+
clearTimeout(timer);
|
|
199
|
+
entry.waiting = Math.max(0, entry.waiting - 1);
|
|
200
|
+
scheduleIdleClose(entry);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
/** Bookkeeping when a pooled connection goes back (or is destroyed). */
|
|
204
|
+
export const markReleased = (entry, destroyed) => {
|
|
205
|
+
entry.inFlight = Math.max(0, entry.inFlight - 1);
|
|
206
|
+
entry.lastUsedAt = Date.now();
|
|
207
|
+
if (destroyed)
|
|
208
|
+
entry.destroyed += 1;
|
|
209
|
+
scheduleIdleClose(entry);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* True when a statement changes the state of its SESSION (not just data), so
|
|
213
|
+
* the connection must not be handed to another run afterwards. Errs on the
|
|
214
|
+
* side of "yes": a destroyed connection only costs one fresh login.
|
|
215
|
+
*/
|
|
216
|
+
export const isSessionMutatingStatement = (query) => {
|
|
217
|
+
if (typeof query !== "string")
|
|
218
|
+
return false;
|
|
219
|
+
const text = query
|
|
220
|
+
.replace(/--[^\n]*/g, " ")
|
|
221
|
+
.replace(/\/\*[\s\S]*?\*\//g, " ")
|
|
222
|
+
.toUpperCase();
|
|
223
|
+
return /(^|;)\s*(SET\s|RESET\s|USE\s|ALTER\s+SESSION|BEGIN\b|START\s+TRANSACTION|SAVEPOINT|LOCK\s|CREATE\s+(GLOBAL\s+|LOCAL\s+)?TEMP|DECLARE\s|PRAGMA\s|EXEC(UTE)?\s+SP_SET|DBMS_SESSION|DBMS_APPLICATION_INFO)/.test(text);
|
|
224
|
+
};
|
|
225
|
+
export const getDbPoolStats = () => [...entries.values()].map((entry) => {
|
|
226
|
+
const driver = entry.handle.stats();
|
|
227
|
+
const open = driver.open ?? entry.inFlight;
|
|
228
|
+
return {
|
|
229
|
+
id: entry.id,
|
|
230
|
+
type: entry.type,
|
|
231
|
+
target: entry.target,
|
|
232
|
+
max: settings.maxPerConnection,
|
|
233
|
+
open,
|
|
234
|
+
inUse: entry.inFlight,
|
|
235
|
+
idle: driver.idle ?? Math.max(0, open - entry.inFlight),
|
|
236
|
+
waiting: Math.max(entry.waiting, driver.waiting ?? 0),
|
|
237
|
+
acquired: entry.acquired,
|
|
238
|
+
destroyed: entry.destroyed,
|
|
239
|
+
acquireTimeouts: entry.acquireTimeouts,
|
|
240
|
+
avgAcquireMs: entry.acquired > 0 ? Math.round((entry.acquireMsTotal / entry.acquired) * 100) / 100 : 0,
|
|
241
|
+
maxAcquireMs: Math.round(entry.maxAcquireMs * 100) / 100,
|
|
242
|
+
createdAt: new Date(entry.createdAt).toISOString(),
|
|
243
|
+
lastUsedAt: new Date(entry.lastUsedAt).toISOString(),
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
/** Close every pool (process shutdown). */
|
|
247
|
+
export const closeAllDbPools = async () => {
|
|
248
|
+
const all = [...entries.values()];
|
|
249
|
+
for (const entry of all)
|
|
250
|
+
cancelIdleClose(entry);
|
|
251
|
+
entries.clear();
|
|
252
|
+
if (sweeper) {
|
|
253
|
+
clearInterval(sweeper);
|
|
254
|
+
sweeper = null;
|
|
255
|
+
}
|
|
256
|
+
await Promise.all(all.map((entry) => entry.handle.close().catch(() => undefined)));
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=dbPool.js.map
|