@valkey/valkey-glide 1.2.0-rc003 → 1.2.0-rc8

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 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 12.7 (Apple silicon/aarch_64 and Intel/x86_64)
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
- Currentlly the package is supported on:
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` | `x86_64`, `arm64` |
104
+ | `macOS` | `Darwin` | `arm64` |
@@ -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
@@ -65,7 +65,7 @@ function loadNativeBinding() {
65
65
  }
66
66
  function initialize() {
67
67
  const nativeBinding = loadNativeBinding();
68
- const { AggregationType, BaseScanOptions, ZScanOptions, HScanOptions, BitEncoding, BitFieldGet, BitFieldIncrBy, BitFieldOffset, BitFieldOverflow, BitFieldSet, BitFieldSubCommands, BitOffset, BitOffsetMultiplier, BitOffsetOptions, BitOverflowControl, BitmapIndexType, BitwiseOperation, ConditionalChange, Decoder, DecoderOption, GeoAddOptions, CoordOrigin, MemberOrigin, SearchOrigin, GeoBoxShape, GeoCircleShape, GeoSearchShape, GeoSearchResultOptions, GeoSearchStoreResultOptions, SortOrder, GeoUnit, GeospatialData, GlideClient, GlideClusterClient, GlideClientConfiguration, GlideJson, GlideRecord, GlideString, JsonGetOptions, SortedSetDataType, StreamEntryDataType, HashDataType, FunctionListOptions, FunctionListResponse, FunctionStatsSingleResponse, FunctionStatsFullResponse, FunctionRestorePolicy, SlotIdTypes, SlotKeyTypes, TimeUnit, RouteByAddress, RouteOption, Routes, RestoreOptions, SingleNodeRoute, PeriodicChecksManualInterval, PeriodicChecks, Logger, Limit, LolwutOptions, LPosOptions, ListDirection, ExpireOptions, FlushMode, InfoOptions, InsertPosition, SetOptions, ZAddOptions, InfBoundary, KeyWeight, Boundary, UpdateOptions, ProtocolVersion, RangeByIndex, RangeByScore, RangeByLex, ReadFrom, ServerCredentials, SortClusterOptions, SortOptions, SortedSetRange, StreamGroupOptions, StreamTrimOptions, StreamAddOptions, StreamReadGroupOptions, StreamReadOptions, StreamClaimOptions, StreamPendingOptions, ClosingError, ConfigurationError, ExecAbortError, ValkeyError, GlideReturnType, StreamEntries, ReturnTypeXinfoStream, RequestError, TimeoutError, ConnectionError, ClusterTransaction, Transaction, PubSubMsg, ScoreFilter, SignedEncoding, UnsignedEncoding, UpdateByScore, createLeakedArray, createLeakedAttribute, createLeakedBigint, createLeakedDouble, createLeakedMap, createLeakedString, parseInfoResponse, Script, ObjectType, ClusterScanCursor, BaseClientConfiguration, GlideClusterClientConfiguration, LevelOptions, ReturnTypeRecord, ReturnTypeMap, ClusterResponse, ReturnTypeAttribute, } = nativeBinding;
68
+ const { AggregationType, BaseScanOptions, ZScanOptions, HScanOptions, BitEncoding, BitFieldGet, BitFieldIncrBy, BitFieldOffset, BitFieldOverflow, BitFieldSet, BitFieldSubCommands, BitOffset, BitOffsetMultiplier, BitOffsetOptions, BitOverflowControl, BitmapIndexType, BitwiseOperation, ConditionalChange, Decoder, DecoderOption, GeoAddOptions, CoordOrigin, MemberOrigin, SearchOrigin, GeoBoxShape, GeoCircleShape, GeoSearchShape, GeoSearchResultOptions, GeoSearchStoreResultOptions, SortOrder, GeoUnit, GeospatialData, GlideClient, GlideClusterClient, GlideClientConfiguration, GlideJson, GlideFt, TextField, TagField, NumericField, VectorField, VectorFieldAttributesFlat, VectorFieldAttributesHnsw, FtCreateOptions, FtSearchOptions, FtInfoReturnType, FtAggregateOptions, FtAggregateLimit, FtAggregateFilter, FtAggregateGroupBy, FtAggregateReducer, FtAggregateSortBy, FtAggregateSortProperty, FtAggregateApply, FtAggregateReturnType, FtSearchReturnType, FtProfileOtions, GlideRecord, GlideString, JsonGetOptions, JsonArrPopOptions, SortedSetDataType, StreamEntryDataType, HashDataType, FunctionListOptions, FunctionListResponse, FunctionStatsSingleResponse, FunctionStatsFullResponse, FunctionRestorePolicy, SlotIdTypes, SlotKeyTypes, TimeUnit, RouteByAddress, RouteOption, Routes, RestoreOptions, SingleNodeRoute, PeriodicChecksManualInterval, PeriodicChecks, Logger, Limit, LolwutOptions, LPosOptions, ListDirection, ExpireOptions, FlushMode, InfoOptions, InsertPosition, SetOptions, ZAddOptions, InfBoundary, KeyWeight, Boundary, UpdateOptions, ProtocolVersion, RangeByIndex, RangeByScore, RangeByLex, ReadFrom, ServerCredentials, SortClusterOptions, SortOptions, SortedSetRange, StreamGroupOptions, StreamTrimOptions, StreamAddOptions, StreamReadGroupOptions, StreamReadOptions, StreamClaimOptions, StreamPendingOptions, ClosingError, ConfigurationError, ExecAbortError, ValkeyError, GlideReturnType, StreamEntries, ReturnTypeXinfoStream, RequestError, TimeoutError, ConnectionError, ClusterTransaction, Transaction, PubSubMsg, ScoreFilter, SignedEncoding, UnsignedEncoding, UpdateByScore, createLeakedArray, createLeakedAttribute, createLeakedBigint, createLeakedDouble, createLeakedMap, createLeakedString, parseInfoResponse, Script, ObjectType, ClusterScanCursor, BaseClientConfiguration, GlideClusterClientConfiguration, LevelOptions, ReturnTypeRecord, ReturnTypeMap, ClusterResponse, ReturnTypeAttribute, ReturnTypeJson, UniversalReturnTypeJson, } = nativeBinding;
69
69
  module.exports = {
70
70
  AggregationType,
71
71
  BaseScanOptions,
@@ -88,10 +88,32 @@ function initialize() {
88
88
  Decoder,
89
89
  DecoderOption,
90
90
  GeoAddOptions,
91
+ GlideFt,
92
+ TextField,
93
+ TagField,
94
+ NumericField,
95
+ VectorField,
96
+ VectorFieldAttributesFlat,
97
+ VectorFieldAttributesHnsw,
98
+ FtCreateOptions,
99
+ FtSearchOptions,
100
+ FtInfoReturnType,
101
+ FtAggregateOptions,
102
+ FtAggregateLimit,
103
+ FtAggregateFilter,
104
+ FtAggregateGroupBy,
105
+ FtAggregateReducer,
106
+ FtAggregateSortBy,
107
+ FtAggregateSortProperty,
108
+ FtAggregateApply,
109
+ FtAggregateReturnType,
110
+ FtSearchReturnType,
111
+ FtProfileOtions,
91
112
  GlideRecord,
92
113
  GlideJson,
93
114
  GlideString,
94
115
  JsonGetOptions,
116
+ JsonArrPopOptions,
95
117
  SortedSetDataType,
96
118
  StreamEntryDataType,
97
119
  HashDataType,
@@ -189,6 +211,8 @@ function initialize() {
189
211
  ReturnTypeMap,
190
212
  ClusterResponse,
191
213
  ReturnTypeAttribute,
214
+ ReturnTypeJson,
215
+ UniversalReturnTypeJson,
192
216
  };
193
217
  globalObject = Object.assign(global, nativeBinding);
194
218
  }
@@ -136,7 +136,10 @@ export type ReadFrom =
136
136
  "primary"
137
137
  /** Spread the requests between all replicas in a round robin manner.
138
138
  If no replica is available, route the requests to the primary.*/
139
- | "preferReplica";
139
+ | "preferReplica"
140
+ /** Spread the requests between replicas in the same client's Aviliablity zone in a round robin manner.
141
+ If no replica is available, route the requests to the primary.*/
142
+ | "AZAffinity";
140
143
  /**
141
144
  * Configuration settings for creating a client. Shared settings for standalone and cluster clients.
142
145
  */
@@ -208,6 +211,18 @@ export interface BaseClientConfiguration {
208
211
  * used.
209
212
  */
210
213
  inflightRequestsLimit?: number;
214
+ /**
215
+ * Availability Zone of the client.
216
+ * If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits.
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * // Example configuration for setting client availability zone and read strategy
221
+ * configuration.clientAz = 'us-east-1a'; // Sets the client's availability zone
222
+ * configuration.readFrom = 'AZAffinity'; // Directs read operations to nodes within the same AZ
223
+ * ```
224
+ */
225
+ clientAz?: string;
211
226
  }
212
227
  /**
213
228
  * Enum of Valkey data types
@@ -253,6 +268,7 @@ export declare class BaseClient {
253
268
  private readonly pubsubFutures;
254
269
  private pendingPushNotification;
255
270
  private readonly inflightRequestsLimit;
271
+ private readonly clientAz;
256
272
  private config;
257
273
  protected configurePubsub(options: GlideClusterClientConfiguration | GlideClientConfiguration, configuration: connection_request.IConnectionRequest): void;
258
274
  private handleReadData;
@@ -267,8 +283,8 @@ export declare class BaseClient {
267
283
  /**
268
284
  * @internal
269
285
  */
270
- protected createWritePromise<T>(command: command_request.Command | command_request.Command[] | command_request.ScriptInvocation | command_request.ClusterScan, options?: WritePromiseOptions): Promise<T>;
271
- protected writeOrBufferCommandRequest(callbackIdx: number, command: command_request.Command | command_request.Command[] | command_request.ScriptInvocation | command_request.ClusterScan, route?: command_request.Routes): void;
286
+ protected createWritePromise<T>(command: command_request.Command | command_request.Command[] | command_request.ScriptInvocation | command_request.ClusterScan | command_request.UpdateConnectionPassword, options?: WritePromiseOptions): Promise<T>;
287
+ 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;
272
288
  private writeOrBufferRequest;
273
289
  /**
274
290
  * @internal
@@ -409,6 +425,14 @@ export declare class BaseClient {
409
425
  *
410
426
  * @see {@link https://valkey.io/commands/del/|valkey.io} for details.
411
427
  *
428
+ * @remarks In cluster mode, if keys in `keys` map to different hash slots,
429
+ * the command will be split across these slots and executed separately for each.
430
+ * This means the command is atomic only at the slot level. If one or more slot-specific
431
+ * requests fail, the entire call will return the first encountered error, even
432
+ * though some requests may have succeeded while others did not.
433
+ * If this behavior impacts your application logic, consider splitting the
434
+ * request into sub-requests per slot to ensure atomicity.
435
+ *
412
436
  * @param keys - The keys we wanted to remove.
413
437
  * @returns The number of keys that were removed.
414
438
  *
@@ -490,7 +514,14 @@ export declare class BaseClient {
490
514
  /** Retrieve the values of multiple keys.
491
515
  *
492
516
  * @see {@link https://valkey.io/commands/mget/|valkey.io} for details.
493
- * @remarks When in cluster mode, the command may route to multiple nodes when `keys` map to different hash slots.
517
+ *
518
+ * @remarks In cluster mode, if keys in `keys` map to different hash slots,
519
+ * the command will be split across these slots and executed separately for each.
520
+ * This means the command is atomic only at the slot level. If one or more slot-specific
521
+ * requests fail, the entire call will return the first encountered error, even
522
+ * though some requests may have succeeded while others did not.
523
+ * If this behavior impacts your application logic, consider splitting the
524
+ * request into sub-requests per slot to ensure atomicity.
494
525
  *
495
526
  * @param keys - A list of keys to retrieve values for.
496
527
  * @param options - (Optional) See {@link DecoderOption}.
@@ -510,10 +541,18 @@ export declare class BaseClient {
510
541
  /** Set multiple keys to multiple values in a single operation.
511
542
  *
512
543
  * @see {@link https://valkey.io/commands/mset/|valkey.io} for details.
513
- * @remarks When in cluster mode, the command may route to multiple nodes when keys in `keyValueMap` map to different hash slots.
544
+ *
545
+ * @remarks In cluster mode, if keys in `keyValueMap` map to different hash slots,
546
+ * the command will be split across these slots and executed separately for each.
547
+ * This means the command is atomic only at the slot level. If one or more slot-specific
548
+ * requests fail, the entire call will return the first encountered error, even
549
+ * though some requests may have succeeded while others did not.
550
+ * If this behavior impacts your application logic, consider splitting the
551
+ * request into sub-requests per slot to ensure atomicity.
514
552
  *
515
553
  * @param keysAndValues - A list of key-value pairs to set.
516
- * @returns always "OK".
554
+ *
555
+ * @returns A simple "OK" response.
517
556
  *
518
557
  * @example
519
558
  * ```typescript
@@ -1094,7 +1133,7 @@ export declare class BaseClient {
1094
1133
  *
1095
1134
  * @param key - The key of the set.
1096
1135
  * @param cursor - The cursor that points to the next iteration of results. A value of `"0"` indicates the start of the search.
1097
- * @param options - (Optional) The {@link HScanOptions}.
1136
+ * @param options - (Optional) See {@link HScanOptions} and {@link DecoderOption}.
1098
1137
  * @returns An array of the `cursor` and the subset of the hash held by `key`.
1099
1138
  * The first element is always the `cursor` for the next iteration of results. `"0"` will be the `cursor`
1100
1139
  * returned on the last iteration of the hash. The second element is always an array of the subset of the
@@ -1971,6 +2010,14 @@ export declare class BaseClient {
1971
2010
  /**
1972
2011
  * Returns the number of keys in `keys` that exist in the database.
1973
2012
  *
2013
+ * @remarks In cluster mode, if keys in `keys` map to different hash slots,
2014
+ * the command will be split across these slots and executed separately for each.
2015
+ * This means the command is atomic only at the slot level. If one or more slot-specific
2016
+ * requests fail, the entire call will return the first encountered error, even
2017
+ * though some requests may have succeeded while others did not.
2018
+ * If this behavior impacts your application logic, consider splitting the
2019
+ * request into sub-requests per slot to ensure atomicity.
2020
+ *
1974
2021
  * @see {@link https://valkey.io/commands/exists/|valkey.io} for details.
1975
2022
  *
1976
2023
  * @param keys - The keys list to check.
@@ -1990,6 +2037,14 @@ export declare class BaseClient {
1990
2037
  * This command, similar to {@link del}, removes specified keys and ignores non-existent ones.
1991
2038
  * However, this command does not block the server, while {@link https://valkey.io/commands/del|`DEL`} does.
1992
2039
  *
2040
+ * @remarks In cluster mode, if keys in `keys` map to different hash slots,
2041
+ * the command will be split across these slots and executed separately for each.
2042
+ * This means the command is atomic only at the slot level. If one or more slot-specific
2043
+ * requests fail, the entire call will return the first encountered error, even
2044
+ * though some requests may have succeeded while others did not.
2045
+ * If this behavior impacts your application logic, consider splitting the
2046
+ * request into sub-requests per slot to ensure atomicity.
2047
+ *
1993
2048
  * @see {@link https://valkey.io/commands/unlink/|valkey.io} for details.
1994
2049
  *
1995
2050
  * @param keys - The keys we wanted to unlink.
@@ -3607,7 +3662,6 @@ export declare class BaseClient {
3607
3662
  * attributes of a consumer group for the stream at `key`.
3608
3663
  * @example
3609
3664
  * ```typescript
3610
- * <pre>{@code
3611
3665
  * const result = await client.xinfoGroups("my_stream");
3612
3666
  * console.log(result); // Output:
3613
3667
  * // [
@@ -3919,13 +3973,11 @@ export declare class BaseClient {
3919
3973
  *
3920
3974
  * @example
3921
3975
  * ```typescript
3922
- * <pre>{@code
3923
3976
  * const entryId = await client.xadd("mystream", ["myfield", "mydata"]);
3924
3977
  * // read messages from streamId
3925
3978
  * const readResult = await client.xreadgroup(["myfield", "mydata"], "mygroup", "my0consumer");
3926
3979
  * // acknowledge messages on stream
3927
3980
  * console.log(await client.xack("mystream", "mygroup", [entryId])); // Output: 1
3928
- * </pre>
3929
3981
  * ```
3930
3982
  */
3931
3983
  xack(key: GlideString, group: GlideString, ids: string[]): Promise<number>;
@@ -4788,7 +4840,14 @@ export declare class BaseClient {
4788
4840
  * Updates the last access time of the specified keys.
4789
4841
  *
4790
4842
  * @see {@link https://valkey.io/commands/touch/|valkey.io} for more details.
4791
- * @remarks When in cluster mode, the command may route to multiple nodes when `keys` map to different hash slots.
4843
+ *
4844
+ * @remarks In cluster mode, if keys in `keys` map to different hash slots,
4845
+ * the command will be split across these slots and executed separately for each.
4846
+ * This means the command is atomic only at the slot level. If one or more slot-specific
4847
+ * requests fail, the entire call will return the first encountered error, even
4848
+ * though some requests may have succeeded while others did not.
4849
+ * If this behavior impacts your application logic, consider splitting the
4850
+ * request into sub-requests per slot to ensure atomicity.
4792
4851
  *
4793
4852
  * @param keys - The keys to update the last access time of.
4794
4853
  * @returns The number of keys that were updated. A key is ignored if it doesn't exist.
@@ -4808,7 +4867,14 @@ export declare class BaseClient {
4808
4867
  * transaction. Executing a transaction will automatically flush all previously watched keys.
4809
4868
  *
4810
4869
  * @see {@link https://valkey.io/commands/watch/|valkey.io} and {@link https://valkey.io/topics/transactions/#cas|Valkey Glide Wiki} for more details.
4811
- * @remarks When in cluster mode, the command may route to multiple nodes when `keys` map to different hash slots.
4870
+ *
4871
+ * @remarks In cluster mode, if keys in `keys` map to different hash slots,
4872
+ * the command will be split across these slots and executed separately for each.
4873
+ * This means the command is atomic only at the slot level. If one or more slot-specific
4874
+ * requests fail, the entire call will return the first encountered error, even
4875
+ * though some requests may have succeeded while others did not.
4876
+ * If this behavior impacts your application logic, consider splitting the
4877
+ * request into sub-requests per slot to ensure atomicity.
4812
4878
  *
4813
4879
  * @param keys - The keys to watch.
4814
4880
  * @returns A simple `"OK"` response.
@@ -5130,5 +5196,25 @@ export declare class BaseClient {
5130
5196
  * @internal
5131
5197
  */
5132
5198
  protected static createClientInternal<TConnection extends BaseClient>(options: BaseClientConfiguration, constructor: (socket: net.Socket, options?: BaseClientConfiguration) => TConnection): Promise<TConnection>;
5199
+ /**
5200
+ * Update the current connection with a new password.
5201
+ *
5202
+ * This method is useful in scenarios where the server password has changed or when utilizing short-lived passwords for enhanced security.
5203
+ * It allows the client to update its password to reconnect upon disconnection without the need to recreate the client instance.
5204
+ * This ensures that the internal reconnection mechanism can handle reconnection seamlessly, preventing the loss of in-flight commands.
5205
+ *
5206
+ * This method updates the client's internal password configuration and does not perform password rotation on the server side.
5207
+ *
5208
+ * @param password - `String | null`. The new password to update the current password, or `null` to remove the current password.
5209
+ * @param immidiateAuth - A `boolean` flag. If `true`, the client will authenticate immediately with the new password against all connections, Using `AUTH` command.
5210
+ * If password supplied is an empty string, the client will not perform auth and instead a warning will be returned.
5211
+ * The default is `false`.
5212
+ *
5213
+ * @example
5214
+ * ```typescript
5215
+ * await client.updateConnectionPassword("newPassword", true) // "OK"
5216
+ * ```
5217
+ */
5218
+ updateConnectionPassword(password: string | null, immediateAuth?: boolean): Promise<GlideString>;
5133
5219
  }
5134
5220
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@valkey/valkey-glide",
3
3
  "types": "build-ts/index.d.ts",
4
- "version": "1.2.0-rc003",
4
+ "version": "1.2.0-rc8",
5
5
  "description": "General Language Independent Driver for the Enterprise (GLIDE) for Valkey",
6
6
  "main": "build-ts/index.js",
7
7
  "module": "build-ts/index.js",
@@ -40,12 +40,12 @@
40
40
  "typescript": "^4.9.4"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@valkey/valkey-glide-darwin-arm64": "1.2.0-rc003",
44
- "@valkey/valkey-glide-darwin-x64": "1.2.0-rc003",
45
- "@valkey/valkey-glide-linux-arm64": "1.2.0-rc003",
46
- "@valkey/valkey-glide-linux-x64": "1.2.0-rc003",
47
- "@valkey/valkey-glide-linux-musl-arm64": "1.2.0-rc003",
48
- "@valkey/valkey-glide-linux-musl-x64": "1.2.0-rc003"
43
+ "@valkey/valkey-glide-darwin-arm64": "1.2.0-rc8",
44
+ "@valkey/valkey-glide-darwin-x64": "1.2.0-rc8",
45
+ "@valkey/valkey-glide-linux-arm64": "1.2.0-rc8",
46
+ "@valkey/valkey-glide-linux-x64": "1.2.0-rc8",
47
+ "@valkey/valkey-glide-linux-musl-arm64": "1.2.0-rc8",
48
+ "@valkey/valkey-glide-linux-musl-x64": "1.2.0-rc8"
49
49
  },
50
50
  "eslintConfig": {
51
51
  "extends": [