neo4j-driver 4.4.2 → 4.4.5

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.
@@ -1811,6 +1811,7 @@ var ResponseHandler = /** @class */ (function () {
1811
1811
  this._log = log;
1812
1812
  this._transformMetadata = transformMetadata || NO_OP_IDENTITY;
1813
1813
  this._observer = Object.assign({
1814
+ onPendingObserversChange: NO_OP,
1814
1815
  onError: NO_OP,
1815
1816
  onFailure: NO_OP,
1816
1817
  onErrorApplyTransformation: NO_OP_IDENTITY
@@ -1885,6 +1886,7 @@ var ResponseHandler = /** @class */ (function () {
1885
1886
  */
1886
1887
  ResponseHandler.prototype._updateCurrentObserver = function () {
1887
1888
  this._currentObserver = this._pendingObservers.shift();
1889
+ this._observer.onPendingObserversChange(this._pendingObservers.length);
1888
1890
  };
1889
1891
  ResponseHandler.prototype._queueObserver = function (observer) {
1890
1892
  observer = observer || NO_OP_OBSERVER;
@@ -1897,6 +1899,7 @@ var ResponseHandler = /** @class */ (function () {
1897
1899
  else {
1898
1900
  this._pendingObservers.push(observer);
1899
1901
  }
1902
+ this._observer.onPendingObserversChange(this._pendingObservers.length);
1900
1903
  return true;
1901
1904
  };
1902
1905
  ResponseHandler.prototype._notifyErrorToObservers = function (error) {
@@ -3292,6 +3295,16 @@ var WebSocketChannel = /** @class */ (function () {
3292
3295
  * @returns {void}
3293
3296
  */
3294
3297
  WebSocketChannel.prototype.setupReceiveTimeout = function (receiveTimeout) { };
3298
+ /**
3299
+ * Stops the receive timeout for the channel.
3300
+ */
3301
+ WebSocketChannel.prototype.stopReceiveTimeout = function () {
3302
+ };
3303
+ /**
3304
+ * Start the receive timeout for the channel.
3305
+ */
3306
+ WebSocketChannel.prototype.startReceiveTimeout = function () {
3307
+ };
3295
3308
  /**
3296
3309
  * Set connection timeout on the given WebSocket, if configured.
3297
3310
  * @return {number} the timeout id or null.
@@ -5482,6 +5495,7 @@ function createChannelConnection(address, config, errorHandler, log, serversideR
5482
5495
  server: conn.server,
5483
5496
  log: conn.logger,
5484
5497
  observer: {
5498
+ onPendingObserversChange: conn._handleOngoingRequestsNumberChange.bind(conn),
5485
5499
  onError: conn._handleFatalError.bind(conn),
5486
5500
  onFailure: conn._resetOnFailure.bind(conn),
5487
5501
  onProtocolError: conn._handleProtocolError.bind(conn),
@@ -5736,6 +5750,18 @@ var ChannelConnection = /** @class */ (function (_super) {
5736
5750
  ChannelConnection.prototype.isOpen = function () {
5737
5751
  return !this._isBroken && this._ch._open;
5738
5752
  };
5753
+ /**
5754
+ * Starts and stops the receive timeout timer.
5755
+ * @param {number} requestsNumber Ongoing requests number
5756
+ */
5757
+ ChannelConnection.prototype._handleOngoingRequestsNumberChange = function (requestsNumber) {
5758
+ if (requestsNumber === 0) {
5759
+ this._ch.stopReceiveTimeout();
5760
+ }
5761
+ else {
5762
+ this._ch.startReceiveTimeout();
5763
+ }
5764
+ };
5739
5765
  /**
5740
5766
  * Call close on the channel.
5741
5767
  * @returns {Promise<void>} - A promise that will be resolved when the underlying channel is closed.
@@ -8168,7 +8194,7 @@ var Pool = /** @class */ (function () {
8168
8194
  case 0:
8169
8195
  key = address.asKey();
8170
8196
  pool = this._pools[key];
8171
- if (!(pool && poolState.isActive())) return [3 /*break*/, 4];
8197
+ if (!(pool && poolState && poolState.isActive())) return [3 /*break*/, 4];
8172
8198
  if (!!this._validate(resource)) return [3 /*break*/, 2];
8173
8199
  if (this._log.isDebugEnabled()) {
8174
8200
  this._log.debug(resource + " destroyed and can't be released to the pool " + key + " because it is not functional");
@@ -9916,9 +9942,6 @@ var INT_CACHE = new Map();
9916
9942
  * @param {number} low The low (signed) 32 bits of the long
9917
9943
  * @param {number} high The high (signed) 32 bits of the long
9918
9944
  *
9919
- * @deprecated This class will be removed or made internal in a future version of the driver.
9920
- * Please configure your driver to use BigInt instead.
9921
- *
9922
9945
  * @constructor
9923
9946
  */
9924
9947
  var Integer = /** @class */ (function () {
@@ -13902,7 +13925,7 @@ var QueryStatistics = /** @class */ (function () {
13902
13925
  indexesAdded: 0,
13903
13926
  indexesRemoved: 0,
13904
13927
  constraintsAdded: 0,
13905
- constraintsRemoved: 0
13928
+ constraintsRemoved: 0,
13906
13929
  };
13907
13930
  this._systemUpdates = 0;
13908
13931
  Object.keys(statistics).forEach(function (index) {
@@ -13914,6 +13937,12 @@ var QueryStatistics = /** @class */ (function () {
13914
13937
  else if (camelCaseIndex === 'systemUpdates') {
13915
13938
  _this._systemUpdates = intValue(statistics[index]);
13916
13939
  }
13940
+ else if (camelCaseIndex === 'containsSystemUpdates') {
13941
+ _this._containsSystemUpdates = statistics[index];
13942
+ }
13943
+ else if (camelCaseIndex === 'containsUpdates') {
13944
+ _this._containsUpdates = statistics[index];
13945
+ }
13917
13946
  });
13918
13947
  this._stats = Object.freeze(this._stats);
13919
13948
  }
@@ -13923,7 +13952,8 @@ var QueryStatistics = /** @class */ (function () {
13923
13952
  */
13924
13953
  QueryStatistics.prototype.containsUpdates = function () {
13925
13954
  var _this = this;
13926
- return (Object.keys(this._stats).reduce(function (last, current) {
13955
+ return this._containsUpdates !== undefined ?
13956
+ this._containsUpdates : (Object.keys(this._stats).reduce(function (last, current) {
13927
13957
  return last + _this._stats[current];
13928
13958
  }, 0) > 0);
13929
13959
  };
@@ -13939,7 +13969,8 @@ var QueryStatistics = /** @class */ (function () {
13939
13969
  * @returns {boolean} - If the system database get updated or not.
13940
13970
  */
13941
13971
  QueryStatistics.prototype.containsSystemUpdates = function () {
13942
- return this._systemUpdates > 0;
13972
+ return this._containsSystemUpdates !== undefined ?
13973
+ this._containsSystemUpdates : this._systemUpdates > 0;
13943
13974
  };
13944
13975
  /**
13945
13976
  * @returns {number} - Number of system updates
@@ -15388,6 +15419,42 @@ function verifyStandardDateAndNanos(standardDate, nanosecond) {
15388
15419
 
15389
15420
  },{"./error":57,"./integer":60,"./internal/temporal-util":73,"./internal/util":77}],85:[function(require,module,exports){
15390
15421
  "use strict";
15422
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15423
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15424
+ return new (P || (P = Promise))(function (resolve, reject) {
15425
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15426
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15427
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15428
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15429
+ });
15430
+ };
15431
+ var __generator = (this && this.__generator) || function (thisArg, body) {
15432
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
15433
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15434
+ function verb(n) { return function (v) { return step([n, v]); }; }
15435
+ function step(op) {
15436
+ if (f) throw new TypeError("Generator is already executing.");
15437
+ while (_) try {
15438
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
15439
+ if (y = 0, t) op = [op[0] & 2, t.value];
15440
+ switch (op[0]) {
15441
+ case 0: case 1: t = op; break;
15442
+ case 4: _.label++; return { value: op[1], done: false };
15443
+ case 5: _.label++; y = op[1]; op = [0]; continue;
15444
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
15445
+ default:
15446
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
15447
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
15448
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
15449
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
15450
+ if (t[2]) _.ops.pop();
15451
+ _.trys.pop(); continue;
15452
+ }
15453
+ op = body.call(thisArg, _);
15454
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
15455
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
15456
+ }
15457
+ };
15391
15458
  var __importDefault = (this && this.__importDefault) || function (mod) {
15392
15459
  return (mod && mod.__esModule) ? mod : { "default": mod };
15393
15460
  };
@@ -15556,6 +15623,28 @@ var Transaction = /** @class */ (function () {
15556
15623
  Transaction.prototype.isOpen = function () {
15557
15624
  return this._state === _states.ACTIVE;
15558
15625
  };
15626
+ /**
15627
+ * Closes the transaction
15628
+ *
15629
+ * This method will roll back the transaction if it is not already committed or rolled back.
15630
+ *
15631
+ * @returns {Promise<void>} An empty promise if closed successfully or error if any error happened during
15632
+ */
15633
+ Transaction.prototype.close = function () {
15634
+ return __awaiter(this, void 0, void 0, function () {
15635
+ return __generator(this, function (_a) {
15636
+ switch (_a.label) {
15637
+ case 0:
15638
+ if (!this.isOpen()) return [3 /*break*/, 2];
15639
+ return [4 /*yield*/, this.rollback()];
15640
+ case 1:
15641
+ _a.sent();
15642
+ _a.label = 2;
15643
+ case 2: return [2 /*return*/];
15644
+ }
15645
+ });
15646
+ });
15647
+ };
15559
15648
  Transaction.prototype._onErrorCallback = function (err) {
15560
15649
  // error will be "acknowledged" by sending a RESET message
15561
15650
  // database will then forget about this transaction and cleanup all corresponding resources
@@ -29975,6 +30064,27 @@ var RxTransaction = /*#__PURE__*/function () {
29975
30064
  });
29976
30065
  });
29977
30066
  }
30067
+ /**
30068
+ * Closes the transaction
30069
+ *
30070
+ * This method will roll back the transaction if it is not already committed or rolled back.
30071
+ *
30072
+ * @returns {Observable} - An empty observable
30073
+ */
30074
+
30075
+ }, {
30076
+ key: "close",
30077
+ value: function close() {
30078
+ var _this4 = this;
30079
+
30080
+ return new _rxjs.Observable(function (observer) {
30081
+ _this4._txc.close().then(function () {
30082
+ observer.complete();
30083
+ })["catch"](function (err) {
30084
+ return observer.error(err);
30085
+ });
30086
+ });
30087
+ }
29978
30088
  }]);
29979
30089
  return RxTransaction;
29980
30090
  }();
@@ -30015,7 +30125,7 @@ exports["default"] = void 0;
30015
30125
  // This is set up this way to keep the version in the code in
30016
30126
  // sync with the npm package version, and to allow the build
30017
30127
  // system to control version names at packaging time.
30018
- var _default = '0.0.0-dev';
30128
+ var _default = '4.4.5';
30019
30129
  exports["default"] = _default;
30020
30130
 
30021
30131
  },{}]},{},[302])(302)