@mondart/nestjs-common-module 1.1.48 → 1.1.49

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.
@@ -16,11 +16,10 @@ const redisStore = require("cache-manager-redis-store");
16
16
  let CachingModule = CachingModule_1 = class CachingModule {
17
17
  static register(options) {
18
18
  const cacheModuleOptions = {
19
- isGlobal: true,
20
19
  store: redisStore,
21
- ttl: options.ttl,
20
+ ttl: Number(options.ttl),
22
21
  host: options.host,
23
- port: options.port,
22
+ port: Number(options.port),
24
23
  password: options.password,
25
24
  max: 10000,
26
25
  };
@@ -34,15 +33,29 @@ let CachingModule = CachingModule_1 = class CachingModule {
34
33
  },
35
34
  caching_service_1.CachingService,
36
35
  ],
37
- exports: [caching_service_1.CachingService],
36
+ exports: [caching_service_1.CachingService, cache_manager_1.CacheModule],
38
37
  };
39
38
  }
40
39
  static registerAsync(options) {
41
40
  return {
42
41
  module: CachingModule_1,
43
- imports: [...options.imports],
42
+ imports: [
43
+ ...(options.imports || []),
44
+ cache_manager_1.CacheModule.registerAsync({
45
+ imports: options.imports || [],
46
+ useFactory: async (cachingOptions) => ({
47
+ store: redisStore,
48
+ ttl: Number(cachingOptions.ttl),
49
+ host: cachingOptions.host,
50
+ port: Number(cachingOptions.port),
51
+ password: cachingOptions.password,
52
+ max: 10000,
53
+ }),
54
+ inject: [caching_interface_1.CACHING_MODULE_OPTIONS],
55
+ }),
56
+ ],
44
57
  providers: [...this.createAsyncProviders(options), caching_service_1.CachingService],
45
- exports: [...this.createAsyncProviders(options), caching_service_1.CachingService],
58
+ exports: [caching_service_1.CachingService, cache_manager_1.CacheModule],
46
59
  };
47
60
  }
48
61
  static createAsyncProviders(options) {
@@ -1,2 +1,3 @@
1
1
  export * from './caching.module';
2
2
  export * from './caching.service';
3
+ export * from './caching.interface';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./caching.module"), exports);
18
18
  __exportStar(require("./caching.service"), exports);
19
+ __exportStar(require("./caching.interface"), exports);