neo4j-driver 5.0.1 → 5.2.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.
package/README.md CHANGED
@@ -2,13 +2,19 @@
2
2
 
3
3
  This is the official Neo4j driver for JavaScript.
4
4
 
5
+ Starting with 5.0, the Neo4j Drivers will be moving to a monthly release cadence. A minor version will be released on the last Friday of each month so as to maintain versioning consistency with the core product (Neo4j DBMS) which has also moved to a monthly cadence.
6
+
7
+ As a policy, patch versions will not be released except on rare occasions. Bug fixes and updates will go into the latest minor version and users should upgrade to that. Driver upgrades within a major version will never contain breaking API changes.
8
+
9
+ See also: https://neo4j.com/developer/kb/neo4j-supported-versions/
10
+
5
11
  Resources to get you started:
6
12
 
7
13
  - [API Documentation](https://neo4j.com/docs/api/javascript-driver/current/)
8
14
  - [Neo4j Manual](https://neo4j.com/docs/)
9
15
  - [Neo4j Refcard](https://neo4j.com/docs/cypher-refcard/current/)
10
16
 
11
- ## What's New in 5.0
17
+ ## What's New in 5.x
12
18
 
13
19
  - [Changelog](https://github.com/neo4j/neo4j-javascript-driver/wiki/5.0-changelog)
14
20
 
@@ -14193,7 +14193,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
14193
14193
  return result;
14194
14194
  };
14195
14195
  Object.defineProperty(exports, "__esModule", { value: true });
14196
- 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.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;
14196
+ 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;
14197
14197
  var integer_1 = __importStar(require("../integer"));
14198
14198
  var error_1 = require("../error");
14199
14199
  var util_1 = require("./util");
@@ -14396,15 +14396,7 @@ exports.timeZoneOffsetToIsoString = timeZoneOffsetToIsoString;
14396
14396
  * @return {string} ISO string that represents given date.
14397
14397
  */
14398
14398
  function dateToIsoString(year, month, day) {
14399
- year = (0, integer_1.int)(year);
14400
- var isNegative = year.isNegative();
14401
- if (isNegative) {
14402
- year = year.multiply(-1);
14403
- }
14404
- var yearString = formatNumber(year, 4);
14405
- if (isNegative) {
14406
- yearString = '-' + yearString;
14407
- }
14399
+ var yearString = formatYear(year);
14408
14400
  var monthString = formatNumber(month, 2);
14409
14401
  var dayString = formatNumber(day, 2);
14410
14402
  return "".concat(yearString, "-").concat(monthString, "-").concat(dayString);
@@ -14420,6 +14412,25 @@ function isoStringToStandardDate(isoString) {
14420
14412
  return new Date(isoString);
14421
14413
  }
14422
14414
  exports.isoStringToStandardDate = isoStringToStandardDate;
14415
+ /**
14416
+ * Convert the given utc timestamp to a JavaScript Date object
14417
+ *
14418
+ * @param {number} utc Timestamp in UTC
14419
+ * @returns {Date} the date
14420
+ */
14421
+ function toStandardDate(utc) {
14422
+ return new Date(utc);
14423
+ }
14424
+ exports.toStandardDate = toStandardDate;
14425
+ /**
14426
+ * Shortcut for creating a new StandardDate
14427
+ * @param date
14428
+ * @returns {Date} the standard date
14429
+ */
14430
+ function newDate(date) {
14431
+ return new Date(date);
14432
+ }
14433
+ exports.newDate = newDate;
14423
14434
  /**
14424
14435
  * Get the total number of nanoseconds from the milliseconds of the given standard JavaScript date and optional nanosecond part.
14425
14436
  * @param {global.Date} standardDate the standard JavaScript date.
@@ -14445,11 +14456,14 @@ exports.totalNanoseconds = totalNanoseconds;
14445
14456
  * @return {number} the time zone offset in seconds.
14446
14457
  */
14447
14458
  function timeZoneOffsetInSeconds(standardDate) {
14459
+ var secondsPortion = standardDate.getSeconds() >= standardDate.getUTCSeconds()
14460
+ ? standardDate.getSeconds() - standardDate.getUTCSeconds()
14461
+ : standardDate.getSeconds() - standardDate.getUTCSeconds() + 60;
14448
14462
  var offsetInMinutes = standardDate.getTimezoneOffset();
14449
14463
  if (offsetInMinutes === 0) {
14450
- return 0;
14464
+ return 0 + secondsPortion;
14451
14465
  }
14452
- return -1 * offsetInMinutes * exports.SECONDS_PER_MINUTE;
14466
+ return -1 * offsetInMinutes * exports.SECONDS_PER_MINUTE + secondsPortion;
14453
14467
  }
14454
14468
  exports.timeZoneOffsetInSeconds = timeZoneOffsetInSeconds;
14455
14469
  /**
@@ -14643,12 +14657,24 @@ function formatNanosecond(value) {
14643
14657
  value = (0, integer_1.int)(value);
14644
14658
  return value.equals(0) ? '' : '.' + formatNumber(value, 9);
14645
14659
  }
14660
+ /**
14661
+ *
14662
+ * @param {Integer|number|string} year The year to be formatted
14663
+ * @return {string} formatted year
14664
+ */
14665
+ function formatYear(year) {
14666
+ var yearInteger = (0, integer_1.int)(year);
14667
+ if (yearInteger.isNegative() || yearInteger.greaterThan(9999)) {
14668
+ return formatNumber(yearInteger, 6, { usePositiveSign: true });
14669
+ }
14670
+ return formatNumber(yearInteger, 4);
14671
+ }
14646
14672
  /**
14647
14673
  * @param {Integer|number|string} num the number to format.
14648
14674
  * @param {number} [stringLength=undefined] the string length to left-pad to.
14649
14675
  * @return {string} formatted and possibly left-padded number as string.
14650
14676
  */
14651
- function formatNumber(num, stringLength) {
14677
+ function formatNumber(num, stringLength, params) {
14652
14678
  num = (0, integer_1.int)(num);
14653
14679
  var isNegative = num.isNegative();
14654
14680
  if (isNegative) {
@@ -14661,7 +14687,13 @@ function formatNumber(num, stringLength) {
14661
14687
  numString = '0' + numString;
14662
14688
  }
14663
14689
  }
14664
- return isNegative ? '-' + numString : numString;
14690
+ if (isNegative) {
14691
+ return '-' + numString;
14692
+ }
14693
+ else if ((params === null || params === void 0 ? void 0 : params.usePositiveSign) === true) {
14694
+ return '+' + numString;
14695
+ }
14696
+ return numString;
14665
14697
  }
14666
14698
  function add(x, y) {
14667
14699
  if (x instanceof integer_1.default) {
@@ -16568,7 +16600,7 @@ var Result = /** @class */ (function () {
16568
16600
  * *Should not be combined with {@link Result#subscribe} or ${@link Result#then} functions.*
16569
16601
  *
16570
16602
  * @public
16571
- * @returns {PeekableAsyncIterator<Record, ResultSummary>} The async iterator for the Results
16603
+ * @returns {PeekableAsyncIterator<Record<RecordShape>, ResultSummary>} The async iterator for the Results
16572
16604
  */
16573
16605
  Result.prototype[Symbol.asyncIterator] = function () {
16574
16606
  var _this = this;
@@ -18183,14 +18215,7 @@ var DateTime = /** @class */ (function () {
18183
18215
  * @throws {Error} If the time zone offset is not defined in the object.
18184
18216
  */
18185
18217
  DateTime.prototype.toStandardDate = function () {
18186
- if (this.timeZoneOffsetSeconds === undefined) {
18187
- throw new Error('Requires DateTime created with time zone offset');
18188
- }
18189
- return util.isoStringToStandardDate(
18190
- // the timezone name should be removed from the
18191
- // string, otherwise the javascript parse doesn't
18192
- // read the datetime correctly
18193
- this.toString().replace(this.timeZoneId != null ? "[".concat(this.timeZoneId, "]") : '', ''));
18218
+ return util.toStandardDate(this._toUTC());
18194
18219
  };
18195
18220
  /**
18196
18221
  * @ignore
@@ -18206,6 +18231,22 @@ var DateTime = /** @class */ (function () {
18206
18231
  : '';
18207
18232
  return localDateTimeStr + timeOffset + timeZoneStr;
18208
18233
  };
18234
+ /**
18235
+ * @private
18236
+ * @returns {number}
18237
+ */
18238
+ DateTime.prototype._toUTC = function () {
18239
+ var _a;
18240
+ if (this.timeZoneOffsetSeconds === undefined) {
18241
+ throw new Error('Requires DateTime created with time zone offset');
18242
+ }
18243
+ var epochSecond = util.localDateTimeToEpochSecond(this.year, this.month, this.day, this.hour, this.minute, this.second, this.nanosecond);
18244
+ var utcSecond = epochSecond.subtract((_a = this.timeZoneOffsetSeconds) !== null && _a !== void 0 ? _a : 0);
18245
+ return (0, integer_1.int)(utcSecond)
18246
+ .multiply(1000)
18247
+ .add((0, integer_1.int)(this.nanosecond).div(1000000))
18248
+ .toNumber();
18249
+ };
18209
18250
  return DateTime;
18210
18251
  }());
18211
18252
  exports.DateTime = DateTime;
@@ -18608,6 +18649,7 @@ var Transaction = /** @class */ (function () {
18608
18649
  this._lowRecordWatermak = lowRecordWatermark;
18609
18650
  this._highRecordWatermark = highRecordWatermark;
18610
18651
  this._bookmarks = bookmarks_1.Bookmarks.empty();
18652
+ this._acceptActive = function () { }; // satisfy DenoJS
18611
18653
  this._activePromise = new Promise(function (resolve, reject) {
18612
18654
  _this._acceptActive = resolve;
18613
18655
  });
@@ -32669,7 +32711,7 @@ exports["default"] = void 0;
32669
32711
  // This is set up this way to keep the version in the code in
32670
32712
  // sync with the npm package version, and to allow the build
32671
32713
  // system to control version names at packaging time.
32672
- var _default = '5.0.1';
32714
+ var _default = '5.2.0';
32673
32715
  exports["default"] = _default;
32674
32716
 
32675
32717
  },{}]},{},[350])(350)