@valkey/valkey-glide-darwin-arm64 1.2.0-rc2 → 1.2.0-rc20
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 +8 -4
- package/build-ts/index.d.ts +2 -0
- package/build-ts/index.js +2 -0
- package/build-ts/index.js.map +1 -1
- package/build-ts/src/BaseClient.d.ts +164 -11
- package/build-ts/src/BaseClient.js +129 -20
- package/build-ts/src/BaseClient.js.map +1 -1
- package/build-ts/src/GlideClient.d.ts +84 -2
- package/build-ts/src/GlideClient.js +50 -0
- package/build-ts/src/GlideClient.js.map +1 -1
- package/build-ts/src/GlideClusterClient.d.ts +265 -4
- package/build-ts/src/GlideClusterClient.js +50 -2
- package/build-ts/src/GlideClusterClient.js.map +1 -1
- package/build-ts/src/ProtobufMessage.js +281 -3
- package/build-ts/src/ProtobufMessage.js.map +1 -1
- package/build-ts/src/server-modules/GlideFt.d.ts +412 -0
- package/build-ts/src/server-modules/GlideFt.js +664 -0
- package/build-ts/src/server-modules/GlideFt.js.map +1 -0
- package/build-ts/src/server-modules/GlideFtOptions.d.ts +244 -0
- package/build-ts/src/server-modules/GlideFtOptions.js +6 -0
- package/build-ts/src/server-modules/GlideFtOptions.js.map +1 -0
- package/build-ts/src/server-modules/GlideJson.d.ts +746 -17
- package/build-ts/src/server-modules/GlideJson.js +886 -17
- package/build-ts/src/server-modules/GlideJson.js.map +1 -1
- package/index.ts +2 -0
- package/node_modules/glide-rs/glide-rs.darwin-arm64.node +0 -0
- package/node_modules/glide-rs/index.d.ts +1 -0
- package/node_modules/glide-rs/index.js +2 -0
- package/npm/glide/index.ts +48 -0
- package/npm/glide/package.json +2 -2
- package/package.json +18 -9
- package/.ort.yml +0 -9
- package/.prettierignore +0 -7
- package/DEVELOPER.md +0 -191
- package/THIRD_PARTY_LICENSES_NODE +0 -35625
- package/npm/glide/tsconfig.json +0 -30
- package/tsconfig.json +0 -31
package/README.md
CHANGED
|
@@ -14,12 +14,16 @@ The release of Valkey GLIDE was tested on the following platforms:
|
|
|
14
14
|
|
|
15
15
|
Linux:
|
|
16
16
|
|
|
17
|
-
- Ubuntu 22.04.1 (x86_64)
|
|
17
|
+
- Ubuntu 22.04.1 (x86_64 and aarch64)
|
|
18
18
|
- Amazon Linux 2023 (AL2023) (x86_64)
|
|
19
19
|
|
|
20
20
|
macOS:
|
|
21
21
|
|
|
22
|
-
- macOS
|
|
22
|
+
- macOS 14.7 (Apple silicon/aarch_64)
|
|
23
|
+
|
|
24
|
+
Alpine:
|
|
25
|
+
|
|
26
|
+
- node:alpine (default on aarch64 and x86_64)
|
|
23
27
|
|
|
24
28
|
## NodeJS supported version
|
|
25
29
|
|
|
@@ -92,9 +96,9 @@ client.close();
|
|
|
92
96
|
|
|
93
97
|
### Supported platforms
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
Currently, the package is tested on:
|
|
96
100
|
|
|
97
101
|
| Operation systems | C lib | Architecture |
|
|
98
102
|
| ----------------- | -------------------- | ----------------- |
|
|
99
103
|
| `Linux` | `glibc`, `musl libc` | `x86_64`, `arm64` |
|
|
100
|
-
| `macOS` | `Darwin` | `
|
|
104
|
+
| `macOS` | `Darwin` | `arm64` |
|
package/build-ts/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@ export * from "./src/GlideClient";
|
|
|
9
9
|
export * from "./src/GlideClusterClient";
|
|
10
10
|
export * from "./src/Logger";
|
|
11
11
|
export * from "./src/server-modules/GlideJson";
|
|
12
|
+
export * from "./src/server-modules/GlideFt";
|
|
13
|
+
export * from "./src/server-modules/GlideFtOptions";
|
|
12
14
|
export * from "./src/Transaction";
|
package/build-ts/index.js
CHANGED
|
@@ -28,5 +28,7 @@ __exportStar(require("./src/GlideClient"), exports);
|
|
|
28
28
|
__exportStar(require("./src/GlideClusterClient"), exports);
|
|
29
29
|
__exportStar(require("./src/Logger"), exports);
|
|
30
30
|
__exportStar(require("./src/server-modules/GlideJson"), exports);
|
|
31
|
+
__exportStar(require("./src/server-modules/GlideFt"), exports);
|
|
32
|
+
__exportStar(require("./src/server-modules/GlideFtOptions"), exports);
|
|
31
33
|
__exportStar(require("./src/Transaction"), exports);
|
|
32
34
|
//# sourceMappingURL=index.js.map
|
package/build-ts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,qCAAqD;AAA5C,6GAAA,iBAAiB,OAAA;AAAE,kGAAA,MAAM,OAAA;AAClC,mDAAiC;AACjC,iDAA+B;AAC/B,+CAA6B;AAC7B,oDAAkC;AAClC,2DAAyC;AACzC,+CAA6B;AAC7B,iEAA+C;AAC/C,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,qCAAqD;AAA5C,6GAAA,iBAAiB,OAAA;AAAE,kGAAA,MAAM,OAAA;AAClC,mDAAiC;AACjC,iDAA+B;AAC/B,+CAA6B;AAC7B,oDAAkC;AAClC,2DAAyC;AACzC,+CAA6B;AAC7B,iEAA+C;AAC/C,+DAA6C;AAC7C,sEAAoD;AACpD,oDAAkC"}
|
|
@@ -112,9 +112,73 @@ export type ReadFrom =
|
|
|
112
112
|
"primary"
|
|
113
113
|
/** Spread the requests between all replicas in a round robin manner.
|
|
114
114
|
If no replica is available, route the requests to the primary.*/
|
|
115
|
-
| "preferReplica"
|
|
115
|
+
| "preferReplica"
|
|
116
|
+
/** Spread the requests between replicas in the same client's Aviliablity zone in a round robin manner.
|
|
117
|
+
If no replica is available, route the requests to the primary.*/
|
|
118
|
+
| "AZAffinity";
|
|
116
119
|
/**
|
|
117
120
|
* Configuration settings for creating a client. Shared settings for standalone and cluster clients.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* The `BaseClientConfiguration` interface defines the foundational configuration options used when creating a client to connect to a Valkey server or cluster. It includes connection details, authentication, communication protocols, and various settings that influence the client's behavior and interaction with the server.
|
|
124
|
+
*
|
|
125
|
+
* ### Connection Details
|
|
126
|
+
*
|
|
127
|
+
* - **Addresses**: Use the `addresses` property to specify the hostnames and ports of the server(s) to connect to.
|
|
128
|
+
* - **Cluster Mode**: In cluster mode, the client will discover other nodes based on the provided addresses.
|
|
129
|
+
* - **Standalone Mode**: In standalone mode, only the provided nodes will be used.
|
|
130
|
+
*
|
|
131
|
+
* ### Security Settings
|
|
132
|
+
*
|
|
133
|
+
* - **TLS**: Enable secure communication using `useTLS`.
|
|
134
|
+
* - **Authentication**: Provide `credentials` to authenticate with the server.
|
|
135
|
+
*
|
|
136
|
+
* ### Communication Settings
|
|
137
|
+
*
|
|
138
|
+
* - **Request Timeout**: Set `requestTimeout` to specify how long the client should wait for a request to complete.
|
|
139
|
+
* - **Protocol Version**: Choose the serialization protocol using `protocol`.
|
|
140
|
+
*
|
|
141
|
+
* ### Client Identification
|
|
142
|
+
*
|
|
143
|
+
* - **Client Name**: Set `clientName` to identify the client connection.
|
|
144
|
+
*
|
|
145
|
+
* ### Read Strategy
|
|
146
|
+
*
|
|
147
|
+
* - Use `readFrom` to specify the client's read strategy (e.g., primary, preferReplica, AZAffinity).
|
|
148
|
+
*
|
|
149
|
+
* ### Availability Zone
|
|
150
|
+
*
|
|
151
|
+
* - Use `clientAz` to specify the client's availability zone, which can influence read operations when using `readFrom: 'AZAffinity'`.
|
|
152
|
+
*
|
|
153
|
+
* ### Decoder Settings
|
|
154
|
+
*
|
|
155
|
+
* - **Default Decoder**: Set `defaultDecoder` to specify how responses are decoded by default.
|
|
156
|
+
*
|
|
157
|
+
* ### Concurrency Control
|
|
158
|
+
*
|
|
159
|
+
* - **Inflight Requests Limit**: Control the number of concurrent requests using `inflightRequestsLimit`.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const config: BaseClientConfiguration = {
|
|
164
|
+
* addresses: [
|
|
165
|
+
* { host: 'redis-node-1.example.com', port: 6379 },
|
|
166
|
+
* { host: 'redis-node-2.example.com' }, // Defaults to port 6379
|
|
167
|
+
* ],
|
|
168
|
+
* useTLS: true,
|
|
169
|
+
* credentials: {
|
|
170
|
+
* username: 'myUser',
|
|
171
|
+
* password: 'myPassword',
|
|
172
|
+
* },
|
|
173
|
+
* requestTimeout: 5000, // 5 seconds
|
|
174
|
+
* protocol: ProtocolVersion.RESP3,
|
|
175
|
+
* clientName: 'myValkeyClient',
|
|
176
|
+
* readFrom: ReadFrom.AZAffinity,
|
|
177
|
+
* clientAz: 'us-east-1a',
|
|
178
|
+
* defaultDecoder: Decoder.String,
|
|
179
|
+
* inflightRequestsLimit: 1000,
|
|
180
|
+
* };
|
|
181
|
+
* ```
|
|
118
182
|
*/
|
|
119
183
|
export interface BaseClientConfiguration {
|
|
120
184
|
/**
|
|
@@ -184,6 +248,18 @@ export interface BaseClientConfiguration {
|
|
|
184
248
|
* used.
|
|
185
249
|
*/
|
|
186
250
|
inflightRequestsLimit?: number;
|
|
251
|
+
/**
|
|
252
|
+
* Availability Zone of the client.
|
|
253
|
+
* If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* // Example configuration for setting client availability zone and read strategy
|
|
258
|
+
* configuration.clientAz = 'us-east-1a'; // Sets the client's availability zone
|
|
259
|
+
* configuration.readFrom = 'AZAffinity'; // Directs read operations to nodes within the same AZ
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
clientAz?: string;
|
|
187
263
|
}
|
|
188
264
|
/**
|
|
189
265
|
* Enum of Valkey data types
|
|
@@ -223,6 +299,7 @@ export declare class BaseClient {
|
|
|
223
299
|
private readonly pubsubFutures;
|
|
224
300
|
private pendingPushNotification;
|
|
225
301
|
private readonly inflightRequestsLimit;
|
|
302
|
+
private readonly clientAz;
|
|
226
303
|
private config;
|
|
227
304
|
protected configurePubsub(options: GlideClusterClientConfiguration | GlideClientConfiguration, configuration: connection_request.IConnectionRequest): void;
|
|
228
305
|
private handleReadData;
|
|
@@ -230,7 +307,7 @@ export declare class BaseClient {
|
|
|
230
307
|
processPush(response: response.Response): void;
|
|
231
308
|
protected getCallbackIndex(): number;
|
|
232
309
|
private writeBufferedRequestsToSocket;
|
|
233
|
-
protected writeOrBufferCommandRequest(callbackIdx: number, command: command_request.Command | command_request.Command[] | command_request.ScriptInvocation | command_request.ClusterScan, route?: command_request.Routes): void;
|
|
310
|
+
protected writeOrBufferCommandRequest(callbackIdx: number, command: command_request.Command | command_request.Command[] | command_request.ScriptInvocation | command_request.ClusterScan | command_request.UpdateConnectionPassword, route?: command_request.Routes): void;
|
|
234
311
|
private writeOrBufferRequest;
|
|
235
312
|
cancelPubSubFuturesWithExceptionSafe(exception: ConnectionError): void;
|
|
236
313
|
isPubsubConfigured(config: GlideClientConfiguration | GlideClusterClientConfiguration): boolean;
|
|
@@ -367,6 +444,14 @@ export declare class BaseClient {
|
|
|
367
444
|
*
|
|
368
445
|
* @see {@link https://valkey.io/commands/del/|valkey.io} for details.
|
|
369
446
|
*
|
|
447
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
448
|
+
* the command will be split across these slots and executed separately for each.
|
|
449
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
450
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
451
|
+
* though some requests may have succeeded while others did not.
|
|
452
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
453
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
454
|
+
*
|
|
370
455
|
* @param keys - The keys we wanted to remove.
|
|
371
456
|
* @returns The number of keys that were removed.
|
|
372
457
|
*
|
|
@@ -448,7 +533,14 @@ export declare class BaseClient {
|
|
|
448
533
|
/** Retrieve the values of multiple keys.
|
|
449
534
|
*
|
|
450
535
|
* @see {@link https://valkey.io/commands/mget/|valkey.io} for details.
|
|
451
|
-
*
|
|
536
|
+
*
|
|
537
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
538
|
+
* the command will be split across these slots and executed separately for each.
|
|
539
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
540
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
541
|
+
* though some requests may have succeeded while others did not.
|
|
542
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
543
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
452
544
|
*
|
|
453
545
|
* @param keys - A list of keys to retrieve values for.
|
|
454
546
|
* @param options - (Optional) See {@link DecoderOption}.
|
|
@@ -468,10 +560,18 @@ export declare class BaseClient {
|
|
|
468
560
|
/** Set multiple keys to multiple values in a single operation.
|
|
469
561
|
*
|
|
470
562
|
* @see {@link https://valkey.io/commands/mset/|valkey.io} for details.
|
|
471
|
-
*
|
|
563
|
+
*
|
|
564
|
+
* @remarks In cluster mode, if keys in `keyValueMap` map to different hash slots,
|
|
565
|
+
* the command will be split across these slots and executed separately for each.
|
|
566
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
567
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
568
|
+
* though some requests may have succeeded while others did not.
|
|
569
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
570
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
472
571
|
*
|
|
473
572
|
* @param keysAndValues - A list of key-value pairs to set.
|
|
474
|
-
*
|
|
573
|
+
*
|
|
574
|
+
* @returns A simple "OK" response.
|
|
475
575
|
*
|
|
476
576
|
* @example
|
|
477
577
|
* ```typescript
|
|
@@ -1052,7 +1152,7 @@ export declare class BaseClient {
|
|
|
1052
1152
|
*
|
|
1053
1153
|
* @param key - The key of the set.
|
|
1054
1154
|
* @param cursor - The cursor that points to the next iteration of results. A value of `"0"` indicates the start of the search.
|
|
1055
|
-
* @param options - (Optional)
|
|
1155
|
+
* @param options - (Optional) See {@link HScanOptions} and {@link DecoderOption}.
|
|
1056
1156
|
* @returns An array of the `cursor` and the subset of the hash held by `key`.
|
|
1057
1157
|
* The first element is always the `cursor` for the next iteration of results. `"0"` will be the `cursor`
|
|
1058
1158
|
* returned on the last iteration of the hash. The second element is always an array of the subset of the
|
|
@@ -1929,6 +2029,14 @@ export declare class BaseClient {
|
|
|
1929
2029
|
/**
|
|
1930
2030
|
* Returns the number of keys in `keys` that exist in the database.
|
|
1931
2031
|
*
|
|
2032
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
2033
|
+
* the command will be split across these slots and executed separately for each.
|
|
2034
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
2035
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
2036
|
+
* though some requests may have succeeded while others did not.
|
|
2037
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
2038
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
2039
|
+
*
|
|
1932
2040
|
* @see {@link https://valkey.io/commands/exists/|valkey.io} for details.
|
|
1933
2041
|
*
|
|
1934
2042
|
* @param keys - The keys list to check.
|
|
@@ -1948,6 +2056,14 @@ export declare class BaseClient {
|
|
|
1948
2056
|
* This command, similar to {@link del}, removes specified keys and ignores non-existent ones.
|
|
1949
2057
|
* However, this command does not block the server, while {@link https://valkey.io/commands/del|`DEL`} does.
|
|
1950
2058
|
*
|
|
2059
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
2060
|
+
* the command will be split across these slots and executed separately for each.
|
|
2061
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
2062
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
2063
|
+
* though some requests may have succeeded while others did not.
|
|
2064
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
2065
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
2066
|
+
*
|
|
1951
2067
|
* @see {@link https://valkey.io/commands/unlink/|valkey.io} for details.
|
|
1952
2068
|
*
|
|
1953
2069
|
* @param keys - The keys we wanted to unlink.
|
|
@@ -3565,7 +3681,6 @@ export declare class BaseClient {
|
|
|
3565
3681
|
* attributes of a consumer group for the stream at `key`.
|
|
3566
3682
|
* @example
|
|
3567
3683
|
* ```typescript
|
|
3568
|
-
* <pre>{@code
|
|
3569
3684
|
* const result = await client.xinfoGroups("my_stream");
|
|
3570
3685
|
* console.log(result); // Output:
|
|
3571
3686
|
* // [
|
|
@@ -3877,13 +3992,11 @@ export declare class BaseClient {
|
|
|
3877
3992
|
*
|
|
3878
3993
|
* @example
|
|
3879
3994
|
* ```typescript
|
|
3880
|
-
* <pre>{@code
|
|
3881
3995
|
* const entryId = await client.xadd("mystream", ["myfield", "mydata"]);
|
|
3882
3996
|
* // read messages from streamId
|
|
3883
3997
|
* const readResult = await client.xreadgroup(["myfield", "mydata"], "mygroup", "my0consumer");
|
|
3884
3998
|
* // acknowledge messages on stream
|
|
3885
3999
|
* console.log(await client.xack("mystream", "mygroup", [entryId])); // Output: 1
|
|
3886
|
-
* </pre>
|
|
3887
4000
|
* ```
|
|
3888
4001
|
*/
|
|
3889
4002
|
xack(key: GlideString, group: GlideString, ids: string[]): Promise<number>;
|
|
@@ -4746,7 +4859,14 @@ export declare class BaseClient {
|
|
|
4746
4859
|
* Updates the last access time of the specified keys.
|
|
4747
4860
|
*
|
|
4748
4861
|
* @see {@link https://valkey.io/commands/touch/|valkey.io} for more details.
|
|
4749
|
-
*
|
|
4862
|
+
*
|
|
4863
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
4864
|
+
* the command will be split across these slots and executed separately for each.
|
|
4865
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
4866
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
4867
|
+
* though some requests may have succeeded while others did not.
|
|
4868
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
4869
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
4750
4870
|
*
|
|
4751
4871
|
* @param keys - The keys to update the last access time of.
|
|
4752
4872
|
* @returns The number of keys that were updated. A key is ignored if it doesn't exist.
|
|
@@ -4766,7 +4886,14 @@ export declare class BaseClient {
|
|
|
4766
4886
|
* transaction. Executing a transaction will automatically flush all previously watched keys.
|
|
4767
4887
|
*
|
|
4768
4888
|
* @see {@link https://valkey.io/commands/watch/|valkey.io} and {@link https://valkey.io/topics/transactions/#cas|Valkey Glide Wiki} for more details.
|
|
4769
|
-
*
|
|
4889
|
+
*
|
|
4890
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
4891
|
+
* the command will be split across these slots and executed separately for each.
|
|
4892
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
4893
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
4894
|
+
* though some requests may have succeeded while others did not.
|
|
4895
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
4896
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
4770
4897
|
*
|
|
4771
4898
|
* @param keys - The keys to watch.
|
|
4772
4899
|
* @returns A simple `"OK"` response.
|
|
@@ -5068,5 +5195,31 @@ export declare class BaseClient {
|
|
|
5068
5195
|
* @param errorMessage - If defined, this error message will be passed along with the exceptions when closing all open promises.
|
|
5069
5196
|
*/
|
|
5070
5197
|
close(errorMessage?: string): void;
|
|
5198
|
+
/**
|
|
5199
|
+
* Update the current connection with a new password.
|
|
5200
|
+
*
|
|
5201
|
+
* This method is useful in scenarios where the server password has changed or when utilizing short-lived passwords for enhanced security.
|
|
5202
|
+
* It allows the client to update its password to reconnect upon disconnection without the need to recreate the client instance.
|
|
5203
|
+
* This ensures that the internal reconnection mechanism can handle reconnection seamlessly, preventing the loss of in-flight commands.
|
|
5204
|
+
*
|
|
5205
|
+
* This method updates the client's internal password configuration and does not perform password rotation on the server side.
|
|
5206
|
+
*
|
|
5207
|
+
* @param password - `String | null`. The new password to update the current password, or `null` to remove the current password.
|
|
5208
|
+
* @param immidiateAuth - A `boolean` flag. If `true`, the client will authenticate immediately with the new password against all connections, Using `AUTH` command.
|
|
5209
|
+
* If password supplied is an empty string, the client will not perform auth and instead a warning will be returned.
|
|
5210
|
+
* The default is `false`.
|
|
5211
|
+
*
|
|
5212
|
+
* @example
|
|
5213
|
+
* ```typescript
|
|
5214
|
+
* await client.updateConnectionPassword("newPassword", true) // "OK"
|
|
5215
|
+
* ```
|
|
5216
|
+
*/
|
|
5217
|
+
updateConnectionPassword(password: string | null, immediateAuth?: boolean): Promise<GlideString>;
|
|
5218
|
+
/**
|
|
5219
|
+
* Return a statistics
|
|
5220
|
+
*
|
|
5221
|
+
* @return Return an object that contains the statistics collected internally by GLIDE core
|
|
5222
|
+
*/
|
|
5223
|
+
getStatistics(): object;
|
|
5071
5224
|
}
|
|
5072
5225
|
export {};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -381,6 +391,7 @@ class BaseClient {
|
|
|
381
391
|
this.MAP_READ_FROM_STRATEGY = {
|
|
382
392
|
primary: ProtobufMessage_1.connection_request.ReadFrom.Primary,
|
|
383
393
|
preferReplica: ProtobufMessage_1.connection_request.ReadFrom.PreferReplica,
|
|
394
|
+
AZAffinity: ProtobufMessage_1.connection_request.ReadFrom.AZAffinity,
|
|
384
395
|
};
|
|
385
396
|
// if logger has been initialized by the external-user on info level this log will be shown
|
|
386
397
|
Logger_1.Logger.log("info", "Client lifetime", `construct client`);
|
|
@@ -476,10 +487,15 @@ class BaseClient {
|
|
|
476
487
|
callbackIdx,
|
|
477
488
|
clusterScan: command,
|
|
478
489
|
})
|
|
479
|
-
: ProtobufMessage_1.command_request.
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
490
|
+
: command instanceof ProtobufMessage_1.command_request.UpdateConnectionPassword
|
|
491
|
+
? ProtobufMessage_1.command_request.CommandRequest.create({
|
|
492
|
+
callbackIdx,
|
|
493
|
+
updateConnectionPassword: command,
|
|
494
|
+
})
|
|
495
|
+
: ProtobufMessage_1.command_request.CommandRequest.create({
|
|
496
|
+
callbackIdx,
|
|
497
|
+
scriptInvocation: command,
|
|
498
|
+
});
|
|
483
499
|
message.route = route;
|
|
484
500
|
this.writeOrBufferRequest(message, (message, writer) => {
|
|
485
501
|
ProtobufMessage_1.command_request.CommandRequest.encodeDelimited(message, writer);
|
|
@@ -764,6 +780,14 @@ class BaseClient {
|
|
|
764
780
|
*
|
|
765
781
|
* @see {@link https://valkey.io/commands/del/|valkey.io} for details.
|
|
766
782
|
*
|
|
783
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
784
|
+
* the command will be split across these slots and executed separately for each.
|
|
785
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
786
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
787
|
+
* though some requests may have succeeded while others did not.
|
|
788
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
789
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
790
|
+
*
|
|
767
791
|
* @param keys - The keys we wanted to remove.
|
|
768
792
|
* @returns The number of keys that were removed.
|
|
769
793
|
*
|
|
@@ -859,7 +883,14 @@ class BaseClient {
|
|
|
859
883
|
/** Retrieve the values of multiple keys.
|
|
860
884
|
*
|
|
861
885
|
* @see {@link https://valkey.io/commands/mget/|valkey.io} for details.
|
|
862
|
-
*
|
|
886
|
+
*
|
|
887
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
888
|
+
* the command will be split across these slots and executed separately for each.
|
|
889
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
890
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
891
|
+
* though some requests may have succeeded while others did not.
|
|
892
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
893
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
863
894
|
*
|
|
864
895
|
* @param keys - A list of keys to retrieve values for.
|
|
865
896
|
* @param options - (Optional) See {@link DecoderOption}.
|
|
@@ -883,10 +914,18 @@ class BaseClient {
|
|
|
883
914
|
/** Set multiple keys to multiple values in a single operation.
|
|
884
915
|
*
|
|
885
916
|
* @see {@link https://valkey.io/commands/mset/|valkey.io} for details.
|
|
886
|
-
*
|
|
917
|
+
*
|
|
918
|
+
* @remarks In cluster mode, if keys in `keyValueMap` map to different hash slots,
|
|
919
|
+
* the command will be split across these slots and executed separately for each.
|
|
920
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
921
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
922
|
+
* though some requests may have succeeded while others did not.
|
|
923
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
924
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
887
925
|
*
|
|
888
926
|
* @param keysAndValues - A list of key-value pairs to set.
|
|
889
|
-
*
|
|
927
|
+
*
|
|
928
|
+
* @returns A simple "OK" response.
|
|
890
929
|
*
|
|
891
930
|
* @example
|
|
892
931
|
* ```typescript
|
|
@@ -1581,7 +1620,7 @@ class BaseClient {
|
|
|
1581
1620
|
*
|
|
1582
1621
|
* @param key - The key of the set.
|
|
1583
1622
|
* @param cursor - The cursor that points to the next iteration of results. A value of `"0"` indicates the start of the search.
|
|
1584
|
-
* @param options - (Optional)
|
|
1623
|
+
* @param options - (Optional) See {@link HScanOptions} and {@link DecoderOption}.
|
|
1585
1624
|
* @returns An array of the `cursor` and the subset of the hash held by `key`.
|
|
1586
1625
|
* The first element is always the `cursor` for the next iteration of results. `"0"` will be the `cursor`
|
|
1587
1626
|
* returned on the last iteration of the hash. The second element is always an array of the subset of the
|
|
@@ -2608,6 +2647,14 @@ class BaseClient {
|
|
|
2608
2647
|
/**
|
|
2609
2648
|
* Returns the number of keys in `keys` that exist in the database.
|
|
2610
2649
|
*
|
|
2650
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
2651
|
+
* the command will be split across these slots and executed separately for each.
|
|
2652
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
2653
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
2654
|
+
* though some requests may have succeeded while others did not.
|
|
2655
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
2656
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
2657
|
+
*
|
|
2611
2658
|
* @see {@link https://valkey.io/commands/exists/|valkey.io} for details.
|
|
2612
2659
|
*
|
|
2613
2660
|
* @param keys - The keys list to check.
|
|
@@ -2631,6 +2678,14 @@ class BaseClient {
|
|
|
2631
2678
|
* This command, similar to {@link del}, removes specified keys and ignores non-existent ones.
|
|
2632
2679
|
* However, this command does not block the server, while {@link https://valkey.io/commands/del|`DEL`} does.
|
|
2633
2680
|
*
|
|
2681
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
2682
|
+
* the command will be split across these slots and executed separately for each.
|
|
2683
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
2684
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
2685
|
+
* though some requests may have succeeded while others did not.
|
|
2686
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
2687
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
2688
|
+
*
|
|
2634
2689
|
* @see {@link https://valkey.io/commands/unlink/|valkey.io} for details.
|
|
2635
2690
|
*
|
|
2636
2691
|
* @param keys - The keys we wanted to unlink.
|
|
@@ -4475,7 +4530,6 @@ class BaseClient {
|
|
|
4475
4530
|
* attributes of a consumer group for the stream at `key`.
|
|
4476
4531
|
* @example
|
|
4477
4532
|
* ```typescript
|
|
4478
|
-
* <pre>{@code
|
|
4479
4533
|
* const result = await client.xinfoGroups("my_stream");
|
|
4480
4534
|
* console.log(result); // Output:
|
|
4481
4535
|
* // [
|
|
@@ -4823,13 +4877,11 @@ class BaseClient {
|
|
|
4823
4877
|
*
|
|
4824
4878
|
* @example
|
|
4825
4879
|
* ```typescript
|
|
4826
|
-
* <pre>{@code
|
|
4827
4880
|
* const entryId = await client.xadd("mystream", ["myfield", "mydata"]);
|
|
4828
4881
|
* // read messages from streamId
|
|
4829
4882
|
* const readResult = await client.xreadgroup(["myfield", "mydata"], "mygroup", "my0consumer");
|
|
4830
4883
|
* // acknowledge messages on stream
|
|
4831
4884
|
* console.log(await client.xack("mystream", "mygroup", [entryId])); // Output: 1
|
|
4832
|
-
* </pre>
|
|
4833
4885
|
* ```
|
|
4834
4886
|
*/
|
|
4835
4887
|
xack(key, group, ids) {
|
|
@@ -5825,7 +5877,14 @@ class BaseClient {
|
|
|
5825
5877
|
* Updates the last access time of the specified keys.
|
|
5826
5878
|
*
|
|
5827
5879
|
* @see {@link https://valkey.io/commands/touch/|valkey.io} for more details.
|
|
5828
|
-
*
|
|
5880
|
+
*
|
|
5881
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
5882
|
+
* the command will be split across these slots and executed separately for each.
|
|
5883
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
5884
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
5885
|
+
* though some requests may have succeeded while others did not.
|
|
5886
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
5887
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
5829
5888
|
*
|
|
5830
5889
|
* @param keys - The keys to update the last access time of.
|
|
5831
5890
|
* @returns The number of keys that were updated. A key is ignored if it doesn't exist.
|
|
@@ -5849,7 +5908,14 @@ class BaseClient {
|
|
|
5849
5908
|
* transaction. Executing a transaction will automatically flush all previously watched keys.
|
|
5850
5909
|
*
|
|
5851
5910
|
* @see {@link https://valkey.io/commands/watch/|valkey.io} and {@link https://valkey.io/topics/transactions/#cas|Valkey Glide Wiki} for more details.
|
|
5852
|
-
*
|
|
5911
|
+
*
|
|
5912
|
+
* @remarks In cluster mode, if keys in `keys` map to different hash slots,
|
|
5913
|
+
* the command will be split across these slots and executed separately for each.
|
|
5914
|
+
* This means the command is atomic only at the slot level. If one or more slot-specific
|
|
5915
|
+
* requests fail, the entire call will return the first encountered error, even
|
|
5916
|
+
* though some requests may have succeeded while others did not.
|
|
5917
|
+
* If this behavior impacts your application logic, consider splitting the
|
|
5918
|
+
* request into sub-requests per slot to ensure atomicity.
|
|
5853
5919
|
*
|
|
5854
5920
|
* @param keys - The keys to watch.
|
|
5855
5921
|
* @returns A simple `"OK"` response.
|
|
@@ -6194,6 +6260,7 @@ class BaseClient {
|
|
|
6194
6260
|
* @internal
|
|
6195
6261
|
*/
|
|
6196
6262
|
createClientRequest(options) {
|
|
6263
|
+
var _a;
|
|
6197
6264
|
const readFrom = options.readFrom
|
|
6198
6265
|
? this.MAP_READ_FROM_STRATEGY[options.readFrom]
|
|
6199
6266
|
: ProtobufMessage_1.connection_request.ReadFrom.Primary;
|
|
@@ -6217,6 +6284,7 @@ class BaseClient {
|
|
|
6217
6284
|
readFrom,
|
|
6218
6285
|
authenticationInfo,
|
|
6219
6286
|
inflightRequestsLimit: options.inflightRequestsLimit,
|
|
6287
|
+
clientAz: (_a = options.clientAz) !== null && _a !== void 0 ? _a : null,
|
|
6220
6288
|
};
|
|
6221
6289
|
}
|
|
6222
6290
|
/**
|
|
@@ -6288,6 +6356,47 @@ class BaseClient {
|
|
|
6288
6356
|
}
|
|
6289
6357
|
});
|
|
6290
6358
|
}
|
|
6359
|
+
/**
|
|
6360
|
+
* Update the current connection with a new password.
|
|
6361
|
+
*
|
|
6362
|
+
* This method is useful in scenarios where the server password has changed or when utilizing short-lived passwords for enhanced security.
|
|
6363
|
+
* It allows the client to update its password to reconnect upon disconnection without the need to recreate the client instance.
|
|
6364
|
+
* This ensures that the internal reconnection mechanism can handle reconnection seamlessly, preventing the loss of in-flight commands.
|
|
6365
|
+
*
|
|
6366
|
+
* This method updates the client's internal password configuration and does not perform password rotation on the server side.
|
|
6367
|
+
*
|
|
6368
|
+
* @param password - `String | null`. The new password to update the current password, or `null` to remove the current password.
|
|
6369
|
+
* @param immidiateAuth - A `boolean` flag. If `true`, the client will authenticate immediately with the new password against all connections, Using `AUTH` command.
|
|
6370
|
+
* If password supplied is an empty string, the client will not perform auth and instead a warning will be returned.
|
|
6371
|
+
* The default is `false`.
|
|
6372
|
+
*
|
|
6373
|
+
* @example
|
|
6374
|
+
* ```typescript
|
|
6375
|
+
* await client.updateConnectionPassword("newPassword", true) // "OK"
|
|
6376
|
+
* ```
|
|
6377
|
+
*/
|
|
6378
|
+
updateConnectionPassword(password_1) {
|
|
6379
|
+
return __awaiter(this, arguments, void 0, function* (password, immediateAuth = false) {
|
|
6380
|
+
var _a;
|
|
6381
|
+
const updateConnectionPassword = ProtobufMessage_1.command_request.UpdateConnectionPassword.create({
|
|
6382
|
+
password,
|
|
6383
|
+
immediateAuth,
|
|
6384
|
+
});
|
|
6385
|
+
const response = yield this.createWritePromise(updateConnectionPassword);
|
|
6386
|
+
if (response === "OK" && !((_a = this.config) === null || _a === void 0 ? void 0 : _a.credentials)) {
|
|
6387
|
+
this.config = Object.assign(Object.assign({}, this.config), { credentials: Object.assign(Object.assign({}, this.config.credentials), { password: password ? password : "" }) });
|
|
6388
|
+
}
|
|
6389
|
+
return response;
|
|
6390
|
+
});
|
|
6391
|
+
}
|
|
6392
|
+
/**
|
|
6393
|
+
* Return a statistics
|
|
6394
|
+
*
|
|
6395
|
+
* @return Return an object that contains the statistics collected internally by GLIDE core
|
|
6396
|
+
*/
|
|
6397
|
+
getStatistics() {
|
|
6398
|
+
return (0, glide_rs_1.getStatistics)();
|
|
6399
|
+
}
|
|
6291
6400
|
}
|
|
6292
6401
|
exports.BaseClient = BaseClient;
|
|
6293
6402
|
//# sourceMappingURL=BaseClient.js.map
|