Socket
Socket
Sign inDemoInstall

neo4j-driver-bolt-connection

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neo4j-driver-bolt-connection - npm Package Compare versions

Comparing version 5.15.0 to 5.16.0

lib/connection-provider/liveness-check-provider.js

13

lib/bolt/response-handler.js

@@ -76,3 +76,3 @@ "use strict";

this._observer = Object.assign({
onPendingObserversChange: NO_OP,
onObserversCountChange: NO_OP,
onError: NO_OP,

@@ -153,4 +153,11 @@ onFailure: NO_OP,

this._currentObserver = this._pendingObservers.shift();
this._observer.onPendingObserversChange(this._pendingObservers.length);
this._observer.onObserversCountChange(this._observersCount);
};
Object.defineProperty(ResponseHandler.prototype, "_observersCount", {
get: function () {
return this._currentObserver == null ? this._pendingObservers.length : this._pendingObservers.length + 1;
},
enumerable: false,
configurable: true
});
ResponseHandler.prototype._queueObserver = function (observer) {

@@ -167,3 +174,3 @@ observer = observer || NO_OP_OBSERVER;

}
this._observer.onPendingObserversChange(this._pendingObservers.length);
this._observer.onObserversCountChange(this._observersCount);
return true;

@@ -170,0 +177,0 @@ };

@@ -56,2 +56,3 @@ "use strict";

this._receiveTimeoutId = null;
this._closingPromise = null;
var _a = determineWebSocketScheme(config, protocolSupplier), scheme = _a.scheme, error = _a.error;

@@ -154,14 +155,19 @@ if (error) {

var _this = this;
return new Promise(function (resolve, reject) {
_this._clearConnectionTimeout();
if (_this._ws && _this._ws.readyState !== WS_CLOSED) {
_this._open = false;
_this.stopReceiveTimeout();
_this._ws.onclose = function () { return resolve(); };
_this._ws.close();
}
else {
resolve();
}
});
if (this._closingPromise === null) {
this._closingPromise = new Promise(function (resolve, reject) {
_this._clearConnectionTimeout();
if (_this._ws && _this._ws.readyState !== WS_CLOSED) {
_this._open = false;
_this.stopReceiveTimeout();
_this._ws.onclose = function () {
resolve();
};
_this._ws.close();
}
else {
resolve();
}
});
}
return this._closingPromise;
};

@@ -168,0 +174,0 @@ /**

@@ -126,2 +126,3 @@ "use strict";

var lang_1 = require("../lang");
var liveness_check_provider_1 = __importDefault(require("./liveness-check-provider"));
var SERVICE_UNAVAILABLE = neo4j_driver_core_1.error.SERVICE_UNAVAILABLE;

@@ -150,2 +151,3 @@ var AUTHENTICATION_ERRORS = [

_this._authenticationProvider = new authentication_provider_1.default({ authTokenManager: authTokenManager, userAgent: userAgent, boltAgent: boltAgent });
_this._livenessCheckProvider = new liveness_check_provider_1.default({ connectionLivenessCheckTimeout: config.connectionLivenessCheckTimeout });
_this._userAgent = userAgent;

@@ -184,2 +186,3 @@ _this._boltAgent = boltAgent;

connection.release = function () {
connection.idleTimestamp = Date.now();
return release(address, connection);

@@ -200,3 +203,3 @@ };

return __awaiter(this, void 0, void 0, function () {
var error_1;
var error_1, error_2;
return __generator(this, function (_b) {

@@ -211,11 +214,21 @@ switch (_b.label) {

_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, this._authenticationProvider.authenticate({ connection: conn, auth: auth, skipReAuth: skipReAuth })];
return [4 /*yield*/, this._livenessCheckProvider.check(conn)];
case 2:
_b.sent();
return [2 /*return*/, true];
return [3 /*break*/, 4];
case 3:
error_1 = _b.sent();
this._log.debug("The connection ".concat(conn.id, " is not valid because of an error ").concat(error_1.code, " '").concat(error_1.message, "'"));
this._log.debug("The connection ".concat(conn.id, " is not alive because of an error ").concat(error_1.code, " '").concat(error_1.message, "'"));
return [2 /*return*/, false];
case 4: return [2 /*return*/];
case 4:
_b.trys.push([4, 6, , 7]);
return [4 /*yield*/, this._authenticationProvider.authenticate({ connection: conn, auth: auth, skipReAuth: skipReAuth })];
case 5:
_b.sent();
return [2 /*return*/, true];
case 6:
error_2 = _b.sent();
this._log.debug("The connection ".concat(conn.id, " is not valid because of an error ").concat(error_2.code, " '").concat(error_2.message, "'"));
return [2 /*return*/, false];
case 7: return [2 /*return*/];
}

@@ -290,3 +303,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var connectionsToRelease, address, connection, lastMessageIsNotLogin, stickyConnection, error_2;
var connectionsToRelease, address, connection, lastMessageIsNotLogin, stickyConnection, error_3;
return __generator(this, function (_b) {

@@ -325,7 +338,7 @@ switch (_b.label) {

case 8:
error_2 = _b.sent();
if (AUTHENTICATION_ERRORS.includes(error_2.code)) {
error_3 = _b.sent();
if (AUTHENTICATION_ERRORS.includes(error_3.code)) {
return [2 /*return*/, false];
}
throw error_2;
throw error_3;
case 9: return [4 /*yield*/, Promise.all(connectionsToRelease.map(function (conn) { return conn.release(); }))];

@@ -386,6 +399,6 @@ case 10:

PooledConnectionProvider._installIdleObserverOnConnection = function (conn, observer) {
conn._queueObserver(observer);
conn._setIdle(observer);
};
PooledConnectionProvider._removeIdleObserverOnConnection = function (conn) {
conn._updateCurrentObserver();
conn._unsetIdle();
};

@@ -392,0 +405,0 @@ PooledConnectionProvider.prototype._handleSecurityError = function (error, address, connection) {

@@ -111,3 +111,3 @@ "use strict";

observer: {
onPendingObserversChange: conn._handleOngoingRequestsNumberChange.bind(conn),
onObserversCountChange: conn._handleOngoingRequestsNumberChange.bind(conn),
onError: conn._handleFatalError.bind(conn),

@@ -152,2 +152,3 @@ onFailure: conn._resetOnFailure.bind(conn),

_this._authToken = null;
_this._idle = false;
_this._reseting = false;

@@ -158,3 +159,3 @@ _this._resetObservers = [];

_this._server = { address: address.asHostPort() };
_this.creationTimestamp = Date.now();
_this._creationTimestamp = Date.now();
_this._disableLosslessIntegers = disableLosslessIntegers;

@@ -248,2 +249,19 @@ _this._ch = channel;

});
Object.defineProperty(ChannelConnection.prototype, "idleTimestamp", {
get: function () {
return this._idleTimestamp;
},
set: function (value) {
this._idleTimestamp = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChannelConnection.prototype, "creationTimestamp", {
get: function () {
return this._creationTimestamp;
},
enumerable: false,
configurable: true
});
/**

@@ -406,6 +424,23 @@ * Send initialization message.

/**
* This method still here because it's used by the {@link PooledConnectionProvider}
* This method is used by the {@link PooledConnectionProvider}
*
* @param {any} observer
*/
ChannelConnection.prototype._setIdle = function (observer) {
this._idle = true;
this._ch.stopReceiveTimeout();
this._protocol.queueObserverIfProtocolIsNotBroken(observer);
};
/**
* This method is used by the {@link PooledConnectionProvider}
*/
ChannelConnection.prototype._unsetIdle = function () {
this._idle = false;
this._updateCurrentObserver();
};
/**
* This method still here because of the connection-channel.tests.js
*
* @param {any} observer
*/
ChannelConnection.prototype._queueObserver = function (observer) {

@@ -415,3 +450,3 @@ return this._protocol.queueObserverIfProtocolIsNotBroken(observer);

ChannelConnection.prototype.hasOngoingObservableRequests = function () {
return this._protocol.hasOngoingObservableRequests();
return !this._idle && this._protocol.hasOngoingObservableRequests();
};

@@ -507,2 +542,5 @@ /**

ChannelConnection.prototype._handleOngoingRequestsNumberChange = function (requestsNumber) {
if (this._idle) {
return;
}
if (requestsNumber === 0) {

@@ -509,0 +547,0 @@ this._ch.stopReceiveTimeout();

@@ -126,2 +126,19 @@ "use strict";

});
Object.defineProperty(DelegateConnection.prototype, "creationTimestamp", {
get: function () {
return this._delegate.creationTimestamp;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DelegateConnection.prototype, "idleTimestamp", {
get: function () {
return this._delegate.idleTimestamp;
},
set: function (value) {
this._delegate.idleTimestamp = value;
},
enumerable: false,
configurable: true
});
DelegateConnection.prototype.isOpen = function () {

@@ -128,0 +145,0 @@ return this._delegate.isOpen();

@@ -81,2 +81,19 @@ "use strict";

});
Object.defineProperty(Connection.prototype, "creationTimestamp", {
get: function () {
throw new Error('not implemented');
},
enumerable: false,
configurable: true
});
Object.defineProperty(Connection.prototype, "idleTimestamp", {
get: function () {
throw new Error('not implemented');
},
set: function (value) {
throw new Error('not implemented');
},
enumerable: false,
configurable: true
});
/**

@@ -83,0 +100,0 @@ * @returns {BoltProtocol} the underlying bolt protocol assigned to this connection

{
"name": "neo4j-driver-bolt-connection",
"version": "5.15.0",
"version": "5.16.0",
"description": "Implements the connection with the Neo4j Database using the Bolt Protocol",

@@ -43,6 +43,6 @@ "main": "lib/index.js",

"buffer": "^6.0.3",
"neo4j-driver-core": "5.15.0",
"neo4j-driver-core": "5.16.0",
"string_decoder": "^1.3.0"
},
"gitHead": "1c8d5cfe63ce8a03d6c1d67d6fcdb0829b42b059"
"gitHead": "532f3eaa7de85d4d762c1b30b4657dbd4d240b1e"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc