@cogitator-ai/redis 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cogitator Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # @cogitator-ai/redis
2
+
3
+ Unified Redis client for Cogitator with standalone and cluster support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @cogitator-ai/redis ioredis
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Standalone Mode
14
+
15
+ ```typescript
16
+ import { createRedisClient } from '@cogitator-ai/redis';
17
+
18
+ const redis = await createRedisClient({
19
+ url: 'redis://localhost:6379',
20
+ });
21
+
22
+ await redis.set('key', 'value');
23
+ const value = await redis.get('key');
24
+ ```
25
+
26
+ ### Cluster Mode
27
+
28
+ ```typescript
29
+ import { createRedisClient } from '@cogitator-ai/redis';
30
+
31
+ const redis = await createRedisClient({
32
+ cluster: {
33
+ nodes: [
34
+ { host: 'node1', port: 6379 },
35
+ { host: 'node2', port: 6379 },
36
+ { host: 'node3', port: 6379 },
37
+ ],
38
+ },
39
+ });
40
+ ```
41
+
42
+ ### Environment Configuration
43
+
44
+ ```typescript
45
+ import { createConfigFromEnv } from '@cogitator-ai/redis';
46
+
47
+ // Reads from REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD
48
+ // REDIS_CLUSTER_NODES for cluster mode
49
+ const config = createConfigFromEnv();
50
+ const redis = await createRedisClient(config);
51
+ ```
52
+
53
+ ### Auto-Detection
54
+
55
+ ```typescript
56
+ import { detectRedisMode } from '@cogitator-ai/redis';
57
+
58
+ // Automatically detects standalone vs cluster
59
+ const mode = await detectRedisMode(config);
60
+ ```
61
+
62
+ ## Environment Variables
63
+
64
+ - `REDIS_URL` - Redis connection URL
65
+ - `REDIS_HOST` - Redis host (alternative to URL)
66
+ - `REDIS_PORT` - Redis port (default: 6379)
67
+ - `REDIS_PASSWORD` - Redis password
68
+ - `REDIS_CLUSTER_NODES` - JSON array of cluster nodes
69
+ - `REDIS_KEY_PREFIX` - Key prefix (auto-uses `{cogitator}:` for cluster)
70
+
71
+ ## Documentation
72
+
73
+ See the [Cogitator documentation](https://github.com/eL1fe/cogitator) for full API reference.
74
+
75
+ ## License
76
+
77
+ MIT
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ describe('@cogitator-ai/redis', () => {
3
+ it('exports createRedisClient', async () => {
4
+ const { createRedisClient } = await import('../index');
5
+ expect(createRedisClient).toBeDefined();
6
+ expect(typeof createRedisClient).toBe('function');
7
+ });
8
+ it('exports createConfigFromEnv', async () => {
9
+ const { createConfigFromEnv } = await import('../index');
10
+ expect(createConfigFromEnv).toBeDefined();
11
+ expect(typeof createConfigFromEnv).toBe('function');
12
+ });
13
+ });
14
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,CAAC,iBAAiB,CAAC,CAAC,WAAW,EAAE,CAAC;QACxC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QACzD,MAAM,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Redis client factory
3
+ *
4
+ * Creates unified Redis clients that work in both standalone and cluster modes.
5
+ */
6
+ import type { RedisConfig, RedisClient, RedisStandaloneConfig } from './types';
7
+ /**
8
+ * Create a Redis client from configuration
9
+ *
10
+ * @example Standalone mode
11
+ * ```ts
12
+ * const client = await createRedisClient({
13
+ * url: 'redis://localhost:6379',
14
+ * keyPrefix: 'myapp:',
15
+ * });
16
+ * ```
17
+ *
18
+ * @example Cluster mode
19
+ * ```ts
20
+ * const client = await createRedisClient({
21
+ * mode: 'cluster',
22
+ * nodes: [
23
+ * { host: '10.0.0.1', port: 6379 },
24
+ * { host: '10.0.0.2', port: 6379 },
25
+ * { host: '10.0.0.3', port: 6379 },
26
+ * ],
27
+ * keyPrefix: '{myapp}:', // Hash tag for cluster key routing
28
+ * });
29
+ * ```
30
+ */
31
+ export declare function createRedisClient(config: RedisConfig): Promise<RedisClient>;
32
+ /**
33
+ * Detect if a Redis server is running in cluster mode
34
+ *
35
+ * Useful for auto-detection when mode is not explicitly specified.
36
+ */
37
+ export declare function detectRedisMode(config: Omit<RedisStandaloneConfig, 'mode'>): Promise<'standalone' | 'cluster'>;
38
+ /**
39
+ * Parse REDIS_CLUSTER_NODES environment variable
40
+ *
41
+ * @example
42
+ * ```
43
+ * REDIS_CLUSTER_NODES='[{"host":"10.0.0.1","port":6379},{"host":"10.0.0.2","port":6379}]'
44
+ * ```
45
+ */
46
+ export declare function parseClusterNodesEnv(env?: string): {
47
+ host: string;
48
+ port: number;
49
+ }[] | null;
50
+ /**
51
+ * Create Redis configuration from environment variables
52
+ *
53
+ * Supports:
54
+ * - REDIS_URL - standalone Redis URL
55
+ * - REDIS_HOST + REDIS_PORT - standalone Redis host/port
56
+ * - REDIS_CLUSTER_NODES - JSON array of cluster nodes
57
+ * - REDIS_PASSWORD - authentication password
58
+ * - REDIS_KEY_PREFIX - key prefix (default: 'cogitator:' or '{cogitator}:' for cluster)
59
+ */
60
+ export declare function createConfigFromEnv(env?: NodeJS.ProcessEnv): RedisConfig;
61
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAsB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA2BnG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAejF;AAmGD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC1C,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,IAAI,CAiB1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CAoBrF"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Redis client factory
3
+ *
4
+ * Creates unified Redis clients that work in both standalone and cluster modes.
5
+ */
6
+ import { isClusterConfig } from './types';
7
+ /**
8
+ * Create a Redis client from configuration
9
+ *
10
+ * @example Standalone mode
11
+ * ```ts
12
+ * const client = await createRedisClient({
13
+ * url: 'redis://localhost:6379',
14
+ * keyPrefix: 'myapp:',
15
+ * });
16
+ * ```
17
+ *
18
+ * @example Cluster mode
19
+ * ```ts
20
+ * const client = await createRedisClient({
21
+ * mode: 'cluster',
22
+ * nodes: [
23
+ * { host: '10.0.0.1', port: 6379 },
24
+ * { host: '10.0.0.2', port: 6379 },
25
+ * { host: '10.0.0.3', port: 6379 },
26
+ * ],
27
+ * keyPrefix: '{myapp}:', // Hash tag for cluster key routing
28
+ * });
29
+ * ```
30
+ */
31
+ export async function createRedisClient(config) {
32
+ const ioredisModule = await import('ioredis');
33
+ const ioredis = (ioredisModule.default ?? ioredisModule);
34
+ if (isClusterConfig(config)) {
35
+ return createClusterClient(ioredis, config);
36
+ }
37
+ return createStandaloneClient(ioredis, config);
38
+ }
39
+ /**
40
+ * Create a standalone Redis client
41
+ */
42
+ function createStandaloneClient(ioredis, config) {
43
+ const url = config.url ?? buildUrl(config.host, config.port);
44
+ const client = new ioredis(url, {
45
+ password: config.password,
46
+ db: config.db,
47
+ tls: config.tls ? {} : undefined,
48
+ keyPrefix: config.keyPrefix,
49
+ maxRetriesPerRequest: config.maxRetriesPerRequest ?? 3,
50
+ lazyConnect: config.lazyConnect ?? false,
51
+ retryStrategy: (times) => Math.min(times * 50, 2000),
52
+ });
53
+ return wrapClient(client);
54
+ }
55
+ /**
56
+ * Create a Redis Cluster client
57
+ */
58
+ function createClusterClient(ioredis, config) {
59
+ const cluster = new ioredis.Cluster(config.nodes, {
60
+ scaleReads: config.scaleReads ?? 'master',
61
+ redisOptions: {
62
+ password: config.password,
63
+ tls: config.tls ? {} : undefined,
64
+ maxRetriesPerRequest: config.maxRetriesPerRequest ?? 3,
65
+ lazyConnect: config.lazyConnect ?? false,
66
+ },
67
+ clusterRetryStrategy: (times) => Math.min(100 + times * 2, 2000),
68
+ natMap: config.natMap,
69
+ keyPrefix: config.keyPrefix,
70
+ });
71
+ return wrapClient(cluster);
72
+ }
73
+ /**
74
+ * Build Redis URL from host and port
75
+ */
76
+ function buildUrl(host, port) {
77
+ return `redis://${host ?? 'localhost'}:${port ?? 6379}`;
78
+ }
79
+ /**
80
+ * Wrap raw Redis client as unified RedisClient interface
81
+ */
82
+ function wrapClient(client) {
83
+ return {
84
+ ping: () => client.ping(),
85
+ quit: () => client.quit(),
86
+ get: (key) => client.get(key),
87
+ set: (key, value) => client.set(key, value),
88
+ setex: (key, seconds, value) => client.setex(key, seconds, value),
89
+ del: (...keys) => client.del(...keys),
90
+ expire: (key, seconds) => client.expire(key, seconds),
91
+ mget: (...keys) => client.mget(...keys),
92
+ zadd: (key, score, member) => client.zadd(key, score, member),
93
+ zrange: (key, start, stop) => client.zrange(key, start, stop),
94
+ zrangebyscore: (key, min, max) => client.zrangebyscore(key, min, max),
95
+ zrem: (key, ...members) => client.zrem(key, ...members),
96
+ smembers: (key) => client.smembers(key),
97
+ publish: (channel, message) => client.publish(channel, message),
98
+ subscribe: async (channel) => {
99
+ await client.subscribe(channel);
100
+ },
101
+ unsubscribe: async (channel) => {
102
+ await client.unsubscribe(channel);
103
+ },
104
+ on: (event, callback) => {
105
+ client.on(event, callback);
106
+ },
107
+ off: (event, callback) => {
108
+ client.off(event, callback);
109
+ },
110
+ keys: (pattern) => client.keys(pattern),
111
+ duplicate: () => wrapClient(client.duplicate()),
112
+ info: (section) => (section ? client.info(section) : client.info()),
113
+ };
114
+ }
115
+ /**
116
+ * Detect if a Redis server is running in cluster mode
117
+ *
118
+ * Useful for auto-detection when mode is not explicitly specified.
119
+ */
120
+ export async function detectRedisMode(config) {
121
+ const client = await createRedisClient({ ...config, mode: 'standalone' });
122
+ try {
123
+ const info = await client.info('cluster');
124
+ return info.includes('cluster_enabled:1') ? 'cluster' : 'standalone';
125
+ }
126
+ finally {
127
+ await client.quit();
128
+ }
129
+ }
130
+ /**
131
+ * Parse REDIS_CLUSTER_NODES environment variable
132
+ *
133
+ * @example
134
+ * ```
135
+ * REDIS_CLUSTER_NODES='[{"host":"10.0.0.1","port":6379},{"host":"10.0.0.2","port":6379}]'
136
+ * ```
137
+ */
138
+ export function parseClusterNodesEnv(env) {
139
+ if (!env)
140
+ return null;
141
+ try {
142
+ const nodes = JSON.parse(env);
143
+ if (!Array.isArray(nodes))
144
+ return null;
145
+ return nodes.filter((node) => typeof node === 'object' &&
146
+ node !== null &&
147
+ typeof node.host === 'string' &&
148
+ typeof node.port === 'number');
149
+ }
150
+ catch {
151
+ return null;
152
+ }
153
+ }
154
+ /**
155
+ * Create Redis configuration from environment variables
156
+ *
157
+ * Supports:
158
+ * - REDIS_URL - standalone Redis URL
159
+ * - REDIS_HOST + REDIS_PORT - standalone Redis host/port
160
+ * - REDIS_CLUSTER_NODES - JSON array of cluster nodes
161
+ * - REDIS_PASSWORD - authentication password
162
+ * - REDIS_KEY_PREFIX - key prefix (default: 'cogitator:' or '{cogitator}:' for cluster)
163
+ */
164
+ export function createConfigFromEnv(env = process.env) {
165
+ const clusterNodes = parseClusterNodesEnv(env.REDIS_CLUSTER_NODES);
166
+ if (clusterNodes && clusterNodes.length > 0) {
167
+ return {
168
+ mode: 'cluster',
169
+ nodes: clusterNodes,
170
+ password: env.REDIS_PASSWORD,
171
+ keyPrefix: env.REDIS_KEY_PREFIX ?? '{cogitator}:',
172
+ };
173
+ }
174
+ return {
175
+ mode: 'standalone',
176
+ url: env.REDIS_URL,
177
+ host: env.REDIS_HOST ?? 'localhost',
178
+ port: parseInt(env.REDIS_PORT ?? '6379', 10),
179
+ password: env.REDIS_PASSWORD,
180
+ keyPrefix: env.REDIS_KEY_PREFIX ?? 'cogitator:',
181
+ };
182
+ }
183
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA0B1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAmB;IACzD,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,CAAC,aAAa,CAAC,OAAO,IAAI,aAAa,CAMtD,CAAC;IAEF,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAUD;;GAEG;AACH,SAAS,sBAAsB,CAC7B,OAAgB,EAChB,MAA6B;IAE7B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAA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IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO;YACL,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,GAAG,CAAC,cAAc;YAC5B,SAAS,EAAE,GAAG,CAAC,gBAAgB,IAAI,cAAc;SAClD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,GAAG,CAAC,SAAS;QAClB,IAAI,EAAE,GAAG,CAAC,UAAU,IAAI,WAAW;QACnC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,EAAE,EAAE,CAAC;QAC5C,QAAQ,EAAE,GAAG,CAAC,cAAc;QAC5B,SAAS,EAAE,GAAG,CAAC,gBAAgB,IAAI,YAAY;KAChD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @cogitator-ai/redis - Unified Redis client with cluster support
3
+ *
4
+ * @example Standalone mode
5
+ * ```ts
6
+ * import { createRedisClient } from '@cogitator-ai/redis';
7
+ *
8
+ * const client = await createRedisClient({
9
+ * url: 'redis://localhost:6379',
10
+ * keyPrefix: 'myapp:',
11
+ * });
12
+ *
13
+ * await client.set('key', 'value');
14
+ * const value = await client.get('key');
15
+ * ```
16
+ *
17
+ * @example Cluster mode
18
+ * ```ts
19
+ * import { createRedisClient } from '@cogitator-ai/redis';
20
+ *
21
+ * const client = await createRedisClient({
22
+ * mode: 'cluster',
23
+ * nodes: [
24
+ * { host: '10.0.0.1', port: 6379 },
25
+ * { host: '10.0.0.2', port: 6379 },
26
+ * { host: '10.0.0.3', port: 6379 },
27
+ * ],
28
+ * keyPrefix: '{myapp}:', // Hash tag for cluster
29
+ * });
30
+ * ```
31
+ *
32
+ * @example From environment
33
+ * ```ts
34
+ * import { createRedisClient, createConfigFromEnv } from '@cogitator-ai/redis';
35
+ *
36
+ * // Uses REDIS_URL, REDIS_CLUSTER_NODES, REDIS_PASSWORD, etc.
37
+ * const config = createConfigFromEnv();
38
+ * const client = await createRedisClient(config);
39
+ * ```
40
+ */
41
+ export { createRedisClient, detectRedisMode, parseClusterNodesEnv, createConfigFromEnv, } from './factory';
42
+ export { isClusterConfig, type RedisMode, type RedisNodeConfig, type RedisCommonOptions, type RedisStandaloneConfig, type RedisClusterConfig, type RedisConfig, type RedisClient, type QueueMetrics, } from './types';
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EACf,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @cogitator-ai/redis - Unified Redis client with cluster support
3
+ *
4
+ * @example Standalone mode
5
+ * ```ts
6
+ * import { createRedisClient } from '@cogitator-ai/redis';
7
+ *
8
+ * const client = await createRedisClient({
9
+ * url: 'redis://localhost:6379',
10
+ * keyPrefix: 'myapp:',
11
+ * });
12
+ *
13
+ * await client.set('key', 'value');
14
+ * const value = await client.get('key');
15
+ * ```
16
+ *
17
+ * @example Cluster mode
18
+ * ```ts
19
+ * import { createRedisClient } from '@cogitator-ai/redis';
20
+ *
21
+ * const client = await createRedisClient({
22
+ * mode: 'cluster',
23
+ * nodes: [
24
+ * { host: '10.0.0.1', port: 6379 },
25
+ * { host: '10.0.0.2', port: 6379 },
26
+ * { host: '10.0.0.3', port: 6379 },
27
+ * ],
28
+ * keyPrefix: '{myapp}:', // Hash tag for cluster
29
+ * });
30
+ * ```
31
+ *
32
+ * @example From environment
33
+ * ```ts
34
+ * import { createRedisClient, createConfigFromEnv } from '@cogitator-ai/redis';
35
+ *
36
+ * // Uses REDIS_URL, REDIS_CLUSTER_NODES, REDIS_PASSWORD, etc.
37
+ * const config = createConfigFromEnv();
38
+ * const client = await createRedisClient(config);
39
+ * ```
40
+ */
41
+ export { createRedisClient, detectRedisMode, parseClusterNodesEnv, createConfigFromEnv, } from './factory';
42
+ export { isClusterConfig, } from './types';
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,GAShB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Redis configuration and client types
3
+ *
4
+ * Supports both standalone Redis and Redis Cluster modes.
5
+ */
6
+ export type RedisMode = 'standalone' | 'cluster';
7
+ /**
8
+ * Redis node configuration for cluster mode
9
+ */
10
+ export interface RedisNodeConfig {
11
+ host: string;
12
+ port: number;
13
+ }
14
+ /**
15
+ * Common Redis options shared between standalone and cluster modes
16
+ */
17
+ export interface RedisCommonOptions {
18
+ /** Key prefix for all operations (use {hashtag} format for cluster) */
19
+ keyPrefix?: string;
20
+ /** Password for authentication */
21
+ password?: string;
22
+ /** Enable TLS */
23
+ tls?: boolean;
24
+ /** Max retries per request */
25
+ maxRetriesPerRequest?: number;
26
+ /** Lazy connect - don't connect immediately */
27
+ lazyConnect?: boolean;
28
+ }
29
+ /**
30
+ * Standalone Redis configuration
31
+ */
32
+ export interface RedisStandaloneConfig extends RedisCommonOptions {
33
+ mode?: 'standalone';
34
+ /** Redis URL (e.g., redis://localhost:6379) */
35
+ url?: string;
36
+ /** Host (alternative to url) */
37
+ host?: string;
38
+ /** Port (alternative to url) */
39
+ port?: number;
40
+ /** Database number */
41
+ db?: number;
42
+ }
43
+ /**
44
+ * Redis Cluster configuration
45
+ */
46
+ export interface RedisClusterConfig extends RedisCommonOptions {
47
+ mode: 'cluster';
48
+ /** Array of cluster nodes */
49
+ nodes: RedisNodeConfig[];
50
+ /** Scale reads to replicas: 'master' | 'slave' | 'all' */
51
+ scaleReads?: 'master' | 'slave' | 'all';
52
+ /** NAT mapping for cluster nodes behind NAT */
53
+ natMap?: Record<string, RedisNodeConfig>;
54
+ }
55
+ /**
56
+ * Combined Redis configuration type
57
+ */
58
+ export type RedisConfig = RedisStandaloneConfig | RedisClusterConfig;
59
+ /**
60
+ * Unified Redis client interface
61
+ *
62
+ * Provides a common interface for both standalone Redis and Redis Cluster.
63
+ * All methods work identically regardless of the underlying implementation.
64
+ */
65
+ export interface RedisClient {
66
+ ping(): Promise<string>;
67
+ quit(): Promise<string>;
68
+ get(key: string): Promise<string | null>;
69
+ set(key: string, value: string): Promise<string>;
70
+ setex(key: string, seconds: number, value: string): Promise<string>;
71
+ del(...keys: string[]): Promise<number>;
72
+ expire(key: string, seconds: number): Promise<number>;
73
+ mget(...keys: string[]): Promise<(string | null)[]>;
74
+ zadd(key: string, score: number, member: string): Promise<number>;
75
+ zrange(key: string, start: number, stop: number): Promise<string[]>;
76
+ zrangebyscore(key: string, min: number | string, max: number | string): Promise<string[]>;
77
+ zrem(key: string, ...members: string[]): Promise<number>;
78
+ smembers(key: string): Promise<string[]>;
79
+ publish(channel: string, message: string): Promise<number>;
80
+ subscribe(channel: string, callback?: (message: string) => void): Promise<void>;
81
+ unsubscribe(channel: string): Promise<void>;
82
+ on(event: string, callback: (...args: any[]) => void): void;
83
+ off(event: string, callback: (...args: any[]) => void): void;
84
+ keys(pattern: string): Promise<string[]>;
85
+ duplicate(): RedisClient;
86
+ info(section?: string): Promise<string>;
87
+ }
88
+ /**
89
+ * Queue metrics for monitoring
90
+ */
91
+ export interface QueueMetrics {
92
+ /** Jobs waiting to be processed */
93
+ waiting: number;
94
+ /** Jobs currently being processed */
95
+ active: number;
96
+ /** Jobs completed successfully */
97
+ completed: number;
98
+ /** Jobs that failed */
99
+ failed: number;
100
+ /** Jobs scheduled for later */
101
+ delayed: number;
102
+ /** Total queue depth (waiting + delayed) */
103
+ depth: number;
104
+ }
105
+ /**
106
+ * Check if config is for cluster mode
107
+ */
108
+ export declare function isClusterConfig(config: RedisConfig): config is RedisClusterConfig;
109
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,8BAA8B;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,EAAE,CAAC,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GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,IAAI,kBAAkB,CAEjF"}
package/dist/types.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Redis configuration and client types
3
+ *
4
+ * Supports both standalone Redis and Redis Cluster modes.
5
+ */
6
+ /**
7
+ * Check if config is for cluster mode
8
+ */
9
+ export function isClusterConfig(config) {
10
+ return config.mode === 'cluster' || ('nodes' in config && Array.isArray(config.nodes));
11
+ }
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyHH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,OAAO,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACzF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@cogitator-ai/redis",
3
+ "version": "0.1.0",
4
+ "description": "Unified Redis client for Cogitator with standalone and cluster support",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "dependencies": {
18
+ "@cogitator-ai/types": "0.1.0"
19
+ },
20
+ "optionalDependencies": {
21
+ "ioredis": "^5.4.1"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^20.10.0",
25
+ "typescript": "^5.3.0",
26
+ "vitest": "^1.0.0"
27
+ },
28
+ "peerDependencies": {
29
+ "ioredis": "^5.0.0"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "ioredis": {
33
+ "optional": true
34
+ }
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/eL1fe/cogitator.git",
39
+ "directory": "packages/redis"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "license": "MIT",
45
+ "scripts": {
46
+ "build": "tsc",
47
+ "dev": "tsc --watch",
48
+ "clean": "rm -rf dist",
49
+ "typecheck": "tsc --noEmit",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest"
52
+ }
53
+ }