@enterprisestandard/redis 0.0.19 → 0.0.20-beta.20260521.2
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 +5 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ bun add @enterprisestandard/redis
|
|
|
10
10
|
|
|
11
11
|
## Secret-backed reactive Redis
|
|
12
12
|
|
|
13
|
-
Use **`esRedis(source, path, options?)`** when
|
|
13
|
+
Use **`esRedis(source, path, options?)`** when Redis connection details arrive from the default config-backed secret client or a named `es.secrets` provider and may rotate over time.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { enterpriseStandard, envConfig } from '@enterprisestandard/server';
|
|
@@ -19,12 +19,9 @@ import { esRedis, RedisSessionStore, RedisUserStore } from '@enterprisestandard/
|
|
|
19
19
|
|
|
20
20
|
export const es = enterpriseStandard(envConfig(), {
|
|
21
21
|
validators: createValidators(),
|
|
22
|
-
secrets: {
|
|
23
|
-
redis: {},
|
|
24
|
-
},
|
|
25
22
|
});
|
|
26
23
|
|
|
27
|
-
const redis = esRedis(es.
|
|
24
|
+
const redis = esRedis(es.secret, `${process.env.ES_VAULT_PATH}/redis`);
|
|
28
25
|
es.setStores({
|
|
29
26
|
sessionStore: new RedisSessionStore({ redis }),
|
|
30
27
|
userStore: new RedisUserStore({ redis }),
|
|
@@ -33,7 +30,7 @@ es.setStores({
|
|
|
33
30
|
|
|
34
31
|
Notes:
|
|
35
32
|
|
|
36
|
-
- The first argument is a stable `SecretsSource` handle (for example `es.secrets.redis`) and the second is the **secret path**. By default the log label is **`redis`**; override that with `{ sourceName }` when needed.
|
|
33
|
+
- The first argument is a stable `SecretsSource` handle (for example `es.secret` or `es.secrets.redis`) and the second is the **secret path**. By default the log label is **`redis`**; override that with `{ sourceName }` when needed.
|
|
37
34
|
- The secret payload should be a node-redis client options object. A top-level **`url`** or **`redisUrl`** field is the simplest shape.
|
|
38
35
|
- The adapter subscribes with async get-then-watch semantics and defaults to fail-fast: a missing Redis secret rejects `ready()` and store operations instead of waiting silently forever. Pass `{ subscription: { mode: 'wait', timeout: 30_000 } }` only when waiting for the secret to appear is intentional.
|
|
39
36
|
- The adapter is source-bound at creation time. Store operations wait for the first configured connection, so you can construct stores synchronously and use `ready()` only when you want an explicit startup or health-check barrier. If the named source is replaced during reconfigure, the adapter creates the next Redis client first and keeps the old client when refresh fails.
|
|
@@ -102,3 +99,5 @@ const redis = createRedisAdapterV4(client);
|
|
|
102
99
|
Prefer **createRedisAdapter** (v5) when you can upgrade.
|
|
103
100
|
|
|
104
101
|
Pass these stores into `enterpriseStandard` (from `@enterprisestandard/server`) the same way you would in-memory stores. Optional: `keyPrefix` and `logger` in store options (see `@enterprisestandard/redis-core` for the adapter interface and key layout). Use one shared `RedisSessionStore` namespace for opaque browser auth sessions so `SessionStore.get(sid)` can resolve the session without tenant-specific lookup context.
|
|
102
|
+
|
|
103
|
+
`RedisTenantStore` keeps user-to-tenant membership sets so tenant-directory lookups do not scan every tenant. It then materializes the matching candidate tenants and applies `ListOptions` in memory. That is appropriate when each user or discovery lookup maps to a bounded tenant set; use a SQL/search-backed custom `TenantStore` when directories need high-cardinality paging or arbitrary indexed sort/filter behavior.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enterprisestandard/redis",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20-beta.20260521.2",
|
|
4
4
|
"description": "redis (node-redis) adapter and Redis stores for Enterprise Standard. Includes createRedisAdapter (v5) and createRedisAdapterV4 (v4). Install this; redis is included.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "enterprisestandard",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./package.json": "./package.json"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@enterprisestandard/redis-core": "
|
|
24
|
+
"@enterprisestandard/redis-core": "0.0.20-beta.20260521.2",
|
|
25
25
|
"redis": "^5.10.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|