ioredis-toolkit 0.0.4 → 0.0.5
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/dist/client.d.ts +2 -2
- package/dist/client.js +2 -3
- package/dist/session/session-manager.d.ts +14 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Cache } from "./cache.js";
|
|
|
5
5
|
import { PubSub } from "./pubsub.js";
|
|
6
6
|
import { DistributedLock } from "./lock.js";
|
|
7
7
|
import { RateLimiter } from "./ratelimiter.js";
|
|
8
|
-
import { SessionManager,
|
|
8
|
+
import { SessionManager, WithSessionManagerOptions } from "./session/session-manager.js";
|
|
9
9
|
import { RedisRevocationStore } from "./session/revocation-store.js";
|
|
10
10
|
export interface RedisClientOptions {
|
|
11
11
|
config: RedisConfigInput;
|
|
@@ -85,7 +85,7 @@ export declare class RedisClientWrapper {
|
|
|
85
85
|
withRateLimiter(value: RateLimitOptionsInput): RedisClientWrapper;
|
|
86
86
|
get revocationStore(): RedisRevocationStore;
|
|
87
87
|
get session(): SessionManager;
|
|
88
|
-
withSession(value:
|
|
88
|
+
withSession(value: WithSessionManagerOptions): RedisClientWrapper;
|
|
89
89
|
private createClient;
|
|
90
90
|
private createClusterClient;
|
|
91
91
|
private createSentinelClient;
|
package/dist/client.js
CHANGED
|
@@ -197,11 +197,10 @@ export class RedisClientWrapper {
|
|
|
197
197
|
withSession(value) {
|
|
198
198
|
const revocationRedisStore = this.revocationStore;
|
|
199
199
|
const config = deepMerge(this.config.sessionOptions ?? {}, value);
|
|
200
|
-
const { revocationStore = revocationRedisStore, ...rest } = config ?? {};
|
|
201
200
|
const newConfig = {
|
|
202
|
-
...
|
|
201
|
+
...config,
|
|
203
202
|
client: this,
|
|
204
|
-
revocationStore,
|
|
203
|
+
revocationStore: revocationRedisStore,
|
|
205
204
|
};
|
|
206
205
|
this.config.sessionOptions = newConfig;
|
|
207
206
|
this._session = undefined;
|
|
@@ -31,6 +31,20 @@ export type SessionManagerOptions = {
|
|
|
31
31
|
/** Injectable clock for tests. */
|
|
32
32
|
now?: () => number;
|
|
33
33
|
};
|
|
34
|
+
export type WithSessionManagerOptions = {
|
|
35
|
+
/** Session configuration (defaults applied; see SessionConfigSchema). */
|
|
36
|
+
config?: PartialSessionConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Encryption key provider. REQUIRED when config.encryption.enabled is
|
|
39
|
+
* true (fail at construction rather than at first write). The provider
|
|
40
|
+
* should be backed by a KMS/vault in production.
|
|
41
|
+
*/
|
|
42
|
+
encryptionKeyProvider?: SessionKeyProvider;
|
|
43
|
+
/** Metrics adapter (no-op without it). */
|
|
44
|
+
metricsAdapter?: SessionMetricsAdapter;
|
|
45
|
+
/** Injectable clock for tests. */
|
|
46
|
+
now?: () => number;
|
|
47
|
+
};
|
|
34
48
|
export declare class SessionManager {
|
|
35
49
|
readonly config: SessionConfig;
|
|
36
50
|
readonly service: SessionService;
|
package/package.json
CHANGED