neo4j-driver 5.9.0 → 5.9.1
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.esm.js +244 -140
- package/lib/browser/neo4j-web.esm.min.js +1 -1
- package/lib/browser/neo4j-web.js +244 -140
- package/lib/browser/neo4j-web.min.js +1 -1
- package/lib/index.js +2 -127
- package/lib/version.js +1 -1
- package/package.json +4 -4
package/lib/browser/neo4j-web.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* See the License for the specific language governing permissions and
|
|
37
37
|
* limitations under the License.
|
|
38
38
|
*/
|
|
39
|
-
var __extends$
|
|
39
|
+
var __extends$L = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
40
40
|
var extendStatics = function (d, b) {
|
|
41
41
|
extendStatics = Object.setPrototypeOf ||
|
|
42
42
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
* Class for all errors thrown/returned by the driver.
|
|
84
84
|
*/
|
|
85
85
|
var Neo4jError = /** @class */ (function (_super) {
|
|
86
|
-
__extends$
|
|
86
|
+
__extends$L(Neo4jError, _super);
|
|
87
87
|
/**
|
|
88
88
|
* @constructor
|
|
89
89
|
* @param {string} message - the error message
|
|
@@ -4533,7 +4533,7 @@
|
|
|
4533
4533
|
* limitations under the License.
|
|
4534
4534
|
*/
|
|
4535
4535
|
/* eslint-disable @typescript-eslint/promise-function-async */
|
|
4536
|
-
var __extends$
|
|
4536
|
+
var __extends$K = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
4537
4537
|
var extendStatics = function (d, b) {
|
|
4538
4538
|
extendStatics = Object.setPrototypeOf ||
|
|
4539
4539
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -4738,7 +4738,7 @@
|
|
|
4738
4738
|
* releasing or initilizing
|
|
4739
4739
|
*/
|
|
4740
4740
|
var ReadOnlyConnectionHolder = /** @class */ (function (_super) {
|
|
4741
|
-
__extends$
|
|
4741
|
+
__extends$K(ReadOnlyConnectionHolder, _super);
|
|
4742
4742
|
/**
|
|
4743
4743
|
* Contructor
|
|
4744
4744
|
* @param {ConnectionHolder} connectionHolder the connection holder which will treat the requests
|
|
@@ -4792,7 +4792,7 @@
|
|
|
4792
4792
|
connectionHolder$1.ReadOnlyConnectionHolder = ReadOnlyConnectionHolder;
|
|
4793
4793
|
connectionHolder$1.default = ReadOnlyConnectionHolder;
|
|
4794
4794
|
var EmptyConnectionHolder = /** @class */ (function (_super) {
|
|
4795
|
-
__extends$
|
|
4795
|
+
__extends$K(EmptyConnectionHolder, _super);
|
|
4796
4796
|
function EmptyConnectionHolder() {
|
|
4797
4797
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
4798
4798
|
}
|
|
@@ -5184,7 +5184,7 @@
|
|
|
5184
5184
|
|
|
5185
5185
|
var logger$1 = {};
|
|
5186
5186
|
|
|
5187
|
-
var __extends$
|
|
5187
|
+
var __extends$J = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
5188
5188
|
var extendStatics = function (d, b) {
|
|
5189
5189
|
extendStatics = Object.setPrototypeOf ||
|
|
5190
5190
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -5334,7 +5334,7 @@
|
|
|
5334
5334
|
}());
|
|
5335
5335
|
logger$1.Logger = Logger$2;
|
|
5336
5336
|
var NoOpLogger = /** @class */ (function (_super) {
|
|
5337
|
-
__extends$
|
|
5337
|
+
__extends$J(NoOpLogger, _super);
|
|
5338
5338
|
function NoOpLogger() {
|
|
5339
5339
|
return _super.call(this, INFO, function (level, message) { }) || this;
|
|
5340
5340
|
}
|
|
@@ -5932,8 +5932,12 @@
|
|
|
5932
5932
|
function fromVersion(version, getSystemInfo) {
|
|
5933
5933
|
if (getSystemInfo === void 0) { getSystemInfo = function () { return ({
|
|
5934
5934
|
get userAgent() {
|
|
5935
|
+
// this should be defined as an `var` since we need to get information
|
|
5936
|
+
// came from the global scope which not always will be defined
|
|
5937
|
+
// and we don't want to override the information
|
|
5938
|
+
var navigator;
|
|
5935
5939
|
// @ts-ignore: browser code so must be skipped by ts
|
|
5936
|
-
return
|
|
5940
|
+
return navigator === null || navigator === void 0 ? void 0 : navigator.userAgent;
|
|
5937
5941
|
}
|
|
5938
5942
|
}); }; }
|
|
5939
5943
|
var systemInfo = getSystemInfo();
|
|
@@ -7626,7 +7630,7 @@
|
|
|
7626
7630
|
* See the License for the specific language governing permissions and
|
|
7627
7631
|
* limitations under the License.
|
|
7628
7632
|
*/
|
|
7629
|
-
var __extends$
|
|
7633
|
+
var __extends$I = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
7630
7634
|
var extendStatics = function (d, b) {
|
|
7631
7635
|
extendStatics = Object.setPrototypeOf ||
|
|
7632
7636
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -7670,7 +7674,7 @@
|
|
|
7670
7674
|
* @access public
|
|
7671
7675
|
*/
|
|
7672
7676
|
var TransactionPromise = /** @class */ (function (_super) {
|
|
7673
|
-
__extends$
|
|
7677
|
+
__extends$I(TransactionPromise, _super);
|
|
7674
7678
|
/**
|
|
7675
7679
|
* @constructor
|
|
7676
7680
|
* @param {object} args
|
|
@@ -10153,7 +10157,232 @@
|
|
|
10153
10157
|
* See the License for the specific language governing permissions and
|
|
10154
10158
|
* limitations under the License.
|
|
10155
10159
|
*/
|
|
10160
|
+
var __extends$H = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
10161
|
+
var extendStatics = function (d, b) {
|
|
10162
|
+
extendStatics = Object.setPrototypeOf ||
|
|
10163
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10164
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
10165
|
+
return extendStatics(d, b);
|
|
10166
|
+
};
|
|
10167
|
+
return function (d, b) {
|
|
10168
|
+
if (typeof b !== "function" && b !== null)
|
|
10169
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10170
|
+
extendStatics(d, b);
|
|
10171
|
+
function __() { this.constructor = d; }
|
|
10172
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10173
|
+
};
|
|
10174
|
+
})();
|
|
10156
10175
|
Object.defineProperty(types$1, "__esModule", { value: true });
|
|
10176
|
+
types$1.InternalConfig = types$1.Config = void 0;
|
|
10177
|
+
/**
|
|
10178
|
+
* The Neo4j Driver configuration.
|
|
10179
|
+
*
|
|
10180
|
+
* @interface
|
|
10181
|
+
*/
|
|
10182
|
+
var Config = /** @class */ (function () {
|
|
10183
|
+
/**
|
|
10184
|
+
* @constructor
|
|
10185
|
+
* @private
|
|
10186
|
+
*/
|
|
10187
|
+
function Config() {
|
|
10188
|
+
/**
|
|
10189
|
+
* Encryption level
|
|
10190
|
+
*
|
|
10191
|
+
* @type {'ENCRYPTION_ON'|'ENCRYPTION_OFF'|undefined}
|
|
10192
|
+
*/
|
|
10193
|
+
this.encrypted = undefined;
|
|
10194
|
+
/**
|
|
10195
|
+
* Trust strategy to use if encryption is enabled.
|
|
10196
|
+
*
|
|
10197
|
+
* There is no mode to disable trust other than disabling encryption altogether. The reason for
|
|
10198
|
+
* this is that if you don't know who you are talking to, it is easy for an
|
|
10199
|
+
* attacker to hijack your encrypted connection, rendering encryption pointless.
|
|
10200
|
+
*
|
|
10201
|
+
* TRUST_SYSTEM_CA_SIGNED_CERTIFICATES is the default choice. For NodeJS environments, this
|
|
10202
|
+
* means that you trust whatever certificates are in the default trusted certificate
|
|
10203
|
+
* store of the underlying system. For Browser environments, the trusted certificate
|
|
10204
|
+
* store is usually managed by the browser. Refer to your system or browser documentation
|
|
10205
|
+
* if you want to explicitly add a certificate as trusted.
|
|
10206
|
+
*
|
|
10207
|
+
* TRUST_CUSTOM_CA_SIGNED_CERTIFICATES is another option for trust verification -
|
|
10208
|
+
* whenever we establish an encrypted connection, we ensure the host is using
|
|
10209
|
+
* an encryption certificate that is in, or is signed by, a certificate given
|
|
10210
|
+
* as trusted through configuration. This option is only available for NodeJS environments.
|
|
10211
|
+
*
|
|
10212
|
+
* TRUST_ALL_CERTIFICATES means that you trust everything without any verifications
|
|
10213
|
+
* steps carried out. This option is only available for NodeJS environments and should not
|
|
10214
|
+
* be used on production systems.
|
|
10215
|
+
*
|
|
10216
|
+
* @type {'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES'|'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'|'TRUST_ALL_CERTIFICATES'|undefined}
|
|
10217
|
+
*/
|
|
10218
|
+
this.trust = undefined;
|
|
10219
|
+
/**
|
|
10220
|
+
* List of one or more paths to trusted encryption certificates.
|
|
10221
|
+
*
|
|
10222
|
+
* This only works in the NodeJS bundle,
|
|
10223
|
+
* and only matters if you use "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES".
|
|
10224
|
+
*
|
|
10225
|
+
* The certificate files should be in regular X.509 PEM format.
|
|
10226
|
+
*
|
|
10227
|
+
* For instance, ['./trusted.pem']
|
|
10228
|
+
*
|
|
10229
|
+
* @type {?string[]}
|
|
10230
|
+
* @see {@link Config#trust}
|
|
10231
|
+
*/
|
|
10232
|
+
this.trustedCertificates = [];
|
|
10233
|
+
/**
|
|
10234
|
+
* The maximum total number of connections allowed to be managed by the connection pool, per host.
|
|
10235
|
+
*
|
|
10236
|
+
* This includes both in-use and idle connections.
|
|
10237
|
+
*
|
|
10238
|
+
* **Default**: ```100```
|
|
10239
|
+
*
|
|
10240
|
+
* @type {number|undefined}
|
|
10241
|
+
*/
|
|
10242
|
+
this.maxConnectionPoolSize = 100;
|
|
10243
|
+
/**
|
|
10244
|
+
* The maximum allowed lifetime for a pooled connection in milliseconds.
|
|
10245
|
+
*
|
|
10246
|
+
* Pooled connections older than this
|
|
10247
|
+
* threshold will be closed and removed from the pool. Such discarding happens during connection acquisition
|
|
10248
|
+
* so that new session is never backed by an old connection. Setting this option to a low value will cause
|
|
10249
|
+
* a high connection churn and might result in a performance hit. It is recommended to set maximum lifetime
|
|
10250
|
+
* to a slightly smaller value than the one configured in network equipment (load balancer, proxy, firewall,
|
|
10251
|
+
* etc. can also limit maximum connection lifetime). No maximum lifetime limit is imposed by default. Zero
|
|
10252
|
+
* and negative values result in lifetime not being checked.
|
|
10253
|
+
*
|
|
10254
|
+
* **Default**: ```60 * 60 * 1000``` (1 hour)
|
|
10255
|
+
*
|
|
10256
|
+
* @type {number|undefined}
|
|
10257
|
+
*/
|
|
10258
|
+
this.maxConnectionLifetime = 60 * 60 * 1000; // 1 hour
|
|
10259
|
+
/**
|
|
10260
|
+
* The maximum amount of time to wait to acquire a connection from the pool (to either create a new
|
|
10261
|
+
* connection or borrow an existing one).
|
|
10262
|
+
*
|
|
10263
|
+
* **Default**: ```60000``` (1 minute)
|
|
10264
|
+
*
|
|
10265
|
+
* @type {number|undefined}
|
|
10266
|
+
*/
|
|
10267
|
+
this.connectionAcquisitionTimeout = 60000; // 1 minute
|
|
10268
|
+
/**
|
|
10269
|
+
* Specify the maximum time in milliseconds transactions are allowed to retry via
|
|
10270
|
+
* {@link Session#executeRead} and {@link Session#executeWrite} functions.
|
|
10271
|
+
*
|
|
10272
|
+
* These functions will retry the given unit of work on `ServiceUnavailable`, `SessionExpired` and transient
|
|
10273
|
+
* errors with exponential backoff using an initial delay of 1 second.
|
|
10274
|
+
*
|
|
10275
|
+
* **Default**: ```30000``` (30 seconds)
|
|
10276
|
+
*
|
|
10277
|
+
* @type {number|undefined}
|
|
10278
|
+
*/
|
|
10279
|
+
this.maxTransactionRetryTime = 30000; // 30 seconds
|
|
10280
|
+
/**
|
|
10281
|
+
* Specify socket connection timeout in milliseconds.
|
|
10282
|
+
*
|
|
10283
|
+
* Negative and zero values result in no timeout being applied.
|
|
10284
|
+
* Connection establishment will be then bound by the timeout configured
|
|
10285
|
+
* on the operating system level.
|
|
10286
|
+
*
|
|
10287
|
+
* **Default**: ```30000``` (30 seconds)
|
|
10288
|
+
*
|
|
10289
|
+
* @type {number|undefined}
|
|
10290
|
+
*/
|
|
10291
|
+
this.connectionTimeout = 30000; // 30 seconds
|
|
10292
|
+
/**
|
|
10293
|
+
* Make this driver always return native JavaScript numbers for integer values, instead of the
|
|
10294
|
+
* dedicated {@link Integer} class.
|
|
10295
|
+
*
|
|
10296
|
+
* Values that do not fit in native number bit range will be represented as `Number.NEGATIVE_INFINITY` or `Number.POSITIVE_INFINITY`.
|
|
10297
|
+
*
|
|
10298
|
+
* **Warning:** {@link ResultSummary} It is not always safe to enable this setting when JavaScript applications are not the only ones
|
|
10299
|
+
* interacting with the database. Stored numbers might in such case be not representable by native
|
|
10300
|
+
* `Number` type and thus the driver will return lossy values. This might also happen when data was
|
|
10301
|
+
* initially imported using neo4j import tool and contained numbers larger than
|
|
10302
|
+
* `Number.MAX_SAFE_INTEGER`. Driver will then return positive infinity, which is lossy.
|
|
10303
|
+
*
|
|
10304
|
+
* **Default**: ```false```
|
|
10305
|
+
*
|
|
10306
|
+
* Default value for this option is `false` because native JavaScript numbers might result
|
|
10307
|
+
* in loss of precision in the general case.
|
|
10308
|
+
*
|
|
10309
|
+
* @type {boolean|undefined}
|
|
10310
|
+
*/
|
|
10311
|
+
this.disableLosslessIntegers = false;
|
|
10312
|
+
/**
|
|
10313
|
+
* Make this driver always return native Javascript `BigInt` for integer values,
|
|
10314
|
+
* instead of the dedicated {@link Integer} class or `Number`.
|
|
10315
|
+
*
|
|
10316
|
+
* **Warning:** `BigInt` doesn't implement the method `toJSON`. To serialize it as `json`,
|
|
10317
|
+
* it's needed to add a custom implementation of the `toJSON` on the
|
|
10318
|
+
* `BigInt.prototype`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json.
|
|
10319
|
+
*
|
|
10320
|
+
* **Default**: ```false``` (for backwards compatibility)
|
|
10321
|
+
*
|
|
10322
|
+
* @type {boolean|undefined}
|
|
10323
|
+
*/
|
|
10324
|
+
this.useBigInt = false;
|
|
10325
|
+
/**
|
|
10326
|
+
* Specify the logging configuration for the driver. Object should have two properties `level` and `logger`.
|
|
10327
|
+
*
|
|
10328
|
+
* Property `level` represents the logging level which should be one of: 'error', 'warn', 'info' or 'debug'. This property is optional and
|
|
10329
|
+
* its default value is 'info'. Levels have priorities: 'error': 0, 'warn': 1, 'info': 2, 'debug': 3. Enabling a certain level also enables all
|
|
10330
|
+
* levels with lower priority. For example: 'error', 'warn' and 'info' will be logged when 'info' level is configured.
|
|
10331
|
+
*
|
|
10332
|
+
* Property `logger` represents the logging function which will be invoked for every log call with an acceptable level. The function should
|
|
10333
|
+
* take two string arguments `level` and `message`. The function should not execute any blocking or long-running operations
|
|
10334
|
+
* because it is often executed on a hot path.
|
|
10335
|
+
*
|
|
10336
|
+
* No logging is done by default. See `neo4j.logging` object that contains predefined logging implementations.
|
|
10337
|
+
*
|
|
10338
|
+
* @type {LoggingConfig|undefined}
|
|
10339
|
+
* @see {@link logging}
|
|
10340
|
+
*/
|
|
10341
|
+
this.logging = undefined;
|
|
10342
|
+
/**
|
|
10343
|
+
* Specify a custom server address resolver function used by the routing driver to resolve the initial address used to create the driver.
|
|
10344
|
+
*
|
|
10345
|
+
* Such resolution happens:
|
|
10346
|
+
* * during the very first rediscovery when driver is created
|
|
10347
|
+
* * when all the known routers from the current routing table have failed and driver needs to fallback to the initial address
|
|
10348
|
+
*
|
|
10349
|
+
* In NodeJS environment driver defaults to performing a DNS resolution of the initial address using 'dns' module.
|
|
10350
|
+
* In browser environment driver uses the initial address as-is.
|
|
10351
|
+
* Value should be a function that takes a single string argument - the initial address. It should return an array of new addresses.
|
|
10352
|
+
* Address is a string of shape '<host>:<port>'. Provided function can return either a Promise resolved with an array of addresses
|
|
10353
|
+
* or array of addresses directly.
|
|
10354
|
+
*
|
|
10355
|
+
* @type {function(address: string) {} |undefined}
|
|
10356
|
+
*/
|
|
10357
|
+
this.resolver = undefined;
|
|
10358
|
+
/**
|
|
10359
|
+
* Configure filter for Notification objects returned in {@Link ResultSummary#notifications}.
|
|
10360
|
+
*
|
|
10361
|
+
* See {@link SessionConfig#notificationFilter} for usage instructions.
|
|
10362
|
+
*
|
|
10363
|
+
* @type {NotificationFilter|undefined}
|
|
10364
|
+
*/
|
|
10365
|
+
this.notificationFilter = undefined;
|
|
10366
|
+
/**
|
|
10367
|
+
* Optionally override the default user agent name.
|
|
10368
|
+
*
|
|
10369
|
+
* **Default**: ```'neo4j-javascript/<version>'```
|
|
10370
|
+
*
|
|
10371
|
+
* @type {string|undefined}
|
|
10372
|
+
*/
|
|
10373
|
+
this.userAgent = undefined;
|
|
10374
|
+
}
|
|
10375
|
+
return Config;
|
|
10376
|
+
}());
|
|
10377
|
+
types$1.Config = Config;
|
|
10378
|
+
var InternalConfig = /** @class */ (function (_super) {
|
|
10379
|
+
__extends$H(InternalConfig, _super);
|
|
10380
|
+
function InternalConfig() {
|
|
10381
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10382
|
+
}
|
|
10383
|
+
return InternalConfig;
|
|
10384
|
+
}(Config));
|
|
10385
|
+
types$1.InternalConfig = InternalConfig;
|
|
10157
10386
|
|
|
10158
10387
|
(function (exports) {
|
|
10159
10388
|
/**
|
|
@@ -19393,7 +19622,7 @@
|
|
|
19393
19622
|
// This is set up this way to keep the version in the code in
|
|
19394
19623
|
// sync with the npm package version, and to allow the build
|
|
19395
19624
|
// system to control version names at packaging time.
|
|
19396
|
-
version$1.default = '5.9.
|
|
19625
|
+
version$1.default = '5.9.1';
|
|
19397
19626
|
|
|
19398
19627
|
var lib = {};
|
|
19399
19628
|
|
|
@@ -30792,7 +31021,7 @@
|
|
|
30792
31021
|
/**
|
|
30793
31022
|
* Connect to the target address, negotiate Bolt protocol and send initialization message.
|
|
30794
31023
|
* @param {string} userAgent the user agent for this driver.
|
|
30795
|
-
* @param {
|
|
31024
|
+
* @param {Object} boltAgent the bolt agent for this driver.
|
|
30796
31025
|
* @param {Object} authToken the object containing auth information.
|
|
30797
31026
|
* @param {boolean} shouldWaitReAuth whether ot not the connection will wait for re-authentication to happen
|
|
30798
31027
|
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
|
|
@@ -31060,7 +31289,7 @@
|
|
|
31060
31289
|
/**
|
|
31061
31290
|
* Send initialization message.
|
|
31062
31291
|
* @param {string} userAgent the user agent for this driver.
|
|
31063
|
-
* @param {
|
|
31292
|
+
* @param {Object} boltAgent the bolt agent for this driver.
|
|
31064
31293
|
* @param {Object} authToken the object containing auth information.
|
|
31065
31294
|
* @param {boolean} waitReAuth whether ot not the connection will wait for re-authentication to happen
|
|
31066
31295
|
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
|
|
@@ -33847,141 +34076,16 @@
|
|
|
33847
34076
|
* Construct a new Neo4j Driver. This is your main entry point for this
|
|
33848
34077
|
* library.
|
|
33849
34078
|
*
|
|
33850
|
-
* ## Configuration
|
|
33851
|
-
*
|
|
33852
|
-
* This function optionally takes a configuration argument. Available configuration
|
|
33853
|
-
* options are as follows:
|
|
33854
|
-
*
|
|
33855
|
-
* {
|
|
33856
|
-
* // Encryption level: ENCRYPTION_ON or ENCRYPTION_OFF.
|
|
33857
|
-
* encrypted: ENCRYPTION_ON|ENCRYPTION_OFF
|
|
33858
|
-
*
|
|
33859
|
-
* // Trust strategy to use if encryption is enabled. There is no mode to disable
|
|
33860
|
-
* // trust other than disabling encryption altogether. The reason for
|
|
33861
|
-
* // this is that if you don't know who you are talking to, it is easy for an
|
|
33862
|
-
* // attacker to hijack your encrypted connection, rendering encryption pointless.
|
|
33863
|
-
* //
|
|
33864
|
-
* // TRUST_SYSTEM_CA_SIGNED_CERTIFICATES is the default choice. For NodeJS environments, this
|
|
33865
|
-
* // means that you trust whatever certificates are in the default trusted certificate
|
|
33866
|
-
* // store of the underlying system. For Browser environments, the trusted certificate
|
|
33867
|
-
* // store is usually managed by the browser. Refer to your system or browser documentation
|
|
33868
|
-
* // if you want to explicitly add a certificate as trusted.
|
|
33869
|
-
* //
|
|
33870
|
-
* // TRUST_CUSTOM_CA_SIGNED_CERTIFICATES is another option for trust verification -
|
|
33871
|
-
* // whenever we establish an encrypted connection, we ensure the host is using
|
|
33872
|
-
* // an encryption certificate that is in, or is signed by, a certificate given
|
|
33873
|
-
* // as trusted through configuration. This option is only available for NodeJS environments.
|
|
33874
|
-
* //
|
|
33875
|
-
* // TRUST_ALL_CERTIFICATES means that you trust everything without any verifications
|
|
33876
|
-
* // steps carried out. This option is only available for NodeJS environments and should not
|
|
33877
|
-
* // be used on production systems.
|
|
33878
|
-
* trust: "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES" | "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES" |
|
|
33879
|
-
* "TRUST_ALL_CERTIFICATES",
|
|
33880
|
-
*
|
|
33881
|
-
* // List of one or more paths to trusted encryption certificates. This only
|
|
33882
|
-
* // works in the NodeJS bundle, and only matters if you use "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES".
|
|
33883
|
-
* // The certificate files should be in regular X.509 PEM format.
|
|
33884
|
-
* // For instance, ['./trusted.pem']
|
|
33885
|
-
* trustedCertificates: [],
|
|
33886
|
-
*
|
|
33887
|
-
* // The maximum total number of connections allowed to be managed by the connection pool, per host.
|
|
33888
|
-
* // This includes both in-use and idle connections. No maximum connection pool size is imposed
|
|
33889
|
-
* // by default.
|
|
33890
|
-
* maxConnectionPoolSize: 100,
|
|
33891
|
-
*
|
|
33892
|
-
* // The maximum allowed lifetime for a pooled connection in milliseconds. Pooled connections older than this
|
|
33893
|
-
* // threshold will be closed and removed from the pool. Such discarding happens during connection acquisition
|
|
33894
|
-
* // so that new session is never backed by an old connection. Setting this option to a low value will cause
|
|
33895
|
-
* // a high connection churn and might result in a performance hit. It is recommended to set maximum lifetime
|
|
33896
|
-
* // to a slightly smaller value than the one configured in network equipment (load balancer, proxy, firewall,
|
|
33897
|
-
* // etc. can also limit maximum connection lifetime). No maximum lifetime limit is imposed by default. Zero
|
|
33898
|
-
* // and negative values result in lifetime not being checked.
|
|
33899
|
-
* maxConnectionLifetime: 60 * 60 * 1000, // 1 hour
|
|
33900
|
-
*
|
|
33901
|
-
* // The maximum amount of time to wait to acquire a connection from the pool (to either create a new
|
|
33902
|
-
* // connection or borrow an existing one.
|
|
33903
|
-
* connectionAcquisitionTimeout: 60000, // 1 minute
|
|
33904
|
-
*
|
|
33905
|
-
* // Specify the maximum time in milliseconds transactions are allowed to retry via
|
|
33906
|
-
* // `Session#executeRead()` and `Session#executeWrite()` functions.
|
|
33907
|
-
* // These functions will retry the given unit of work on `ServiceUnavailable`, `SessionExpired` and transient
|
|
33908
|
-
* // errors with exponential backoff using initial delay of 1 second.
|
|
33909
|
-
* // Default value is 30000 which is 30 seconds.
|
|
33910
|
-
* maxTransactionRetryTime: 30000, // 30 seconds
|
|
33911
|
-
*
|
|
33912
|
-
* // Specify socket connection timeout in milliseconds. Numeric values are expected. Negative and zero values
|
|
33913
|
-
* // result in no timeout being applied. Connection establishment will be then bound by the timeout configured
|
|
33914
|
-
* // on the operating system level. Default value is 30000, which is 30 seconds.
|
|
33915
|
-
* connectionTimeout: 30000, // 30 seconds
|
|
33916
|
-
*
|
|
33917
|
-
* // Make this driver always return native JavaScript numbers for integer values, instead of the
|
|
33918
|
-
* // dedicated {@link Integer} class. Values that do not fit in native number bit range will be represented as
|
|
33919
|
-
* // `Number.NEGATIVE_INFINITY` or `Number.POSITIVE_INFINITY`.
|
|
33920
|
-
* // **Warning:** ResultSummary It is not always safe to enable this setting when JavaScript applications are not the only ones
|
|
33921
|
-
* // interacting with the database. Stored numbers might in such case be not representable by native
|
|
33922
|
-
* // {@link Number} type and thus driver will return lossy values. This might also happen when data was
|
|
33923
|
-
* // initially imported using neo4j import tool and contained numbers larger than
|
|
33924
|
-
* // `Number.MAX_SAFE_INTEGER`. Driver will then return positive infinity, which is lossy.
|
|
33925
|
-
* // Default value for this option is `false` because native JavaScript numbers might result
|
|
33926
|
-
* // in loss of precision in the general case.
|
|
33927
|
-
* disableLosslessIntegers: false,
|
|
33928
|
-
*
|
|
33929
|
-
* // Make this driver always return native Javascript {@link BigInt} for integer values, instead of the dedicated {@link Integer} class or {@link Number}.
|
|
33930
|
-
* //
|
|
33931
|
-
* // Default value for this option is `false` for backwards compatibility.
|
|
33932
|
-
* //
|
|
33933
|
-
* // **Warning:** `BigInt` doesn't implement the method `toJSON`. In maner of serialize it as `json`, It's needed to add a custom implementation of the `toJSON` on the
|
|
33934
|
-
* // `BigInt.prototype` {@see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json}
|
|
33935
|
-
* useBigInt: false,
|
|
33936
|
-
*
|
|
33937
|
-
* // Specify the logging configuration for the driver. Object should have two properties `level` and `logger`.
|
|
33938
|
-
* //
|
|
33939
|
-
* // Property `level` represents the logging level which should be one of: 'error', 'warn', 'info' or 'debug'. This property is optional and
|
|
33940
|
-
* // its default value is 'info'. Levels have priorities: 'error': 0, 'warn': 1, 'info': 2, 'debug': 3. Enabling a certain level also enables all
|
|
33941
|
-
* // levels with lower priority. For example: 'error', 'warn' and 'info' will be logged when 'info' level is configured.
|
|
33942
|
-
* //
|
|
33943
|
-
* // Property `logger` represents the logging function which will be invoked for every log call with an acceptable level. The function should
|
|
33944
|
-
* // take two string arguments `level` and `message`. The function should not execute any blocking or long-running operations
|
|
33945
|
-
* // because it is often executed on a hot path.
|
|
33946
|
-
* //
|
|
33947
|
-
* // No logging is done by default. See `neo4j.logging` object that contains predefined logging implementations.
|
|
33948
|
-
* logging: {
|
|
33949
|
-
* level: 'info',
|
|
33950
|
-
* logger: (level, message) => console.log(level + ' ' + message)
|
|
33951
|
-
* },
|
|
33952
|
-
*
|
|
33953
|
-
* // Specify a custom server address resolver function used by the routing driver to resolve the initial address used to create the driver.
|
|
33954
|
-
* // Such resolution happens:
|
|
33955
|
-
* // * during the very first rediscovery when driver is created
|
|
33956
|
-
* // * when all the known routers from the current routing table have failed and driver needs to fallback to the initial address
|
|
33957
|
-
* //
|
|
33958
|
-
* // In NodeJS environment driver defaults to performing a DNS resolution of the initial address using 'dns' module.
|
|
33959
|
-
* // In browser environment driver uses the initial address as-is.
|
|
33960
|
-
* // Value should be a function that takes a single string argument - the initial address. It should return an array of new addresses.
|
|
33961
|
-
* // Address is a string of shape '<host>:<port>'. Provided function can return either a Promise resolved with an array of addresses
|
|
33962
|
-
* // or array of addresses directly.
|
|
33963
|
-
* resolver: function(address) {
|
|
33964
|
-
* return ['127.0.0.1:8888', 'fallback.db.com:7687'];
|
|
33965
|
-
* },
|
|
33966
|
-
*
|
|
33967
|
-
* // Configure filter for Notification objects returned in ResultSummary#notifications.
|
|
33968
|
-
* // See SessionConfig#notificationFilter for usage instructions.
|
|
33969
|
-
* notificationFilter: undefined,
|
|
33970
|
-
*
|
|
33971
|
-
* // Optionally override the default user agent name.
|
|
33972
|
-
* userAgent: USER_AGENT
|
|
33973
|
-
* }
|
|
33974
|
-
*
|
|
33975
34079
|
* @param {string} url The URL for the Neo4j database, for instance "neo4j://localhost" and/or "bolt://localhost"
|
|
33976
34080
|
* @param {Map<string,string>} authToken Authentication credentials. See {@link auth} for helpers.
|
|
33977
|
-
* @param {
|
|
34081
|
+
* @param {Config} config Configuration object.
|
|
33978
34082
|
* @returns {Driver}
|
|
33979
34083
|
*/
|
|
33980
34084
|
function driver(url, authToken, config) {
|
|
33981
34085
|
if (config === void 0) { config = {}; }
|
|
33982
34086
|
assertString(url, 'Bolt URL');
|
|
33983
34087
|
var parsedUrl = urlUtil.parseDatabaseUrl(url);
|
|
33984
|
-
// Determine
|
|
34088
|
+
// Determine encryption/trust options from the URL.
|
|
33985
34089
|
var routing = false;
|
|
33986
34090
|
var encrypted = false;
|
|
33987
34091
|
var trust;
|