@valkey/valkey-glide 2.4.0-rc2 → 2.4.0

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.
@@ -163,22 +163,6 @@ function convertRecordToGlideRecord(data) {
163
163
  return { key, value };
164
164
  });
165
165
  }
166
- /**
167
- * Our purpose in creating PointerResponse type is to mark when response is of number/long pointer response type.
168
- * Consequently, when the response is returned, we can check whether it is instanceof the PointerResponse type and pass it to the Rust core function with the proper parameters.
169
- */
170
- class PointerResponse {
171
- pointer;
172
- // As Javascript does not support 64-bit integers,
173
- // we split the Rust u64 pointer into two u32 integers (high and low) and build it again when we call value_from_split_pointer, the Rust function.
174
- high;
175
- low;
176
- constructor(pointer, high, low) {
177
- this.pointer = pointer;
178
- this.high = high;
179
- this.low = low;
180
- }
181
- }
182
166
  /** Represents the types of services that can be used for IAM authentication. */
183
167
  var ServiceType;
184
168
  (function (ServiceType) {
@@ -401,18 +385,11 @@ class BaseClient {
401
385
  reject(new errorType(message.requestError.message ?? undefined));
402
386
  }
403
387
  else if (message.respPointer != null) {
404
- let pointer;
405
- if (typeof message.respPointer === "number") {
406
- // Response from type number
407
- const long = long_1.default.fromNumber(message.respPointer);
408
- pointer = new PointerResponse(message.respPointer, long.high, long.low);
409
- }
410
- else {
411
- // Response from type long
412
- pointer = new PointerResponse(message.respPointer, message.respPointer.high, message.respPointer.low);
413
- }
388
+ const ptrNum = typeof message.respPointer === "number"
389
+ ? message.respPointer
390
+ : message.respPointer.toNumber();
414
391
  try {
415
- resolve((0, _1.valueFromSplitPointer)(pointer.high, pointer.low, decoder === Decoder.String));
392
+ resolve((0, _1.valueFromPointer)(ptrNum, decoder === Decoder.String));
416
393
  }
417
394
  catch (err) {
418
395
  _1.Logger.log("error", "Decoder", `Decoding error: '${err}'`);
@@ -739,12 +716,10 @@ class BaseClient {
739
716
  let nextPushNotificationValue = {};
740
717
  const isStringDecoder = (decoder ?? this.defaultDecoder) === Decoder.String;
741
718
  if (responsePointer) {
742
- if (typeof responsePointer !== "number") {
743
- nextPushNotificationValue = (0, _1.valueFromSplitPointer)(responsePointer.high, responsePointer.low, isStringDecoder);
744
- }
745
- else {
746
- nextPushNotificationValue = (0, _1.valueFromSplitPointer)(0, responsePointer, isStringDecoder);
747
- }
719
+ const ptrNum = typeof responsePointer === "number"
720
+ ? responsePointer
721
+ : responsePointer.toNumber();
722
+ nextPushNotificationValue = (0, _1.valueFromPointer)(ptrNum, isStringDecoder);
748
723
  const messageKind = nextPushNotificationValue["kind"];
749
724
  if (messageKind === "Disconnect") {
750
725
  _1.Logger.log("warn", "disconnect notification", "Transport disconnected, messages might be lost");
@@ -2433,6 +2433,9 @@ export namespace connection_request {
2433
2433
 
2434
2434
  /** ConnectionRequest nodeDiscoveryMode */
2435
2435
  nodeDiscoveryMode?: (connection_request.NodeDiscoveryMode|null);
2436
+
2437
+ /** ConnectionRequest addressResolverKey */
2438
+ addressResolverKey?: (string|null);
2436
2439
  }
2437
2440
 
2438
2441
  /** Represents a ConnectionRequest. */
@@ -2528,6 +2531,9 @@ export namespace connection_request {
2528
2531
  /** ConnectionRequest nodeDiscoveryMode. */
2529
2532
  public nodeDiscoveryMode: connection_request.NodeDiscoveryMode;
2530
2533
 
2534
+ /** ConnectionRequest addressResolverKey. */
2535
+ public addressResolverKey?: (string|null);
2536
+
2531
2537
  /** ConnectionRequest periodicChecks. */
2532
2538
  public periodicChecks?: ("periodicChecksManualInterval"|"periodicChecksDisabled");
2533
2539
 
@@ -5219,6 +5219,7 @@ $root.connection_request = (function() {
5219
5219
  * @property {boolean|null} [readOnly] ConnectionRequest readOnly
5220
5220
  * @property {connection_request.IClientSideCache|null} [clientSideCache] ConnectionRequest clientSideCache
5221
5221
  * @property {connection_request.NodeDiscoveryMode|null} [nodeDiscoveryMode] ConnectionRequest nodeDiscoveryMode
5222
+ * @property {string|null} [addressResolverKey] ConnectionRequest addressResolverKey
5222
5223
  */
5223
5224
 
5224
5225
  /**
@@ -5462,6 +5463,14 @@ $root.connection_request = (function() {
5462
5463
  */
5463
5464
  ConnectionRequest.prototype.nodeDiscoveryMode = 0;
5464
5465
 
5466
+ /**
5467
+ * ConnectionRequest addressResolverKey.
5468
+ * @member {string|null|undefined} addressResolverKey
5469
+ * @memberof connection_request.ConnectionRequest
5470
+ * @instance
5471
+ */
5472
+ ConnectionRequest.prototype.addressResolverKey = null;
5473
+
5465
5474
  // OneOf field names bound to virtual getters and setters
5466
5475
  var $oneOfFields;
5467
5476
 
@@ -5506,6 +5515,12 @@ $root.connection_request = (function() {
5506
5515
  set: $util.oneOfSetter($oneOfFields)
5507
5516
  });
5508
5517
 
5518
+ // Virtual OneOf for proto3 optional field
5519
+ Object.defineProperty(ConnectionRequest.prototype, "_addressResolverKey", {
5520
+ get: $util.oneOfGetter($oneOfFields = ["addressResolverKey"]),
5521
+ set: $util.oneOfSetter($oneOfFields)
5522
+ });
5523
+
5509
5524
  /**
5510
5525
  * Creates a new ConnectionRequest instance using the specified properties.
5511
5526
  * @function create
@@ -5588,6 +5603,8 @@ $root.connection_request = (function() {
5588
5603
  $root.connection_request.ClientSideCache.encode(message.clientSideCache, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim();
5589
5604
  if (message.nodeDiscoveryMode != null && Object.hasOwnProperty.call(message, "nodeDiscoveryMode"))
5590
5605
  writer.uint32(/* id 28, wireType 0 =*/224).int32(message.nodeDiscoveryMode);
5606
+ if (message.addressResolverKey != null && Object.hasOwnProperty.call(message, "addressResolverKey"))
5607
+ writer.uint32(/* id 29, wireType 2 =*/234).string(message.addressResolverKey);
5591
5608
  return writer;
5592
5609
  };
5593
5610
 
@@ -5744,6 +5761,10 @@ $root.connection_request = (function() {
5744
5761
  message.nodeDiscoveryMode = reader.int32();
5745
5762
  break;
5746
5763
  }
5764
+ case 29: {
5765
+ message.addressResolverKey = reader.string();
5766
+ break;
5767
+ }
5747
5768
  default:
5748
5769
  reader.skipType(tag & 7, long);
5749
5770
  break;
@@ -70,7 +70,17 @@ export declare function StartSocketConnection(): Promise<string>
70
70
  export declare function InitOpenTelemetry(openTelemetryConfig: OpenTelemetryConfig): void
71
71
  export declare function log(logLevel: Level, logIdentifier: string, message: string): void
72
72
  export declare function InitInternalLogger(level?: Level | undefined | null, fileName?: string | undefined | null): Level
73
- export declare function valueFromSplitPointer(highBits: number, lowBits: number, stringDecoder: boolean): null | string | Uint8Array | number | {} | Boolean | BigInt | Set<any> | any[] | Buffer
73
+ /**
74
+ * Dereference a response pointer passed as a single JS number.
75
+ *
76
+ * napi-rs marshals `i64` via `napi_get_value_int64`, which preserves all
77
+ * bits for values within the safe integer range. User-space heap addresses
78
+ * on current 64-bit platforms (48-bit on arm64 macOS, 47-bit on x86-64
79
+ * Linux) are well within this range. Using a single integer avoids the
80
+ * high/low u32 split and eliminates the class of bugs where the caller
81
+ * passes the wrong high bits.
82
+ */
83
+ export declare function valueFromPointer(pointerNumber: number, stringDecoder: boolean): null | string | Uint8Array | number | {} | Boolean | BigInt | Set<any> | any[] | Buffer
74
84
  /**
75
85
  * @internal @test
76
86
  * This function is for tests that require a value allocated on the heap.
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { Level, MAX_REQUEST_ARGS_LEN, DEFAULT_REQUEST_TIMEOUT_IN_MILLISECONDS, DEFAULT_CONNECTION_TIMEOUT_IN_MILLISECONDS, DEFAULT_INFLIGHT_REQUESTS_LIMIT, AsyncClient, StartSocketConnection, InitOpenTelemetry, log, InitInternalLogger, valueFromSplitPointer, createLeakedStringVec, createLeakedOtelSpan, createOtelSpanWithTraceContext, dropOtelSpan, Script, ClusterScanCursor, getStatistics } = nativeBinding
313
+ const { Level, MAX_REQUEST_ARGS_LEN, DEFAULT_REQUEST_TIMEOUT_IN_MILLISECONDS, DEFAULT_CONNECTION_TIMEOUT_IN_MILLISECONDS, DEFAULT_INFLIGHT_REQUESTS_LIMIT, AsyncClient, StartSocketConnection, InitOpenTelemetry, log, InitInternalLogger, valueFromPointer, createLeakedStringVec, createLeakedOtelSpan, createOtelSpanWithTraceContext, dropOtelSpan, Script, ClusterScanCursor, getStatistics } = nativeBinding
314
314
 
315
315
  module.exports.Level = Level
316
316
  module.exports.MAX_REQUEST_ARGS_LEN = MAX_REQUEST_ARGS_LEN
@@ -322,7 +322,7 @@ module.exports.StartSocketConnection = StartSocketConnection
322
322
  module.exports.InitOpenTelemetry = InitOpenTelemetry
323
323
  module.exports.log = log
324
324
  module.exports.InitInternalLogger = InitInternalLogger
325
- module.exports.valueFromSplitPointer = valueFromSplitPointer
325
+ module.exports.valueFromPointer = valueFromPointer
326
326
  module.exports.createLeakedStringVec = createLeakedStringVec
327
327
  module.exports.createLeakedOtelSpan = createLeakedOtelSpan
328
328
  module.exports.createOtelSpanWithTraceContext = createOtelSpanWithTraceContext
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.4.0-rc2",
7
+ "version": "2.4.0",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": {
@@ -135,11 +135,11 @@
135
135
  }
136
136
  },
137
137
  "optionalDependencies": {
138
- "@valkey/valkey-glide-darwin-x64": "2.4.0-rc2",
139
- "@valkey/valkey-glide-darwin-arm64": "2.4.0-rc2",
140
- "@valkey/valkey-glide-linux-x64-gnu": "2.4.0-rc2",
141
- "@valkey/valkey-glide-linux-arm64-gnu": "2.4.0-rc2",
142
- "@valkey/valkey-glide-linux-x64-musl": "2.4.0-rc2",
143
- "@valkey/valkey-glide-linux-arm64-musl": "2.4.0-rc2"
138
+ "@valkey/valkey-glide-darwin-x64": "2.4.0",
139
+ "@valkey/valkey-glide-darwin-arm64": "2.4.0",
140
+ "@valkey/valkey-glide-linux-x64-gnu": "2.4.0",
141
+ "@valkey/valkey-glide-linux-arm64-gnu": "2.4.0",
142
+ "@valkey/valkey-glide-linux-x64-musl": "2.4.0",
143
+ "@valkey/valkey-glide-linux-arm64-musl": "2.4.0"
144
144
  }
145
145
  }