neo4j-driver 4.3.1 → 4.3.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.
- package/README.md +35 -1
- package/lib/browser/neo4j-web.js +68 -15
- package/lib/browser/neo4j-web.min.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ This is the official Neo4j driver for JavaScript.
|
|
|
4
4
|
|
|
5
5
|
Resources to get you started:
|
|
6
6
|
|
|
7
|
-
- [API Documentation](https://neo4j.com/docs/api/javascript-driver/4.
|
|
7
|
+
- [API Documentation](https://neo4j.com/docs/api/javascript-driver/4.3/)
|
|
8
8
|
- [Neo4j Manual](https://neo4j.com/docs/)
|
|
9
9
|
- [Neo4j Refcard](https://neo4j.com/docs/cypher-refcard/current/)
|
|
10
10
|
|
|
@@ -490,6 +490,40 @@ See files under `examples/` on how to use.
|
|
|
490
490
|
|
|
491
491
|
## Testing
|
|
492
492
|
|
|
493
|
+
Tests **require** latest [Testkit 4.3](https://github.com/neo4j-drivers/testkit/tree/4.3), Python3 and Docker.
|
|
494
|
+
|
|
495
|
+
Testkit is needed to be cloned and configured to run against the Javascript Lite Driver. Use the following steps to configure Testkit.
|
|
496
|
+
|
|
497
|
+
1. Clone the Testkit repository
|
|
498
|
+
|
|
499
|
+
```
|
|
500
|
+
git clone https://github.com/neo4j-drivers/testkit.git
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
2. Under the Testkit folder, install the requirements.
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
pip3 install -r requirements.txt
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
3. Define some enviroment variables to configure Testkit
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
export TEST_DRIVER_NAME=javascript
|
|
513
|
+
export TEST_DRIVER_REPO=<path for the root folder of driver repository>
|
|
514
|
+
unset TEST_DRIVER_LITE
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
To run test against against some Neo4j version:
|
|
518
|
+
|
|
519
|
+
```
|
|
520
|
+
python3 main.py
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
More details about how to use Teskit could be found on [its repository](https://github.com/neo4j-drivers/testkit/tree/4.3)
|
|
524
|
+
|
|
525
|
+
## Testing (Legacy)
|
|
526
|
+
|
|
493
527
|
Tests **require** latest [Boltkit](https://github.com/neo4j-contrib/boltkit) and [Firefox](https://www.mozilla.org/firefox/) to be installed in the system.
|
|
494
528
|
|
|
495
529
|
Boltkit is needed to start, stop and configure local test database. Boltkit can be installed with the following command:
|
package/lib/browser/neo4j-web.js
CHANGED
|
@@ -129,6 +129,13 @@ var BoltProtocol = /** @class */ (function () {
|
|
|
129
129
|
enumerable: false,
|
|
130
130
|
configurable: true
|
|
131
131
|
});
|
|
132
|
+
Object.defineProperty(BoltProtocol.prototype, "currentFailure", {
|
|
133
|
+
get: function () {
|
|
134
|
+
return this._responseHandler.currentFailure;
|
|
135
|
+
},
|
|
136
|
+
enumerable: false,
|
|
137
|
+
configurable: true
|
|
138
|
+
});
|
|
132
139
|
/**
|
|
133
140
|
* Get the packer.
|
|
134
141
|
* @return {Packer} the protocol's packer.
|
|
@@ -1693,6 +1700,13 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
1693
1700
|
this._observer.onError(neo4j_driver_core_1.newError('Unknown Bolt protocol message: ' + msg));
|
|
1694
1701
|
}
|
|
1695
1702
|
};
|
|
1703
|
+
Object.defineProperty(ResponseHandler.prototype, "currentFailure", {
|
|
1704
|
+
get: function () {
|
|
1705
|
+
return this._currentFailure;
|
|
1706
|
+
},
|
|
1707
|
+
enumerable: false,
|
|
1708
|
+
configurable: true
|
|
1709
|
+
});
|
|
1696
1710
|
/*
|
|
1697
1711
|
* Pop next pending observer form the list of observers and make it current observer.
|
|
1698
1712
|
* @protected
|
|
@@ -3165,6 +3179,15 @@ var WebSocketChannel = /** @class */ (function () {
|
|
|
3165
3179
|
}
|
|
3166
3180
|
});
|
|
3167
3181
|
};
|
|
3182
|
+
/**
|
|
3183
|
+
* Setup the receive timeout for the channel.
|
|
3184
|
+
*
|
|
3185
|
+
* Not supported for the browser channel.
|
|
3186
|
+
*
|
|
3187
|
+
* @param {number} receiveTimeout The amount of time the channel will keep without receive any data before timeout (ms)
|
|
3188
|
+
* @returns {void}
|
|
3189
|
+
*/
|
|
3190
|
+
WebSocketChannel.prototype.setupReceiveTimeout = function (receiveTimeout) { };
|
|
3168
3191
|
/**
|
|
3169
3192
|
* Set connection timeout on the given WebSocket, if configured.
|
|
3170
3193
|
* @return {number} the timeout id or null.
|
|
@@ -4762,7 +4785,8 @@ var RoutingConnectionProvider = /** @class */ (function (_super) {
|
|
|
4762
4785
|
};
|
|
4763
4786
|
RoutingConnectionProvider.prototype._createSessionForRediscovery = function (routerAddress, bookmark) {
|
|
4764
4787
|
return __awaiter(this, void 0, void 0, function () {
|
|
4765
|
-
var connection, connectionProvider, protocolVersion, error_4;
|
|
4788
|
+
var connection, databaseSpecificErrorHandler, connectionProvider, protocolVersion, error_4;
|
|
4789
|
+
var _this = this;
|
|
4766
4790
|
return __generator(this, function (_a) {
|
|
4767
4791
|
switch (_a.label) {
|
|
4768
4792
|
case 0:
|
|
@@ -4770,7 +4794,11 @@ var RoutingConnectionProvider = /** @class */ (function (_super) {
|
|
|
4770
4794
|
return [4 /*yield*/, this._connectionPool.acquire(routerAddress)];
|
|
4771
4795
|
case 1:
|
|
4772
4796
|
connection = _a.sent();
|
|
4773
|
-
|
|
4797
|
+
databaseSpecificErrorHandler = connection_1.ConnectionErrorHandler.create({
|
|
4798
|
+
errorCode: SESSION_EXPIRED,
|
|
4799
|
+
handleAuthorizationExpired: function (error, address) { return _this._handleAuthorizationExpired(error, address); }
|
|
4800
|
+
});
|
|
4801
|
+
connectionProvider = new connection_provider_single_1.default(new connection_1.DelegateConnection(connection, databaseSpecificErrorHandler));
|
|
4774
4802
|
protocolVersion = connection.protocol().version;
|
|
4775
4803
|
if (protocolVersion < 4.0) {
|
|
4776
4804
|
return [2 /*return*/, new neo4j_driver_core_1.Session({
|
|
@@ -5280,6 +5308,21 @@ var ChannelConnection = /** @class */ (function (_super) {
|
|
|
5280
5308
|
if (!_this.databaseId) {
|
|
5281
5309
|
_this.databaseId = dbConnectionId;
|
|
5282
5310
|
}
|
|
5311
|
+
if (metadata.hints) {
|
|
5312
|
+
var receiveTimeoutRaw = metadata.hints['connection.recv_timeout_seconds'];
|
|
5313
|
+
if (receiveTimeoutRaw !== null &&
|
|
5314
|
+
receiveTimeoutRaw !== undefined) {
|
|
5315
|
+
var receiveTimeoutInSeconds = neo4j_driver_core_1.toNumber(receiveTimeoutRaw);
|
|
5316
|
+
if (Number.isInteger(receiveTimeoutInSeconds) &&
|
|
5317
|
+
receiveTimeoutInSeconds > 0) {
|
|
5318
|
+
_this._ch.setupReceiveTimeout(receiveTimeoutInSeconds * 1000);
|
|
5319
|
+
}
|
|
5320
|
+
else {
|
|
5321
|
+
_this._log.info("Server located at " + _this._address + " supplied an invalid connection receive timeout value (" + receiveTimeoutInSeconds + "). " +
|
|
5322
|
+
'Please, verify the server configuration and status because this can be the symptom of a bigger issue.');
|
|
5323
|
+
}
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5283
5326
|
}
|
|
5284
5327
|
resolve(self);
|
|
5285
5328
|
}
|
|
@@ -5339,7 +5382,7 @@ var ChannelConnection = /** @class */ (function (_super) {
|
|
|
5339
5382
|
*/
|
|
5340
5383
|
ChannelConnection.prototype._handleFatalError = function (error) {
|
|
5341
5384
|
this._isBroken = true;
|
|
5342
|
-
this._error = this.handleAndTransformError(error, this._address);
|
|
5385
|
+
this._error = this.handleAndTransformError(this._protocol.currentFailure || error, this._address);
|
|
5343
5386
|
if (this._log.isErrorEnabled()) {
|
|
5344
5387
|
this._log.error("experienced a fatal error " + neo4j_driver_core_1.json.stringify(this._error));
|
|
5345
5388
|
}
|
|
@@ -6811,7 +6854,7 @@ var Unpacker = /** @class */ (function () {
|
|
|
6811
6854
|
var prevNode = nodes[0];
|
|
6812
6855
|
for (var i = 0; i < sequence.length; i += 2) {
|
|
6813
6856
|
var nextNode = nodes[sequence[i + 1]];
|
|
6814
|
-
var relIndex = sequence[i];
|
|
6857
|
+
var relIndex = neo4j_driver_core_1.toNumber(sequence[i]);
|
|
6815
6858
|
var rel = void 0;
|
|
6816
6859
|
if (relIndex > 0) {
|
|
6817
6860
|
rel = rels[relIndex - 1];
|
|
@@ -7680,7 +7723,7 @@ var Pool = /** @class */ (function () {
|
|
|
7680
7723
|
// request is still pending and needs to be failed
|
|
7681
7724
|
var activeCount = _this.activeResourceCount(address);
|
|
7682
7725
|
var idleCount = _this.has(address) ? _this._pools[key].length : 0;
|
|
7683
|
-
request.reject(neo4j_driver_core_1.newError("Connection acquisition timed out in " + _this._acquisitionTimeout + " ms.
|
|
7726
|
+
request.reject(neo4j_driver_core_1.newError("Connection acquisition timed out in " + _this._acquisitionTimeout + " ms. Pool status: Active conn count = " + activeCount + ", Idle conn count = " + idleCount + "."));
|
|
7684
7727
|
}
|
|
7685
7728
|
}, _this._acquisitionTimeout);
|
|
7686
7729
|
request = new PendingRequest(key, resolve, reject, timeoutId, _this._log);
|
|
@@ -8149,13 +8192,14 @@ var MIN_ROUTERS = 1;
|
|
|
8149
8192
|
*/
|
|
8150
8193
|
var RoutingTable = /** @class */ (function () {
|
|
8151
8194
|
function RoutingTable(_a) {
|
|
8152
|
-
var _b = _a === void 0 ? {} : _a, database = _b.database, routers = _b.routers, readers = _b.readers, writers = _b.writers, expirationTime = _b.expirationTime;
|
|
8195
|
+
var _b = _a === void 0 ? {} : _a, database = _b.database, routers = _b.routers, readers = _b.readers, writers = _b.writers, expirationTime = _b.expirationTime, ttl = _b.ttl;
|
|
8153
8196
|
this.database = database;
|
|
8154
8197
|
this.databaseName = database || 'default database';
|
|
8155
8198
|
this.routers = routers || [];
|
|
8156
8199
|
this.readers = readers || [];
|
|
8157
8200
|
this.writers = writers || [];
|
|
8158
8201
|
this.expirationTime = expirationTime || neo4j_driver_core_1.int(0);
|
|
8202
|
+
this.ttl = ttl;
|
|
8159
8203
|
}
|
|
8160
8204
|
/**
|
|
8161
8205
|
* Create a valid routing table from a raw object
|
|
@@ -8234,6 +8278,7 @@ function removeFromArray(array, element) {
|
|
|
8234
8278
|
* @param {RoutingTable} The valid Routing Table
|
|
8235
8279
|
*/
|
|
8236
8280
|
function createValidRoutingTable(database, routerAddress, rawRoutingTable) {
|
|
8281
|
+
var ttl = rawRoutingTable.ttl;
|
|
8237
8282
|
var expirationTime = calculateExpirationTime(rawRoutingTable, routerAddress);
|
|
8238
8283
|
var _a = parseServers(rawRoutingTable, routerAddress), routers = _a.routers, readers = _a.readers, writers = _a.writers;
|
|
8239
8284
|
assertNonEmpty(routers, 'routers', routerAddress);
|
|
@@ -8243,7 +8288,8 @@ function createValidRoutingTable(database, routerAddress, rawRoutingTable) {
|
|
|
8243
8288
|
routers: routers,
|
|
8244
8289
|
readers: readers,
|
|
8245
8290
|
writers: writers,
|
|
8246
|
-
expirationTime: expirationTime
|
|
8291
|
+
expirationTime: expirationTime,
|
|
8292
|
+
ttl: ttl
|
|
8247
8293
|
});
|
|
8248
8294
|
}
|
|
8249
8295
|
exports.createValidRoutingTable = createValidRoutingTable;
|
|
@@ -9552,7 +9598,7 @@ var Node = /** @class */ (function () {
|
|
|
9552
9598
|
* @protected
|
|
9553
9599
|
* @param {Integer|number} identity - Unique identity
|
|
9554
9600
|
* @param {Array<string>} labels - Array for all labels
|
|
9555
|
-
* @param {
|
|
9601
|
+
* @param {Properties} properties - Map with node properties
|
|
9556
9602
|
*/
|
|
9557
9603
|
function Node(identity, labels, properties) {
|
|
9558
9604
|
/**
|
|
@@ -9567,7 +9613,7 @@ var Node = /** @class */ (function () {
|
|
|
9567
9613
|
this.labels = labels;
|
|
9568
9614
|
/**
|
|
9569
9615
|
* Properties of the node.
|
|
9570
|
-
* @type {
|
|
9616
|
+
* @type {Properties}
|
|
9571
9617
|
*/
|
|
9572
9618
|
this.properties = properties;
|
|
9573
9619
|
}
|
|
@@ -9616,7 +9662,7 @@ var Relationship = /** @class */ (function () {
|
|
|
9616
9662
|
* @param {Integer|number} start - Identity of start Node
|
|
9617
9663
|
* @param {Integer|number} end - Identity of end Node
|
|
9618
9664
|
* @param {string} type - Relationship type
|
|
9619
|
-
* @param {
|
|
9665
|
+
* @param {Properties} properties - Map with relationship properties
|
|
9620
9666
|
*/
|
|
9621
9667
|
function Relationship(identity, start, end, type, properties) {
|
|
9622
9668
|
/**
|
|
@@ -9641,7 +9687,7 @@ var Relationship = /** @class */ (function () {
|
|
|
9641
9687
|
this.type = type;
|
|
9642
9688
|
/**
|
|
9643
9689
|
* Properties of the relationship.
|
|
9644
|
-
* @type {
|
|
9690
|
+
* @type {Properties}
|
|
9645
9691
|
*/
|
|
9646
9692
|
this.properties = properties;
|
|
9647
9693
|
}
|
|
@@ -9686,7 +9732,7 @@ var UnboundRelationship = /** @class */ (function () {
|
|
|
9686
9732
|
* @protected
|
|
9687
9733
|
* @param {Integer|number} identity - Unique identity
|
|
9688
9734
|
* @param {string} type - Relationship type
|
|
9689
|
-
* @param {
|
|
9735
|
+
* @param {Properties} properties - Map with relationship properties
|
|
9690
9736
|
*/
|
|
9691
9737
|
function UnboundRelationship(identity, type, properties) {
|
|
9692
9738
|
/**
|
|
@@ -9701,7 +9747,7 @@ var UnboundRelationship = /** @class */ (function () {
|
|
|
9701
9747
|
this.type = type;
|
|
9702
9748
|
/**
|
|
9703
9749
|
* Properties of the relationship.
|
|
9704
|
-
* @type {
|
|
9750
|
+
* @type {Properties}
|
|
9705
9751
|
*/
|
|
9706
9752
|
this.properties = properties;
|
|
9707
9753
|
}
|
|
@@ -10791,7 +10837,14 @@ var Integer = /** @class */ (function () {
|
|
|
10791
10837
|
* @expose
|
|
10792
10838
|
*/
|
|
10793
10839
|
Integer.toNumber = function (val) {
|
|
10794
|
-
|
|
10840
|
+
switch (typeof val) {
|
|
10841
|
+
case 'number':
|
|
10842
|
+
return val;
|
|
10843
|
+
case 'bigint':
|
|
10844
|
+
return Number(val);
|
|
10845
|
+
default:
|
|
10846
|
+
return Integer.fromValue(val).toNumber();
|
|
10847
|
+
}
|
|
10795
10848
|
};
|
|
10796
10849
|
/**
|
|
10797
10850
|
* Converts the specified value to a string.
|
|
@@ -27769,7 +27822,7 @@ exports["default"] = void 0;
|
|
|
27769
27822
|
// This is set up this way to keep the version in the code in
|
|
27770
27823
|
// sync with the npm package version, and to allow the build
|
|
27771
27824
|
// system to control version names at packaging time.
|
|
27772
|
-
var _default = '4.3.
|
|
27825
|
+
var _default = '4.3.5';
|
|
27773
27826
|
exports["default"] = _default;
|
|
27774
27827
|
|
|
27775
27828
|
},{}]},{},[296])(296)
|