@envoy1084/effect-redis 0.0.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.
@@ -0,0 +1,106 @@
1
+ import { Context, Effect, Layer } from "effect";
2
+ import { RedisClientOptions, RedisClientOptions as RedisClientOptions$1, RedisClientType } from "redis";
3
+ import * as effect_Types0 from "effect/Types";
4
+ import * as effect_Cause0 from "effect/Cause";
5
+
6
+ //#region src/connection.d.ts
7
+ type RedisConnectionShape = {
8
+ readonly client: RedisClientType;
9
+ };
10
+ declare const RedisConnection_base: Context.TagClass<RedisConnection, "RedisConnection", RedisConnectionShape>;
11
+ declare class RedisConnection extends RedisConnection_base {}
12
+ declare const layerWithOptions: (options: RedisClientOptions$1) => Layer.Layer<RedisConnection, never, never>;
13
+ //#endregion
14
+ //#region src/errors.d.ts
15
+ declare const RedisError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
16
+ readonly _tag: "RedisError";
17
+ } & Readonly<A>;
18
+ declare class RedisError extends RedisError_base<{
19
+ cause: unknown;
20
+ message?: string;
21
+ }> {}
22
+ //#endregion
23
+ //#region src/helpers.d.ts
24
+ type ExecStrategy<Mode extends "async" | "queue"> = {
25
+ readonly mode: Mode;
26
+ run<F extends (...args: any[]) => any>(self: unknown, fn: F, args: Parameters<F>): Effect.Effect<any, RedisError>;
27
+ };
28
+ type CommandGroup<TClient, Keys extends readonly (keyof TClient)[], Mode extends "async" | "queue"> = { [K in Keys[number]]: (...args: TClient[K] extends ((...a: infer A) => any) ? A : never) => Mode extends "async" ? Effect.Effect<TClient[K] extends ((...a: any[]) => Promise<infer R>) ? R : never, RedisError> : Effect.Effect<void, never> };
29
+ declare function makeCommandGroup<TClient, const Keys extends readonly (keyof TClient)[], Mode extends "async" | "queue">(client: TClient, keys: Keys, exec: ExecStrategy<Mode>): CommandGroup<TClient, Keys, Mode>;
30
+ declare const AsyncExec: ExecStrategy<"async">;
31
+ declare const QueueExec: ExecStrategy<"queue">;
32
+ //#endregion
33
+ //#region src/commands/bitmap.d.ts
34
+ declare const redisBitmapKeys: readonly ["bitCount", "bitField", "bitFieldRo", "bitOp", "bitPos", "getBit", "setBit"];
35
+ type RedisBitmapAsync = CommandGroup<RedisClientType, typeof redisBitmapKeys, "async">;
36
+ type RedisBitmapQueue = CommandGroup<RedisClientType, typeof redisBitmapKeys, "queue">;
37
+ //#endregion
38
+ //#region src/commands/generic.d.ts
39
+ declare const redisGenericKeys: readonly ["copy", "del", "dump", "exists", "expire", "expireAt", "expireTime", "keys", "migrate", "move", "persist", "pExpire", "pExpireAt", "pExpireTime", "pTTL", "randomKey", "rename", "renameNX", "restore", "scan", "sort", "sortRo", "touch", "ttl", "type", "unlink", "wait"];
40
+ type RedisGenericAsync = CommandGroup<RedisClientType, typeof redisGenericKeys, "async">;
41
+ type RedisGenericQueue = CommandGroup<RedisClientType, typeof redisGenericKeys, "queue">;
42
+ //#endregion
43
+ //#region src/commands/geospatial.d.ts
44
+ declare const redisGeoSpatialKeys: readonly ["geoAdd", "geoDist", "geoHash", "geoPos", "geoRadius", "geoRadiusByMember", "geoRadiusByMemberRo", "geoRadiusRo", "geoSearch", "geoSearchStore"];
45
+ type RedisGeoSpatialAsync = CommandGroup<RedisClientType, typeof redisGeoSpatialKeys, "async">;
46
+ type RedisGeoSpatialQueue = CommandGroup<RedisClientType, typeof redisGeoSpatialKeys, "queue">;
47
+ //#endregion
48
+ //#region src/commands/hash.d.ts
49
+ declare const redisHashKeys: readonly ["hDel", "hExists", "hExpire", "hExpireAt", "hExpireTime", "hGet", "hGetAll", "hGetDel", "hGetEx", "hIncrBy", "hIncrByFloat", "hKeys", "hLen", "hmGet", "hPersist", "hpExpire", "hpExpireAt", "hpExpireTime", "hpTTL", "hRandField", "hScan", "hSet", "hSetEx", "hSetNX", "hStrLen", "hTTL", "hVals"];
50
+ type RedisHashAsync = CommandGroup<RedisClientType, typeof redisHashKeys, "async">;
51
+ type RedisHashQueue = CommandGroup<RedisClientType, typeof redisHashKeys, "queue">;
52
+ //#endregion
53
+ //#region src/commands/hyper-log-log.d.ts
54
+ declare const redisHyperLogLogKeys: readonly ["pfAdd", "pfCount", "pfMerge"];
55
+ type RedisHyperLogLogAsync = CommandGroup<RedisClientType, typeof redisHyperLogLogKeys, "async">;
56
+ type RedisHyperLogLogQueue = CommandGroup<RedisClientType, typeof redisHyperLogLogKeys, "queue">;
57
+ //#endregion
58
+ //#region src/commands/json.d.ts
59
+ declare const redisJsonKeys: readonly ["arrAppend", "arrIndex", "arrInsert", "arrLen", "arrPop", "arrTrim", "clear", "debugMemory", "del", "forget", "get", "merge", "mGet", "mSet", "numIncrBy", "numMultBy", "objKeys", "objLen", "set", "strAppend", "strLen", "toggle", "type"];
60
+ type RedisJsonAsync = CommandGroup<RedisClientType["json"], typeof redisJsonKeys, "async">;
61
+ type RedisJsonQueue = CommandGroup<RedisClientType["json"], typeof redisJsonKeys, "queue">;
62
+ //#endregion
63
+ //#region src/commands/list.d.ts
64
+ declare const redisListKeys: readonly ["blMove", "blmPop", "blPop", "brPop", "brPopLPush", "lIndex", "lInsert", "lLen", "lMove", "lPop", "lPos", "lPush", "lPushX", "lRange", "lRem", "lSet", "lTrim", "rPop", "rPopLPush", "rPush", "rPushX"];
65
+ type RedisListAsync = CommandGroup<RedisClientType, typeof redisListKeys, "async">;
66
+ type RedisListQueue = CommandGroup<RedisClientType, typeof redisListKeys, "queue">;
67
+ //#endregion
68
+ //#region src/commands/scripting.d.ts
69
+ declare const redisScriptingKeys: readonly ["eval", "evalSha", "evalShaRo", "evalRo", "fCall", "fCallRo", "functionDelete", "functionDump", "functionFlush", "functionKill", "functionList", "functionLoad", "functionRestore", "functionStats", "scriptDebug", "scriptExists", "scriptFlush", "scriptKill", "scriptLoad"];
70
+ type RedisScriptingAsync = CommandGroup<RedisClientType, typeof redisScriptingKeys, "async">;
71
+ type RedisScriptingQueue = CommandGroup<RedisClientType, typeof redisScriptingKeys, "queue">;
72
+ //#endregion
73
+ //#region src/commands/set.d.ts
74
+ declare const redisSetKeys: readonly ["sAdd", "sCard", "sDiff", "sDiffStore", "sInter", "sInterCard", "sInterStore", "sIsMember", "sMembers", "smIsMember", "sMove", "sPop", "sRandMember", "sRem", "sScan", "sUnion", "sUnionStore"];
75
+ type RedisSetAsync = CommandGroup<RedisClientType, typeof redisSetKeys, "async">;
76
+ type RedisSetQueue = CommandGroup<RedisClientType, typeof redisSetKeys, "queue">;
77
+ //#endregion
78
+ //#region src/commands/sorted-set.d.ts
79
+ declare const redisSortedSetKeys: readonly ["zAdd", "zCard", "zCount", "zDiff", "zDiffStore", "zIncrBy", "zInter", "zInterCard", "zInterStore", "zLexCount", "zmPop", "zmScore", "zPopMax", "zPopMin", "zRandMember", "zRange", "zRangeByLex", "zRangeByScore", "zRangeStore", "zRank", "zRem", "zRemRangeByLex", "zRemRangeByRank", "zRemRangeByScore", "zRevRank", "zScan", "zScore", "zUnion", "zUnionStore"];
80
+ type RedisSortedSetAsync = CommandGroup<RedisClientType, typeof redisSortedSetKeys, "async">;
81
+ type RedisSortedSetQueue = CommandGroup<RedisClientType, typeof redisSortedSetKeys, "queue">;
82
+ //#endregion
83
+ //#region src/commands/string.d.ts
84
+ declare const redisStringKeys: readonly ["append", "decr", "decrBy", "delEx", "digest", "get", "getDel", "getEx", "getRange", "getSet", "incr", "incrBy", "incrByFloat", "lcs", "mGet", "mSet", "mSetEx", "mSetNX", "pSetEx", "set", "setEx", "setNX", "setRange", "strLen"];
85
+ type RedisStringAsync = CommandGroup<RedisClientType, typeof redisStringKeys, "async">;
86
+ type RedisStringQueue = CommandGroup<RedisClientType, typeof redisStringKeys, "queue">;
87
+ //#endregion
88
+ //#region src/modules/core.d.ts
89
+ type RedisTxShape = RedisStringQueue & RedisHashQueue & RedisListQueue & RedisSetQueue & RedisSortedSetQueue & RedisBitmapQueue & RedisScriptingQueue & RedisGenericQueue & RedisGeoSpatialQueue & RedisHyperLogLogQueue & {
90
+ json: RedisJsonQueue;
91
+ };
92
+ type Multi = <A>(program: (tx: RedisTxShape) => Effect.Effect<A, RedisError>) => Effect.Effect<readonly [result: A, exec: ReadonlyArray<unknown> | null], RedisError>;
93
+ type Pipeline = <A>(program: (tx: RedisTxShape) => Effect.Effect<A, RedisError>) => Effect.Effect<readonly [result: A, exec: ReadonlyArray<unknown>], RedisError>;
94
+ type TransactionAsync = {
95
+ multi: Multi;
96
+ pipeline: Pipeline;
97
+ };
98
+ type RedisCoreShape = RedisStringAsync & RedisHashAsync & RedisListAsync & RedisSetAsync & RedisSortedSetAsync & RedisBitmapAsync & RedisScriptingAsync & RedisGenericAsync & RedisHyperLogLogAsync & RedisGeoSpatialAsync & TransactionAsync & {
99
+ json: RedisJsonAsync;
100
+ };
101
+ declare const RedisCore_base: Context.TagClass<RedisCore, "RedisCore", RedisCoreShape>;
102
+ declare class RedisCore extends RedisCore_base {}
103
+ declare const RedisCoreLive: Layer.Layer<RedisCore, never, RedisConnection>;
104
+ //#endregion
105
+ export { AsyncExec, CommandGroup, ExecStrategy, Multi, Pipeline, QueueExec, type RedisClientOptions, RedisConnection, RedisConnectionShape, RedisCore, RedisCoreLive, RedisCoreShape, RedisError, RedisTxShape, TransactionAsync, layerWithOptions, makeCommandGroup };
106
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/connection.ts","../src/errors.ts","../src/helpers.ts","../src/commands/bitmap.ts","../src/commands/generic.ts","../src/commands/geospatial.ts","../src/commands/hash.ts","../src/commands/hyper-log-log.ts","../src/commands/json.ts","../src/commands/list.ts","../src/commands/scripting.ts","../src/commands/set.ts","../src/commands/sorted-set.ts","../src/commands/string.ts","../src/modules/core.ts"],"mappings":";;;;;;KAOY,oBAAA;EAAA,SACD,MAAA,EAAQ,eAAA;AAAA;AAAA,cACjB,oBAAA;cAEW,eAAA,SAAw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MAAA,CAAO,MAAA,CAAO,CAAA,EAAG,UAAA,MAC7C,MAAA,CAAO,MAAA,WACA,MAAA,EAAQ,CAAA,EAAG,IAAA,EAAM,aAAA,mBAC3B,UAAA;AAAA,KAGU,QAAA,OACV,OAAA,GAAU,EAAA,EAAI,YAAA,KAAiB,MAAA,CAAO,MAAA,CAAO,CAAA,EAAG,UAAA,MAC7C,MAAA,CAAO,MAAA,WACA,MAAA,EAAQ,CAAA,EAAG,IAAA,EAAM,aAAA,YAC3B,UAAA;AAAA,KAGU,gBAAA;EACV,KAAA,EAAO,KAAA;EACP,QAAA,EAAU,QAAA;AAAA;AAAA,KAGA,cAAA,GAAiB,gBAAA,GAC3B,cAAA,GACA,cAAA,GACA,aAAA,GACA,mBAAA,GACA,gBAAA,GACA,mBAAA,GACA,iBAAA,GACA,qBAAA,GACA,oBAAA,GACA,gBAAA;EACE,IAAA,EAAM,cAAA;AAAA;AAAA,cACN,cAAA;cA2DS,SAAA,SAAkB,cAAA;AAAA,cAKlB,aAAA,EAAa,KAAA,CAAA,KAAA,CAAA,SAAA,SAAA,eAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,383 @@
1
+ import { Context, Data, Effect, Layer } from "effect";
2
+ import { createClient } from "redis";
3
+
4
+ //#region src/connection.ts
5
+ var RedisConnection = class extends Context.Tag("RedisConnection")() {};
6
+ const layerWithOptions = (options) => Layer.scoped(RedisConnection, Effect.acquireRelease(Effect.promise(async () => {
7
+ const client = createClient(options);
8
+ await client.connect();
9
+ return { client };
10
+ }), ({ client }) => Effect.promise(() => client.quit())));
11
+
12
+ //#endregion
13
+ //#region src/errors.ts
14
+ var RedisError = class extends Data.TaggedError("RedisError") {};
15
+
16
+ //#endregion
17
+ //#region src/helpers.ts
18
+ /** biome-ignore-all lint/suspicious/noExplicitAny: safe */
19
+ function makeCommandGroup(client, keys, exec) {
20
+ const out = {};
21
+ for (const k of keys) {
22
+ const fn = client[k];
23
+ out[k] = (...args) => exec.run(client, fn, args);
24
+ }
25
+ return out;
26
+ }
27
+ const AsyncExec = {
28
+ mode: "async",
29
+ run(self, fn, args) {
30
+ return Effect.tryPromise({
31
+ catch: (e) => new RedisError({ cause: e }),
32
+ try: () => fn.apply(self, args)
33
+ });
34
+ }
35
+ };
36
+ const QueueExec = {
37
+ mode: "queue",
38
+ run(self, fn, args) {
39
+ return Effect.sync(() => {
40
+ fn.apply(self, args);
41
+ });
42
+ }
43
+ };
44
+
45
+ //#endregion
46
+ //#region src/commands/bitmap.ts
47
+ const redisBitmapKeys = [
48
+ "bitCount",
49
+ "bitField",
50
+ "bitFieldRo",
51
+ "bitOp",
52
+ "bitPos",
53
+ "getBit",
54
+ "setBit"
55
+ ];
56
+ const makeRedisBitmap = (client) => makeCommandGroup(client, redisBitmapKeys, AsyncExec);
57
+ const makeRedisBitmapQueue = (client) => makeCommandGroup(client, redisBitmapKeys, QueueExec);
58
+
59
+ //#endregion
60
+ //#region src/commands/generic.ts
61
+ const redisGenericKeys = [
62
+ "copy",
63
+ "del",
64
+ "dump",
65
+ "exists",
66
+ "expire",
67
+ "expireAt",
68
+ "expireTime",
69
+ "keys",
70
+ "migrate",
71
+ "move",
72
+ "persist",
73
+ "pExpire",
74
+ "pExpireAt",
75
+ "pExpireTime",
76
+ "pTTL",
77
+ "randomKey",
78
+ "rename",
79
+ "renameNX",
80
+ "restore",
81
+ "scan",
82
+ "sort",
83
+ "sortRo",
84
+ "touch",
85
+ "ttl",
86
+ "type",
87
+ "unlink",
88
+ "wait"
89
+ ];
90
+ const makeRedisGeneric = (client) => makeCommandGroup(client, redisGenericKeys, AsyncExec);
91
+ const makeRedisGenericQueue = (client) => makeCommandGroup(client, redisGenericKeys, QueueExec);
92
+
93
+ //#endregion
94
+ //#region src/commands/geospatial.ts
95
+ const redisGeoSpatialKeys = [
96
+ "geoAdd",
97
+ "geoDist",
98
+ "geoHash",
99
+ "geoPos",
100
+ "geoRadius",
101
+ "geoRadiusByMember",
102
+ "geoRadiusByMemberRo",
103
+ "geoRadiusRo",
104
+ "geoSearch",
105
+ "geoSearchStore"
106
+ ];
107
+ const makeRedisGeoSpatial = (client) => makeCommandGroup(client, redisGeoSpatialKeys, AsyncExec);
108
+ const makeRedisGeoSpatialQueue = (client) => makeCommandGroup(client, redisGeoSpatialKeys, QueueExec);
109
+
110
+ //#endregion
111
+ //#region src/commands/hash.ts
112
+ const redisHashKeys = [
113
+ "hDel",
114
+ "hExists",
115
+ "hExpire",
116
+ "hExpireAt",
117
+ "hExpireTime",
118
+ "hGet",
119
+ "hGetAll",
120
+ "hGetDel",
121
+ "hGetEx",
122
+ "hIncrBy",
123
+ "hIncrByFloat",
124
+ "hKeys",
125
+ "hLen",
126
+ "hmGet",
127
+ "hPersist",
128
+ "hpExpire",
129
+ "hpExpireAt",
130
+ "hpExpireTime",
131
+ "hpTTL",
132
+ "hRandField",
133
+ "hScan",
134
+ "hSet",
135
+ "hSetEx",
136
+ "hSetNX",
137
+ "hStrLen",
138
+ "hTTL",
139
+ "hVals"
140
+ ];
141
+ const makeRedisHash = (client) => makeCommandGroup(client, redisHashKeys, AsyncExec);
142
+ const makeRedisHashQueue = (client) => makeCommandGroup(client, redisHashKeys, QueueExec);
143
+
144
+ //#endregion
145
+ //#region src/commands/hyper-log-log.ts
146
+ const redisHyperLogLogKeys = [
147
+ "pfAdd",
148
+ "pfCount",
149
+ "pfMerge"
150
+ ];
151
+ const makeRedisHyperLogLog = (client) => makeCommandGroup(client, redisHyperLogLogKeys, AsyncExec);
152
+ const makeRedisHyperLogLogQueue = (client) => makeCommandGroup(client, redisHyperLogLogKeys, QueueExec);
153
+
154
+ //#endregion
155
+ //#region src/commands/json.ts
156
+ const redisJsonKeys = [
157
+ "arrAppend",
158
+ "arrIndex",
159
+ "arrInsert",
160
+ "arrLen",
161
+ "arrPop",
162
+ "arrTrim",
163
+ "clear",
164
+ "debugMemory",
165
+ "del",
166
+ "forget",
167
+ "get",
168
+ "merge",
169
+ "mGet",
170
+ "mSet",
171
+ "numIncrBy",
172
+ "numMultBy",
173
+ "objKeys",
174
+ "objLen",
175
+ "set",
176
+ "strAppend",
177
+ "strLen",
178
+ "toggle",
179
+ "type"
180
+ ];
181
+ const makeRedisJson = (client) => makeCommandGroup(client.json, redisJsonKeys, AsyncExec);
182
+ const makeRedisJsonQueue = (client) => makeCommandGroup(client.json, redisJsonKeys, QueueExec);
183
+
184
+ //#endregion
185
+ //#region src/commands/list.ts
186
+ const redisListKeys = [
187
+ "blMove",
188
+ "blmPop",
189
+ "blPop",
190
+ "brPop",
191
+ "brPopLPush",
192
+ "lIndex",
193
+ "lInsert",
194
+ "lLen",
195
+ "lMove",
196
+ "lPop",
197
+ "lPos",
198
+ "lPush",
199
+ "lPushX",
200
+ "lRange",
201
+ "lRem",
202
+ "lSet",
203
+ "lTrim",
204
+ "rPop",
205
+ "rPopLPush",
206
+ "rPush",
207
+ "rPushX"
208
+ ];
209
+ const makeRedisList = (client) => makeCommandGroup(client, redisListKeys, AsyncExec);
210
+ const makeRedisListQueue = (client) => makeCommandGroup(client, redisListKeys, QueueExec);
211
+
212
+ //#endregion
213
+ //#region src/commands/scripting.ts
214
+ const redisScriptingKeys = [
215
+ "eval",
216
+ "evalSha",
217
+ "evalShaRo",
218
+ "evalRo",
219
+ "fCall",
220
+ "fCallRo",
221
+ "functionDelete",
222
+ "functionDump",
223
+ "functionFlush",
224
+ "functionKill",
225
+ "functionList",
226
+ "functionLoad",
227
+ "functionRestore",
228
+ "functionStats",
229
+ "scriptDebug",
230
+ "scriptExists",
231
+ "scriptFlush",
232
+ "scriptKill",
233
+ "scriptLoad"
234
+ ];
235
+ const makeRedisScripting = (client) => makeCommandGroup(client, redisScriptingKeys, AsyncExec);
236
+ const makeRedisScriptingQueue = (client) => makeCommandGroup(client, redisScriptingKeys, QueueExec);
237
+
238
+ //#endregion
239
+ //#region src/commands/set.ts
240
+ const redisSetKeys = [
241
+ "sAdd",
242
+ "sCard",
243
+ "sDiff",
244
+ "sDiffStore",
245
+ "sInter",
246
+ "sInterCard",
247
+ "sInterStore",
248
+ "sIsMember",
249
+ "sMembers",
250
+ "smIsMember",
251
+ "sMove",
252
+ "sPop",
253
+ "sRandMember",
254
+ "sRem",
255
+ "sScan",
256
+ "sUnion",
257
+ "sUnionStore"
258
+ ];
259
+ const makeRedisSet = (client) => makeCommandGroup(client, redisSetKeys, AsyncExec);
260
+ const makeRedisSetQueue = (client) => makeCommandGroup(client, redisSetKeys, QueueExec);
261
+
262
+ //#endregion
263
+ //#region src/commands/sorted-set.ts
264
+ const redisSortedSetKeys = [
265
+ "zAdd",
266
+ "zCard",
267
+ "zCount",
268
+ "zDiff",
269
+ "zDiffStore",
270
+ "zIncrBy",
271
+ "zInter",
272
+ "zInterCard",
273
+ "zInterStore",
274
+ "zLexCount",
275
+ "zmPop",
276
+ "zmScore",
277
+ "zPopMax",
278
+ "zPopMin",
279
+ "zRandMember",
280
+ "zRange",
281
+ "zRangeByLex",
282
+ "zRangeByScore",
283
+ "zRangeStore",
284
+ "zRank",
285
+ "zRem",
286
+ "zRemRangeByLex",
287
+ "zRemRangeByRank",
288
+ "zRemRangeByScore",
289
+ "zRevRank",
290
+ "zScan",
291
+ "zScore",
292
+ "zUnion",
293
+ "zUnionStore"
294
+ ];
295
+ const makeRedisSortedSet = (client) => makeCommandGroup(client, redisSortedSetKeys, AsyncExec);
296
+ const makeRedisSortedSetQueue = (client) => makeCommandGroup(client, redisSortedSetKeys, QueueExec);
297
+
298
+ //#endregion
299
+ //#region src/commands/string.ts
300
+ const redisStringKeys = [
301
+ "append",
302
+ "decr",
303
+ "decrBy",
304
+ "delEx",
305
+ "digest",
306
+ "get",
307
+ "getDel",
308
+ "getEx",
309
+ "getRange",
310
+ "getSet",
311
+ "incr",
312
+ "incrBy",
313
+ "incrByFloat",
314
+ "lcs",
315
+ "mGet",
316
+ "mSet",
317
+ "mSetEx",
318
+ "mSetNX",
319
+ "pSetEx",
320
+ "set",
321
+ "setEx",
322
+ "setNX",
323
+ "setRange",
324
+ "strLen"
325
+ ];
326
+ const makeRedisString = (client) => makeCommandGroup(client, redisStringKeys, AsyncExec);
327
+ const makeRedisStringQueue = (client) => makeCommandGroup(client, redisStringKeys, QueueExec);
328
+
329
+ //#endregion
330
+ //#region src/modules/core.ts
331
+ const makeRedisTx = (c) => ({
332
+ ...makeRedisBitmapQueue(c),
333
+ ...makeRedisGenericQueue(c),
334
+ ...makeRedisHashQueue(c),
335
+ ...makeRedisHyperLogLogQueue(c),
336
+ ...makeRedisListQueue(c),
337
+ ...makeRedisScriptingQueue(c),
338
+ ...makeRedisSetQueue(c),
339
+ ...makeRedisSortedSetQueue(c),
340
+ ...makeRedisStringQueue(c),
341
+ ...makeRedisGeoSpatialQueue(c),
342
+ json: makeRedisJsonQueue(c)
343
+ });
344
+ const makeRedisCore = (c) => ({
345
+ ...makeRedisBitmap(c),
346
+ ...makeRedisGeneric(c),
347
+ ...makeRedisHash(c),
348
+ ...makeRedisHyperLogLog(c),
349
+ ...makeRedisList(c),
350
+ ...makeRedisScripting(c),
351
+ ...makeRedisSet(c),
352
+ ...makeRedisSortedSet(c),
353
+ ...makeRedisString(c),
354
+ ...makeRedisGeoSpatial(c),
355
+ json: makeRedisJson(c),
356
+ multi: (program) => Effect.gen(function* () {
357
+ const txClient = c.multi();
358
+ return [yield* program(makeRedisTx(txClient)), yield* Effect.tryPromise({
359
+ catch: (e) => new RedisError({ cause: e }),
360
+ try: () => txClient.exec()
361
+ })];
362
+ }),
363
+ pipeline: (program) => Effect.gen(function* () {
364
+ const txClient = c.multi();
365
+ return [yield* program(makeRedisTx(txClient)), yield* Effect.tryPromise({
366
+ catch: (e) => new RedisError({ cause: e }),
367
+ try: () => txClient.execAsPipeline()
368
+ })];
369
+ })
370
+ });
371
+ var RedisCore = class extends Context.Tag("RedisCore")() {};
372
+ const RedisCoreLive = Layer.effect(RedisCore, Effect.gen(function* () {
373
+ const { client } = yield* RedisConnection;
374
+ client.eval("return redis.call('GET',KEYS[1])", {
375
+ arguments: [],
376
+ keys: ["key"]
377
+ });
378
+ return makeRedisCore(client);
379
+ }));
380
+
381
+ //#endregion
382
+ export { AsyncExec, QueueExec, RedisConnection, RedisCore, RedisCoreLive, RedisError, layerWithOptions, makeCommandGroup };
383
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["bitMap.makeRedisBitmapQueue","generic.makeRedisGenericQueue","hash.makeRedisHashQueue","hyperLogLog.makeRedisHyperLogLogQueue","list.makeRedisListQueue","scripting.makeRedisScriptingQueue","set.makeRedisSetQueue","sortedSet.makeRedisSortedSetQueue","string.makeRedisStringQueue","geospatial.makeRedisGeoSpatialQueue","json.makeRedisJsonQueue","bitMap.makeRedisBitmap","generic.makeRedisGeneric","hash.makeRedisHash","hyperLogLog.makeRedisHyperLogLog","list.makeRedisList","scripting.makeRedisScripting","set.makeRedisSet","sortedSet.makeRedisSortedSet","string.makeRedisString","geospatial.makeRedisGeoSpatial","json.makeRedisJson"],"sources":["../src/connection.ts","../src/errors.ts","../src/helpers.ts","../src/commands/bitmap.ts","../src/commands/generic.ts","../src/commands/geospatial.ts","../src/commands/hash.ts","../src/commands/hyper-log-log.ts","../src/commands/json.ts","../src/commands/list.ts","../src/commands/scripting.ts","../src/commands/set.ts","../src/commands/sorted-set.ts","../src/commands/string.ts","../src/modules/core.ts"],"sourcesContent":["import { Context, Effect, Layer } from \"effect\";\nimport {\n createClient,\n type RedisClientOptions,\n type RedisClientType,\n} from \"redis\";\n\nexport type RedisConnectionShape = {\n readonly client: RedisClientType;\n};\n\nexport class RedisConnection extends Context.Tag(\"RedisConnection\")<\n RedisConnection,\n RedisConnectionShape\n>() {}\n\nexport const layerWithOptions = (options: RedisClientOptions) =>\n Layer.scoped(\n RedisConnection,\n Effect.acquireRelease(\n Effect.promise(async () => {\n const client = createClient(options) as RedisClientType;\n\n await client.connect();\n return { client };\n }),\n ({ client }) => Effect.promise(() => client.quit()),\n ),\n );\n\nexport type { RedisClientOptions } from \"redis\";\n","import { Data } from \"effect\";\n\nexport class RedisError extends Data.TaggedError(\"RedisError\")<{\n cause: unknown;\n message?: string;\n}> {}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: safe */\nimport { Effect } from \"effect\";\n\nimport { RedisError } from \"./errors\";\n\nexport type ExecStrategy<Mode extends \"async\" | \"queue\"> = {\n readonly mode: Mode;\n\n run<F extends (...args: any[]) => any>(\n self: unknown,\n fn: F,\n args: Parameters<F>,\n ): Effect.Effect<any, RedisError>;\n};\nexport type CommandGroup<\n TClient,\n Keys extends readonly (keyof TClient)[],\n Mode extends \"async\" | \"queue\",\n> = {\n [K in Keys[number]]: (\n ...args: TClient[K] extends (...a: infer A) => any ? A : never\n ) => Mode extends \"async\"\n ? Effect.Effect<\n TClient[K] extends (...a: any[]) => Promise<infer R> ? R : never,\n RedisError\n >\n : Effect.Effect<void, never>;\n};\n\nexport function makeCommandGroup<\n TClient,\n const Keys extends readonly (keyof TClient)[],\n Mode extends \"async\" | \"queue\",\n>(\n client: TClient,\n keys: Keys,\n exec: ExecStrategy<Mode>,\n): CommandGroup<TClient, Keys, Mode> {\n const out: Record<string, unknown> = {};\n\n for (const k of keys) {\n const fn = (client as any)[k];\n out[k as string] = (...args: any[]) => exec.run(client, fn, args);\n }\n\n return out as any;\n}\n\nexport const AsyncExec: ExecStrategy<\"async\"> = {\n mode: \"async\" as const,\n run(self, fn, args) {\n return Effect.tryPromise({\n catch: (e) => new RedisError({ cause: e }),\n try: () => fn.apply(self, args),\n });\n },\n};\n\nexport const QueueExec: ExecStrategy<\"queue\"> = {\n mode: \"queue\",\n run(self, fn, args) {\n return Effect.sync(() => {\n fn.apply(self, args);\n });\n },\n};\n","// Bitmap Commands\n//\n// BITCOUNT - Counts the number of set bits (population counting) in a string.\n// BITFIELD - Performs arbitrary bitfield integer operations on strings.\n// BITFIELD_RO - Performs arbitrary read-only bitfield integer operations on strings.\n// BITOP - Performs bitwise operations on multiple strings, and stores the result.\n// BITPOS - Finds the first set (1) or clear (0) bit in a string.\n// GETBIT - Returns a bit value by offset.\n// SETBIT - Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisBitmapKeys = [\n \"bitCount\",\n \"bitField\",\n \"bitFieldRo\",\n \"bitOp\",\n \"bitPos\",\n \"getBit\",\n \"setBit\",\n] as const;\n\nexport type RedisBitmapAsync = CommandGroup<\n RedisClientType,\n typeof redisBitmapKeys,\n \"async\"\n>;\n\nexport type RedisBitmapQueue = CommandGroup<\n RedisClientType,\n typeof redisBitmapKeys,\n \"queue\"\n>;\n\nexport const makeRedisBitmap = (client: RedisClientType): RedisBitmapAsync =>\n makeCommandGroup(client, redisBitmapKeys, AsyncExec);\n\nexport const makeRedisBitmapQueue = (\n client: RedisClientType,\n): RedisBitmapQueue => makeCommandGroup(client, redisBitmapKeys, QueueExec);\n","// COPY - Copies the value of a key to a new key.\n// DEL - Deletes one or more keys.\n// DUMP - Returns a serialized representation of the value stored at a key.\n// EXISTS - Determines whether one or more keys exist.\n// EXPIRE - Sets the expiration time of a key in seconds.\n// EXPIREAT - Sets the expiration time of a key to a Unix timestamp.\n// EXPIRETIME - Returns the expiration time of a key as a Unix timestamp.\n// KEYS - Returns all key names that match a pattern.\n// MIGRATE - Atomically transfers a key from one Redis instance to another.\n// MOVE - Moves a key to another database.\n// OBJECT ENCODING - Returns the internal encoding of a Redis object.\n// OBJECT FREQ - Returns the logarithmic access frequency counter of a Redis object.\n// OBJECT IDLETIME - Returns the time since the last access to a Redis object.\n// OBJECT REFCOUNT - Returns the reference count of a value of a key.\n// PERSIST - Removes the expiration time of a key.\n// PEXPIRE - Sets the expiration time of a key in milliseconds.\n// PEXPIREAT - Sets the expiration time of a key to a Unix milliseconds timestamp.\n// PEXPIRETIME - Returns the expiration time of a key as a Unix milliseconds timestamp.\n// PTTL - Returns the expiration time in milliseconds of a key.\n// RANDOMKEY - Returns a random key name from the database.\n// RENAME - Renames a key and overwrites the destination.\n// RENAMENX - Renames a key only when the target key name doesn't exist.\n// RESTORE - Creates a key from the serialized representation of a value.\n// Redis 6.2 Commands Reference - Complete list of all Redis commands available in version 6.2, organized by functional group\n// Redis 7.2 Commands Reference - Complete list of all Redis commands available in version 7.2, organized by functional group\n// Redis 7.4 Commands Reference - Complete list of all Redis commands available in version 7.4, organized by functional group\n// Redis 8.0 Commands Reference - Complete list of all Redis commands available in version 8.0, organized by functional group\n// Redis 8.2 Commands Reference - Complete list of all Redis commands available in version 8.2, organized by functional group\n// Redis 8.4 Commands Reference - Complete list of all Redis commands available in version 8.4, organized by functional group\n// SCAN - Iterates over the key names in the database.\n// SORT - Sorts the elements in a list, a set, or a sorted set, optionally storing the result.\n// SORT_RO - Returns the sorted elements of a list, a set, or a sorted set.\n// TOUCH - Returns the number of existing keys out of those specified after updating the time they were last accessed.\n// TTL - Returns the expiration time in seconds of a key.\n// TYPE - Determines the type of value stored at a key.\n// UNLINK - Asynchronously deletes one or more keys.\n// WAIT - Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed.\n// WAITAOF - Blocks until all of the preceding write commands sent by the connection are written to the append-only file of the master and/or replicas.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisGenericKeys = [\n \"copy\",\n \"del\",\n \"dump\",\n \"exists\",\n \"expire\",\n \"expireAt\",\n \"expireTime\",\n \"keys\",\n \"migrate\",\n \"move\",\n // \"object\", // TODO: Not Supported\n \"persist\",\n \"pExpire\",\n \"pExpireAt\",\n \"pExpireTime\",\n \"pTTL\",\n \"randomKey\",\n \"rename\",\n \"renameNX\",\n \"restore\",\n \"scan\",\n \"sort\",\n \"sortRo\",\n \"touch\",\n \"ttl\",\n \"type\",\n \"unlink\",\n \"wait\",\n // \"waitAof\", // TODO: Not Supported\n] as const;\n\nexport type RedisGenericAsync = CommandGroup<\n RedisClientType,\n typeof redisGenericKeys,\n \"async\"\n>;\n\nexport type RedisGenericQueue = CommandGroup<\n RedisClientType,\n typeof redisGenericKeys,\n \"queue\"\n>;\n\nexport const makeRedisGeneric = (client: RedisClientType): RedisGenericAsync =>\n makeCommandGroup(client, redisGenericKeys, AsyncExec);\n\nexport const makeRedisGenericQueue = (\n client: RedisClientType,\n): RedisGenericQueue => makeCommandGroup(client, redisGenericKeys, QueueExec);\n","// Geospatial commands\n// Geospatial commands operate on geographic coordinates.\n\n// GEOADD - Adds one or more members to a geospatial index. The key is created if it doesn't exist.\n// GEODIST - Returns the distance between two members of a geospatial index.\n// GEOHASH - Returns members from a geospatial index as geohash strings.\n// GEOPOS - Returns the longitude and latitude of members from a geospatial index.\n// GEORADIUS - Queries a geospatial index for members within a distance from a coordinate, optionally stores the result.\n// GEORADIUSBYMEMBER - Queries a geospatial index for members within a distance from a member, optionally stores the result.\n// GEORADIUSBYMEMBER_RO - Returns members from a geospatial index that are within a distance from a member.\n// GEORADIUS_RO - Returns members from a geospatial index that are within a distance from a coordinate.\n// GEOSEARCH - Queries a geospatial index for members inside an area of a box or a circle. ⭐ New in 6.2\n// GEOSEARCHSTORE - Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result. ⭐ New in 6.2\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisGeoSpatialKeys = [\n \"geoAdd\",\n \"geoDist\",\n \"geoHash\",\n \"geoPos\",\n \"geoRadius\",\n \"geoRadiusByMember\",\n \"geoRadiusByMemberRo\",\n \"geoRadiusRo\",\n \"geoSearch\",\n \"geoSearchStore\",\n] as const;\n\nexport type RedisGeoSpatialAsync = CommandGroup<\n RedisClientType,\n typeof redisGeoSpatialKeys,\n \"async\"\n>;\n\nexport type RedisGeoSpatialQueue = CommandGroup<\n RedisClientType,\n typeof redisGeoSpatialKeys,\n \"queue\"\n>;\n\nexport const makeRedisGeoSpatial = (\n client: RedisClientType,\n): RedisGeoSpatialAsync =>\n makeCommandGroup(client, redisGeoSpatialKeys, AsyncExec);\n\nexport const makeRedisGeoSpatialQueue = (\n client: RedisClientType,\n): RedisGeoSpatialQueue =>\n makeCommandGroup(client, redisGeoSpatialKeys, QueueExec);\n","// Hash Commands\n//\n// HDEL - Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain.\n// HEXISTS - Determines whether a field exists in a hash.\n// HEXPIRE - Set expiry for hash field using relative time to expire (seconds)\n// HEXPIREAT - Set expiry for hash field using an absolute Unix timestamp (seconds)\n// HEXPIRETIME - Returns the expiration time of a hash field as a Unix timestamp, in seconds.\n// HGET - Returns the value of a field in a hash.\n// HGETALL - Returns all fields and values in a hash.\n// HGETDEL - Returns the value of a field and deletes it from the hash.\n// HGETEX - Get the value of one or more fields of a given hash key, and optionally set their expiration.\n// HINCRBY - Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist.\n// HINCRBYFLOAT - Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist.\n// HKEYS - Returns all fields in a hash.\n// HLEN - Returns the number of fields in a hash.\n// HMGET - Returns the values of all fields in a hash.\n// HMSET - Sets the values of multiple fields. // TODO: Not Supported\n// HPERSIST - Removes the expiration time for each specified field\n// HPEXPIRE - Set expiry for hash field using relative time to expire (milliseconds)\n// HPEXPIREAT - Set expiry for hash field using an absolute Unix timestamp (milliseconds)\n// HPEXPIRETIME - Returns the expiration time of a hash field as a Unix timestamp, in msec.\n// HPTTL - Returns the TTL in milliseconds of a hash field.\n// HRANDFIELD - Returns one or more random fields from a hash.\n// HSCAN - Iterates over fields and values of a hash.\n// HSET - Creates or modifies the value of a field in a hash.\n// HSETEX - Set the value of one or more fields of a given hash key, and optionally set their expiration.\n// HSETNX - Sets the value of a field in a hash only when the field doesn't exist.\n// HSTRLEN - Returns the length of the value of a field.\n// HTTL - Returns the TTL in seconds of a hash field.\n// HVALS - Returns all values in a hash.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisHashKeys = [\n \"hDel\",\n \"hExists\",\n \"hExpire\",\n \"hExpireAt\",\n \"hExpireTime\",\n \"hGet\",\n \"hGetAll\",\n \"hGetDel\",\n \"hGetEx\",\n \"hIncrBy\",\n \"hIncrByFloat\",\n \"hKeys\",\n \"hLen\",\n \"hmGet\",\n // hmSet, // TODO: Not Supported\n \"hPersist\",\n \"hpExpire\",\n \"hpExpireAt\",\n \"hpExpireTime\",\n \"hpTTL\",\n \"hRandField\",\n \"hScan\",\n \"hSet\",\n \"hSetEx\",\n \"hSetNX\",\n \"hStrLen\",\n \"hTTL\",\n \"hVals\",\n] as const;\n\nexport type RedisHashAsync = CommandGroup<\n RedisClientType,\n typeof redisHashKeys,\n \"async\"\n>;\n\nexport type RedisHashQueue = CommandGroup<\n RedisClientType,\n typeof redisHashKeys,\n \"queue\"\n>;\n\nexport const makeRedisHash = (client: RedisClientType): RedisHashAsync =>\n makeCommandGroup(client, redisHashKeys, AsyncExec);\n\nexport const makeRedisHashQueue = (client: RedisClientType): RedisHashQueue =>\n makeCommandGroup(client, redisHashKeys, QueueExec);\n","// HyperLogLog commands provide probabilistic cardinality estimation.\n\n// PFADD - Adds elements to a HyperLogLog key. Creates the key if it doesn't exist.\n// PFCOUNT - Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s).\n// PFDEBUG - Internal commands for debugging HyperLogLog values.\n// PFMERGE - Merges one or more HyperLogLog values into a single key.\n// PFSELFTEST - An internal command for testing HyperLogLog values.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisHyperLogLogKeys = [\n \"pfAdd\",\n \"pfCount\",\n // \"pfDebug\", // TODO: Not Supported\n \"pfMerge\",\n // \"pfSelfTest\", // TODO: Not Supported\n] as const;\n\nexport type RedisHyperLogLogAsync = CommandGroup<\n RedisClientType,\n typeof redisHyperLogLogKeys,\n \"async\"\n>;\n\nexport type RedisHyperLogLogQueue = CommandGroup<\n RedisClientType,\n typeof redisHyperLogLogKeys,\n \"queue\"\n>;\n\nexport const makeRedisHyperLogLog = (\n client: RedisClientType,\n): RedisHyperLogLogAsync =>\n makeCommandGroup(client, redisHyperLogLogKeys, AsyncExec);\n\nexport const makeRedisHyperLogLogQueue = (\n client: RedisClientType,\n): RedisHyperLogLogQueue =>\n makeCommandGroup(client, redisHyperLogLogKeys, QueueExec);\n","// JSON Commands\n//\n// JSON.ARRAPPEND - Append one or more JSON values into the array at path after the last element in it.\n// JSON.ARRINDEX - Returns the index of the first occurrence of a JSON scalar value in the array at path\n// JSON.ARRINSERT - Inserts the JSON scalar(s) value at the specified index in the array at path\n// JSON.ARRLEN - Returns the length of the array at path\n// JSON.ARRPOP - Removes and returns the element at the specified index in the array at path\n// JSON.ARRTRIM - Trims the array at path to contain only the specified inclusive range of indices from start to stop\n// JSON.CLEAR - Clears all values from an array or an object and sets numeric values to `0`\n// JSON.DEBUG - Debugging container command // TODO: Not Supported\n// JSON.DEBUG MEMORY - Reports the size in bytes of a key\n// JSON.DEL - Deletes a value\n// JSON.FORGET - Deletes a value\n// JSON.GET - Gets the value at one or more paths in JSON serialized form\n// JSON.MERGE - Merges a given JSON value into matching paths. Consequently, JSON values at matching paths are updated, deleted, or expanded with new children\n// JSON.MGET - Returns the values at a path from one or more keys\n// JSON.MSET - Sets or updates the JSON value of one or more keys\n// JSON.NUMINCRBY - Increments the numeric value at path by a value\n// JSON.NUMMULTBY - Multiplies the numeric value at path by a value\n// JSON.OBJKEYS - Returns the JSON keys of the object at path\n// JSON.OBJLEN - Returns the number of keys of the object at path\n// JSON.RESP - Returns the JSON value at path in Redis Serialization Protocol (RESP) // TODO: Not Supported\n// JSON.SET - Sets or updates the JSON value at a path\n// JSON.STRAPPEND - Appends a string to a JSON string value at path\n// JSON.STRLEN - Returns the length of the JSON String at path in key\n// JSON.TOGGLE - Toggles a boolean value\n// JSON.TYPE - Returns the type of the JSON value at path\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisJsonKeys = [\n \"arrAppend\",\n \"arrIndex\",\n \"arrInsert\",\n \"arrLen\",\n \"arrPop\",\n \"arrTrim\",\n \"clear\",\n // debug, // TODO: Not Supported\n \"debugMemory\",\n \"del\",\n \"forget\",\n \"get\",\n \"merge\",\n \"mGet\",\n \"mSet\",\n \"numIncrBy\",\n \"numMultBy\",\n \"objKeys\",\n \"objLen\",\n // resp, // TODO: Not Supported\n \"set\",\n \"strAppend\",\n \"strLen\",\n \"toggle\",\n \"type\",\n] as const;\n\nexport type RedisJsonAsync = CommandGroup<\n RedisClientType[\"json\"],\n typeof redisJsonKeys,\n \"async\"\n>;\n\nexport type RedisJsonQueue = CommandGroup<\n RedisClientType[\"json\"],\n typeof redisJsonKeys,\n \"queue\"\n>;\n\nexport const makeRedisJson = (client: RedisClientType): RedisJsonAsync =>\n makeCommandGroup(client.json, redisJsonKeys, AsyncExec);\n\nexport const makeRedisJsonQueue = (client: RedisClientType): RedisJsonQueue =>\n makeCommandGroup(client.json, redisJsonKeys, QueueExec);\n","// List commands operate on lists of strings, ordered by insertion order.\n\n// BLMOVE - Pops an element from a list, pushes it to another list and returns it. Blocks until an element is available otherwise. Deletes the list if the last element was moved.\n// BLMPOP - Pops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped.\n// BLPOP - Removes and returns the first element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.\n// BRPOP - Removes and returns the last element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.\n// BRPOPLPUSH - Pops an element from a list, pushes it to another list and returns it. Block until an element is available otherwise. Deletes the list if the last element was popped.\n// LINDEX - Returns an element from a list by its index.\n// LINSERT - Inserts an element before or after another element in a list.\n// LLEN - Returns the length of a list.\n// LMOVE - Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved.\n// LMPOP - Returns multiple elements from a list after removing them. Deletes the list if the last element was popped.\n// LPOP - Returns the first elements in a list after removing it. Deletes the list if the last element was popped.\n// LPOS - Returns the index of matching elements in a list.\n// LPUSH - Prepends one or more elements to a list. Creates the key if it doesn't exist.\n// LPUSHX - Prepends one or more elements to a list only when the list exists.\n// LRANGE - Returns a range of elements from a list.\n// LREM - Removes elements from a list. Deletes the list if the last element was removed.\n// LSET - Sets the value of an element in a list by its index.\n// LTRIM - Removes elements from both ends a list. Deletes the list if all elements were trimmed.\n// RPOP - Returns and removes the last elements of a list. Deletes the list if the last element was popped.\n// RPOPLPUSH - Returns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped.\n// RPUSH - Appends one or more elements to a list. Creates the key if it doesn't exist.\n// RPUSHX - Appends an element to a list only when the list exists.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisListKeys = [\n \"blMove\",\n \"blmPop\",\n \"blPop\",\n \"brPop\",\n \"brPopLPush\",\n \"lIndex\",\n \"lInsert\",\n \"lLen\",\n \"lMove\",\n \"lPop\",\n \"lPos\",\n \"lPush\",\n \"lPushX\",\n \"lRange\",\n \"lRem\",\n \"lSet\",\n \"lTrim\",\n \"rPop\",\n \"rPopLPush\",\n \"rPush\",\n \"rPushX\",\n] as const;\n\nexport type RedisListAsync = CommandGroup<\n RedisClientType,\n typeof redisListKeys,\n \"async\"\n>;\n\nexport type RedisListQueue = CommandGroup<\n RedisClientType,\n typeof redisListKeys,\n \"queue\"\n>;\n\nexport const makeRedisList = (client: RedisClientType): RedisListAsync =>\n makeCommandGroup(client, redisListKeys, AsyncExec);\n\nexport const makeRedisListQueue = (client: RedisClientType): RedisListQueue =>\n makeCommandGroup(client, redisListKeys, QueueExec);\n","// Scripting commands enable server-side Lua script execution.\n\n// EVAL - Executes a server-side Lua script.\n// EVALSHA - Executes a server-side Lua script by SHA1 digest.\n// EVALSHA_RO - Executes a read-only server-side Lua script by SHA1 digest.\n// EVAL_RO - Executes a read-only server-side Lua script.\n// FCALL - Invokes a function.\n// FCALL_RO - Invokes a read-only function.\n// FUNCTION DELETE - Deletes a library and its functions.\n// FUNCTION DUMP - Dumps all libraries into a serialized binary payload.\n// FUNCTION FLUSH - Deletes all libraries and functions.\n// FUNCTION KILL - Terminates a function during execution.\n// FUNCTION LIST - Returns information about all libraries.\n// FUNCTION LOAD - Creates a library.\n// FUNCTION RESTORE - Restores all libraries from a payload.\n// FUNCTION STATS - Returns information about a function during execution.\n// SCRIPT DEBUG - Sets the debug mode of server-side Lua scripts.\n// SCRIPT EXISTS - Determines whether server-side Lua scripts exist in the script cache.\n// SCRIPT FLUSH - Removes all server-side Lua scripts from the script cache.\n// SCRIPT KILL - Terminates a server-side Lua script during execution.\n// SCRIPT LOAD - Loads a server-side Lua script to the script cache.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisScriptingKeys = [\n \"eval\",\n \"evalSha\",\n \"evalShaRo\",\n \"evalRo\",\n \"fCall\",\n \"fCallRo\",\n \"functionDelete\",\n \"functionDump\",\n \"functionFlush\",\n \"functionKill\",\n \"functionList\",\n \"functionLoad\",\n \"functionRestore\",\n \"functionStats\",\n \"scriptDebug\",\n \"scriptExists\",\n \"scriptFlush\",\n \"scriptKill\",\n \"scriptLoad\",\n] as const;\n\nexport type RedisScriptingAsync = CommandGroup<\n RedisClientType,\n typeof redisScriptingKeys,\n \"async\"\n>;\n\nexport type RedisScriptingQueue = CommandGroup<\n RedisClientType,\n typeof redisScriptingKeys,\n \"queue\"\n>;\n\nexport const makeRedisScripting = (\n client: RedisClientType,\n): RedisScriptingAsync =>\n makeCommandGroup(client, redisScriptingKeys, AsyncExec);\n\nexport const makeRedisScriptingQueue = (\n client: RedisClientType,\n): RedisScriptingQueue =>\n makeCommandGroup(client, redisScriptingKeys, QueueExec);\n","// Set commands operate on unordered collections of unique strings.\n\n// SADD - Adds one or more members to a set. Creates the key if it doesn't exist.\n// SCARD - Returns the number of members in a set.\n// SDIFF - Returns the difference of multiple sets.\n// SDIFFSTORE - Stores the difference of multiple sets in a key.\n// SINTER - Returns the intersect of multiple sets.\n// SINTERCARD - Returns the number of members of the intersect of multiple sets.\n// SINTERSTORE - Stores the intersect of multiple sets in a key.\n// SISMEMBER - Determines whether a member belongs to a set.\n// SMEMBERS - Returns all members of a set.\n// SMISMEMBER - Determines whether multiple members belong to a set.\n// SMOVE - Moves a member from one set to another.\n// SPOP - Returns one or more random members from a set after removing them. Deletes the set if the last member was popped.\n// SRANDMEMBER - Get one or multiple random members from a set\n// SREM - Removes one or more members from a set. Deletes the set if the last member was removed.\n// SSCAN - Iterates over members of a set.\n// SUNION - Returns the union of multiple sets.\n// SUNIONSTORE - Stores the union of multiple sets in a key.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisSetKeys = [\n \"sAdd\",\n \"sCard\",\n \"sDiff\",\n \"sDiffStore\",\n \"sInter\",\n \"sInterCard\",\n \"sInterStore\",\n \"sIsMember\",\n \"sMembers\",\n \"smIsMember\",\n \"sMove\",\n \"sPop\",\n \"sRandMember\",\n \"sRem\",\n \"sScan\",\n \"sUnion\",\n \"sUnionStore\",\n] as const;\n\nexport type RedisSetAsync = CommandGroup<\n RedisClientType,\n typeof redisSetKeys,\n \"async\"\n>;\n\nexport type RedisSetQueue = CommandGroup<\n RedisClientType,\n typeof redisSetKeys,\n \"queue\"\n>;\n\nexport const makeRedisSet = (client: RedisClientType): RedisSetAsync =>\n makeCommandGroup(client, redisSetKeys, AsyncExec);\n\nexport const makeRedisSetQueue = (client: RedisClientType): RedisSetQueue =>\n makeCommandGroup(client, redisSetKeys, QueueExec);\n","// Sorted set commands operate on sets of unique strings ordered by a score.\n\n// BZMPOP - Removes and returns a member by score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.\n// BZPOPMAX - Removes and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped.\n// BZPOPMIN - Removes and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.\n// ZADD - Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist.\n// ZCARD - Returns the number of members in a sorted set.\n// ZCOUNT - Returns the count of members in a sorted set that have scores within a range.\n// ZDIFF - Returns the difference between multiple sorted sets.\n// ZDIFFSTORE - Stores the difference of multiple sorted sets in a key.\n// ZINCRBY - Increments the score of a member in a sorted set.\n// ZINTER - Returns the intersect of multiple sorted sets.\n// ZINTERCARD - Returns the number of members of the intersect of multiple sorted sets.\n// ZINTERSTORE - Stores the intersect of multiple sorted sets in a key.\n// ZLEXCOUNT - Returns the number of members in a sorted set within a lexicographical range.\n// ZMPOP - Returns the highest- or lowest-scoring members from one or more sorted sets after removing them. Deletes the sorted set if the last member was popped.\n// ZMSCORE - Returns the score of one or more members in a sorted set.\n// ZPOPMAX - Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.\n// ZPOPMIN - Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.\n// ZRANDMEMBER - Returns one or more random members from a sorted set.\n// ZRANGE - Returns members in a sorted set within a range of indexes.\n// ZRANGEBYLEX - Returns members in a sorted set within a lexicographical range.\n// ZRANGEBYSCORE - Returns members in a sorted set within a range of scores.\n// ZRANGESTORE - Stores a range of members from sorted set in a key.\n// ZRANK - Returns the index of a member in a sorted set ordered by ascending scores.\n// ZREM - Removes one or more members from a sorted set. Deletes the sorted set if all members were removed.\n// ZREMRANGEBYLEX - Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed.\n// ZREMRANGEBYRANK - Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed.\n// ZREMRANGEBYSCORE - Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed.\n// ZREVRANGE - Returns members in a sorted set within a range of indexes in reverse order.\n// ZREVRANGEBYLEX - Returns members in a sorted set within a lexicographical range in reverse order.\n// ZREVRANGEBYSCORE - Returns members in a sorted set within a range of scores in reverse order.\n// ZREVRANK - Returns the index of a member in a sorted set ordered by descending scores.\n// ZSCAN - Iterates over members and scores of a sorted set.\n// ZSCORE - Returns the score of a member in a sorted set.\n// ZUNION - Returns the union of multiple sorted sets.\n// ZUNIONSTORE - Stores the union of multiple sorted sets in a key.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisSortedSetKeys = [\n \"zAdd\",\n \"zCard\",\n \"zCount\",\n \"zDiff\",\n \"zDiffStore\",\n \"zIncrBy\",\n \"zInter\",\n \"zInterCard\",\n \"zInterStore\",\n \"zLexCount\",\n \"zmPop\",\n \"zmScore\",\n \"zPopMax\",\n \"zPopMin\",\n \"zRandMember\",\n \"zRange\",\n \"zRangeByLex\",\n \"zRangeByScore\",\n \"zRangeStore\",\n \"zRank\",\n \"zRem\",\n \"zRemRangeByLex\",\n \"zRemRangeByRank\",\n \"zRemRangeByScore\",\n // zRevRange, // TODO: Not Supported\n // zRevRangeByLex, // TODO: Not Supported\n // zRevRangeByScore, // TODO: Not Supported\n \"zRevRank\",\n \"zScan\",\n \"zScore\",\n \"zUnion\",\n \"zUnionStore\",\n] as const;\n\nexport type RedisSortedSetAsync = CommandGroup<\n RedisClientType,\n typeof redisSortedSetKeys,\n \"async\"\n>;\n\nexport type RedisSortedSetQueue = CommandGroup<\n RedisClientType,\n typeof redisSortedSetKeys,\n \"queue\"\n>;\n\nexport const makeRedisSortedSet = (\n client: RedisClientType,\n): RedisSortedSetAsync =>\n makeCommandGroup(client, redisSortedSetKeys, AsyncExec);\n\nexport const makeRedisSortedSetQueue = (\n client: RedisClientType,\n): RedisSortedSetQueue =>\n makeCommandGroup(client, redisSortedSetKeys, QueueExec);\n","// String Commands\n//\n// APPEND - Appends a string to the value of a key. Creates the key if it doesn't exist.\n// DECR - Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.\n// DECRBY - Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist.\n// DELEX - Conditionally removes the specified key based on value or hash digest comparison. ⭐ New in 8.4\n// DIGEST - Returns the hash digest of a string value as a hexadecimal string. ⭐ New in 8.4\n// GET - Returns the string value of a key.\n// GETDEL - Returns the string value of a key after deleting the key.\n// GETEX - Returns the string value of a key after setting its expiration time.\n// GETRANGE - Returns a substring of the string stored at a key.\n// GETSET - Returns the previous string value of a key after setting it to a new value.\n// INCR - Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.\n// INCRBY - Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist.\n// INCRBYFLOAT - Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist.\n// LCS - Finds the longest common substring.\n// MGET - Atomically returns the string values of one or more keys.\n// MSET - Atomically creates or modifies the string values of one or more keys.\n// MSETEX - Atomically sets multiple string keys with a shared expiration in a single operation. ⭐ New in 8.4\n// MSETNX - Atomically modifies the string values of one or more keys only when all keys don't exist.\n// PSETEX - Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist.\n// SET - Sets the string value of a key, ignoring its type. The key is created if it doesn't exist.\n// SETEX - Sets the string value and expiration time of a key. Creates the key if it doesn't exist.\n// SETNX - Set the string value of a key only when the key doesn't exist.\n// SETRANGE - Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist.\n// STRLEN - Returns the length of a string value.\n// SUBSTR - Returns a substring from a string value.\n\nimport type { RedisClientType } from \"redis\";\n\nimport {\n AsyncExec,\n type CommandGroup,\n makeCommandGroup,\n QueueExec,\n} from \"@/helpers\";\n\nconst redisStringKeys = [\n \"append\",\n \"decr\",\n \"decrBy\",\n \"delEx\",\n \"digest\",\n \"get\",\n \"getDel\",\n \"getEx\",\n \"getRange\",\n \"getSet\",\n \"incr\",\n \"incrBy\",\n \"incrByFloat\",\n \"lcs\",\n \"mGet\",\n \"mSet\",\n \"mSetEx\",\n \"mSetNX\",\n \"pSetEx\",\n \"set\",\n \"setEx\",\n \"setNX\",\n \"setRange\",\n \"strLen\",\n // \"substr\", // TODO: Not Supported\n] as const;\n\nexport type RedisStringAsync = CommandGroup<\n RedisClientType,\n typeof redisStringKeys,\n \"async\"\n>;\n\nexport type RedisStringQueue = CommandGroup<\n RedisClientType,\n typeof redisStringKeys,\n \"queue\"\n>;\n\nexport const makeRedisString = (client: RedisClientType): RedisStringAsync =>\n makeCommandGroup(client, redisStringKeys, AsyncExec);\n\nexport const makeRedisStringQueue = (\n client: RedisClientType,\n): RedisStringQueue => makeCommandGroup(client, redisStringKeys, QueueExec);\n","// core/index.ts\n\nimport { Context, Effect, Layer } from \"effect\";\nimport type { RedisClientType } from \"redis\";\n\n// Commands\nimport * as bitMap from \"../commands/bitmap\";\nimport * as generic from \"../commands/generic\";\nimport * as geospatial from \"../commands/geospatial\";\nimport * as hash from \"../commands/hash\";\nimport * as hyperLogLog from \"../commands/hyper-log-log\";\nimport * as json from \"../commands/json\";\nimport * as list from \"../commands/list\";\nimport * as scripting from \"../commands/scripting\";\nimport * as set from \"../commands/set\";\nimport * as sortedSet from \"../commands/sorted-set\";\nimport * as string from \"../commands/string\";\n// Connection\nimport { RedisConnection } from \"../connection\";\n// Errors\nimport { RedisError } from \"../errors\";\n\nexport type RedisTxShape = string.RedisStringQueue &\n hash.RedisHashQueue &\n list.RedisListQueue &\n set.RedisSetQueue &\n sortedSet.RedisSortedSetQueue &\n bitMap.RedisBitmapQueue &\n scripting.RedisScriptingQueue &\n generic.RedisGenericQueue &\n geospatial.RedisGeoSpatialQueue &\n hyperLogLog.RedisHyperLogLogQueue & {\n json: json.RedisJsonQueue;\n };\n\nexport type Multi = <A>(\n program: (tx: RedisTxShape) => Effect.Effect<A, RedisError>,\n) => Effect.Effect<\n readonly [result: A, exec: ReadonlyArray<unknown> | null],\n RedisError\n>;\n\nexport type Pipeline = <A>(\n program: (tx: RedisTxShape) => Effect.Effect<A, RedisError>,\n) => Effect.Effect<\n readonly [result: A, exec: ReadonlyArray<unknown>],\n RedisError\n>;\n\nexport type TransactionAsync = {\n multi: Multi;\n pipeline: Pipeline;\n};\n\nexport type RedisCoreShape = string.RedisStringAsync &\n hash.RedisHashAsync &\n list.RedisListAsync &\n set.RedisSetAsync &\n sortedSet.RedisSortedSetAsync &\n bitMap.RedisBitmapAsync &\n scripting.RedisScriptingAsync &\n generic.RedisGenericAsync &\n hyperLogLog.RedisHyperLogLogAsync &\n geospatial.RedisGeoSpatialAsync &\n TransactionAsync & {\n json: json.RedisJsonAsync;\n };\n\n// biome-ignore lint/suspicious/noExplicitAny: safe\nconst makeRedisTx = (c: any): RedisTxShape => ({\n ...bitMap.makeRedisBitmapQueue(c),\n ...generic.makeRedisGenericQueue(c),\n ...hash.makeRedisHashQueue(c),\n ...hyperLogLog.makeRedisHyperLogLogQueue(c),\n ...list.makeRedisListQueue(c),\n ...scripting.makeRedisScriptingQueue(c),\n ...set.makeRedisSetQueue(c),\n ...sortedSet.makeRedisSortedSetQueue(c),\n ...string.makeRedisStringQueue(c),\n ...geospatial.makeRedisGeoSpatialQueue(c),\n json: json.makeRedisJsonQueue(c),\n});\n\nconst makeRedisCore = (c: RedisClientType): RedisCoreShape => ({\n ...bitMap.makeRedisBitmap(c),\n ...generic.makeRedisGeneric(c),\n ...hash.makeRedisHash(c),\n ...hyperLogLog.makeRedisHyperLogLog(c),\n ...list.makeRedisList(c),\n ...scripting.makeRedisScripting(c),\n ...set.makeRedisSet(c),\n ...sortedSet.makeRedisSortedSet(c),\n ...string.makeRedisString(c),\n ...geospatial.makeRedisGeoSpatial(c),\n json: json.makeRedisJson(c),\n multi: <A>(program: (tx: RedisTxShape) => Effect.Effect<A, RedisError>) =>\n Effect.gen(function* () {\n const txClient = c.multi();\n const txApi = makeRedisTx(txClient);\n\n const programResult = yield* program(txApi);\n\n const execResult = yield* Effect.tryPromise({\n catch: (e) => new RedisError({ cause: e }),\n try: () => txClient.exec(),\n });\n\n return [programResult, execResult] as const;\n }),\n pipeline: <A>(program: (tx: RedisTxShape) => Effect.Effect<A, RedisError>) =>\n Effect.gen(function* () {\n const txClient = c.multi();\n const txApi = makeRedisTx(txClient);\n\n const programResult = yield* program(txApi);\n\n const execResult = yield* Effect.tryPromise({\n catch: (e) => new RedisError({ cause: e }),\n try: () => txClient.execAsPipeline(),\n });\n\n return [programResult, execResult] as const;\n }),\n});\n\nexport class RedisCore extends Context.Tag(\"RedisCore\")<\n RedisCore,\n RedisCoreShape\n>() {}\n\nexport const RedisCoreLive = Layer.effect(\n RedisCore,\n Effect.gen(function* () {\n const { client } = yield* RedisConnection;\n\n client.eval(\"return redis.call('GET',KEYS[1])\", {\n arguments: [],\n keys: [\"key\"],\n });\n\n return makeRedisCore(client);\n }),\n);\n"],"mappings":";;;;AAWA,IAAa,kBAAb,cAAqC,QAAQ,IAAI,kBAAkB,EAGhE,CAAC;AAEJ,MAAa,oBAAoB,YAC/B,MAAM,OACJ,iBACA,OAAO,eACL,OAAO,QAAQ,YAAY;CACzB,MAAM,SAAS,aAAa,QAAQ;AAEpC,OAAM,OAAO,SAAS;AACtB,QAAO,EAAE,QAAQ;EACjB,GACD,EAAE,aAAa,OAAO,cAAc,OAAO,MAAM,CAAC,CACpD,CACF;;;;AC1BH,IAAa,aAAb,cAAgC,KAAK,YAAY,aAAa,CAG3D;;;;;ACwBH,SAAgB,iBAKd,QACA,MACA,MACmC;CACnC,MAAM,MAA+B,EAAE;AAEvC,MAAK,MAAM,KAAK,MAAM;EACpB,MAAM,KAAM,OAAe;AAC3B,MAAI,MAAgB,GAAG,SAAgB,KAAK,IAAI,QAAQ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