@valkey/valkey-glide 1.3.4 → 1.3.5-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/LICENSE +201 -0
- package/README.md +36 -14
- package/build-ts/{src/BaseClient.d.ts → BaseClient.d.ts} +62 -118
- package/build-ts/BaseClient.js +6049 -0
- package/build-ts/{src/Transaction.d.ts → Batch.d.ts} +124 -67
- package/build-ts/Batch.js +3457 -0
- package/build-ts/{src/Commands.d.ts → Commands.d.ts} +171 -791
- package/build-ts/Commands.js +2708 -0
- package/build-ts/Errors.js +42 -0
- package/build-ts/{src/GlideClient.d.ts → GlideClient.d.ts} +55 -19
- package/build-ts/GlideClient.js +899 -0
- package/build-ts/{src/GlideClusterClient.d.ts → GlideClusterClient.d.ts} +78 -42
- package/build-ts/GlideClusterClient.js +1251 -0
- package/build-ts/Logger.js +67 -0
- package/build-ts/{src/ProtobufMessage.d.ts → ProtobufMessage.d.ts} +171 -634
- package/build-ts/ProtobufMessage.js +5265 -0
- package/build-ts/index.d.ts +16 -11
- package/build-ts/index.js +53 -216
- package/build-ts/native.d.ts +14 -0
- package/build-ts/native.js +342 -0
- package/build-ts/server-modules/GlideFt.js +628 -0
- package/build-ts/{src/server-modules → server-modules}/GlideFtOptions.d.ts +1 -1
- package/build-ts/server-modules/GlideFtOptions.js +5 -0
- package/build-ts/{src/server-modules → server-modules}/GlideJson.d.ts +65 -65
- package/build-ts/server-modules/GlideJson.js +1572 -0
- package/package.json +141 -64
- /package/build-ts/{src/Errors.d.ts → Errors.d.ts} +0 -0
- /package/build-ts/{src/Logger.d.ts → Logger.d.ts} +0 -0
- /package/build-ts/{src/server-modules → server-modules}/GlideFt.d.ts +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
# Valkey GLIDE
|
|
1
|
+
# Welcome to Valkey GLIDE!
|
|
2
2
|
|
|
3
|
-
Valkey General Language Independent Driver for the Enterprise (GLIDE)
|
|
3
|
+
Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official open-source Valkey client library, proudly part of the Valkey organization. Our mission is to make your experience with Valkey and Redis OSS seamless and enjoyable. Whether you're a seasoned developer or just starting out, Valkey GLIDE is here to support you every step of the way.
|
|
4
|
+
|
|
5
|
+
# Why Choose Valkey GLIDE?
|
|
6
|
+
|
|
7
|
+
- **Community and Open Source**: Join our vibrant community and contribute to the project. We are always here to respond, and the client is for the community.
|
|
8
|
+
- **Reliability**: Built with best practices learned from over a decade of operating Redis OSS-compatible services.
|
|
9
|
+
- **Performance**: Optimized for high performance and low latency.
|
|
10
|
+
- **High Availability**: Designed to ensure your applications are always up and running.
|
|
11
|
+
- **Cross-Language Support**: Implemented using a core driver framework written in Rust, with language-specific extensions to ensure consistency and reduce complexity.
|
|
12
|
+
- **Stability and Fault Tolerance**: We brought our years of experience to create a bulletproof client.
|
|
13
|
+
- **Backed and Supported by AWS and GCP**: Ensuring robust support and continuous improvement of the project.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
See GLIDE's [documentation site](https://valkey.io/valkey-glide/).
|
|
18
|
+
Visit our [wiki](https://github.com/valkey-io/valkey-glide/wiki/NodeJS-wrapper) for examples and further details on TLS, Read strategy, Timeouts and various other configurations.
|
|
4
19
|
|
|
5
20
|
## Supported Engine Versions
|
|
6
21
|
|
|
@@ -14,31 +29,34 @@ The release of Valkey GLIDE was tested on the following platforms:
|
|
|
14
29
|
|
|
15
30
|
Linux:
|
|
16
31
|
|
|
17
|
-
- Ubuntu 22.04.
|
|
18
|
-
- Amazon Linux 2023 (AL2023) (x86_64)
|
|
32
|
+
- Ubuntu 22.04.5 (x86_64/amd64 and arm64/aarch64)
|
|
33
|
+
- Amazon Linux 2023 (AL2023) (x86_64/amd64 and arm64/aarch64)
|
|
19
34
|
|
|
20
35
|
macOS:
|
|
21
36
|
|
|
22
|
-
- macOS (Apple silicon/aarch_64
|
|
23
|
-
|
|
24
|
-
Please note that the package is not tested on macOS intel platforms, only minimal testing is done during CD.
|
|
37
|
+
- macOS 14.7 (Apple silicon/aarch_64)
|
|
38
|
+
- macOS 13.7 (x86_64/amd64)
|
|
25
39
|
|
|
26
40
|
Alpine:
|
|
27
41
|
|
|
28
|
-
- node:alpine (
|
|
42
|
+
- node:alpine (x86_64/amd64 and arm64/aarch64)
|
|
29
43
|
|
|
30
44
|
## NodeJS supported version
|
|
31
45
|
|
|
32
|
-
Node.js 16
|
|
33
|
-
|
|
34
|
-
## Documentation
|
|
35
|
-
|
|
36
|
-
Visit our [wiki](https://github.com/valkey-io/valkey-glide/wiki/NodeJS-wrapper) for examples and further details on TLS, Read strategy, Timeouts and various other configurations.
|
|
46
|
+
Node.js 16 or higher.
|
|
37
47
|
|
|
38
48
|
### Building & Testing
|
|
39
49
|
|
|
40
50
|
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.
|
|
41
51
|
|
|
52
|
+
# Quick Start
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm i @valkey/valkey-glide
|
|
58
|
+
```
|
|
59
|
+
|
|
42
60
|
## Basic Examples
|
|
43
61
|
|
|
44
62
|
#### Standalone Mode:
|
|
@@ -103,4 +121,8 @@ Currently, the package is tested on:
|
|
|
103
121
|
| Operation systems | C lib | Architecture |
|
|
104
122
|
| ----------------- | -------------------- | ----------------- |
|
|
105
123
|
| `Linux` | `glibc`, `musl libc` | `x86_64`, `arm64` |
|
|
106
|
-
| `macOS` | `Darwin`
|
|
124
|
+
| `macOS` | `Darwin` | `x86_64`, `arm64` |
|
|
125
|
+
|
|
126
|
+
## Community and Feedback
|
|
127
|
+
|
|
128
|
+
We encourage you to join our community to support, share feedback, and ask questions. You can approach us for anything on our Valkey Slack: [Join Valkey Slack](https://join.slack.com/t/valkey-oss-developer/shared_invite/zt-2nxs51chx-EB9hu9Qdch3GMfRcztTSkQ).
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { Script } from "glide-rs";
|
|
5
|
-
import * as net from "net";
|
|
6
|
-
import { Buffer, Writer } from "protobufjs";
|
|
7
|
-
import { AggregationType, BaseScanOptions, BitFieldGet, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1
|
+
import { Buffer, Writer } from "protobufjs/minimal";
|
|
2
|
+
import { AggregationType, BaseScanOptions, BatchOptions, BitFieldGet, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
8
3
|
BitFieldSubCommands, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9
|
-
BitOffsetOptions, BitwiseOperation, Boundary, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
BitOffsetOptions, BitwiseOperation, Boundary, ClusterBatchOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
5
|
ExpireOptions, GeoAddOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
11
6
|
GeoSearchResultOptions, GeoSearchShape, GeoSearchStoreResultOptions, GeoUnit, GeospatialData, HScanOptions, InsertPosition, KeyWeight, LPosOptions, ListDirection, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
12
7
|
RangeByIndex, RangeByLex, RangeByScore, RestoreOptions, ScoreFilter, SearchOrigin, SetOptions, SortOptions, StreamAddOptions, StreamClaimOptions, StreamGroupOptions, StreamPendingOptions, StreamReadGroupOptions, StreamReadOptions, StreamTrimOptions, TimeUnit, ZAddOptions, ZScanOptions } from "./Commands";
|
|
13
|
-
import { ConnectionError, ValkeyError } from "./Errors";
|
|
8
|
+
import { ConnectionError, RequestError, ValkeyError } from "./Errors";
|
|
14
9
|
import { GlideClientConfiguration } from "./GlideClient";
|
|
15
|
-
import { GlideClusterClientConfiguration,
|
|
16
|
-
import {
|
|
10
|
+
import { GlideClusterClientConfiguration, Routes } from "./GlideClusterClient";
|
|
11
|
+
import { Script } from "./native";
|
|
12
|
+
import { command_request, connection_request, response } from "../build-ts/ProtobufMessage";
|
|
17
13
|
type PromiseFunction = (value?: any) => void;
|
|
18
14
|
type ErrorFunction = (error: ValkeyError) => void;
|
|
19
15
|
export type ReturnTypeRecord = {
|
|
@@ -30,7 +26,7 @@ export declare enum ProtocolVersion {
|
|
|
30
26
|
/** Use RESP3 to communicate with the server nodes. */
|
|
31
27
|
RESP3 = 0
|
|
32
28
|
}
|
|
33
|
-
export type GlideReturnType = "OK" | string | number | null | boolean | bigint | Buffer | Set<GlideReturnType> | ReturnTypeRecord | ReturnTypeMap | ReturnTypeAttribute | GlideReturnType[];
|
|
29
|
+
export type GlideReturnType = "OK" | string | number | null | boolean | bigint | Buffer | Set<GlideReturnType> | ReturnTypeRecord | ReturnTypeMap | ReturnTypeAttribute | RequestError | GlideReturnType[];
|
|
34
30
|
/**
|
|
35
31
|
* Union type that can store either a valid UTF-8 string or array of bytes.
|
|
36
32
|
*/
|
|
@@ -48,7 +44,16 @@ export declare enum Decoder {
|
|
|
48
44
|
*/
|
|
49
45
|
String = 1
|
|
50
46
|
}
|
|
51
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* An extension to command option types with {@link Decoder}.
|
|
49
|
+
*
|
|
50
|
+
* WARNING:
|
|
51
|
+
*
|
|
52
|
+
* Be aware that if decoding fails during a command execution (due to
|
|
53
|
+
* invalid inputs, incorrect decoder), data COULD BE UNRECOVERABLY LOST.
|
|
54
|
+
*
|
|
55
|
+
* Use with caution.
|
|
56
|
+
*/
|
|
52
57
|
export interface DecoderOption {
|
|
53
58
|
/**
|
|
54
59
|
* {@link Decoder} type which defines how to handle the response.
|
|
@@ -102,24 +107,6 @@ export type ElementAndScore = {
|
|
|
102
107
|
/** The element score. */
|
|
103
108
|
score: Score;
|
|
104
109
|
};
|
|
105
|
-
/**
|
|
106
|
-
* @internal
|
|
107
|
-
* This function converts an input from GlideRecord or Record types to GlideRecord.
|
|
108
|
-
*
|
|
109
|
-
* @param keysAndValues - key names and their values.
|
|
110
|
-
* @returns GlideRecord array containing keys and their values.
|
|
111
|
-
*/
|
|
112
|
-
export declare function convertGlideRecord(keysAndValues: GlideRecord<GlideString> | Record<string, GlideString>): GlideRecord<GlideString>;
|
|
113
|
-
/**
|
|
114
|
-
* @internal
|
|
115
|
-
* Recursively downcast `GlideRecord` to `Record`. Use if `data` keys are always strings.
|
|
116
|
-
*/
|
|
117
|
-
export declare function convertGlideRecordToRecord<T>(data: GlideRecord<T>): Record<string, T>;
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
* Check whether an object is a `GlideRecord` (see {@link GlideRecord}).
|
|
121
|
-
*/
|
|
122
|
-
export declare function isGlideRecord(obj?: unknown): boolean;
|
|
123
110
|
/** Represents the return type of {@link xinfoStream} command. */
|
|
124
111
|
export type ReturnTypeXinfoStream = Record<string, StreamEntries | Record<string, StreamEntries | Record<string, StreamEntries>[]>[]>;
|
|
125
112
|
/**
|
|
@@ -127,11 +114,6 @@ export type ReturnTypeXinfoStream = Record<string, StreamEntries | Record<string
|
|
|
127
114
|
* See {@link ReturnTypeXinfoStream}.
|
|
128
115
|
*/
|
|
129
116
|
export type StreamEntries = GlideString | number | (GlideString | number | GlideString[])[][];
|
|
130
|
-
/**
|
|
131
|
-
* @internal
|
|
132
|
-
* Reverse of {@link convertGlideRecordToRecord}.
|
|
133
|
-
*/
|
|
134
|
-
export declare function convertRecordToGlideRecord<T>(data: Record<string, T>): GlideRecord<T>;
|
|
135
117
|
/** Represents the credentials for connecting to a server. */
|
|
136
118
|
export interface ServerCredentials {
|
|
137
119
|
/**
|
|
@@ -352,12 +334,10 @@ export interface PubSubMsg {
|
|
|
352
334
|
channel: GlideString;
|
|
353
335
|
pattern?: GlideString | null;
|
|
354
336
|
}
|
|
337
|
+
export type WritePromiseOptions = BaseOptions | (BaseOptions & (ClusterBatchOptions | BatchOptions));
|
|
355
338
|
/**
|
|
356
|
-
*
|
|
357
|
-
* A type to combine RouterOption and DecoderOption to be used for creating write promises for the command.
|
|
358
|
-
* See - {@link DecoderOption} and {@link RouteOption}
|
|
339
|
+
* Base client interface for GLIDE
|
|
359
340
|
*/
|
|
360
|
-
export type WritePromiseOptions = RouteOption & DecoderOption;
|
|
361
341
|
export declare class BaseClient {
|
|
362
342
|
private socket;
|
|
363
343
|
protected readonly promiseCallbackFunctions: [PromiseFunction, ErrorFunction, Decoder | undefined][] | [PromiseFunction, ErrorFunction][];
|
|
@@ -377,28 +357,15 @@ export declare class BaseClient {
|
|
|
377
357
|
protected toProtobufRoute(route: Routes | undefined): command_request.Routes | undefined;
|
|
378
358
|
processResponse(message: response.Response): void;
|
|
379
359
|
processPush(response: response.Response): void;
|
|
380
|
-
/**
|
|
381
|
-
* @internal
|
|
382
|
-
*/
|
|
383
|
-
protected constructor(socket: net.Socket, options?: BaseClientConfiguration);
|
|
384
360
|
protected getCallbackIndex(): number;
|
|
385
361
|
private writeBufferedRequestsToSocket;
|
|
386
362
|
protected ensureClientIsOpen(): void;
|
|
387
|
-
/**
|
|
388
|
-
* @internal
|
|
389
|
-
*/
|
|
390
|
-
protected createWritePromise<T>(command: command_request.Command | command_request.Command[], options?: WritePromiseOptions): Promise<T>;
|
|
391
363
|
protected createUpdateConnectionPasswordPromise(command: command_request.UpdateConnectionPassword): Promise<GlideString>;
|
|
392
364
|
protected createScriptInvocationPromise<T = GlideString>(command: command_request.ScriptInvocation, options?: {
|
|
393
365
|
keys?: GlideString[];
|
|
394
366
|
args?: GlideString[];
|
|
395
367
|
} & DecoderOption): Promise<T>;
|
|
396
|
-
protected writeOrBufferCommandRequest(callbackIdx: number, command: command_request.Command | command_request.Command[], route?: command_request.Routes): void;
|
|
397
368
|
protected writeOrBufferRequest<TRequest>(message: TRequest, encodeDelimited: (message: TRequest, writer: Writer) => void): void;
|
|
398
|
-
/**
|
|
399
|
-
* @internal
|
|
400
|
-
*/
|
|
401
|
-
protected processResultWithSetCommands(result: GlideReturnType[] | null, setCommandsIndexes: number[]): GlideReturnType[] | null;
|
|
402
369
|
cancelPubSubFuturesWithExceptionSafe(exception: ConnectionError): void;
|
|
403
370
|
isPubsubConfigured(config: GlideClientConfiguration | GlideClusterClientConfiguration): boolean;
|
|
404
371
|
getPubsubCallbackAndContext(config: GlideClientConfiguration | GlideClusterClientConfiguration): [((msg: PubSubMsg, context: any) => void) | null | undefined, any];
|
|
@@ -406,13 +373,13 @@ export declare class BaseClient {
|
|
|
406
373
|
tryGetPubSubMessage(decoder?: Decoder): PubSubMsg | null;
|
|
407
374
|
notificationToPubSubMessageSafe(pushNotification: response.Response, decoder?: Decoder): PubSubMsg | null;
|
|
408
375
|
completePubSubFuturesSafe(): void;
|
|
409
|
-
/** Get the value associated with the given key
|
|
376
|
+
/** Get the value associated with the given `key`, or `null` if no such `key` exists.
|
|
410
377
|
*
|
|
411
378
|
* @see {@link https://valkey.io/commands/get/|valkey.io} for details.
|
|
412
379
|
*
|
|
413
|
-
* @param key - The key to retrieve from the database.
|
|
380
|
+
* @param key - The `key` to retrieve from the database.
|
|
414
381
|
* @param options - (Optional) See {@link DecoderOption}.
|
|
415
|
-
* @returns If `key` exists, returns the value of `key`. Otherwise, return null
|
|
382
|
+
* @returns If `key` exists, returns the value of `key`. Otherwise, return `null`.
|
|
416
383
|
*
|
|
417
384
|
* @example
|
|
418
385
|
* ```typescript
|
|
@@ -1287,9 +1254,9 @@ export declare class BaseClient {
|
|
|
1287
1254
|
*
|
|
1288
1255
|
* @param key - The key of the hash.
|
|
1289
1256
|
* @param count - The number of field names to return.
|
|
1257
|
+
* If `count` is positive, returns unique elements.
|
|
1258
|
+
* If negative, allows for duplicates.
|
|
1290
1259
|
* @param options - (Optional) See {@link DecoderOption}.
|
|
1291
|
-
*
|
|
1292
|
-
* If `count` is positive, returns unique elements. If negative, allows for duplicates.
|
|
1293
1260
|
* @returns An `array` of random field names from the hash stored at `key`,
|
|
1294
1261
|
* or an `empty array` when the key does not exist.
|
|
1295
1262
|
*
|
|
@@ -1308,9 +1275,9 @@ export declare class BaseClient {
|
|
|
1308
1275
|
*
|
|
1309
1276
|
* @param key - The key of the hash.
|
|
1310
1277
|
* @param count - The number of field names to return.
|
|
1278
|
+
* If `count` is positive, returns unique elements.
|
|
1279
|
+
* If negative, allows for duplicates.
|
|
1311
1280
|
* @param options - (Optional) See {@link DecoderOption}.
|
|
1312
|
-
*
|
|
1313
|
-
* If `count` is positive, returns unique elements. If negative, allows for duplicates.
|
|
1314
1281
|
* @returns A 2D `array` of `[fieldName, value]` `arrays`, where `fieldName` is a random
|
|
1315
1282
|
* field name from the hash and `value` is the associated value of the field name.
|
|
1316
1283
|
* If the hash does not exist or is empty, the response will be an empty `array`.
|
|
@@ -3812,7 +3779,7 @@ export declare class BaseClient {
|
|
|
3812
3779
|
* @param start - Filters the claimed entries to those that have an ID equal or greater than the
|
|
3813
3780
|
* specified value.
|
|
3814
3781
|
* @param options - (Optional) Additional parameters:
|
|
3815
|
-
* - (Optional) `count`: the number of claimed entries.
|
|
3782
|
+
* - (Optional) `count`: the number of claimed entries. Default value is 100.
|
|
3816
3783
|
* - (Optional) `decoder`: see {@link DecoderOption}.
|
|
3817
3784
|
* @returns A `tuple` containing the following elements:
|
|
3818
3785
|
* - A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is
|
|
@@ -3859,7 +3826,7 @@ export declare class BaseClient {
|
|
|
3859
3826
|
* @param start - Filters the claimed entries to those that have an ID equal or greater than the
|
|
3860
3827
|
* specified value.
|
|
3861
3828
|
* @param options - (Optional) Additional parameters:
|
|
3862
|
-
* - (Optional) `count`: limits the number of claimed entries to the specified value.
|
|
3829
|
+
* - (Optional) `count`: limits the number of claimed entries to the specified value. Default value is 100.
|
|
3863
3830
|
* @returns An `array` containing the following elements:
|
|
3864
3831
|
* - A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is
|
|
3865
3832
|
* equivalent to the next ID in the stream after the entries that were scanned, or "0-0" if
|
|
@@ -3936,7 +3903,7 @@ export declare class BaseClient {
|
|
|
3936
3903
|
* @see {@link https://valkey.io/commands/xgroup-destroy/|valkey.io} for more details.
|
|
3937
3904
|
*
|
|
3938
3905
|
* @param key - The key of the stream.
|
|
3939
|
-
* @param groupname - The
|
|
3906
|
+
* @param groupname - The consumer group name to delete.
|
|
3940
3907
|
* @returns `true` if the consumer group is destroyed. Otherwise, `false`.
|
|
3941
3908
|
*
|
|
3942
3909
|
* @example
|
|
@@ -3966,14 +3933,14 @@ export declare class BaseClient {
|
|
|
3966
3933
|
* console.log(infoResult);
|
|
3967
3934
|
* // Output: {
|
|
3968
3935
|
* // length: 2,
|
|
3969
|
-
* //
|
|
3970
|
-
* //
|
|
3971
|
-
* //
|
|
3972
|
-
* //
|
|
3973
|
-
* //
|
|
3974
|
-
* //
|
|
3975
|
-
* //
|
|
3976
|
-
* //
|
|
3936
|
+
* // "radix-tree-keys": 1,
|
|
3937
|
+
* // "radix-tree-nodes": 2,
|
|
3938
|
+
* // "last-generated-id": "1719877599564-1",
|
|
3939
|
+
* // "max-deleted-entry-id": "0-0",
|
|
3940
|
+
* // "entries-added": 2,
|
|
3941
|
+
* // "recorded-first-entry-id": "1719877599564-0",
|
|
3942
|
+
* // "first-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
|
|
3943
|
+
* // "last-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
|
|
3977
3944
|
* // groups: 1,
|
|
3978
3945
|
* // }
|
|
3979
3946
|
* ```
|
|
@@ -3984,27 +3951,27 @@ export declare class BaseClient {
|
|
|
3984
3951
|
* const infoResult = await client.xinfoStream("my_stream", 15); // limit of 15 entries
|
|
3985
3952
|
* console.log(infoResult);
|
|
3986
3953
|
* // Output: {
|
|
3987
|
-
* //
|
|
3988
|
-
* //
|
|
3989
|
-
* //
|
|
3990
|
-
* //
|
|
3991
|
-
* //
|
|
3992
|
-
* //
|
|
3993
|
-
* //
|
|
3994
|
-
* //
|
|
3995
|
-
* //
|
|
3996
|
-
* //
|
|
3997
|
-
* //
|
|
3998
|
-
* //
|
|
3999
|
-
* //
|
|
4000
|
-
* //
|
|
4001
|
-
* //
|
|
4002
|
-
* //
|
|
4003
|
-
* //
|
|
4004
|
-
* //
|
|
4005
|
-
* //
|
|
4006
|
-
* //
|
|
4007
|
-
* //
|
|
3954
|
+
* // "length": 2,
|
|
3955
|
+
* // "radix-tree-keys": 1,
|
|
3956
|
+
* // "radix-tree-nodes": 2,
|
|
3957
|
+
* // "last-generated-id": "1719877599564-1",
|
|
3958
|
+
* // "max-deleted-entry-id": "0-0",
|
|
3959
|
+
* // "entries-added": 2,
|
|
3960
|
+
* // "recorded-first-entry-id": "1719877599564-0",
|
|
3961
|
+
* // "entries": [ [ "1719877599564-0", ["some_field", "some_value", ...] ] ],
|
|
3962
|
+
* // "groups': [ {
|
|
3963
|
+
* // "name': "group",
|
|
3964
|
+
* // "last-delivered-id": "1719877599564-0",
|
|
3965
|
+
* // "entries-read": 1,
|
|
3966
|
+
* // "lag": 1,
|
|
3967
|
+
* // "pel-count": 1,
|
|
3968
|
+
* // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ],
|
|
3969
|
+
* // "consumers": [ {
|
|
3970
|
+
* // "name": "consumer",
|
|
3971
|
+
* // "seen-time": 1722624726802,
|
|
3972
|
+
* // "active-time": 1722624726802,
|
|
3973
|
+
* // "pel-count": 1,
|
|
3974
|
+
* // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ],
|
|
4008
3975
|
* // }
|
|
4009
3976
|
* // ]
|
|
4010
3977
|
* // }
|
|
@@ -4973,14 +4940,14 @@ export declare class BaseClient {
|
|
|
4973
4940
|
* ```typescript
|
|
4974
4941
|
* const response = await client.watch(["sampleKey"]);
|
|
4975
4942
|
* console.log(response); // Output: "OK"
|
|
4976
|
-
* const transaction = new
|
|
4943
|
+
* const transaction = new Batch(true).set("SampleKey", "foobar");
|
|
4977
4944
|
* const result = await client.exec(transaction);
|
|
4978
4945
|
* console.log(result); // Output: "OK" - Executes successfully and keys are unwatched.
|
|
4979
4946
|
* ```
|
|
4980
4947
|
* ```typescript
|
|
4981
4948
|
* const response = await client.watch(["sampleKey"]);
|
|
4982
4949
|
* console.log(response); // Output: "OK"
|
|
4983
|
-
* const transaction = new
|
|
4950
|
+
* const transaction = new Batch(true).set("SampleKey", "foobar");
|
|
4984
4951
|
* await client.set("sampleKey", "hello world");
|
|
4985
4952
|
* const result = await client.exec(transaction);
|
|
4986
4953
|
* console.log(result); // Output: null - null is returned when the watched key is modified before transaction execution.
|
|
@@ -5063,6 +5030,7 @@ export declare class BaseClient {
|
|
|
5063
5030
|
* - (Optional) `count`: the maximum number of popped elements. If not specified, pops one member.
|
|
5064
5031
|
* - (Optional) `decoder`: see {@link DecoderOption}.
|
|
5065
5032
|
* @returns A `Record` which stores the key name where elements were popped out and the array of popped elements.
|
|
5033
|
+
* If no member could be popped, returns `null`.
|
|
5066
5034
|
*
|
|
5067
5035
|
* @example
|
|
5068
5036
|
* ```typescript
|
|
@@ -5260,36 +5228,12 @@ export declare class BaseClient {
|
|
|
5260
5228
|
* ```
|
|
5261
5229
|
*/
|
|
5262
5230
|
sortStore(key: GlideString, destination: GlideString, options?: SortOptions): Promise<number>;
|
|
5263
|
-
/**
|
|
5264
|
-
* @internal
|
|
5265
|
-
*/
|
|
5266
|
-
protected createClientRequest(options: BaseClientConfiguration): connection_request.IConnectionRequest;
|
|
5267
|
-
/**
|
|
5268
|
-
* @internal
|
|
5269
|
-
*/
|
|
5270
|
-
protected configureAdvancedConfigurationBase(options: AdvancedBaseClientConfiguration, request: connection_request.IConnectionRequest): void;
|
|
5271
|
-
/**
|
|
5272
|
-
* @internal
|
|
5273
|
-
*/
|
|
5274
|
-
protected connectToServer(options: BaseClientConfiguration): Promise<void>;
|
|
5275
5231
|
/**
|
|
5276
5232
|
* Terminate the client by closing all associated resources, including the socket and any active promises.
|
|
5277
5233
|
* All open promises will be closed with an exception.
|
|
5278
5234
|
* @param errorMessage - If defined, this error message will be passed along with the exceptions when closing all open promises.
|
|
5279
5235
|
*/
|
|
5280
5236
|
close(errorMessage?: string): void;
|
|
5281
|
-
/**
|
|
5282
|
-
* @internal
|
|
5283
|
-
*/
|
|
5284
|
-
protected static __createClientInternal<TConnection extends BaseClient>(options: BaseClientConfiguration, connectedSocket: net.Socket, constructor: (socket: net.Socket, options?: BaseClientConfiguration) => TConnection): Promise<TConnection>;
|
|
5285
|
-
/**
|
|
5286
|
-
* @internal
|
|
5287
|
-
*/
|
|
5288
|
-
protected static GetSocket(path: string): Promise<net.Socket>;
|
|
5289
|
-
/**
|
|
5290
|
-
* @internal
|
|
5291
|
-
*/
|
|
5292
|
-
protected static createClientInternal<TConnection extends BaseClient>(options: BaseClientConfiguration, constructor: (socket: net.Socket, options?: BaseClientConfiguration) => TConnection): Promise<TConnection>;
|
|
5293
5237
|
/**
|
|
5294
5238
|
* Update the current connection with a new password.
|
|
5295
5239
|
*
|