@proteinjs/db-driver-knex 1.13.8 → 1.14.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/CHANGELOG.md +25 -0
- package/README.md +10 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/test/index.js +1 -1
- package/dist/generated/test/index.js.map +1 -1
- 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/src/KnexDriver.d.ts +66 -0
- package/dist/src/KnexDriver.d.ts.map +1 -1
- package/dist/src/KnexDriver.js +181 -1
- package/dist/src/KnexDriver.js.map +1 -1
- package/dist/src/KnexLogValues.d.ts +38 -0
- package/dist/src/KnexLogValues.d.ts.map +1 -0
- package/dist/src/KnexLogValues.js +47 -0
- package/dist/src/KnexLogValues.js.map +1 -0
- package/dist/test/LogValuesSwitch.test.d.ts +2 -0
- package/dist/test/LogValuesSwitch.test.d.ts.map +1 -0
- package/dist/test/LogValuesSwitch.test.js +255 -0
- package/dist/test/LogValuesSwitch.test.js.map +1 -0
- package/dist/test/StatementLogNeverThrows.test.d.ts +2 -0
- package/dist/test/StatementLogNeverThrows.test.d.ts.map +1 -0
- package/dist/test/StatementLogNeverThrows.test.js +541 -0
- package/dist/test/StatementLogNeverThrows.test.js.map +1 -0
- package/dist/test/StatementParamLogging.test.d.ts +2 -0
- package/dist/test/StatementParamLogging.test.d.ts.map +1 -0
- package/dist/test/StatementParamLogging.test.js +403 -0
- package/dist/test/StatementParamLogging.test.js.map +1 -0
- package/dist/test/util/printedLine.d.ts +20 -0
- package/dist/test/util/printedLine.d.ts.map +1 -0
- package/dist/test/util/printedLine.js +48 -0
- package/dist/test/util/printedLine.js.map +1 -0
- package/generated/index.ts +1 -1
- package/generated/test/index.ts +1 -1
- package/index.ts +1 -0
- package/package.json +5 -5
- package/src/KnexDriver.ts +191 -2
- package/src/KnexLogValues.ts +42 -0
- package/test/LogValuesSwitch.test.ts +201 -0
- package/test/StatementLogNeverThrows.test.ts +466 -0
- package/test/StatementParamLogging.test.ts +313 -0
- package/test/util/printedLine.ts +43 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexDriver.js","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KnexDriver.js","sourceRoot":"","sources":["../../src/KnexDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAyC;AACzC,oCAQuB;AAEvB,iDAAgD;AAChD,4CAA2C;AAE3C,+DAA8D;AAC9D,iEAAgE;AAchE;;GAEG;AACH;IAOE,oBAAY,MAAkB,EAAE,QAAuC;QAL/D,WAAM,GAAG,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAM3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG;YAChB,MAAM,EAAE,OAAO;YACf,UAAU,EAAE;gBACV,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;gBACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;gBACtB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;aAC/B;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,4BAAO,GAAP;QACE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACpB,UAAU,CAAC,IAAI,GAAG,IAAA,cAAI,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACzC;QAED,OAAO,UAAU,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,8BAAS,GAAT;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAgB,CAAC;IACtC,CAAC;IAEK,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K,CAAsD,IAAI,CAAC,CAAC;SAC1E;QAAC,WAAM;YACN,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AAxVD,IAwVC;AAxVY,gCAAU"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE owner of the dev-only switch that lets the driver's failure line carry the REAL values
|
|
3
|
+
* of a statement's bound parameters, and of the fields that carry them.
|
|
4
|
+
*
|
|
5
|
+
* By default the line carries no bound value: the parameters are described
|
|
6
|
+
* (KnexDriver.describeParams — positions, kinds, lengths) and the failure is summarized by the
|
|
7
|
+
* vendor's codes and the server's own message — never by the vendor error itself, whose `message`
|
|
8
|
+
* the query layer rewrites to the SQL with every binding INTERPOLATED (and whose `sql` is the
|
|
9
|
+
* same text). A parameter is row content, and a log line outlives and out-travels the row it came
|
|
10
|
+
* from. A local dev database holds nothing that needs that protection, and there the values are
|
|
11
|
+
* what locates a bug. So the switch: when BOTH `DEVELOPMENT` is set (the dev-server switch, never
|
|
12
|
+
* set in a production image) AND `DB_LOG_PARAM_VALUES=1`, the line adds `paramValues` — the
|
|
13
|
+
* parameters as they were bound — and carries the vendor error itself as `error`. With either
|
|
14
|
+
* unset: never. Both are read at each line, so a process cannot hold a stale answer.
|
|
15
|
+
*
|
|
16
|
+
* The switch adds FIELDS to a log line and changes nothing else: what the driver throws is the
|
|
17
|
+
* same with the switch on or off.
|
|
18
|
+
*/
|
|
19
|
+
export declare class KnexLogValues {
|
|
20
|
+
/** The dev-server switch: the first gate. */
|
|
21
|
+
static readonly DEVELOPMENT_VAR = "DEVELOPMENT";
|
|
22
|
+
/** The values switch: the second gate, on only as exactly `1`. */
|
|
23
|
+
static readonly SWITCH_VAR = "DB_LOG_PARAM_VALUES";
|
|
24
|
+
/** Whether lines may carry real values right now — both gates, read now. */
|
|
25
|
+
static enabled(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* What a statement's line adds beside its described parameters: `{ paramValues }` — the bindings
|
|
28
|
+
* as the statement carried them, positional or a bindings dictionary — or nothing.
|
|
29
|
+
*/
|
|
30
|
+
static ofStatement(params: unknown): {
|
|
31
|
+
paramValues?: unknown;
|
|
32
|
+
};
|
|
33
|
+
/** What a failure's line carries beside its cause summary: the vendor error itself as `{ error }`, or nothing. */
|
|
34
|
+
static ofFailure(error: unknown): {
|
|
35
|
+
error?: unknown;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=KnexLogValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KnexLogValues.d.ts","sourceRoot":"","sources":["../../src/KnexLogValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAa;IACxB,6CAA6C;IAC7C,MAAM,CAAC,QAAQ,CAAC,eAAe,iBAAiB;IAChD,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,UAAU,yBAAyB;IAEnD,4EAA4E;IAC5E,MAAM,CAAC,OAAO,IAAI,OAAO;IAIzB;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE;IAI9D,kHAAkH;IAClH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAGtD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KnexLogValues = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The ONE owner of the dev-only switch that lets the driver's failure line carry the REAL values
|
|
6
|
+
* of a statement's bound parameters, and of the fields that carry them.
|
|
7
|
+
*
|
|
8
|
+
* By default the line carries no bound value: the parameters are described
|
|
9
|
+
* (KnexDriver.describeParams — positions, kinds, lengths) and the failure is summarized by the
|
|
10
|
+
* vendor's codes and the server's own message — never by the vendor error itself, whose `message`
|
|
11
|
+
* the query layer rewrites to the SQL with every binding INTERPOLATED (and whose `sql` is the
|
|
12
|
+
* same text). A parameter is row content, and a log line outlives and out-travels the row it came
|
|
13
|
+
* from. A local dev database holds nothing that needs that protection, and there the values are
|
|
14
|
+
* what locates a bug. So the switch: when BOTH `DEVELOPMENT` is set (the dev-server switch, never
|
|
15
|
+
* set in a production image) AND `DB_LOG_PARAM_VALUES=1`, the line adds `paramValues` — the
|
|
16
|
+
* parameters as they were bound — and carries the vendor error itself as `error`. With either
|
|
17
|
+
* unset: never. Both are read at each line, so a process cannot hold a stale answer.
|
|
18
|
+
*
|
|
19
|
+
* The switch adds FIELDS to a log line and changes nothing else: what the driver throws is the
|
|
20
|
+
* same with the switch on or off.
|
|
21
|
+
*/
|
|
22
|
+
var KnexLogValues = /** @class */ (function () {
|
|
23
|
+
function KnexLogValues() {
|
|
24
|
+
}
|
|
25
|
+
/** Whether lines may carry real values right now — both gates, read now. */
|
|
26
|
+
KnexLogValues.enabled = function () {
|
|
27
|
+
return !!process.env[KnexLogValues.DEVELOPMENT_VAR] && process.env[KnexLogValues.SWITCH_VAR] === '1';
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* What a statement's line adds beside its described parameters: `{ paramValues }` — the bindings
|
|
31
|
+
* as the statement carried them, positional or a bindings dictionary — or nothing.
|
|
32
|
+
*/
|
|
33
|
+
KnexLogValues.ofStatement = function (params) {
|
|
34
|
+
return KnexLogValues.enabled() && params !== undefined ? { paramValues: params } : {};
|
|
35
|
+
};
|
|
36
|
+
/** What a failure's line carries beside its cause summary: the vendor error itself as `{ error }`, or nothing. */
|
|
37
|
+
KnexLogValues.ofFailure = function (error) {
|
|
38
|
+
return KnexLogValues.enabled() ? { error: error } : {};
|
|
39
|
+
};
|
|
40
|
+
/** The dev-server switch: the first gate. */
|
|
41
|
+
KnexLogValues.DEVELOPMENT_VAR = 'DEVELOPMENT';
|
|
42
|
+
/** The values switch: the second gate, on only as exactly `1`. */
|
|
43
|
+
KnexLogValues.SWITCH_VAR = 'DB_LOG_PARAM_VALUES';
|
|
44
|
+
return KnexLogValues;
|
|
45
|
+
}());
|
|
46
|
+
exports.KnexLogValues = KnexLogValues;
|
|
47
|
+
//# sourceMappingURL=KnexLogValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KnexLogValues.js","sourceRoot":"","sources":["../../src/KnexLogValues.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAAA;IAuBA,CAAC;IAjBC,4EAA4E;IACrE,qBAAO,GAAd;QACE,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC;IACvG,CAAC;IAED;;;OAGG;IACI,yBAAW,GAAlB,UAAmB,MAAe;QAChC,OAAO,aAAa,CAAC,OAAO,EAAE,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxF,CAAC;IAED,kHAAkH;IAC3G,uBAAS,GAAhB,UAAiB,KAAc;QAC7B,OAAO,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClD,CAAC;IArBD,6CAA6C;IAC7B,6BAAe,GAAG,aAAa,CAAC;IAChD,kEAAkE;IAClD,wBAAU,GAAG,qBAAqB,CAAC;IAmBrD,oBAAC;CAAA,AAvBD,IAuBC;AAvBY,sCAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogValuesSwitch.test.d.ts","sourceRoot":"","sources":["../../test/LogValuesSwitch.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var knex_1 = __importDefault(require("knex"));
|
|
43
|
+
var db_driver_knex_1 = require("@proteinjs/db-driver-knex");
|
|
44
|
+
var logger_1 = require("@proteinjs/logger");
|
|
45
|
+
var printedLine_1 = require("./util/printedLine");
|
|
46
|
+
/**
|
|
47
|
+
* The dev-only values switch (`KnexLogValues`): the driver's failure line carries the REAL values
|
|
48
|
+
* of the bound parameters — `paramValues`, and the vendor error itself as `error` — only when BOTH
|
|
49
|
+
* `DEVELOPMENT` is set AND `DB_LOG_PARAM_VALUES=1`. With either gate closed: never.
|
|
50
|
+
*
|
|
51
|
+
* By default the line describes the parameters and summarizes the failure
|
|
52
|
+
* (StatementParamLogging.test.ts holds that). On a local dev database the values are what locates
|
|
53
|
+
* a bug, so there — and only there — the line adds them, beside the description, which stays. What
|
|
54
|
+
* a caller CATCHES is the same error whatever the switch says: the switch adds fields to a line
|
|
55
|
+
* and changes nothing else.
|
|
56
|
+
*
|
|
57
|
+
* No server is needed: the REAL query layer and dialect run over a stub connection that rejects
|
|
58
|
+
* the way the client library does. The stub server's message quotes no bound value: what the
|
|
59
|
+
* SERVER echoes is not this switch's subject (see StatementParamLogging.test.ts's header).
|
|
60
|
+
*/
|
|
61
|
+
// A fixture value shaped like row content (not a real credential).
|
|
62
|
+
var VALUE = 'rst_5d41402abc4b2a76b9719d911017c592';
|
|
63
|
+
/** A connection that rejects every statement like a missing table — a server message that quotes no binding. */
|
|
64
|
+
var rejectingConnection = function () {
|
|
65
|
+
var mysql = require('mysql');
|
|
66
|
+
return {
|
|
67
|
+
state: 'authenticated',
|
|
68
|
+
on: function () { return undefined; },
|
|
69
|
+
removeAllListeners: function () { return undefined; },
|
|
70
|
+
connect: function (done) { return done(); },
|
|
71
|
+
end: function (done) { return done(); },
|
|
72
|
+
query: function (options, bindings, done) {
|
|
73
|
+
var sqlMessage = "Table 'test.credential' doesn't exist";
|
|
74
|
+
done(Object.assign(new Error("ER_NO_SUCH_TABLE: ".concat(sqlMessage)), {
|
|
75
|
+
code: 'ER_NO_SUCH_TABLE',
|
|
76
|
+
errno: 1146,
|
|
77
|
+
sqlState: '42S02',
|
|
78
|
+
sqlMessage: sqlMessage,
|
|
79
|
+
sql: mysql.format(options.sql, bindings),
|
|
80
|
+
}));
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
var GATES = [
|
|
85
|
+
['DEVELOPMENT set AND DB_LOG_PARAM_VALUES=1', { DEVELOPMENT: 'true', DB_LOG_PARAM_VALUES: '1' }, true],
|
|
86
|
+
['DEVELOPMENT unset, DB_LOG_PARAM_VALUES=1', { DB_LOG_PARAM_VALUES: '1' }, false],
|
|
87
|
+
['DEVELOPMENT empty, DB_LOG_PARAM_VALUES=1', { DEVELOPMENT: '', DB_LOG_PARAM_VALUES: '1' }, false],
|
|
88
|
+
['DEVELOPMENT set, DB_LOG_PARAM_VALUES unset', { DEVELOPMENT: 'true' }, false],
|
|
89
|
+
[
|
|
90
|
+
'DEVELOPMENT set, DB_LOG_PARAM_VALUES=true (on only as exactly 1)',
|
|
91
|
+
{ DEVELOPMENT: 'true', DB_LOG_PARAM_VALUES: 'true' },
|
|
92
|
+
false,
|
|
93
|
+
],
|
|
94
|
+
['DEVELOPMENT set, DB_LOG_PARAM_VALUES=0', { DEVELOPMENT: 'true', DB_LOG_PARAM_VALUES: '0' }, false],
|
|
95
|
+
['neither set', {}, false],
|
|
96
|
+
];
|
|
97
|
+
describe('the dev-only values switch: real values ride the driver`s failure line only behind both gates', function () {
|
|
98
|
+
var driver = new db_driver_knex_1.KnexDriver({ host: 'localhost', user: 'root', password: '', dbName: 'test' });
|
|
99
|
+
var internals = driver;
|
|
100
|
+
var statics = db_driver_knex_1.KnexDriver;
|
|
101
|
+
var ENV = [db_driver_knex_1.KnexLogValues.DEVELOPMENT_VAR, db_driver_knex_1.KnexLogValues.SWITCH_VAR];
|
|
102
|
+
var envBefore = {};
|
|
103
|
+
var captured = [];
|
|
104
|
+
var instance;
|
|
105
|
+
var previousInstance;
|
|
106
|
+
beforeAll(function () {
|
|
107
|
+
instance = (0, knex_1.default)({ client: 'mysql', connection: { host: 'localhost', user: 'root', password: '' } });
|
|
108
|
+
instance.client.driver = { createConnection: rejectingConnection };
|
|
109
|
+
previousInstance = statics.KNEX;
|
|
110
|
+
statics.KNEX = instance;
|
|
111
|
+
internals.logger = new logger_1.Logger({
|
|
112
|
+
name: 'KnexDriver',
|
|
113
|
+
logLevel: 'debug',
|
|
114
|
+
logWriter: { write: function (log) { return captured.push(log); } },
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
statics.KNEX = previousInstance;
|
|
122
|
+
return [4 /*yield*/, instance.destroy()];
|
|
123
|
+
case 1:
|
|
124
|
+
_a.sent();
|
|
125
|
+
return [2 /*return*/];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}); });
|
|
129
|
+
beforeEach(function () {
|
|
130
|
+
captured = [];
|
|
131
|
+
for (var _i = 0, ENV_1 = ENV; _i < ENV_1.length; _i++) {
|
|
132
|
+
var name_1 = ENV_1[_i];
|
|
133
|
+
envBefore[name_1] = process.env[name_1];
|
|
134
|
+
delete process.env[name_1];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
afterEach(function () {
|
|
138
|
+
for (var _i = 0, ENV_2 = ENV; _i < ENV_2.length; _i++) {
|
|
139
|
+
var name_2 = ENV_2[_i];
|
|
140
|
+
if (envBefore[name_2] === undefined) {
|
|
141
|
+
delete process.env[name_2];
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
process.env[name_2] = envBefore[name_2];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
var params = [VALUE, 42];
|
|
149
|
+
var failingInsert = function () {
|
|
150
|
+
return driver
|
|
151
|
+
.runDml(function () { return ({ sql: 'INSERT INTO `credential` (`id`, `n`) VALUES (?, ?)', params: params }); })
|
|
152
|
+
.then(function () { return 'resolved'; }, function (error) { return error; });
|
|
153
|
+
};
|
|
154
|
+
/** Everything a caller can read off a caught error. */
|
|
155
|
+
var facts = function (error) { return ({
|
|
156
|
+
class: error.constructor.name,
|
|
157
|
+
message: error.message,
|
|
158
|
+
own: Object.getOwnPropertyNames(error)
|
|
159
|
+
.sort()
|
|
160
|
+
.map(function (name) { return [name, name === 'stack' ? '(stack)' : error[name]]; }),
|
|
161
|
+
}); };
|
|
162
|
+
test.each(GATES)('%s', function (_gate, env, on) { return __awaiter(void 0, void 0, void 0, function () {
|
|
163
|
+
var baseline, _a, caught, failures, failure, _i, captured_1, log;
|
|
164
|
+
var _b;
|
|
165
|
+
return __generator(this, function (_c) {
|
|
166
|
+
switch (_c.label) {
|
|
167
|
+
case 0:
|
|
168
|
+
_a = facts;
|
|
169
|
+
return [4 /*yield*/, failingInsert()];
|
|
170
|
+
case 1:
|
|
171
|
+
baseline = _a.apply(void 0, [_c.sent()]);
|
|
172
|
+
captured = [];
|
|
173
|
+
Object.assign(process.env, env);
|
|
174
|
+
return [4 /*yield*/, failingInsert()];
|
|
175
|
+
case 2:
|
|
176
|
+
caught = _c.sent();
|
|
177
|
+
expect(db_driver_knex_1.KnexLogValues.enabled()).toBe(on);
|
|
178
|
+
failures = captured.filter(function (log) { return log.message === 'Failed when executing sql'; });
|
|
179
|
+
expect(failures).toHaveLength(1);
|
|
180
|
+
failure = failures[0];
|
|
181
|
+
// What a caller catches is the same whatever the switch says.
|
|
182
|
+
expect(facts(caught)).toEqual(baseline);
|
|
183
|
+
// The description and the summary ride the line at every gate.
|
|
184
|
+
expect(failure.obj.params).toEqual([{ type: 'string', length: VALUE.length }, { type: 'number' }]);
|
|
185
|
+
expect(failure.obj.cause).toEqual({
|
|
186
|
+
name: 'Error',
|
|
187
|
+
code: 'ER_NO_SUCH_TABLE',
|
|
188
|
+
errno: 1146,
|
|
189
|
+
sqlState: '42S02',
|
|
190
|
+
sqlMessage: "Table 'test.credential' doesn't exist",
|
|
191
|
+
});
|
|
192
|
+
if (!on) {
|
|
193
|
+
for (_i = 0, captured_1 = captured; _i < captured_1.length; _i++) {
|
|
194
|
+
log = captured_1[_i];
|
|
195
|
+
expect((0, printedLine_1.lineOf)(log)).not.toContain(VALUE);
|
|
196
|
+
expect(Object.keys((_b = log.obj) !== null && _b !== void 0 ? _b : {})).not.toContain('paramValues');
|
|
197
|
+
expect(log.error).toBeUndefined();
|
|
198
|
+
}
|
|
199
|
+
return [2 /*return*/];
|
|
200
|
+
}
|
|
201
|
+
// The values as bound, BESIDE the description; and the vendor error itself, as it was thrown.
|
|
202
|
+
expect(failure.obj.paramValues).toEqual(params);
|
|
203
|
+
expect(failure.error).toBe(caught);
|
|
204
|
+
expect((0, printedLine_1.lineOf)(failure)).toContain(VALUE);
|
|
205
|
+
return [2 /*return*/];
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}); });
|
|
209
|
+
// A bindings DICTIONARY — wider than `Statement` declares, and what the query layer accepts.
|
|
210
|
+
var namedParams = { id: VALUE, n: 42 };
|
|
211
|
+
var failingNamedInsert = function () {
|
|
212
|
+
return driver
|
|
213
|
+
.runDml(function () { return ({ sql: 'INSERT INTO `credential` (`id`, `n`) VALUES (:id, :n)', params: namedParams }); })
|
|
214
|
+
.then(function () { return 'resolved'; }, function (error) { return error; });
|
|
215
|
+
};
|
|
216
|
+
test.each(GATES)('a bindings dictionary rides the same switch — %s', function (_gate, env, on) { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
|
+
var baseline, _a, caught, failures, failure, _i, captured_2, log;
|
|
218
|
+
var _b;
|
|
219
|
+
return __generator(this, function (_c) {
|
|
220
|
+
switch (_c.label) {
|
|
221
|
+
case 0:
|
|
222
|
+
_a = facts;
|
|
223
|
+
return [4 /*yield*/, failingNamedInsert()];
|
|
224
|
+
case 1:
|
|
225
|
+
baseline = _a.apply(void 0, [_c.sent()]);
|
|
226
|
+
captured = [];
|
|
227
|
+
Object.assign(process.env, env);
|
|
228
|
+
return [4 /*yield*/, failingNamedInsert()];
|
|
229
|
+
case 2:
|
|
230
|
+
caught = _c.sent();
|
|
231
|
+
failures = captured.filter(function (log) { return log.message === 'Failed when executing sql'; });
|
|
232
|
+
expect(failures).toHaveLength(1);
|
|
233
|
+
failure = failures[0];
|
|
234
|
+
expect(caught.code).toBe('ER_NO_SUCH_TABLE');
|
|
235
|
+
expect(facts(caught)).toEqual(baseline);
|
|
236
|
+
// The description, by entry name, rides the line at every gate.
|
|
237
|
+
expect(failure.obj.params).toEqual({ id: { type: 'string', length: VALUE.length }, n: { type: 'number' } });
|
|
238
|
+
if (!on) {
|
|
239
|
+
for (_i = 0, captured_2 = captured; _i < captured_2.length; _i++) {
|
|
240
|
+
log = captured_2[_i];
|
|
241
|
+
expect((0, printedLine_1.lineOf)(log)).not.toContain(VALUE);
|
|
242
|
+
expect(Object.keys((_b = log.obj) !== null && _b !== void 0 ? _b : {})).not.toContain('paramValues');
|
|
243
|
+
expect(log.error).toBeUndefined();
|
|
244
|
+
}
|
|
245
|
+
return [2 /*return*/];
|
|
246
|
+
}
|
|
247
|
+
// The dictionary as bound, BESIDE the description; and the vendor error itself, as it was thrown.
|
|
248
|
+
expect(failure.obj.paramValues).toEqual(namedParams);
|
|
249
|
+
expect(failure.error).toBe(caught);
|
|
250
|
+
return [2 /*return*/];
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}); });
|
|
254
|
+
});
|
|
255
|
+
//# sourceMappingURL=LogValuesSwitch.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogValuesSwitch.test.js","sourceRoot":"","sources":["../../test/LogValuesSwitch.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,4DAAsE;AACtE,4CAA2C;AAC3C,kDAAyD;AAEzD;;;;;;;;;;;;;;GAcG;AAEH,mEAAmE;AACnE,IAAM,KAAK,GAAG,sCAAsC,CAAC;AAKrD,gHAAgH;AAChH,IAAM,mBAAmB,GAAG;IAC1B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO;QACL,KAAK,EAAE,eAAe;QACtB,EAAE,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;QACnB,kBAAkB,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;QACnC,OAAO,EAAE,UAAC,IAA6B,IAAK,OAAA,IAAI,EAAE,EAAN,CAAM;QAClD,GAAG,EAAE,UAAC,IAA6B,IAAK,OAAA,IAAI,EAAE,EAAN,CAAM;QAC9C,KAAK,EAAE,UAAC,OAAwB,EAAE,QAAe,EAAE,IAA4B;YAC7E,IAAM,UAAU,GAAG,uCAAuC,CAAC;YAC3D,IAAI,CACF,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4BAAqB,UAAU,CAAE,CAAC,EAAE;gBAC1D,IAAI,EAAE,kBAAkB;gBAC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