neo4j-driver 4.4.1 → 4.4.2
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/lib/browser/neo4j-web.js +40 -55
- package/lib/browser/neo4j-web.min.js +1 -1
- package/lib/driver.js +1 -1
- package/package.json +4 -4
- package/types/session-rx.d.ts +1 -1
package/lib/browser/neo4j-web.js
CHANGED
|
@@ -727,25 +727,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
727
727
|
};
|
|
728
728
|
return __assign.apply(this, arguments);
|
|
729
729
|
};
|
|
730
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
731
|
-
if (k2 === undefined) k2 = k;
|
|
732
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
733
|
-
}) : (function(o, m, k, k2) {
|
|
734
|
-
if (k2 === undefined) k2 = k;
|
|
735
|
-
o[k2] = m[k];
|
|
736
|
-
}));
|
|
737
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
738
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
739
|
-
}) : function(o, v) {
|
|
740
|
-
o["default"] = v;
|
|
741
|
-
});
|
|
742
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
743
|
-
if (mod && mod.__esModule) return mod;
|
|
744
|
-
var result = {};
|
|
745
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
746
|
-
__setModuleDefault(result, mod);
|
|
747
|
-
return result;
|
|
748
|
-
};
|
|
749
730
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
750
731
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
751
732
|
};
|
|
@@ -769,11 +750,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
769
750
|
* limitations under the License.
|
|
770
751
|
*/
|
|
771
752
|
var bolt_protocol_v3_1 = __importDefault(require("./bolt-protocol-v3"));
|
|
772
|
-
var request_message_1 =
|
|
753
|
+
var request_message_1 = __importDefault(require("./request-message"));
|
|
773
754
|
var bolt_protocol_util_1 = require("./bolt-protocol-util");
|
|
774
755
|
var stream_observers_1 = require("./stream-observers");
|
|
775
756
|
var neo4j_driver_core_1 = require("neo4j-driver-core");
|
|
776
|
-
var Bookmark = neo4j_driver_core_1.internal.bookmark.Bookmark,
|
|
757
|
+
var Bookmark = neo4j_driver_core_1.internal.bookmark.Bookmark, _a = neo4j_driver_core_1.internal.constants, BOLT_PROTOCOL_V4_0 = _a.BOLT_PROTOCOL_V4_0, FETCH_ALL = _a.FETCH_ALL, TxConfig = neo4j_driver_core_1.internal.txConfig.TxConfig;
|
|
777
758
|
var CONTEXT = 'context';
|
|
778
759
|
var DATABASE = 'database';
|
|
779
760
|
var CALL_GET_ROUTING_TABLE_MULTI_DB = "CALL dbms.routing.getRoutingTable($" + CONTEXT + ", $" + DATABASE + ")";
|
|
@@ -805,7 +786,7 @@ var BoltProtocol = /** @class */ (function (_super) {
|
|
|
805
786
|
return observer;
|
|
806
787
|
};
|
|
807
788
|
BoltProtocol.prototype.run = function (query, parameters, _a) {
|
|
808
|
-
var _b = _a === void 0 ? {} : _a, bookmark = _b.bookmark, txConfig = _b.txConfig, database = _b.database, impersonatedUser = _b.impersonatedUser, mode = _b.mode, beforeKeys = _b.beforeKeys, afterKeys = _b.afterKeys, beforeError = _b.beforeError, afterError = _b.afterError, beforeComplete = _b.beforeComplete, afterComplete = _b.afterComplete, _c = _b.flush, flush = _c === void 0 ? true : _c, _d = _b.reactive, reactive = _d === void 0 ? false : _d, _e = _b.fetchSize, fetchSize = _e === void 0 ?
|
|
789
|
+
var _b = _a === void 0 ? {} : _a, bookmark = _b.bookmark, txConfig = _b.txConfig, database = _b.database, impersonatedUser = _b.impersonatedUser, mode = _b.mode, beforeKeys = _b.beforeKeys, afterKeys = _b.afterKeys, beforeError = _b.beforeError, afterError = _b.afterError, beforeComplete = _b.beforeComplete, afterComplete = _b.afterComplete, _c = _b.flush, flush = _c === void 0 ? true : _c, _d = _b.reactive, reactive = _d === void 0 ? false : _d, _e = _b.fetchSize, fetchSize = _e === void 0 ? FETCH_ALL : _e;
|
|
809
790
|
var observer = new stream_observers_1.ResultStreamObserver({
|
|
810
791
|
server: this._server,
|
|
811
792
|
reactive: reactive,
|
|
@@ -1116,25 +1097,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
1116
1097
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1117
1098
|
};
|
|
1118
1099
|
})();
|
|
1119
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1120
|
-
if (k2 === undefined) k2 = k;
|
|
1121
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
1122
|
-
}) : (function(o, m, k, k2) {
|
|
1123
|
-
if (k2 === undefined) k2 = k;
|
|
1124
|
-
o[k2] = m[k];
|
|
1125
|
-
}));
|
|
1126
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
1127
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1128
|
-
}) : function(o, v) {
|
|
1129
|
-
o["default"] = v;
|
|
1130
|
-
});
|
|
1131
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1132
|
-
if (mod && mod.__esModule) return mod;
|
|
1133
|
-
var result = {};
|
|
1134
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1135
|
-
__setModuleDefault(result, mod);
|
|
1136
|
-
return result;
|
|
1137
|
-
};
|
|
1138
1100
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1139
1101
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1140
1102
|
};
|
|
@@ -1159,9 +1121,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
1159
1121
|
*/
|
|
1160
1122
|
var bolt_protocol_v4x3_1 = __importDefault(require("./bolt-protocol-v4x3"));
|
|
1161
1123
|
var neo4j_driver_core_1 = require("neo4j-driver-core");
|
|
1162
|
-
var request_message_1 =
|
|
1124
|
+
var request_message_1 = __importDefault(require("./request-message"));
|
|
1163
1125
|
var stream_observers_1 = require("./stream-observers");
|
|
1164
|
-
var
|
|
1126
|
+
var _a = neo4j_driver_core_1.internal.constants, BOLT_PROTOCOL_V4_4 = _a.BOLT_PROTOCOL_V4_4, FETCH_ALL = _a.FETCH_ALL, Bookmark = neo4j_driver_core_1.internal.bookmark.Bookmark;
|
|
1165
1127
|
var BoltProtocol = /** @class */ (function (_super) {
|
|
1166
1128
|
__extends(BoltProtocol, _super);
|
|
1167
1129
|
function BoltProtocol() {
|
|
@@ -1198,7 +1160,7 @@ var BoltProtocol = /** @class */ (function (_super) {
|
|
|
1198
1160
|
return observer;
|
|
1199
1161
|
};
|
|
1200
1162
|
BoltProtocol.prototype.run = function (query, parameters, _a) {
|
|
1201
|
-
var _b = _a === void 0 ? {} : _a, bookmark = _b.bookmark, txConfig = _b.txConfig, database = _b.database, mode = _b.mode, impersonatedUser = _b.impersonatedUser, beforeKeys = _b.beforeKeys, afterKeys = _b.afterKeys, beforeError = _b.beforeError, afterError = _b.afterError, beforeComplete = _b.beforeComplete, afterComplete = _b.afterComplete, _c = _b.flush, flush = _c === void 0 ? true : _c, _d = _b.reactive, reactive = _d === void 0 ? false : _d, _e = _b.fetchSize, fetchSize = _e === void 0 ?
|
|
1163
|
+
var _b = _a === void 0 ? {} : _a, bookmark = _b.bookmark, txConfig = _b.txConfig, database = _b.database, mode = _b.mode, impersonatedUser = _b.impersonatedUser, beforeKeys = _b.beforeKeys, afterKeys = _b.afterKeys, beforeError = _b.beforeError, afterError = _b.afterError, beforeComplete = _b.beforeComplete, afterComplete = _b.afterComplete, _c = _b.flush, flush = _c === void 0 ? true : _c, _d = _b.reactive, reactive = _d === void 0 ? false : _d, _e = _b.fetchSize, fetchSize = _e === void 0 ? FETCH_ALL : _e;
|
|
1202
1164
|
var observer = new stream_observers_1.ResultStreamObserver({
|
|
1203
1165
|
server: this._server,
|
|
1204
1166
|
reactive: reactive,
|
|
@@ -2205,8 +2167,8 @@ exports.ProcedureRouteObserver = exports.RouteObserver = exports.CompletedObserv
|
|
|
2205
2167
|
* limitations under the License.
|
|
2206
2168
|
*/
|
|
2207
2169
|
var neo4j_driver_core_1 = require("neo4j-driver-core");
|
|
2208
|
-
var request_message_1 = require("./request-message");
|
|
2209
2170
|
var routing_table_raw_1 = __importDefault(require("./routing-table-raw"));
|
|
2171
|
+
var FETCH_ALL = neo4j_driver_core_1.internal.constants.FETCH_ALL;
|
|
2210
2172
|
var PROTOCOL_ERROR = neo4j_driver_core_1.error.PROTOCOL_ERROR;
|
|
2211
2173
|
var StreamObserver = /** @class */ (function () {
|
|
2212
2174
|
function StreamObserver() {
|
|
@@ -2245,7 +2207,7 @@ var ResultStreamObserver = /** @class */ (function (_super) {
|
|
|
2245
2207
|
* @param {function(metadata: Object): Promise|void} param.afterComplete -
|
|
2246
2208
|
*/
|
|
2247
2209
|
function ResultStreamObserver(_a) {
|
|
2248
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.reactive, reactive = _c === void 0 ? false : _c, moreFunction = _b.moreFunction, discardFunction = _b.discardFunction, _d = _b.fetchSize, fetchSize = _d === void 0 ?
|
|
2210
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.reactive, reactive = _c === void 0 ? false : _c, moreFunction = _b.moreFunction, discardFunction = _b.discardFunction, _d = _b.fetchSize, fetchSize = _d === void 0 ? FETCH_ALL : _d, beforeError = _b.beforeError, afterError = _b.afterError, beforeKeys = _b.beforeKeys, afterKeys = _b.afterKeys, beforeComplete = _b.beforeComplete, afterComplete = _b.afterComplete, server = _b.server;
|
|
2249
2211
|
var _this = _super.call(this) || this;
|
|
2250
2212
|
_this._fieldKeys = null;
|
|
2251
2213
|
_this._fieldLookup = null;
|
|
@@ -2511,7 +2473,7 @@ var ResultStreamObserver = /** @class */ (function (_super) {
|
|
|
2511
2473
|
};
|
|
2512
2474
|
ResultStreamObserver.prototype._setupAuoPull = function (fetchSize) {
|
|
2513
2475
|
this._autoPull = true;
|
|
2514
|
-
if (fetchSize ===
|
|
2476
|
+
if (fetchSize === FETCH_ALL) {
|
|
2515
2477
|
this._lowRecordWatermark = Number.MAX_VALUE; // we shall always lower than this number to enable auto pull
|
|
2516
2478
|
this._highRecordWatermark = Number.MAX_VALUE; // we shall never reach this number to disable auto pull
|
|
2517
2479
|
}
|
|
@@ -2749,7 +2711,7 @@ var _states = {
|
|
|
2749
2711
|
}
|
|
2750
2712
|
};
|
|
2751
2713
|
|
|
2752
|
-
},{"./
|
|
2714
|
+
},{"./routing-table-raw":15,"neo4j-driver-core":59}],17:[function(require,module,exports){
|
|
2753
2715
|
"use strict";
|
|
2754
2716
|
/**
|
|
2755
2717
|
* Copyright (c) "Neo4j"
|
|
@@ -8013,6 +7975,7 @@ var Pool = /** @class */ (function () {
|
|
|
8013
7975
|
this._pendingCreates = {};
|
|
8014
7976
|
this._acquireRequests = {};
|
|
8015
7977
|
this._activeResourceCounts = {};
|
|
7978
|
+
this._poolState = {};
|
|
8016
7979
|
this._release = this._release.bind(this);
|
|
8017
7980
|
this._log = log;
|
|
8018
7981
|
this._closed = false;
|
|
@@ -8127,7 +8090,8 @@ var Pool = /** @class */ (function () {
|
|
|
8127
8090
|
};
|
|
8128
8091
|
Pool.prototype._acquire = function (address) {
|
|
8129
8092
|
return __awaiter(this, void 0, void 0, function () {
|
|
8130
|
-
var key, pool, resource_1, numConnections, resource;
|
|
8093
|
+
var key, pool, poolState, resource_1, numConnections, resource;
|
|
8094
|
+
var _this = this;
|
|
8131
8095
|
return __generator(this, function (_a) {
|
|
8132
8096
|
switch (_a.label) {
|
|
8133
8097
|
case 0:
|
|
@@ -8136,10 +8100,13 @@ var Pool = /** @class */ (function () {
|
|
|
8136
8100
|
}
|
|
8137
8101
|
key = address.asKey();
|
|
8138
8102
|
pool = this._pools[key];
|
|
8103
|
+
poolState = this._poolState[key];
|
|
8139
8104
|
if (!pool) {
|
|
8140
8105
|
pool = [];
|
|
8106
|
+
poolState = new PoolState();
|
|
8141
8107
|
this._pools[key] = pool;
|
|
8142
8108
|
this._pendingCreates[key] = 0;
|
|
8109
|
+
this._poolState[key] = poolState;
|
|
8143
8110
|
}
|
|
8144
8111
|
_a.label = 1;
|
|
8145
8112
|
case 1:
|
|
@@ -8175,7 +8142,7 @@ var Pool = /** @class */ (function () {
|
|
|
8175
8142
|
_a.label = 6;
|
|
8176
8143
|
case 6:
|
|
8177
8144
|
_a.trys.push([6, , 8, 9]);
|
|
8178
|
-
return [4 /*yield*/, this._create(address,
|
|
8145
|
+
return [4 /*yield*/, this._create(address, function (address, resource) { return _this._release(poolState, address, resource); })];
|
|
8179
8146
|
case 7:
|
|
8180
8147
|
// Invoke callback that creates actual connection
|
|
8181
8148
|
resource = _a.sent();
|
|
@@ -8192,7 +8159,7 @@ var Pool = /** @class */ (function () {
|
|
|
8192
8159
|
});
|
|
8193
8160
|
});
|
|
8194
8161
|
};
|
|
8195
|
-
Pool.prototype._release = function (address, resource) {
|
|
8162
|
+
Pool.prototype._release = function (poolState, address, resource) {
|
|
8196
8163
|
return __awaiter(this, void 0, void 0, function () {
|
|
8197
8164
|
var key, pool;
|
|
8198
8165
|
var _this = this;
|
|
@@ -8201,7 +8168,7 @@ var Pool = /** @class */ (function () {
|
|
|
8201
8168
|
case 0:
|
|
8202
8169
|
key = address.asKey();
|
|
8203
8170
|
pool = this._pools[key];
|
|
8204
|
-
if (!pool) return [3 /*break*/, 4];
|
|
8171
|
+
if (!(pool && poolState.isActive())) return [3 /*break*/, 4];
|
|
8205
8172
|
if (!!this._validate(resource)) return [3 /*break*/, 2];
|
|
8206
8173
|
if (this._log.isDebugEnabled()) {
|
|
8207
8174
|
this._log.debug(resource + " destroyed and can't be released to the pool " + key + " because it is not functional");
|
|
@@ -8251,11 +8218,12 @@ var Pool = /** @class */ (function () {
|
|
|
8251
8218
|
};
|
|
8252
8219
|
Pool.prototype._purgeKey = function (key) {
|
|
8253
8220
|
return __awaiter(this, void 0, void 0, function () {
|
|
8254
|
-
var pool, resource;
|
|
8221
|
+
var pool, poolState, resource;
|
|
8255
8222
|
return __generator(this, function (_a) {
|
|
8256
8223
|
switch (_a.label) {
|
|
8257
8224
|
case 0:
|
|
8258
8225
|
pool = this._pools[key] || [];
|
|
8226
|
+
poolState = this._poolState[key] || new PoolState();
|
|
8259
8227
|
_a.label = 1;
|
|
8260
8228
|
case 1:
|
|
8261
8229
|
if (!pool.length) return [3 /*break*/, 3];
|
|
@@ -8268,7 +8236,9 @@ var Pool = /** @class */ (function () {
|
|
|
8268
8236
|
_a.sent();
|
|
8269
8237
|
return [3 /*break*/, 1];
|
|
8270
8238
|
case 3:
|
|
8239
|
+
poolState.close();
|
|
8271
8240
|
delete this._pools[key];
|
|
8241
|
+
delete this._poolState[key];
|
|
8272
8242
|
return [2 /*return*/];
|
|
8273
8243
|
}
|
|
8274
8244
|
});
|
|
@@ -8278,6 +8248,7 @@ var Pool = /** @class */ (function () {
|
|
|
8278
8248
|
var _this = this;
|
|
8279
8249
|
var key = address.asKey();
|
|
8280
8250
|
var requests = this._acquireRequests[key];
|
|
8251
|
+
var poolState = this._poolState[key];
|
|
8281
8252
|
if (requests) {
|
|
8282
8253
|
var pendingRequest_1 = requests.shift(); // pop a pending acquire request
|
|
8283
8254
|
if (pendingRequest_1) {
|
|
@@ -8294,7 +8265,7 @@ var Pool = /** @class */ (function () {
|
|
|
8294
8265
|
if (pendingRequest_1.isCompleted()) {
|
|
8295
8266
|
// request has been completed, most likely failed by a timeout
|
|
8296
8267
|
// return the acquired resource back to the pool
|
|
8297
|
-
_this._release(address, resource);
|
|
8268
|
+
_this._release(poolState, address, resource);
|
|
8298
8269
|
}
|
|
8299
8270
|
else {
|
|
8300
8271
|
// request is still pending and can be resolved with the newly acquired resource
|
|
@@ -8367,6 +8338,18 @@ var PendingRequest = /** @class */ (function () {
|
|
|
8367
8338
|
};
|
|
8368
8339
|
return PendingRequest;
|
|
8369
8340
|
}());
|
|
8341
|
+
var PoolState = /** @class */ (function () {
|
|
8342
|
+
function PoolState() {
|
|
8343
|
+
this._active = true;
|
|
8344
|
+
}
|
|
8345
|
+
PoolState.prototype.isActive = function () {
|
|
8346
|
+
return this._active;
|
|
8347
|
+
};
|
|
8348
|
+
PoolState.prototype.close = function () {
|
|
8349
|
+
this._active = false;
|
|
8350
|
+
};
|
|
8351
|
+
return PoolState;
|
|
8352
|
+
}());
|
|
8370
8353
|
exports.default = Pool;
|
|
8371
8354
|
|
|
8372
8355
|
},{"./pool-config":48,"neo4j-driver-core":59}],50:[function(require,module,exports){
|
|
@@ -8926,6 +8909,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8926
8909
|
*/
|
|
8927
8910
|
var Connection = /** @class */ (function () {
|
|
8928
8911
|
function Connection() {
|
|
8912
|
+
this.id = "";
|
|
8913
|
+
this.databaseId = "";
|
|
8929
8914
|
}
|
|
8930
8915
|
/**
|
|
8931
8916
|
* @returns {boolean} whether this connection is in a working condition
|
|
@@ -28791,7 +28776,7 @@ var Driver = /*#__PURE__*/function (_CoreDriver) {
|
|
|
28791
28776
|
return new _sessionRx["default"]({
|
|
28792
28777
|
session: this._newSession({
|
|
28793
28778
|
defaultAccessMode: defaultAccessMode,
|
|
28794
|
-
|
|
28779
|
+
bookmarkOrBookmarks: bookmarks,
|
|
28795
28780
|
database: database,
|
|
28796
28781
|
impersonatedUser: impersonatedUser,
|
|
28797
28782
|
reactive: true,
|