neo4j-driver 5.16.0 → 5.18.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.
@@ -1939,12 +1939,23 @@
1939
1939
  return assertValidTemporalValue(nanosecond, exports.NANOSECOND_OF_SECOND_RANGE, 'Nanosecond');
1940
1940
  }
1941
1941
  exports.assertValidNanosecond = assertValidNanosecond;
1942
+ var timeZoneValidityCache = new Map();
1943
+ var newInvalidZoneIdError = function (zoneId, fieldName) { return (0, error_1.newError)("".concat(fieldName, " is expected to be a valid ZoneId but was: \"").concat(zoneId, "\"")); };
1942
1944
  function assertValidZoneId(fieldName, zoneId) {
1945
+ var cachedResult = timeZoneValidityCache.get(zoneId);
1946
+ if (cachedResult === true) {
1947
+ return;
1948
+ }
1949
+ if (cachedResult === false) {
1950
+ throw newInvalidZoneIdError(zoneId, fieldName);
1951
+ }
1943
1952
  try {
1944
1953
  Intl.DateTimeFormat(undefined, { timeZone: zoneId });
1954
+ timeZoneValidityCache.set(zoneId, true);
1945
1955
  }
1946
1956
  catch (e) {
1947
- throw (0, error_1.newError)("".concat(fieldName, " is expected to be a valid ZoneId but was: \"").concat(zoneId, "\""));
1957
+ timeZoneValidityCache.set(zoneId, false);
1958
+ throw newInvalidZoneIdError(zoneId, fieldName);
1948
1959
  }
1949
1960
  }
1950
1961
  exports.assertValidZoneId = assertValidZoneId;
@@ -8948,7 +8959,8 @@
8948
8959
  session = this._createSession({
8949
8960
  database: config.database,
8950
8961
  bookmarkManager: config.bookmarkManager,
8951
- impersonatedUser: config.impersonatedUser
8962
+ impersonatedUser: config.impersonatedUser,
8963
+ auth: config.auth
8952
8964
  });
8953
8965
  // @ts-expect-error The method is private for external users
8954
8966
  session._configureTransactionExecutor(true, constants_1$1.TELEMETRY_APIS.EXECUTE_QUERY);
@@ -9131,12 +9143,12 @@
9131
9143
  /**
9132
9144
  * The {@link AuthToken} which will be used for the duration of the session.
9133
9145
  *
9134
- * By default, the session will use connections authenticated with {@link AuthToken} configured in the
9135
- * driver creation. This configuration allows switch user and/or authorization information for the
9146
+ * By default, the session will use connections authenticated with the {@link AuthToken} configured on
9147
+ * driver creation. This configuration allows switching user and/or authorization information for the
9136
9148
  * session lifetime.
9137
9149
  *
9138
- * **Warning**: This option is only enable when the driver is connected with Neo4j Database servers
9139
- * which supports Bolt 5.1 and onwards.
9150
+ * **Warning**: This option is only available when the driver is connected to Neo4j Database servers
9151
+ * which supports Bolt 5.1 or newer.
9140
9152
  *
9141
9153
  * @type {AuthToken|undefined}
9142
9154
  * @see {@link driver}
@@ -9331,6 +9343,20 @@
9331
9343
  *
9332
9344
  */
9333
9345
  this.transactionConfig = undefined;
9346
+ /**
9347
+ * The {@link AuthToken} which will be used for executing the query.
9348
+ *
9349
+ * By default, the query executor will use connections authenticated with the {@link AuthToken} configured on
9350
+ * driver creation. This configuration allows switching user and/or authorization information for the
9351
+ * underlying transaction's lifetime.
9352
+ *
9353
+ * **Warning**: This option is only available when the driver is connected to Neo4j Database servers
9354
+ * which support Bolt 5.1 or newer.
9355
+ *
9356
+ * @type {AuthToken|undefined}
9357
+ * @see {@link driver}
9358
+ */
9359
+ this.auth = undefined;
9334
9360
  }
9335
9361
  return QueryConfig;
9336
9362
  }());
@@ -9486,7 +9512,8 @@
9486
9512
  routing: routingConfig,
9487
9513
  database: config.database,
9488
9514
  impersonatedUser: config.impersonatedUser,
9489
- transactionConfig: config.transactionConfig
9515
+ transactionConfig: config.transactionConfig,
9516
+ auth: config.auth
9490
9517
  }, query, parameters)];
9491
9518
  case 1: return [2 /*return*/, _d.sent()];
9492
9519
  }
@@ -19757,7 +19784,7 @@
19757
19784
  // This is set up this way to keep the version in the code in
19758
19785
  // sync with the npm package version, and to allow the build
19759
19786
  // system to control version names at packaging time.
19760
- version$1.default = '5.16.0';
19787
+ version$1.default = '5.18.0';
19761
19788
 
19762
19789
  var lib = {};
19763
19790
 
@@ -28821,18 +28848,26 @@
28821
28848
  var offset = zonedEpochFromGuessedUtc.subtract(guessedUtc);
28822
28849
  return offset;
28823
28850
  }
28851
+ var dateTimeFormatCache = new Map();
28852
+ function getDateTimeFormatForZoneId(timeZoneId) {
28853
+ if (!dateTimeFormatCache.has(timeZoneId)) {
28854
+ var formatter = new Intl.DateTimeFormat('en-US', {
28855
+ timeZone: timeZoneId,
28856
+ year: 'numeric',
28857
+ month: 'numeric',
28858
+ day: 'numeric',
28859
+ hour: 'numeric',
28860
+ minute: 'numeric',
28861
+ second: 'numeric',
28862
+ hour12: false,
28863
+ era: 'narrow'
28864
+ });
28865
+ dateTimeFormatCache.set(timeZoneId, formatter);
28866
+ }
28867
+ return dateTimeFormatCache.get(timeZoneId);
28868
+ }
28824
28869
  function getTimeInZoneId(timeZoneId, epochSecond, nano) {
28825
- var formatter = new Intl.DateTimeFormat('en-US', {
28826
- timeZone: timeZoneId,
28827
- year: 'numeric',
28828
- month: 'numeric',
28829
- day: 'numeric',
28830
- hour: 'numeric',
28831
- minute: 'numeric',
28832
- second: 'numeric',
28833
- hour12: false,
28834
- era: 'narrow'
28835
- });
28870
+ var formatter = getDateTimeFormatForZoneId(timeZoneId);
28836
28871
  var utc = (0, neo4j_driver_core_1$k.int)(epochSecond)
28837
28872
  .multiply(1000)
28838
28873
  .add((0, neo4j_driver_core_1$k.int)(nano).div(1000000))
@@ -34589,7 +34624,7 @@
34589
34624
  var authTokenManager = createAuthManager(authToken);
34590
34625
  // Use default user agent or user agent specified by user.
34591
34626
  config.userAgent = config.userAgent || USER_AGENT;
34592
- config.boltAgent = neo4j_driver_core_1.internal.boltAgent.fromVersion('neo4j-javascript/' + version_1.default);
34627
+ config.boltAgent = neo4j_driver_core_1.internal.boltAgent.fromVersion(version_1.default);
34593
34628
  var address = ServerAddress.fromUrl(parsedUrl.hostAndPort);
34594
34629
  var meta = {
34595
34630
  address: address,