@fluojs/redis 1.0.0-beta.5 → 1.0.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/README.ko.md +4 -0
- package/README.md +4 -0
- package/dist/service.d.ts +1 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +9 -1
- package/package.json +4 -4
package/README.ko.md
CHANGED
|
@@ -151,6 +151,7 @@ export class AdvancedService {
|
|
|
151
151
|
### 핵심 구성 요소
|
|
152
152
|
- `RedisModule`: Redis 클라이언트 등록 및 수명 주기 훅을 관리합니다.
|
|
153
153
|
- `RedisModule.forRoot(options)`: `name`을 생략하면 기본 Redis 클라이언트와 `RedisService` 파사드를 등록하고, `name`을 제공하면 추가 이름 있는 Redis 클라이언트를 등록합니다. 기본 등록은 기본적으로 global이고, 이름 있는 등록은 scoped입니다. `lifecycle.connectTimeoutMs`와 `lifecycle.quitTimeoutMs`로 Fluo가 소유한 연결 시작/종료 시간을 제한할 수 있습니다.
|
|
154
|
+
- lifecycle hook은 `RedisModule.forRoot(...).lifecycle`로만 설정합니다. 내부 lifecycle service는 의도적으로 public API에 포함하지 않습니다.
|
|
154
155
|
- `RedisService`: JSON 코덱 지원 및 `get`/`set`/`del` 메서드를 제공하는 파사드입니다.
|
|
155
156
|
- `REDIS_CLIENT`: 내부 `ioredis` 인스턴스에 접근하기 위한 DI 토큰입니다.
|
|
156
157
|
- `DEFAULT_REDIS_CLIENT_NAME`: 안정적인 기본 Redis client name입니다.
|
|
@@ -160,7 +161,10 @@ export class AdvancedService {
|
|
|
160
161
|
- `createRedisPlatformStatusSnapshot(input)`: Redis 연결 상태를 Fluo 플랫폼 health/readiness 스냅샷으로 변환합니다.
|
|
161
162
|
|
|
162
163
|
### 타입
|
|
164
|
+
- `DefaultRedisModuleOptions`: 이름 없는 기본 Redis 등록이 받는 옵션입니다. 선택적 global alias visibility와 lifecycle timeout control을 포함합니다.
|
|
165
|
+
- `NamedRedisModuleOptions`: 추가 이름 있는 Redis 등록이 받는 옵션입니다. 필수 `name`과 scoped lifecycle timeout control을 포함합니다.
|
|
163
166
|
- `RedisModuleOptions`: Fluo가 module-only `name`, `global`, `lifecycle` 필드를 제거한 뒤 `ioredis` 생성자에 전달하는 설정 옵션입니다.
|
|
167
|
+
- `RedisClientOptions`: Fluo가 module-only field를 제거하고 내부에서 `lazyConnect: true`를 강제하기 전의 Redis constructor option입니다.
|
|
164
168
|
- `RedisLifecycleOptions`: Fluo가 소유한 `connect()`와 `quit()` lifecycle command의 timeout을 조정하는 선택적 옵션입니다.
|
|
165
169
|
- `PersistencePlatformStatusSnapshot`, `RedisStatusAdapterInput`: status snapshot input/output type입니다.
|
|
166
170
|
|
package/README.md
CHANGED
|
@@ -151,6 +151,7 @@ export class AdvancedService {
|
|
|
151
151
|
### Core
|
|
152
152
|
- `RedisModule`: Registers Redis clients and lifecycle hooks.
|
|
153
153
|
- `RedisModule.forRoot(options)`: Registers the default Redis client plus `RedisService` facade when `name` is omitted, or an additional named Redis client when `name` is provided. The default registration is global by default; named registrations are scoped. Use `lifecycle.connectTimeoutMs` and `lifecycle.quitTimeoutMs` to bound Fluo-owned connection startup and shutdown.
|
|
154
|
+
- Lifecycle hooks are configured only through `RedisModule.forRoot(...).lifecycle`; the internal lifecycle service is intentionally not part of the public API.
|
|
154
155
|
- `RedisService`: Facade with JSON codec support and `get`/`set`/`del` methods.
|
|
155
156
|
- `REDIS_CLIENT`: DI token for the underlying `ioredis` instance.
|
|
156
157
|
- `DEFAULT_REDIS_CLIENT_NAME`: Stable default Redis client name.
|
|
@@ -160,7 +161,10 @@ export class AdvancedService {
|
|
|
160
161
|
- `createRedisPlatformStatusSnapshot(input)`: Adapts Redis connection state into Fluo's platform health/readiness snapshot contract.
|
|
161
162
|
|
|
162
163
|
### Types
|
|
164
|
+
- `DefaultRedisModuleOptions`: Options accepted by the unnamed default Redis registration, including optional global alias visibility and lifecycle timeout controls.
|
|
165
|
+
- `NamedRedisModuleOptions`: Options accepted by additional named Redis registrations, including required `name` and scoped lifecycle timeout controls.
|
|
163
166
|
- `RedisModuleOptions`: Configuration options passed to the `ioredis` constructor after Fluo removes module-only `name`, `global`, and `lifecycle` fields.
|
|
167
|
+
- `RedisClientOptions`: Redis constructor options after Fluo removes module-only fields and before it forces `lazyConnect: true` internally.
|
|
164
168
|
- `RedisLifecycleOptions`: Optional timeout controls for Fluo-owned `connect()` and `quit()` lifecycle commands.
|
|
165
169
|
- `PersistencePlatformStatusSnapshot`, `RedisStatusAdapterInput`: Status snapshot input/output types.
|
|
166
170
|
|
package/dist/service.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class RedisLifecycleService implements OnModuleInit, OnApplicatio
|
|
|
15
15
|
private shouldConnectOnInit;
|
|
16
16
|
private disconnectIfPossible;
|
|
17
17
|
private quitWithDisconnectFallback;
|
|
18
|
+
private connectWithDisconnectFallback;
|
|
18
19
|
private describeClient;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAiDxD;;GAEG;AACH,qBACa,qBAAsB,YAAW,YAAY,EAAE,qBAAqB;IAE7E,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAFhB,MAAM,EAAE,KAAK,EACb,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,gBAAgB,GAAE,qBAA0B;IAGzD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAiDxD;;GAEG;AACH,qBACa,qBAAsB,YAAW,YAAY,EAAE,qBAAqB;IAE7E,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAFhB,MAAM,EAAE,KAAK,EACb,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,gBAAgB,GAAE,qBAA0B;IAGzD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7B,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5C,4BAA4B;IAO5B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,oBAAoB;YAMd,0BAA0B;YAiB1B,6BAA6B;IAc3C,OAAO,CAAC,cAAc;CAGvB"}
|
package/dist/service.js
CHANGED
|
@@ -60,7 +60,7 @@ class RedisLifecycleService {
|
|
|
60
60
|
if (!this.shouldConnectOnInit()) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
await
|
|
63
|
+
await this.connectWithDisconnectFallback();
|
|
64
64
|
}
|
|
65
65
|
async onApplicationShutdown() {
|
|
66
66
|
const status = this.client.status;
|
|
@@ -98,6 +98,14 @@ class RedisLifecycleService {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
async connectWithDisconnectFallback() {
|
|
102
|
+
try {
|
|
103
|
+
await withLifecycleTimeout(this.client.connect(), normalizeTimeoutMs(this.lifecycleOptions.connectTimeoutMs), `Redis client ${this.describeClient()} connect timed out after ${String(normalizeTimeoutMs(this.lifecycleOptions.connectTimeoutMs))}ms.`);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
this.disconnectIfPossible(this.client.status);
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
101
109
|
describeClient() {
|
|
102
110
|
return this.clientName ?? 'default';
|
|
103
111
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"connection",
|
|
10
10
|
"lifecycle"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.
|
|
12
|
+
"version": "1.0.1",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluojs/core": "^1.0.
|
|
40
|
-
"@fluojs/di": "^1.0.
|
|
41
|
-
"@fluojs/runtime": "^1.
|
|
39
|
+
"@fluojs/core": "^1.0.3",
|
|
40
|
+
"@fluojs/di": "^1.0.3",
|
|
41
|
+
"@fluojs/runtime": "^1.1.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"ioredis": "^5.10.0"
|