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 22
22
* @private
23
23
*/
24
24
class Connection {
25
- id : string
26
- databaseId : string
25
+ id : string = ""
26
+ databaseId : string = ""
27
27
server : any
28
28
29
29
/**
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ class ConnectionHolder implements ConnectionHolderInterface {
194
194
*/
195
195
private _releaseConnection ( ) : Promise < Connection | void > {
196
196
this . _connectionPromise = this . _connectionPromise
197
- . then ( ( connection ?: Connection ) => {
197
+ . then ( ( connection ?: Connection | void ) => {
198
198
if ( connection ) {
199
199
if ( connection . isOpen ( ) ) {
200
200
return connection
Original file line number Diff line number Diff line change @@ -174,6 +174,6 @@ export class FailedObserver implements ResultStreamObserver {
174
174
175
175
function apply < T > ( thisArg : any , func ?: ( param : T ) => void , param ?: T ) : void {
176
176
if ( func ) {
177
- func . bind ( thisArg ) ( param )
177
+ func . bind ( thisArg ) ( param as any )
178
178
}
179
179
}
Original file line number Diff line number Diff line change @@ -30,13 +30,14 @@ type TransactionCreator = () => Transaction
30
30
type TransactionWork < T > = ( tx : Transaction ) => T | Promise < T >
31
31
type Resolve < T > = ( value : T | PromiseLike < T > ) => void
32
32
type Reject = ( value : any ) => void
33
+ type Timeout = ReturnType < typeof setTimeout >
33
34
34
35
export class TransactionExecutor {
35
36
private _maxRetryTimeMs : number
36
37
private _initialRetryDelayMs : number
37
38
private _multiplier : number
38
39
private _jitterFactor : number
39
- private _inFlightTimeoutIds : NodeJS . Timeout [ ]
40
+ private _inFlightTimeoutIds : Timeout [ ]
40
41
41
42
constructor (
42
43
maxRetryTimeMs ?: number | null ,
Original file line number Diff line number Diff line change 17
17
* limitations under the License.
18
18
*/
19
19
import VERSION from './version'
20
+ import { logging } from './logging'
20
21
21
22
import {
22
23
Neo4jError ,
@@ -79,7 +80,6 @@ type EncryptionLevel = coreTypes.EncryptionLevel
79
80
type SessionMode = coreTypes . SessionMode
80
81
type Logger = internal . logger . Logger
81
82
type ConfiguredCustomResolver = internal . resolver . ConfiguredCustomResolver
82
- type LogLevel = coreTypes . LogLevel
83
83
84
84
const { READ , WRITE } = coreDriver
85
85
@@ -327,21 +327,6 @@ function driver (
327
327
328
328
const USER_AGENT : string = 'neo4j-javascript/' + VERSION
329
329
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
-
345
330
/**
346
331
* Object containing constructors for all neo4j types.
347
332
*/
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