slonik-interceptor-query-logging 47.3.1 → 48.0.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 +8 -0
- package/dist/factories/createQueryLoggingInterceptor.d.ts +1 -1
- package/dist/factories/createQueryLoggingInterceptor.d.ts.map +1 -1
- package/dist/factories/createQueryLoggingInterceptor.js +10 -17
- package/dist/factories/createQueryLoggingInterceptor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/utilities/getAutoExplainPayload.js +3 -7
- package/dist/utilities/getAutoExplainPayload.js.map +1 -1
- package/dist/utilities/getAutoExplainPayload.test.js +8 -13
- package/dist/utilities/getAutoExplainPayload.test.js.map +1 -1
- package/dist/utilities/isAutoExplainJsonMessage.js +1 -5
- package/dist/utilities/isAutoExplainJsonMessage.js.map +1 -1
- package/dist/utilities/isAutoExplainJsonMessage.test.js +4 -9
- package/dist/utilities/isAutoExplainJsonMessage.test.js.map +1 -1
- package/eslint.config.js +4 -0
- package/package.json +13 -11
- package/src/factories/createQueryLoggingInterceptor.ts +3 -3
- package/src/index.ts +1 -1
- package/src/utilities/getAutoExplainPayload.test.ts +1 -1
- package/src/utilities/isAutoExplainJsonMessage.test.ts +1 -1
- package/tsconfig.json +3 -3
- package/eslint.config.cjs +0 -1
- package/src/.eslintrc +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# slonik-interceptor-query-logging
|
|
2
2
|
|
|
3
|
+
## 48.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#692](https://github.com/gajus/slonik/pull/692) [`31db3aa`](https://github.com/gajus/slonik/commit/31db3aa0f0f64cd2fadfc854815d2c0e346b75be) Thanks [@gajus](https://github.com/gajus)! - migrate to esm
|
|
8
|
+
|
|
9
|
+
## 47.3.2
|
|
10
|
+
|
|
3
11
|
## 47.3.1
|
|
4
12
|
|
|
5
13
|
## 47.3.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQueryLoggingInterceptor.d.ts","sourceRoot":"","sources":["../../src/factories/createQueryLoggingInterceptor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createQueryLoggingInterceptor.d.ts","sourceRoot":"","sources":["../../src/factories/createQueryLoggingInterceptor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C;;GAEG;AACH,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAgBF,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,qBAAqB,KACxC,WAiGF,CAAC"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createQueryLoggingInterceptor = void 0;
|
|
7
|
-
const getAutoExplainPayload_1 = require("../utilities/getAutoExplainPayload");
|
|
8
|
-
const isAutoExplainJsonMessage_1 = require("../utilities/isAutoExplainJsonMessage");
|
|
9
|
-
const pretty_ms_1 = __importDefault(require("pretty-ms"));
|
|
10
|
-
const serialize_error_1 = require("serialize-error");
|
|
1
|
+
import { getAutoExplainPayload } from '../utilities/getAutoExplainPayload.js';
|
|
2
|
+
import { isAutoExplainJsonMessage } from '../utilities/isAutoExplainJsonMessage.js';
|
|
3
|
+
import prettyMs from 'pretty-ms';
|
|
4
|
+
import { serializeError } from 'serialize-error';
|
|
11
5
|
const stringifyCallSite = (callSite) => {
|
|
12
6
|
return ((callSite.fileName || '') +
|
|
13
7
|
':' +
|
|
@@ -18,7 +12,7 @@ const stringifyCallSite = (callSite) => {
|
|
|
18
12
|
const defaultConfiguration = {
|
|
19
13
|
logValues: true,
|
|
20
14
|
};
|
|
21
|
-
const createQueryLoggingInterceptor = (userConfiguration) => {
|
|
15
|
+
export const createQueryLoggingInterceptor = (userConfiguration) => {
|
|
22
16
|
const configuration = {
|
|
23
17
|
...defaultConfiguration,
|
|
24
18
|
...userConfiguration,
|
|
@@ -33,15 +27,15 @@ const createQueryLoggingInterceptor = (userConfiguration) => {
|
|
|
33
27
|
if (!notice.message) {
|
|
34
28
|
continue;
|
|
35
29
|
}
|
|
36
|
-
if (
|
|
30
|
+
if (isAutoExplainJsonMessage(notice.message)) {
|
|
37
31
|
context.log.info({
|
|
38
|
-
autoExplain:
|
|
32
|
+
autoExplain: getAutoExplainPayload(notice.message),
|
|
39
33
|
}, 'auto explain');
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
context.log.debug({
|
|
43
|
-
executionTime: (
|
|
44
|
-
|
|
37
|
+
executionTime: prettyMs(Number(process.hrtime.bigint() - BigInt(context.queryInputTime)) /
|
|
38
|
+
1_000_000),
|
|
45
39
|
rowCount,
|
|
46
40
|
}, 'query execution result');
|
|
47
41
|
return null;
|
|
@@ -81,11 +75,10 @@ const createQueryLoggingInterceptor = (userConfiguration) => {
|
|
|
81
75
|
name: 'slonik-interceptor-query-logging',
|
|
82
76
|
queryExecutionError: (context, query, error) => {
|
|
83
77
|
context.log.error({
|
|
84
|
-
error:
|
|
78
|
+
error: serializeError(error),
|
|
85
79
|
}, 'query execution produced an error');
|
|
86
80
|
return null;
|
|
87
81
|
},
|
|
88
82
|
};
|
|
89
83
|
};
|
|
90
|
-
exports.createQueryLoggingInterceptor = createQueryLoggingInterceptor;
|
|
91
84
|
//# sourceMappingURL=createQueryLoggingInterceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQueryLoggingInterceptor.js","sourceRoot":"","sources":["../../src/factories/createQueryLoggingInterceptor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createQueryLoggingInterceptor.js","sourceRoot":"","s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,OAAO,CAAC,GAAG,CAAC,KAAK,CACf;gBACE,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,UAAU;gBACV,MAAM;aACP,EACD,iBAAiB,CAClB,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,EAAE,kCAAkC;QACxC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CACf;gBACE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC;aAC7B,EACD,mCAAmC,CACpC,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createQueryLoggingInterceptor } from './factories/createQueryLoggingInterceptor';
|
|
1
|
+
export { createQueryLoggingInterceptor } from './factories/createQueryLoggingInterceptor.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createQueryLoggingInterceptor = void 0;
|
|
4
|
-
var createQueryLoggingInterceptor_1 = require("./factories/createQueryLoggingInterceptor");
|
|
5
|
-
Object.defineProperty(exports, "createQueryLoggingInterceptor", { enumerable: true, get: function () { return createQueryLoggingInterceptor_1.createQueryLoggingInterceptor; } });
|
|
1
|
+
export { createQueryLoggingInterceptor } from './factories/createQueryLoggingInterceptor.js';
|
|
6
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const crack_json_1 = require("crack-json");
|
|
5
|
-
const getAutoExplainPayload = (noticeMessage) => {
|
|
6
|
-
const matches = (0, crack_json_1.extractJson)(noticeMessage);
|
|
1
|
+
import { extractJson } from 'crack-json';
|
|
2
|
+
export const getAutoExplainPayload = (noticeMessage) => {
|
|
3
|
+
const matches = extractJson(noticeMessage);
|
|
7
4
|
if (matches.length === 0) {
|
|
8
5
|
throw new Error('Notice message does not contain a recognizable JSON payload.');
|
|
9
6
|
}
|
|
@@ -12,5 +9,4 @@ const getAutoExplainPayload = (noticeMessage) => {
|
|
|
12
9
|
}
|
|
13
10
|
return matches[0];
|
|
14
11
|
};
|
|
15
|
-
exports.getAutoExplainPayload = getAutoExplainPayload;
|
|
16
12
|
//# sourceMappingURL=getAutoExplainPayload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAutoExplainPayload.js","sourceRoot":"","sources":["../../src/utilities/getAutoExplainPayload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getAutoExplainPayload.js","sourceRoot":"","sources":["../../src/utilities/getAutoExplainPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,aAAqB,EAAE,EAAE;IAC7D,MAAM,OAAO,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;IAE3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getAutoExplainPayload_1 = require("./getAutoExplainPayload");
|
|
7
|
-
const ava_1 = __importDefault(require("ava"));
|
|
8
|
-
(0, ava_1.default)('extracts JSON from the message', (t) => {
|
|
9
|
-
t.deepEqual((0, getAutoExplainPayload_1.getAutoExplainPayload)('duration: {"foo":"bar"}'), {
|
|
1
|
+
import { getAutoExplainPayload } from './getAutoExplainPayload.js';
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
test('extracts JSON from the message', (t) => {
|
|
4
|
+
t.deepEqual(getAutoExplainPayload('duration: {"foo":"bar"}'), {
|
|
10
5
|
foo: 'bar',
|
|
11
6
|
});
|
|
12
7
|
});
|
|
13
|
-
(
|
|
8
|
+
test('throws an error if payload is not found', (t) => {
|
|
14
9
|
t.throws(() => {
|
|
15
|
-
|
|
10
|
+
getAutoExplainPayload('duration:');
|
|
16
11
|
}, {
|
|
17
12
|
message: 'Notice message does not contain a recognizable JSON payload.',
|
|
18
13
|
});
|
|
19
14
|
});
|
|
20
|
-
(
|
|
15
|
+
test('throws an error if multiple payloads are found', (t) => {
|
|
21
16
|
t.throws(() => {
|
|
22
|
-
|
|
17
|
+
getAutoExplainPayload('duration: {"foo":"bar"} {"foo":"bar"}');
|
|
23
18
|
}, {
|
|
24
19
|
message: 'Notice message contains multiple JSON payloads.',
|
|
25
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAutoExplainPayload.test.js","sourceRoot":"","sources":["../../src/utilities/getAutoExplainPayload.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getAutoExplainPayload.test.js","sourceRoot":"","sources":["../../src/utilities/getAutoExplainPayload.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,IAAI,MAAM,KAAK,CAAC;AAEvB,IAAI,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE,EAAE;IAC3C,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,EAAE;QAC5D,GAAG,EAAE,KAAK;KACX,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yCAAyC,EAAE,CAAC,CAAC,EAAE,EAAE;IACpD,CAAC,CAAC,MAAM,CACN,GAAG,EAAE;QACH,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC,EACD;QACE,OAAO,EAAE,8DAA8D;KACxE,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gDAAgD,EAAE,CAAC,CAAC,EAAE,EAAE;IAC3D,CAAC,CAAC,MAAM,CACN,GAAG,EAAE;QACH,qBAAqB,CAAC,uCAAuC,CAAC,CAAC;IACjE,CAAC,EACD;QACE,OAAO,EAAE,iDAAiD;KAC3D,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAutoExplainJsonMessage = void 0;
|
|
4
|
-
const isAutoExplainJsonMessage = (noticeMessage) => {
|
|
1
|
+
export const isAutoExplainJsonMessage = (noticeMessage) => {
|
|
5
2
|
return (noticeMessage.trim().startsWith('duration:') && noticeMessage.includes('{'));
|
|
6
3
|
};
|
|
7
|
-
exports.isAutoExplainJsonMessage = isAutoExplainJsonMessage;
|
|
8
4
|
//# sourceMappingURL=isAutoExplainJsonMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAutoExplainJsonMessage.js","sourceRoot":"","sources":["../../src/utilities/isAutoExplainJsonMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isAutoExplainJsonMessage.js","sourceRoot":"","sources":["../../src/utilities/isAutoExplainJsonMessage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,aAAqB,EAAW,EAAE;IACzE,OAAO,CACL,aAAa,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAC5E,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const isAutoExplainJsonMessage_1 = require("./isAutoExplainJsonMessage");
|
|
7
|
-
const ava_1 = __importDefault(require("ava"));
|
|
8
|
-
(0, ava_1.default)('recognizes notice containing JSON', (t) => {
|
|
9
|
-
t.true((0, isAutoExplainJsonMessage_1.isAutoExplainJsonMessage)('duration: {}'));
|
|
1
|
+
import { isAutoExplainJsonMessage } from './isAutoExplainJsonMessage.js';
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
test('recognizes notice containing JSON', (t) => {
|
|
4
|
+
t.true(isAutoExplainJsonMessage('duration: {}'));
|
|
10
5
|
});
|
|
11
6
|
//# sourceMappingURL=isAutoExplainJsonMessage.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAutoExplainJsonMessage.test.js","sourceRoot":"","sources":["../../src/utilities/isAutoExplainJsonMessage.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isAutoExplainJsonMessage.test.js","sourceRoot":"","sources":["../../src/utilities/isAutoExplainJsonMessage.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,IAAI,MAAM,KAAK,CAAC;AAEvB,IAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE,EAAE;IAC9C,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
|
package/eslint.config.js
ADDED
package/package.json
CHANGED
|
@@ -11,26 +11,27 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"src/**/*.test.ts"
|
|
13
13
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"nodeArguments": [
|
|
15
|
+
"--import=tsimp"
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"crack-json": "^1.3.0",
|
|
20
|
-
"pretty-ms": "^
|
|
21
|
-
"serialize-error": "^
|
|
20
|
+
"pretty-ms": "^9.2.0",
|
|
21
|
+
"serialize-error": "^12.0.0"
|
|
22
22
|
},
|
|
23
23
|
"description": "Logs Slonik queries.",
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"ava": "^6.3.0",
|
|
26
|
-
"eslint": "9.
|
|
27
|
-
"slonik": "^
|
|
28
|
-
"
|
|
26
|
+
"eslint": "9.27.0",
|
|
27
|
+
"slonik": "^48.0.0",
|
|
28
|
+
"tsimp": "^2.0.12",
|
|
29
29
|
"typescript": "^5.8.3",
|
|
30
|
-
"
|
|
30
|
+
"typescript-eslint": "^8.32.1",
|
|
31
|
+
"@slonik/eslint-config": "^48.0.0"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
34
|
+
"node": ">=24"
|
|
34
35
|
},
|
|
35
36
|
"keywords": [
|
|
36
37
|
"postgresql",
|
|
@@ -47,8 +48,9 @@
|
|
|
47
48
|
"type": "git",
|
|
48
49
|
"url": "https://github.com/gajus/slonik"
|
|
49
50
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
51
|
+
"type": "module",
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"version": "48.0.0",
|
|
52
54
|
"scripts": {
|
|
53
55
|
"build": "rm -fr ./dist && tsc",
|
|
54
56
|
"lint": "eslint ./src && tsc --noEmit",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getAutoExplainPayload } from '../utilities/getAutoExplainPayload';
|
|
2
|
-
import { isAutoExplainJsonMessage } from '../utilities/isAutoExplainJsonMessage';
|
|
1
|
+
import { getAutoExplainPayload } from '../utilities/getAutoExplainPayload.js';
|
|
2
|
+
import { isAutoExplainJsonMessage } from '../utilities/isAutoExplainJsonMessage.js';
|
|
3
3
|
import prettyMs from 'pretty-ms';
|
|
4
4
|
import { serializeError } from 'serialize-error';
|
|
5
|
-
import {
|
|
5
|
+
import type { Interceptor } from 'slonik';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @property logValues Dictates whether to include parameter values used to execute the query. (default: true)
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createQueryLoggingInterceptor } from './factories/createQueryLoggingInterceptor';
|
|
1
|
+
export { createQueryLoggingInterceptor } from './factories/createQueryLoggingInterceptor.js';
|
package/tsconfig.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"declarationMap": true,
|
|
6
6
|
"esModuleInterop": true,
|
|
7
7
|
"lib": [
|
|
8
|
-
"
|
|
8
|
+
"es2024"
|
|
9
9
|
],
|
|
10
|
-
"module": "
|
|
10
|
+
"module": "ES2022",
|
|
11
11
|
"moduleResolution": "node",
|
|
12
12
|
"noImplicitAny": false,
|
|
13
13
|
"noImplicitReturns": true,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"skipLibCheck": true,
|
|
16
16
|
"sourceMap": true,
|
|
17
17
|
"strict": true,
|
|
18
|
-
"target": "
|
|
18
|
+
"target": "es2024",
|
|
19
19
|
"useUnknownInCatchVariables": false
|
|
20
20
|
},
|
|
21
21
|
"include": [
|
package/eslint.config.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = [...require('@slonik/eslint-config')];
|
package/src/.eslintrc
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "canonical/auto",
|
|
3
|
-
"ignorePatterns": [
|
|
4
|
-
"dist",
|
|
5
|
-
"package-lock.json"
|
|
6
|
-
],
|
|
7
|
-
"overrides": [
|
|
8
|
-
{
|
|
9
|
-
"files": "*.ts",
|
|
10
|
-
"rules": {
|
|
11
|
-
"import/no-cycle": 0,
|
|
12
|
-
"no-restricted-imports": ["error", "pg"]
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"files": ["*.test.ts", "**/*.test/*"],
|
|
17
|
-
"extends": "canonical/ava",
|
|
18
|
-
"rules": {
|
|
19
|
-
"@typescript-eslint/no-explicit-any": 0,
|
|
20
|
-
"@typescript-eslint/no-unused-expressions": 0,
|
|
21
|
-
"ava/no-ignored-test-files": 0
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"root": true
|
|
26
|
-
}
|