@valkey/valkey-glide 1.1.0-rc9 → 1.2.0-rc003
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 +67 -6
- package/build-ts/index.d.ts +1 -0
- package/build-ts/index.js +13 -1
- package/build-ts/src/BaseClient.d.ts +9 -1
- package/build-ts/src/Commands.d.ts +1 -1
- package/build-ts/src/GlideClusterClient.d.ts +1 -2
- package/build-ts/src/Logger.d.ts +3 -2
- package/build-ts/src/Transaction.d.ts +2 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -6,16 +6,20 @@ Valkey General Language Independent Driver for the Enterprise (GLIDE), is an ope
|
|
|
6
6
|
|
|
7
7
|
Refer to the [Supported Engine Versions table](https://github.com/valkey-io/valkey-glide/blob/main/README.md#supported-engine-versions) for details.
|
|
8
8
|
|
|
9
|
-
## Current Status
|
|
10
|
-
|
|
11
|
-
We've made Valkey GLIDE an open-source project, and are releasing it in Preview to the community to gather feedback, and actively collaborate on the project roadmap. We welcome questions and contributions from all Redis stakeholders.
|
|
12
|
-
This preview release is recommended for testing purposes only.
|
|
13
|
-
|
|
14
9
|
# Getting Started - Node Wrapper
|
|
15
10
|
|
|
16
11
|
## System Requirements
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
The release of Valkey GLIDE was tested on the following platforms:
|
|
14
|
+
|
|
15
|
+
Linux:
|
|
16
|
+
|
|
17
|
+
- Ubuntu 22.04.1 (x86_64)
|
|
18
|
+
- Amazon Linux 2023 (AL2023) (x86_64)
|
|
19
|
+
|
|
20
|
+
macOS:
|
|
21
|
+
|
|
22
|
+
- macOS 12.7 (Apple silicon/aarch_64 and Intel/x86_64)
|
|
19
23
|
|
|
20
24
|
## NodeJS supported version
|
|
21
25
|
|
|
@@ -29,6 +33,63 @@ Visit our [wiki](https://github.com/valkey-io/valkey-glide/wiki/NodeJS-wrapper)
|
|
|
29
33
|
|
|
30
34
|
Development instructions for local building & testing the package are in the [DEVELOPER.md](https://github.com/valkey-io/valkey-glide/blob/main/node/DEVELOPER.md#build-from-source) file.
|
|
31
35
|
|
|
36
|
+
## Basic Examples
|
|
37
|
+
|
|
38
|
+
#### Standalone Mode:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
|
|
42
|
+
// When Valkey is in standalone mode, add address of the primary node, and any replicas you'd like to be able to read from.
|
|
43
|
+
const addresses = [
|
|
44
|
+
{
|
|
45
|
+
host: "localhost",
|
|
46
|
+
port: 6379,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
// Check `GlideClientConfiguration/GlideClusterClientConfiguration` for additional options.
|
|
50
|
+
const client = await GlideClient.createClient({
|
|
51
|
+
addresses: addresses,
|
|
52
|
+
// if the server uses TLS, you'll need to enable it. Otherwise, the connection attempt will time out silently.
|
|
53
|
+
// useTLS: true,
|
|
54
|
+
clientName: "test_standalone_client",
|
|
55
|
+
});
|
|
56
|
+
// The empty array signifies that there are no additional arguments.
|
|
57
|
+
const pong = await client.customCommand(["PING"]);
|
|
58
|
+
console.log(pong);
|
|
59
|
+
const set_response = await client.set("foo", "bar");
|
|
60
|
+
console.log(`Set response is = ${set_response}`);
|
|
61
|
+
const get_response = await client.get("foo");
|
|
62
|
+
console.log(`Get response is = ${get_response}`);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Cluster Mode:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
|
|
69
|
+
// When Valkey is in cluster mode, add address of any nodes, and the client will find all nodes in the cluster.
|
|
70
|
+
const addresses = [
|
|
71
|
+
{
|
|
72
|
+
host: "localhost",
|
|
73
|
+
port: 6379,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
// Check `GlideClientConfiguration/GlideClusterClientConfiguration` for additional options.
|
|
77
|
+
const client = await GlideClusterClient.createClient({
|
|
78
|
+
addresses: addresses,
|
|
79
|
+
// if the cluster nodes use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
|
|
80
|
+
// useTLS: true,
|
|
81
|
+
clientName: "test_cluster_client",
|
|
82
|
+
});
|
|
83
|
+
// The empty array signifies that there are no additional arguments.
|
|
84
|
+
const pong = await client.customCommand(["PING"], { route: "randomNode" });
|
|
85
|
+
console.log(pong);
|
|
86
|
+
const set_response = await client.set("foo", "bar");
|
|
87
|
+
console.log(`Set response is = ${set_response}`);
|
|
88
|
+
const get_response = await client.get("foo");
|
|
89
|
+
console.log(`Get response is = ${get_response}`);
|
|
90
|
+
client.close();
|
|
91
|
+
```
|
|
92
|
+
|
|
32
93
|
### Supported platforms
|
|
33
94
|
|
|
34
95
|
Currentlly the package is supported on:
|
package/build-ts/index.d.ts
CHANGED
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, GlideRecord, GlideString, 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, } = 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, 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;
|
|
69
69
|
module.exports = {
|
|
70
70
|
AggregationType,
|
|
71
71
|
BaseScanOptions,
|
|
@@ -89,7 +89,9 @@ function initialize() {
|
|
|
89
89
|
DecoderOption,
|
|
90
90
|
GeoAddOptions,
|
|
91
91
|
GlideRecord,
|
|
92
|
+
GlideJson,
|
|
92
93
|
GlideString,
|
|
94
|
+
JsonGetOptions,
|
|
93
95
|
SortedSetDataType,
|
|
94
96
|
StreamEntryDataType,
|
|
95
97
|
HashDataType,
|
|
@@ -177,6 +179,16 @@ function initialize() {
|
|
|
177
179
|
createLeakedMap,
|
|
178
180
|
createLeakedString,
|
|
179
181
|
parseInfoResponse,
|
|
182
|
+
Script,
|
|
183
|
+
ObjectType,
|
|
184
|
+
ClusterScanCursor,
|
|
185
|
+
BaseClientConfiguration,
|
|
186
|
+
GlideClusterClientConfiguration,
|
|
187
|
+
LevelOptions,
|
|
188
|
+
ReturnTypeRecord,
|
|
189
|
+
ReturnTypeMap,
|
|
190
|
+
ClusterResponse,
|
|
191
|
+
ReturnTypeAttribute,
|
|
180
192
|
};
|
|
181
193
|
globalObject = Object.assign(global, nativeBinding);
|
|
182
194
|
}
|
|
@@ -201,6 +201,13 @@ export interface BaseClientConfiguration {
|
|
|
201
201
|
* If not set, 'Decoder.String' will be used.
|
|
202
202
|
*/
|
|
203
203
|
defaultDecoder?: Decoder;
|
|
204
|
+
/**
|
|
205
|
+
* The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed).
|
|
206
|
+
* This limit is used to control the memory usage and prevent the client from overwhelming the
|
|
207
|
+
* server or getting stuck in case of a queue backlog. If not set, a default value of 1000 will be
|
|
208
|
+
* used.
|
|
209
|
+
*/
|
|
210
|
+
inflightRequestsLimit?: number;
|
|
204
211
|
}
|
|
205
212
|
/**
|
|
206
213
|
* Enum of Valkey data types
|
|
@@ -245,6 +252,7 @@ export declare class BaseClient {
|
|
|
245
252
|
protected defaultDecoder: Decoder;
|
|
246
253
|
private readonly pubsubFutures;
|
|
247
254
|
private pendingPushNotification;
|
|
255
|
+
private readonly inflightRequestsLimit;
|
|
248
256
|
private config;
|
|
249
257
|
protected configurePubsub(options: GlideClusterClientConfiguration | GlideClientConfiguration, configuration: connection_request.IConnectionRequest): void;
|
|
250
258
|
private handleReadData;
|
|
@@ -3622,7 +3630,7 @@ export declare class BaseClient {
|
|
|
3622
3630
|
* // ]
|
|
3623
3631
|
* ```
|
|
3624
3632
|
*/
|
|
3625
|
-
xinfoGroups(key:
|
|
3633
|
+
xinfoGroups(key: GlideString, options?: DecoderOption): Promise<Record<string, GlideString | number | null>[]>;
|
|
3626
3634
|
/**
|
|
3627
3635
|
* Changes the ownership of a pending message.
|
|
3628
3636
|
*
|
|
@@ -1174,7 +1174,7 @@ export declare function createXReadGroup(group: GlideString, consumer: GlideStri
|
|
|
1174
1174
|
*/
|
|
1175
1175
|
export declare function createXInfoStream(key: GlideString, options: boolean | number): command_request.Command;
|
|
1176
1176
|
/** @internal */
|
|
1177
|
-
export declare function createXInfoGroups(key:
|
|
1177
|
+
export declare function createXInfoGroups(key: GlideString): command_request.Command;
|
|
1178
1178
|
/**
|
|
1179
1179
|
* @internal
|
|
1180
1180
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
|
-
import { ClusterScanCursor } from "glide-rs";
|
|
5
|
-
import { Script } from "index";
|
|
4
|
+
import { ClusterScanCursor, Script } from "glide-rs";
|
|
6
5
|
import * as net from "net";
|
|
7
6
|
import { BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
8
7
|
import { FlushMode, FunctionListOptions, FunctionListResponse, FunctionRestorePolicy, FunctionStatsSingleResponse, InfoOptions, LolwutOptions, ScanOptions } from "./Commands";
|
package/build-ts/src/Logger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
|
-
type LevelOptions = "error" | "warn" | "info" | "debug" | "trace";
|
|
4
|
+
export type LevelOptions = "error" | "warn" | "info" | "debug" | "trace" | "off";
|
|
5
5
|
export declare class Logger {
|
|
6
6
|
private static _instance;
|
|
7
7
|
private static logger_level;
|
|
@@ -19,13 +19,14 @@ export declare class Logger {
|
|
|
19
19
|
* Initialize a logger if it wasn't initialized before - this method is meant to be used when there is no intention to replace an existing logger.
|
|
20
20
|
* The logger will filter all logs with a level lower than the given level,
|
|
21
21
|
* If given a fileName argument, will write the logs to files postfixed with fileName. If fileName isn't provided, the logs will be written to the console.
|
|
22
|
+
* To turn off the logger, provide the level "off".
|
|
22
23
|
*/
|
|
23
24
|
static init(level?: LevelOptions, fileName?: string): void;
|
|
24
25
|
/**
|
|
25
26
|
* configure the logger.
|
|
26
27
|
* the level argument is the level of the logs you want the system to provide (error logs, warn logs, etc.)
|
|
27
28
|
* the filename argument is optional - if provided the target of the logs will be the file mentioned, else will be the console
|
|
29
|
+
* To turn off the logger, provide the level "off".
|
|
28
30
|
*/
|
|
29
31
|
static setLoggerConfig(level: LevelOptions, fileName?: string): void;
|
|
30
32
|
}
|
|
31
|
-
export {};
|
|
@@ -761,7 +761,7 @@ export declare class BaseTransaction<T extends BaseTransaction<T>> {
|
|
|
761
761
|
* Command Response - the number of the removed elements.
|
|
762
762
|
* If `key` does not exist, 0 is returned.
|
|
763
763
|
*/
|
|
764
|
-
lrem(key: GlideString, count: number, element:
|
|
764
|
+
lrem(key: GlideString, count: number, element: GlideString): T;
|
|
765
765
|
/** Inserts all the specified values at the tail of the list stored at `key`.
|
|
766
766
|
* `elements` are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element.
|
|
767
767
|
* If `key` does not exist, it is created as empty list before performing the push operations.
|
|
@@ -1820,7 +1820,7 @@ export declare class BaseTransaction<T extends BaseTransaction<T>> {
|
|
|
1820
1820
|
* attributes of a consumer group for the stream at `key`.
|
|
1821
1821
|
* The response comes in format `GlideRecord<GlideString | number | null>[]`, see {@link GlideRecord}.
|
|
1822
1822
|
*/
|
|
1823
|
-
xinfoGroups(key:
|
|
1823
|
+
xinfoGroups(key: GlideString): T;
|
|
1824
1824
|
/**
|
|
1825
1825
|
* Returns the server time.
|
|
1826
1826
|
*
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valkey/valkey-glide",
|
|
3
3
|
"types": "build-ts/index.d.ts",
|
|
4
|
-
"version": "
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.2.0-rc003",
|
|
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",
|
|
8
8
|
"type": "commonjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"client",
|
|
27
27
|
"valkey-glide"
|
|
28
28
|
],
|
|
29
|
-
"author": "
|
|
29
|
+
"author": "Valkey GLIDE Maintainers",
|
|
30
30
|
"license": "Apache-2.0",
|
|
31
31
|
"bugs": {
|
|
32
32
|
"url": "https://github.com/valkey-io/valkey-glide/issues"
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"typescript": "^4.9.4"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@valkey/valkey-glide-darwin-arm64": "
|
|
44
|
-
"@valkey/valkey-glide-darwin-x64": "
|
|
45
|
-
"@valkey/valkey-glide-linux-arm64": "
|
|
46
|
-
"@valkey/valkey-glide-linux-x64": "
|
|
47
|
-
"@valkey/valkey-glide-linux-musl-arm64": "
|
|
48
|
-
"@valkey/valkey-glide-linux-musl-x64": "
|
|
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"
|
|
49
49
|
},
|
|
50
50
|
"eslintConfig": {
|
|
51
51
|
"extends": [
|