neo4j-driver 4.4.8 → 4.4.10

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.
@@ -6752,13 +6752,15 @@ function getTimeInZoneId(timeZoneId, epochSecond, nano) {
6752
6752
  hour12: false,
6753
6753
  era: 'narrow'
6754
6754
  });
6755
- var l = (0, temporal_factory_1.epochSecondAndNanoToLocalDateTime)(epochSecond, nano);
6756
- var utc = Date.UTC((0, neo4j_driver_core_1.int)(l.year).toNumber(), (0, neo4j_driver_core_1.int)(l.month).toNumber() - 1, (0, neo4j_driver_core_1.int)(l.day).toNumber(), (0, neo4j_driver_core_1.int)(l.hour).toNumber(), (0, neo4j_driver_core_1.int)(l.minute).toNumber(), (0, neo4j_driver_core_1.int)(l.second).toNumber());
6755
+ var utc = (0, neo4j_driver_core_1.int)(epochSecond)
6756
+ .multiply(1000)
6757
+ .add((0, neo4j_driver_core_1.int)(nano).div(1000000))
6758
+ .toNumber();
6757
6759
  var formattedUtcParts = formatter.formatToParts(utc);
6758
6760
  var localDateTime = formattedUtcParts.reduce(function (obj, currentValue) {
6759
6761
  if (currentValue.type === 'era') {
6760
6762
  obj.adjustEra =
6761
- currentValue.value.toLocaleUpperCase() === 'B'
6763
+ currentValue.value.toUpperCase() === 'B'
6762
6764
  ? function (year) { return year.subtract(1).negate(); } // 1BC equals to year 0 in astronomical year numbering
6763
6765
  : function (year) { return year; };
6764
6766
  }
@@ -8512,27 +8514,26 @@ var Pool = /** @class */ (function () {
8512
8514
  };
8513
8515
  Pool.prototype._purgeKey = function (key) {
8514
8516
  return __awaiter(this, void 0, void 0, function () {
8515
- var pool, poolState, resource;
8517
+ var pool, poolState, destructionList, resource;
8516
8518
  return __generator(this, function (_a) {
8517
8519
  switch (_a.label) {
8518
8520
  case 0:
8519
8521
  pool = this._pools[key] || [];
8520
8522
  poolState = this._poolState[key] || new PoolState();
8521
- _a.label = 1;
8522
- case 1:
8523
- if (!pool.length) return [3 /*break*/, 3];
8524
- resource = pool.pop();
8525
- if (this._removeIdleObserver) {
8526
- this._removeIdleObserver(resource);
8523
+ destructionList = [];
8524
+ while (pool.length) {
8525
+ resource = pool.pop();
8526
+ if (this._removeIdleObserver) {
8527
+ this._removeIdleObserver(resource);
8528
+ }
8529
+ destructionList.push(this._destroy(resource));
8527
8530
  }
8528
- return [4 /*yield*/, this._destroy(resource)];
8529
- case 2:
8530
- _a.sent();
8531
- return [3 /*break*/, 1];
8532
- case 3:
8533
8531
  poolState.close();
8534
8532
  delete this._pools[key];
8535
8533
  delete this._poolState[key];
8534
+ return [4 /*yield*/, Promise.all(destructionList)];
8535
+ case 1:
8536
+ _a.sent();
8536
8537
  return [2 /*return*/];
8537
8538
  }
8538
8539
  });
@@ -12405,7 +12406,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
12405
12406
  return result;
12406
12407
  };
12407
12408
  Object.defineProperty(exports, "__esModule", { value: true });
12408
- exports.floorMod = exports.floorDiv = exports.assertValidZoneId = exports.assertValidNanosecond = exports.assertValidSecond = exports.assertValidMinute = exports.assertValidHour = exports.assertValidDay = exports.assertValidMonth = exports.assertValidYear = exports.timeZoneOffsetInSeconds = exports.totalNanoseconds = exports.dateToIsoString = exports.timeZoneOffsetToIsoString = exports.timeToIsoString = exports.durationToIsoString = exports.dateToEpochDay = exports.localDateTimeToEpochSecond = exports.localTimeToNanoOfDay = exports.normalizeNanosecondsForDuration = exports.normalizeSecondsForDuration = exports.SECONDS_PER_DAY = exports.DAYS_PER_400_YEAR_CYCLE = exports.DAYS_0000_TO_1970 = exports.NANOS_PER_HOUR = exports.NANOS_PER_MINUTE = exports.NANOS_PER_MILLISECOND = exports.NANOS_PER_SECOND = exports.SECONDS_PER_HOUR = exports.SECONDS_PER_MINUTE = exports.MINUTES_PER_HOUR = exports.NANOSECOND_OF_SECOND_RANGE = exports.SECOND_OF_MINUTE_RANGE = exports.MINUTE_OF_HOUR_RANGE = exports.HOUR_OF_DAY_RANGE = exports.DAY_OF_MONTH_RANGE = exports.MONTH_OF_YEAR_RANGE = exports.YEAR_RANGE = void 0;
12409
+ exports.floorMod = exports.floorDiv = exports.assertValidZoneId = exports.assertValidNanosecond = exports.assertValidSecond = exports.assertValidMinute = exports.assertValidHour = exports.assertValidDay = exports.assertValidMonth = exports.assertValidYear = exports.timeZoneOffsetInSeconds = exports.totalNanoseconds = exports.newDate = exports.toStandardDate = exports.isoStringToStandardDate = exports.dateToIsoString = exports.timeZoneOffsetToIsoString = exports.timeToIsoString = exports.durationToIsoString = exports.dateToEpochDay = exports.localDateTimeToEpochSecond = exports.localTimeToNanoOfDay = exports.normalizeNanosecondsForDuration = exports.normalizeSecondsForDuration = exports.SECONDS_PER_DAY = exports.DAYS_PER_400_YEAR_CYCLE = exports.DAYS_0000_TO_1970 = exports.NANOS_PER_HOUR = exports.NANOS_PER_MINUTE = exports.NANOS_PER_MILLISECOND = exports.NANOS_PER_SECOND = exports.SECONDS_PER_HOUR = exports.SECONDS_PER_MINUTE = exports.MINUTES_PER_HOUR = exports.NANOSECOND_OF_SECOND_RANGE = exports.SECOND_OF_MINUTE_RANGE = exports.MINUTE_OF_HOUR_RANGE = exports.HOUR_OF_DAY_RANGE = exports.DAY_OF_MONTH_RANGE = exports.MONTH_OF_YEAR_RANGE = exports.YEAR_RANGE = void 0;
12409
12410
  var integer_1 = __importStar(require("../integer"));
12410
12411
  var error_1 = require("../error");
12411
12412
  var util_1 = require("./util");
@@ -12608,20 +12609,41 @@ exports.timeZoneOffsetToIsoString = timeZoneOffsetToIsoString;
12608
12609
  * @return {string} ISO string that represents given date.
12609
12610
  */
12610
12611
  function dateToIsoString(year, month, day) {
12611
- year = (0, integer_1.int)(year);
12612
- var isNegative = year.isNegative();
12613
- if (isNegative) {
12614
- year = year.multiply(-1);
12615
- }
12616
- var yearString = formatNumber(year, 4);
12617
- if (isNegative) {
12618
- yearString = '-' + yearString;
12619
- }
12612
+ var yearString = formatYear(year);
12620
12613
  var monthString = formatNumber(month, 2);
12621
12614
  var dayString = formatNumber(day, 2);
12622
12615
  return yearString + "-" + monthString + "-" + dayString;
12623
12616
  }
12624
12617
  exports.dateToIsoString = dateToIsoString;
12618
+ /**
12619
+ * Convert the given iso date string to a JavaScript Date object
12620
+ *
12621
+ * @param {string} isoString The iso date string
12622
+ * @returns {Date} the date
12623
+ */
12624
+ function isoStringToStandardDate(isoString) {
12625
+ return new Date(isoString);
12626
+ }
12627
+ exports.isoStringToStandardDate = isoStringToStandardDate;
12628
+ /**
12629
+ * Convert the given utc timestamp to a JavaScript Date object
12630
+ *
12631
+ * @param {number} utc Timestamp in UTC
12632
+ * @returns {Date} the date
12633
+ */
12634
+ function toStandardDate(utc) {
12635
+ return new Date(utc);
12636
+ }
12637
+ exports.toStandardDate = toStandardDate;
12638
+ /**
12639
+ * Shortcut for creating a new StandardDate
12640
+ * @param date
12641
+ * @returns {Date} the standard date
12642
+ */
12643
+ function newDate(date) {
12644
+ return new Date(date);
12645
+ }
12646
+ exports.newDate = newDate;
12625
12647
  /**
12626
12648
  * Get the total number of nanoseconds from the milliseconds of the given standard JavaScript date and optional nanosecond part.
12627
12649
  * @param {global.Date} standardDate the standard JavaScript date.
@@ -12647,11 +12669,14 @@ exports.totalNanoseconds = totalNanoseconds;
12647
12669
  * @return {number} the time zone offset in seconds.
12648
12670
  */
12649
12671
  function timeZoneOffsetInSeconds(standardDate) {
12672
+ var secondsPortion = standardDate.getSeconds() >= standardDate.getUTCSeconds()
12673
+ ? standardDate.getSeconds() - standardDate.getUTCSeconds()
12674
+ : standardDate.getSeconds() - standardDate.getUTCSeconds() + 60;
12650
12675
  var offsetInMinutes = standardDate.getTimezoneOffset();
12651
12676
  if (offsetInMinutes === 0) {
12652
- return 0;
12677
+ return 0 + secondsPortion;
12653
12678
  }
12654
- return -1 * offsetInMinutes * exports.SECONDS_PER_MINUTE;
12679
+ return -1 * offsetInMinutes * exports.SECONDS_PER_MINUTE + secondsPortion;
12655
12680
  }
12656
12681
  exports.timeZoneOffsetInSeconds = timeZoneOffsetInSeconds;
12657
12682
  /**
@@ -12845,12 +12870,24 @@ function formatNanosecond(value) {
12845
12870
  value = (0, integer_1.int)(value);
12846
12871
  return value.equals(0) ? '' : '.' + formatNumber(value, 9);
12847
12872
  }
12873
+ /**
12874
+ *
12875
+ * @param {Integer|number|string} year The year to be formatted
12876
+ * @return {string} formatted year
12877
+ */
12878
+ function formatYear(year) {
12879
+ var yearInteger = (0, integer_1.int)(year);
12880
+ if (yearInteger.isNegative() || yearInteger.greaterThan(9999)) {
12881
+ return formatNumber(yearInteger, 6, { usePositiveSign: true });
12882
+ }
12883
+ return formatNumber(yearInteger, 4);
12884
+ }
12848
12885
  /**
12849
12886
  * @param {Integer|number|string} num the number to format.
12850
12887
  * @param {number} [stringLength=undefined] the string length to left-pad to.
12851
12888
  * @return {string} formatted and possibly left-padded number as string.
12852
12889
  */
12853
- function formatNumber(num, stringLength) {
12890
+ function formatNumber(num, stringLength, params) {
12854
12891
  num = (0, integer_1.int)(num);
12855
12892
  var isNegative = num.isNegative();
12856
12893
  if (isNegative) {
@@ -12863,7 +12900,13 @@ function formatNumber(num, stringLength) {
12863
12900
  numString = '0' + numString;
12864
12901
  }
12865
12902
  }
12866
- return isNegative ? '-' + numString : numString;
12903
+ if (isNegative) {
12904
+ return '-' + numString;
12905
+ }
12906
+ else if ((params === null || params === void 0 ? void 0 : params.usePositiveSign) === true) {
12907
+ return '+' + numString;
12908
+ }
12909
+ return numString;
12867
12910
  }
12868
12911
  function add(x, y) {
12869
12912
  if (x instanceof integer_1.default) {
@@ -30737,7 +30780,7 @@ exports["default"] = void 0;
30737
30780
  // This is set up this way to keep the version in the code in
30738
30781
  // sync with the npm package version, and to allow the build
30739
30782
  // system to control version names at packaging time.
30740
- var _default = '4.4.8';
30783
+ var _default = '4.4.10';
30741
30784
  exports["default"] = _default;
30742
30785
 
30743
30786
  },{}]},{},[304])(304)