@valkey/valkey-glide 2.0.0-rc5 → 2.0.0-rc7

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.
@@ -144,6 +144,7 @@ export type ReadFrom =
144
144
  * - **Addresses**: Use the `addresses` property to specify the hostnames and ports of the server(s) to connect to.
145
145
  * - **Cluster Mode**: In cluster mode, the client will discover other nodes based on the provided addresses.
146
146
  * - **Standalone Mode**: In standalone mode, only the provided nodes will be used.
147
+ * - **Lazy Connect**: Set `lazyConnect` to `true` to defer connection establishment until the first command is sent.
147
148
  *
148
149
  * ### Security Settings
149
150
  *
@@ -210,6 +211,7 @@ export type ReadFrom =
210
211
  * exponentBase: 2, // Delay doubles with each retry (2^N)
211
212
  * jitterPercent: 20, // Optional jitter percentage
212
213
  * },
214
+ * lazyConnect: true,
213
215
  * };
214
216
  * ```
215
217
  */
@@ -326,6 +328,40 @@ export interface BaseClientConfiguration {
326
328
  */
327
329
  jitterPercent?: number;
328
330
  };
331
+ /**
332
+ * Enables lazy connection mode, where physical connections to the server(s) are deferred
333
+ * until the first command is sent. This can reduce startup latency and allow for client
334
+ * creation in disconnected environments.
335
+ *
336
+ * - **Default**: `false` – connections are established immediately during client creation.
337
+ *
338
+ * @remarks
339
+ * When `lazyConnect` is set to `true`, the client will not attempt to connect to the specified
340
+ * nodes during initialization. Instead, connections will be established only when a command is
341
+ * actually executed.
342
+ *
343
+ * Note that the first command executed with lazy connections may experience additional latency
344
+ * as it needs to establish the connection first. During this initial connection, the standard
345
+ * request timeout does not apply yet - instead, the connection establishment is governed by
346
+ * `AdvancedBaseClientConfiguration::connectionTimeout`. The request timeout (`requestTimeout`)
347
+ * only begins counting after the connection has been successfully established. This behavior
348
+ * can effectively increase the total time needed for the first command to complete.
349
+ *
350
+ * This setting applies to both standalone and cluster modes. Note that if an operation is
351
+ * attempted and connection fails (e.g., unreachable nodes), errors will surface at that point.
352
+ *
353
+ * @example
354
+ * ```typescript
355
+ * const client = await GlideClient.createClient({
356
+ * addresses: [{ host: "localhost", port: 6379 }],
357
+ * lazyConnect: true
358
+ * });
359
+ *
360
+ * // No connection is made yet
361
+ * await client.ping(); // Now the client connects and sends the command
362
+ * ```
363
+ */
364
+ lazyConnect?: boolean;
329
365
  }
330
366
  /**
331
367
  * Represents advanced configuration settings for a client, including connection-related options.
@@ -1598,7 +1634,7 @@ export declare class BaseClient {
1598
1634
  * @param start - The starting point of the range.
1599
1635
  * @param end - The end of the range.
1600
1636
  * @returns always "OK".
1601
- * If `start` exceeds the end of the list, or if `start` is greater than `end`, the result will be an empty list (which causes key to be removed).
1637
+ * If `start` exceeds the end of the list, or if `start` is greater than `end`, the list is emptied and the key is removed.
1602
1638
  * If `end` exceeds the actual end of the list, it will be treated like the last element of the list.
1603
1639
  * If `key` does not exist the command will be ignored.
1604
1640
  *
@@ -1611,12 +1647,12 @@ export declare class BaseClient {
1611
1647
  */
1612
1648
  ltrim(key: GlideString, start: number, end: number): Promise<"OK">;
1613
1649
  /** Removes the first `count` occurrences of elements equal to `element` from the list stored at `key`.
1614
- * If `count` is positive : Removes elements equal to `element` moving from head to tail.
1615
- * If `count` is negative : Removes elements equal to `element` moving from tail to head.
1616
- * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
1617
1650
  *
1618
1651
  * @param key - The key of the list.
1619
1652
  * @param count - The count of the occurrences of elements equal to `element` to remove.
1653
+ * If `count` is positive : Removes elements equal to `element` moving from head to tail.
1654
+ * If `count` is negative : Removes elements equal to `element` moving from tail to head.
1655
+ * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
1620
1656
  * @param element - The element to remove from the list.
1621
1657
  * @returns the number of the removed elements.
1622
1658
  * If `key` does not exist, 0 is returned.
@@ -1964,7 +1964,7 @@ class BaseClient {
1964
1964
  * @param start - The starting point of the range.
1965
1965
  * @param end - The end of the range.
1966
1966
  * @returns always "OK".
1967
- * If `start` exceeds the end of the list, or if `start` is greater than `end`, the result will be an empty list (which causes key to be removed).
1967
+ * If `start` exceeds the end of the list, or if `start` is greater than `end`, the list is emptied and the key is removed.
1968
1968
  * If `end` exceeds the actual end of the list, it will be treated like the last element of the list.
1969
1969
  * If `key` does not exist the command will be ignored.
1970
1970
  *
@@ -1981,12 +1981,12 @@ class BaseClient {
1981
1981
  });
1982
1982
  }
1983
1983
  /** Removes the first `count` occurrences of elements equal to `element` from the list stored at `key`.
1984
- * If `count` is positive : Removes elements equal to `element` moving from head to tail.
1985
- * If `count` is negative : Removes elements equal to `element` moving from tail to head.
1986
- * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
1987
1984
  *
1988
1985
  * @param key - The key of the list.
1989
1986
  * @param count - The count of the occurrences of elements equal to `element` to remove.
1987
+ * If `count` is positive : Removes elements equal to `element` moving from head to tail.
1988
+ * If `count` is negative : Removes elements equal to `element` moving from tail to head.
1989
+ * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
1990
1990
  * @param element - The element to remove from the list.
1991
1991
  * @returns the number of the removed elements.
1992
1992
  * If `key` does not exist, 0 is returned.
@@ -5955,6 +5955,7 @@ class BaseClient {
5955
5955
  inflightRequestsLimit: options.inflightRequestsLimit,
5956
5956
  clientAz: options.clientAz ?? null,
5957
5957
  connectionRetryStrategy: options.connectionBackoff,
5958
+ lazyConnect: options.lazyConnect ?? false,
5958
5959
  };
5959
5960
  }
5960
5961
  /**
@@ -714,18 +714,18 @@ export declare class BaseBatch<T extends BaseBatch<T>> {
714
714
  * @param end - The end of the range.
715
715
  *
716
716
  * Command Response - always "OK".
717
- * If `start` exceeds the end of the list, or if `start` is greater than `end`, the result will be an empty list (which causes key to be removed).
717
+ * If `start` exceeds the end of the list, or if `start` is greater than `end`, the list is emptied and the key is removed.
718
718
  * If `end` exceeds the actual end of the list, it will be treated like the last element of the list.
719
719
  * If `key` does not exist the command will be ignored.
720
720
  */
721
721
  ltrim(key: GlideString, start: number, end: number): T;
722
722
  /** Removes the first `count` occurrences of elements equal to `element` from the list stored at `key`.
723
- * If `count` is positive : Removes elements equal to `element` moving from head to tail.
724
- * If `count` is negative : Removes elements equal to `element` moving from tail to head.
725
- * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
726
723
  *
727
724
  * @param key - The key of the list.
728
725
  * @param count - The count of the occurrences of elements equal to `element` to remove.
726
+ * If `count` is positive : Removes elements equal to `element` moving from head to tail.
727
+ * If `count` is negative : Removes elements equal to `element` moving from tail to head.
728
+ * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
729
729
  * @param element - The element to remove from the list.
730
730
  *
731
731
  * Command Response - the number of the removed elements.
package/build-ts/Batch.js CHANGED
@@ -834,7 +834,7 @@ class BaseBatch {
834
834
  * @param end - The end of the range.
835
835
  *
836
836
  * Command Response - always "OK".
837
- * If `start` exceeds the end of the list, or if `start` is greater than `end`, the result will be an empty list (which causes key to be removed).
837
+ * If `start` exceeds the end of the list, or if `start` is greater than `end`, the list is emptied and the key is removed.
838
838
  * If `end` exceeds the actual end of the list, it will be treated like the last element of the list.
839
839
  * If `key` does not exist the command will be ignored.
840
840
  */
@@ -842,12 +842,12 @@ class BaseBatch {
842
842
  return this.addAndReturn((0, _1.createLTrim)(key, start, end));
843
843
  }
844
844
  /** Removes the first `count` occurrences of elements equal to `element` from the list stored at `key`.
845
- * If `count` is positive : Removes elements equal to `element` moving from head to tail.
846
- * If `count` is negative : Removes elements equal to `element` moving from tail to head.
847
- * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
848
845
  *
849
846
  * @param key - The key of the list.
850
847
  * @param count - The count of the occurrences of elements equal to `element` to remove.
848
+ * If `count` is positive : Removes elements equal to `element` moving from head to tail.
849
+ * If `count` is negative : Removes elements equal to `element` moving from tail to head.
850
+ * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
851
851
  * @param element - The element to remove from the list.
852
852
  *
853
853
  * Command Response - the number of the removed elements.
@@ -1953,6 +1953,9 @@ export namespace connection_request {
1953
1953
 
1954
1954
  /** ConnectionRequest connectionTimeout */
1955
1955
  connectionTimeout?: (number|null);
1956
+
1957
+ /** ConnectionRequest lazyConnect */
1958
+ lazyConnect?: (boolean|null);
1956
1959
  }
1957
1960
 
1958
1961
  /** Represents a ConnectionRequest. */
@@ -2012,6 +2015,9 @@ export namespace connection_request {
2012
2015
  /** ConnectionRequest connectionTimeout. */
2013
2016
  public connectionTimeout: number;
2014
2017
 
2018
+ /** ConnectionRequest lazyConnect. */
2019
+ public lazyConnect: boolean;
2020
+
2015
2021
  /** ConnectionRequest periodicChecks. */
2016
2022
  public periodicChecks?: ("periodicChecksManualInterval"|"periodicChecksDisabled");
2017
2023
 
@@ -4115,6 +4115,7 @@ $root.connection_request = (function() {
4115
4115
  * @property {number|null} [inflightRequestsLimit] ConnectionRequest inflightRequestsLimit
4116
4116
  * @property {string|null} [clientAz] ConnectionRequest clientAz
4117
4117
  * @property {number|null} [connectionTimeout] ConnectionRequest connectionTimeout
4118
+ * @property {boolean|null} [lazyConnect] ConnectionRequest lazyConnect
4118
4119
  */
4119
4120
 
4120
4121
  /**
@@ -4261,6 +4262,14 @@ $root.connection_request = (function() {
4261
4262
  */
4262
4263
  ConnectionRequest.prototype.connectionTimeout = 0;
4263
4264
 
4265
+ /**
4266
+ * ConnectionRequest lazyConnect.
4267
+ * @member {boolean} lazyConnect
4268
+ * @memberof connection_request.ConnectionRequest
4269
+ * @instance
4270
+ */
4271
+ ConnectionRequest.prototype.lazyConnect = false;
4272
+
4264
4273
  // OneOf field names bound to virtual getters and setters
4265
4274
  var $oneOfFields;
4266
4275
 
@@ -4332,6 +4341,8 @@ $root.connection_request = (function() {
4332
4341
  writer.uint32(/* id 15, wireType 2 =*/122).string(message.clientAz);
4333
4342
  if (message.connectionTimeout != null && Object.hasOwnProperty.call(message, "connectionTimeout"))
4334
4343
  writer.uint32(/* id 16, wireType 0 =*/128).uint32(message.connectionTimeout);
4344
+ if (message.lazyConnect != null && Object.hasOwnProperty.call(message, "lazyConnect"))
4345
+ writer.uint32(/* id 17, wireType 0 =*/136).bool(message.lazyConnect);
4335
4346
  return writer;
4336
4347
  };
4337
4348
 
@@ -4434,6 +4445,10 @@ $root.connection_request = (function() {
4434
4445
  message.connectionTimeout = reader.uint32();
4435
4446
  break;
4436
4447
  }
4448
+ case 17: {
4449
+ message.lazyConnect = reader.bool();
4450
+ break;
4451
+ }
4437
4452
  default:
4438
4453
  reader.skipType(tag & 7);
4439
4454
  break;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "build-ts/index.js",
5
5
  "module": "build-ts/index.js",
6
6
  "types": "build-ts/index.d.ts",
7
- "version": "2.0.0-rc5",
7
+ "version": "2.0.0-rc7",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": {
@@ -133,11 +133,11 @@
133
133
  }
134
134
  },
135
135
  "optionalDependencies": {
136
- "@valkey/valkey-glide-darwin-x64": "2.0.0-rc5",
137
- "@valkey/valkey-glide-darwin-arm64": "2.0.0-rc5",
138
- "@valkey/valkey-glide-linux-x64-gnu": "2.0.0-rc5",
139
- "@valkey/valkey-glide-linux-arm64-gnu": "2.0.0-rc5",
140
- "@valkey/valkey-glide-linux-x64-musl": "2.0.0-rc5",
141
- "@valkey/valkey-glide-linux-arm64-musl": "2.0.0-rc5"
136
+ "@valkey/valkey-glide-darwin-x64": "2.0.0-rc7",
137
+ "@valkey/valkey-glide-darwin-arm64": "2.0.0-rc7",
138
+ "@valkey/valkey-glide-linux-x64-gnu": "2.0.0-rc7",
139
+ "@valkey/valkey-glide-linux-arm64-gnu": "2.0.0-rc7",
140
+ "@valkey/valkey-glide-linux-x64-musl": "2.0.0-rc7",
141
+ "@valkey/valkey-glide-linux-arm64-musl": "2.0.0-rc7"
142
142
  }
143
143
  }