slonik-interceptor-query-logging 1.4.3 → 1.4.7

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.
@@ -1,9 +1,9 @@
1
- import type { InterceptorType } from 'slonik';
1
+ import type { Interceptor } from 'slonik';
2
2
  /**
3
3
  * @property logValues Dictates whether to include parameter values used to execute the query. (default: true)
4
4
  */
5
5
  declare type UserConfigurationType = {
6
6
  logValues: boolean;
7
7
  };
8
- export declare const createQueryLoggingInterceptor: (userConfiguration?: UserConfigurationType | undefined) => InterceptorType;
8
+ export declare const createQueryLoggingInterceptor: (userConfiguration?: UserConfigurationType | undefined) => Interceptor;
9
9
  export {};
@@ -25,6 +25,9 @@ const createQueryLoggingInterceptor = (userConfiguration) => {
25
25
  rowCount = result.rowCount;
26
26
  }
27
27
  for (const notice of result.notices) {
28
+ if (!notice.message) {
29
+ continue;
30
+ }
28
31
  if ((0, utilities_1.isAutoExplainJsonMessage)(notice.message)) {
29
32
  context.log.info({
30
33
  autoExplain: (0, utilities_1.getAutoExplainPayload)(notice.message),
package/package.json CHANGED
@@ -22,23 +22,22 @@
22
22
  },
23
23
  "description": "Logs Slonik queries.",
24
24
  "devDependencies": {
25
- "@istanbuljs/nyc-config-typescript": "^1.0.1",
25
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
26
26
  "ava": "^3.15.0",
27
27
  "babel-plugin-istanbul": "^6.1.1",
28
28
  "babel-plugin-macros": "^3.1.0",
29
29
  "babel-plugin-transform-export-default-name": "^2.1.0",
30
30
  "coveralls": "^3.1.1",
31
31
  "del-cli": "^4.0.1",
32
- "eslint": "^8.3.0",
33
- "eslint-config-canonical": "^32.43.0",
32
+ "eslint": "^8.4.1",
33
+ "eslint-config-canonical": "^32.46.0",
34
34
  "husky": "^7.0.4",
35
35
  "inline-loops.macro": "^1.2.2",
36
36
  "nyc": "^15.1.0",
37
37
  "semantic-release": "^18.0.1",
38
38
  "sinon": "^12.0.1",
39
- "slonik": "^22.4.0",
40
39
  "ts-node": "^10.4.0",
41
- "typescript": "^4.5.2"
40
+ "typescript": "^4.5.3"
42
41
  },
43
42
  "engines": {
44
43
  "node": ">=8.0"
@@ -57,7 +56,7 @@
57
56
  "main": "./dist/src/index.js",
58
57
  "name": "slonik-interceptor-query-logging",
59
58
  "peerDependencies": {
60
- "slonik": ">=25.1.2"
59
+ "slonik": ">=27.0.0"
61
60
  },
62
61
  "repository": {
63
62
  "type": "git",
@@ -69,5 +68,5 @@
69
68
  "test": "NODE_ENV=test nyc ava --verbose --serial"
70
69
  },
71
70
  "typings": "./dist/src/index.d.ts",
72
- "version": "1.4.3"
71
+ "version": "1.4.7"
73
72
  }
@@ -3,7 +3,7 @@ import {
3
3
  serializeError,
4
4
  } from 'serialize-error';
5
5
  import type {
6
- InterceptorType,
6
+ Interceptor,
7
7
  } from 'slonik';
8
8
  import {
9
9
  getAutoExplainPayload,
@@ -25,7 +25,7 @@ const defaultConfiguration = {
25
25
  logValues: true,
26
26
  };
27
27
 
28
- export const createQueryLoggingInterceptor = (userConfiguration?: UserConfigurationType): InterceptorType => {
28
+ export const createQueryLoggingInterceptor = (userConfiguration?: UserConfigurationType): Interceptor => {
29
29
  const configuration = {
30
30
  ...defaultConfiguration,
31
31
  ...userConfiguration,
@@ -40,6 +40,10 @@ export const createQueryLoggingInterceptor = (userConfiguration?: UserConfigurat
40
40
  }
41
41
 
42
42
  for (const notice of result.notices) {
43
+ if (!notice.message) {
44
+ continue;
45
+ }
46
+
43
47
  if (isAutoExplainJsonMessage(notice.message)) {
44
48
  context.log.info({
45
49
  autoExplain: getAutoExplainPayload(notice.message),