@devvit/redis 0.11.16-next-2025-05-21-9df7afc74.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 +26 -0
- package/README.md +5 -0
- package/RedisClient.d.ts +108 -0
- package/RedisClient.d.ts.map +1 -0
- package/RedisClient.js +615 -0
- package/RedisClient.test.d.ts.map +1 -0
- package/getRedis.d.ts +4 -0
- package/getRedis.d.ts.map +1 -0
- package/getRedis.js +10 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +2 -0
- package/package.json +44 -0
- package/types/redis.d.ts +1514 -0
- package/types/redis.d.ts.map +1 -0
- package/types/redis.js +1 -0
package/RedisClient.js
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _TxClient_instances, _TxClient_storage, _TxClient_transactionId, _TxClient_txnStartMetadata, _TxClient_metadata_get, _RedisClient_instances, _RedisClient_storage, _RedisClient_metadata_get;
|
|
13
|
+
import { BitfieldOverflowBehavior, RedisKeyScope } from '@devvit/protos';
|
|
14
|
+
import { getContext } from '@devvit/server';
|
|
15
|
+
// Re-export this here, to prevent devs from needing to directly import from the protos package.
|
|
16
|
+
export { RedisKeyScope } from '@devvit/protos';
|
|
17
|
+
// TODO: This code is currently cloned into the Devvit Web world from `@devvit/public-api`. If
|
|
18
|
+
// you change this code, please make sure to update the other package as well. Eventually, that
|
|
19
|
+
// copy of the code will be deleted, when we move to a fully Devvit Web world.
|
|
20
|
+
export class TxClient {
|
|
21
|
+
constructor(storage, transactionId, metadata) {
|
|
22
|
+
_TxClient_instances.add(this);
|
|
23
|
+
_TxClient_storage.set(this, void 0);
|
|
24
|
+
_TxClient_transactionId.set(this, void 0);
|
|
25
|
+
_TxClient_txnStartMetadata.set(this, void 0);
|
|
26
|
+
__classPrivateFieldSet(this, _TxClient_storage, storage, "f");
|
|
27
|
+
__classPrivateFieldSet(this, _TxClient_transactionId, transactionId, "f");
|
|
28
|
+
__classPrivateFieldSet(this, _TxClient_txnStartMetadata, metadata, "f");
|
|
29
|
+
}
|
|
30
|
+
async get(key) {
|
|
31
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Get({ key: key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
async multi() {
|
|
35
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Multi(__classPrivateFieldGet(this, _TxClient_transactionId, "f"), __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
36
|
+
}
|
|
37
|
+
async set(key, value, options) {
|
|
38
|
+
let expiration;
|
|
39
|
+
if (options?.expiration) {
|
|
40
|
+
expiration = Math.floor((options.expiration.getTime() - Date.now()) / 1000); // convert to seconds
|
|
41
|
+
if (expiration < 1) {
|
|
42
|
+
expiration = 1; // minimum expiration is 1 second, clock skew can cause issues, so let's set 1 second.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Set({
|
|
46
|
+
key,
|
|
47
|
+
value,
|
|
48
|
+
nx: options?.nx === true,
|
|
49
|
+
xx: options?.xx === true,
|
|
50
|
+
expiration: expiration || 0,
|
|
51
|
+
transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f"),
|
|
52
|
+
}, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
async del(...keys) {
|
|
56
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Del({ keys: keys, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
async type(key) {
|
|
60
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Type({ key: key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
async exec() {
|
|
65
|
+
const response = await __classPrivateFieldGet(this, _TxClient_storage, "f").Exec(__classPrivateFieldGet(this, _TxClient_transactionId, "f"), __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
66
|
+
// eslint-disable-next-line
|
|
67
|
+
let output = [];
|
|
68
|
+
for (const result of response.response) {
|
|
69
|
+
if (result.members) {
|
|
70
|
+
output.push(result.members);
|
|
71
|
+
}
|
|
72
|
+
else if (result.nil !== undefined) {
|
|
73
|
+
output.push(null);
|
|
74
|
+
}
|
|
75
|
+
else if (result.num !== undefined) {
|
|
76
|
+
output.push(result.num);
|
|
77
|
+
}
|
|
78
|
+
else if (result.values !== undefined) {
|
|
79
|
+
output.push(result.values.values);
|
|
80
|
+
}
|
|
81
|
+
else if (result.str !== undefined) {
|
|
82
|
+
output.push(result.str);
|
|
83
|
+
}
|
|
84
|
+
else if (result.dbl !== undefined) {
|
|
85
|
+
output.push(result.dbl);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return output;
|
|
89
|
+
}
|
|
90
|
+
async discard() {
|
|
91
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Discard(__classPrivateFieldGet(this, _TxClient_transactionId, "f"), __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
92
|
+
}
|
|
93
|
+
async watch(...keys) {
|
|
94
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Watch({ keys: keys, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
async unwatch() {
|
|
98
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Unwatch(__classPrivateFieldGet(this, _TxClient_transactionId, "f"), __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
async getrange(key, start, end) {
|
|
102
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").GetRange({ key, start, end, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
async setrange(key, offset, value) {
|
|
106
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").SetRange({ key, offset, value, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
async strlen(key) {
|
|
110
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Strlen({ key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
async mget(keys) {
|
|
114
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").MGet({ keys, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
async mset(keyValues) {
|
|
118
|
+
const kv = Object.entries(keyValues).map(([key, value]) => ({ key, value }));
|
|
119
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").MSet({ kv, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
async incrby(key, value) {
|
|
123
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").IncrBy({ key, value, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
async expire(key, seconds) {
|
|
127
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").Expire({ key, seconds, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
async expiretime(key) {
|
|
131
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ExpireTime({ key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
async zadd(key, ...members) {
|
|
135
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZAdd({ key, members, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
async zscore(key, member) {
|
|
139
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZScore({ key: { key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, member }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
async zrank(key, member) {
|
|
143
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZRank({ key: { key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, member }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
144
|
+
return this;
|
|
145
|
+
}
|
|
146
|
+
async zincrby(key, member, value) {
|
|
147
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZIncrBy({ key, member, value, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
async zscan(key, cursor, pattern, count) {
|
|
151
|
+
const request = {
|
|
152
|
+
key,
|
|
153
|
+
cursor,
|
|
154
|
+
pattern,
|
|
155
|
+
count,
|
|
156
|
+
transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f"),
|
|
157
|
+
};
|
|
158
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZScan(request, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
async zcard(key) {
|
|
162
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZCard({ key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
async zrange(key, start, stop, options) {
|
|
166
|
+
// eslint-disable-next-line
|
|
167
|
+
let opts = { rev: false, byLex: false, byScore: false, offset: 0, count: 1000 };
|
|
168
|
+
if (options?.reverse) {
|
|
169
|
+
opts.rev = options.reverse;
|
|
170
|
+
}
|
|
171
|
+
if (options?.by === 'lex') {
|
|
172
|
+
opts.byLex = true;
|
|
173
|
+
}
|
|
174
|
+
else if (options?.by === 'score') {
|
|
175
|
+
opts.byScore = true;
|
|
176
|
+
}
|
|
177
|
+
if (options?.limit) {
|
|
178
|
+
if (opts.byLex || opts.byScore) {
|
|
179
|
+
opts.offset = options.limit.offset;
|
|
180
|
+
opts.count = options.limit.count;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
throw new Error(`zRange parsing error: 'limit' only allowed when 'options.by' is 'lex' or 'score'`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZRange({
|
|
187
|
+
key: { key: key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") },
|
|
188
|
+
start: start + '',
|
|
189
|
+
stop: stop + '',
|
|
190
|
+
...opts,
|
|
191
|
+
}, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
async zrem(key, members) {
|
|
195
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZRem({ key: { key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, members: members }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
async zremrangebylex(key, min, max) {
|
|
199
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZRemRangeByLex({ key: { key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, min: min, max: max }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
async zremrangebyrank(key, start, stop) {
|
|
203
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZRemRangeByRank({ key: { key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, start: start, stop: stop }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
async zremrangebyscore(key, min, max) {
|
|
207
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").ZRemRangeByScore({ key: { key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, min: min, max: max }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
async hgetall(key) {
|
|
211
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HGetAll({ key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
212
|
+
return this;
|
|
213
|
+
}
|
|
214
|
+
async hget(key, field) {
|
|
215
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HGet({ key: key, field: field, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
async hmget(key, fields) {
|
|
219
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HMGet({ key: key, fields: fields, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
async hset(key, fieldValues) {
|
|
223
|
+
const fv = Object.entries(fieldValues).map(([field, value]) => ({ field, value }));
|
|
224
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HSet({ key, fv, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
async hincrby(key, field, value) {
|
|
228
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HIncrBy({ key, field, value, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
async hdel(key, fields) {
|
|
232
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HDel({ key, fields, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
233
|
+
return this;
|
|
234
|
+
}
|
|
235
|
+
async hscan(key, cursor, pattern, count) {
|
|
236
|
+
const request = {
|
|
237
|
+
key,
|
|
238
|
+
cursor,
|
|
239
|
+
pattern,
|
|
240
|
+
count,
|
|
241
|
+
transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f"),
|
|
242
|
+
};
|
|
243
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HScan(request, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
async hkeys(key) {
|
|
247
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HKeys({ key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
248
|
+
return this;
|
|
249
|
+
}
|
|
250
|
+
async hlen(key) {
|
|
251
|
+
await __classPrivateFieldGet(this, _TxClient_storage, "f").HLen({ key, transactionId: __classPrivateFieldGet(this, _TxClient_transactionId, "f") }, __classPrivateFieldGet(this, _TxClient_instances, "a", _TxClient_metadata_get));
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
_TxClient_storage = new WeakMap(), _TxClient_transactionId = new WeakMap(), _TxClient_txnStartMetadata = new WeakMap(), _TxClient_instances = new WeakSet(), _TxClient_metadata_get = function _TxClient_metadata_get() {
|
|
256
|
+
assertTxMetadataIsCurrent(__classPrivateFieldGet(this, _TxClient_txnStartMetadata, "f"));
|
|
257
|
+
return __classPrivateFieldGet(this, _TxClient_txnStartMetadata, "f");
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* This is a subset of the overall Redis API. You should be able to look up https://redis.io/commands
|
|
261
|
+
* for more details on each command.
|
|
262
|
+
*
|
|
263
|
+
* For the moment, we've implemented a lot of the basic string/number commands, sorted sets, and transactions.
|
|
264
|
+
* This is the most powerful subset and the safest.
|
|
265
|
+
*/
|
|
266
|
+
export class RedisClient {
|
|
267
|
+
constructor(storage, scope) {
|
|
268
|
+
_RedisClient_instances.add(this);
|
|
269
|
+
_RedisClient_storage.set(this, void 0);
|
|
270
|
+
__classPrivateFieldSet(this, _RedisClient_storage, storage, "f");
|
|
271
|
+
this.scope = scope;
|
|
272
|
+
this.global =
|
|
273
|
+
scope === RedisKeyScope.INSTALLATION
|
|
274
|
+
? new RedisClient(__classPrivateFieldGet(this, _RedisClient_storage, "f"), RedisKeyScope.GLOBAL)
|
|
275
|
+
: this;
|
|
276
|
+
}
|
|
277
|
+
async watch(...keys) {
|
|
278
|
+
const txId = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Watch({ keys }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
279
|
+
return new TxClient(__classPrivateFieldGet(this, _RedisClient_storage, "f"), txId, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
280
|
+
}
|
|
281
|
+
async get(key) {
|
|
282
|
+
try {
|
|
283
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Get({ key, scope: this.scope }, {
|
|
284
|
+
...__classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get),
|
|
285
|
+
'throw-redis-nil': { values: ['true'] },
|
|
286
|
+
});
|
|
287
|
+
return response !== null ? (response.value ?? undefined) : response;
|
|
288
|
+
}
|
|
289
|
+
catch (e) {
|
|
290
|
+
if (isRedisNilError(e)) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
throw e;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async getbuffer(key) {
|
|
297
|
+
try {
|
|
298
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").GetBytes({ key, scope: this.scope }, {
|
|
299
|
+
...__classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get),
|
|
300
|
+
'throw-redis-nil': { values: ['true'] },
|
|
301
|
+
});
|
|
302
|
+
return response !== null ? Buffer.from(response.value) : response;
|
|
303
|
+
}
|
|
304
|
+
catch (e) {
|
|
305
|
+
if (isRedisNilError(e)) {
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
throw e;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async set(key, value, options) {
|
|
312
|
+
let expiration;
|
|
313
|
+
if (options?.expiration) {
|
|
314
|
+
expiration = Math.floor((options.expiration.getTime() - Date.now()) / 1000); // convert to seconds
|
|
315
|
+
if (expiration < 1) {
|
|
316
|
+
expiration = 1; // minimum expiration is 1 second, clock skew can cause issues, so let's set 1 second.
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Set({
|
|
320
|
+
key,
|
|
321
|
+
value,
|
|
322
|
+
nx: options?.nx === true && !options.xx,
|
|
323
|
+
xx: options?.xx === true && !options.nx,
|
|
324
|
+
expiration: expiration || 0,
|
|
325
|
+
scope: this.scope,
|
|
326
|
+
}, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
327
|
+
return response.value;
|
|
328
|
+
}
|
|
329
|
+
async exists(...keys) {
|
|
330
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Exists({ keys, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
331
|
+
return response.existingKeys;
|
|
332
|
+
}
|
|
333
|
+
async del(...keys) {
|
|
334
|
+
await __classPrivateFieldGet(this, _RedisClient_storage, "f").Del({ keys, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
335
|
+
}
|
|
336
|
+
async incrby(key, value) {
|
|
337
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").IncrBy({ key, value, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
338
|
+
return response.value;
|
|
339
|
+
}
|
|
340
|
+
async getrange(key, start, end) {
|
|
341
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").GetRange({ key, start, end, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
342
|
+
return response !== null ? response.value : response;
|
|
343
|
+
}
|
|
344
|
+
async setrange(key, offset, value) {
|
|
345
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").SetRange({ key, offset, value, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
346
|
+
return response.value;
|
|
347
|
+
}
|
|
348
|
+
async strlen(key) {
|
|
349
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Strlen({ key, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
350
|
+
return response.value;
|
|
351
|
+
}
|
|
352
|
+
async expire(key, seconds) {
|
|
353
|
+
await __classPrivateFieldGet(this, _RedisClient_storage, "f").Expire({ key, seconds, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
354
|
+
}
|
|
355
|
+
async expiretime(key) {
|
|
356
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ExpireTime({ key, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
357
|
+
return response.value;
|
|
358
|
+
}
|
|
359
|
+
async zadd(key, ...members) {
|
|
360
|
+
return (await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZAdd({ key, members, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get))).value;
|
|
361
|
+
}
|
|
362
|
+
async zrange(key, start, stop, options) {
|
|
363
|
+
// eslint-disable-next-line
|
|
364
|
+
let opts = { rev: false, byLex: false, byScore: false, offset: 0, count: 1000 };
|
|
365
|
+
if (options?.reverse) {
|
|
366
|
+
opts.rev = options.reverse;
|
|
367
|
+
}
|
|
368
|
+
if (options?.by === 'lex') {
|
|
369
|
+
opts.byLex = true;
|
|
370
|
+
}
|
|
371
|
+
else if (options?.by === 'score') {
|
|
372
|
+
opts.byScore = true;
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
// LIMIT requires BYLEX/BYSCORE
|
|
376
|
+
opts.offset = 0;
|
|
377
|
+
opts.count = 0;
|
|
378
|
+
}
|
|
379
|
+
if (options?.limit) {
|
|
380
|
+
if (opts.byLex || opts.byScore) {
|
|
381
|
+
opts.offset = options.limit.offset;
|
|
382
|
+
opts.count = options.limit.count;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
throw new Error(`zRange parsing error: 'limit' only allowed when 'options.by' is 'lex' or 'score'`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return (await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZRange({ key: { key: key }, start: start + '', stop: stop + '', ...opts, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get))).members;
|
|
389
|
+
}
|
|
390
|
+
async zrem(key, members) {
|
|
391
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZRem({ key: { key }, members, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
392
|
+
return response.value;
|
|
393
|
+
}
|
|
394
|
+
async zremrangebylex(key, min, max) {
|
|
395
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZRemRangeByLex({ key: { key }, min, max, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
396
|
+
return response.value;
|
|
397
|
+
}
|
|
398
|
+
async zremrangebyrank(key, start, stop) {
|
|
399
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZRemRangeByRank({ key: { key }, start, stop, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
400
|
+
return response.value;
|
|
401
|
+
}
|
|
402
|
+
async zremrangebyscore(key, min, max) {
|
|
403
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZRemRangeByScore({ key: { key }, min, max, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
404
|
+
return response.value;
|
|
405
|
+
}
|
|
406
|
+
async zscore(key, member) {
|
|
407
|
+
try {
|
|
408
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZScore({ key: { key }, member, scope: this.scope }, {
|
|
409
|
+
...__classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get),
|
|
410
|
+
'throw-redis-nil': { values: ['true'] },
|
|
411
|
+
});
|
|
412
|
+
return response !== null ? response.value : response;
|
|
413
|
+
}
|
|
414
|
+
catch (e) {
|
|
415
|
+
if (isRedisNilError(e)) {
|
|
416
|
+
return undefined;
|
|
417
|
+
}
|
|
418
|
+
throw e;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
async zrank(key, member) {
|
|
422
|
+
try {
|
|
423
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZRank({ key: { key }, member, scope: this.scope }, {
|
|
424
|
+
...__classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get),
|
|
425
|
+
'throw-redis-nil': { values: ['true'] },
|
|
426
|
+
});
|
|
427
|
+
return response !== null ? response.value : response;
|
|
428
|
+
}
|
|
429
|
+
catch (e) {
|
|
430
|
+
if (isRedisNilError(e)) {
|
|
431
|
+
return undefined;
|
|
432
|
+
}
|
|
433
|
+
throw e;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
async zincrby(key, member, value) {
|
|
437
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZIncrBy({ key, member, value, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
438
|
+
return response !== null ? response.value : response;
|
|
439
|
+
}
|
|
440
|
+
async mget(keys) {
|
|
441
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").MGet({ keys, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
442
|
+
return response !== null ? response.values.map((value) => value || null) : response;
|
|
443
|
+
}
|
|
444
|
+
async mset(keyValues) {
|
|
445
|
+
const kv = Object.entries(keyValues).map(([key, value]) => ({ key, value }));
|
|
446
|
+
await __classPrivateFieldGet(this, _RedisClient_storage, "f").MSet({ kv, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
447
|
+
}
|
|
448
|
+
async zcard(key) {
|
|
449
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZCard({ key, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
450
|
+
return response !== null ? response.value : response;
|
|
451
|
+
}
|
|
452
|
+
async zscan(key, cursor, pattern, count) {
|
|
453
|
+
const request = { key, cursor, pattern, count, scope: this.scope };
|
|
454
|
+
return await __classPrivateFieldGet(this, _RedisClient_storage, "f").ZScan(request, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
455
|
+
}
|
|
456
|
+
async type(key) {
|
|
457
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Type({ key: key, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
458
|
+
return response !== null ? response.value : response;
|
|
459
|
+
}
|
|
460
|
+
async rename(key, newKey) {
|
|
461
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Rename({ key, newKey, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
462
|
+
return response.result;
|
|
463
|
+
}
|
|
464
|
+
async hget(key, field) {
|
|
465
|
+
try {
|
|
466
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HGet({ key, field, scope: this.scope }, {
|
|
467
|
+
...__classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get),
|
|
468
|
+
'throw-redis-nil': { values: ['true'] },
|
|
469
|
+
});
|
|
470
|
+
return response !== null ? (response.value ?? undefined) : response;
|
|
471
|
+
}
|
|
472
|
+
catch (e) {
|
|
473
|
+
if (isRedisNilError(e)) {
|
|
474
|
+
return undefined;
|
|
475
|
+
}
|
|
476
|
+
throw e;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
async hmget(key, fields) {
|
|
480
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HMGet({ key, fields, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
481
|
+
return response !== null ? response.values.map((value) => value || null) : response;
|
|
482
|
+
}
|
|
483
|
+
async hset(key, fieldValues) {
|
|
484
|
+
const fv = Object.entries(fieldValues).map(([field, value]) => ({ field, value }));
|
|
485
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HSet({ key, fv, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
486
|
+
return response.value;
|
|
487
|
+
}
|
|
488
|
+
async hsetnx(key, field, value) {
|
|
489
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HSetNX({ key, field, value, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
490
|
+
return response.success;
|
|
491
|
+
}
|
|
492
|
+
async hgetall(key) {
|
|
493
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HGetAll({ key, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
494
|
+
return response !== null ? response.fieldValues : response;
|
|
495
|
+
}
|
|
496
|
+
async hdel(key, fields) {
|
|
497
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HDel({ key, fields, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
498
|
+
return response.value;
|
|
499
|
+
}
|
|
500
|
+
async hscan(key, cursor, pattern, count) {
|
|
501
|
+
const request = { key, cursor, pattern, count, scope: this.scope };
|
|
502
|
+
return await __classPrivateFieldGet(this, _RedisClient_storage, "f").HScan(request, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
503
|
+
}
|
|
504
|
+
async hkeys(key) {
|
|
505
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HKeys({ key, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
506
|
+
return response !== null ? response.keys : response;
|
|
507
|
+
}
|
|
508
|
+
async hincrby(key, field, value) {
|
|
509
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HIncrBy({ key, field, value, scope: this.scope }, __classPrivateFieldGet(this, _RedisClient_instances, "a", _RedisClient_metadata_get));
|
|
510
|
+
return response.value;
|
|
511
|
+
}
|
|
512
|
+
async hlen(key) {
|
|
513
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").HLen({
|
|
514
|
+
key,
|
|
515
|
+
scope: this.scope,
|
|
516
|
+
});
|
|
517
|
+
return response.value;
|
|
518
|
+
}
|
|
519
|
+
async bitfield(key, ...cmds) {
|
|
520
|
+
const commands = [];
|
|
521
|
+
for (let argIndex = 0; argIndex < cmds.length;) {
|
|
522
|
+
const currentArg = cmds[argIndex];
|
|
523
|
+
const command = {};
|
|
524
|
+
switch (currentArg) {
|
|
525
|
+
case 'get': {
|
|
526
|
+
if (argIndex + 2 >= cmds.length) {
|
|
527
|
+
throw Error(`bitfield command parse failed; not enough arguments for 'get' command`);
|
|
528
|
+
}
|
|
529
|
+
command.get = {
|
|
530
|
+
encoding: cmds[argIndex + 1],
|
|
531
|
+
offset: cmds[argIndex + 2].toString(),
|
|
532
|
+
};
|
|
533
|
+
argIndex += 3;
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
case 'set': {
|
|
537
|
+
if (argIndex + 3 >= cmds.length) {
|
|
538
|
+
throw Error(`bitfield command parse failed; not enough arguments for 'set' command`);
|
|
539
|
+
}
|
|
540
|
+
command.set = {
|
|
541
|
+
encoding: cmds[argIndex + 1],
|
|
542
|
+
offset: cmds[argIndex + 2].toString(),
|
|
543
|
+
value: cmds[argIndex + 3].toString(),
|
|
544
|
+
};
|
|
545
|
+
argIndex += 4;
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
case 'incrBy': {
|
|
549
|
+
if (argIndex + 3 >= cmds.length) {
|
|
550
|
+
throw Error(`bitfield command parse failed; not enough arguments for 'incrBy' command`);
|
|
551
|
+
}
|
|
552
|
+
command.incrBy = {
|
|
553
|
+
encoding: cmds[argIndex + 1],
|
|
554
|
+
offset: cmds[argIndex + 2].toString(),
|
|
555
|
+
increment: cmds[argIndex + 3].toString(),
|
|
556
|
+
};
|
|
557
|
+
argIndex += 4;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
case 'overflow': {
|
|
561
|
+
if (argIndex + 1 >= cmds.length) {
|
|
562
|
+
throw Error(`bitfield command parse failed; not enough arguments for 'overflow' command`);
|
|
563
|
+
}
|
|
564
|
+
const behavior = cmds[argIndex + 1].toString();
|
|
565
|
+
command.overflow = {
|
|
566
|
+
behavior: toBehaviorProto(behavior),
|
|
567
|
+
};
|
|
568
|
+
argIndex += 2;
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
default: {
|
|
572
|
+
throw Error(`bitfield command parse failed; ${currentArg} unrecognized (must be 'get', 'set', 'incrBy', or 'overflow')`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
commands.push(command);
|
|
576
|
+
}
|
|
577
|
+
const response = await __classPrivateFieldGet(this, _RedisClient_storage, "f").Bitfield({
|
|
578
|
+
key,
|
|
579
|
+
commands,
|
|
580
|
+
});
|
|
581
|
+
return response.results;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
_RedisClient_storage = new WeakMap(), _RedisClient_instances = new WeakSet(), _RedisClient_metadata_get = function _RedisClient_metadata_get() {
|
|
585
|
+
return getContext().debug.metadata;
|
|
586
|
+
};
|
|
587
|
+
function toBehaviorProto(behavior) {
|
|
588
|
+
const lowercase = behavior.toLowerCase();
|
|
589
|
+
switch (lowercase) {
|
|
590
|
+
case 'wrap':
|
|
591
|
+
return BitfieldOverflowBehavior.BITFIELD_OVERFLOW_BEHAVIOR_WRAP;
|
|
592
|
+
case 'sat':
|
|
593
|
+
return BitfieldOverflowBehavior.BITFIELD_OVERFLOW_BEHAVIOR_SAT;
|
|
594
|
+
case 'fail':
|
|
595
|
+
return BitfieldOverflowBehavior.BITFIELD_OVERFLOW_BEHAVIOR_FAIL;
|
|
596
|
+
default:
|
|
597
|
+
throw Error(`unknown bitfield overflow behavior: ${lowercase}`);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function isRedisNilError(e) {
|
|
601
|
+
// TODO: Replace with impl in a Gatsby-only world
|
|
602
|
+
//return e && e.details === 'redis: nil';
|
|
603
|
+
if (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string') {
|
|
604
|
+
return e.message.includes('redis: nil');
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function assertTxMetadataIsCurrent(metadata) {
|
|
611
|
+
const context = getContext();
|
|
612
|
+
if (context.debug.metadata !== metadata) {
|
|
613
|
+
throw new Error(`TxClient: Current metadata does not match what was used to start the transaction. Don't pass clients around between calls!`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisClient.test.d.ts","sourceRoot":"","sources":["../src/RedisClient.test.ts"],"names":[],"mappings":""}
|
package/getRedis.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRedis.d.ts","sourceRoot":"","sources":["../src/getRedis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGlF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,wBAAgB,QAAQ,CAAC,KAAK,GAAE,aAA0C,GAAG,WAAW,CAMvF"}
|
package/getRedis.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RedisAPIDefinition, RedisKeyScope } from '@devvit/protos';
|
|
2
|
+
import { getDevvitConfig } from '@devvit/server/get-devvit-config.js';
|
|
3
|
+
import { RedisClient } from './RedisClient.js';
|
|
4
|
+
let redisApiPlugin;
|
|
5
|
+
export function getRedis(scope = RedisKeyScope.INSTALLATION) {
|
|
6
|
+
if (!redisApiPlugin) {
|
|
7
|
+
redisApiPlugin = getDevvitConfig().use(RedisAPIDefinition);
|
|
8
|
+
}
|
|
9
|
+
return new RedisClient(redisApiPlugin, scope);
|
|
10
|
+
}
|
package/index.d.ts
ADDED
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
package/index.js
ADDED