@rxap/nest-keyv-minio 10.0.3 → 11.0.0-dev.1
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [11.0.0-dev.1](https://gitlab.com/rxap/packages/compare/@rxap/nest-keyv-minio@10.0.3...@rxap/nest-keyv-minio@11.0.0-dev.1) (2025-05-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rxap/nest-keyv-minio
|
|
9
|
+
|
|
6
10
|
## [10.0.3](https://gitlab.com/rxap/packages/compare/@rxap/nest-keyv-minio@10.0.3-dev.0...@rxap/nest-keyv-minio@10.0.3) (2025-05-16)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @rxap/nest-keyv-minio
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ yarn add @rxap/nest-keyv-minio
|
|
|
19
19
|
```
|
|
20
20
|
**Install peer dependencies:**
|
|
21
21
|
```bash
|
|
22
|
-
yarn add @nestjs/cache-manager @nestjs/common @rxap/nest-utilities keyv minio
|
|
22
|
+
yarn add @nestjs/cache-manager @nestjs/common @rxap/nest-utilities joi keyv minio
|
|
23
23
|
```
|
|
24
24
|
**Execute the init generator:**
|
|
25
25
|
```bash
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "11.0.0-dev.1",
|
|
3
3
|
"name": "@rxap/nest-keyv-minio",
|
|
4
4
|
"description": "A NestJS cache module that utilizes MinIO as a storage adapter for Keyv. It provides a simple way to integrate MinIO with NestJS caching, allowing you to store cached data in a MinIO bucket. This package includes a Keyv adapter and a module options factory for easy configuration.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nx/devkit": "20.5.0",
|
|
8
|
-
"tslib": "
|
|
8
|
+
"tslib": "2.6.2"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@nestjs/cache-manager": "^
|
|
12
|
-
"@nestjs/common": "^
|
|
13
|
-
"@rxap/nest-utilities": "^
|
|
14
|
-
"
|
|
11
|
+
"@nestjs/cache-manager": "^3.0.1",
|
|
12
|
+
"@nestjs/common": "^11.1.1",
|
|
13
|
+
"@rxap/nest-utilities": "^11.0.0-dev.0",
|
|
14
|
+
"joi": "^17.9.2",
|
|
15
|
+
"keyv": "^5.2.3",
|
|
15
16
|
"minio": "^8.0.1"
|
|
16
17
|
},
|
|
17
18
|
"author": {
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
},
|
|
43
44
|
"type": "commonjs",
|
|
44
45
|
"types": "./src/index.d.ts",
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "d7af9475bea5bf9e79ec16df38c566451c99a105"
|
|
46
47
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CacheOptions } from '@nestjs/cache-manager';
|
|
2
|
-
import { KeyvMinioOptions } from './keyv-minio';
|
|
3
2
|
import { CacheModuleOptionsLoader } from '@rxap/nest-utilities';
|
|
4
|
-
export declare class MinioCacheModuleOptionsFactory extends CacheModuleOptionsLoader
|
|
5
|
-
createCacheOptions(): Promise<CacheOptions
|
|
3
|
+
export declare class MinioCacheModuleOptionsFactory extends CacheModuleOptionsLoader {
|
|
4
|
+
createCacheOptions(): Promise<CacheOptions> | CacheOptions;
|
|
6
5
|
}
|
|
@@ -3,60 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MinioCacheModuleOptionsFactory = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
|
-
const keyv_minio_1 = require("./keyv-minio");
|
|
7
6
|
const nest_utilities_1 = require("@rxap/nest-utilities");
|
|
8
|
-
|
|
9
|
-
return value !== undefined && value !== null && typeof value === 'object' && 'value' in value && 'expires' in value;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Adapter to convert the v6 keyv store to the v5 keyv store
|
|
13
|
-
* Required util nestjs support cache-manager v6
|
|
14
|
-
* https://github.com/nestjs/cache-manager/pull/508
|
|
15
|
-
*/
|
|
16
|
-
class CacheStoreV6ToV5Adapter {
|
|
17
|
-
constructor(store) {
|
|
18
|
-
this.store = store;
|
|
19
|
-
}
|
|
20
|
-
async set(key, value, options) {
|
|
21
|
-
let ttl = undefined;
|
|
22
|
-
if (typeof options === 'number') {
|
|
23
|
-
ttl = options;
|
|
24
|
-
}
|
|
25
|
-
else if (typeof options?.ttl === 'number') {
|
|
26
|
-
ttl = options.ttl;
|
|
27
|
-
}
|
|
28
|
-
else if (typeof options?.ttl === 'function') {
|
|
29
|
-
ttl = options.ttl(value);
|
|
30
|
-
}
|
|
31
|
-
await this.store.set(key, value, ttl);
|
|
32
|
-
}
|
|
33
|
-
async get(key) {
|
|
34
|
-
const cache = await this.store.get(key);
|
|
35
|
-
if (cache && isStoredDataRaw(cache)) {
|
|
36
|
-
if (cache.expires && cache.expires < Date.now()) {
|
|
37
|
-
await this.store.delete(key);
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
return cache.value;
|
|
41
|
-
}
|
|
42
|
-
return cache;
|
|
43
|
-
}
|
|
44
|
-
async del(key) {
|
|
45
|
-
await this.store.delete(key);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
7
|
+
const keyv_minio_1 = require("./keyv-minio");
|
|
48
8
|
let MinioCacheModuleOptionsFactory = class MinioCacheModuleOptionsFactory extends nest_utilities_1.CacheModuleOptionsLoader {
|
|
49
9
|
createCacheOptions() {
|
|
50
10
|
return {
|
|
51
11
|
...super.createCacheOptions(),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
12
|
+
stores: new keyv_minio_1.KeyvMinio({
|
|
13
|
+
endPoint: this.config.get('KEYV_MINIO_END_POINT', 'minio'),
|
|
14
|
+
port: this.config.get('KEYV_MINIO_PORT', 9000),
|
|
15
|
+
useSSL: this.config.get('KEYV_MINIO_USE_SSL', false),
|
|
16
|
+
accessKey: this.config.get('KEYV_MINIO_ACCESS_KEY', 'minioadmin'),
|
|
17
|
+
secretKey: this.config.get('KEYV_MINIO_SECRET_KEY', 'minioadmin'),
|
|
18
|
+
bucketName: this.config.get('KEYV_MINIO_BUCKET_NAME', 'keyv'),
|
|
19
|
+
pathPrefix: this.config.get('KEYV_MINIO_PATH_PREFIX'),
|
|
20
|
+
}),
|
|
60
21
|
};
|
|
61
22
|
}
|
|
62
23
|
};
|