@valkey/valkey-glide-darwin-arm64 1.2.1 → 1.3.0-rc2
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/build-ts/src/BaseClient.d.ts +44 -55
- package/build-ts/src/BaseClient.js +151 -170
- package/build-ts/src/BaseClient.js.map +1 -1
- package/build-ts/src/Commands.d.ts +30 -12
- package/build-ts/src/Commands.js +27 -17
- package/build-ts/src/Commands.js.map +1 -1
- package/build-ts/src/GlideClient.d.ts +2 -0
- package/build-ts/src/GlideClient.js +2 -0
- package/build-ts/src/GlideClient.js.map +1 -1
- package/build-ts/src/GlideClusterClient.d.ts +4 -1
- package/build-ts/src/GlideClusterClient.js +50 -3
- package/build-ts/src/GlideClusterClient.js.map +1 -1
- package/build-ts/src/ProtobufMessage.js +7 -0
- package/build-ts/src/ProtobufMessage.js.map +1 -1
- package/build-ts/src/Transaction.d.ts +7 -31
- package/build-ts/src/Transaction.js +6 -32
- package/build-ts/src/Transaction.js.map +1 -1
- package/build-ts/src/server-modules/GlideJson.d.ts +518 -12
- package/build-ts/src/server-modules/GlideJson.js +629 -13
- package/build-ts/src/server-modules/GlideJson.js.map +1 -1
- package/node_modules/glide-rs/glide-rs.darwin-arm64.node +0 -0
- package/npm/glide/index.ts +2 -0
- package/package.json +6 -3
- package/rust-client/node_modules/mingo/dist/cjs/index.js +5 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/_predicates.js +8 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/slice.js +0 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/setField.js +4 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/bucketAuto.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/util.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/index.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/_predicates.js +8 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/slice.js +0 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/setField.js +4 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/bucketAuto.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/util.js +1 -1
- package/rust-client/node_modules/mingo/package.json +1 -1
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
4
|
import { Script } from "glide-rs";
|
|
5
|
-
import { Buffer } from "protobufjs";
|
|
5
|
+
import { Buffer, Writer } from "protobufjs";
|
|
6
6
|
import { AggregationType, BaseScanOptions, BitFieldGet, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
7
|
BitFieldSubCommands, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
8
|
-
BitOffsetOptions,
|
|
8
|
+
BitOffsetOptions, BitwiseOperation, Boundary, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9
9
|
ExpireOptions, GeoAddOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
10
|
GeoSearchResultOptions, GeoSearchShape, GeoSearchStoreResultOptions, GeoUnit, GeospatialData, HScanOptions, InsertPosition, KeyWeight, LPosOptions, ListDirection, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
11
11
|
RangeByIndex, RangeByLex, RangeByScore, RestoreOptions, ScoreFilter, SearchOrigin, SetOptions, SortOptions, StreamAddOptions, StreamClaimOptions, StreamGroupOptions, StreamPendingOptions, StreamReadGroupOptions, StreamReadOptions, StreamTrimOptions, TimeUnit, ZAddOptions, ZScanOptions } from "./Commands";
|
|
12
12
|
import { ConnectionError, ValkeyError } from "./Errors";
|
|
13
13
|
import { GlideClientConfiguration } from "./GlideClient";
|
|
14
|
-
import { GlideClusterClientConfiguration } from "./GlideClusterClient";
|
|
14
|
+
import { GlideClusterClientConfiguration, Routes } from "./GlideClusterClient";
|
|
15
15
|
import { command_request, connection_request, response } from "./ProtobufMessage";
|
|
16
16
|
type PromiseFunction = (value?: any) => void;
|
|
17
17
|
type ErrorFunction = (error: ValkeyError) => void;
|
|
@@ -115,7 +115,10 @@ export type ReadFrom =
|
|
|
115
115
|
| "preferReplica"
|
|
116
116
|
/** Spread the requests between replicas in the same client's Aviliablity zone in a round robin manner.
|
|
117
117
|
If no replica is available, route the requests to the primary.*/
|
|
118
|
-
| "AZAffinity"
|
|
118
|
+
| "AZAffinity"
|
|
119
|
+
/** Spread the read requests among all nodes within the client's Availability Zone (AZ) in a round robin manner,
|
|
120
|
+
prioritizing local replicas, then the local primary, and falling back to any replica or the primary if needed.*/
|
|
121
|
+
| "AZAffinityReplicasAndPrimary";
|
|
119
122
|
/**
|
|
120
123
|
* Configuration settings for creating a client. Shared settings for standalone and cluster clients.
|
|
121
124
|
*
|
|
@@ -144,11 +147,11 @@ export type ReadFrom =
|
|
|
144
147
|
*
|
|
145
148
|
* ### Read Strategy
|
|
146
149
|
*
|
|
147
|
-
* - Use `readFrom` to specify the client's read strategy (e.g., primary, preferReplica, AZAffinity).
|
|
150
|
+
* - Use `readFrom` to specify the client's read strategy (e.g., primary, preferReplica, AZAffinity, AZAffinityReplicasAndPrimary).
|
|
148
151
|
*
|
|
149
152
|
* ### Availability Zone
|
|
150
153
|
*
|
|
151
|
-
* - Use `clientAz` to specify the client's availability zone, which can influence read operations when using `readFrom: 'AZAffinity'`.
|
|
154
|
+
* - Use `clientAz` to specify the client's availability zone, which can influence read operations when using `readFrom: 'AZAffinity'or `readFrom: 'AZAffinityReplicasAndPrimary'`.
|
|
152
155
|
*
|
|
153
156
|
* ### Decoder Settings
|
|
154
157
|
*
|
|
@@ -223,12 +226,12 @@ export interface BaseClientConfiguration {
|
|
|
223
226
|
*/
|
|
224
227
|
requestTimeout?: number;
|
|
225
228
|
/**
|
|
226
|
-
*
|
|
229
|
+
* The client's read from strategy.
|
|
227
230
|
* If not set, `Primary` will be used.
|
|
228
231
|
*/
|
|
229
232
|
readFrom?: ReadFrom;
|
|
230
233
|
/**
|
|
231
|
-
*
|
|
234
|
+
* Serialization protocol to be used.
|
|
232
235
|
* If not set, `RESP3` will be used.
|
|
233
236
|
*/
|
|
234
237
|
protocol?: ProtocolVersion;
|
|
@@ -250,13 +253,15 @@ export interface BaseClientConfiguration {
|
|
|
250
253
|
inflightRequestsLimit?: number;
|
|
251
254
|
/**
|
|
252
255
|
* Availability Zone of the client.
|
|
253
|
-
* If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to
|
|
256
|
+
* If ReadFrom strategy is AZAffinity or AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes within the specified AZ if they exist.
|
|
254
257
|
*
|
|
255
258
|
* @example
|
|
256
259
|
* ```typescript
|
|
257
260
|
* // Example configuration for setting client availability zone and read strategy
|
|
258
261
|
* configuration.clientAz = 'us-east-1a'; // Sets the client's availability zone
|
|
259
262
|
* configuration.readFrom = 'AZAffinity'; // Directs read operations to nodes within the same AZ
|
|
263
|
+
* Or
|
|
264
|
+
* configuration.readFrom = 'AZAffinityReplicasAndPrimary'; // Directs read operations to any node (primary or replica) within the same AZ
|
|
260
265
|
* ```
|
|
261
266
|
*/
|
|
262
267
|
clientAz?: string;
|
|
@@ -311,10 +316,7 @@ export interface PubSubMsg {
|
|
|
311
316
|
}
|
|
312
317
|
export declare class BaseClient {
|
|
313
318
|
private socket;
|
|
314
|
-
protected readonly promiseCallbackFunctions: [
|
|
315
|
-
PromiseFunction,
|
|
316
|
-
ErrorFunction
|
|
317
|
-
][];
|
|
319
|
+
protected readonly promiseCallbackFunctions: [PromiseFunction, ErrorFunction, Decoder | undefined][] | [PromiseFunction, ErrorFunction][];
|
|
318
320
|
private readonly availableCallbackSlots;
|
|
319
321
|
private requestWriter;
|
|
320
322
|
private writeInProgress;
|
|
@@ -325,16 +327,22 @@ export declare class BaseClient {
|
|
|
325
327
|
private readonly pubsubFutures;
|
|
326
328
|
private pendingPushNotification;
|
|
327
329
|
private readonly inflightRequestsLimit;
|
|
328
|
-
private readonly clientAz;
|
|
329
330
|
private config;
|
|
330
331
|
protected configurePubsub(options: GlideClusterClientConfiguration | GlideClientConfiguration, configuration: connection_request.IConnectionRequest): void;
|
|
331
332
|
private handleReadData;
|
|
333
|
+
protected toProtobufRoute(route: Routes | undefined): command_request.Routes | undefined;
|
|
332
334
|
processResponse(message: response.Response): void;
|
|
333
335
|
processPush(response: response.Response): void;
|
|
334
336
|
protected getCallbackIndex(): number;
|
|
335
337
|
private writeBufferedRequestsToSocket;
|
|
336
|
-
protected
|
|
337
|
-
|
|
338
|
+
protected ensureClientIsOpen(): void;
|
|
339
|
+
protected createUpdateConnectionPasswordPromise(command: command_request.UpdateConnectionPassword): Promise<GlideString>;
|
|
340
|
+
protected createScriptInvocationPromise<T = GlideString>(command: command_request.ScriptInvocation, options?: {
|
|
341
|
+
keys?: GlideString[];
|
|
342
|
+
args?: GlideString[];
|
|
343
|
+
} & DecoderOption): Promise<T>;
|
|
344
|
+
protected writeOrBufferCommandRequest(callbackIdx: number, command: command_request.Command | command_request.Command[], route?: command_request.Routes): void;
|
|
345
|
+
protected writeOrBufferRequest<TRequest>(message: TRequest, encodeDelimited: (message: TRequest, writer: Writer) => void): void;
|
|
338
346
|
cancelPubSubFuturesWithExceptionSafe(exception: ConnectionError): void;
|
|
339
347
|
isPubsubConfigured(config: GlideClientConfiguration | GlideClusterClientConfiguration): boolean;
|
|
340
348
|
getPubsubCallbackAndContext(config: GlideClientConfiguration | GlideClusterClientConfiguration): [((msg: PubSubMsg, context: any) => void) | null | undefined, any];
|
|
@@ -442,7 +450,8 @@ export declare class BaseClient {
|
|
|
442
450
|
* @param value - The value to store with the given key.
|
|
443
451
|
* @param options - (Optional) See {@link SetOptions} and {@link DecoderOption}.
|
|
444
452
|
* @returns - If the value is successfully set, return OK.
|
|
445
|
-
* If
|
|
453
|
+
* If `conditional` in `options` is not set, the value will be set regardless of prior value existence.
|
|
454
|
+
* If value isn't set because of `onlyIfExists` or `onlyIfDoesNotExist` or `onlyIfEqual` conditions, return `null`.
|
|
446
455
|
* If `returnOldValue` is set, return the old value as a string.
|
|
447
456
|
*
|
|
448
457
|
* @example
|
|
@@ -462,6 +471,13 @@ export declare class BaseClient {
|
|
|
462
471
|
* // Example usage of get method to retrieve the value of a key
|
|
463
472
|
* const result4 = await client.get("key");
|
|
464
473
|
* console.log(result4); // Output: 'new_value' - Value wasn't modified back to being "value" because of "NX" flag.
|
|
474
|
+
*
|
|
475
|
+
* // Example usage of set method with conditional option IFEQ
|
|
476
|
+
* await client.set("key", "value we will compare to");
|
|
477
|
+
* const result5 = await client.set("key", "new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
|
|
478
|
+
* console.log(result5); // Output: 'OK' - Set "new_value" to "key" only if comparisonValue is equal to the current value of "key".
|
|
479
|
+
* const result6 = await client.set("key", "another_new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
|
|
480
|
+
* console.log(result6); // Output: `null` - Value wasn't set because the comparisonValue is not equal to the current value of "key". Value of "key" remains "new_value".
|
|
465
481
|
* ```
|
|
466
482
|
*/
|
|
467
483
|
set(key: GlideString, value: GlideString, options?: SetOptions & DecoderOption): Promise<"OK" | GlideString | null>;
|
|
@@ -787,11 +803,12 @@ export declare class BaseClient {
|
|
|
787
803
|
* The offset can also be a negative number indicating an offset starting at the end of the list, with `-1` being
|
|
788
804
|
* the last byte of the list, `-2` being the penultimate, and so on.
|
|
789
805
|
*
|
|
790
|
-
* @see {@link https://valkey.io/commands/bitpos/|valkey.io} for
|
|
806
|
+
* @see {@link https://valkey.io/commands/bitpos/|valkey.io} for details.
|
|
791
807
|
*
|
|
792
808
|
* @param key - The key of the string.
|
|
793
809
|
* @param bit - The bit value to match. Must be `0` or `1`.
|
|
794
|
-
* @param
|
|
810
|
+
* @param options - (Optional) The {@link BitOffsetOptions}.
|
|
811
|
+
*
|
|
795
812
|
* @returns The position of the first occurrence of `bit` in the binary value of the string held at `key`.
|
|
796
813
|
* If `start` was provided, the search begins at the offset indicated by `start`.
|
|
797
814
|
*
|
|
@@ -801,45 +818,18 @@ export declare class BaseClient {
|
|
|
801
818
|
* const result1 = await client.bitpos("key1", 1);
|
|
802
819
|
* console.log(result1); // Output: 1 - The first occurrence of bit value 1 in the string stored at "key1" is at the second position.
|
|
803
820
|
*
|
|
804
|
-
* const result2 = await client.bitpos("key1", 1, -1);
|
|
821
|
+
* const result2 = await client.bitpos("key1", 1, { start: -1 });
|
|
805
822
|
* console.log(result2); // Output: 10 - The first occurrence of bit value 1, starting at the last byte in the string stored at "key1", is at the eleventh position.
|
|
806
|
-
* ```
|
|
807
|
-
*/
|
|
808
|
-
bitpos(key: GlideString, bit: number, start?: number): Promise<number>;
|
|
809
|
-
/**
|
|
810
|
-
* Returns the position of the first bit matching the given `bit` value. The offsets are zero-based indexes, with
|
|
811
|
-
* `0` being the first element of the list, `1` being the next, and so on. These offsets can also be negative
|
|
812
|
-
* numbers indicating offsets starting at the end of the list, with `-1` being the last element of the list, `-2`
|
|
813
|
-
* being the penultimate, and so on.
|
|
814
|
-
*
|
|
815
|
-
* If you are using Valkey 7.0.0 or above, the optional `indexType` can also be provided to specify whether the
|
|
816
|
-
* `start` and `end` offsets specify BIT or BYTE offsets. If `indexType` is not provided, BYTE offsets
|
|
817
|
-
* are assumed. If BIT is specified, `start=0` and `end=2` means to look at the first three bits. If BYTE is
|
|
818
|
-
* specified, `start=0` and `end=2` means to look at the first three bytes.
|
|
819
823
|
*
|
|
820
|
-
* @see {@link https://valkey.io/commands/bitpos/|valkey.io} for more details.
|
|
821
|
-
*
|
|
822
|
-
* @param key - The key of the string.
|
|
823
|
-
* @param bit - The bit value to match. Must be `0` or `1`.
|
|
824
|
-
* @param start - The starting offset.
|
|
825
|
-
* @param end - The ending offset.
|
|
826
|
-
* @param indexType - (Optional) The index offset type. This option can only be specified if you are using Valkey
|
|
827
|
-
* version 7.0.0 or above. Could be either {@link BitmapIndexType.BYTE} or {@link BitmapIndexType.BIT}. If no
|
|
828
|
-
* index type is provided, the indexes will be assumed to be byte indexes.
|
|
829
|
-
* @returns The position of the first occurrence from the `start` to the `end` offsets of the `bit` in the binary
|
|
830
|
-
* value of the string held at `key`.
|
|
831
|
-
*
|
|
832
|
-
* @example
|
|
833
|
-
* ```typescript
|
|
834
824
|
* await client.set("key1", "A12"); // "A12" has binary value 01000001 00110001 00110010
|
|
835
|
-
* const
|
|
836
|
-
* console.log(
|
|
825
|
+
* const result3 = await client.bitpos("key1", 1, { start: 1, end: -1 });
|
|
826
|
+
* console.log(result3); // Output: 10 - The first occurrence of bit value 1 in the second byte to the last byte of the string stored at "key1" is at the eleventh position.
|
|
837
827
|
*
|
|
838
|
-
* const
|
|
839
|
-
* console.log(
|
|
828
|
+
* const result4 = await client.bitpos("key1", 1, { start: 2, end: 9, indexType: BitmapIndexType.BIT });
|
|
829
|
+
* console.log(result4); // Output: 7 - The first occurrence of bit value 1 in the third to tenth bits of the string stored at "key1" is at the eighth position.
|
|
840
830
|
* ```
|
|
841
831
|
*/
|
|
842
|
-
|
|
832
|
+
bitpos(key: GlideString, bit: number, options?: BitOffsetOptions): Promise<number>;
|
|
843
833
|
/**
|
|
844
834
|
* Reads or modifies the array of bits representing the string that is held at `key` based on the specified
|
|
845
835
|
* `subcommands`.
|
|
@@ -2787,7 +2777,6 @@ export declare class BaseClient {
|
|
|
2787
2777
|
* @param key - The key of the sorted set.
|
|
2788
2778
|
* @param rangeQuery - The range query object representing the type of range query to perform.
|
|
2789
2779
|
* - For range queries by index (rank), use {@link RangeByIndex}.
|
|
2790
|
-
* - For range queries by lexicographical order, use {@link RangeByLex}.
|
|
2791
2780
|
* - For range queries by score, use {@link RangeByScore}.
|
|
2792
2781
|
* @param options - (Optional) Additional parameters:
|
|
2793
2782
|
* - (Optional) `reverse`: if `true`, reverses the sorted set, with index `0` as the element with the highest score.
|
|
@@ -2818,7 +2807,7 @@ export declare class BaseClient {
|
|
|
2818
2807
|
* // [{ element: 'member7', score: 1.5 }, { element: 'member4', score: -2.0 }]
|
|
2819
2808
|
* ```
|
|
2820
2809
|
*/
|
|
2821
|
-
zrangeWithScores(key: GlideString, rangeQuery: RangeByScore |
|
|
2810
|
+
zrangeWithScores(key: GlideString, rangeQuery: RangeByScore | RangeByIndex, options?: {
|
|
2822
2811
|
reverse?: boolean;
|
|
2823
2812
|
} & DecoderOption): Promise<SortedSetDataType>;
|
|
2824
2813
|
/**
|
|
@@ -4390,7 +4379,7 @@ export declare class BaseClient {
|
|
|
4390
4379
|
* @see {@link https://valkey.io/commands/bitcount/|valkey.io} for more details.
|
|
4391
4380
|
*
|
|
4392
4381
|
* @param key - The key for the string to count the set bits of.
|
|
4393
|
-
* @param options - The offset options.
|
|
4382
|
+
* @param options - The offset options - see {@link BitOffsetOptions}.
|
|
4394
4383
|
* @returns If `options` is provided, returns the number of set bits in the string interval specified by `options`.
|
|
4395
4384
|
* If `options` is not provided, returns the number of set bits in the string stored at `key`.
|
|
4396
4385
|
* Otherwise, if `key` is missing, returns `0` as it is treated as an empty string.
|