neo4j-driver 4.4.0-beta02 → 4.4.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.
@@ -5692,6 +5692,9 @@ var ChannelConnection = /** @class */ (function (_super) {
5692
5692
  };
5693
5693
  ChannelConnection.prototype._resetOnFailure = function () {
5694
5694
  var _this = this;
5695
+ if (!this.isOpen()) {
5696
+ return;
5697
+ }
5695
5698
  this._protocol.reset({
5696
5699
  onError: function () {
5697
5700
  _this._protocol.resetFailure();
@@ -8012,9 +8015,29 @@ var Pool = /** @class */ (function () {
8012
8015
  * @returns {Promise<void>} A promise that is resolved when the resources are purged
8013
8016
  */
8014
8017
  Pool.prototype.close = function () {
8015
- var _this = this;
8016
- this._closed = true;
8017
- return Promise.all(Object.keys(this._pools).map(function (key) { return _this._purgeKey(key); }));
8018
+ return __awaiter(this, void 0, void 0, function () {
8019
+ var _this = this;
8020
+ return __generator(this, function (_a) {
8021
+ switch (_a.label) {
8022
+ case 0:
8023
+ this._closed = true;
8024
+ return [4 /*yield*/, Promise.all(Object.keys(this._pools).map(function (key) { return _this._purgeKey(key); }))];
8025
+ case 1:
8026
+ /**
8027
+ * The lack of Promise consuming was making the driver do not close properly in the scenario
8028
+ * captured at result.test.js:it('should handle missing onCompleted'). The test was timing out
8029
+ * because while wainting for the driver close.
8030
+ *
8031
+ * Consuming the Promise.all or by calling then or by awaiting in the result inside this method solved
8032
+ * the issue somehow.
8033
+ *
8034
+ * PS: the return of this method was already awaited at PooledConnectionProvider.close, but the await bellow
8035
+ * seems to be need also.
8036
+ */
8037
+ return [2 /*return*/, _a.sent()];
8038
+ }
8039
+ });
8040
+ });
8018
8041
  };
8019
8042
  /**
8020
8043
  * Keep the idle resources for the provided addresses and purge the rest.
@@ -11665,10 +11688,13 @@ var ConnectionHolder = /** @class */ (function () {
11665
11688
  this._connectionPromise = this._connectionPromise
11666
11689
  .then(function (connection) {
11667
11690
  if (connection) {
11668
- return connection
11669
- .resetAndFlush()
11670
- .catch(ignoreError)
11671
- .then(function () { return connection._release(); });
11691
+ if (connection.isOpen()) {
11692
+ return connection
11693
+ .resetAndFlush()
11694
+ .catch(ignoreError)
11695
+ .then(function () { return connection._release(); });
11696
+ }
11697
+ return connection._release();
11672
11698
  }
11673
11699
  else {
11674
11700
  return Promise.resolve();
@@ -15213,8 +15239,10 @@ var Session = /** @class */ (function () {
15213
15239
  return this._transactionExecutor.execute(function () { return _this._beginTransaction(accessMode, transactionConfig); }, transactionWork);
15214
15240
  };
15215
15241
  /**
15242
+ * Sets the resolved database name in the session context.
15216
15243
  * @private
15217
15244
  * @param {string|undefined} database The resolved database name
15245
+ * @returns {void}
15218
15246
  */
15219
15247
  Session.prototype._onDatabaseNameResolved = function (database) {
15220
15248
  if (!this._databaseNameResolved) {