neo4j-driver-core
Advanced tools
Comparing version 5.27.0 to 5.28.0
@@ -19,2 +19,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var error_1 = require("./error"); | ||
var json_1 = require("./json"); | ||
/** | ||
@@ -74,2 +76,8 @@ * @property {function(username: string, password: string, realm: ?string)} basic the function to create a | ||
if (isNotEmpty(parameters)) { | ||
try { | ||
(0, json_1.stringify)(parameters); | ||
} | ||
catch (e) { | ||
throw (0, error_1.newError)('Circular references in custom auth token parameters', undefined, e); | ||
} | ||
output.parameters = parameters; | ||
@@ -76,0 +84,0 @@ } |
@@ -61,3 +61,5 @@ "use strict"; | ||
* @property {string} param.impersonatedUser - the impersonated user | ||
* @property {function (databaseName:string?)} param.onDatabaseNameResolved - Callback called when the database name get resolved | ||
* @property {function (databaseName:string)} param.onDatabaseNameResolved - Callback called when the database name get resolved | ||
* @property {AuthToken} param.auth - auth token used to authorize for connection acquisition | ||
* @property {string} param.homeDb - the driver's best guess at the current home database for the user | ||
* @returns {Promise<Connection>} | ||
@@ -87,3 +89,3 @@ */ | ||
/** | ||
* This method checks whether the backend database supports transaction config functionality | ||
* This method checks whether the backend database supports user impersonation functionality | ||
* by checking protocol handshake result. | ||
@@ -105,2 +107,5 @@ * | ||
}; | ||
ConnectionProvider.prototype.SSREnabled = function () { | ||
return false; | ||
}; | ||
/** | ||
@@ -107,0 +112,0 @@ * This method verifies the connectivity of the database by trying to acquire a connection |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -53,2 +64,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var error_1 = require("./error"); | ||
var homedb_cache_1 = __importDefault(require("./internal/homedb-cache")); | ||
var auth_util_1 = require("./internal/auth-util"); | ||
var DEFAULT_MAX_CONNECTION_LIFETIME = 60 * 60 * 1000; // 1 hour | ||
@@ -61,2 +74,6 @@ /** | ||
/** | ||
* The maximum number of entries allowed in the home database cache before pruning. | ||
*/ | ||
var HOMEDB_CACHE_MAX_SIZE = 10000; | ||
/** | ||
* Constant that represents read session access mode. | ||
@@ -427,2 +444,6 @@ * Should be used like this: `driver.session({ defaultAccessMode: neo4j.session.READ })`. | ||
this._connectionProvider = null; | ||
/** | ||
* @private | ||
*/ | ||
this.homeDatabaseCache = new homedb_cache_1.default(HOMEDB_CACHE_MAX_SIZE); | ||
this._afterConstruction(); | ||
@@ -752,2 +773,5 @@ } | ||
}; | ||
Driver.prototype._homeDatabaseCallback = function (cacheKey, database) { | ||
this.homeDatabaseCache.set(cacheKey, database); | ||
}; | ||
/** | ||
@@ -760,2 +784,5 @@ * @private | ||
var connectionProvider = this._getOrCreateConnectionProvider(); | ||
// eslint-disable-next-line | ||
var cachedHomeDatabase = this.homeDatabaseCache.get((0, auth_util_1.cacheKey)(auth, impersonatedUser)); | ||
var homeDatabaseCallback = this._homeDatabaseCallback.bind(this); | ||
var bookmarks = bookmarkOrBookmarks != null | ||
@@ -769,3 +796,3 @@ ? new bookmarks_1.Bookmarks(bookmarkOrBookmarks) | ||
bookmarks: bookmarks, | ||
config: this._config, | ||
config: __assign({ cachedHomeDatabase: cachedHomeDatabase, routingDriver: this._supportsRouting() }, this._config), | ||
reactive: reactive, | ||
@@ -777,3 +804,4 @@ impersonatedUser: impersonatedUser, | ||
auth: auth, | ||
log: this._log | ||
log: this._log, | ||
homeDatabaseCallback: homeDatabaseCallback | ||
}); | ||
@@ -780,0 +808,0 @@ }; |
@@ -128,5 +128,5 @@ "use strict"; | ||
}; | ||
ConnectionHolder.prototype.initializeConnection = function () { | ||
ConnectionHolder.prototype.initializeConnection = function (homeDatabase) { | ||
if (this._referenceCount === 0 && (this._connectionProvider != null)) { | ||
this._connectionPromise = this._createConnectionPromise(this._connectionProvider); | ||
this._connectionPromise = this._createConnectionPromise(this._connectionProvider, homeDatabase); | ||
} | ||
@@ -140,3 +140,3 @@ else { | ||
}; | ||
ConnectionHolder.prototype._createConnectionPromise = function (connectionProvider) { | ||
ConnectionHolder.prototype._createConnectionPromise = function (connectionProvider, homeDatabase) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -158,2 +158,3 @@ var _a, _b; | ||
_c.auth = this._auth, | ||
_c.homeDb = homeDatabase, | ||
_c)])]; | ||
@@ -160,0 +161,0 @@ case 2: return [2 /*return*/, _d.sent()]; |
@@ -19,3 +19,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TELEMETRY_APIS = exports.BOLT_PROTOCOL_V5_7 = exports.BOLT_PROTOCOL_V5_6 = exports.BOLT_PROTOCOL_V5_5 = exports.BOLT_PROTOCOL_V5_4 = exports.BOLT_PROTOCOL_V5_3 = exports.BOLT_PROTOCOL_V5_2 = exports.BOLT_PROTOCOL_V5_1 = exports.BOLT_PROTOCOL_V5_0 = exports.BOLT_PROTOCOL_V4_4 = exports.BOLT_PROTOCOL_V4_3 = exports.BOLT_PROTOCOL_V4_2 = exports.BOLT_PROTOCOL_V4_1 = exports.BOLT_PROTOCOL_V4_0 = exports.BOLT_PROTOCOL_V3 = exports.BOLT_PROTOCOL_V2 = exports.BOLT_PROTOCOL_V1 = exports.DEFAULT_POOL_MAX_SIZE = exports.DEFAULT_POOL_ACQUISITION_TIMEOUT = exports.DEFAULT_CONNECTION_TIMEOUT_MILLIS = exports.ACCESS_MODE_WRITE = exports.ACCESS_MODE_READ = exports.FETCH_ALL = void 0; | ||
exports.TELEMETRY_APIS = exports.BOLT_PROTOCOL_V5_8 = exports.BOLT_PROTOCOL_V5_7 = exports.BOLT_PROTOCOL_V5_6 = exports.BOLT_PROTOCOL_V5_5 = exports.BOLT_PROTOCOL_V5_4 = exports.BOLT_PROTOCOL_V5_3 = exports.BOLT_PROTOCOL_V5_2 = exports.BOLT_PROTOCOL_V5_1 = exports.BOLT_PROTOCOL_V5_0 = exports.BOLT_PROTOCOL_V4_4 = exports.BOLT_PROTOCOL_V4_3 = exports.BOLT_PROTOCOL_V4_2 = exports.BOLT_PROTOCOL_V4_1 = exports.BOLT_PROTOCOL_V4_0 = exports.BOLT_PROTOCOL_V3 = exports.BOLT_PROTOCOL_V2 = exports.BOLT_PROTOCOL_V1 = exports.DEFAULT_POOL_MAX_SIZE = exports.DEFAULT_POOL_ACQUISITION_TIMEOUT = exports.DEFAULT_CONNECTION_TIMEOUT_MILLIS = exports.ACCESS_MODE_WRITE = exports.ACCESS_MODE_READ = exports.FETCH_ALL = void 0; | ||
var FETCH_ALL = -1; | ||
@@ -65,2 +65,4 @@ exports.FETCH_ALL = FETCH_ALL; | ||
exports.BOLT_PROTOCOL_V5_7 = BOLT_PROTOCOL_V5_7; | ||
var BOLT_PROTOCOL_V5_8 = 5.8; | ||
exports.BOLT_PROTOCOL_V5_8 = BOLT_PROTOCOL_V5_8; | ||
var TELEMETRY_APIS = { | ||
@@ -67,0 +69,0 @@ MANAGED_TRANSACTION: 0, |
@@ -295,8 +295,2 @@ "use strict"; | ||
* | ||
* <b>Implementation note:</b> | ||
* Time zone offset returned by the standard JavaScript date is the difference, in minutes, from local time to UTC. | ||
* So positive value means offset is behind UTC and negative value means it is ahead. | ||
* For Neo4j temporal types, like `Time` or `DateTime` offset is in seconds and represents difference from UTC to local time. | ||
* This is different from standard JavaScript dates and that's why implementation negates the returned value. | ||
* | ||
* @param {global.Date} standardDate the standard JavaScript date. | ||
@@ -306,13 +300,52 @@ * @return {number} the time zone offset in seconds. | ||
function timeZoneOffsetInSeconds(standardDate) { | ||
var secondsPortion = standardDate.getSeconds() >= standardDate.getUTCSeconds() | ||
? standardDate.getSeconds() - standardDate.getUTCSeconds() | ||
: standardDate.getSeconds() - standardDate.getUTCSeconds() + 60; | ||
var offsetInMinutes = standardDate.getTimezoneOffset(); | ||
if (offsetInMinutes === 0) { | ||
return 0 + secondsPortion; | ||
} | ||
return -1 * offsetInMinutes * exports.SECONDS_PER_MINUTE + secondsPortion; | ||
var secondsPortion = standardDate.getSeconds() - standardDate.getUTCSeconds(); | ||
var minutesPortion = standardDate.getMinutes() - standardDate.getUTCMinutes(); | ||
var hoursPortion = standardDate.getHours() - standardDate.getUTCHours(); | ||
var daysPortion = _getDayOffset(standardDate); | ||
return hoursPortion * exports.SECONDS_PER_HOUR + minutesPortion * exports.SECONDS_PER_MINUTE + secondsPortion + daysPortion * exports.SECONDS_PER_DAY; | ||
} | ||
exports.timeZoneOffsetInSeconds = timeZoneOffsetInSeconds; | ||
/** | ||
* Get the difference in days from the given JavaScript date in local time and UTC. | ||
* | ||
* @private | ||
* @param {global.Date} standardDate the date to evaluate | ||
* @returns {number} the difference in days between date local time and UTC | ||
*/ | ||
function _getDayOffset(standardDate) { | ||
if (standardDate.getMonth() === standardDate.getUTCMonth()) { | ||
return standardDate.getDate() - standardDate.getUTCDate(); | ||
} | ||
else if ((standardDate.getFullYear() > standardDate.getUTCFullYear()) || (standardDate.getMonth() > standardDate.getUTCMonth() && standardDate.getFullYear() === standardDate.getUTCFullYear())) { | ||
return standardDate.getDate() + _daysUntilNextMonth(standardDate.getUTCMonth(), standardDate.getUTCFullYear()) - standardDate.getUTCDate(); | ||
} | ||
else { | ||
return standardDate.getDate() - (standardDate.getUTCDate() + _daysUntilNextMonth(standardDate.getMonth(), standardDate.getFullYear())); | ||
} | ||
} | ||
/** | ||
* Get the number of days in a month, including a check for leap years. | ||
* | ||
* @private | ||
* @param {number} month the month of the date to evalutate | ||
* @param {number} year the month of the date to evalutate | ||
* @returns {number} the total number of days in the month evaluated | ||
*/ | ||
function _daysUntilNextMonth(month, year) { | ||
if (month === 1) { | ||
if (year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)) { | ||
return 29; | ||
} | ||
else { | ||
return 28; | ||
} | ||
} | ||
else if ([0, 2, 4, 6, 7, 9, 11].includes(month)) { | ||
return 31; | ||
} | ||
else { | ||
return 30; | ||
} | ||
} | ||
/** | ||
* Assert that the year value is valid. | ||
@@ -319,0 +352,0 @@ * @param {Integer|number} year the value to check. |
@@ -38,2 +38,11 @@ "use strict"; | ||
} | ||
if ((opts === null || opts === void 0 ? void 0 : opts.sortedElements) === true && | ||
typeof value === 'object' && | ||
!Array.isArray(value)) { | ||
return Object.keys(value).sort().reduce(function (obj, key) { | ||
// @ts-expect-error: no way to avoid implicit 'any' | ||
obj[key] = value[key]; | ||
return obj; | ||
}, {}); | ||
} | ||
if ((opts === null || opts === void 0 ? void 0 : opts.useCustomToString) === true && | ||
@@ -40,0 +49,0 @@ typeof value === 'object' && |
@@ -95,2 +95,3 @@ "use strict"; | ||
var transaction_managed_1 = __importDefault(require("./transaction-managed")); | ||
var auth_util_1 = require("./internal/auth-util"); | ||
/** | ||
@@ -116,7 +117,11 @@ * A Session instance is used for handling the connection and | ||
* @param {string} args.impersonatedUser - The username which the user wants to impersonate for the duration of the session. | ||
* @param {BookmarkManager} args.bookmarkManager - The bookmark manager used for this session. | ||
* @param {NotificationFilter} args.notificationFilter - The notification filter used for this session. | ||
* @param {AuthToken} args.auth - the target auth for the to-be-acquired connection | ||
* @param {NotificationFilter} args.notificationFilter - The notification filter used for this session. | ||
* @param {Logger} args.log - the logger used for logs in this session. | ||
* @param {(user:string, database:string) => void} args.homeDatabaseCallback - callback used to update the home database cache | ||
*/ | ||
function Session(_a) { | ||
var mode = _a.mode, connectionProvider = _a.connectionProvider, bookmarks = _a.bookmarks, database = _a.database, config = _a.config, reactive = _a.reactive, fetchSize = _a.fetchSize, impersonatedUser = _a.impersonatedUser, bookmarkManager = _a.bookmarkManager, notificationFilter = _a.notificationFilter, auth = _a.auth, log = _a.log; | ||
var mode = _a.mode, connectionProvider = _a.connectionProvider, bookmarks = _a.bookmarks, database = _a.database, config = _a.config, reactive = _a.reactive, fetchSize = _a.fetchSize, impersonatedUser = _a.impersonatedUser, bookmarkManager = _a.bookmarkManager, notificationFilter = _a.notificationFilter, auth = _a.auth, log = _a.log, homeDatabaseCallback = _a.homeDatabaseCallback; | ||
var _b; | ||
this._mode = mode; | ||
@@ -126,3 +131,4 @@ this._database = database; | ||
this._fetchSize = fetchSize; | ||
this._onDatabaseNameResolved = this._onDatabaseNameResolved.bind(this); | ||
this._homeDatabaseCallback = homeDatabaseCallback; | ||
this._auth = auth; | ||
this._getConnectionAcquistionBookmarks = this._getConnectionAcquistionBookmarks.bind(this); | ||
@@ -136,3 +142,3 @@ this._readConnectionHolder = new connection_holder_1.ConnectionHolder({ | ||
impersonatedUser: impersonatedUser, | ||
onDatabaseNameResolved: this._onDatabaseNameResolved, | ||
onDatabaseNameResolved: this._onDatabaseNameResolved.bind(this), | ||
getConnectionAcquistionBookmarks: this._getConnectionAcquistionBookmarks, | ||
@@ -148,3 +154,3 @@ log: log | ||
impersonatedUser: impersonatedUser, | ||
onDatabaseNameResolved: this._onDatabaseNameResolved, | ||
onDatabaseNameResolved: this._onDatabaseNameResolved.bind(this), | ||
getConnectionAcquistionBookmarks: this._getConnectionAcquistionBookmarks, | ||
@@ -167,2 +173,4 @@ log: log | ||
this._log = log; | ||
this._databaseGuess = config === null || config === void 0 ? void 0 : config.cachedHomeDatabase; | ||
this._isRoutingSession = (_b = config === null || config === void 0 ? void 0 : config.routingDriver) !== null && _b !== void 0 ? _b : false; | ||
} | ||
@@ -209,3 +217,4 @@ /** | ||
highRecordWatermark: this._highRecordWatermark, | ||
notificationFilter: this._notificationFilter | ||
notificationFilter: this._notificationFilter, | ||
onDb: this._onDatabaseNameResolved.bind(this) | ||
})]; | ||
@@ -259,3 +268,3 @@ } | ||
} | ||
else if (!this._hasTx && connectionHolder.initializeConnection()) { | ||
else if (!this._hasTx && connectionHolder.initializeConnection(this._databaseGuess)) { | ||
resultPromise = connectionHolder | ||
@@ -306,3 +315,3 @@ .getConnection() | ||
var connectionHolder = this._connectionHolderWithMode(mode); | ||
connectionHolder.initializeConnection(); | ||
connectionHolder.initializeConnection(this._databaseGuess); | ||
this._hasTx = true; | ||
@@ -320,3 +329,4 @@ var tx = new transaction_promise_1.default({ | ||
notificationFilter: this._notificationFilter, | ||
apiTelemetryConfig: apiTelemetryConfig | ||
apiTelemetryConfig: apiTelemetryConfig, | ||
onDbCallback: this._onDatabaseNameResolved.bind(this) | ||
}); | ||
@@ -486,8 +496,14 @@ tx._begin(function () { return _this._bookmarks(); }, txConfig); | ||
Session.prototype._onDatabaseNameResolved = function (database) { | ||
if (!this._databaseNameResolved) { | ||
var normalizedDatabase = database !== null && database !== void 0 ? database : ''; | ||
this._database = normalizedDatabase; | ||
this._readConnectionHolder.setDatabase(normalizedDatabase); | ||
this._writeConnectionHolder.setDatabase(normalizedDatabase); | ||
this._databaseNameResolved = true; | ||
if (this._isRoutingSession) { | ||
this._databaseGuess = database; | ||
if (!this._databaseNameResolved) { | ||
var normalizedDatabase = database !== null && database !== void 0 ? database : ''; | ||
this._database = normalizedDatabase; | ||
this._readConnectionHolder.setDatabase(normalizedDatabase); | ||
this._writeConnectionHolder.setDatabase(normalizedDatabase); | ||
this._databaseNameResolved = true; | ||
if (this._homeDatabaseCallback != null) { | ||
this._homeDatabaseCallback((0, auth_util_1.cacheKey)(this._auth, this._impersonatedUser), database); | ||
} | ||
} | ||
} | ||
@@ -494,0 +510,0 @@ }; |
@@ -305,2 +305,6 @@ "use strict"; | ||
* Hour, minute, second, millisecond and time zone offset components of the given date are ignored. | ||
* | ||
* NOTE: the function {@link toStandardDate} and {@link fromStandardDate} are not inverses of one another. {@link fromStandardDate} takes the Day, Month and Year in local time from the supplies JavaScript Date object, while {@link toStandardDate} creates a new JavaScript Date object at midnight UTC. This incongruity will be rectified in 6.0 | ||
* If your timezone has a negative offset from UTC, creating a JavaScript Date at midnight UTC and converting it with {@link fromStandardDate} will result in a Date for the day before. | ||
* | ||
* @param {global.Date} standardDate - The standard JavaScript date to convert. | ||
@@ -319,2 +323,4 @@ * @return {Date} New Date. | ||
* | ||
* NOTE: the function {@link toStandardDate} and {@link fromStandardDate} are not inverses of one another. {@link fromStandardDate} takes the Day, Month and Year in local time from the supplies JavaScript Date object, while {@link toStandardDate} creates a new JavaScript Date object at midnight UTC. This incongruity will be rectified in 6.0 | ||
* | ||
* @returns {StandardDate} Standard JavaScript `Date` at `00:00:00.000` UTC. | ||
@@ -321,0 +327,0 @@ */ |
@@ -78,3 +78,3 @@ "use strict"; | ||
function TransactionPromise(_b) { | ||
var connectionHolder = _b.connectionHolder, onClose = _b.onClose, onBookmarks = _b.onBookmarks, onConnection = _b.onConnection, reactive = _b.reactive, fetchSize = _b.fetchSize, impersonatedUser = _b.impersonatedUser, highRecordWatermark = _b.highRecordWatermark, lowRecordWatermark = _b.lowRecordWatermark, notificationFilter = _b.notificationFilter, apiTelemetryConfig = _b.apiTelemetryConfig; | ||
var connectionHolder = _b.connectionHolder, onClose = _b.onClose, onBookmarks = _b.onBookmarks, onConnection = _b.onConnection, reactive = _b.reactive, fetchSize = _b.fetchSize, impersonatedUser = _b.impersonatedUser, highRecordWatermark = _b.highRecordWatermark, lowRecordWatermark = _b.lowRecordWatermark, notificationFilter = _b.notificationFilter, apiTelemetryConfig = _b.apiTelemetryConfig, onDbCallback = _b.onDbCallback; | ||
var _this = _super.call(this, { | ||
@@ -94,2 +94,3 @@ connectionHolder: connectionHolder, | ||
_this[_a] = 'TransactionPromise'; | ||
_this._onDbCallback = onDbCallback; | ||
return _this; | ||
@@ -153,3 +154,4 @@ } | ||
onError: this._onBeginError.bind(this), | ||
onComplete: this._onBeginMetadata.bind(this) | ||
onComplete: this._onBeginMetadata.bind(this), | ||
onDB: this._onDbCallback | ||
}); | ||
@@ -156,0 +158,0 @@ }; |
@@ -153,2 +153,5 @@ "use strict"; | ||
} | ||
if (metadata.db !== undefined && ((events === null || events === void 0 ? void 0 : events.onDB) != null)) { | ||
events.onDB(metadata.db); | ||
} | ||
_this._onComplete(metadata); | ||
@@ -155,0 +158,0 @@ } |
{ | ||
"name": "neo4j-driver-core", | ||
"version": "5.27.0", | ||
"version": "5.28.0", | ||
"description": "Internals of neo4j-driver", | ||
@@ -48,3 +48,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "720a7e2a9f108d0a6780c4a6bfe2275e79981e9e" | ||
"gitHead": "5b5495066f8ea8d0450e2c9ac52194e25d85a774" | ||
} |
@@ -53,3 +53,5 @@ /** | ||
* @property {string} param.impersonatedUser - the impersonated user | ||
* @property {function (databaseName:string?)} param.onDatabaseNameResolved - Callback called when the database name get resolved | ||
* @property {function (databaseName:string)} param.onDatabaseNameResolved - Callback called when the database name get resolved | ||
* @property {AuthToken} param.auth - auth token used to authorize for connection acquisition | ||
* @property {string} param.homeDb - the driver's best guess at the current home database for the user | ||
* @returns {Promise<Connection>} | ||
@@ -62,4 +64,5 @@ */ | ||
impersonatedUser?: string; | ||
onDatabaseNameResolved?: (databaseName?: string) => void; | ||
onDatabaseNameResolved?: (database: string) => void; | ||
auth?: AuthToken; | ||
homeDb?: string; | ||
}): Promise<Connection & Releasable>; | ||
@@ -81,3 +84,3 @@ /** | ||
/** | ||
* This method checks whether the backend database supports transaction config functionality | ||
* This method checks whether the backend database supports user impersonation functionality | ||
* by checking protocol handshake result. | ||
@@ -95,2 +98,3 @@ * | ||
supportsSessionAuth(): Promise<boolean>; | ||
SSREnabled(): boolean; | ||
/** | ||
@@ -97,0 +101,0 @@ * This method verifies the connectivity of the database by trying to acquire a connection |
@@ -50,2 +50,3 @@ /** | ||
reactive: boolean; | ||
onDb?: (database: string) => void; | ||
} | ||
@@ -52,0 +53,0 @@ /** |
@@ -62,2 +62,3 @@ /// <reference types="node" /> | ||
log: Logger; | ||
homeDatabaseCallback?: (user: string, database: any) => void; | ||
}) => Session; | ||
@@ -149,2 +150,3 @@ type CreateQueryExecutor = (createSession: (config: { | ||
private readonly _queryExecutor; | ||
private readonly homeDatabaseCache; | ||
/** | ||
@@ -380,2 +382,3 @@ * You should not be calling this directly, instead use {@link driver}. | ||
_afterConstruction(): void; | ||
_homeDatabaseCallback(cacheKey: string, database: any): void; | ||
/** | ||
@@ -382,0 +385,0 @@ * @private |
@@ -97,3 +97,3 @@ /** | ||
impersonatedUser?: string; | ||
onDatabaseNameResolved?: (databaseName?: string) => void; | ||
onDatabaseNameResolved?: (database: string) => void; | ||
getConnectionAcquistionBookmarks?: () => Promise<Bookmarks>; | ||
@@ -109,3 +109,3 @@ auth?: AuthToken; | ||
referenceCount(): number; | ||
initializeConnection(): boolean; | ||
initializeConnection(homeDatabase?: string): boolean; | ||
private _createConnectionPromise; | ||
@@ -112,0 +112,0 @@ private _getBookmarks; |
@@ -39,2 +39,3 @@ /** | ||
declare const BOLT_PROTOCOL_V5_7: number; | ||
declare const BOLT_PROTOCOL_V5_8: number; | ||
declare const TELEMETRY_APIS: { | ||
@@ -48,2 +49,2 @@ readonly MANAGED_TRANSACTION: 0; | ||
export type AccessMode = typeof ACCESS_MODE_READ | typeof ACCESS_MODE_WRITE; | ||
export { FETCH_ALL, ACCESS_MODE_READ, ACCESS_MODE_WRITE, DEFAULT_CONNECTION_TIMEOUT_MILLIS, DEFAULT_POOL_ACQUISITION_TIMEOUT, DEFAULT_POOL_MAX_SIZE, BOLT_PROTOCOL_V1, BOLT_PROTOCOL_V2, BOLT_PROTOCOL_V3, BOLT_PROTOCOL_V4_0, BOLT_PROTOCOL_V4_1, BOLT_PROTOCOL_V4_2, BOLT_PROTOCOL_V4_3, BOLT_PROTOCOL_V4_4, BOLT_PROTOCOL_V5_0, BOLT_PROTOCOL_V5_1, BOLT_PROTOCOL_V5_2, BOLT_PROTOCOL_V5_3, BOLT_PROTOCOL_V5_4, BOLT_PROTOCOL_V5_5, BOLT_PROTOCOL_V5_6, BOLT_PROTOCOL_V5_7, TELEMETRY_APIS }; | ||
export { FETCH_ALL, ACCESS_MODE_READ, ACCESS_MODE_WRITE, DEFAULT_CONNECTION_TIMEOUT_MILLIS, DEFAULT_POOL_ACQUISITION_TIMEOUT, DEFAULT_POOL_MAX_SIZE, BOLT_PROTOCOL_V1, BOLT_PROTOCOL_V2, BOLT_PROTOCOL_V3, BOLT_PROTOCOL_V4_0, BOLT_PROTOCOL_V4_1, BOLT_PROTOCOL_V4_2, BOLT_PROTOCOL_V4_3, BOLT_PROTOCOL_V4_4, BOLT_PROTOCOL_V5_0, BOLT_PROTOCOL_V5_1, BOLT_PROTOCOL_V5_2, BOLT_PROTOCOL_V5_3, BOLT_PROTOCOL_V5_4, BOLT_PROTOCOL_V5_5, BOLT_PROTOCOL_V5_6, BOLT_PROTOCOL_V5_7, BOLT_PROTOCOL_V5_8, TELEMETRY_APIS }; |
@@ -138,8 +138,2 @@ /** | ||
* | ||
* <b>Implementation note:</b> | ||
* Time zone offset returned by the standard JavaScript date is the difference, in minutes, from local time to UTC. | ||
* So positive value means offset is behind UTC and negative value means it is ahead. | ||
* For Neo4j temporal types, like `Time` or `DateTime` offset is in seconds and represents difference from UTC to local time. | ||
* This is different from standard JavaScript dates and that's why implementation negates the returned value. | ||
* | ||
* @param {global.Date} standardDate the standard JavaScript date. | ||
@@ -146,0 +140,0 @@ * @return {number} the time zone offset in seconds. |
@@ -19,2 +19,3 @@ /** | ||
useCustomToString?: boolean; | ||
sortedElements?: boolean; | ||
} | ||
@@ -21,0 +22,0 @@ /** |
@@ -67,2 +67,6 @@ /** | ||
private readonly _log; | ||
private readonly _homeDatabaseCallback; | ||
private readonly _auth; | ||
private _databaseGuess; | ||
private readonly _isRoutingSession; | ||
/** | ||
@@ -80,6 +84,9 @@ * @constructor | ||
* @param {string} args.impersonatedUser - The username which the user wants to impersonate for the duration of the session. | ||
* @param {BookmarkManager} args.bookmarkManager - The bookmark manager used for this session. | ||
* @param {NotificationFilter} args.notificationFilter - The notification filter used for this session. | ||
* @param {AuthToken} args.auth - the target auth for the to-be-acquired connection | ||
* @param {NotificationFilter} args.notificationFilter - The notification filter used for this session. | ||
* @param {Logger} args.log - the logger used for logs in this session. | ||
* @param {(user:string, database:string) => void} args.homeDatabaseCallback - callback used to update the home database cache | ||
*/ | ||
constructor({ mode, connectionProvider, bookmarks, database, config, reactive, fetchSize, impersonatedUser, bookmarkManager, notificationFilter, auth, log }: { | ||
constructor({ mode, connectionProvider, bookmarks, database, config, reactive, fetchSize, impersonatedUser, bookmarkManager, notificationFilter, auth, log, homeDatabaseCallback }: { | ||
mode: SessionMode; | ||
@@ -97,2 +104,3 @@ connectionProvider: ConnectionProvider; | ||
log: Logger; | ||
homeDatabaseCallback?: (user: string, database: string) => void; | ||
}); | ||
@@ -99,0 +107,0 @@ /** |
@@ -140,2 +140,6 @@ /** | ||
* Hour, minute, second, millisecond and time zone offset components of the given date are ignored. | ||
* | ||
* NOTE: the function {@link toStandardDate} and {@link fromStandardDate} are not inverses of one another. {@link fromStandardDate} takes the Day, Month and Year in local time from the supplies JavaScript Date object, while {@link toStandardDate} creates a new JavaScript Date object at midnight UTC. This incongruity will be rectified in 6.0 | ||
* If your timezone has a negative offset from UTC, creating a JavaScript Date at midnight UTC and converting it with {@link fromStandardDate} will result in a Date for the day before. | ||
* | ||
* @param {global.Date} standardDate - The standard JavaScript date to convert. | ||
@@ -151,2 +155,4 @@ * @return {Date} New Date. | ||
* | ||
* NOTE: the function {@link toStandardDate} and {@link fromStandardDate} are not inverses of one another. {@link fromStandardDate} takes the Day, Month and Year in local time from the supplies JavaScript Date object, while {@link toStandardDate} creates a new JavaScript Date object at midnight UTC. This incongruity will be rectified in 6.0 | ||
* | ||
* @returns {StandardDate} Standard JavaScript `Date` at `00:00:00.000` UTC. | ||
@@ -153,0 +159,0 @@ */ |
@@ -39,2 +39,3 @@ /** | ||
private _resolve?; | ||
private readonly _onDbCallback; | ||
/** | ||
@@ -54,3 +55,3 @@ * @constructor | ||
*/ | ||
constructor({ connectionHolder, onClose, onBookmarks, onConnection, reactive, fetchSize, impersonatedUser, highRecordWatermark, lowRecordWatermark, notificationFilter, apiTelemetryConfig }: { | ||
constructor({ connectionHolder, onClose, onBookmarks, onConnection, reactive, fetchSize, impersonatedUser, highRecordWatermark, lowRecordWatermark, notificationFilter, apiTelemetryConfig, onDbCallback }: { | ||
connectionHolder: ConnectionHolder; | ||
@@ -67,2 +68,3 @@ onClose: () => void; | ||
apiTelemetryConfig?: NonAutoCommitApiTelemetryConfig; | ||
onDbCallback: (database: string) => void; | ||
}); | ||
@@ -69,0 +71,0 @@ /** |
@@ -91,2 +91,3 @@ /** | ||
onComplete: (metadata: any) => void; | ||
onDB: (database: string) => void; | ||
}): void; | ||
@@ -93,0 +94,0 @@ /** |
803053
116
18843