@nestjs/common 9.1.2 → 9.1.4
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/cache/cache.providers.js
CHANGED
|
@@ -15,9 +15,18 @@ function createCacheManager() {
|
|
|
15
15
|
provide: cache_constants_1.CACHE_MANAGER,
|
|
16
16
|
useFactory: (options) => {
|
|
17
17
|
const cacheManager = (0, load_package_util_1.loadPackage)('cache-manager', 'CacheModule', () => require('cache-manager'));
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
19
|
+
const cacheManagerVersion = require('cache-manager/package.json').version;
|
|
20
|
+
const cacheManagerMajor = cacheManagerVersion.split('.')[0];
|
|
21
|
+
const cachingFactory = (store, options) => {
|
|
22
|
+
if (cacheManagerMajor < 5) {
|
|
23
|
+
return cacheManager.caching(Object.assign(Object.assign({}, default_options_1.defaultCacheOptions), Object.assign(Object.assign({}, options), { store })));
|
|
24
|
+
}
|
|
25
|
+
return cacheManager.caching(store !== null && store !== void 0 ? store : 'memory', Object.assign(Object.assign({}, default_options_1.defaultCacheOptions), options));
|
|
26
|
+
};
|
|
18
27
|
return Array.isArray(options)
|
|
19
|
-
? cacheManager.multiCaching(options.map(
|
|
20
|
-
:
|
|
28
|
+
? cacheManager.multiCaching(options.map(option => cachingFactory(options.store, option)))
|
|
29
|
+
: cachingFactory(options.store, options);
|
|
21
30
|
},
|
|
22
31
|
inject: [cache_module_definition_1.MODULE_OPTIONS_TOKEN],
|
|
23
32
|
};
|
|
@@ -57,7 +57,7 @@ export declare class ConfigurableModuleBuilder<ModuleOptions, StaticMethodKey ex
|
|
|
57
57
|
* )
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
setExtras<ExtraModuleDefinitionOptions>(extras: ExtraModuleDefinitionOptions, transformDefinition
|
|
60
|
+
setExtras<ExtraModuleDefinitionOptions>(extras: ExtraModuleDefinitionOptions, transformDefinition?: (definition: DynamicModule, extras: ExtraModuleDefinitionOptions) => DynamicModule): ConfigurableModuleBuilder<ModuleOptions, StaticMethodKey, FactoryClassMethodKey, ExtraModuleDefinitionOptions>;
|
|
61
61
|
/**
|
|
62
62
|
* Dynamic modules must expose public static methods that let you pass in
|
|
63
63
|
* configuration parameters (control the module's behavior from the outside).
|
|
@@ -38,7 +38,7 @@ class ConfigurableModuleBuilder {
|
|
|
38
38
|
* )
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
setExtras(extras, transformDefinition) {
|
|
41
|
+
setExtras(extras, transformDefinition = def => def) {
|
|
42
42
|
const builder = new ConfigurableModuleBuilder(this.options, this);
|
|
43
43
|
builder.extras = extras;
|
|
44
44
|
builder.transformModuleDefinition = transformDefinition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.4",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"uuid": "9.0.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"cache-manager": "
|
|
25
|
+
"cache-manager": "<=5",
|
|
26
26
|
"class-transformer": "*",
|
|
27
27
|
"class-validator": "*",
|
|
28
28
|
"reflect-metadata": "^0.1.12",
|