@rineex/ioredis 0.0.0 → 1.1.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.
- package/README.md +31 -15
- package/dist/index.d.mts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
## Overview
|
|
2
2
|
|
|
3
|
-
`@rineex/ioredis` provides a NestJS integration for
|
|
3
|
+
`@rineex/ioredis` provides a NestJS integration for
|
|
4
|
+
[`ioredis`](https://www.npmjs.com/package/ioredis), including:
|
|
4
5
|
|
|
5
|
-
- Creating and exporting Redis clients (single instance or cluster) via a
|
|
6
|
+
- Creating and exporting Redis clients (single instance or cluster) via a
|
|
7
|
+
configurable module (`RedisModule`)
|
|
6
8
|
- Injecting clients by name via `@InjectRedis()`
|
|
7
9
|
- Basic lifecycle management:
|
|
8
10
|
- On application bootstrap: ping all tracked clients and log results
|
|
9
11
|
- On application shutdown: `quit()` all tracked clients
|
|
10
|
-
- A Terminus health indicator and module (`RedisHealthIndicator`,
|
|
12
|
+
- A Terminus health indicator and module (`RedisHealthIndicator`,
|
|
13
|
+
`RedisHealthModule`)
|
|
11
14
|
|
|
12
15
|
Use this when:
|
|
13
16
|
|
|
14
|
-
- You want an `ioredis` client managed by NestJS DI, with support for multiple
|
|
17
|
+
- You want an `ioredis` client managed by NestJS DI, with support for multiple
|
|
18
|
+
named connections.
|
|
15
19
|
- You want the module to close Redis connections on shutdown.
|
|
16
20
|
|
|
17
21
|
Do not use this when:
|
|
@@ -33,7 +37,8 @@ The package exports:
|
|
|
33
37
|
|
|
34
38
|
### `RedisModule`
|
|
35
39
|
|
|
36
|
-
A NestJS configurable module for provisioning an `ioredis` client and exporting
|
|
40
|
+
A NestJS configurable module for provisioning an `ioredis` client and exporting
|
|
41
|
+
it under a DI token.
|
|
37
42
|
|
|
38
43
|
- **register(options: RedisModuleOptions, extras?: RedisModuleExtraOptions)**
|
|
39
44
|
- **options**:
|
|
@@ -55,26 +60,30 @@ A NestJS configurable module for provisioning an `ioredis` client and exporting
|
|
|
55
60
|
### Injection helpers
|
|
56
61
|
|
|
57
62
|
- **InjectRedis(connection?: string)**
|
|
58
|
-
- Parameter decorator that injects the `ioredis` client for the given
|
|
63
|
+
- Parameter decorator that injects the `ioredis` client for the given
|
|
64
|
+
connection name.
|
|
59
65
|
- If `connection` is omitted, injects the default connection (`'default'`).
|
|
60
66
|
|
|
61
67
|
- **getRedisConnectionToken(connection?: string): string**
|
|
62
68
|
- Returns the DI token used to register/inject the client.
|
|
63
69
|
|
|
64
70
|
- **getRedisOptionsToken(connection?: string): string**
|
|
65
|
-
- Returns the DI token used internally for module options for a given
|
|
71
|
+
- Returns the DI token used internally for module options for a given
|
|
72
|
+
connection.
|
|
66
73
|
|
|
67
74
|
### Health check integration
|
|
68
75
|
|
|
69
76
|
- **RedisHealthModule**
|
|
70
77
|
- Nest module exporting `RedisHealthIndicator`.
|
|
71
|
-
- Provides a `REDIS_HEALTH_INDICATOR` client via a factory that calls
|
|
78
|
+
- Provides a `REDIS_HEALTH_INDICATOR` client via a factory that calls
|
|
79
|
+
`new Redis()` with default settings.
|
|
72
80
|
|
|
73
81
|
- **RedisHealthIndicator**
|
|
74
82
|
- `isHealthy(key: string): Promise<import('@nestjs/terminus').HealthIndicatorResult>`
|
|
75
83
|
- **Behavior**:
|
|
76
84
|
- `PING` succeeds → returns healthy status for `key`
|
|
77
|
-
- `PING` fails → throws `HealthCheckError` with a status payload including
|
|
85
|
+
- `PING` fails → throws `HealthCheckError` with a status payload including
|
|
86
|
+
`message`
|
|
78
87
|
|
|
79
88
|
## Usage Examples
|
|
80
89
|
|
|
@@ -176,22 +185,29 @@ export class HealthController {
|
|
|
176
185
|
|
|
177
186
|
## Behavior & Guarantees
|
|
178
187
|
|
|
179
|
-
- **Connection naming**: if `extras.connection` is omitted, the connection name
|
|
188
|
+
- **Connection naming**: if `extras.connection` is omitted, the connection name
|
|
189
|
+
is `'default'`.
|
|
180
190
|
- **Lifecycle**:
|
|
181
|
-
- Clients created by `RedisModule` are tracked via `WeakRef` and pinged during
|
|
182
|
-
|
|
183
|
-
-
|
|
191
|
+
- Clients created by `RedisModule` are tracked via `WeakRef` and pinged during
|
|
192
|
+
`onApplicationBootstrap()`.
|
|
193
|
+
- On shutdown, the module attempts to `quit()` each tracked client; failures
|
|
194
|
+
are logged and do not throw.
|
|
195
|
+
- **Concurrency**: clients are shared singletons per DI token; concurrent use
|
|
196
|
+
follows `ioredis` semantics.
|
|
184
197
|
|
|
185
198
|
## Operational Notes
|
|
186
199
|
|
|
187
200
|
- **Configuration**
|
|
188
|
-
- For single instances, prefer a `url` (e.g. `redis://host:6379`) and pass
|
|
201
|
+
- For single instances, prefer a `url` (e.g. `redis://host:6379`) and pass
|
|
202
|
+
`options` for advanced settings.
|
|
189
203
|
- For cluster, supply `nodes` and optional `ClusterOptions`.
|
|
190
204
|
- **Logging**
|
|
191
205
|
- Bootstrap health checks log ping success/failure per client.
|
|
192
206
|
- Shutdown logs success or error when closing connections.
|
|
193
207
|
- **Health module default client**
|
|
194
|
-
- `RedisHealthModule` creates a fresh `new Redis()` with default
|
|
208
|
+
- `RedisHealthModule` creates a fresh `new Redis()` with default
|
|
209
|
+
configuration; override the `REDIS_HEALTH_INDICATOR` provider if you need to
|
|
210
|
+
health-check a configured/named connection instead of the default.
|
|
195
211
|
|
|
196
212
|
## Development
|
|
197
213
|
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Redis, { RedisOptions, ClusterNode, ClusterOptions, Cluster } from 'ioredis';
|
|
2
|
+
import { HealthIndicatorService, HealthIndicatorResult } from '@nestjs/terminus';
|
|
3
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
4
|
+
import { OnApplicationShutdown, OnApplicationBootstrap } from '@nestjs/common';
|
|
5
|
+
|
|
6
|
+
declare class RedisHealthIndicator {
|
|
7
|
+
private readonly redis;
|
|
8
|
+
private readonly healthIndicatorService;
|
|
9
|
+
constructor(redis: Redis, healthIndicatorService: HealthIndicatorService);
|
|
10
|
+
isHealthy(key: string): Promise<HealthIndicatorResult>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class RedisHealthModule {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const InjectRedis: (connection?: string) => PropertyDecorator & ParameterDecorator;
|
|
17
|
+
|
|
18
|
+
interface RedisSingleOptions {
|
|
19
|
+
type: 'single';
|
|
20
|
+
url?: string;
|
|
21
|
+
options?: RedisOptions;
|
|
22
|
+
}
|
|
23
|
+
interface RedisClusterOptions {
|
|
24
|
+
type: 'cluster';
|
|
25
|
+
nodes: ClusterNode[];
|
|
26
|
+
options?: ClusterOptions;
|
|
27
|
+
}
|
|
28
|
+
type RedisModuleOptions = RedisClusterOptions | RedisSingleOptions;
|
|
29
|
+
interface RedisModuleExtraOptions {
|
|
30
|
+
connection?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare const RedisModuleClass: _nestjs_common.ConfigurableModuleCls<RedisModuleOptions, "register", "create", RedisModuleExtraOptions>;
|
|
34
|
+
|
|
35
|
+
declare class RedisModule extends RedisModuleClass implements OnApplicationShutdown, OnApplicationBootstrap {
|
|
36
|
+
private static readonly redisConnections;
|
|
37
|
+
private readonly logger;
|
|
38
|
+
static track(redis: Cluster | Redis): Redis | Cluster;
|
|
39
|
+
onApplicationBootstrap(): Promise<void>;
|
|
40
|
+
onApplicationShutdown(): Promise<void>;
|
|
41
|
+
private tryCloseRedisConnectionPermanently;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare function getRedisOptionsToken(connection?: string): string;
|
|
45
|
+
declare function getRedisConnectionToken(connection?: string): string;
|
|
46
|
+
declare function createRedisConnection(options: RedisModuleOptions): Redis | Cluster;
|
|
47
|
+
|
|
48
|
+
export { InjectRedis, type RedisClusterOptions, RedisHealthIndicator, RedisHealthModule, RedisModule, type RedisModuleExtraOptions, type RedisModuleOptions, type RedisSingleOptions, createRedisConnection, getRedisConnectionToken, getRedisOptionsToken };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Redis, { RedisOptions, ClusterNode, ClusterOptions, Cluster } from 'ioredis';
|
|
2
|
+
import { HealthIndicatorService, HealthIndicatorResult } from '@nestjs/terminus';
|
|
3
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
4
|
+
import { OnApplicationShutdown, OnApplicationBootstrap } from '@nestjs/common';
|
|
5
|
+
|
|
6
|
+
declare class RedisHealthIndicator {
|
|
7
|
+
private readonly redis;
|
|
8
|
+
private readonly healthIndicatorService;
|
|
9
|
+
constructor(redis: Redis, healthIndicatorService: HealthIndicatorService);
|
|
10
|
+
isHealthy(key: string): Promise<HealthIndicatorResult>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class RedisHealthModule {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const InjectRedis: (connection?: string) => PropertyDecorator & ParameterDecorator;
|
|
17
|
+
|
|
18
|
+
interface RedisSingleOptions {
|
|
19
|
+
type: 'single';
|
|
20
|
+
url?: string;
|
|
21
|
+
options?: RedisOptions;
|
|
22
|
+
}
|
|
23
|
+
interface RedisClusterOptions {
|
|
24
|
+
type: 'cluster';
|
|
25
|
+
nodes: ClusterNode[];
|
|
26
|
+
options?: ClusterOptions;
|
|
27
|
+
}
|
|
28
|
+
type RedisModuleOptions = RedisClusterOptions | RedisSingleOptions;
|
|
29
|
+
interface RedisModuleExtraOptions {
|
|
30
|
+
connection?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare const RedisModuleClass: _nestjs_common.ConfigurableModuleCls<RedisModuleOptions, "register", "create", RedisModuleExtraOptions>;
|
|
34
|
+
|
|
35
|
+
declare class RedisModule extends RedisModuleClass implements OnApplicationShutdown, OnApplicationBootstrap {
|
|
36
|
+
private static readonly redisConnections;
|
|
37
|
+
private readonly logger;
|
|
38
|
+
static track(redis: Cluster | Redis): Redis | Cluster;
|
|
39
|
+
onApplicationBootstrap(): Promise<void>;
|
|
40
|
+
onApplicationShutdown(): Promise<void>;
|
|
41
|
+
private tryCloseRedisConnectionPermanently;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare function getRedisOptionsToken(connection?: string): string;
|
|
45
|
+
declare function getRedisConnectionToken(connection?: string): string;
|
|
46
|
+
declare function createRedisConnection(options: RedisModuleOptions): Redis | Cluster;
|
|
47
|
+
|
|
48
|
+
export { InjectRedis, type RedisClusterOptions, RedisHealthIndicator, RedisHealthModule, RedisModule, type RedisModuleExtraOptions, type RedisModuleOptions, type RedisSingleOptions, createRedisConnection, getRedisConnectionToken, getRedisOptionsToken };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var b=Object.create;var d=Object.defineProperty,B=Object.defineProperties,_=Object.getOwnPropertyDescriptor,F=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,Y=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var y=(e,t,r)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>{for(var r in t||(t={}))S.call(t,r)&&y(e,r,t[r]);if(h)for(var r of h(t))q.call(t,r)&&y(e,r,t[r]);return e},D=(e,t)=>B(e,F(t));var G=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},v=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of W(t))!S.call(e,s)&&s!==r&&d(e,s,{get:()=>t[s],enumerable:!(o=_(t,s))||o.enumerable});return e};var w=(e,t,r)=>(r=e!=null?b(Y(e)):{},v(t||!e||!e.__esModule?d(r,"default",{value:e,enumerable:!0}):r,e)),z=e=>v(d({},"__esModule",{value:!0}),e),O=(e,t,r,o)=>{for(var s=o>1?void 0:o?_(t,r):t,i=e.length-1,p;i>=0;i--)(p=e[i])&&(s=(o?p(t,r,s):p(s))||s);return o&&s&&d(t,r,s),s},A=(e,t)=>(r,o)=>t(r,o,e);var l=(e,t,r)=>new Promise((o,s)=>{var i=a=>{try{m(r.next(a))}catch(g){s(g)}},p=a=>{try{m(r.throw(a))}catch(g){s(g)}},m=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,p);m((r=r.apply(e,t)).next())});var X={};G(X,{InjectRedis:()=>V,RedisHealthIndicator:()=>c,RedisHealthModule:()=>R,RedisModule:()=>n,createRedisConnection:()=>T,getRedisConnectionToken:()=>C,getRedisOptionsToken:()=>Q});module.exports=z(X);var f=require("@nestjs/common");var N="default",M="IORedisModuleConnectionToken",P="IORedisModuleOptionsToken",I="redisHealthIndicator";var c=class{constructor(t,r){this.redis=t;this.healthIndicatorService=r}isHealthy(t){return l(this,null,function*(){let r=this.healthIndicatorService.check(t);try{return yield this.redis.ping(),r.up()}catch(o){let s=o instanceof Error?o.message:String(o);return r.down({message:s})}})}};c=O([(0,f.Injectable)(),A(0,(0,f.Inject)(I))],c);var H=require("@nestjs/terminus"),$=require("@nestjs/common");var k=w(require("ioredis"));var L={provide:I,useFactory:()=>new k.default};var R=class{};R=O([(0,$.Module)({providers:[c,L],exports:[c],imports:[H.TerminusModule]})],R);var U=require("@nestjs/common");var E=w(require("ioredis"));var u=require("@nestjs/common");var j=require("@nestjs/common");var{ASYNC_OPTIONS_TYPE:me,ConfigurableModuleClass:K,MODULE_OPTIONS_TOKEN:J}=new j.ConfigurableModuleBuilder().setExtras({connection:"default"},(e,t)=>{var o,s;(o=e.providers)!=null||(e.providers=[]),(s=e.exports)!=null||(e.exports=[]);let r=C(t.connection);return e.providers.push({useFactory:i=>T(i),provide:r,inject:[J]}),e.exports.push(r),e}).build();var n=class extends K{constructor(){super(...arguments);this.logger=new u.Logger(n.name)}static track(r){return this.redisConnections.push(new WeakRef(r)),r}onApplicationBootstrap(){return l(this,null,function*(){this.logger.log("Checking Redis connections health...");let r=n.redisConnections.map(o=>o.deref()).filter(o=>!!o);yield Promise.all(r.map((o,s)=>l(this,null,function*(){try{let i=yield o.ping();this.logger.log(`Redis client #${s} responded: ${i}`)}catch(i){this.logger.error(`Redis client #${s} ping failed: ${i.message}`)}})))})}onApplicationShutdown(){return l(this,null,function*(){yield Promise.allSettled(n.redisConnections.map(r=>r.deref()).filter(r=>!!r).map(r=>this.tryCloseRedisConnectionPermanently(r)))})}tryCloseRedisConnectionPermanently(r){return l(this,null,function*(){try{yield r.quit(),this.logger.log("Redis connection closed successfully.")}catch(o){this.logger.error("Error closing Redis connection:",o)}})}};n.redisConnections=[],n=O([(0,u.Module)({}),(0,u.Global)()],n);function Q(e){return`${e||N}_${P}`}function C(e){return`${e||N}_${M}`}function T(e){let{options:t={},type:r}=e,o;if(r==="cluster")o=new E.default.Cluster(e.nodes,t);else{let{options:{port:s,host:i}={},url:p}=e,m=D(x({},t),{port:s,host:i});o=p?new E.default(p,m):new E.default(m)}return n.track(o)}var V=e=>(0,U.Inject)(C(e));0&&(module.exports={InjectRedis,RedisHealthIndicator,RedisHealthModule,RedisModule,createRedisConnection,getRedisConnectionToken,getRedisOptionsToken});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/redis-health/redis-health.indicator.ts","../src/redis.constants.ts","../src/redis-health/redis-health.module.ts","../src/redis-health/redis-health.provider.ts","../src/redis.decorators.ts","../src/redis.utils.ts","../src/redis.module.ts","../src/redis.module-definition.ts"],"sourcesContent":["export * from './redis-health/redis-health.indicator';\nexport * from './redis-health/redis-health.module';\nexport * from './redis.decorators';\nexport * from './redis.interfaces';\nexport * from './redis.module';\nexport * from './redis.utils';\n","import type Redis from 'ioredis';\n\nimport type { HealthIndicatorResult } from '@nestjs/terminus';\nimport { HealthIndicatorService } from '@nestjs/terminus';\nimport { Inject, Injectable } from '@nestjs/common';\n\nimport { REDIS_HEALTH_INDICATOR } from '../redis.constants';\n\n@Injectable()\nexport class RedisHealthIndicator {\n constructor(\n @Inject(REDIS_HEALTH_INDICATOR) private readonly redis: Redis,\n private readonly healthIndicatorService: HealthIndicatorService,\n ) {}\n\n async isHealthy(key: string): Promise<HealthIndicatorResult> {\n const indicator = this.healthIndicatorService.check(key);\n\n try {\n await this.redis.ping();\n return indicator.up();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return indicator.down({ message });\n }\n }\n}\n","export const REDIS_MODULE_CONNECTION = 'default';\nexport const REDIS_MODULE_CONNECTION_TOKEN = 'IORedisModuleConnectionToken';\nexport const REDIS_MODULE_OPTIONS_TOKEN = 'IORedisModuleOptionsToken';\n\nexport const REDIS_HEALTH_INDICATOR = 'redisHealthIndicator';\n","import { TerminusModule } from '@nestjs/terminus';\nimport { Module } from '@nestjs/common';\n\nimport { redisHealthIndicatorProvider } from './redis-health.provider';\nimport { RedisHealthIndicator } from './redis-health.indicator';\n\n@Module({\n providers: [RedisHealthIndicator, redisHealthIndicatorProvider],\n exports: [RedisHealthIndicator],\n imports: [TerminusModule],\n})\nexport class RedisHealthModule {}\n","import Redis from 'ioredis';\n\nimport { REDIS_HEALTH_INDICATOR } from '../redis.constants';\n\nexport const redisHealthIndicatorProvider = {\n provide: REDIS_HEALTH_INDICATOR,\n useFactory: () => new Redis(),\n};\n","import { Inject } from '@nestjs/common';\n\nimport { getRedisConnectionToken } from './redis.utils';\n\nexport const InjectRedis = (connection?: string) => {\n return Inject(getRedisConnectionToken(connection));\n};\n","import type { Cluster, RedisOptions } from 'ioredis';\nimport Redis from 'ioredis';\n\nimport {\n REDIS_MODULE_CONNECTION,\n REDIS_MODULE_CONNECTION_TOKEN,\n REDIS_MODULE_OPTIONS_TOKEN,\n} from './redis.constants';\nimport type { RedisModuleOptions } from './redis.interfaces';\nimport { RedisModule } from './redis.module';\n\nexport function getRedisOptionsToken(connection?: string): string {\n return `${connection || REDIS_MODULE_CONNECTION}_${REDIS_MODULE_OPTIONS_TOKEN}`;\n}\n\nexport function getRedisConnectionToken(connection?: string): string {\n return `${connection || REDIS_MODULE_CONNECTION}_${REDIS_MODULE_CONNECTION_TOKEN}`;\n}\n\nexport function createRedisConnection(options: RedisModuleOptions) {\n const { options: commonOptions = {}, type } = options;\n\n let client: Cluster | Redis;\n if (type === 'cluster') {\n client = new Redis.Cluster(options.nodes, commonOptions);\n } else {\n const { options: { port, host } = {}, url } = options;\n const redisOptions: RedisOptions = { ...commonOptions, port, host };\n client = url ? new Redis(url, redisOptions) : new Redis(redisOptions);\n }\n\n return RedisModule.track(client);\n}\n","import type { Cluster } from 'ioredis';\nimport type Redis from 'ioredis';\n\nimport type {\n OnApplicationBootstrap,\n OnApplicationShutdown,\n} from '@nestjs/common';\nimport { Global, Logger, Module } from '@nestjs/common';\n\nimport { RedisModuleClass } from './redis.module-definition';\n\n@Module({})\n@Global()\nexport class RedisModule\n extends RedisModuleClass\n implements OnApplicationShutdown, OnApplicationBootstrap\n{\n private static readonly redisConnections = [] as WeakRef<Cluster | Redis>[];\n private readonly logger = new Logger(RedisModule.name);\n\n static track(redis: Cluster | Redis) {\n this.redisConnections.push(new WeakRef(redis));\n return redis;\n }\n\n async onApplicationBootstrap() {\n this.logger.log('Checking Redis connections health...');\n const clients = RedisModule.redisConnections\n .map(ref => ref.deref())\n .filter((client): client is Cluster | Redis => !!client);\n\n await Promise.all(\n clients.map(async (client, index) => {\n try {\n const result = await client.ping();\n this.logger.log(`Redis client #${index} responded: ${result}`);\n } catch (error) {\n this.logger.error(\n `Redis client #${index} ping failed: ${error.message}`,\n );\n }\n }),\n );\n }\n\n async onApplicationShutdown() {\n await Promise.allSettled(\n RedisModule.redisConnections\n .map(ref => ref.deref())\n .filter((client): client is Cluster | Redis => !!client)\n .map(client => this.tryCloseRedisConnectionPermanently(client)),\n );\n }\n\n private async tryCloseRedisConnectionPermanently(redis: Cluster | Redis) {\n try {\n await redis.quit();\n this.logger.log('Redis connection closed successfully.');\n } catch (error) {\n this.logger.error('Error closing Redis connection:', error);\n }\n }\n}\n","import { ConfigurableModuleBuilder } from '@nestjs/common';\n\nimport type {\n RedisModuleExtraOptions,\n RedisModuleOptions,\n} from './redis.interfaces';\nimport { createRedisConnection, getRedisConnectionToken } from './redis.utils';\n\nexport const {\n ASYNC_OPTIONS_TYPE: RedisModuleAsyncOptions,\n ConfigurableModuleClass: RedisModuleClass,\n MODULE_OPTIONS_TOKEN: REDIS_OPTIONS_TOKEN,\n} = new ConfigurableModuleBuilder<RedisModuleOptions>()\n .setExtras<RedisModuleExtraOptions>(\n { connection: 'default' },\n (definition, extras) => {\n definition.providers ??= [];\n definition.exports ??= [];\n\n const REDIS_CONNECTION_TOKEN = getRedisConnectionToken(extras.connection);\n definition.providers.push({\n useFactory: (options: RedisModuleOptions) => {\n return createRedisConnection(options);\n },\n provide: REDIS_CONNECTION_TOKEN,\n\n inject: [REDIS_OPTIONS_TOKEN],\n });\n definition.exports.push(REDIS_CONNECTION_TOKEN);\n\n return definition;\n },\n )\n .build();\n"],"mappings":"4uCAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,yBAAAC,EAAA,sBAAAC,EAAA,gBAAAC,EAAA,0BAAAC,EAAA,4BAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAT,GCIA,IAAAU,EAAmC,0BCJ5B,IAAMC,EAA0B,UAC1BC,EAAgC,+BAChCC,EAA6B,4BAE7BC,EAAyB,uBDK/B,IAAMC,EAAN,KAA2B,CAChC,YACmDC,EAChCC,EACjB,CAFiD,WAAAD,EAChC,4BAAAC,CAChB,CAEG,UAAUC,EAA6C,QAAAC,EAAA,sBAC3D,IAAMC,EAAY,KAAK,uBAAuB,MAAMF,CAAG,EAEvD,GAAI,CACF,aAAM,KAAK,MAAM,KAAK,EACfE,EAAU,GAAG,CACtB,OAASC,EAAO,CACd,IAAMC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AAC,QAAM,QAAQJ,EAAQ,MAAOC,CAAa,MAClD,CACL,GAAM,CAAE,QAAS,CAAE,KAAAI,EAAM,KAAAC,CAAK,EAAI,CAAC,EAAG,IAAAC,CAAI,EAAIP,EACxCQ,EAA6BC,EAAAC,EAAA,GAAKT,GAAL,CAAoB,KAAAI,EAAM,KAAAC,CAAK,GAClEH,EAASI,EAAM,IAAI,EAAAH,QAAMG,EAAKC,CAAY,EAAI,IAAI,EAAAJ,QAAMI,CAAY,CACtE,CAEA,OAAOG,EAAY,MAAMR,CAAM,CACjC,CD5BO,IAAMS,EAAeC,MACnB,UAAOC,EAAwBD,CAAU,CAAC","names":["index_exports","__export","InjectRedis","RedisHealthIndicator","RedisHealthModule","RedisModule","createRedisConnection","getRedisConnectionToken","getRedisOptionsToken","__toCommonJS","import_common","REDIS_MODULE_CONNECTION","REDIS_MODULE_CONNECTION_TOKEN","REDIS_MODULE_OPTIONS_TOKEN","REDIS_HEALTH_INDICATOR","RedisHealthIndicator","redis","healthIndicatorService","key","__async","indicator","error","message","__decorateClass","__decorateParam","REDIS_HEALTH_INDICATOR","import_terminus","import_common","import_ioredis","redisHealthIndicatorProvider","REDIS_HEALTH_INDICATOR","Redis","RedisHealthModule","__decorateClass","RedisHealthIndicator","redisHealthIndicatorProvider","import_common","import_ioredis","import_common","import_common","RedisModuleAsyncOptions","RedisModuleClass","REDIS_OPTIONS_TOKEN","definition","extras","_a","_b","REDIS_CONNECTION_TOKEN","getRedisConnectionToken","options","createRedisConnection","RedisModule","RedisModuleClass","redis","__async","clients","ref","client","index","result","error","__decorateClass","getRedisOptionsToken","connection","REDIS_MODULE_CONNECTION","REDIS_MODULE_OPTIONS_TOKEN","getRedisConnectionToken","REDIS_MODULE_CONNECTION_TOKEN","createRedisConnection","options","commonOptions","type","client","Redis","port","host","url","redisOptions","__spreadProps","__spreadValues","RedisModule","InjectRedis","connection","getRedisConnectionToken"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var N=Object.defineProperty,w=Object.defineProperties,A=Object.getOwnPropertyDescriptor,M=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var g=(r,t,e)=>t in r?N(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,T=(r,t)=>{for(var e in t||(t={}))P.call(t,e)&&g(r,e,t[e]);if(E)for(var e of E(t))k.call(t,e)&&g(r,e,t[e]);return r},h=(r,t)=>w(r,M(t));var d=(r,t,e,o)=>{for(var s=o>1?void 0:o?A(t,e):t,i=r.length-1,p;i>=0;i--)(p=r[i])&&(s=(o?p(t,e,s):p(s))||s);return o&&s&&N(t,e,s),s},y=(r,t)=>(e,o)=>t(e,o,r);var a=(r,t,e)=>new Promise((o,s)=>{var i=c=>{try{m(e.next(c))}catch(C){s(C)}},p=c=>{try{m(e.throw(c))}catch(C){s(C)}},m=c=>c.done?o(c.value):Promise.resolve(c.value).then(i,p);m((e=e.apply(r,t)).next())});import{Inject as L,Injectable as H}from"@nestjs/common";var I="default",_="IORedisModuleConnectionToken",S="IORedisModuleOptionsToken",O="redisHealthIndicator";var l=class{constructor(t,e){this.redis=t;this.healthIndicatorService=e}isHealthy(t){return a(this,null,function*(){let e=this.healthIndicatorService.check(t);try{return yield this.redis.ping(),e.up()}catch(o){let s=o instanceof Error?o.message:String(o);return e.down({message:s})}})}};l=d([H(),y(0,L(O))],l);import{TerminusModule as j}from"@nestjs/terminus";import{Module as K}from"@nestjs/common";import $ from"ioredis";var x={provide:O,useFactory:()=>new $};var u=class{};u=d([K({providers:[l,x],exports:[l],imports:[j]})],u);import{Inject as Y}from"@nestjs/common";import f from"ioredis";import{Global as B,Logger as F,Module as W}from"@nestjs/common";import{ConfigurableModuleBuilder as U}from"@nestjs/common";var{ASYNC_OPTIONS_TYPE:ae,ConfigurableModuleClass:D,MODULE_OPTIONS_TOKEN:b}=new U().setExtras({connection:"default"},(r,t)=>{var o,s;(o=r.providers)!=null||(r.providers=[]),(s=r.exports)!=null||(r.exports=[]);let e=R(t.connection);return r.providers.push({useFactory:i=>v(i),provide:e,inject:[b]}),r.exports.push(e),r}).build();var n=class extends D{constructor(){super(...arguments);this.logger=new F(n.name)}static track(e){return this.redisConnections.push(new WeakRef(e)),e}onApplicationBootstrap(){return a(this,null,function*(){this.logger.log("Checking Redis connections health...");let e=n.redisConnections.map(o=>o.deref()).filter(o=>!!o);yield Promise.all(e.map((o,s)=>a(this,null,function*(){try{let i=yield o.ping();this.logger.log(`Redis client #${s} responded: ${i}`)}catch(i){this.logger.error(`Redis client #${s} ping failed: ${i.message}`)}})))})}onApplicationShutdown(){return a(this,null,function*(){yield Promise.allSettled(n.redisConnections.map(e=>e.deref()).filter(e=>!!e).map(e=>this.tryCloseRedisConnectionPermanently(e)))})}tryCloseRedisConnectionPermanently(e){return a(this,null,function*(){try{yield e.quit(),this.logger.log("Redis connection closed successfully.")}catch(o){this.logger.error("Error closing Redis connection:",o)}})}};n.redisConnections=[],n=d([W({}),B()],n);function fe(r){return`${r||I}_${S}`}function R(r){return`${r||I}_${_}`}function v(r){let{options:t={},type:e}=r,o;if(e==="cluster")o=new f.Cluster(r.nodes,t);else{let{options:{port:s,host:i}={},url:p}=r,m=h(T({},t),{port:s,host:i});o=p?new f(p,m):new f(m)}return n.track(o)}var he=r=>Y(R(r));export{he as InjectRedis,l as RedisHealthIndicator,u as RedisHealthModule,n as RedisModule,v as createRedisConnection,R as getRedisConnectionToken,fe as getRedisOptionsToken};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/redis-health/redis-health.indicator.ts","../src/redis.constants.ts","../src/redis-health/redis-health.module.ts","../src/redis-health/redis-health.provider.ts","../src/redis.decorators.ts","../src/redis.utils.ts","../src/redis.module.ts","../src/redis.module-definition.ts"],"sourcesContent":["import type Redis from 'ioredis';\n\nimport type { HealthIndicatorResult } from '@nestjs/terminus';\nimport { HealthIndicatorService } from '@nestjs/terminus';\nimport { Inject, Injectable } from '@nestjs/common';\n\nimport { REDIS_HEALTH_INDICATOR } from '../redis.constants';\n\n@Injectable()\nexport class RedisHealthIndicator {\n constructor(\n @Inject(REDIS_HEALTH_INDICATOR) private readonly redis: Redis,\n private readonly healthIndicatorService: HealthIndicatorService,\n ) {}\n\n async isHealthy(key: string): Promise<HealthIndicatorResult> {\n const indicator = this.healthIndicatorService.check(key);\n\n try {\n await this.redis.ping();\n return indicator.up();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return indicator.down({ message });\n }\n }\n}\n","export const REDIS_MODULE_CONNECTION = 'default';\nexport const REDIS_MODULE_CONNECTION_TOKEN = 'IORedisModuleConnectionToken';\nexport const REDIS_MODULE_OPTIONS_TOKEN = 'IORedisModuleOptionsToken';\n\nexport const REDIS_HEALTH_INDICATOR = 'redisHealthIndicator';\n","import { TerminusModule } from '@nestjs/terminus';\nimport { Module } from '@nestjs/common';\n\nimport { redisHealthIndicatorProvider } from './redis-health.provider';\nimport { RedisHealthIndicator } from './redis-health.indicator';\n\n@Module({\n providers: [RedisHealthIndicator, redisHealthIndicatorProvider],\n exports: [RedisHealthIndicator],\n imports: [TerminusModule],\n})\nexport class RedisHealthModule {}\n","import Redis from 'ioredis';\n\nimport { REDIS_HEALTH_INDICATOR } from '../redis.constants';\n\nexport const redisHealthIndicatorProvider = {\n provide: REDIS_HEALTH_INDICATOR,\n useFactory: () => new Redis(),\n};\n","import { Inject } from '@nestjs/common';\n\nimport { getRedisConnectionToken } from './redis.utils';\n\nexport const InjectRedis = (connection?: string) => {\n return Inject(getRedisConnectionToken(connection));\n};\n","import type { Cluster, RedisOptions } from 'ioredis';\nimport Redis from 'ioredis';\n\nimport {\n REDIS_MODULE_CONNECTION,\n REDIS_MODULE_CONNECTION_TOKEN,\n REDIS_MODULE_OPTIONS_TOKEN,\n} from './redis.constants';\nimport type { RedisModuleOptions } from './redis.interfaces';\nimport { RedisModule } from './redis.module';\n\nexport function getRedisOptionsToken(connection?: string): string {\n return `${connection || REDIS_MODULE_CONNECTION}_${REDIS_MODULE_OPTIONS_TOKEN}`;\n}\n\nexport function getRedisConnectionToken(connection?: string): string {\n return `${connection || REDIS_MODULE_CONNECTION}_${REDIS_MODULE_CONNECTION_TOKEN}`;\n}\n\nexport function createRedisConnection(options: RedisModuleOptions) {\n const { options: commonOptions = {}, type } = options;\n\n let client: Cluster | Redis;\n if (type === 'cluster') {\n client = new Redis.Cluster(options.nodes, commonOptions);\n } else {\n const { options: { port, host } = {}, url } = options;\n const redisOptions: RedisOptions = { ...commonOptions, port, host };\n client = url ? new Redis(url, redisOptions) : new Redis(redisOptions);\n }\n\n return RedisModule.track(client);\n}\n","import type { Cluster } from 'ioredis';\nimport type Redis from 'ioredis';\n\nimport type {\n OnApplicationBootstrap,\n OnApplicationShutdown,\n} from '@nestjs/common';\nimport { Global, Logger, Module } from '@nestjs/common';\n\nimport { RedisModuleClass } from './redis.module-definition';\n\n@Module({})\n@Global()\nexport class RedisModule\n extends RedisModuleClass\n implements OnApplicationShutdown, OnApplicationBootstrap\n{\n private static readonly redisConnections = [] as WeakRef<Cluster | Redis>[];\n private readonly logger = new Logger(RedisModule.name);\n\n static track(redis: Cluster | Redis) {\n this.redisConnections.push(new WeakRef(redis));\n return redis;\n }\n\n async onApplicationBootstrap() {\n this.logger.log('Checking Redis connections health...');\n const clients = RedisModule.redisConnections\n .map(ref => ref.deref())\n .filter((client): client is Cluster | Redis => !!client);\n\n await Promise.all(\n clients.map(async (client, index) => {\n try {\n const result = await client.ping();\n this.logger.log(`Redis client #${index} responded: ${result}`);\n } catch (error) {\n this.logger.error(\n `Redis client #${index} ping failed: ${error.message}`,\n );\n }\n }),\n );\n }\n\n async onApplicationShutdown() {\n await Promise.allSettled(\n RedisModule.redisConnections\n .map(ref => ref.deref())\n .filter((client): client is Cluster | Redis => !!client)\n .map(client => this.tryCloseRedisConnectionPermanently(client)),\n );\n }\n\n private async tryCloseRedisConnectionPermanently(redis: Cluster | Redis) {\n try {\n await redis.quit();\n this.logger.log('Redis connection closed successfully.');\n } catch (error) {\n this.logger.error('Error closing Redis connection:', error);\n }\n }\n}\n","import { ConfigurableModuleBuilder } from '@nestjs/common';\n\nimport type {\n RedisModuleExtraOptions,\n RedisModuleOptions,\n} from './redis.interfaces';\nimport { createRedisConnection, getRedisConnectionToken } from './redis.utils';\n\nexport const {\n ASYNC_OPTIONS_TYPE: RedisModuleAsyncOptions,\n ConfigurableModuleClass: RedisModuleClass,\n MODULE_OPTIONS_TOKEN: REDIS_OPTIONS_TOKEN,\n} = new ConfigurableModuleBuilder<RedisModuleOptions>()\n .setExtras<RedisModuleExtraOptions>(\n { connection: 'default' },\n (definition, extras) => {\n definition.providers ??= [];\n definition.exports ??= [];\n\n const REDIS_CONNECTION_TOKEN = getRedisConnectionToken(extras.connection);\n definition.providers.push({\n useFactory: (options: RedisModuleOptions) => {\n return createRedisConnection(options);\n },\n provide: REDIS_CONNECTION_TOKEN,\n\n inject: [REDIS_OPTIONS_TOKEN],\n });\n definition.exports.push(REDIS_CONNECTION_TOKEN);\n\n return definition;\n },\n )\n .build();\n"],"mappings":"uzBAIA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,iBCJ5B,IAAMC,EAA0B,UAC1BC,EAAgC,+BAChCC,EAA6B,4BAE7BC,EAAyB,uBDK/B,IAAMC,EAAN,KAA2B,CAChC,YACmDC,EAChCC,EACjB,CAFiD,WAAAD,EAChC,4BAAAC,CAChB,CAEG,UAAUC,EAA6C,QAAAC,EAAA,sBAC3D,IAAMC,EAAY,KAAK,uBAAuB,MAAMF,CAAG,EAEvD,GAAI,CACF,aAAM,KAAK,MAAM,KAAK,EACfE,EAAU,GAAG,CACtB,OAASC,EAAO,CACd,IAAMC,EAAUD,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACrE,OAAOD,EAAU,KAAK,CAAE,QAAAE,CAAQ,CAAC,CACnC,CAC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ACL,GAAM,CAAE,QAAS,CAAE,KAAAI,EAAM,KAAAC,CAAK,EAAI,CAAC,EAAG,IAAAC,CAAI,EAAIP,EACxCQ,EAA6BC,EAAAC,EAAA,GAAKT,GAAL,CAAoB,KAAAI,EAAM,KAAAC,CAAK,GAClEH,EAASI,EAAM,IAAIH,EAAMG,EAAKC,CAAY,EAAI,IAAIJ,EAAMI,CAAY,CACtE,CAEA,OAAOG,EAAY,MAAMR,CAAM,CACjC,CD5BO,IAAMS,GAAeC,GACnBC,EAAOC,EAAwBF,CAAU,CAAC","names":["Inject","Injectable","REDIS_MODULE_CONNECTION","REDIS_MODULE_CONNECTION_TOKEN","REDIS_MODULE_OPTIONS_TOKEN","REDIS_HEALTH_INDICATOR","RedisHealthIndicator","redis","healthIndicatorService","key","__async","indicator","error","message","__decorateClass","Injectable","__decorateParam","Inject","REDIS_HEALTH_INDICATOR","TerminusModule","Module","Redis","redisHealthIndicatorProvider","REDIS_HEALTH_INDICATOR","Redis","RedisHealthModule","__decorateClass","Module","RedisHealthIndicator","redisHealthIndicatorProvider","TerminusModule","Inject","Redis","Global","Logger","Module","ConfigurableModuleBuilder","RedisModuleAsyncOptions","RedisModuleClass","REDIS_OPTIONS_TOKEN","ConfigurableModuleBuilder","definition","extras","_a","_b","REDIS_CONNECTION_TOKEN","getRedisConnectionToken","options","createRedisConnection","RedisModule","RedisModuleClass","Logger","redis","__async","clients","ref","client","index","result","error","__decorateClass","Module","Global","getRedisOptionsToken","connection","REDIS_MODULE_CONNECTION","REDIS_MODULE_OPTIONS_TOKEN","getRedisConnectionToken","REDIS_MODULE_CONNECTION_TOKEN","createRedisConnection","options","commonOptions","type","client","Redis","port","host","url","redisOptions","__spreadProps","__spreadValues","RedisModule","InjectRedis","connection","Inject","getRedisConnectionToken"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rineex/ioredis",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Redis adapter for Rineex core modules",
|
|
5
5
|
"author": "Rineex Team",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"publishConfig": {
|
|
34
|
+
"provenance": true,
|
|
34
35
|
"access": "public",
|
|
35
36
|
"registry": "https://registry.npmjs.org"
|
|
36
37
|
},
|