neo4j-driver 5.9.0 → 5.9.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.esm.js +247 -140
- package/lib/browser/neo4j-web.esm.min.js +1 -1
- package/lib/browser/neo4j-web.js +247 -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
|
@@ -30,7 +30,7 @@ var error = {};
|
|
|
30
30
|
* See the License for the specific language governing permissions and
|
|
31
31
|
* limitations under the License.
|
|
32
32
|
*/
|
|
33
|
-
var __extends$
|
|
33
|
+
var __extends$L = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
34
34
|
var extendStatics = function (d, b) {
|
|
35
35
|
extendStatics = Object.setPrototypeOf ||
|
|
36
36
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -77,7 +77,7 @@ var NOT_AVAILABLE$1 = 'N/A';
|
|
|
77
77
|
* Class for all errors thrown/returned by the driver.
|
|
78
78
|
*/
|
|
79
79
|
var Neo4jError = /** @class */ (function (_super) {
|
|
80
|
-
__extends$
|
|
80
|
+
__extends$L(Neo4jError, _super);
|
|
81
81
|
/**
|
|
82
82
|
* @constructor
|
|
83
83
|
* @param {string} message - the error message
|
|
@@ -4527,7 +4527,7 @@ var connectionHolder$1 = {};
|
|
|
4527
4527
|
* limitations under the License.
|
|
4528
4528
|
*/
|
|
4529
4529
|
/* eslint-disable @typescript-eslint/promise-function-async */
|
|
4530
|
-
var __extends$
|
|
4530
|
+
var __extends$K = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
4531
4531
|
var extendStatics = function (d, b) {
|
|
4532
4532
|
extendStatics = Object.setPrototypeOf ||
|
|
4533
4533
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -4732,7 +4732,7 @@ connectionHolder$1.ConnectionHolder = ConnectionHolder;
|
|
|
4732
4732
|
* releasing or initilizing
|
|
4733
4733
|
*/
|
|
4734
4734
|
var ReadOnlyConnectionHolder = /** @class */ (function (_super) {
|
|
4735
|
-
__extends$
|
|
4735
|
+
__extends$K(ReadOnlyConnectionHolder, _super);
|
|
4736
4736
|
/**
|
|
4737
4737
|
* Contructor
|
|
4738
4738
|
* @param {ConnectionHolder} connectionHolder the connection holder which will treat the requests
|
|
@@ -4786,7 +4786,7 @@ var ReadOnlyConnectionHolder = /** @class */ (function (_super) {
|
|
|
4786
4786
|
connectionHolder$1.ReadOnlyConnectionHolder = ReadOnlyConnectionHolder;
|
|
4787
4787
|
connectionHolder$1.default = ReadOnlyConnectionHolder;
|
|
4788
4788
|
var EmptyConnectionHolder = /** @class */ (function (_super) {
|
|
4789
|
-
__extends$
|
|
4789
|
+
__extends$K(EmptyConnectionHolder, _super);
|
|
4790
4790
|
function EmptyConnectionHolder() {
|
|
4791
4791
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
4792
4792
|
}
|
|
@@ -5178,7 +5178,7 @@ function _valueOrDefault(value, defaultValue) {
|
|
|
5178
5178
|
|
|
5179
5179
|
var logger$1 = {};
|
|
5180
5180
|
|
|
5181
|
-
var __extends$
|
|
5181
|
+
var __extends$J = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
5182
5182
|
var extendStatics = function (d, b) {
|
|
5183
5183
|
extendStatics = Object.setPrototypeOf ||
|
|
5184
5184
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -5328,7 +5328,7 @@ var Logger$2 = /** @class */ (function () {
|
|
|
5328
5328
|
}());
|
|
5329
5329
|
logger$1.Logger = Logger$2;
|
|
5330
5330
|
var NoOpLogger = /** @class */ (function (_super) {
|
|
5331
|
-
__extends$
|
|
5331
|
+
__extends$J(NoOpLogger, _super);
|
|
5332
5332
|
function NoOpLogger() {
|
|
5333
5333
|
return _super.call(this, INFO, function (level, message) { }) || this;
|
|
5334
5334
|
}
|
|
@@ -5926,8 +5926,12 @@ boltAgent$1.fromVersion = void 0;
|
|
|
5926
5926
|
function fromVersion(version, getSystemInfo) {
|
|
5927
5927
|
if (getSystemInfo === void 0) { getSystemInfo = function () { return ({
|
|
5928
5928
|
get userAgent() {
|
|
5929
|
+
// this should be defined as an `var` since we need to get information
|
|
5930
|
+
// came from the global scope which not always will be defined
|
|
5931
|
+
// and we don't want to override the information
|
|
5932
|
+
var navigator;
|
|
5929
5933
|
// @ts-ignore: browser code so must be skipped by ts
|
|
5930
|
-
return
|
|
5934
|
+
return navigator === null || navigator === void 0 ? void 0 : navigator.userAgent;
|
|
5931
5935
|
}
|
|
5932
5936
|
}); }; }
|
|
5933
5937
|
var systemInfo = getSystemInfo();
|
|
@@ -7620,7 +7624,7 @@ var transactionPromise = {};
|
|
|
7620
7624
|
* See the License for the specific language governing permissions and
|
|
7621
7625
|
* limitations under the License.
|
|
7622
7626
|
*/
|
|
7623
|
-
var __extends$
|
|
7627
|
+
var __extends$I = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
7624
7628
|
var extendStatics = function (d, b) {
|
|
7625
7629
|
extendStatics = Object.setPrototypeOf ||
|
|
7626
7630
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -7664,7 +7668,7 @@ var transaction_1 = __importDefault$P(transaction);
|
|
|
7664
7668
|
* @access public
|
|
7665
7669
|
*/
|
|
7666
7670
|
var TransactionPromise = /** @class */ (function (_super) {
|
|
7667
|
-
__extends$
|
|
7671
|
+
__extends$I(TransactionPromise, _super);
|
|
7668
7672
|
/**
|
|
7669
7673
|
* @constructor
|
|
7670
7674
|
* @param {object} args
|
|
@@ -10147,7 +10151,232 @@ var types$1 = {};
|
|
|
10147
10151
|
* See the License for the specific language governing permissions and
|
|
10148
10152
|
* limitations under the License.
|
|
10149
10153
|
*/
|
|
10154
|
+
var __extends$H = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
10155
|
+
var extendStatics = function (d, b) {
|
|
10156
|
+
extendStatics = Object.setPrototypeOf ||
|
|
10157
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10158
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
10159
|
+
return extendStatics(d, b);
|
|
10160
|
+
};
|
|
10161
|
+
return function (d, b) {
|
|
10162
|
+
if (typeof b !== "function" && b !== null)
|
|
10163
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10164
|
+
extendStatics(d, b);
|
|
10165
|
+
function __() { this.constructor = d; }
|
|
10166
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10167
|
+
};
|
|
10168
|
+
})();
|
|
10150
10169
|
Object.defineProperty(types$1, "__esModule", { value: true });
|
|
10170
|
+
types$1.InternalConfig = types$1.Config = void 0;
|
|
10171
|
+
/**
|
|
10172
|
+
* The Neo4j Driver configuration.
|
|
10173
|
+
*
|
|
10174
|
+
* @interface
|
|
10175
|
+
*/
|
|
10176
|
+
var Config = /** @class */ (function () {
|
|
10177
|
+
/**
|
|
10178
|
+
* @constructor
|
|
10179
|
+
* @private
|
|
10180
|
+
*/
|
|
10181
|
+
function Config() {
|
|
10182
|
+
/**
|
|
10183
|
+
* Encryption level
|
|
10184
|
+
*
|
|
10185
|
+
* @type {'ENCRYPTION_ON'|'ENCRYPTION_OFF'|undefined}
|
|
10186
|
+
*/
|
|
10187
|
+
this.encrypted = undefined;
|
|
10188
|
+
/**
|
|
10189
|
+
* Trust strategy to use if encryption is enabled.
|
|
10190
|
+
*
|
|
10191
|
+
* There is no mode to disable trust other than disabling encryption altogether. The reason for
|
|
10192
|
+
* this is that if you don't know who you are talking to, it is easy for an
|
|
10193
|
+
* attacker to hijack your encrypted connection, rendering encryption pointless.
|
|
10194
|
+
*
|
|
10195
|
+
* TRUST_SYSTEM_CA_SIGNED_CERTIFICATES is the default choice. For NodeJS environments, this
|
|
10196
|
+
* means that you trust whatever certificates are in the default trusted certificate
|
|
10197
|
+
* store of the underlying system. For Browser environments, the trusted certificate
|
|
10198
|
+
* store is usually managed by the browser. Refer to your system or browser documentation
|
|
10199
|
+
* if you want to explicitly add a certificate as trusted.
|
|
10200
|
+
*
|
|
10201
|
+
* TRUST_CUSTOM_CA_SIGNED_CERTIFICATES is another option for trust verification -
|
|
10202
|
+
* whenever we establish an encrypted connection, we ensure the host is using
|
|
10203
|
+
* an encryption certificate that is in, or is signed by, a certificate given
|
|
10204
|
+
* as trusted through configuration. This option is only available for NodeJS environments.
|
|
10205
|
+
*
|
|
10206
|
+
* TRUST_ALL_CERTIFICATES means that you trust everything without any verifications
|
|
10207
|
+
* steps carried out. This option is only available for NodeJS environments and should not
|
|
10208
|
+
* be used on production systems.
|
|
10209
|
+
*
|
|
10210
|
+
* @type {'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES'|'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'|'TRUST_ALL_CERTIFICATES'|undefined}
|
|
10211
|
+
*/
|
|
10212
|
+
this.trust = undefined;
|
|
10213
|
+
/**
|
|
10214
|
+
* List of one or more paths to trusted encryption certificates.
|
|
10215
|
+
*
|
|
10216
|
+
* This only works in the NodeJS bundle,
|
|
10217
|
+
* and only matters if you use "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES".
|
|
10218
|
+
*
|
|
10219
|
+
* The certificate files should be in regular X.509 PEM format.
|
|
10220
|
+
*
|
|
10221
|
+
* For instance, ['./trusted.pem']
|
|
10222
|
+
*
|
|
10223
|
+
* @type {?string[]}
|
|
10224
|
+
* @see {@link Config#trust}
|
|
10225
|
+
*/
|
|
10226
|
+
this.trustedCertificates = [];
|
|
10227
|
+
/**
|
|
10228
|
+
* The maximum total number of connections allowed to be managed by the connection pool, per host.
|
|
10229
|
+
*
|
|
10230
|
+
* This includes both in-use and idle connections.
|
|
10231
|
+
*
|
|
10232
|
+
* **Default**: ```100```
|
|
10233
|
+
*
|
|
10234
|
+
* @type {number|undefined}
|
|
10235
|
+
*/
|
|
10236
|
+
this.maxConnectionPoolSize = 100;
|
|
10237
|
+
/**
|
|
10238
|
+
* The maximum allowed lifetime for a pooled connection in milliseconds.
|
|
10239
|
+
*
|
|
10240
|
+
* Pooled connections older than this
|
|
10241
|
+
* threshold will be closed and removed from the pool. Such discarding happens during connection acquisition
|
|
10242
|
+
* so that new session is never backed by an old connection. Setting this option to a low value will cause
|
|
10243
|
+
* a high connection churn and might result in a performance hit. It is recommended to set maximum lifetime
|
|
10244
|
+
* to a slightly smaller value than the one configured in network equipment (load balancer, proxy, firewall,
|
|
10245
|
+
* etc. can also limit maximum connection lifetime). No maximum lifetime limit is imposed by default. Zero
|
|
10246
|
+
* and negative values result in lifetime not being checked.
|
|
10247
|
+
*
|
|
10248
|
+
* **Default**: ```60 * 60 * 1000``` (1 hour)
|
|
10249
|
+
*
|
|
10250
|
+
* @type {number|undefined}
|
|
10251
|
+
*/
|
|
10252
|
+
this.maxConnectionLifetime = 60 * 60 * 1000; // 1 hour
|
|
10253
|
+
/**
|
|
10254
|
+
* The maximum amount of time to wait to acquire a connection from the pool (to either create a new
|
|
10255
|
+
* connection or borrow an existing one).
|
|
10256
|
+
*
|
|
10257
|
+
* **Default**: ```60000``` (1 minute)
|
|
10258
|
+
*
|
|
10259
|
+
* @type {number|undefined}
|
|
10260
|
+
*/
|
|
10261
|
+
this.connectionAcquisitionTimeout = 60000; // 1 minute
|
|
10262
|
+
/**
|
|
10263
|
+
* Specify the maximum time in milliseconds transactions are allowed to retry via
|
|
10264
|
+
* {@link Session#executeRead} and {@link Session#executeWrite} functions.
|
|
10265
|
+
*
|
|
10266
|
+
* These functions will retry the given unit of work on `ServiceUnavailable`, `SessionExpired` and transient
|
|
10267
|
+
* errors with exponential backoff using an initial delay of 1 second.
|
|
10268
|
+
*
|
|
10269
|
+
* **Default**: ```30000``` (30 seconds)
|
|
10270
|
+
*
|
|
10271
|
+
* @type {number|undefined}
|
|
10272
|
+
*/
|
|
10273
|
+
this.maxTransactionRetryTime = 30000; // 30 seconds
|
|
10274
|
+
/**
|
|
10275
|
+
* Specify socket connection timeout in milliseconds.
|
|
10276
|
+
*
|
|
10277
|
+
* Negative and zero values result in no timeout being applied.
|
|
10278
|
+
* Connection establishment will be then bound by the timeout configured
|
|
10279
|
+
* on the operating system level.
|
|
10280
|
+
*
|
|
10281
|
+
* **Default**: ```30000``` (30 seconds)
|
|
10282
|
+
*
|
|
10283
|
+
* @type {number|undefined}
|
|
10284
|
+
*/
|
|
10285
|
+
this.connectionTimeout = 30000; // 30 seconds
|
|
10286
|
+
/**
|
|
10287
|
+
* Make this driver always return native JavaScript numbers for integer values, instead of the
|
|
10288
|
+
* dedicated {@link Integer} class.
|
|
10289
|
+
*
|
|
10290
|
+
* Values that do not fit in native number bit range will be represented as `Number.NEGATIVE_INFINITY` or `Number.POSITIVE_INFINITY`.
|
|
10291
|
+
*
|
|
10292
|
+
* **Warning:** {@link ResultSummary} It is not always safe to enable this setting when JavaScript applications are not the only ones
|
|
10293
|
+
* interacting with the database. Stored numbers might in such case be not representable by native
|
|
10294
|
+
* `Number` type and thus the driver will return lossy values. This might also happen when data was
|
|
10295
|
+
* initially imported using neo4j import tool and contained numbers larger than
|
|
10296
|
+
* `Number.MAX_SAFE_INTEGER`. Driver will then return positive infinity, which is lossy.
|
|
10297
|
+
*
|
|
10298
|
+
* **Default**: ```false```
|
|
10299
|
+
*
|
|
10300
|
+
* Default value for this option is `false` because native JavaScript numbers might result
|
|
10301
|
+
* in loss of precision in the general case.
|
|
10302
|
+
*
|
|
10303
|
+
* @type {boolean|undefined}
|
|
10304
|
+
*/
|
|
10305
|
+
this.disableLosslessIntegers = false;
|
|
10306
|
+
/**
|
|
10307
|
+
* Make this driver always return native Javascript `BigInt` for integer values,
|
|
10308
|
+
* instead of the dedicated {@link Integer} class or `Number`.
|
|
10309
|
+
*
|
|
10310
|
+
* **Warning:** `BigInt` doesn't implement the method `toJSON`. To serialize it as `json`,
|
|
10311
|
+
* it's needed to add a custom implementation of the `toJSON` on the
|
|
10312
|
+
* `BigInt.prototype`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json.
|
|
10313
|
+
*
|
|
10314
|
+
* **Default**: ```false``` (for backwards compatibility)
|
|
10315
|
+
*
|
|
10316
|
+
* @type {boolean|undefined}
|
|
10317
|
+
*/
|
|
10318
|
+
this.useBigInt = false;
|
|
10319
|
+
/**
|
|
10320
|
+
* Specify the logging configuration for the driver. Object should have two properties `level` and `logger`.
|
|
10321
|
+
*
|
|
10322
|
+
* Property `level` represents the logging level which should be one of: 'error', 'warn', 'info' or 'debug'. This property is optional and
|
|
10323
|
+
* its default value is 'info'. Levels have priorities: 'error': 0, 'warn': 1, 'info': 2, 'debug': 3. Enabling a certain level also enables all
|
|
10324
|
+
* levels with lower priority. For example: 'error', 'warn' and 'info' will be logged when 'info' level is configured.
|
|
10325
|
+
*
|
|
10326
|
+
* Property `logger` represents the logging function which will be invoked for every log call with an acceptable level. The function should
|
|
10327
|
+
* take two string arguments `level` and `message`. The function should not execute any blocking or long-running operations
|
|
10328
|
+
* because it is often executed on a hot path.
|
|
10329
|
+
*
|
|
10330
|
+
* No logging is done by default. See `neo4j.logging` object that contains predefined logging implementations.
|
|
10331
|
+
*
|
|
10332
|
+
* @type {LoggingConfig|undefined}
|
|
10333
|
+
* @see {@link logging}
|
|
10334
|
+
*/
|
|
10335
|
+
this.logging = undefined;
|
|
10336
|
+
/**
|
|
10337
|
+
* Specify a custom server address resolver function used by the routing driver to resolve the initial address used to create the driver.
|
|
10338
|
+
*
|
|
10339
|
+
* Such resolution happens:
|
|
10340
|
+
* * during the very first rediscovery when driver is created
|
|
10341
|
+
* * when all the known routers from the current routing table have failed and driver needs to fallback to the initial address
|
|
10342
|
+
*
|
|
10343
|
+
* In NodeJS environment driver defaults to performing a DNS resolution of the initial address using 'dns' module.
|
|
10344
|
+
* In browser environment driver uses the initial address as-is.
|
|
10345
|
+
* Value should be a function that takes a single string argument - the initial address. It should return an array of new addresses.
|
|
10346
|
+
* Address is a string of shape '<host>:<port>'. Provided function can return either a Promise resolved with an array of addresses
|
|
10347
|
+
* or array of addresses directly.
|
|
10348
|
+
*
|
|
10349
|
+
* @type {function(address: string) {} |undefined}
|
|
10350
|
+
*/
|
|
10351
|
+
this.resolver = undefined;
|
|
10352
|
+
/**
|
|
10353
|
+
* Configure filter for Notification objects returned in {@Link ResultSummary#notifications}.
|
|
10354
|
+
*
|
|
10355
|
+
* See {@link SessionConfig#notificationFilter} for usage instructions.
|
|
10356
|
+
*
|
|
10357
|
+
* @type {NotificationFilter|undefined}
|
|
10358
|
+
*/
|
|
10359
|
+
this.notificationFilter = undefined;
|
|
10360
|
+
/**
|
|
10361
|
+
* Optionally override the default user agent name.
|
|
10362
|
+
*
|
|
10363
|
+
* **Default**: ```'neo4j-javascript/<version>'```
|
|
10364
|
+
*
|
|
10365
|
+
* @type {string|undefined}
|
|
10366
|
+
*/
|
|
10367
|
+
this.userAgent = undefined;
|
|
10368
|
+
}
|
|
10369
|
+
return Config;
|
|
10370
|
+
}());
|
|
10371
|
+
types$1.Config = Config;
|
|
10372
|
+
var InternalConfig = /** @class */ (function (_super) {
|
|
10373
|
+
__extends$H(InternalConfig, _super);
|
|
10374
|
+
function InternalConfig() {
|
|
10375
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10376
|
+
}
|
|
10377
|
+
return InternalConfig;
|
|
10378
|
+
}(Config));
|
|
10379
|
+
types$1.InternalConfig = InternalConfig;
|
|
10151
10380
|
|
|
10152
10381
|
(function (exports) {
|
|
10153
10382
|
/**
|
|
@@ -19387,7 +19616,7 @@ Object.defineProperty(version$1, "__esModule", { value: true });
|
|
|
19387
19616
|
// This is set up this way to keep the version in the code in
|
|
19388
19617
|
// sync with the npm package version, and to allow the build
|
|
19389
19618
|
// system to control version names at packaging time.
|
|
19390
|
-
version$1.default = '5.9.
|
|
19619
|
+
version$1.default = '5.9.2';
|
|
19391
19620
|
|
|
19392
19621
|
var lib = {};
|
|
19393
19622
|
|
|
@@ -28470,6 +28699,9 @@ function getTimeInZoneId(timeZoneId, epochSecond, nano) {
|
|
|
28470
28699
|
? function (year) { return year.subtract(1).negate(); } // 1BC equals to year 0 in astronomical year numbering
|
|
28471
28700
|
: functional_1.identity;
|
|
28472
28701
|
}
|
|
28702
|
+
else if (currentValue.type === 'hour') {
|
|
28703
|
+
obj.hour = (0, neo4j_driver_core_1$i.int)(currentValue.value).modulo(24);
|
|
28704
|
+
}
|
|
28473
28705
|
else if (currentValue.type !== 'literal') {
|
|
28474
28706
|
obj[currentValue.type] = (0, neo4j_driver_core_1$i.int)(currentValue.value);
|
|
28475
28707
|
}
|
|
@@ -30786,7 +31018,7 @@ var Connection = /** @class */ (function () {
|
|
|
30786
31018
|
/**
|
|
30787
31019
|
* Connect to the target address, negotiate Bolt protocol and send initialization message.
|
|
30788
31020
|
* @param {string} userAgent the user agent for this driver.
|
|
30789
|
-
* @param {
|
|
31021
|
+
* @param {Object} boltAgent the bolt agent for this driver.
|
|
30790
31022
|
* @param {Object} authToken the object containing auth information.
|
|
30791
31023
|
* @param {boolean} shouldWaitReAuth whether ot not the connection will wait for re-authentication to happen
|
|
30792
31024
|
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
|
|
@@ -31054,7 +31286,7 @@ var ChannelConnection = /** @class */ (function (_super) {
|
|
|
31054
31286
|
/**
|
|
31055
31287
|
* Send initialization message.
|
|
31056
31288
|
* @param {string} userAgent the user agent for this driver.
|
|
31057
|
-
* @param {
|
|
31289
|
+
* @param {Object} boltAgent the bolt agent for this driver.
|
|
31058
31290
|
* @param {Object} authToken the object containing auth information.
|
|
31059
31291
|
* @param {boolean} waitReAuth whether ot not the connection will wait for re-authentication to happen
|
|
31060
31292
|
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
|
|
@@ -33841,141 +34073,16 @@ function createAuthManager(authTokenOrManager) {
|
|
|
33841
34073
|
* Construct a new Neo4j Driver. This is your main entry point for this
|
|
33842
34074
|
* library.
|
|
33843
34075
|
*
|
|
33844
|
-
* ## Configuration
|
|
33845
|
-
*
|
|
33846
|
-
* This function optionally takes a configuration argument. Available configuration
|
|
33847
|
-
* options are as follows:
|
|
33848
|
-
*
|
|
33849
|
-
* {
|
|
33850
|
-
* // Encryption level: ENCRYPTION_ON or ENCRYPTION_OFF.
|
|
33851
|
-
* encrypted: ENCRYPTION_ON|ENCRYPTION_OFF
|
|
33852
|
-
*
|
|
33853
|
-
* // Trust strategy to use if encryption is enabled. There is no mode to disable
|
|
33854
|
-
* // trust other than disabling encryption altogether. The reason for
|
|
33855
|
-
* // this is that if you don't know who you are talking to, it is easy for an
|
|
33856
|
-
* // attacker to hijack your encrypted connection, rendering encryption pointless.
|
|
33857
|
-
* //
|
|
33858
|
-
* // TRUST_SYSTEM_CA_SIGNED_CERTIFICATES is the default choice. For NodeJS environments, this
|
|
33859
|
-
* // means that you trust whatever certificates are in the default trusted certificate
|
|
33860
|
-
* // store of the underlying system. For Browser environments, the trusted certificate
|
|
33861
|
-
* // store is usually managed by the browser. Refer to your system or browser documentation
|
|
33862
|
-
* // if you want to explicitly add a certificate as trusted.
|
|
33863
|
-
* //
|
|
33864
|
-
* // TRUST_CUSTOM_CA_SIGNED_CERTIFICATES is another option for trust verification -
|
|
33865
|
-
* // whenever we establish an encrypted connection, we ensure the host is using
|
|
33866
|
-
* // an encryption certificate that is in, or is signed by, a certificate given
|
|
33867
|
-
* // as trusted through configuration. This option is only available for NodeJS environments.
|
|
33868
|
-
* //
|
|
33869
|
-
* // TRUST_ALL_CERTIFICATES means that you trust everything without any verifications
|
|
33870
|
-
* // steps carried out. This option is only available for NodeJS environments and should not
|
|
33871
|
-
* // be used on production systems.
|
|
33872
|
-
* trust: "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES" | "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES" |
|
|
33873
|
-
* "TRUST_ALL_CERTIFICATES",
|
|
33874
|
-
*
|
|
33875
|
-
* // List of one or more paths to trusted encryption certificates. This only
|
|
33876
|
-
* // works in the NodeJS bundle, and only matters if you use "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES".
|
|
33877
|
-
* // The certificate files should be in regular X.509 PEM format.
|
|
33878
|
-
* // For instance, ['./trusted.pem']
|
|
33879
|
-
* trustedCertificates: [],
|
|
33880
|
-
*
|
|
33881
|
-
* // The maximum total number of connections allowed to be managed by the connection pool, per host.
|
|
33882
|
-
* // This includes both in-use and idle connections. No maximum connection pool size is imposed
|
|
33883
|
-
* // by default.
|
|
33884
|
-
* maxConnectionPoolSize: 100,
|
|
33885
|
-
*
|
|
33886
|
-
* // The maximum allowed lifetime for a pooled connection in milliseconds. Pooled connections older than this
|
|
33887
|
-
* // threshold will be closed and removed from the pool. Such discarding happens during connection acquisition
|
|
33888
|
-
* // so that new session is never backed by an old connection. Setting this option to a low value will cause
|
|
33889
|
-
* // a high connection churn and might result in a performance hit. It is recommended to set maximum lifetime
|
|
33890
|
-
* // to a slightly smaller value than the one configured in network equipment (load balancer, proxy, firewall,
|
|
33891
|
-
* // etc. can also limit maximum connection lifetime). No maximum lifetime limit is imposed by default. Zero
|
|
33892
|
-
* // and negative values result in lifetime not being checked.
|
|
33893
|
-
* maxConnectionLifetime: 60 * 60 * 1000, // 1 hour
|
|
33894
|
-
*
|
|
33895
|
-
* // The maximum amount of time to wait to acquire a connection from the pool (to either create a new
|
|
33896
|
-
* // connection or borrow an existing one.
|
|
33897
|
-
* connectionAcquisitionTimeout: 60000, // 1 minute
|
|
33898
|
-
*
|
|
33899
|
-
* // Specify the maximum time in milliseconds transactions are allowed to retry via
|
|
33900
|
-
* // `Session#executeRead()` and `Session#executeWrite()` functions.
|
|
33901
|
-
* // These functions will retry the given unit of work on `ServiceUnavailable`, `SessionExpired` and transient
|
|
33902
|
-
* // errors with exponential backoff using initial delay of 1 second.
|
|
33903
|
-
* // Default value is 30000 which is 30 seconds.
|
|
33904
|
-
* maxTransactionRetryTime: 30000, // 30 seconds
|
|
33905
|
-
*
|
|
33906
|
-
* // Specify socket connection timeout in milliseconds. Numeric values are expected. Negative and zero values
|
|
33907
|
-
* // result in no timeout being applied. Connection establishment will be then bound by the timeout configured
|
|
33908
|
-
* // on the operating system level. Default value is 30000, which is 30 seconds.
|
|
33909
|
-
* connectionTimeout: 30000, // 30 seconds
|
|
33910
|
-
*
|
|
33911
|
-
* // Make this driver always return native JavaScript numbers for integer values, instead of the
|
|
33912
|
-
* // dedicated {@link Integer} class. Values that do not fit in native number bit range will be represented as
|
|
33913
|
-
* // `Number.NEGATIVE_INFINITY` or `Number.POSITIVE_INFINITY`.
|
|
33914
|
-
* // **Warning:** ResultSummary It is not always safe to enable this setting when JavaScript applications are not the only ones
|
|
33915
|
-
* // interacting with the database. Stored numbers might in such case be not representable by native
|
|
33916
|
-
* // {@link Number} type and thus driver will return lossy values. This might also happen when data was
|
|
33917
|
-
* // initially imported using neo4j import tool and contained numbers larger than
|
|
33918
|
-
* // `Number.MAX_SAFE_INTEGER`. Driver will then return positive infinity, which is lossy.
|
|
33919
|
-
* // Default value for this option is `false` because native JavaScript numbers might result
|
|
33920
|
-
* // in loss of precision in the general case.
|
|
33921
|
-
* disableLosslessIntegers: false,
|
|
33922
|
-
*
|
|
33923
|
-
* // Make this driver always return native Javascript {@link BigInt} for integer values, instead of the dedicated {@link Integer} class or {@link Number}.
|
|
33924
|
-
* //
|
|
33925
|
-
* // Default value for this option is `false` for backwards compatibility.
|
|
33926
|
-
* //
|
|
33927
|
-
* // **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
|
|
33928
|
-
* // `BigInt.prototype` {@see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json}
|
|
33929
|
-
* useBigInt: false,
|
|
33930
|
-
*
|
|
33931
|
-
* // Specify the logging configuration for the driver. Object should have two properties `level` and `logger`.
|
|
33932
|
-
* //
|
|
33933
|
-
* // Property `level` represents the logging level which should be one of: 'error', 'warn', 'info' or 'debug'. This property is optional and
|
|
33934
|
-
* // its default value is 'info'. Levels have priorities: 'error': 0, 'warn': 1, 'info': 2, 'debug': 3. Enabling a certain level also enables all
|
|
33935
|
-
* // levels with lower priority. For example: 'error', 'warn' and 'info' will be logged when 'info' level is configured.
|
|
33936
|
-
* //
|
|
33937
|
-
* // Property `logger` represents the logging function which will be invoked for every log call with an acceptable level. The function should
|
|
33938
|
-
* // take two string arguments `level` and `message`. The function should not execute any blocking or long-running operations
|
|
33939
|
-
* // because it is often executed on a hot path.
|
|
33940
|
-
* //
|
|
33941
|
-
* // No logging is done by default. See `neo4j.logging` object that contains predefined logging implementations.
|
|
33942
|
-
* logging: {
|
|
33943
|
-
* level: 'info',
|
|
33944
|
-
* logger: (level, message) => console.log(level + ' ' + message)
|
|
33945
|
-
* },
|
|
33946
|
-
*
|
|
33947
|
-
* // Specify a custom server address resolver function used by the routing driver to resolve the initial address used to create the driver.
|
|
33948
|
-
* // Such resolution happens:
|
|
33949
|
-
* // * during the very first rediscovery when driver is created
|
|
33950
|
-
* // * when all the known routers from the current routing table have failed and driver needs to fallback to the initial address
|
|
33951
|
-
* //
|
|
33952
|
-
* // In NodeJS environment driver defaults to performing a DNS resolution of the initial address using 'dns' module.
|
|
33953
|
-
* // In browser environment driver uses the initial address as-is.
|
|
33954
|
-
* // Value should be a function that takes a single string argument - the initial address. It should return an array of new addresses.
|
|
33955
|
-
* // Address is a string of shape '<host>:<port>'. Provided function can return either a Promise resolved with an array of addresses
|
|
33956
|
-
* // or array of addresses directly.
|
|
33957
|
-
* resolver: function(address) {
|
|
33958
|
-
* return ['127.0.0.1:8888', 'fallback.db.com:7687'];
|
|
33959
|
-
* },
|
|
33960
|
-
*
|
|
33961
|
-
* // Configure filter for Notification objects returned in ResultSummary#notifications.
|
|
33962
|
-
* // See SessionConfig#notificationFilter for usage instructions.
|
|
33963
|
-
* notificationFilter: undefined,
|
|
33964
|
-
*
|
|
33965
|
-
* // Optionally override the default user agent name.
|
|
33966
|
-
* userAgent: USER_AGENT
|
|
33967
|
-
* }
|
|
33968
|
-
*
|
|
33969
34076
|
* @param {string} url The URL for the Neo4j database, for instance "neo4j://localhost" and/or "bolt://localhost"
|
|
33970
34077
|
* @param {Map<string,string>} authToken Authentication credentials. See {@link auth} for helpers.
|
|
33971
|
-
* @param {
|
|
34078
|
+
* @param {Config} config Configuration object.
|
|
33972
34079
|
* @returns {Driver}
|
|
33973
34080
|
*/
|
|
33974
34081
|
function driver(url, authToken, config) {
|
|
33975
34082
|
if (config === void 0) { config = {}; }
|
|
33976
34083
|
assertString(url, 'Bolt URL');
|
|
33977
34084
|
var parsedUrl = urlUtil.parseDatabaseUrl(url);
|
|
33978
|
-
// Determine
|
|
34085
|
+
// Determine encryption/trust options from the URL.
|
|
33979
34086
|
var routing = false;
|
|
33980
34087
|
var encrypted = false;
|
|
33981
34088
|
var trust;
|