@enterprisestandard/ioredis 0.0.8-beta.20260214.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/README.md +36 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @enterprisestandard/ioredis
|
|
2
|
+
|
|
3
|
+
ioredis adapter and Redis stores for Enterprise Standard. Install this package and **ioredis**; import the adapter and all store classes from here. You do not need to install `@enterprisestandard/redis-core` separately.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @enterprisestandard/ioredis ioredis
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import Redis from 'ioredis';
|
|
15
|
+
import {
|
|
16
|
+
createIoredisAdapter,
|
|
17
|
+
RedisUserStore,
|
|
18
|
+
RedisSessionStore,
|
|
19
|
+
RedisMagicLinkStore,
|
|
20
|
+
RedisWorkloadTokenStore,
|
|
21
|
+
RedisGroupStore,
|
|
22
|
+
RedisTenantStore,
|
|
23
|
+
} from '@enterprisestandard/ioredis';
|
|
24
|
+
|
|
25
|
+
const client = new Redis(process.env.REDIS_URL ?? 'redis://localhost:6379');
|
|
26
|
+
const redis = createIoredisAdapter(client);
|
|
27
|
+
|
|
28
|
+
const userStore = new RedisUserStore({ redis });
|
|
29
|
+
const sessionStore = new RedisSessionStore({ redis });
|
|
30
|
+
const magicLinkStore = new RedisMagicLinkStore({ redis });
|
|
31
|
+
const workloadTokenStore = new RedisWorkloadTokenStore({ redis });
|
|
32
|
+
const groupStore = new RedisGroupStore({ redis });
|
|
33
|
+
const tenantStore = new RedisTenantStore({ redis });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
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).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RedisAdapter as RedisAdapter2 } from "@enterprisestandard/redis-core";
|
|
2
|
+
import { getKeyPrefix, getLogger, isRedisVersionSupported, prefixedKey, RedisGroupStore, RedisMagicLinkStore, RedisSessionStore, RedisStoreOptions, RedisTenantStore, RedisUserStore, RedisWorkloadTokenStore, supportsSortedSetList } from "@enterprisestandard/redis-core";
|
|
3
|
+
import { RedisAdapter } from "@enterprisestandard/redis-core";
|
|
4
|
+
import { Redis } from "ioredis";
|
|
5
|
+
/**
|
|
6
|
+
* Create a RedisAdapter that uses an ioredis Redis client.
|
|
7
|
+
* Implements the full interface including sorted-set list and getRedisVersion.
|
|
8
|
+
*/
|
|
9
|
+
declare function createIoredisAdapter(redis: Redis): RedisAdapter;
|
|
10
|
+
export { supportsSortedSetList, prefixedKey, isRedisVersionSupported, getLogger, getKeyPrefix, createIoredisAdapter, RedisWorkloadTokenStore, RedisUserStore, RedisTenantStore, RedisStoreOptions, RedisSessionStore, RedisMagicLinkStore, RedisGroupStore, RedisAdapter2 as RedisAdapter };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getKeyPrefix as f,getLogger as A,isRedisVersionSupported as G,prefixedKey as M,RedisGroupStore as O,RedisMagicLinkStore as P,RedisSessionStore as U,RedisTenantStore as W,RedisUserStore as j,RedisWorkloadTokenStore as q,supportsSortedSetList as t}from"@enterprisestandard/redis-core";function g(p){return{async get(o){return p.get(o)},async set(o,S){await p.set(o,S)},async setex(o,S,R){await p.setex(o,S,R)},async del(o){await p.del(o)},async sadd(o,...S){if(S.length>0)await p.sadd(o,...S)},async srem(o,...S){if(S.length>0)await p.srem(o,...S)},async smembers(o){return p.smembers(o)},async mget(o){if(o.length===0)return[];return p.mget(...o)},async zadd(o,S,R){await p.zadd(o,S,R)},async zrem(o,...S){if(S.length>0)await p.zrem(o,...S)},async zrange(o,S,R,x){if(x)return p.zrevrange(o,S,R);return p.zrange(o,S,R)},async zcard(o){return p.zcard(o)},async getRedisVersion(){let o=await p.call("INFO","server");if(typeof o!=="string")return null;let S=/redis_version:([^\r\n]+)/.exec(o);return S?S[1].trim():null}}}export{t as supportsSortedSetList,M as prefixedKey,G as isRedisVersionSupported,A as getLogger,f as getKeyPrefix,g as createIoredisAdapter,q as RedisWorkloadTokenStore,j as RedisUserStore,W as RedisTenantStore,U as RedisSessionStore,P as RedisMagicLinkStore,O as RedisGroupStore};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@enterprisestandard/ioredis",
|
|
3
|
+
"version": "0.0.8-beta.20260214.5",
|
|
4
|
+
"description": "ioredis adapter and Redis stores for Enterprise Standard. Single package: install this and ioredis; import adapter and stores from here.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"author": "enterprisestandard",
|
|
7
|
+
"license": "proprietary",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@enterprisestandard/redis-core": "0.0.8-beta.20260214.5"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"ioredis": "*"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"ioredis": "^5.8.0",
|
|
31
|
+
"typescript": "^5.9.3"
|
|
32
|
+
}
|
|
33
|
+
}
|