@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
|
@@ -2,94 +2,95 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Value } from './wire.js';
|
|
4
4
|
/**
|
|
5
|
-
* A reply
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* A Redis reply decoded into plain JavaScript values, as returned by
|
|
6
|
+
* {@link Reply.value}. Strings decode to UTF-8 text, integers decode to
|
|
7
|
+
* `number` (or `bigint` when outside the safe integer range), and maps decode
|
|
8
|
+
* to prototype-less objects keyed by their string keys.
|
|
8
9
|
*/
|
|
9
10
|
export type RedisValue = null | string | number | bigint | boolean | RedisValue[] | {
|
|
10
11
|
[key: string]: RedisValue;
|
|
11
12
|
};
|
|
12
|
-
/** A
|
|
13
|
+
/** A sorted set member along with its score. */
|
|
13
14
|
export interface ScoredMember {
|
|
14
15
|
member: string;
|
|
15
16
|
score: number;
|
|
16
17
|
}
|
|
17
|
-
/** A field
|
|
18
|
+
/** A hash field along with its value. */
|
|
18
19
|
export interface FieldValue {
|
|
19
20
|
field: string;
|
|
20
21
|
value: string;
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
+
/** A stream entry containing its ID and field-value pairs. */
|
|
23
24
|
export interface StreamEntry {
|
|
24
25
|
id: string;
|
|
25
26
|
fields: Record<string, string>;
|
|
26
27
|
}
|
|
27
|
-
/**
|
|
28
|
+
/** Entries read from a single stream. */
|
|
28
29
|
export interface Stream {
|
|
29
30
|
key: string;
|
|
30
31
|
entries: StreamEntry[];
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
34
|
+
* Summary of pending (unacknowledged) entries for a consumer group, as
|
|
35
|
+
* returned by `xpending`.
|
|
35
36
|
*/
|
|
36
37
|
export interface StreamPending {
|
|
37
|
-
/**
|
|
38
|
+
/** Number of pending entries. */
|
|
38
39
|
count: number;
|
|
39
|
-
/**
|
|
40
|
+
/** Lowest pending entry ID, or `null` if no entries are pending. */
|
|
40
41
|
lowest: string | null;
|
|
41
|
-
/**
|
|
42
|
+
/** Highest pending entry ID, or `null` if no entries are pending. */
|
|
42
43
|
highest: string | null;
|
|
43
|
-
/**
|
|
44
|
+
/** Consumers with pending entries and the pending count for each. */
|
|
44
45
|
consumers: {
|
|
45
46
|
name: string;
|
|
46
47
|
pending: number;
|
|
47
48
|
}[];
|
|
48
49
|
}
|
|
49
|
-
/**
|
|
50
|
+
/** Metadata about a stream, as returned by `xinfoStream`. */
|
|
50
51
|
export interface StreamInfo {
|
|
51
52
|
length: number;
|
|
52
53
|
radixTreeKeys: number;
|
|
53
54
|
radixTreeNodes: number;
|
|
54
55
|
groups: number;
|
|
55
56
|
lastGeneratedId: string;
|
|
56
|
-
/** `null`
|
|
57
|
+
/** The first entry in the stream, or `null` if the stream is empty. */
|
|
57
58
|
firstEntry: StreamEntry | null;
|
|
58
|
-
/** `null`
|
|
59
|
+
/** The last entry in the stream, or `null` if the stream is empty. */
|
|
59
60
|
lastEntry: StreamEntry | null;
|
|
60
61
|
}
|
|
61
|
-
/**
|
|
62
|
+
/** Result of an `xautoclaim` command. */
|
|
62
63
|
export interface StreamAutoClaim {
|
|
63
64
|
/**
|
|
64
|
-
* The
|
|
65
|
-
* pending entries is
|
|
65
|
+
* The cursor ID to pass as the starting point for the next call, or `"0-0"`
|
|
66
|
+
* when the pending entries scan is complete.
|
|
66
67
|
*/
|
|
67
68
|
next: string;
|
|
68
|
-
/** The entries
|
|
69
|
+
/** The entries successfully claimed by the consumer. */
|
|
69
70
|
claimed: StreamEntry[];
|
|
70
|
-
/**
|
|
71
|
+
/** IDs of pending entries that no longer exist in the stream. */
|
|
71
72
|
deleted: string[];
|
|
72
73
|
}
|
|
73
74
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
75
|
+
* Result of a blocking pop of a single element: the source key (with the
|
|
76
|
+
* database's prefix stripped) and the popped element.
|
|
76
77
|
*/
|
|
77
78
|
export interface Popped {
|
|
78
79
|
key: string;
|
|
79
80
|
value: Reply;
|
|
80
81
|
}
|
|
81
|
-
/**
|
|
82
|
+
/** Result of a blocking pop of multiple elements, in the order they were popped. */
|
|
82
83
|
export interface PoppedMany {
|
|
83
84
|
key: string;
|
|
84
85
|
values: Reply[];
|
|
85
86
|
}
|
|
86
|
-
/**
|
|
87
|
+
/** Result of a blocking pop of a single sorted set member. */
|
|
87
88
|
export interface PoppedScored {
|
|
88
89
|
key: string;
|
|
89
90
|
member: Reply;
|
|
90
91
|
score: number;
|
|
91
92
|
}
|
|
92
|
-
/**
|
|
93
|
+
/** Result of a blocking pop of multiple sorted set members. */
|
|
93
94
|
export interface PoppedScoredMany {
|
|
94
95
|
key: string;
|
|
95
96
|
members: {
|
|
@@ -97,19 +98,19 @@ export interface PoppedScoredMany {
|
|
|
97
98
|
score: number;
|
|
98
99
|
}[];
|
|
99
100
|
}
|
|
100
|
-
/**
|
|
101
|
+
/** Geographic coordinates (longitude and latitude). */
|
|
101
102
|
export interface GeoPosition {
|
|
102
103
|
longitude: number;
|
|
103
104
|
latitude: number;
|
|
104
105
|
}
|
|
105
|
-
/** A member
|
|
106
|
+
/** A member matched by a geo radius search, with any requested metadata. */
|
|
106
107
|
export interface GeoRadiusResult {
|
|
107
108
|
name: string;
|
|
108
|
-
/**
|
|
109
|
+
/** Distance from the search center (present when `withDist` is enabled). */
|
|
109
110
|
dist?: number;
|
|
110
|
-
/**
|
|
111
|
+
/** Geohash integer of the member (present when `withHash` is enabled). */
|
|
111
112
|
hash?: bigint;
|
|
112
|
-
/**
|
|
113
|
+
/** Coordinates of the member (present when `withCoord` is enabled). */
|
|
113
114
|
coord?: GeoPosition;
|
|
114
115
|
}
|
|
115
116
|
export declare function textOf(v: Value): string;
|
|
@@ -119,10 +120,10 @@ export declare function arrayOf(v: Value): Value[];
|
|
|
119
120
|
/** The members of a sorted set with their scores, nested in pairs or flat. */
|
|
120
121
|
export declare function scoredMembersOf(items: Value[]): ScoredMember[];
|
|
121
122
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* {@link Reply.
|
|
125
|
-
*
|
|
123
|
+
* A Redis command reply, or the error the command failed with. Decode it into
|
|
124
|
+
* the expected type using methods such as {@link Reply.text},
|
|
125
|
+
* {@link Reply.number}, or {@link Reply.textMap}. Every accessor throws if the
|
|
126
|
+
* command failed and returns `null` for a nil reply.
|
|
126
127
|
*/
|
|
127
128
|
export declare class Reply {
|
|
128
129
|
private readonly reply;
|
|
@@ -131,86 +132,92 @@ export declare class Reply {
|
|
|
131
132
|
constructor(reply: Value, err?: Error | undefined);
|
|
132
133
|
/** @internal A reply for a command that could not be sent. */
|
|
133
134
|
static failed(err: unknown): Reply;
|
|
134
|
-
/** The error the command failed with, if
|
|
135
|
+
/** The error the command failed with, if any. A nil reply is not an error. */
|
|
135
136
|
get error(): Error | undefined;
|
|
136
|
-
/**
|
|
137
|
+
/** Returns `true` if the command succeeded and returned nil. */
|
|
137
138
|
isNull(): boolean;
|
|
138
139
|
/** The reply, or the error it failed with, thrown. */
|
|
139
140
|
private get v();
|
|
140
|
-
/**
|
|
141
|
+
/** Decodes the reply as plain JavaScript values. */
|
|
141
142
|
value(): RedisValue;
|
|
142
|
-
/**
|
|
143
|
+
/** Decodes the reply as UTF-8 text (or stringified digits for a number). */
|
|
143
144
|
text(): string | null;
|
|
144
|
-
/**
|
|
145
|
+
/** Returns the reply as raw bytes. */
|
|
145
146
|
bytes(): Buffer | null;
|
|
146
147
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* {@link Reply.bigint}.
|
|
148
|
+
* Decodes the reply as a number, parsing numeric strings if necessary.
|
|
149
|
+
* Integers outside the safe integer range lose precision; use
|
|
150
|
+
* {@link Reply.bigint} for exact 64-bit integers.
|
|
150
151
|
*/
|
|
151
152
|
number(): number | null;
|
|
152
|
-
/**
|
|
153
|
+
/** Decodes the reply as a `bigint`, parsing numeric strings if necessary. */
|
|
153
154
|
bigint(): bigint | null;
|
|
154
|
-
/**
|
|
155
|
+
/** Decodes the reply as a boolean (non-zero integers and `"OK"` are `true`). */
|
|
155
156
|
bool(): boolean | null;
|
|
156
|
-
/**
|
|
157
|
+
/** Decodes the reply as UTF-8 text and parses it as JSON. */
|
|
157
158
|
json<T = unknown>(): T | null;
|
|
158
|
-
/**
|
|
159
|
+
/** Decodes an array reply as an array of {@link Reply} instances. */
|
|
159
160
|
replies(): Reply[];
|
|
160
161
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
162
|
+
* Decodes an array reply as strings. Throws if any element is nil; use
|
|
163
|
+
* {@link Reply.optionalTexts} to preserve missing elements as `null`.
|
|
163
164
|
*/
|
|
164
165
|
texts(): string[];
|
|
165
166
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
167
|
+
* Decodes an array reply as strings, mapping nil elements to `null` (as
|
|
168
|
+
* returned by `mget` and `hmget` for missing keys or fields).
|
|
168
169
|
*/
|
|
169
170
|
optionalTexts(): (string | null)[];
|
|
170
|
-
/**
|
|
171
|
+
/** Decodes an array reply as numbers. */
|
|
171
172
|
numbers(): number[];
|
|
172
|
-
/**
|
|
173
|
+
/** Decodes an array reply as booleans. */
|
|
173
174
|
bools(): boolean[];
|
|
174
175
|
/**
|
|
175
|
-
*
|
|
176
|
-
* `hgetall`
|
|
177
|
-
*
|
|
176
|
+
* Decodes a map reply (or flat array of key-value pairs, as returned by
|
|
177
|
+
* `hgetall`) into a prototype-less object so keys like `__proto__` are
|
|
178
|
+
* handled safely.
|
|
178
179
|
*/
|
|
179
180
|
textMap(): Record<string, string>;
|
|
180
181
|
/**
|
|
181
|
-
*
|
|
182
|
-
* `
|
|
182
|
+
* Decodes sorted set members with their scores, as returned by
|
|
183
|
+
* `zrangeWithscores` and `zpopmin`.
|
|
183
184
|
*/
|
|
184
185
|
scoredMembers(): ScoredMember[];
|
|
185
186
|
/**
|
|
186
|
-
*
|
|
187
|
+
* Decodes stream entries, as returned by `xrange`, `xrevrange`, and
|
|
188
|
+
* `xclaim`.
|
|
187
189
|
*/
|
|
188
190
|
streamEntries(): StreamEntry[];
|
|
189
191
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
+
* Decodes entries grouped by stream, as returned by `xread` and
|
|
193
|
+
* `xreadGroup`. Returns an empty array if no entries were read.
|
|
192
194
|
*/
|
|
193
195
|
streams(): Stream[];
|
|
194
|
-
/**
|
|
196
|
+
/** Decodes a pending-entries summary returned by `xpending`. */
|
|
195
197
|
streamPending(): StreamPending;
|
|
196
|
-
/**
|
|
198
|
+
/** Decodes stream metadata returned by `xinfoStream`. */
|
|
197
199
|
streamInfo(): StreamInfo;
|
|
198
|
-
/**
|
|
200
|
+
/** Decodes an `xautoclaim` reply. */
|
|
199
201
|
streamAutoClaim(): StreamAutoClaim;
|
|
200
|
-
/**
|
|
202
|
+
/**
|
|
203
|
+
* Decodes member positions returned by `geoPos`, with `null` for missing
|
|
204
|
+
* members.
|
|
205
|
+
*/
|
|
201
206
|
geoPositions(): (GeoPosition | null)[];
|
|
202
|
-
/**
|
|
207
|
+
/** Decodes members matched by a `geoRadius` search. */
|
|
203
208
|
geoRadius(): GeoRadiusResult[];
|
|
204
209
|
}
|
|
205
210
|
/**
|
|
206
|
-
* A command
|
|
207
|
-
* rejects if the command
|
|
211
|
+
* A pending command reply. Await it directly to get the {@link Reply} (which
|
|
212
|
+
* rejects if the command fails), or chain a decoder method to read the value
|
|
213
|
+
* directly:
|
|
208
214
|
*
|
|
209
215
|
* ```ts
|
|
210
216
|
* const name = await SESSIONS.string.get("name:1").text();
|
|
211
217
|
* ```
|
|
212
218
|
*
|
|
213
|
-
* The command is sent when
|
|
219
|
+
* The command is sent immediately when called, whether or not the returned
|
|
220
|
+
* promise is awaited.
|
|
214
221
|
*/
|
|
215
222
|
export declare class ReplyPromise implements PromiseLike<Reply> {
|
|
216
223
|
private readonly reply;
|
|
@@ -263,11 +270,12 @@ export declare class ReplyPromise implements PromiseLike<Reply> {
|
|
|
263
270
|
geoRadius(): Promise<GeoRadiusResult[]>;
|
|
264
271
|
}
|
|
265
272
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
273
|
+
* Error thrown by a pipeline or transaction when the server rejects one or
|
|
274
|
+
* more queued commands. The remaining commands still executed, as Redis does
|
|
275
|
+
* not support rollbacks.
|
|
268
276
|
*/
|
|
269
277
|
export declare class BatchError extends Error {
|
|
270
|
-
/**
|
|
278
|
+
/** Replies for every queued command in order, including each command's error. */
|
|
271
279
|
readonly replies: Reply[];
|
|
272
280
|
/** @internal */
|
|
273
281
|
constructor(replies: Reply[], first: Error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../storage/redis/reply.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAgC,KAAK,EAAC,MAAM,QAAQ,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../storage/redis/reply.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAgC,KAAK,EAAC,MAAM,QAAQ,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,IAAI,GACJ,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,UAAU,EAAE,GACZ;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAC,CAAC;AAEhC,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,KAAK,EA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E,KAAK,EAAE,KAAK;CAU3C;AAED,6DAA6D;AAC7D,eAAO,MAAM,EAAE;IACb,yCAAyC;eAC9B,KAAK,KAAG,KAAK;cACd,KAAK,KAAG,IAAI;gBAGV,KAAK,KAAG,MAAM;wBACN,KAAK,KAAG,MAAM,GAAG,IAAI;cAE/B,KAAK,KAAG,OAAO;cACf,KAAK,KAAG,MAAM;eACb,KAAK,KAAG,OAAO,EAAE;gBAChB,KAAK,KAAG,MAAM,GAAG,IAAI;oBAIjB,KAAK,KAAG,UAAU,GAAG,IAAI;sBASvB,KAAK,KAAG,YAAY,GAAG,IAAI;0BAUvB,KAAK,KAAG,gBAAgB,GAAG,IAAI;CAYtD,CAAC"}
|
|
@@ -139,7 +139,7 @@ function dict() {
|
|
|
139
139
|
function textMapOf(v) {
|
|
140
140
|
const items = arrayOf(v);
|
|
141
141
|
if (items.length % 2 !== 0) {
|
|
142
|
-
throw new TypeError(`redis: an
|
|
142
|
+
throw new TypeError(`redis: expected an even number of elements for key-value pairs, got ${items.length}`);
|
|
143
143
|
}
|
|
144
144
|
const out = dict();
|
|
145
145
|
for (let i = 0; i < items.length; i += 2) {
|
|
@@ -159,7 +159,7 @@ export function scoredMembersOf(items) {
|
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
if (items.length % 2 !== 0) {
|
|
162
|
-
throw new TypeError(`redis: an
|
|
162
|
+
throw new TypeError(`redis: expected an even number of elements for members and scores, got ${items.length}`);
|
|
163
163
|
}
|
|
164
164
|
const out = [];
|
|
165
165
|
for (let i = 0; i < items.length; i += 2) {
|
|
@@ -180,10 +180,10 @@ function geoPositionOf(v) {
|
|
|
180
180
|
return { longitude: numberOf(parts[0]), latitude: numberOf(parts[1]) };
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* {@link Reply.
|
|
186
|
-
*
|
|
183
|
+
* A Redis command reply, or the error the command failed with. Decode it into
|
|
184
|
+
* the expected type using methods such as {@link Reply.text},
|
|
185
|
+
* {@link Reply.number}, or {@link Reply.textMap}. Every accessor throws if the
|
|
186
|
+
* command failed and returns `null` for a nil reply.
|
|
187
187
|
*/
|
|
188
188
|
export class Reply {
|
|
189
189
|
reply;
|
|
@@ -197,11 +197,11 @@ export class Reply {
|
|
|
197
197
|
static failed(err) {
|
|
198
198
|
return new Reply(null, err instanceof Error ? err : new Error(String(err)));
|
|
199
199
|
}
|
|
200
|
-
/** The error the command failed with, if
|
|
200
|
+
/** The error the command failed with, if any. A nil reply is not an error. */
|
|
201
201
|
get error() {
|
|
202
202
|
return (this.err ?? (this.reply instanceof ServerError ? this.reply : undefined));
|
|
203
203
|
}
|
|
204
|
-
/**
|
|
204
|
+
/** Returns `true` if the command succeeded and returned nil. */
|
|
205
205
|
isNull() {
|
|
206
206
|
return !this.err && this.reply === null;
|
|
207
207
|
}
|
|
@@ -211,15 +211,15 @@ export class Reply {
|
|
|
211
211
|
throw this.err;
|
|
212
212
|
return this.reply;
|
|
213
213
|
}
|
|
214
|
-
/**
|
|
214
|
+
/** Decodes the reply as plain JavaScript values. */
|
|
215
215
|
value() {
|
|
216
216
|
return plain(this.v);
|
|
217
217
|
}
|
|
218
|
-
/**
|
|
218
|
+
/** Decodes the reply as UTF-8 text (or stringified digits for a number). */
|
|
219
219
|
text() {
|
|
220
220
|
return this.v === null ? null : textOf(this.v);
|
|
221
221
|
}
|
|
222
|
-
/**
|
|
222
|
+
/** Returns the reply as raw bytes. */
|
|
223
223
|
bytes() {
|
|
224
224
|
const v = ok(this.v);
|
|
225
225
|
if (v === null)
|
|
@@ -227,80 +227,81 @@ export class Reply {
|
|
|
227
227
|
return Buffer.isBuffer(v) ? v : Buffer.from(textOf(v), 'utf8');
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* {@link Reply.bigint}.
|
|
230
|
+
* Decodes the reply as a number, parsing numeric strings if necessary.
|
|
231
|
+
* Integers outside the safe integer range lose precision; use
|
|
232
|
+
* {@link Reply.bigint} for exact 64-bit integers.
|
|
233
233
|
*/
|
|
234
234
|
number() {
|
|
235
235
|
return this.v === null ? null : numberOf(this.v);
|
|
236
236
|
}
|
|
237
|
-
/**
|
|
237
|
+
/** Decodes the reply as a `bigint`, parsing numeric strings if necessary. */
|
|
238
238
|
bigint() {
|
|
239
239
|
return this.v === null ? null : bigintOf(this.v);
|
|
240
240
|
}
|
|
241
|
-
/**
|
|
241
|
+
/** Decodes the reply as a boolean (non-zero integers and `"OK"` are `true`). */
|
|
242
242
|
bool() {
|
|
243
243
|
return this.v === null ? null : boolOf(this.v);
|
|
244
244
|
}
|
|
245
|
-
/**
|
|
245
|
+
/** Decodes the reply as UTF-8 text and parses it as JSON. */
|
|
246
246
|
json() {
|
|
247
247
|
const text = this.text();
|
|
248
248
|
return text === null ? null : JSON.parse(text);
|
|
249
249
|
}
|
|
250
|
-
/**
|
|
250
|
+
/** Decodes an array reply as an array of {@link Reply} instances. */
|
|
251
251
|
replies() {
|
|
252
252
|
return arrayOf(this.v).map(item => new Reply(item));
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
255
|
+
* Decodes an array reply as strings. Throws if any element is nil; use
|
|
256
|
+
* {@link Reply.optionalTexts} to preserve missing elements as `null`.
|
|
257
257
|
*/
|
|
258
258
|
texts() {
|
|
259
259
|
return arrayOf(this.v).map(item => {
|
|
260
260
|
if (item === null)
|
|
261
|
-
throw new TypeError('redis: a nil element
|
|
261
|
+
throw new TypeError('redis: cannot read a nil element as text');
|
|
262
262
|
return textOf(item);
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
266
|
+
* Decodes an array reply as strings, mapping nil elements to `null` (as
|
|
267
|
+
* returned by `mget` and `hmget` for missing keys or fields).
|
|
268
268
|
*/
|
|
269
269
|
optionalTexts() {
|
|
270
270
|
return arrayOf(this.v).map(item => (item === null ? null : textOf(item)));
|
|
271
271
|
}
|
|
272
|
-
/**
|
|
272
|
+
/** Decodes an array reply as numbers. */
|
|
273
273
|
numbers() {
|
|
274
274
|
return arrayOf(this.v).map(numberOf);
|
|
275
275
|
}
|
|
276
|
-
/**
|
|
276
|
+
/** Decodes an array reply as booleans. */
|
|
277
277
|
bools() {
|
|
278
278
|
return arrayOf(this.v).map(boolOf);
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
|
-
*
|
|
282
|
-
* `hgetall`
|
|
283
|
-
*
|
|
281
|
+
* Decodes a map reply (or flat array of key-value pairs, as returned by
|
|
282
|
+
* `hgetall`) into a prototype-less object so keys like `__proto__` are
|
|
283
|
+
* handled safely.
|
|
284
284
|
*/
|
|
285
285
|
textMap() {
|
|
286
286
|
return textMapOf(this.v);
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
289
|
-
*
|
|
290
|
-
* `
|
|
289
|
+
* Decodes sorted set members with their scores, as returned by
|
|
290
|
+
* `zrangeWithscores` and `zpopmin`.
|
|
291
291
|
*/
|
|
292
292
|
scoredMembers() {
|
|
293
293
|
return scoredMembersOf(arrayOf(this.v));
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
|
-
*
|
|
296
|
+
* Decodes stream entries, as returned by `xrange`, `xrevrange`, and
|
|
297
|
+
* `xclaim`.
|
|
297
298
|
*/
|
|
298
299
|
streamEntries() {
|
|
299
300
|
return arrayOf(this.v).map(streamEntryOf);
|
|
300
301
|
}
|
|
301
302
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
303
|
+
* Decodes entries grouped by stream, as returned by `xread` and
|
|
304
|
+
* `xreadGroup`. Returns an empty array if no entries were read.
|
|
304
305
|
*/
|
|
305
306
|
streams() {
|
|
306
307
|
const v = ok(this.v);
|
|
@@ -319,7 +320,7 @@ export class Reply {
|
|
|
319
320
|
entries: arrayOf(entries).map(streamEntryOf),
|
|
320
321
|
}));
|
|
321
322
|
}
|
|
322
|
-
/**
|
|
323
|
+
/** Decodes a pending-entries summary returned by `xpending`. */
|
|
323
324
|
streamPending() {
|
|
324
325
|
const parts = arrayOf(this.v);
|
|
325
326
|
if (parts.length !== 4)
|
|
@@ -339,7 +340,7 @@ export class Reply {
|
|
|
339
340
|
}),
|
|
340
341
|
};
|
|
341
342
|
}
|
|
342
|
-
/**
|
|
343
|
+
/** Decodes stream metadata returned by `xinfoStream`. */
|
|
343
344
|
streamInfo() {
|
|
344
345
|
const items = arrayOf(this.v);
|
|
345
346
|
const out = {
|
|
@@ -379,7 +380,7 @@ export class Reply {
|
|
|
379
380
|
}
|
|
380
381
|
return out;
|
|
381
382
|
}
|
|
382
|
-
/**
|
|
383
|
+
/** Decodes an `xautoclaim` reply. */
|
|
383
384
|
streamAutoClaim() {
|
|
384
385
|
const parts = arrayOf(this.v);
|
|
385
386
|
if (parts.length < 2)
|
|
@@ -390,11 +391,14 @@ export class Reply {
|
|
|
390
391
|
deleted: parts.length > 2 ? arrayOf(parts[2]).map(textOf) : [],
|
|
391
392
|
};
|
|
392
393
|
}
|
|
393
|
-
/**
|
|
394
|
+
/**
|
|
395
|
+
* Decodes member positions returned by `geoPos`, with `null` for missing
|
|
396
|
+
* members.
|
|
397
|
+
*/
|
|
394
398
|
geoPositions() {
|
|
395
399
|
return arrayOf(this.v).map(item => item === null ? null : geoPositionOf(item));
|
|
396
400
|
}
|
|
397
|
-
/**
|
|
401
|
+
/** Decodes members matched by a `geoRadius` search. */
|
|
398
402
|
geoRadius() {
|
|
399
403
|
return arrayOf(this.v).map(item => {
|
|
400
404
|
// A plain name without any of withDist, withHash and withCoord;
|
|
@@ -419,14 +423,16 @@ export class Reply {
|
|
|
419
423
|
}
|
|
420
424
|
}
|
|
421
425
|
/**
|
|
422
|
-
* A command
|
|
423
|
-
* rejects if the command
|
|
426
|
+
* A pending command reply. Await it directly to get the {@link Reply} (which
|
|
427
|
+
* rejects if the command fails), or chain a decoder method to read the value
|
|
428
|
+
* directly:
|
|
424
429
|
*
|
|
425
430
|
* ```ts
|
|
426
431
|
* const name = await SESSIONS.string.get("name:1").text();
|
|
427
432
|
* ```
|
|
428
433
|
*
|
|
429
|
-
* The command is sent when
|
|
434
|
+
* The command is sent immediately when called, whether or not the returned
|
|
435
|
+
* promise is awaited.
|
|
430
436
|
*/
|
|
431
437
|
export class ReplyPromise {
|
|
432
438
|
reply;
|
|
@@ -535,11 +541,12 @@ export class ReplyPromise {
|
|
|
535
541
|
}
|
|
536
542
|
}
|
|
537
543
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
544
|
+
* Error thrown by a pipeline or transaction when the server rejects one or
|
|
545
|
+
* more queued commands. The remaining commands still executed, as Redis does
|
|
546
|
+
* not support rollbacks.
|
|
540
547
|
*/
|
|
541
548
|
export class BatchError extends Error {
|
|
542
|
-
/**
|
|
549
|
+
/** Replies for every queued command in order, including each command's error. */
|
|
543
550
|
replies;
|
|
544
551
|
/** @internal */
|
|
545
552
|
constructor(replies, first) {
|
|
@@ -601,11 +608,11 @@ function popParts(v, n) {
|
|
|
601
608
|
return null;
|
|
602
609
|
const parts = arrayOf(v);
|
|
603
610
|
if (parts.length !== n) {
|
|
604
|
-
throw new TypeError(`redis:
|
|
611
|
+
throw new TypeError(`redis: expected ${n} values in pop reply, got ${parts.length}`);
|
|
605
612
|
}
|
|
606
613
|
return parts;
|
|
607
614
|
}
|
|
608
615
|
function nilErr() {
|
|
609
|
-
throw new TypeError('redis:
|
|
616
|
+
throw new TypeError('redis: command returned an unexpected nil reply');
|
|
610
617
|
}
|
|
611
618
|
//# sourceMappingURL=reply.js.map
|