@valkey/valkey-glide 1.2.0 → 1.2.1-rc0
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/index.js
CHANGED
|
@@ -45,9 +45,6 @@ function loadNativeBinding() {
|
|
|
45
45
|
break;
|
|
46
46
|
case "darwin":
|
|
47
47
|
switch (process_1.arch) {
|
|
48
|
-
case "x64":
|
|
49
|
-
nativeBinding = require("@valkey/valkey-glide-darwin-x64");
|
|
50
|
-
break;
|
|
51
48
|
case "arm64":
|
|
52
49
|
nativeBinding = require("@valkey/valkey-glide-darwin-arm64");
|
|
53
50
|
break;
|
|
@@ -65,7 +62,7 @@ function loadNativeBinding() {
|
|
|
65
62
|
}
|
|
66
63
|
function initialize() {
|
|
67
64
|
const nativeBinding = loadNativeBinding();
|
|
68
|
-
const { AggregationType, BaseScanOptions, ScanOptions, 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, Field, TextField, TagField, NumericField, VectorField, VectorFieldAttributesFlat, VectorFieldAttributesHnsw, FtCreateOptions, FtSearchOptions, FtInfoReturnType, FtAggregateOptions, FtAggregateLimit, FtAggregateFilter, FtAggregateGroupBy, FtAggregateReducer, FtAggregateSortBy, FtAggregateSortProperty, FtAggregateApply, FtAggregateReturnType, FtSearchReturnType, 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, ProtocolVersion, RangeByIndex, RangeByScore, RangeByLex, ReadFrom, ServerCredentials, SortOptions, 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, Script, ObjectType, ClusterScanCursor, BaseClientConfiguration, GlideClusterClientConfiguration, LevelOptions, ReturnTypeRecord, ReturnTypeMap, ClusterResponse, ReturnTypeAttribute, ReturnTypeJson, UniversalReturnTypeJson, } = nativeBinding;
|
|
65
|
+
const { AggregationType, BaseScanOptions, ScanOptions, 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, Field, TextField, TagField, NumericField, VectorField, VectorFieldAttributesFlat, VectorFieldAttributesHnsw, FtCreateOptions, FtSearchOptions, FtInfoReturnType, FtAggregateOptions, FtAggregateLimit, FtAggregateFilter, FtAggregateGroupBy, FtAggregateReducer, FtAggregateSortBy, FtAggregateSortProperty, FtAggregateApply, FtAggregateReturnType, FtSearchReturnType, 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, ProtocolVersion, RangeByIndex, RangeByScore, RangeByLex, ReadFrom, ServerCredentials, SortOptions, 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, Script, ObjectType, ClusterScanCursor, AdvancedGlideClientConfiguration, AdvancedGlideClusterClientConfiguration, BaseClientConfiguration, GlideClusterClientConfiguration, LevelOptions, ReturnTypeRecord, ReturnTypeMap, ClusterResponse, ReturnTypeAttribute, ReturnTypeJson, UniversalReturnTypeJson, } = nativeBinding;
|
|
69
66
|
module.exports = {
|
|
70
67
|
AggregationType,
|
|
71
68
|
BaseScanOptions,
|
|
@@ -132,6 +129,8 @@ function initialize() {
|
|
|
132
129
|
GlideClient,
|
|
133
130
|
GlideClusterClient,
|
|
134
131
|
GlideClientConfiguration,
|
|
132
|
+
AdvancedGlideClientConfiguration,
|
|
133
|
+
AdvancedGlideClusterClientConfiguration,
|
|
135
134
|
FunctionListOptions,
|
|
136
135
|
FunctionListResponse,
|
|
137
136
|
FunctionStatsSingleResponse,
|
|
@@ -242,7 +242,7 @@ export interface BaseClientConfiguration {
|
|
|
242
242
|
* The duration in milliseconds that the client should wait for a request to complete.
|
|
243
243
|
* This duration encompasses sending the request, awaiting for a response from the server, and any required reconnections or retries.
|
|
244
244
|
* If the specified timeout is exceeded for a pending request, it will result in a timeout error.
|
|
245
|
-
* If not set, a default value will be used.
|
|
245
|
+
* If not explicitly set, a default value of 250 milliseconds will be used.
|
|
246
246
|
* Value must be an integer.
|
|
247
247
|
*/
|
|
248
248
|
requestTimeout?: number;
|
|
@@ -285,6 +285,32 @@ export interface BaseClientConfiguration {
|
|
|
285
285
|
*/
|
|
286
286
|
clientAz?: string;
|
|
287
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Represents advanced configuration settings for a client, including connection-related options.
|
|
290
|
+
*
|
|
291
|
+
* @remarks
|
|
292
|
+
* The `AdvancedBaseClientConfiguration` interface defines advanced configuration settings for managing the client's connection behavior.
|
|
293
|
+
*
|
|
294
|
+
* ### Connection Timeout
|
|
295
|
+
*
|
|
296
|
+
* - **Connection Timeout**: The `connectionTimeout` property specifies the duration (in milliseconds) the client should wait for a connection to be established.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```typescript
|
|
300
|
+
* const config: AdvancedBaseClientConfiguration = {
|
|
301
|
+
* connectionTimeout: 5000, // 5 seconds
|
|
302
|
+
* };
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
export interface AdvancedBaseClientConfiguration {
|
|
306
|
+
/**
|
|
307
|
+
* The duration in milliseconds to wait for a TCP/TLS connection to complete.
|
|
308
|
+
* This applies both during initial client creation and any reconnections that may occur during request processing.
|
|
309
|
+
* **Note**: A high connection timeout may lead to prolonged blocking of the entire command pipeline.
|
|
310
|
+
* If not explicitly set, a default value of 250 milliseconds will be used.
|
|
311
|
+
*/
|
|
312
|
+
connectionTimeout?: number;
|
|
313
|
+
}
|
|
288
314
|
/**
|
|
289
315
|
* Enum of Valkey data types
|
|
290
316
|
* `STRING`
|
|
@@ -5235,6 +5261,10 @@ export declare class BaseClient {
|
|
|
5235
5261
|
* @internal
|
|
5236
5262
|
*/
|
|
5237
5263
|
protected createClientRequest(options: BaseClientConfiguration): connection_request.IConnectionRequest;
|
|
5264
|
+
/**
|
|
5265
|
+
* @internal
|
|
5266
|
+
*/
|
|
5267
|
+
protected configureAdvancedConfigurationBase(options: AdvancedBaseClientConfiguration, request: connection_request.IConnectionRequest): void;
|
|
5238
5268
|
/**
|
|
5239
5269
|
* @internal
|
|
5240
5270
|
*/
|
|
@@ -1679,6 +1679,18 @@ export interface BaseScanOptions {
|
|
|
1679
1679
|
export interface ScanOptions extends BaseScanOptions {
|
|
1680
1680
|
type?: ObjectType;
|
|
1681
1681
|
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Options for the SCAN command.
|
|
1684
|
+
* `match`: The match filter is applied to the result of the command and will only include keys that match the pattern specified.
|
|
1685
|
+
* `count`: `COUNT` is a just a hint for the command for how many elements to fetch from the server, the default is 10.
|
|
1686
|
+
* `type`: The type of the object to scan.
|
|
1687
|
+
* Types are the data types of Valkey: `string`, `list`, `set`, `zset`, `hash`, `stream`.
|
|
1688
|
+
* `allowNonCoveredSlots`: If true, the scan will keep scanning even if slots are not covered by the cluster.
|
|
1689
|
+
* By default, the scan will stop if slots are not covered by the cluster.
|
|
1690
|
+
*/
|
|
1691
|
+
export interface ClusterScanOptions extends ScanOptions {
|
|
1692
|
+
allowNonCoveredSlots?: boolean;
|
|
1693
|
+
}
|
|
1682
1694
|
/**
|
|
1683
1695
|
* Options specific to the ZSCAN command, extending from the base scan options.
|
|
1684
1696
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
4
|
import * as net from "net";
|
|
5
|
-
import { BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
5
|
+
import { AdvancedBaseClientConfiguration, BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
6
6
|
import { FlushMode, FunctionListOptions, FunctionListResponse, FunctionRestorePolicy, FunctionStatsFullResponse, InfoOptions, LolwutOptions, ScanOptions } from "./Commands";
|
|
7
7
|
import { connection_request } from "./ProtobufMessage";
|
|
8
8
|
import { Transaction } from "./Transaction";
|
|
@@ -108,7 +108,23 @@ export type GlideClientConfiguration = BaseClientConfiguration & {
|
|
|
108
108
|
* Will be applied via SUBSCRIBE/PSUBSCRIBE commands during connection establishment.
|
|
109
109
|
*/
|
|
110
110
|
pubsubSubscriptions?: GlideClientConfiguration.PubSubSubscriptions;
|
|
111
|
+
/**
|
|
112
|
+
* Advanced configuration settings for the client.
|
|
113
|
+
*/
|
|
114
|
+
advancedConfiguration?: AdvancedGlideClientConfiguration;
|
|
111
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* Represents advanced configuration settings for creating a {@link GlideClient | GlideClient} used in {@link GlideClientConfiguration | GlideClientConfiguration}.
|
|
118
|
+
*
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const config: AdvancedGlideClientConfiguration = {
|
|
123
|
+
* connectionTimeout: 500, // Set the connection timeout to 500ms
|
|
124
|
+
* };
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export type AdvancedGlideClientConfiguration = AdvancedBaseClientConfiguration & {};
|
|
112
128
|
/**
|
|
113
129
|
* Client used for connection to standalone servers.
|
|
114
130
|
*
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { ClusterScanCursor, Script } from "glide-rs";
|
|
5
5
|
import * as net from "net";
|
|
6
|
-
import { BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
7
|
-
import { FlushMode, FunctionListOptions, FunctionListResponse, FunctionRestorePolicy, FunctionStatsSingleResponse, InfoOptions, LolwutOptions,
|
|
6
|
+
import { AdvancedBaseClientConfiguration, BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
7
|
+
import { FlushMode, FunctionListOptions, FunctionListResponse, FunctionRestorePolicy, FunctionStatsSingleResponse, InfoOptions, LolwutOptions, ClusterScanOptions } from "./Commands";
|
|
8
8
|
import { command_request, connection_request } from "./ProtobufMessage";
|
|
9
9
|
import { ClusterTransaction } from "./Transaction";
|
|
10
10
|
/** An extension to command option types with {@link Routes}. */
|
|
@@ -80,7 +80,7 @@ export declare namespace GlideClusterClientConfiguration {
|
|
|
80
80
|
/**
|
|
81
81
|
* Configuration options for creating a {@link GlideClusterClient | GlideClusterClient}.
|
|
82
82
|
*
|
|
83
|
-
* Extends
|
|
83
|
+
* Extends {@link BaseClientConfiguration | BaseClientConfiguration} with properties specific to `GlideClusterClient`, such as periodic topology checks
|
|
84
84
|
* and Pub/Sub subscription settings.
|
|
85
85
|
*
|
|
86
86
|
* @remarks
|
|
@@ -123,7 +123,23 @@ export type GlideClusterClientConfiguration = BaseClientConfiguration & {
|
|
|
123
123
|
* Will be applied via SUBSCRIBE/PSUBSCRIBE/SSUBSCRIBE commands during connection establishment.
|
|
124
124
|
*/
|
|
125
125
|
pubsubSubscriptions?: GlideClusterClientConfiguration.PubSubSubscriptions;
|
|
126
|
+
/**
|
|
127
|
+
* Advanced configuration settings for the client.
|
|
128
|
+
*/
|
|
129
|
+
advancedConfiguration?: AdvancedGlideClusterClientConfiguration;
|
|
126
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* Represents advanced configuration settings for creating a {@link GlideClusterClient | GlideClusterClient} used in {@link GlideClusterClientConfiguration | GlideClusterClientConfiguration}.
|
|
133
|
+
*
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const config: AdvancedGlideClusterClientConfiguration = {
|
|
138
|
+
* connectionTimeout: 500, // Set the connection timeout to 500ms
|
|
139
|
+
* };
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export type AdvancedGlideClusterClientConfiguration = AdvancedBaseClientConfiguration & {};
|
|
127
143
|
/**
|
|
128
144
|
* If the command's routing is to one node we will get T as a response type,
|
|
129
145
|
* otherwise, we will get a dictionary of address: nodeResponse, address is of type string and nodeResponse is of type T.
|
|
@@ -430,11 +446,11 @@ export declare class GlideClusterClient extends BaseClient {
|
|
|
430
446
|
/**
|
|
431
447
|
* @internal
|
|
432
448
|
*/
|
|
433
|
-
protected scanOptionsToProto(cursor: string, options?:
|
|
449
|
+
protected scanOptionsToProto(cursor: string, options?: ClusterScanOptions): command_request.ClusterScan;
|
|
434
450
|
/**
|
|
435
451
|
* @internal
|
|
436
452
|
*/
|
|
437
|
-
protected createClusterScanPromise(cursor: ClusterScanCursor, options?:
|
|
453
|
+
protected createClusterScanPromise(cursor: ClusterScanCursor, options?: ClusterScanOptions & DecoderOption): Promise<[ClusterScanCursor, GlideString[]]>;
|
|
438
454
|
/**
|
|
439
455
|
* Incrementally iterates over the keys in the Cluster.
|
|
440
456
|
*
|
|
@@ -455,7 +471,7 @@ export declare class GlideClusterClient extends BaseClient {
|
|
|
455
471
|
*
|
|
456
472
|
* @param cursor - The cursor object that wraps the scan state.
|
|
457
473
|
* To start a new scan, create a new empty `ClusterScanCursor` using {@link ClusterScanCursor}.
|
|
458
|
-
* @param options - (Optional) The scan options, see {@link
|
|
474
|
+
* @param options - (Optional) The scan options, see {@link ClusterScanOptions} and {@link DecoderOption}.
|
|
459
475
|
* @returns A Promise resolving to an array containing the next cursor and an array of keys,
|
|
460
476
|
* formatted as [`ClusterScanCursor`, `string[]`].
|
|
461
477
|
*
|
|
@@ -473,14 +489,14 @@ export declare class GlideClusterClient extends BaseClient {
|
|
|
473
489
|
* console.log(allKeys); // ["key1", "key2", "key3"]
|
|
474
490
|
*
|
|
475
491
|
* // Iterate over keys matching a pattern
|
|
476
|
-
* await client.mset([{key: "key1", value: "value1"}, {key: "key2", value: "value2"}, {key: "
|
|
492
|
+
* await client.mset([{key: "key1", value: "value1"}, {key: "key2", value: "value2"}, {key: "notMyKey", value: "value3"}, {key: "somethingElse", value: "value4"}]);
|
|
477
493
|
* let cursor = new ClusterScanCursor();
|
|
478
494
|
* const matchedKeys: GlideString[] = [];
|
|
479
495
|
* while (!cursor.isFinished()) {
|
|
480
496
|
* const [cursor, keys] = await client.scan(cursor, { match: "*key*", count: 10 });
|
|
481
497
|
* matchedKeys.push(...keys);
|
|
482
498
|
* }
|
|
483
|
-
* console.log(matchedKeys); // ["key1", "key2", "
|
|
499
|
+
* console.log(matchedKeys); // ["key1", "key2", "notMyKey"]
|
|
484
500
|
*
|
|
485
501
|
* // Iterate over keys of a specific type
|
|
486
502
|
* await client.mset([{key: "key1", value: "value1"}, {key: "key2", value: "value2"}, {key: "key3", value: "value3"}]);
|
|
@@ -494,7 +510,7 @@ export declare class GlideClusterClient extends BaseClient {
|
|
|
494
510
|
* console.log(stringKeys); // ["key1", "key2", "key3"]
|
|
495
511
|
* ```
|
|
496
512
|
*/
|
|
497
|
-
scan(cursor: ClusterScanCursor, options?:
|
|
513
|
+
scan(cursor: ClusterScanCursor, options?: ClusterScanOptions & DecoderOption): Promise<[ClusterScanCursor, GlideString[]]>;
|
|
498
514
|
/** Executes a single command, without checking inputs. Every part of the command, including subcommands,
|
|
499
515
|
* should be added as a separate value in args.
|
|
500
516
|
* The command will be routed automatically based on the passed command's default request policy, unless `route` is provided,
|
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.
|
|
4
|
+
"version": "1.2.1-rc0",
|
|
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,11 @@
|
|
|
40
40
|
"typescript": "^4.9.4"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@valkey/valkey-glide-darwin-arm64": "1.2.
|
|
44
|
-
"@valkey/valkey-glide-
|
|
45
|
-
"@valkey/valkey-glide-linux-
|
|
46
|
-
"@valkey/valkey-glide-linux-
|
|
47
|
-
"@valkey/valkey-glide-linux-musl-
|
|
48
|
-
"@valkey/valkey-glide-linux-musl-x64": "1.2.0"
|
|
43
|
+
"@valkey/valkey-glide-darwin-arm64": "1.2.1-rc0",
|
|
44
|
+
"@valkey/valkey-glide-linux-arm64": "1.2.1-rc0",
|
|
45
|
+
"@valkey/valkey-glide-linux-x64": "1.2.1-rc0",
|
|
46
|
+
"@valkey/valkey-glide-linux-musl-arm64": "1.2.1-rc0",
|
|
47
|
+
"@valkey/valkey-glide-linux-musl-x64": "1.2.1-rc0"
|
|
49
48
|
},
|
|
50
49
|
"eslintConfig": {
|
|
51
50
|
"extends": [
|