neo4j-driver 5.16.0 → 5.17.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;
@@ -19751,7 +19762,7 @@ Object.defineProperty(version$1, "__esModule", { value: true });
19751
19762
  // This is set up this way to keep the version in the code in
19752
19763
  // sync with the npm package version, and to allow the build
19753
19764
  // system to control version names at packaging time.
19754
- version$1.default = '5.16.0';
19765
+ version$1.default = '5.17.0';
19755
19766
 
19756
19767
  var lib = {};
19757
19768
 
@@ -28815,18 +28826,26 @@ function getOffsetFromZoneId(timeZoneId, epochSecond, nanosecond) {
28815
28826
  var offset = zonedEpochFromGuessedUtc.subtract(guessedUtc);
28816
28827
  return offset;
28817
28828
  }
28829
+ var dateTimeFormatCache = new Map();
28830
+ function getDateTimeFormatForZoneId(timeZoneId) {
28831
+ if (!dateTimeFormatCache.has(timeZoneId)) {
28832
+ var formatter = new Intl.DateTimeFormat('en-US', {
28833
+ timeZone: timeZoneId,
28834
+ year: 'numeric',
28835
+ month: 'numeric',
28836
+ day: 'numeric',
28837
+ hour: 'numeric',
28838
+ minute: 'numeric',
28839
+ second: 'numeric',
28840
+ hour12: false,
28841
+ era: 'narrow'
28842
+ });
28843
+ dateTimeFormatCache.set(timeZoneId, formatter);
28844
+ }
28845
+ return dateTimeFormatCache.get(timeZoneId);
28846
+ }
28818
28847
  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
- });
28848
+ var formatter = getDateTimeFormatForZoneId(timeZoneId);
28830
28849
  var utc = (0, neo4j_driver_core_1$k.int)(epochSecond)
28831
28850
  .multiply(1000)
28832
28851
  .add((0, neo4j_driver_core_1$k.int)(nano).div(1000000))
@@ -34583,7 +34602,7 @@ function driver(url, authToken, config) {
34583
34602
  var authTokenManager = createAuthManager(authToken);
34584
34603
  // Use default user agent or user agent specified by user.
34585
34604
  config.userAgent = config.userAgent || USER_AGENT;
34586
- config.boltAgent = neo4j_driver_core_1.internal.boltAgent.fromVersion('neo4j-javascript/' + version_1.default);
34605
+ config.boltAgent = neo4j_driver_core_1.internal.boltAgent.fromVersion(version_1.default);
34587
34606
  var address = ServerAddress.fromUrl(parsedUrl.hostAndPort);
34588
34607
  var meta = {
34589
34608
  address: address,