@valkey/valkey-glide 2.1.1 → 2.2.0-rc1
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/BaseClient.d.ts +58 -2
- package/build-ts/BaseClient.js +111 -14
- package/build-ts/Batch.d.ts +4 -0
- package/build-ts/Batch.js +4 -0
- package/build-ts/Commands.d.ts +2 -1
- package/build-ts/Commands.js +9 -4
- package/build-ts/GlideClient.d.ts +3 -1
- package/build-ts/GlideClient.js +50 -49
- package/build-ts/GlideClusterClient.d.ts +17 -2
- package/build-ts/GlideClusterClient.js +59 -51
- package/build-ts/ProtobufMessage.d.ts +193 -1
- package/build-ts/ProtobufMessage.js +436 -5
- package/package.json +8 -8
package/build-ts/GlideClient.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GlideClient = exports.GlideClientConfiguration = void 0;
|
|
7
|
-
const
|
|
7
|
+
const BaseClient_1 = require("./BaseClient");
|
|
8
|
+
const Commands_1 = require("./Commands");
|
|
8
9
|
/* eslint-disable-next-line @typescript-eslint/no-namespace */
|
|
9
10
|
var GlideClientConfiguration;
|
|
10
11
|
(function (GlideClientConfiguration) {
|
|
@@ -30,7 +31,7 @@ var GlideClientConfiguration;
|
|
|
30
31
|
*
|
|
31
32
|
* @see For full documentation refer to {@link https://github.com/valkey-io/valkey-glide/wiki/NodeJS-wrapper#standalone | Valkey Glide Wiki}.
|
|
32
33
|
*/
|
|
33
|
-
class GlideClient extends
|
|
34
|
+
class GlideClient extends BaseClient_1.BaseClient {
|
|
34
35
|
/**
|
|
35
36
|
* @internal
|
|
36
37
|
*/
|
|
@@ -171,7 +172,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
171
172
|
* ```
|
|
172
173
|
*/
|
|
173
174
|
async customCommand(args, options) {
|
|
174
|
-
return this.createWritePromise((0,
|
|
175
|
+
return this.createWritePromise((0, Commands_1.createCustomCommand)(args), options);
|
|
175
176
|
}
|
|
176
177
|
/**
|
|
177
178
|
* Pings the server.
|
|
@@ -200,7 +201,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
200
201
|
* ```
|
|
201
202
|
*/
|
|
202
203
|
async ping(options) {
|
|
203
|
-
return this.createWritePromise((0,
|
|
204
|
+
return this.createWritePromise((0, Commands_1.createPing)(options?.message), options);
|
|
204
205
|
}
|
|
205
206
|
/**
|
|
206
207
|
* Gets information and statistics about the server.
|
|
@@ -221,8 +222,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
221
222
|
* ```
|
|
222
223
|
*/
|
|
223
224
|
async info(sections) {
|
|
224
|
-
return this.createWritePromise((0,
|
|
225
|
-
decoder:
|
|
225
|
+
return this.createWritePromise((0, Commands_1.createInfo)(sections), {
|
|
226
|
+
decoder: BaseClient_1.Decoder.String,
|
|
226
227
|
});
|
|
227
228
|
}
|
|
228
229
|
/**
|
|
@@ -241,7 +242,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
241
242
|
* ```
|
|
242
243
|
*/
|
|
243
244
|
async clientGetName(options) {
|
|
244
|
-
return this.createWritePromise((0,
|
|
245
|
+
return this.createWritePromise((0, Commands_1.createClientGetName)(), options);
|
|
245
246
|
}
|
|
246
247
|
/**
|
|
247
248
|
* Rewrites the configuration file with the current configuration.
|
|
@@ -258,8 +259,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
258
259
|
* ```
|
|
259
260
|
*/
|
|
260
261
|
async configRewrite() {
|
|
261
|
-
return this.createWritePromise((0,
|
|
262
|
-
decoder:
|
|
262
|
+
return this.createWritePromise((0, Commands_1.createConfigRewrite)(), {
|
|
263
|
+
decoder: BaseClient_1.Decoder.String,
|
|
263
264
|
});
|
|
264
265
|
}
|
|
265
266
|
/**
|
|
@@ -277,8 +278,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
277
278
|
* ```
|
|
278
279
|
*/
|
|
279
280
|
async configResetStat() {
|
|
280
|
-
return this.createWritePromise((0,
|
|
281
|
-
decoder:
|
|
281
|
+
return this.createWritePromise((0, Commands_1.createConfigResetStat)(), {
|
|
282
|
+
decoder: BaseClient_1.Decoder.String,
|
|
282
283
|
});
|
|
283
284
|
}
|
|
284
285
|
/**
|
|
@@ -295,7 +296,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
295
296
|
* ```
|
|
296
297
|
*/
|
|
297
298
|
async clientId() {
|
|
298
|
-
return this.createWritePromise((0,
|
|
299
|
+
return this.createWritePromise((0, Commands_1.createClientId)());
|
|
299
300
|
}
|
|
300
301
|
/**
|
|
301
302
|
* Reads the configuration parameters of the running server.
|
|
@@ -316,7 +317,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
316
317
|
* ```
|
|
317
318
|
*/
|
|
318
319
|
async configGet(parameters, options) {
|
|
319
|
-
return this.createWritePromise((0,
|
|
320
|
+
return this.createWritePromise((0, Commands_1.createConfigGet)(parameters), options).then(BaseClient_1.convertGlideRecordToRecord);
|
|
320
321
|
}
|
|
321
322
|
/**
|
|
322
323
|
* Sets configuration parameters to the specified values.
|
|
@@ -334,8 +335,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
334
335
|
* ```
|
|
335
336
|
*/
|
|
336
337
|
async configSet(parameters) {
|
|
337
|
-
return this.createWritePromise((0,
|
|
338
|
-
decoder:
|
|
338
|
+
return this.createWritePromise((0, Commands_1.createConfigSet)(parameters), {
|
|
339
|
+
decoder: BaseClient_1.Decoder.String,
|
|
339
340
|
});
|
|
340
341
|
}
|
|
341
342
|
/**
|
|
@@ -355,7 +356,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
355
356
|
* ```
|
|
356
357
|
*/
|
|
357
358
|
async echo(message, options) {
|
|
358
|
-
return this.createWritePromise((0,
|
|
359
|
+
return this.createWritePromise((0, Commands_1.createEcho)(message), options);
|
|
359
360
|
}
|
|
360
361
|
/**
|
|
361
362
|
* Returns the server time.
|
|
@@ -372,8 +373,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
372
373
|
* ```
|
|
373
374
|
*/
|
|
374
375
|
async time() {
|
|
375
|
-
return this.createWritePromise((0,
|
|
376
|
-
decoder:
|
|
376
|
+
return this.createWritePromise((0, Commands_1.createTime)(), {
|
|
377
|
+
decoder: BaseClient_1.Decoder.String,
|
|
377
378
|
});
|
|
378
379
|
}
|
|
379
380
|
/**
|
|
@@ -391,8 +392,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
391
392
|
* ```
|
|
392
393
|
*/
|
|
393
394
|
async lolwut(options) {
|
|
394
|
-
return this.createWritePromise((0,
|
|
395
|
-
decoder:
|
|
395
|
+
return this.createWritePromise((0, Commands_1.createLolwut)(options), {
|
|
396
|
+
decoder: BaseClient_1.Decoder.String,
|
|
396
397
|
});
|
|
397
398
|
}
|
|
398
399
|
/**
|
|
@@ -411,8 +412,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
411
412
|
* ```
|
|
412
413
|
*/
|
|
413
414
|
async functionDelete(libraryCode) {
|
|
414
|
-
return this.createWritePromise((0,
|
|
415
|
-
decoder:
|
|
415
|
+
return this.createWritePromise((0, Commands_1.createFunctionDelete)(libraryCode), {
|
|
416
|
+
decoder: BaseClient_1.Decoder.String,
|
|
416
417
|
});
|
|
417
418
|
}
|
|
418
419
|
/**
|
|
@@ -436,7 +437,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
436
437
|
* ```
|
|
437
438
|
*/
|
|
438
439
|
async functionLoad(libraryCode, options) {
|
|
439
|
-
return this.createWritePromise((0,
|
|
440
|
+
return this.createWritePromise((0, Commands_1.createFunctionLoad)(libraryCode, options?.replace), options);
|
|
440
441
|
}
|
|
441
442
|
/**
|
|
442
443
|
* Deletes all function libraries.
|
|
@@ -454,8 +455,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
454
455
|
* ```
|
|
455
456
|
*/
|
|
456
457
|
async functionFlush(mode) {
|
|
457
|
-
return this.createWritePromise((0,
|
|
458
|
-
decoder:
|
|
458
|
+
return this.createWritePromise((0, Commands_1.createFunctionFlush)(mode), {
|
|
459
|
+
decoder: BaseClient_1.Decoder.String,
|
|
459
460
|
});
|
|
460
461
|
}
|
|
461
462
|
/**
|
|
@@ -487,7 +488,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
487
488
|
* ```
|
|
488
489
|
*/
|
|
489
490
|
async functionList(options) {
|
|
490
|
-
return this.createWritePromise((0,
|
|
491
|
+
return this.createWritePromise((0, Commands_1.createFunctionList)(options), options).then((res) => res.map(BaseClient_1.convertGlideRecordToRecord));
|
|
491
492
|
}
|
|
492
493
|
/**
|
|
493
494
|
* Returns information about the function that's currently running and information about the
|
|
@@ -535,7 +536,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
535
536
|
* ```
|
|
536
537
|
*/
|
|
537
538
|
async functionStats(options) {
|
|
538
|
-
return this.createWritePromise((0,
|
|
539
|
+
return this.createWritePromise((0, Commands_1.createFunctionStats)(), options).then((res) => (0, BaseClient_1.convertGlideRecordToRecord)(res));
|
|
539
540
|
}
|
|
540
541
|
/**
|
|
541
542
|
* Kills a function that is currently executing.
|
|
@@ -552,8 +553,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
552
553
|
* ```
|
|
553
554
|
*/
|
|
554
555
|
async functionKill() {
|
|
555
|
-
return this.createWritePromise((0,
|
|
556
|
-
decoder:
|
|
556
|
+
return this.createWritePromise((0, Commands_1.createFunctionKill)(), {
|
|
557
|
+
decoder: BaseClient_1.Decoder.String,
|
|
557
558
|
});
|
|
558
559
|
}
|
|
559
560
|
/**
|
|
@@ -571,8 +572,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
571
572
|
* ```
|
|
572
573
|
*/
|
|
573
574
|
async functionDump() {
|
|
574
|
-
return this.createWritePromise((0,
|
|
575
|
-
decoder:
|
|
575
|
+
return this.createWritePromise((0, Commands_1.createFunctionDump)(), {
|
|
576
|
+
decoder: BaseClient_1.Decoder.Bytes,
|
|
576
577
|
});
|
|
577
578
|
}
|
|
578
579
|
/**
|
|
@@ -592,8 +593,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
592
593
|
* ```
|
|
593
594
|
*/
|
|
594
595
|
async functionRestore(payload, policy) {
|
|
595
|
-
return this.createWritePromise((0,
|
|
596
|
-
decoder:
|
|
596
|
+
return this.createWritePromise((0, Commands_1.createFunctionRestore)(payload, policy), {
|
|
597
|
+
decoder: BaseClient_1.Decoder.String,
|
|
597
598
|
});
|
|
598
599
|
}
|
|
599
600
|
/**
|
|
@@ -611,8 +612,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
611
612
|
* ```
|
|
612
613
|
*/
|
|
613
614
|
async flushall(mode) {
|
|
614
|
-
return this.createWritePromise((0,
|
|
615
|
-
decoder:
|
|
615
|
+
return this.createWritePromise((0, Commands_1.createFlushAll)(mode), {
|
|
616
|
+
decoder: BaseClient_1.Decoder.String,
|
|
616
617
|
});
|
|
617
618
|
}
|
|
618
619
|
/**
|
|
@@ -630,8 +631,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
630
631
|
* ```
|
|
631
632
|
*/
|
|
632
633
|
async flushdb(mode) {
|
|
633
|
-
return this.createWritePromise((0,
|
|
634
|
-
decoder:
|
|
634
|
+
return this.createWritePromise((0, Commands_1.createFlushDB)(mode), {
|
|
635
|
+
decoder: BaseClient_1.Decoder.String,
|
|
635
636
|
});
|
|
636
637
|
}
|
|
637
638
|
/**
|
|
@@ -648,7 +649,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
648
649
|
* ```
|
|
649
650
|
*/
|
|
650
651
|
async dbsize() {
|
|
651
|
-
return this.createWritePromise((0,
|
|
652
|
+
return this.createWritePromise((0, Commands_1.createDBSize)());
|
|
652
653
|
}
|
|
653
654
|
/** Publish a message on pubsub channel.
|
|
654
655
|
*
|
|
@@ -667,7 +668,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
667
668
|
* ```
|
|
668
669
|
*/
|
|
669
670
|
async publish(message, channel) {
|
|
670
|
-
return this.createWritePromise((0,
|
|
671
|
+
return this.createWritePromise((0, Commands_1.createPublish)(message, channel));
|
|
671
672
|
}
|
|
672
673
|
/**
|
|
673
674
|
* Returns `UNIX TIME` of the last DB save timestamp or startup timestamp if no save
|
|
@@ -684,7 +685,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
684
685
|
* ```
|
|
685
686
|
*/
|
|
686
687
|
async lastsave() {
|
|
687
|
-
return this.createWritePromise((0,
|
|
688
|
+
return this.createWritePromise((0, Commands_1.createLastSave)());
|
|
688
689
|
}
|
|
689
690
|
/**
|
|
690
691
|
* Returns a random existing key name from the currently selected database.
|
|
@@ -700,7 +701,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
700
701
|
* ```
|
|
701
702
|
*/
|
|
702
703
|
async randomKey(options) {
|
|
703
|
-
return this.createWritePromise((0,
|
|
704
|
+
return this.createWritePromise((0, Commands_1.createRandomKey)(), options);
|
|
704
705
|
}
|
|
705
706
|
/**
|
|
706
707
|
* Flushes all the previously watched keys for a transaction. Executing a transaction will
|
|
@@ -717,8 +718,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
717
718
|
* ```
|
|
718
719
|
*/
|
|
719
720
|
async unwatch() {
|
|
720
|
-
return this.createWritePromise((0,
|
|
721
|
-
decoder:
|
|
721
|
+
return this.createWritePromise((0, Commands_1.createUnWatch)(), {
|
|
722
|
+
decoder: BaseClient_1.Decoder.String,
|
|
722
723
|
});
|
|
723
724
|
}
|
|
724
725
|
/**
|
|
@@ -736,7 +737,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
736
737
|
* ```
|
|
737
738
|
*/
|
|
738
739
|
async scriptExists(sha1s) {
|
|
739
|
-
return this.createWritePromise((0,
|
|
740
|
+
return this.createWritePromise((0, Commands_1.createScriptExists)(sha1s));
|
|
740
741
|
}
|
|
741
742
|
/**
|
|
742
743
|
* Flushes the Lua scripts cache.
|
|
@@ -753,8 +754,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
753
754
|
* ```
|
|
754
755
|
*/
|
|
755
756
|
async scriptFlush(mode) {
|
|
756
|
-
return this.createWritePromise((0,
|
|
757
|
-
decoder:
|
|
757
|
+
return this.createWritePromise((0, Commands_1.createScriptFlush)(mode), {
|
|
758
|
+
decoder: BaseClient_1.Decoder.String,
|
|
758
759
|
});
|
|
759
760
|
}
|
|
760
761
|
/**
|
|
@@ -771,8 +772,8 @@ class GlideClient extends _1.BaseClient {
|
|
|
771
772
|
* ```
|
|
772
773
|
*/
|
|
773
774
|
async scriptKill() {
|
|
774
|
-
return this.createWritePromise((0,
|
|
775
|
-
decoder:
|
|
775
|
+
return this.createWritePromise((0, Commands_1.createScriptKill)(), {
|
|
776
|
+
decoder: BaseClient_1.Decoder.String,
|
|
776
777
|
});
|
|
777
778
|
}
|
|
778
779
|
/**
|
|
@@ -817,7 +818,7 @@ class GlideClient extends _1.BaseClient {
|
|
|
817
818
|
* ```
|
|
818
819
|
*/
|
|
819
820
|
async scan(cursor, options) {
|
|
820
|
-
return this.createWritePromise((0,
|
|
821
|
+
return this.createWritePromise((0, Commands_1.createScan)(cursor, options), options);
|
|
821
822
|
}
|
|
822
823
|
}
|
|
823
824
|
exports.GlideClient = GlideClient;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { ClusterScanCursor, Script } from "../build-ts/native";
|
|
5
|
+
import { AdvancedBaseClientConfiguration, BaseClient, BaseClientConfiguration, DecoderOption, GlideReturnType, GlideString, PubSubMsg } from "./BaseClient";
|
|
6
|
+
import { ClusterBatch } from "./Batch";
|
|
7
|
+
import { ClusterBatchOptions, ClusterScanOptions, FlushMode, FunctionListOptions, FunctionListResponse, FunctionRestorePolicy, FunctionStatsSingleResponse, InfoOptions, LolwutOptions } from "./Commands";
|
|
5
8
|
/** An extension to command option types with {@link Routes}. */
|
|
6
9
|
export interface RouteOption {
|
|
7
10
|
/**
|
|
@@ -139,10 +142,22 @@ export type GlideClusterClientConfiguration = BaseClientConfiguration & {
|
|
|
139
142
|
* tlsAdvancedConfiguration: {
|
|
140
143
|
* insecure: true, // Skip TLS certificate verification (use only in development)
|
|
141
144
|
* },
|
|
145
|
+
* refreshTopologyFromInitialNodes: true, // Refresh topology from initial seed nodes
|
|
142
146
|
* };
|
|
143
147
|
* ```
|
|
144
148
|
*/
|
|
145
|
-
export type AdvancedGlideClusterClientConfiguration = AdvancedBaseClientConfiguration & {
|
|
149
|
+
export type AdvancedGlideClusterClientConfiguration = AdvancedBaseClientConfiguration & {
|
|
150
|
+
/**
|
|
151
|
+
* Enables refreshing the cluster topology using only the initial nodes.
|
|
152
|
+
*
|
|
153
|
+
* When this option is enabled, all topology updates (both the periodic checks and on-demand
|
|
154
|
+
* refreshes triggered by topology changes) will query only the initial nodes provided when
|
|
155
|
+
* creating the client, rather than using the internal cluster view.
|
|
156
|
+
*
|
|
157
|
+
* If not set, defaults to `false` (uses internal cluster view for topology refresh).
|
|
158
|
+
*/
|
|
159
|
+
refreshTopologyFromInitialNodes?: boolean;
|
|
160
|
+
};
|
|
146
161
|
/**
|
|
147
162
|
* If the command's routing is to one node we will get T as a response type,
|
|
148
163
|
* otherwise, we will get a dictionary of address: nodeResponse, address is of type string and nodeResponse is of type T.
|