@nestjs-redisx/cache 1.0.3 → 1.0.5

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/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { Reflector } from '@nestjs/core';
1
+ import { ModuleRef, Reflector } from '@nestjs/core';
2
2
  import { Logger, Injectable, Inject, Optional, SetMetadata } from '@nestjs/common';
3
3
  import 'reflect-metadata';
4
- import { REDIS_DRIVER, RedisXError, ErrorCode } from '@nestjs-redisx/core';
5
4
  import { createHash } from 'crypto';
5
+ import { REDIS_DRIVER, RedisXError, ErrorCode } from '@nestjs-redisx/core';
6
6
  import { EventEmitter } from 'events';
7
7
  import { from, of } from 'rxjs';
8
8
  import { switchMap, tap } from 'rxjs/operators';
@@ -24,7 +24,7 @@ var __decorateClass = (decorators, target, key, kind) => {
24
24
  var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
25
25
 
26
26
  // package.json
27
- var version = "1.0.3";
27
+ var version = "1.0.4";
28
28
 
29
29
  // src/shared/constants/index.ts
30
30
  var CACHE_PLUGIN_OPTIONS = /* @__PURE__ */ Symbol.for("CACHE_PLUGIN_OPTIONS");
@@ -208,13 +208,17 @@ function serializeArg(arg) {
208
208
  }
209
209
  if (typeof arg === "object") {
210
210
  try {
211
- return stableStringify(arg);
211
+ const stable = stableStringify(arg);
212
+ return hashForKey(stable);
212
213
  } catch {
213
214
  return "object";
214
215
  }
215
216
  }
216
217
  return "unknown";
217
218
  }
219
+ function hashForKey(input) {
220
+ return createHash("sha256").update(input).digest("hex").slice(0, 16);
221
+ }
218
222
  function stableStringify(value) {
219
223
  if (value === null || value === void 0) {
220
224
  return "null";
@@ -350,6 +354,7 @@ var CacheDecoratorInitializerService = class {
350
354
  };
351
355
  CacheDecoratorInitializerService = __decorateClass([
352
356
  Injectable(),
357
+ __decorateParam(0, Inject(ModuleRef)),
353
358
  __decorateParam(1, Inject(CACHE_SERVICE)),
354
359
  __decorateParam(2, Inject(CACHE_PLUGIN_OPTIONS)),
355
360
  __decorateParam(3, Optional()),