File tree Expand file tree Collapse file tree 6 files changed +27
-21
lines changed Expand file tree Collapse file tree 6 files changed +27
-21
lines changed Original file line number Diff line number Diff line change 2222 * @private
2323 */
2424class Connection {
25- id : string
26- databaseId : string
25+ id : string = ""
26+ databaseId : string = ""
2727 server : any
2828
2929 /**
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ class ConnectionHolder implements ConnectionHolderInterface {
194194 */
195195 private _releaseConnection ( ) : Promise < Connection | void > {
196196 this . _connectionPromise = this . _connectionPromise
197- . then ( ( connection ?: Connection ) => {
197+ . then ( ( connection ?: Connection | void ) => {
198198 if ( connection ) {
199199 if ( connection . isOpen ( ) ) {
200200 return connection
Original file line number Diff line number Diff line change @@ -174,6 +174,6 @@ export class FailedObserver implements ResultStreamObserver {
174174
175175function apply < T > ( thisArg : any , func ?: ( param : T ) => void , param ?: T ) : void {
176176 if ( func ) {
177- func . bind ( thisArg ) ( param )
177+ func . bind ( thisArg ) ( param as any )
178178 }
179179}
Original file line number Diff line number Diff line change @@ -30,13 +30,14 @@ type TransactionCreator = () => Transaction
3030type TransactionWork < T > = ( tx : Transaction ) => T | Promise < T >
3131type Resolve < T > = ( value : T | PromiseLike < T > ) => void
3232type Reject = ( value : any ) => void
33+ type Timeout = ReturnType < typeof setTimeout >
3334
3435export class TransactionExecutor {
3536 private _maxRetryTimeMs : number
3637 private _initialRetryDelayMs : number
3738 private _multiplier : number
3839 private _jitterFactor : number
39- private _inFlightTimeoutIds : NodeJS . Timeout [ ]
40+ private _inFlightTimeoutIds : Timeout [ ]
4041
4142 constructor (
4243 maxRetryTimeMs ?: number | null ,
Original file line number Diff line number Diff line change 1717 * limitations under the License.
1818 */
1919import VERSION from './version'
20+ import { logging } from './logging'
2021
2122import {
2223 Neo4jError ,
@@ -79,7 +80,6 @@ type EncryptionLevel = coreTypes.EncryptionLevel
7980type SessionMode = coreTypes . SessionMode
8081type Logger = internal . logger . Logger
8182type ConfiguredCustomResolver = internal . resolver . ConfiguredCustomResolver
82- type LogLevel = coreTypes . LogLevel
8383
8484const { READ , WRITE } = coreDriver
8585
@@ -327,21 +327,6 @@ function driver (
327327
328328const USER_AGENT : string = 'neo4j-javascript/' + VERSION
329329
330- /**
331- * Object containing predefined logging configurations. These are expected to be used as values of the driver config's `logging` property.
332- * @property {function(level: ?string): object } console the function to create a logging config that prints all messages to `console.log` with
333- * timestamp, level and message. It takes an optional `level` parameter which represents the maximum log level to be logged. Default value is 'info'.
334- */
335- const logging = {
336- console : ( level : LogLevel ) => {
337- return {
338- level : level ,
339- logger : ( level : LogLevel , message : string ) =>
340- console . log ( `${ global . Date . now ( ) } ${ level . toUpperCase ( ) } ${ message } ` )
341- }
342- }
343- }
344-
345330/**
346331 * Object containing constructors for all neo4j types.
347332 */
Original file line number Diff line number Diff line change 1+ import { types as coreTypes } from 'neo4j-driver-core'
2+
3+ type LogLevel = coreTypes . LogLevel
4+
5+ /**
6+ * Object containing predefined logging configurations. These are expected to be used as values of the driver config's `logging` property.
7+ * @property {function(level: ?string): object } console the function to create a logging config that prints all messages to `console.log` with
8+ * timestamp, level and message. It takes an optional `level` parameter which represents the maximum log level to be logged. Default value is 'info'.
9+ */
10+ export const logging = {
11+ console : ( level : LogLevel ) => {
12+ return {
13+ level : level ,
14+ logger : ( level : LogLevel , message : string ) =>
15+ console . log ( `${ Date . now ( ) } ${ level . toUpperCase ( ) } ${ message } ` )
16+ // Note: This 'logging' object is in its own file so we can easily access the global Date object here without conflicting
17+ // with the Neo4j Date class, and without relying on 'globalThis' which isn't compatible with Node 10.
18+ }
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments