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.
@@ -1933,12 +1933,23 @@ function assertValidNanosecond(nanosecond) {
1933
1933
  return assertValidTemporalValue(nanosecond, exports.NANOSECOND_OF_SECOND_RANGE, 'Nanosecond');
1934
1934
  }
1935
1935
  exports.assertValidNanosecond = assertValidNanosecond;
1936
+ var timeZoneValidityCache = new Map();
1937
+ var newInvalidZoneIdError = function (zoneId, fieldName) { return (0, error_1.newError)("".concat(fieldName, " is expected to be a valid ZoneId but was: \"").concat(zoneId, "\"")); };
1936
1938
  function assertValidZoneId(fieldName, zoneId) {
1939
+ var cachedResult = timeZoneValidityCache.get(zoneId);
1940
+ if (cachedResult === true) {
1941
+ return;
1942
+ }
1943
+ if (cachedResult === false) {
1944
+ throw newInvalidZoneIdError(zoneId, fieldName);
1945
+ }
1937
1946
  try {
1938
1947
  Intl.DateTimeFormat(undefined, { timeZone: zoneId });
1948
+ timeZoneValidityCache.set(zoneId, true);
1939
1949
  }
1940
1950
  catch (e) {
1941
- throw (0, error_1.newError)("".concat(fieldName, " is expected to be a valid ZoneId but was: \"").concat(zoneId, "\""));
1951
+ timeZoneValidityCache.set(zoneId, false);
1952
+ throw newInvalidZoneIdError(zoneId, fieldName);
1942
1953
  }
1943
1954
  }
1944
1955
  exports.assertValidZoneId = assertValidZoneId;
@@ -8942,7 +8953,8 @@ var QueryExecutor = /** @class */ (function () {
8942
8953
  session = this._createSession({
8943
8954
  database: config.database,
8944
8955
  bookmarkManager: config.bookmarkManager,
8945
- impersonatedUser: config.impersonatedUser
8956
+ impersonatedUser: config.impersonatedUser,
8957
+ auth: config.auth
8946
8958
  });
8947
8959
  // @ts-expect-error The method is private for external users
8948
8960
  session._configureTransactionExecutor(true, constants_1$1.TELEMETRY_APIS.EXECUTE_QUERY);
@@ -9125,12 +9137,12 @@ var SessionConfig = /** @class */ (function () {
9125
9137
  /**
9126
9138
  * The {@link AuthToken} which will be used for the duration of the session.
9127
9139
  *
9128
- * By default, the session will use connections authenticated with {@link AuthToken} configured in the
9129
- * driver creation. This configuration allows switch user and/or authorization information for the
9140
+ * By default, the session will use connections authenticated with the {@link AuthToken} configured on
9141
+ * driver creation. This configuration allows switching user and/or authorization information for the
9130
9142
  * session lifetime.
9131
9143
  *
9132
- * **Warning**: This option is only enable when the driver is connected with Neo4j Database servers
9133
- * which supports Bolt 5.1 and onwards.
9144
+ * **Warning**: This option is only available when the driver is connected to Neo4j Database servers
9145
+ * which supports Bolt 5.1 or newer.
9134
9146
  *
9135
9147
  * @type {AuthToken|undefined}
9136
9148
  * @see {@link driver}
@@ -9325,6 +9337,20 @@ var QueryConfig = /** @class */ (function () {
9325
9337
  *
9326
9338
  */
9327
9339
  this.transactionConfig = undefined;
9340
+ /**
9341
+ * The {@link AuthToken} which will be used for executing the query.
9342
+ *
9343
+ * By default, the query executor will use connections authenticated with the {@link AuthToken} configured on
9344
+ * driver creation. This configuration allows switching user and/or authorization information for the
9345
+ * underlying transaction's lifetime.
9346
+ *
9347
+ * **Warning**: This option is only available when the driver is connected to Neo4j Database servers
9348
+ * which support Bolt 5.1 or newer.
9349
+ *
9350
+ * @type {AuthToken|undefined}
9351
+ * @see {@link driver}
9352
+ */
9353
+ this.auth = undefined;
9328
9354
  }
9329
9355
  return QueryConfig;
9330
9356
  }());
@@ -9480,7 +9506,8 @@ var Driver$1 = /** @class */ (function () {
9480
9506
  routing: routingConfig,
9481
9507
  database: config.database,
9482
9508
  impersonatedUser: config.impersonatedUser,
9483
- transactionConfig: config.transactionConfig
9509
+ transactionConfig: config.transactionConfig,
9510
+ auth: config.auth
9484
9511
  }, query, parameters)];
9485
9512
  case 1: return [2 /*return*/, _d.sent()];
9486
9513
  }
@@ -19751,7 +19778,7 @@ Object.defineProperty(version$1, "__esModule", { value: true });
19751
19778
  // This is set up this way to keep the version in the code in
19752
19779
  // sync with the npm package version, and to allow the build
19753
19780
  // system to control version names at packaging time.
19754
- version$1.default = '5.16.0';
19781
+ version$1.default = '5.18.0';
19755
19782
 
19756
19783
  var lib = {};
19757
19784
 
@@ -28815,18 +28842,26 @@ function getOffsetFromZoneId(timeZoneId, epochSecond, nanosecond) {
28815
28842
  var offset = zonedEpochFromGuessedUtc.subtract(guessedUtc);
28816
28843
  return offset;
28817
28844
  }
28845
+ var dateTimeFormatCache = new Map();
28846
+ function getDateTimeFormatForZoneId(timeZoneId) {
28847
+ if (!dateTimeFormatCache.has(timeZoneId)) {
28848
+ var formatter = new Intl.DateTimeFormat('en-US', {
28849
+ timeZone: timeZoneId,
28850
+ year: 'numeric',
28851
+ month: 'numeric',
28852
+ day: 'numeric',
28853
+ hour: 'numeric',
28854
+ minute: 'numeric',
28855
+ second: 'numeric',
28856
+ hour12: false,
28857
+ era: 'narrow'
28858
+ });
28859
+ dateTimeFormatCache.set(timeZoneId, formatter);
28860
+ }
28861
+ return dateTimeFormatCache.get(timeZoneId);
28862
+ }
28818
28863
  function getTimeInZoneId(timeZoneId, epochSecond, nano) {
28819
- var formatter = new Intl.DateTimeFormat('en-US', {
28820
- timeZone: timeZoneId,
28821
- year: 'numeric',
28822
- month: 'numeric',
28823
- day: 'numeric',
28824
- hour: 'numeric',
28825
- minute: 'numeric',
28826
- second: 'numeric',
28827
- hour12: false,
28828
- era: 'narrow'
28829
- });
28864
+ var formatter = getDateTimeFormatForZoneId(timeZoneId);
28830
28865
  var utc = (0, neo4j_driver_core_1$k.int)(epochSecond)
28831
28866
  .multiply(1000)
28832
28867
  .add((0, neo4j_driver_core_1$k.int)(nano).div(1000000))
@@ -34583,7 +34618,7 @@ function driver(url, authToken, config) {
34583
34618
  var authTokenManager = createAuthManager(authToken);
34584
34619
  // Use default user agent or user agent specified by user.
34585
34620
  config.userAgent = config.userAgent || USER_AGENT;
34586
- config.boltAgent = neo4j_driver_core_1.internal.boltAgent.fromVersion('neo4j-javascript/' + version_1.default);
34621
+ config.boltAgent = neo4j_driver_core_1.internal.boltAgent.fromVersion(version_1.default);
34587
34622
  var address = ServerAddress.fromUrl(parsedUrl.hostAndPort);
34588
34623
  var meta = {
34589
34624
  address: address,