neo4j-driver 5.7.0 → 5.8.0

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/driver.js CHANGED
@@ -74,13 +74,14 @@ var Driver = /** @class */ (function (_super) {
74
74
  * @returns {RxSession} new reactive session.
75
75
  */
76
76
  Driver.prototype.rxSession = function (_a) {
77
- var _b = _a === void 0 ? {} : _a, _c = _b.defaultAccessMode, defaultAccessMode = _c === void 0 ? WRITE : _c, bookmarks = _b.bookmarks, _d = _b.database, database = _d === void 0 ? '' : _d, fetchSize = _b.fetchSize, impersonatedUser = _b.impersonatedUser, bookmarkManager = _b.bookmarkManager, notificationFilter = _b.notificationFilter;
77
+ var _b = _a === void 0 ? {} : _a, _c = _b.defaultAccessMode, defaultAccessMode = _c === void 0 ? WRITE : _c, bookmarks = _b.bookmarks, _d = _b.database, database = _d === void 0 ? '' : _d, fetchSize = _b.fetchSize, impersonatedUser = _b.impersonatedUser, bookmarkManager = _b.bookmarkManager, notificationFilter = _b.notificationFilter, auth = _b.auth;
78
78
  return new session_rx_1.default({
79
79
  session: this._newSession({
80
80
  defaultAccessMode: defaultAccessMode,
81
81
  bookmarkOrBookmarks: bookmarks,
82
82
  database: database,
83
83
  impersonatedUser: impersonatedUser,
84
+ auth: auth,
84
85
  reactive: false,
85
86
  fetchSize: validateFetchSizeValue(fetchSize, this._config.fetchSize),
86
87
  bookmarkManager: bookmarkManager,
package/lib/index.js CHANGED
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.PathSegment = exports.Path = exports.UnboundRelationship = exports.Relationship = exports.Node = exports.Record = exports.ServerInfo = exports.Notification = exports.QueryStatistics = exports.ProfiledPlan = exports.Plan = exports.ResultSummary = exports.RxResult = exports.RxManagedTransaction = exports.RxTransaction = exports.RxSession = exports.EagerResult = exports.Result = exports.ManagedTransaction = exports.Transaction = exports.Session = exports.Driver = exports.temporal = exports.spatial = exports.graph = exports.error = exports.routing = exports.session = exports.types = exports.logging = exports.auth = exports.isRetryableError = exports.Neo4jError = exports.integer = exports.isUnboundRelationship = exports.isRelationship = exports.isPathSegment = exports.isPath = exports.isNode = exports.isDateTime = exports.isLocalDateTime = exports.isDate = exports.isTime = exports.isLocalTime = exports.isDuration = exports.isPoint = exports.isInt = exports.int = exports.hasReachableServer = exports.driver = void 0;
43
- exports.notificationFilterMinimumSeverityLevel = exports.notificationFilterDisabledCategory = exports.notificationSeverityLevel = exports.notificationCategory = exports.resultTransformers = exports.bookmarkManager = exports.DateTime = exports.LocalDateTime = exports.Date = exports.Time = exports.LocalTime = exports.Duration = exports.Integer = exports.Point = void 0;
43
+ exports.expirationBasedAuthTokenManager = exports.notificationFilterMinimumSeverityLevel = exports.notificationFilterDisabledCategory = exports.notificationSeverityLevel = exports.notificationCategory = exports.resultTransformers = exports.bookmarkManager = exports.DateTime = exports.LocalDateTime = exports.Date = exports.Time = exports.LocalTime = exports.Duration = exports.Integer = exports.Point = void 0;
44
44
  /**
45
45
  * Copyright (c) "Neo4j"
46
46
  * Neo4j Sweden AB [http://neo4j.com]
@@ -113,6 +113,7 @@ Object.defineProperty(exports, "notificationCategory", { enumerable: true, get:
113
113
  Object.defineProperty(exports, "notificationSeverityLevel", { enumerable: true, get: function () { return neo4j_driver_core_1.notificationSeverityLevel; } });
114
114
  Object.defineProperty(exports, "notificationFilterDisabledCategory", { enumerable: true, get: function () { return neo4j_driver_core_1.notificationFilterDisabledCategory; } });
115
115
  Object.defineProperty(exports, "notificationFilterMinimumSeverityLevel", { enumerable: true, get: function () { return neo4j_driver_core_1.notificationFilterMinimumSeverityLevel; } });
116
+ Object.defineProperty(exports, "expirationBasedAuthTokenManager", { enumerable: true, get: function () { return neo4j_driver_core_1.expirationBasedAuthTokenManager; } });
116
117
  var neo4j_driver_bolt_connection_1 = require("neo4j-driver-bolt-connection");
117
118
  var session_rx_1 = __importDefault(require("./session-rx"));
118
119
  exports.RxSession = session_rx_1.default;
@@ -123,6 +124,24 @@ exports.RxManagedTransaction = transaction_managed_rx_1.default;
123
124
  var result_rx_1 = __importDefault(require("./result-rx"));
124
125
  exports.RxResult = result_rx_1.default;
125
126
  var _a = neo4j_driver_core_1.internal.util, ENCRYPTION_ON = _a.ENCRYPTION_ON, assertString = _a.assertString, isEmptyObjectOrNull = _a.isEmptyObjectOrNull, ServerAddress = neo4j_driver_core_1.internal.serverAddress.ServerAddress, urlUtil = neo4j_driver_core_1.internal.urlUtil;
127
+ function isAuthTokenManager(value) {
128
+ return typeof value === 'object' &&
129
+ value != null &&
130
+ 'getToken' in value &&
131
+ 'onTokenExpired' in value &&
132
+ typeof value.getToken === 'function' &&
133
+ typeof value.onTokenExpired === 'function';
134
+ }
135
+ function createAuthManager(authTokenOrManager) {
136
+ if (isAuthTokenManager(authTokenOrManager)) {
137
+ return authTokenOrManager;
138
+ }
139
+ var authToken = authTokenOrManager;
140
+ // Sanitize authority token. Nicer error from server when a scheme is set.
141
+ authToken = authToken || {};
142
+ authToken.scheme = authToken.scheme || 'none';
143
+ return (0, neo4j_driver_core_1.staticAuthTokenManager)({ authToken: authToken });
144
+ }
126
145
  /**
127
146
  * Construct a new Neo4j Driver. This is your main entry point for this
128
147
  * library.
@@ -301,9 +320,7 @@ function driver(url, authToken, config) {
301
320
  config.encrypted = ENCRYPTION_ON;
302
321
  config.trust = trust;
303
322
  }
304
- // Sanitize authority token. Nicer error from server when a scheme is set.
305
- authToken = authToken || {};
306
- authToken.scheme = authToken.scheme || 'none';
323
+ var authTokenManager = createAuthManager(authToken);
307
324
  // Use default user agent or user agent specified by user.
308
325
  config.userAgent = config.userAgent || USER_AGENT;
309
326
  var address = ServerAddress.fromUrl(parsedUrl.hostAndPort);
@@ -321,7 +338,7 @@ function driver(url, authToken, config) {
321
338
  config: config,
322
339
  log: log,
323
340
  hostNameResolver: hostNameResolver,
324
- authToken: authToken,
341
+ authTokenManager: authTokenManager,
325
342
  address: address,
326
343
  userAgent: config.userAgent,
327
344
  routingContext: parsedUrl.query
@@ -337,7 +354,7 @@ function driver(url, authToken, config) {
337
354
  id: id,
338
355
  config: config,
339
356
  log: log,
340
- authToken: authToken,
357
+ authTokenManager: authTokenManager,
341
358
  address: address,
342
359
  userAgent: config.userAgent
343
360
  });
@@ -534,6 +551,7 @@ var forExport = {
534
551
  notificationCategory: neo4j_driver_core_1.notificationCategory,
535
552
  notificationSeverityLevel: neo4j_driver_core_1.notificationSeverityLevel,
536
553
  notificationFilterDisabledCategory: neo4j_driver_core_1.notificationFilterDisabledCategory,
537
- notificationFilterMinimumSeverityLevel: neo4j_driver_core_1.notificationFilterMinimumSeverityLevel
554
+ notificationFilterMinimumSeverityLevel: neo4j_driver_core_1.notificationFilterMinimumSeverityLevel,
555
+ expirationBasedAuthTokenManager: neo4j_driver_core_1.expirationBasedAuthTokenManager
538
556
  };
539
557
  exports.default = forExport;
package/lib/version.js CHANGED
@@ -26,4 +26,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  // This is set up this way to keep the version in the code in
27
27
  // sync with the npm package version, and to allow the build
28
28
  // system to control version names at packaging time.
29
- exports.default = '5.7.0';
29
+ exports.default = '5.8.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo4j-driver",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "The official Neo4j driver for Javascript",
5
5
  "author": "Neo4j",
6
6
  "license": "Apache-2.0",
@@ -79,9 +79,9 @@
79
79
  "webpack": "^5.75.0"
80
80
  },
81
81
  "dependencies": {
82
- "neo4j-driver-bolt-connection": "^5.7.0",
83
- "neo4j-driver-core": "^5.7.0",
82
+ "neo4j-driver-bolt-connection": "^5.8.0",
83
+ "neo4j-driver-core": "^5.8.0",
84
84
  "rxjs": "^7.8.0"
85
85
  },
86
- "gitHead": "dd93e78d7b189c59765fe6bc0104c5d4a5fbd15d"
86
+ "gitHead": "d8c4e0f4f9643f99da56bb8f1d179d0ec4b3b3ab"
87
87
  }
package/types/index.d.ts CHANGED
@@ -83,7 +83,10 @@ import {
83
83
  NotificationFilterDisabledCategory,
84
84
  NotificationFilterMinimumSeverityLevel,
85
85
  notificationFilterDisabledCategory,
86
- notificationFilterMinimumSeverityLevel
86
+ notificationFilterMinimumSeverityLevel,
87
+ AuthTokenManager,
88
+ AuthTokenAndExpiration,
89
+ expirationBasedAuthTokenManager
87
90
  } from 'neo4j-driver-core'
88
91
  import {
89
92
  AuthToken,
@@ -265,6 +268,7 @@ declare const forExport: {
265
268
  notificationSeverityLevel: typeof notificationSeverityLevel
266
269
  notificationFilterDisabledCategory: typeof notificationFilterDisabledCategory
267
270
  notificationFilterMinimumSeverityLevel: typeof notificationFilterMinimumSeverityLevel
271
+ expirationBasedAuthTokenManager: typeof expirationBasedAuthTokenManager
268
272
  }
269
273
 
270
274
  export {
@@ -338,7 +342,8 @@ export {
338
342
  notificationCategory,
339
343
  notificationSeverityLevel,
340
344
  notificationFilterDisabledCategory,
341
- notificationFilterMinimumSeverityLevel
345
+ notificationFilterMinimumSeverityLevel,
346
+ expirationBasedAuthTokenManager
342
347
  }
343
348
 
344
349
  export type {
@@ -352,7 +357,9 @@ export type {
352
357
  NotificationSeverityLevel,
353
358
  NotificationFilter,
354
359
  NotificationFilterDisabledCategory,
355
- NotificationFilterMinimumSeverityLevel
360
+ NotificationFilterMinimumSeverityLevel,
361
+ AuthTokenManager,
362
+ AuthTokenAndExpiration
356
363
  }
357
364
 
358
365
  export default forExport