effect-redis 0.0.4 → 0.0.6
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 +180 -180
- package/dist/index.js +7 -7
- package/package.json +2 -2
- package/src/redis.ts +21 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-redis",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Simple Effect wrapper for Redis.",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"typescript": "^5",
|
|
25
|
-
"effect": "^3.
|
|
25
|
+
"effect": "^3.16.2",
|
|
26
26
|
"redis": "^5.1.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {}
|
package/src/redis.ts
CHANGED
|
@@ -128,15 +128,13 @@ const bootstrapRedisPersistenceEffect = Effect.gen(function* () {
|
|
|
128
128
|
|
|
129
129
|
return RedisPersistence.of({
|
|
130
130
|
setValue: (key, value) =>
|
|
131
|
-
Effect.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}),
|
|
139
|
-
});
|
|
131
|
+
Effect.tryPromise({
|
|
132
|
+
try: () => client.set(key, value),
|
|
133
|
+
catch: (e) =>
|
|
134
|
+
new RedisError({
|
|
135
|
+
cause: e,
|
|
136
|
+
message: 'Error in `Redis.setValue`',
|
|
137
|
+
}),
|
|
140
138
|
}),
|
|
141
139
|
});
|
|
142
140
|
});
|
|
@@ -152,26 +150,22 @@ const bootstrapRedisPubSubEffect = Effect.gen(function* () {
|
|
|
152
150
|
|
|
153
151
|
return RedisPubSub.of({
|
|
154
152
|
publish: (channel, message) =>
|
|
155
|
-
Effect.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}),
|
|
163
|
-
});
|
|
153
|
+
Effect.tryPromise({
|
|
154
|
+
try: () => clientPublish.publish(channel, message),
|
|
155
|
+
catch: (e) =>
|
|
156
|
+
new RedisError({
|
|
157
|
+
cause: e,
|
|
158
|
+
message: 'Error in `Redis.publish`',
|
|
159
|
+
}),
|
|
164
160
|
}),
|
|
165
161
|
subscribe: (channel, handler) =>
|
|
166
|
-
Effect.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
});
|
|
162
|
+
Effect.tryPromise({
|
|
163
|
+
try: () => clientSubscribe.subscribe(channel, handler),
|
|
164
|
+
catch: (e) =>
|
|
165
|
+
new RedisError({
|
|
166
|
+
cause: e,
|
|
167
|
+
message: 'Error in `Redis.subscribe`',
|
|
168
|
+
}),
|
|
175
169
|
}),
|
|
176
170
|
});
|
|
177
171
|
});
|