@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.16
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 +111 -101
- package/app_meta.ts +56 -54
- package/config/config.ts +60 -57
- package/config/secrets.ts +45 -52
- package/config/value.ts +23 -26
- package/cron/mod.ts +28 -29
- package/dist/app_meta.d.ts +52 -50
- package/dist/app_meta.d.ts.map +1 -1
- package/dist/app_meta.js +2 -2
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +58 -55
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +8 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.d.ts +45 -52
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +8 -9
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +20 -23
- package/dist/config/value.d.ts.map +1 -1
- package/dist/config/value.js +20 -23
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +26 -27
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +13 -14
- package/dist/cron/mod.js.map +1 -1
- package/dist/frontends/mod.d.ts +20 -19
- package/dist/frontends/mod.d.ts.map +1 -1
- package/dist/frontends/mod.js +20 -19
- package/dist/frontends/mod.js.map +1 -1
- package/dist/gateway/errors.d.ts +28 -30
- package/dist/gateway/errors.d.ts.map +1 -1
- package/dist/gateway/errors.js +29 -31
- package/dist/gateway/errors.js.map +1 -1
- package/dist/gateway/match.d.ts +54 -54
- package/dist/gateway/match.d.ts.map +1 -1
- package/dist/gateway/match.js +56 -56
- package/dist/gateway/match.js.map +1 -1
- package/dist/gateway/middleware.d.ts +62 -64
- package/dist/gateway/middleware.d.ts.map +1 -1
- package/dist/gateway/middleware.js +1 -1
- package/dist/gateway/middleware.js.map +1 -1
- package/dist/gateway/mod.d.ts +64 -67
- package/dist/gateway/mod.d.ts.map +1 -1
- package/dist/gateway/mod.js +72 -76
- package/dist/gateway/mod.js.map +1 -1
- package/dist/gateway/request.d.ts +138 -134
- package/dist/gateway/request.d.ts.map +1 -1
- package/dist/gateway/request.js +117 -108
- package/dist/gateway/request.js.map +1 -1
- package/dist/gateway/serve.d.ts +29 -34
- package/dist/gateway/serve.d.ts.map +1 -1
- package/dist/gateway/serve.js +51 -56
- package/dist/gateway/serve.js.map +1 -1
- package/dist/gateways/mod.d.ts +23 -21
- package/dist/gateways/mod.d.ts.map +1 -1
- package/dist/gateways/mod.js +25 -23
- package/dist/gateways/mod.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +1 -1
- package/dist/internal/runtime/napi/napi.d.cts +10 -3
- package/dist/internal/runtime/shutdown.d.ts +75 -57
- package/dist/internal/runtime/shutdown.d.ts.map +1 -1
- package/dist/internal/runtime/shutdown.js +88 -84
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/log/logger.d.ts +43 -37
- package/dist/log/logger.d.ts.map +1 -1
- package/dist/log/logger.js +26 -25
- package/dist/log/logger.js.map +1 -1
- package/dist/metrics/mod.d.ts +133 -114
- package/dist/metrics/mod.d.ts.map +1 -1
- package/dist/metrics/mod.js +109 -101
- package/dist/metrics/mod.js.map +1 -1
- package/dist/otel.d.ts +6 -3
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +6 -3
- package/dist/otel.js.map +1 -1
- package/dist/pubsub/subscription.d.ts +88 -116
- package/dist/pubsub/subscription.d.ts.map +1 -1
- package/dist/pubsub/subscription.js +14 -17
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +86 -113
- package/dist/pubsub/topic.d.ts.map +1 -1
- package/dist/pubsub/topic.js +68 -82
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +83 -86
- package/dist/reqctx/mod.d.ts.map +1 -1
- package/dist/reqctx/mod.js +39 -41
- package/dist/reqctx/mod.js.map +1 -1
- package/dist/services/index.d.ts +76 -75
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +73 -71
- package/dist/services/index.js.map +1 -1
- package/dist/shutdown/mod.d.ts +26 -25
- package/dist/shutdown/mod.d.ts.map +1 -1
- package/dist/shutdown/mod.js +26 -25
- package/dist/shutdown/mod.js.map +1 -1
- package/dist/storage/clickhouse/database.d.ts +113 -115
- package/dist/storage/clickhouse/database.d.ts.map +1 -1
- package/dist/storage/clickhouse/database.js +65 -79
- package/dist/storage/clickhouse/database.js.map +1 -1
- package/dist/storage/clickhouse/errors.d.ts +25 -26
- package/dist/storage/clickhouse/errors.d.ts.map +1 -1
- package/dist/storage/clickhouse/errors.js +15 -17
- package/dist/storage/clickhouse/errors.js.map +1 -1
- package/dist/storage/clickhouse/mod.d.ts +10 -10
- package/dist/storage/clickhouse/mod.js +10 -10
- package/dist/storage/objects/bucket.d.ts +196 -225
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +71 -84
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/objects/error.d.ts +4 -4
- package/dist/storage/objects/error.js +4 -4
- package/dist/storage/postgres/database.d.ts +124 -149
- package/dist/storage/postgres/database.d.ts.map +1 -1
- package/dist/storage/postgres/database.js +98 -135
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/postgres/errors.d.ts +42 -48
- package/dist/storage/postgres/errors.d.ts.map +1 -1
- package/dist/storage/postgres/errors.js +44 -51
- package/dist/storage/postgres/errors.js.map +1 -1
- package/dist/storage/postgres/interval.d.ts +19 -19
- package/dist/storage/postgres/interval.d.ts.map +1 -1
- package/dist/storage/postgres/interval.js +21 -21
- package/dist/storage/postgres/interval.js.map +1 -1
- package/dist/storage/redis/bitfield.d.ts +48 -23
- package/dist/storage/redis/bitfield.d.ts.map +1 -1
- package/dist/storage/redis/bitfield.js +38 -19
- package/dist/storage/redis/bitfield.js.map +1 -1
- package/dist/storage/redis/command.d.ts +16 -12
- package/dist/storage/redis/command.d.ts.map +1 -1
- package/dist/storage/redis/command.js +16 -12
- package/dist/storage/redis/command.js.map +1 -1
- package/dist/storage/redis/commands.d.ts +99 -100
- package/dist/storage/redis/commands.d.ts.map +1 -1
- package/dist/storage/redis/commands.js +84 -85
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/storage/redis/database.d.ts +138 -122
- package/dist/storage/redis/database.d.ts.map +1 -1
- package/dist/storage/redis/database.js +120 -101
- package/dist/storage/redis/database.js.map +1 -1
- package/dist/storage/redis/mod.d.ts +52 -48
- package/dist/storage/redis/mod.d.ts.map +1 -1
- package/dist/storage/redis/mod.js +52 -48
- package/dist/storage/redis/mod.js.map +1 -1
- package/dist/storage/redis/options.d.ts +26 -24
- package/dist/storage/redis/options.d.ts.map +1 -1
- package/dist/storage/redis/options.js.map +1 -1
- package/dist/storage/redis/pubsub.d.ts +16 -16
- package/dist/storage/redis/pubsub.d.ts.map +1 -1
- package/dist/storage/redis/pubsub.js +14 -14
- package/dist/storage/redis/pubsub.js.map +1 -1
- package/dist/storage/redis/reply.d.ts +80 -72
- package/dist/storage/redis/reply.d.ts.map +1 -1
- package/dist/storage/redis/reply.js +53 -46
- package/dist/storage/redis/reply.js.map +1 -1
- package/dist/storage/redis/scan.d.ts +4 -4
- package/dist/storage/redis/scan.d.ts.map +1 -1
- package/dist/storage/redis/scan.js +6 -6
- package/dist/storage/redis/scan.js.map +1 -1
- package/dist/storage/redis/script.d.ts +28 -21
- package/dist/storage/redis/script.d.ts.map +1 -1
- package/dist/storage/redis/script.js +29 -22
- package/dist/storage/redis/script.js.map +1 -1
- package/dist/storage/redis/target.d.ts +17 -1
- package/dist/storage/redis/target.d.ts.map +1 -1
- package/dist/storage/redis/target.js +30 -1
- package/dist/storage/redis/target.js.map +1 -1
- package/dist/storage/redis/wire.d.ts +6 -6
- package/dist/storage/redis/wire.d.ts.map +1 -1
- package/dist/storage/redis/wire.js +6 -6
- package/dist/storage/redis/wire.js.map +1 -1
- package/dist/testing/mod.d.ts +83 -88
- package/dist/testing/mod.d.ts.map +1 -1
- package/dist/testing/mod.js +75 -81
- package/dist/testing/mod.js.map +1 -1
- package/dist/testing/playwright.d.ts +28 -32
- package/dist/testing/playwright.d.ts.map +1 -1
- package/dist/testing/playwright.js +22 -27
- package/dist/testing/playwright.js.map +1 -1
- package/dist/testing/puppeteer.d.ts +11 -12
- package/dist/testing/puppeteer.d.ts.map +1 -1
- package/dist/testing/puppeteer.js +17 -18
- package/dist/testing/puppeteer.js.map +1 -1
- package/dist/testing/system.d.ts +72 -90
- package/dist/testing/system.d.ts.map +1 -1
- package/dist/testing/system.js +90 -107
- package/dist/testing/system.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/frontends/mod.test.ts +6 -2
- package/frontends/mod.ts +20 -19
- package/gateway/errors.ts +30 -32
- package/gateway/match.ts +61 -57
- package/gateway/middleware.ts +62 -64
- package/gateway/mod.ts +73 -76
- package/gateway/request.ts +143 -140
- package/gateway/serve.ts +58 -63
- package/gateways/mod.ts +25 -23
- package/internal/runtime/napi/napi.cjs +1 -1
- package/internal/runtime/napi/napi.d.cts +10 -3
- package/internal/runtime/shutdown.ts +113 -101
- package/log/logger.test.ts +8 -0
- package/log/logger.ts +48 -45
- package/metrics/mod.ts +138 -122
- package/otel.ts +6 -3
- package/package.json +1 -1
- package/pubsub/subscription.ts +93 -123
- package/pubsub/topic.ts +96 -130
- package/reqctx/mod.ts +83 -86
- package/services/index.ts +78 -78
- package/shutdown/mod.ts +26 -25
- package/storage/clickhouse/database.ts +115 -129
- package/storage/clickhouse/errors.ts +27 -29
- package/storage/clickhouse/mod.ts +10 -10
- package/storage/objects/bucket.ts +209 -239
- package/storage/objects/error.ts +4 -4
- package/storage/postgres/database.ts +131 -164
- package/storage/postgres/errors.ts +45 -52
- package/storage/postgres/interval.ts +21 -21
- package/storage/redis/bitfield.ts +51 -26
- package/storage/redis/command.ts +16 -12
- package/storage/redis/commands.ts +99 -100
- package/storage/redis/database.ts +145 -123
- package/storage/redis/mod.ts +52 -48
- package/storage/redis/options.ts +26 -24
- package/storage/redis/pubsub.ts +14 -14
- package/storage/redis/redis.test.ts +17 -2
- package/storage/redis/reply.ts +85 -77
- package/storage/redis/scan.ts +6 -6
- package/storage/redis/script.ts +29 -22
- package/storage/redis/target.ts +34 -1
- package/storage/redis/wire.ts +8 -8
- package/testing/mod.ts +99 -105
- package/testing/playwright.ts +32 -37
- package/testing/puppeteer.ts +22 -23
- package/testing/system.ts +117 -133
|
@@ -44,7 +44,7 @@ import {subscribe, type Subscription} from './pubsub';
|
|
|
44
44
|
import type {Target} from './target';
|
|
45
45
|
import {Cmd, type Pairs, type RedisArg, type Value} from './wire';
|
|
46
46
|
|
|
47
|
-
/** A score bound: a number, `"-inf"
|
|
47
|
+
/** A sorted set score bound: a number, `"-inf"`, `"+inf"`, or an exclusive bound such as `"(1.5"`. */
|
|
48
48
|
export type ScoreBound = number | string;
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -190,56 +190,56 @@ const generic = {
|
|
|
190
190
|
* many existed.
|
|
191
191
|
*/
|
|
192
192
|
unlink: write((...keys: string[]) => cmd('UNLINK').keys(keys), as.number),
|
|
193
|
-
/**
|
|
193
|
+
/** Sets the key to expire after `seconds`. Returns `false` if the key does not exist. */
|
|
194
194
|
expire: write(
|
|
195
195
|
(key: string, seconds: number) => cmd('EXPIRE').key(key).arg(seconds),
|
|
196
196
|
as.bool,
|
|
197
197
|
),
|
|
198
|
-
/**
|
|
198
|
+
/** Sets the key to expire after `milliseconds`. Returns `false` if the key does not exist. */
|
|
199
199
|
pexpire: write(
|
|
200
200
|
(key: string, milliseconds: number) =>
|
|
201
201
|
cmd('PEXPIRE').key(key).arg(milliseconds),
|
|
202
202
|
as.bool,
|
|
203
203
|
),
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
206
|
-
* exist.
|
|
205
|
+
* Sets the key to expire at the given Unix timestamp in seconds. Returns
|
|
206
|
+
* `false` if the key does not exist.
|
|
207
207
|
*/
|
|
208
208
|
expireAt: write(
|
|
209
209
|
(key: string, timestamp: number) => cmd('EXPIREAT').key(key).arg(timestamp),
|
|
210
210
|
as.bool,
|
|
211
211
|
),
|
|
212
|
-
/** Removes the key's
|
|
212
|
+
/** Removes the key's expiration. Returns `false` if it had none or does not exist. */
|
|
213
213
|
persist: write((key: string) => cmd('PERSIST').key(key), as.bool),
|
|
214
214
|
/** Renames the key, replacing `newKey` if it exists. */
|
|
215
215
|
rename: write(
|
|
216
216
|
(key: string, newKey: string) => cmd('RENAME').key(key).key(newKey),
|
|
217
217
|
as.none,
|
|
218
218
|
),
|
|
219
|
-
/** Renames the key
|
|
219
|
+
/** Renames the key only if `newKey` does not exist. Returns `false` if `newKey` already exists. */
|
|
220
220
|
renameNx: write(
|
|
221
221
|
(key: string, newKey: string) => cmd('RENAMENX').key(key).key(newKey),
|
|
222
222
|
as.bool,
|
|
223
223
|
),
|
|
224
224
|
/**
|
|
225
|
-
* Copies the value at `source` to `destination`. `false` if
|
|
226
|
-
* exists.
|
|
225
|
+
* Copies the value at `source` to `destination`. Returns `false` if
|
|
226
|
+
* `destination` already exists.
|
|
227
227
|
*/
|
|
228
228
|
copy: write(
|
|
229
229
|
(source: string, destination: string) =>
|
|
230
230
|
cmd('COPY').key(source).key(destination),
|
|
231
231
|
as.bool,
|
|
232
232
|
),
|
|
233
|
-
/**
|
|
233
|
+
/** Updates the last-access time of the keys and returns how many exist. */
|
|
234
234
|
touch: write((...keys: string[]) => cmd('TOUCH').keys(keys), as.number),
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
const string = {
|
|
238
|
-
/**
|
|
238
|
+
/** Returns the value at the key, or nil if it does not exist. */
|
|
239
239
|
get: read((key: string) => cmd('GET').key(key), as.reply),
|
|
240
240
|
/**
|
|
241
|
-
*
|
|
242
|
-
* {@link Reply.optionalTexts}.
|
|
241
|
+
* Returns the values for the keys in order, with missing keys as nil.
|
|
242
|
+
* Decode with {@link Reply.optionalTexts}.
|
|
243
243
|
*/
|
|
244
244
|
mget: read((...keys: string[]) => cmd('MGET').keys(keys), as.reply),
|
|
245
245
|
/** The length of the value at the key, in bytes. */
|
|
@@ -265,14 +265,14 @@ const string = {
|
|
|
265
265
|
cmd('SETEX').key(key).arg(seconds).arg(value),
|
|
266
266
|
as.none,
|
|
267
267
|
),
|
|
268
|
-
/** Sets the key to the value
|
|
268
|
+
/** Sets the key to the value only if it does not exist. Returns `false` if it already exists. */
|
|
269
269
|
setNx: write(
|
|
270
270
|
(key: string, value: RedisArg) => cmd('SETNX').key(key).arg(value),
|
|
271
271
|
as.bool,
|
|
272
272
|
),
|
|
273
273
|
/**
|
|
274
|
-
* Sets the key to the value
|
|
275
|
-
*
|
|
274
|
+
* Sets the key to the value using `options` (existence condition,
|
|
275
|
+
* expiration, and optionally returning the previous value).
|
|
276
276
|
*/
|
|
277
277
|
setOptions: write(
|
|
278
278
|
(key: string, value: RedisArg, options: SetOptions) =>
|
|
@@ -282,16 +282,16 @@ const string = {
|
|
|
282
282
|
/** Sets each key to its value, all at once. */
|
|
283
283
|
mset: write((items: Pairs<RedisArg>) => cmd('MSET').pairs(items), as.none),
|
|
284
284
|
/**
|
|
285
|
-
* Sets each key to its value
|
|
286
|
-
*
|
|
285
|
+
* Sets each key to its value only if none of the keys exist. Returns `false`
|
|
286
|
+
* if any key already exists, leaving all keys unchanged.
|
|
287
287
|
*/
|
|
288
288
|
msetNx: write(
|
|
289
289
|
(items: Pairs<RedisArg>) => cmd('MSETNX').pairs(items),
|
|
290
290
|
as.bool,
|
|
291
291
|
),
|
|
292
|
-
/**
|
|
292
|
+
/** Returns the value at the key and deletes the key. */
|
|
293
293
|
getDel: write((key: string) => cmd('GETDEL').key(key), as.reply),
|
|
294
|
-
/**
|
|
294
|
+
/** Returns the value at the key and updates its expiration according to `expiry`. */
|
|
295
295
|
getEx: write(
|
|
296
296
|
(key: string, expiry: Expiry) =>
|
|
297
297
|
cmd('GETEX').key(key).argsOf(expiryArgs(expiry)),
|
|
@@ -351,7 +351,7 @@ const bitmap = {
|
|
|
351
351
|
as.number,
|
|
352
352
|
),
|
|
353
353
|
|
|
354
|
-
/** Sets the bit at `offset
|
|
354
|
+
/** Sets the bit at `offset` and returns its previous value. */
|
|
355
355
|
setbit: write(
|
|
356
356
|
(key: string, offset: number, value: boolean) =>
|
|
357
357
|
cmd('SETBIT').key(key).arg(offset).arg(bitArg(value)),
|
|
@@ -394,15 +394,15 @@ const bitmap = {
|
|
|
394
394
|
as.number,
|
|
395
395
|
),
|
|
396
396
|
/**
|
|
397
|
-
*
|
|
398
|
-
* the string
|
|
397
|
+
* Reads and writes arbitrary-width integers (up to 64 bits) at any bit
|
|
398
|
+
* offset in the string. Chain operations, then call {@link Bitfield.invoke}.
|
|
399
399
|
*/
|
|
400
400
|
bitfield: writeBuilder(
|
|
401
401
|
(key: string) => cmd('BITFIELD').key(key),
|
|
402
402
|
(t, c) => new Bitfield(t, c),
|
|
403
403
|
(queue, c) => new QueuedBitfield(queue, c),
|
|
404
404
|
),
|
|
405
|
-
/** {@link Bitfield}
|
|
405
|
+
/** Read-only variant of {@link Bitfield} (`BITFIELD_RO`). */
|
|
406
406
|
bitfieldRo: readBuilder(
|
|
407
407
|
(key: string) => cmd('BITFIELD_RO').key(key),
|
|
408
408
|
(t, c) => new BitfieldRo(t, c),
|
|
@@ -417,8 +417,8 @@ const hash = {
|
|
|
417
417
|
as.reply,
|
|
418
418
|
),
|
|
419
419
|
/**
|
|
420
|
-
*
|
|
421
|
-
* {@link Reply.optionalTexts}.
|
|
420
|
+
* Returns the values of the fields in order, with missing fields as nil.
|
|
421
|
+
* Decode with {@link Reply.optionalTexts}.
|
|
422
422
|
*/
|
|
423
423
|
hmget: read(
|
|
424
424
|
(key: string, ...fields: RedisArg[]) =>
|
|
@@ -456,7 +456,7 @@ const hash = {
|
|
|
456
456
|
(key: string, items: Pairs<RedisArg>) => cmd('HSET').key(key).fields(items),
|
|
457
457
|
as.number,
|
|
458
458
|
),
|
|
459
|
-
/** Sets a field
|
|
459
|
+
/** Sets a field only if it does not exist. Returns `false` if it already exists. */
|
|
460
460
|
hsetNx: write(
|
|
461
461
|
(key: string, field: RedisArg, value: RedisArg) =>
|
|
462
462
|
cmd('HSETNX').key(key).arg(field).arg(value),
|
|
@@ -529,8 +529,8 @@ const list = {
|
|
|
529
529
|
as.number,
|
|
530
530
|
),
|
|
531
531
|
/**
|
|
532
|
-
* Removes and returns the first element, or
|
|
533
|
-
*
|
|
532
|
+
* Removes and returns the first element, or up to `count` elements as an
|
|
533
|
+
* array when `count` is specified.
|
|
534
534
|
*/
|
|
535
535
|
lpop: write(
|
|
536
536
|
(key: string, count?: number) =>
|
|
@@ -540,8 +540,8 @@ const list = {
|
|
|
540
540
|
as.reply,
|
|
541
541
|
),
|
|
542
542
|
/**
|
|
543
|
-
* Removes and returns the last element, or
|
|
544
|
-
*
|
|
543
|
+
* Removes and returns the last element, or up to `count` elements as an
|
|
544
|
+
* array when `count` is specified.
|
|
545
545
|
*/
|
|
546
546
|
rpop: write(
|
|
547
547
|
(key: string, count?: number) =>
|
|
@@ -581,8 +581,9 @@ const list = {
|
|
|
581
581
|
as.number,
|
|
582
582
|
),
|
|
583
583
|
/**
|
|
584
|
-
* Removes elements equal to `value`: the first `count`
|
|
585
|
-
* `-count`
|
|
584
|
+
* Removes elements equal to `value`: the first `count` matches when positive,
|
|
585
|
+
* the last `-count` matches when negative, or all matches when 0. Returns the
|
|
586
|
+
* number of removed elements.
|
|
586
587
|
*/
|
|
587
588
|
lrem: write(
|
|
588
589
|
(key: string, count: number, value: RedisArg) =>
|
|
@@ -604,24 +605,24 @@ const list = {
|
|
|
604
605
|
),
|
|
605
606
|
|
|
606
607
|
/**
|
|
607
|
-
* Removes and returns the first element
|
|
608
|
-
*
|
|
609
|
-
*
|
|
608
|
+
* Removes and returns the first element (along with its key) from the first
|
|
609
|
+
* non-empty list in `keys`, waiting up to `timeout` seconds (`0` waits
|
|
610
|
+
* forever). Returns `null` on timeout.
|
|
610
611
|
*/
|
|
611
612
|
blpop: writeBlocking(
|
|
612
613
|
(keys: string | string[], timeout: number) =>
|
|
613
614
|
cmd('BLPOP').keys(keyList(keys)).arg(timeout),
|
|
614
615
|
as.popped,
|
|
615
616
|
),
|
|
616
|
-
/** `blpop`, from the
|
|
617
|
+
/** Like `blpop`, but pops from the tail of the list. */
|
|
617
618
|
brpop: writeBlocking(
|
|
618
619
|
(keys: string | string[], timeout: number) =>
|
|
619
620
|
cmd('BRPOP').keys(keyList(keys)).arg(timeout),
|
|
620
621
|
as.popped,
|
|
621
622
|
),
|
|
622
623
|
/**
|
|
623
|
-
* `lmove`, waiting up to `timeout` seconds for `source`
|
|
624
|
-
*
|
|
624
|
+
* Like `lmove`, waiting up to `timeout` seconds for `source` to have an
|
|
625
|
+
* element (`0` waits forever). Returns nil on timeout.
|
|
625
626
|
*/
|
|
626
627
|
blmove: writeBlocking(
|
|
627
628
|
(
|
|
@@ -640,9 +641,9 @@ const list = {
|
|
|
640
641
|
as.reply,
|
|
641
642
|
),
|
|
642
643
|
/**
|
|
643
|
-
* Removes and returns up to `count` elements
|
|
644
|
-
*
|
|
645
|
-
*
|
|
644
|
+
* Removes and returns up to `count` elements (along with their key) from the
|
|
645
|
+
* first non-empty list in `keys`, waiting up to `timeout` seconds (`0` waits
|
|
646
|
+
* forever). Returns `null` on timeout.
|
|
646
647
|
*/
|
|
647
648
|
blmpop: writeBlocking(
|
|
648
649
|
(keys: string[], from: Direction, count: number, timeout: number) =>
|
|
@@ -746,7 +747,7 @@ const sortedSet = {
|
|
|
746
747
|
as.reply,
|
|
747
748
|
),
|
|
748
749
|
/**
|
|
749
|
-
* `zrange`, each member
|
|
750
|
+
* Like `zrange`, including each member's score. Decode with
|
|
750
751
|
* {@link Reply.scoredMembers}.
|
|
751
752
|
*/
|
|
752
753
|
zrangeWithscores: read(
|
|
@@ -761,7 +762,7 @@ const sortedSet = {
|
|
|
761
762
|
as.reply,
|
|
762
763
|
),
|
|
763
764
|
/**
|
|
764
|
-
* `zrevrange`, each member
|
|
765
|
+
* Like `zrevrange`, including each member's score. Decode with
|
|
765
766
|
* {@link Reply.scoredMembers}.
|
|
766
767
|
*/
|
|
767
768
|
zrevrangeWithscores: read(
|
|
@@ -776,7 +777,7 @@ const sortedSet = {
|
|
|
776
777
|
as.reply,
|
|
777
778
|
),
|
|
778
779
|
/**
|
|
779
|
-
* `zrangebyscore`, each member
|
|
780
|
+
* Like `zrangebyscore`, including each member's score. Decode with
|
|
780
781
|
* {@link Reply.scoredMembers}.
|
|
781
782
|
*/
|
|
782
783
|
zrangebyscoreWithscores: read(
|
|
@@ -897,26 +898,26 @@ const sortedSet = {
|
|
|
897
898
|
),
|
|
898
899
|
|
|
899
900
|
/**
|
|
900
|
-
* Removes and returns the lowest
|
|
901
|
-
*
|
|
902
|
-
*
|
|
901
|
+
* Removes and returns the lowest-scoring member (along with its key and
|
|
902
|
+
* score) from the first non-empty sorted set in `keys`, waiting up to
|
|
903
|
+
* `timeout` seconds (`0` waits forever). Returns `null` on timeout.
|
|
903
904
|
*/
|
|
904
905
|
bzpopmin: writeBlocking(
|
|
905
906
|
(keys: string | string[], timeout: number) =>
|
|
906
907
|
cmd('BZPOPMIN').keys(keyList(keys)).arg(timeout),
|
|
907
908
|
as.poppedScored,
|
|
908
909
|
),
|
|
909
|
-
/** `bzpopmin`, the highest
|
|
910
|
+
/** Like `bzpopmin`, but pops the highest-scoring member. */
|
|
910
911
|
bzpopmax: writeBlocking(
|
|
911
912
|
(keys: string | string[], timeout: number) =>
|
|
912
913
|
cmd('BZPOPMAX').keys(keyList(keys)).arg(timeout),
|
|
913
914
|
as.poppedScored,
|
|
914
915
|
),
|
|
915
916
|
/**
|
|
916
|
-
* Removes and returns up to `count`
|
|
917
|
-
* (`'max'`)
|
|
918
|
-
*
|
|
919
|
-
*
|
|
917
|
+
* Removes and returns up to `count` lowest-scoring (`'min'`) or
|
|
918
|
+
* highest-scoring (`'max'`) members (along with their key and scores) from
|
|
919
|
+
* the first non-empty sorted set in `keys`, waiting up to `timeout` seconds
|
|
920
|
+
* (`0` waits forever). Returns `null` on timeout.
|
|
920
921
|
*/
|
|
921
922
|
bzmpop: writeBlocking(
|
|
922
923
|
(keys: string[], which: 'min' | 'max', count: number, timeout: number) =>
|
|
@@ -932,8 +933,8 @@ const sortedSet = {
|
|
|
932
933
|
|
|
933
934
|
const geo = {
|
|
934
935
|
/**
|
|
935
|
-
*
|
|
936
|
-
* {@link Reply.geoPositions}.
|
|
936
|
+
* Returns the positions of the members, with missing members as nil. Decode
|
|
937
|
+
* with {@link Reply.geoPositions}.
|
|
937
938
|
*/
|
|
938
939
|
geoPos: read(
|
|
939
940
|
(key: string, ...members: RedisArg[]) =>
|
|
@@ -1035,9 +1036,8 @@ const stream = {
|
|
|
1035
1036
|
/** How many entries the stream has. */
|
|
1036
1037
|
xlen: read((key: string) => cmd('XLEN').key(key), as.number),
|
|
1037
1038
|
/**
|
|
1038
|
-
*
|
|
1039
|
-
*
|
|
1040
|
-
* {@link Reply.streams}.
|
|
1039
|
+
* Reads entries after the given IDs across `keys` (`ids` corresponds to
|
|
1040
|
+
* `keys` in order) without blocking. Decode with {@link Reply.streams}.
|
|
1041
1041
|
*/
|
|
1042
1042
|
xread: read(
|
|
1043
1043
|
(keys: string[], ids: string[]) =>
|
|
@@ -1045,16 +1045,15 @@ const stream = {
|
|
|
1045
1045
|
as.reply,
|
|
1046
1046
|
),
|
|
1047
1047
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1048
|
+
* Returns a summary of pending (unacknowledged) entries for a consumer
|
|
1049
|
+
* group. Decode with {@link Reply.streamPending}.
|
|
1050
1050
|
*/
|
|
1051
1051
|
xpending: read(
|
|
1052
1052
|
(key: string, group: string) => cmd('XPENDING').key(key).arg(group),
|
|
1053
1053
|
as.reply,
|
|
1054
1054
|
),
|
|
1055
1055
|
/**
|
|
1056
|
-
*
|
|
1057
|
-
* {@link Reply.streamInfo}.
|
|
1056
|
+
* Returns metadata about the stream. Decode with {@link Reply.streamInfo}.
|
|
1058
1057
|
*/
|
|
1059
1058
|
xinfoStream: read(
|
|
1060
1059
|
(key: string) => cmd('XINFO').arg('STREAM').key(key),
|
|
@@ -1062,15 +1061,15 @@ const stream = {
|
|
|
1062
1061
|
),
|
|
1063
1062
|
|
|
1064
1063
|
/**
|
|
1065
|
-
* Appends an entry with the given fields
|
|
1066
|
-
* the
|
|
1064
|
+
* Appends an entry with the given fields and returns its ID. Pass `"*"` as
|
|
1065
|
+
* the ID to let Redis generate one.
|
|
1067
1066
|
*/
|
|
1068
1067
|
xadd: write(
|
|
1069
1068
|
(key: string, id: string, fields: Pairs<RedisArg>) =>
|
|
1070
1069
|
cmd('XADD').key(key).arg(id).fields(fields),
|
|
1071
1070
|
as.reply,
|
|
1072
1071
|
),
|
|
1073
|
-
/** `xadd`, trimming the stream to a maximum length. */
|
|
1072
|
+
/** Like `xadd`, while trimming the stream to a maximum length. */
|
|
1074
1073
|
xaddMaxlen: write(
|
|
1075
1074
|
(key: string, maxlen: StreamMaxlen, id: string, fields: Pairs<RedisArg>) =>
|
|
1076
1075
|
cmd('XADD').key(key).argsOf(maxlenArgs(maxlen)).arg(id).fields(fields),
|
|
@@ -1099,23 +1098,23 @@ const stream = {
|
|
|
1099
1098
|
cmd('XGROUP').arg('CREATE').key(key).arg(group).arg(id),
|
|
1100
1099
|
as.none,
|
|
1101
1100
|
),
|
|
1102
|
-
/** `xgroupCreate`, creating the stream if it does not exist. */
|
|
1101
|
+
/** Like `xgroupCreate`, creating the stream if it does not already exist. */
|
|
1103
1102
|
xgroupCreateMkstream: write(
|
|
1104
1103
|
(key: string, group: string, id: string) =>
|
|
1105
1104
|
cmd('XGROUP').arg('CREATE').key(key).arg(group).arg(id).arg('MKSTREAM'),
|
|
1106
1105
|
as.none,
|
|
1107
1106
|
),
|
|
1108
|
-
/** Deletes a consumer group. `false` if
|
|
1107
|
+
/** Deletes a consumer group. Returns `false` if the group did not exist. */
|
|
1109
1108
|
xgroupDestroy: write(
|
|
1110
1109
|
(key: string, group: string) =>
|
|
1111
1110
|
cmd('XGROUP').arg('DESTROY').key(key).arg(group),
|
|
1112
1111
|
as.bool,
|
|
1113
1112
|
),
|
|
1114
1113
|
/**
|
|
1115
|
-
* Reads entries as `consumer`
|
|
1116
|
-
*
|
|
1117
|
-
* stream.
|
|
1118
|
-
* {@link Reply.streams}.
|
|
1114
|
+
* Reads entries as `consumer` in a consumer group (pass `">"` as the ID to
|
|
1115
|
+
* read undelivered entries). When `count` is provided, reads at most `count`
|
|
1116
|
+
* entries per stream. Treated as a write because Redis records delivery to
|
|
1117
|
+
* the consumer. Decode with {@link Reply.streams}.
|
|
1119
1118
|
*/
|
|
1120
1119
|
xreadGroup: write(
|
|
1121
1120
|
(
|
|
@@ -1136,8 +1135,8 @@ const stream = {
|
|
|
1136
1135
|
as.reply,
|
|
1137
1136
|
),
|
|
1138
1137
|
/**
|
|
1139
|
-
* Acknowledges entries a consumer group
|
|
1140
|
-
* pending.
|
|
1138
|
+
* Acknowledges entries delivered to a consumer group and returns how many
|
|
1139
|
+
* were pending.
|
|
1141
1140
|
*/
|
|
1142
1141
|
xack: write(
|
|
1143
1142
|
(key: string, group: string, ...ids: string[]) =>
|
|
@@ -1145,8 +1144,8 @@ const stream = {
|
|
|
1145
1144
|
as.number,
|
|
1146
1145
|
),
|
|
1147
1146
|
/**
|
|
1148
|
-
*
|
|
1149
|
-
* `consumer
|
|
1147
|
+
* Claims pending entries that have been idle for at least `minIdleMs` for
|
|
1148
|
+
* `consumer`. Decode with {@link Reply.streamEntries}.
|
|
1150
1149
|
*/
|
|
1151
1150
|
xclaim: write(
|
|
1152
1151
|
(
|
|
@@ -1165,8 +1164,9 @@ const stream = {
|
|
|
1165
1164
|
as.reply,
|
|
1166
1165
|
),
|
|
1167
1166
|
/**
|
|
1168
|
-
*
|
|
1169
|
-
* `minIdleMs
|
|
1167
|
+
* Claims pending entries starting from `start` that have been idle for at
|
|
1168
|
+
* least `minIdleMs` for `consumer`. Decode with
|
|
1169
|
+
* {@link Reply.streamAutoClaim}.
|
|
1170
1170
|
*/
|
|
1171
1171
|
xautoclaim: write(
|
|
1172
1172
|
(
|
|
@@ -1186,9 +1186,9 @@ const stream = {
|
|
|
1186
1186
|
),
|
|
1187
1187
|
|
|
1188
1188
|
/**
|
|
1189
|
-
* `xread`, waiting up to `blockMs` milliseconds
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1189
|
+
* Like `xread`, waiting up to `blockMs` milliseconds if no entries are
|
|
1190
|
+
* immediately available (`0` waits forever). When `count` is provided, reads
|
|
1191
|
+
* at most `count` entries per stream. Returns nil on timeout.
|
|
1192
1192
|
*/
|
|
1193
1193
|
xreadBlock: readBlocking(
|
|
1194
1194
|
(keys: string[], ids: string[], blockMs: number, count?: number) =>
|
|
@@ -1202,9 +1202,8 @@ const stream = {
|
|
|
1202
1202
|
as.reply,
|
|
1203
1203
|
),
|
|
1204
1204
|
/**
|
|
1205
|
-
* `xreadGroup`, waiting up to `blockMs` milliseconds
|
|
1206
|
-
*
|
|
1207
|
-
* wait passes.
|
|
1205
|
+
* Like `xreadGroup`, waiting up to `blockMs` milliseconds if no entries are
|
|
1206
|
+
* immediately available (`0` waits forever). Returns nil on timeout.
|
|
1208
1207
|
*/
|
|
1209
1208
|
xreadGroupBlock: writeBlocking(
|
|
1210
1209
|
(
|
|
@@ -1251,14 +1250,14 @@ const hyperloglog = {
|
|
|
1251
1250
|
};
|
|
1252
1251
|
|
|
1253
1252
|
const pubsub = {
|
|
1254
|
-
/** Subscribes to one or more channels
|
|
1253
|
+
/** Subscribes to one or more channels on a dedicated connection. */
|
|
1255
1254
|
subscribe: readRun(
|
|
1256
1255
|
(t: Target, ...channels: string[]): Promise<Subscription> =>
|
|
1257
1256
|
subscribe(t, channels, []),
|
|
1258
1257
|
),
|
|
1259
1258
|
/**
|
|
1260
|
-
* Subscribes to
|
|
1261
|
-
* connection
|
|
1259
|
+
* Subscribes to channels matching one or more glob-style patterns on a
|
|
1260
|
+
* dedicated connection.
|
|
1262
1261
|
*/
|
|
1263
1262
|
psubscribe: readRun(
|
|
1264
1263
|
(t: Target, ...patterns: string[]): Promise<Subscription> =>
|
|
@@ -1304,10 +1303,10 @@ type RunForm<D> =
|
|
|
1304
1303
|
? (...args: A) => R
|
|
1305
1304
|
: never;
|
|
1306
1305
|
|
|
1307
|
-
/**
|
|
1306
|
+
/** Immediate-execution methods for a command group. */
|
|
1308
1307
|
export type Commands<G> = {readonly [K in keyof G]: RunForm<G[K]>};
|
|
1309
1308
|
|
|
1310
|
-
/**
|
|
1309
|
+
/** Read-only immediate-execution methods for a command group. */
|
|
1311
1310
|
export type ReadCommands<G> = {
|
|
1312
1311
|
readonly [K in keyof G as G[K] extends {write: false} ? K : never]: RunForm<
|
|
1313
1312
|
G[K]
|
|
@@ -1315,8 +1314,8 @@ export type ReadCommands<G> = {
|
|
|
1315
1314
|
};
|
|
1316
1315
|
|
|
1317
1316
|
/**
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1317
|
+
* Queued methods for a command group on a pipeline or transaction. Replies
|
|
1318
|
+
* are returned by `exec()` in the order queued.
|
|
1320
1319
|
*/
|
|
1321
1320
|
export type Queue<G> = {
|
|
1322
1321
|
readonly [
|
|
@@ -1331,38 +1330,38 @@ export type Queue<G> = {
|
|
|
1331
1330
|
: never;
|
|
1332
1331
|
};
|
|
1333
1332
|
|
|
1334
|
-
/** Commands that
|
|
1333
|
+
/** Commands that operate on keys of any type (expiration, deletion, renaming). */
|
|
1335
1334
|
export type GenericCommands = Commands<Groups['generic']>;
|
|
1336
|
-
/** Commands on
|
|
1335
|
+
/** Commands on Redis string values. */
|
|
1337
1336
|
export type StringCommands = Commands<Groups['string']>;
|
|
1338
|
-
/**
|
|
1337
|
+
/** Bit-level commands on Redis string values. */
|
|
1339
1338
|
export type BitmapCommands = Commands<Groups['bitmap']>;
|
|
1340
|
-
/** Commands on hashes
|
|
1339
|
+
/** Commands on Redis hashes (field-value maps). */
|
|
1341
1340
|
export type HashCommands = Commands<Groups['hash']>;
|
|
1342
1341
|
/** Commands on lists. */
|
|
1343
1342
|
export type ListCommands = Commands<Groups['list']>;
|
|
1344
1343
|
/** Commands on sets. */
|
|
1345
1344
|
export type SetCommands = Commands<Groups['set']>;
|
|
1346
|
-
/** Commands on sorted sets
|
|
1345
|
+
/** Commands on Redis sorted sets (members ordered by score). */
|
|
1347
1346
|
export type SortedSetCommands = Commands<Groups['sortedSet']>;
|
|
1348
1347
|
/** Commands on geospatial indexes. */
|
|
1349
1348
|
export type GeoCommands = Commands<Groups['geo']>;
|
|
1350
1349
|
/** Commands on streams. */
|
|
1351
1350
|
export type StreamCommands = Commands<Groups['stream']>;
|
|
1352
|
-
/** Commands on HyperLogLogs
|
|
1351
|
+
/** Commands on Redis HyperLogLogs (approximate cardinality counters). */
|
|
1353
1352
|
export type HyperLogLogCommands = Commands<Groups['hyperloglog']>;
|
|
1354
|
-
/**
|
|
1353
|
+
/** Commands for Redis pub/sub channels. */
|
|
1355
1354
|
export type PubsubCommands = Commands<Groups['pubsub']>;
|
|
1356
1355
|
|
|
1357
|
-
/**
|
|
1356
|
+
/** Command groups available on a database, read-write handle, and connection. */
|
|
1358
1357
|
export type CommandGroups = {
|
|
1359
1358
|
readonly [G in keyof Groups]: Commands<Groups[G]>;
|
|
1360
1359
|
};
|
|
1361
|
-
/**
|
|
1360
|
+
/** Read-only command groups available on a read-only database handle. */
|
|
1362
1361
|
export type ReadCommandGroups = {
|
|
1363
1362
|
readonly [G in keyof Groups]: ReadCommands<Groups[G]>;
|
|
1364
1363
|
};
|
|
1365
|
-
/**
|
|
1364
|
+
/** Queued command groups available on a pipeline or transaction. */
|
|
1366
1365
|
export type QueueGroups = {readonly [G in keyof Groups]: Queue<Groups[G]>};
|
|
1367
1366
|
|
|
1368
1367
|
/** `setEx` as a trace names it, after the Rust SDK: `set_ex`. */
|