slonik-interceptor-query-cache 2.3.0 → 2.4.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.
@@ -10,7 +10,7 @@ const extractCacheAttributes = (subject, values) => {
10
10
  if (!key) {
11
11
  throw new Error('@cache-key must be specified when @cache-ttl is specified.');
12
12
  }
13
- if (!/-- @cache-hash-values false/ui.test(subject)) {
13
+ if (!/-- @cache-hash-values false/ui.test(subject) && values.length > 0) {
14
14
  key += ':' + (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(values)).digest('hex');
15
15
  }
16
16
  return {
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "test": "NODE_ENV=test nyc ava --verbose --serial"
58
58
  },
59
59
  "typings": "./dist/src/index.d.ts",
60
- "version": "2.3.0",
60
+ "version": "2.4.0",
61
61
  "peerDependencies": {
62
62
  "slonik": ">=27.0.0"
63
63
  },
@@ -15,7 +15,7 @@ export const extractCacheAttributes = (subject: string, values: readonly Primiti
15
15
  throw new Error('@cache-key must be specified when @cache-ttl is specified.');
16
16
  }
17
17
 
18
- if (!/-- @cache-hash-values false/ui.test(subject)) {
18
+ if (!/-- @cache-hash-values false/ui.test(subject) && values.length > 0) {
19
19
  key += ':' + createHash('sha256').update(JSON.stringify(values)).digest('hex');
20
20
  }
21
21