@valkey/valkey-glide 1.3.5-rc0 → 1.3.5-rc11
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 +22 -9
- package/build-ts/BaseClient.d.ts +4 -5
- package/build-ts/BaseClient.js +2 -3
- package/build-ts/Batch.js +0 -1
- package/build-ts/Commands.js +1 -2
- package/build-ts/Errors.js +0 -1
- package/build-ts/GlideClient.js +0 -1
- package/build-ts/GlideClusterClient.d.ts +1 -1
- package/build-ts/GlideClusterClient.js +2 -3
- package/build-ts/Logger.d.ts +30 -15
- package/build-ts/Logger.js +32 -22
- package/build-ts/ProtobufMessage.js +23 -69
- package/build-ts/index.d.ts +1 -1
- package/build-ts/index.js +1 -2
- package/build-ts/native.d.ts +92 -14
- package/build-ts/native.js +128 -106
- package/build-ts/server-modules/GlideFt.js +0 -1
- package/build-ts/server-modules/GlideFtOptions.js +0 -1
- package/build-ts/server-modules/GlideJson.js +0 -1
- package/package.json +14 -29
- package/build-ts/BaseClient.js.map +0 -1
- package/build-ts/Batch.js.map +0 -1
- package/build-ts/Commands.js.map +0 -1
- package/build-ts/Errors.js.map +0 -1
- package/build-ts/GlideClient.js.map +0 -1
- package/build-ts/GlideClusterClient.js.map +0 -1
- package/build-ts/Logger.js.map +0 -1
- package/build-ts/index.js.map +0 -1
- package/build-ts/native.js.map +0 -1
- package/build-ts/server-modules/GlideFt.js.map +0 -1
- package/build-ts/server-modules/GlideFtOptions.js.map +0 -1
- package/build-ts/server-modules/GlideJson.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,23 +27,36 @@ Refer to the [Supported Engine Versions table](https://github.com/valkey-io/valk
|
|
|
27
27
|
|
|
28
28
|
The release of Valkey GLIDE was tested on the following platforms:
|
|
29
29
|
|
|
30
|
-
Linux
|
|
30
|
+
### Linux GNU
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
Tests are actively running on **Ubuntu 24**, but the package is being build for any linux using **glibc 2.17** or higher.
|
|
33
|
+
Manual tests have been done on:
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
- Fedora 39
|
|
36
|
+
- Ubuntu 22.04
|
|
37
|
+
- Amazon Linux 2
|
|
38
|
+
- Debian 12.
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
- macOS 13.7 (x86_64/amd64)
|
|
40
|
+
### MacOS (Darwin)
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
MacOS Apple Silicon/aarch_64 and x86_64/amd64.
|
|
43
|
+
|
|
44
|
+
- Full tests are running on MacOS 15.0 arm64/aarch64
|
|
45
|
+
- Minimal tests are running on: MacOS 13.5 x86*64/amd64 *(We do not recommend using MacOS Intel for production, It is supported for development purposes)\_
|
|
46
|
+
|
|
47
|
+
### Alpine
|
|
48
|
+
|
|
49
|
+
All alpine versions that are using _musl libc_ 1.2.3 (All Alpine non deprecated alpine versions) or higher should be supported.
|
|
50
|
+
Tests are running on:
|
|
41
51
|
|
|
42
52
|
- node:alpine (x86_64/amd64 and arm64/aarch64)
|
|
43
53
|
|
|
44
54
|
## NodeJS supported version
|
|
45
55
|
|
|
46
56
|
Node.js 16 or higher.
|
|
57
|
+
**For npm users on linux it is recommended to use npm >=11 since it support optional download base on libc, yarn users should not be concerned**
|
|
58
|
+
|
|
59
|
+
- Note: The library is dependent on the [protobufjs library](https://protobufjs.github.io/protobuf.js/#installation), which add a size to the package. The package is using the protobufjs/minimal version, hence, if size matter, bundlers should be able to strip the unused code. It should reduce the size of the dependency from 19kb gzipped to 6.5kb gzipped.
|
|
47
60
|
|
|
48
61
|
### Building & Testing
|
|
49
62
|
|
|
@@ -59,7 +72,7 @@ npm i @valkey/valkey-glide
|
|
|
59
72
|
|
|
60
73
|
## Basic Examples
|
|
61
74
|
|
|
62
|
-
#### Standalone Mode
|
|
75
|
+
#### Standalone Mode
|
|
63
76
|
|
|
64
77
|
```typescript
|
|
65
78
|
import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
|
|
@@ -86,7 +99,7 @@ const get_response = await client.get("foo");
|
|
|
86
99
|
console.log(`Get response is = ${get_response}`);
|
|
87
100
|
```
|
|
88
101
|
|
|
89
|
-
#### Cluster Mode
|
|
102
|
+
#### Cluster Mode
|
|
90
103
|
|
|
91
104
|
```typescript
|
|
92
105
|
import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
|
package/build-ts/BaseClient.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Buffer, Writer } from "protobufjs/minimal";
|
|
2
|
-
import {
|
|
2
|
+
import { Script } from "../build-ts/native";
|
|
3
|
+
import { command_request, connection_request, response } from "../build-ts/ProtobufMessage";
|
|
4
|
+
import { AggregationType, BaseScanOptions, BitFieldGet, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
5
|
BitFieldSubCommands, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
-
BitOffsetOptions, BitwiseOperation, Boundary,
|
|
6
|
+
BitOffsetOptions, BitwiseOperation, Boundary, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
7
|
ExpireOptions, GeoAddOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
6
8
|
GeoSearchResultOptions, GeoSearchShape, GeoSearchStoreResultOptions, GeoUnit, GeospatialData, HScanOptions, InsertPosition, KeyWeight, LPosOptions, ListDirection, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
9
|
RangeByIndex, RangeByLex, RangeByScore, RestoreOptions, ScoreFilter, SearchOrigin, SetOptions, SortOptions, StreamAddOptions, StreamClaimOptions, StreamGroupOptions, StreamPendingOptions, StreamReadGroupOptions, StreamReadOptions, StreamTrimOptions, TimeUnit, ZAddOptions, ZScanOptions } from "./Commands";
|
|
8
10
|
import { ConnectionError, RequestError, ValkeyError } from "./Errors";
|
|
9
11
|
import { GlideClientConfiguration } from "./GlideClient";
|
|
10
12
|
import { GlideClusterClientConfiguration, Routes } from "./GlideClusterClient";
|
|
11
|
-
import { Script } from "./native";
|
|
12
|
-
import { command_request, connection_request, response } from "../build-ts/ProtobufMessage";
|
|
13
13
|
type PromiseFunction = (value?: any) => void;
|
|
14
14
|
type ErrorFunction = (error: ValkeyError) => void;
|
|
15
15
|
export type ReturnTypeRecord = {
|
|
@@ -334,7 +334,6 @@ export interface PubSubMsg {
|
|
|
334
334
|
channel: GlideString;
|
|
335
335
|
pattern?: GlideString | null;
|
|
336
336
|
}
|
|
337
|
-
export type WritePromiseOptions = BaseOptions | (BaseOptions & (ClusterBatchOptions | BatchOptions));
|
|
338
337
|
/**
|
|
339
338
|
* Base client interface for GLIDE
|
|
340
339
|
*/
|
package/build-ts/BaseClient.js
CHANGED
|
@@ -43,11 +43,11 @@ exports.convertRecordToGlideRecord = convertRecordToGlideRecord;
|
|
|
43
43
|
*/
|
|
44
44
|
const net = __importStar(require("net"));
|
|
45
45
|
const minimal_1 = require("protobufjs/minimal");
|
|
46
|
+
const native_1 = require("../build-ts/native");
|
|
47
|
+
const ProtobufMessage_1 = require("../build-ts/ProtobufMessage");
|
|
46
48
|
const Commands_1 = require("./Commands");
|
|
47
49
|
const Errors_1 = require("./Errors");
|
|
48
50
|
const Logger_1 = require("./Logger");
|
|
49
|
-
const native_1 = require("./native");
|
|
50
|
-
const ProtobufMessage_1 = require("../build-ts/ProtobufMessage");
|
|
51
51
|
var ProtocolVersion;
|
|
52
52
|
(function (ProtocolVersion) {
|
|
53
53
|
/** Use RESP2 to communicate with the server nodes. */
|
|
@@ -6047,4 +6047,3 @@ class BaseClient {
|
|
|
6047
6047
|
}
|
|
6048
6048
|
}
|
|
6049
6049
|
exports.BaseClient = BaseClient;
|
|
6050
|
-
//# sourceMappingURL=BaseClient.js.map
|
package/build-ts/Batch.js
CHANGED
package/build-ts/Commands.js
CHANGED
|
@@ -216,8 +216,8 @@ exports.createXGroupSetid = createXGroupSetid;
|
|
|
216
216
|
exports.createScriptExists = createScriptExists;
|
|
217
217
|
exports.createScriptFlush = createScriptFlush;
|
|
218
218
|
exports.createScriptKill = createScriptKill;
|
|
219
|
-
const native_1 = require("./native");
|
|
220
219
|
const long_1 = __importDefault(require("long"));
|
|
220
|
+
const native_1 = require("../build-ts/native");
|
|
221
221
|
const BaseClient_1 = require("./BaseClient");
|
|
222
222
|
const ProtobufMessage_1 = require("../build-ts/ProtobufMessage");
|
|
223
223
|
var RequestType = ProtobufMessage_1.command_request.RequestType;
|
|
@@ -2706,4 +2706,3 @@ function createScriptFlush(mode) {
|
|
|
2706
2706
|
function createScriptKill() {
|
|
2707
2707
|
return createCommand(RequestType.ScriptKill, []);
|
|
2708
2708
|
}
|
|
2709
|
-
//# sourceMappingURL=Commands.js.map
|
package/build-ts/Errors.js
CHANGED
package/build-ts/GlideClient.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
|
+
import { ClusterScanCursor, Script } from "../build-ts/native";
|
|
4
5
|
import { AdvancedBaseClientConfiguration, BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
5
6
|
import { ClusterBatch } from "./Batch";
|
|
6
7
|
import { ClusterBatchOptions, ClusterScanOptions, FlushMode, FunctionListOptions, FunctionListResponse, FunctionRestorePolicy, FunctionStatsSingleResponse, InfoOptions, LolwutOptions } from "./Commands";
|
|
7
|
-
import { ClusterScanCursor, Script } from "./native";
|
|
8
8
|
/** An extension to command option types with {@link Routes}. */
|
|
9
9
|
export interface RouteOption {
|
|
10
10
|
/**
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GlideClusterClient = exports.GlideClusterClientConfiguration = void 0;
|
|
7
|
+
const native_1 = require("../build-ts/native");
|
|
8
|
+
const ProtobufMessage_1 = require("../build-ts/ProtobufMessage");
|
|
7
9
|
const BaseClient_1 = require("./BaseClient");
|
|
8
10
|
const Commands_1 = require("./Commands");
|
|
9
|
-
const native_1 = require("./native");
|
|
10
|
-
const ProtobufMessage_1 = require("../build-ts/ProtobufMessage");
|
|
11
11
|
/* eslint-disable-next-line @typescript-eslint/no-namespace */
|
|
12
12
|
var GlideClusterClientConfiguration;
|
|
13
13
|
(function (GlideClusterClientConfiguration) {
|
|
@@ -1249,4 +1249,3 @@ class GlideClusterClient extends BaseClient_1.BaseClient {
|
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
1251
|
exports.GlideClusterClient = GlideClusterClient;
|
|
1252
|
-
//# sourceMappingURL=GlideClusterClient.js.map
|
package/build-ts/Logger.d.ts
CHANGED
|
@@ -2,31 +2,46 @@
|
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
4
|
export type LevelOptions = "error" | "warn" | "info" | "debug" | "trace" | "off";
|
|
5
|
+
/**
|
|
6
|
+
* A singleton class that allows logging which is consistent with logs from the internal GLIDE core.
|
|
7
|
+
* The logger can be set up in 2 ways -
|
|
8
|
+
* 1. By calling {@link init}, which configures the logger only if it wasn't previously configured.
|
|
9
|
+
* 2. By calling {@link setLoggerConfig}, which replaces the existing configuration, and means that new logs
|
|
10
|
+
* will not be saved with the logs that were sent before the call. The previous logs will remain unchanged.
|
|
11
|
+
* If none of these functions are called, the first log attempt will initialize a new logger with default configuration.
|
|
12
|
+
*/
|
|
5
13
|
export declare class Logger {
|
|
6
14
|
private static _instance;
|
|
7
15
|
private static logger_level;
|
|
8
16
|
private constructor();
|
|
9
17
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* logIdentifier
|
|
14
|
-
*
|
|
15
|
-
*
|
|
18
|
+
* Logs the provided message if the provided log level is lower then the logger level.
|
|
19
|
+
*
|
|
20
|
+
* @param logLevel - The log level of the provided message.
|
|
21
|
+
* @param logIdentifier - The log identifier should give the log a context.
|
|
22
|
+
* @param message - The message to log.
|
|
23
|
+
* @param err - The exception or error to log.
|
|
16
24
|
*/
|
|
17
|
-
static log(logLevel: LevelOptions, logIdentifier: string, message: string): void;
|
|
25
|
+
static log(logLevel: LevelOptions, logIdentifier: string, message: string, err?: Error): void;
|
|
18
26
|
/**
|
|
19
|
-
* Initialize a logger if it wasn't initialized before - this method is meant to be used when there is no intention to
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
27
|
+
* Initialize a logger if it wasn't initialized before - this method is meant to be used when there is no intention to
|
|
28
|
+
* replace an existing logger.
|
|
29
|
+
* The logger will filter all logs with a level lower than the given level.
|
|
30
|
+
* If given a fileName argument, will write the logs to files postfixed with fileName. If fileName isn't provided,
|
|
31
|
+
* the logs will be written to the console.
|
|
32
|
+
*
|
|
33
|
+
* @param level - Set the logger level to one of [ERROR, WARN, INFO, DEBUG, TRACE, OFF].
|
|
34
|
+
* If log level isn't provided, the logger will be configured with default configuration.
|
|
35
|
+
* To turn off logging completely, set the level to level "off".
|
|
36
|
+
* @param fileName - If provided the target of the logs will be the file mentioned.
|
|
37
|
+
* Otherwise, logs will be printed to the console.
|
|
23
38
|
*/
|
|
24
39
|
static init(level?: LevelOptions, fileName?: string): void;
|
|
25
40
|
/**
|
|
26
|
-
* configure the
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
41
|
+
* Creates a new logger instance and configure it with the provided log level and file name.
|
|
42
|
+
*
|
|
43
|
+
* @param level - Set the logger level to one of [ERROR, WARN, INFO, DEBUG, TRACE, OFF].
|
|
44
|
+
* @param fileName - The target of the logs will be the file mentioned.
|
|
30
45
|
*/
|
|
31
46
|
static setLoggerConfig(level: LevelOptions, fileName?: string): void;
|
|
32
47
|
}
|
package/build-ts/Logger.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Logger = void 0;
|
|
7
|
-
const native_1 = require("
|
|
7
|
+
const native_1 = require("../build-ts/native");
|
|
8
8
|
const LEVEL = new Map([
|
|
9
9
|
["error", 0 /* Level.Error */],
|
|
10
10
|
["warn", 1 /* Level.Warn */],
|
|
@@ -14,39 +14,50 @@ const LEVEL = new Map([
|
|
|
14
14
|
["off", 5 /* Level.Off */],
|
|
15
15
|
[undefined, undefined],
|
|
16
16
|
]);
|
|
17
|
-
|
|
18
|
-
* A singleton class that allows logging which is consistent with logs from the internal
|
|
17
|
+
/**
|
|
18
|
+
* A singleton class that allows logging which is consistent with logs from the internal GLIDE core.
|
|
19
19
|
* The logger can be set up in 2 ways -
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* 1. By calling {@link init}, which configures the logger only if it wasn't previously configured.
|
|
21
|
+
* 2. By calling {@link setLoggerConfig}, which replaces the existing configuration, and means that new logs
|
|
22
|
+
* will not be saved with the logs that were sent before the call. The previous logs will remain unchanged.
|
|
23
|
+
* If none of these functions are called, the first log attempt will initialize a new logger with default configuration.
|
|
23
24
|
*/
|
|
24
25
|
class Logger {
|
|
25
26
|
constructor(level, fileName) {
|
|
26
27
|
Logger.logger_level = (0, native_1.InitInternalLogger)(LEVEL.get(level), fileName);
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* logIdentifier
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* Logs the provided message if the provided log level is lower then the logger level.
|
|
31
|
+
*
|
|
32
|
+
* @param logLevel - The log level of the provided message.
|
|
33
|
+
* @param logIdentifier - The log identifier should give the log a context.
|
|
34
|
+
* @param message - The message to log.
|
|
35
|
+
* @param err - The exception or error to log.
|
|
35
36
|
*/
|
|
36
|
-
static log(logLevel, logIdentifier, message) {
|
|
37
|
+
static log(logLevel, logIdentifier, message, err) {
|
|
37
38
|
if (!Logger._instance) {
|
|
38
39
|
new Logger();
|
|
39
40
|
}
|
|
41
|
+
if (err) {
|
|
42
|
+
message += `: ${err.stack}`;
|
|
43
|
+
}
|
|
40
44
|
const level = LEVEL.get(logLevel) || 0;
|
|
41
45
|
if (!(level <= Logger.logger_level))
|
|
42
46
|
return;
|
|
43
47
|
(0, native_1.log)(level, logIdentifier, message);
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
|
-
* Initialize a logger if it wasn't initialized before - this method is meant to be used when there is no intention to
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
+
* Initialize a logger if it wasn't initialized before - this method is meant to be used when there is no intention to
|
|
51
|
+
* replace an existing logger.
|
|
52
|
+
* The logger will filter all logs with a level lower than the given level.
|
|
53
|
+
* If given a fileName argument, will write the logs to files postfixed with fileName. If fileName isn't provided,
|
|
54
|
+
* the logs will be written to the console.
|
|
55
|
+
*
|
|
56
|
+
* @param level - Set the logger level to one of [ERROR, WARN, INFO, DEBUG, TRACE, OFF].
|
|
57
|
+
* If log level isn't provided, the logger will be configured with default configuration.
|
|
58
|
+
* To turn off logging completely, set the level to level "off".
|
|
59
|
+
* @param fileName - If provided the target of the logs will be the file mentioned.
|
|
60
|
+
* Otherwise, logs will be printed to the console.
|
|
50
61
|
*/
|
|
51
62
|
static init(level, fileName) {
|
|
52
63
|
if (!this._instance) {
|
|
@@ -54,10 +65,10 @@ class Logger {
|
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
|
-
* configure the
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
68
|
+
* Creates a new logger instance and configure it with the provided log level and file name.
|
|
69
|
+
*
|
|
70
|
+
* @param level - Set the logger level to one of [ERROR, WARN, INFO, DEBUG, TRACE, OFF].
|
|
71
|
+
* @param fileName - The target of the logs will be the file mentioned.
|
|
61
72
|
*/
|
|
62
73
|
static setLoggerConfig(level, fileName) {
|
|
63
74
|
this._instance = new this(level, fileName);
|
|
@@ -65,4 +76,3 @@ class Logger {
|
|
|
65
76
|
}
|
|
66
77
|
exports.Logger = Logger;
|
|
67
78
|
Logger.logger_level = 0;
|
|
68
|
-
//# sourceMappingURL=Logger.js.map
|