@@ -56,70 +56,6 @@ import {
56
56
} from './temporal-types'
57
57
import ServerAddress from './internal/server-address'
58
58
59
- /**
60
- * @property {function(username: string, password: string, realm: ?string) } basic the function to create a
61
- * basic authentication token.
62
- * @property {function(base64EncodedTicket: string) } kerberos the function to create a Kerberos authentication token.
63
- * Accepts a single string argument - base64 encoded Kerberos ticket.
64
- * @property {function(principal: string, credentials: string, realm: string, scheme: string, parameters: ?object) } custom
65
- * the function to create a custom authentication token.
66
- */
67
- const auth = {
68
- basic : ( username , password , realm = undefined ) => {
69
- if ( realm ) {
70
- return {
71
- scheme : 'basic' ,
72
- principal : username ,
73
- credentials : password ,
74
- realm : realm
75
- }
76
- } else {
77
- return { scheme : 'basic' , principal : username , credentials : password }
78
- }
79
- } ,
80
- kerberos : base64EncodedTicket => {
81
- return {
82
- scheme : 'kerberos' ,
83
- principal : '' , // This empty string is required for backwards compatibility.
84
- credentials : base64EncodedTicket
85
- }
86
- } ,
87
- custom : ( principal , credentials , realm , scheme , parameters = undefined ) => {
88
- if ( parameters ) {
89
- return {
90
- scheme : scheme ,
91
- principal : principal ,
92
- credentials : credentials ,
93
- realm : realm ,
94
- parameters : parameters
95
- }
96
- } else {
97
- return {
98
- scheme : scheme ,
99
- principal : principal ,
100
- credentials : credentials ,
101
- realm : realm
102
- }
103
- }
104
- }
105
- }
106
- const USER_AGENT = 'neo4j-javascript/' + VERSION
107
-
108
- /**
109
- * Object containing predefined logging configurations. These are expected to be used as values of the driver config's `logging` property.
110
- * @property {function(level: ?string): object } console the function to create a logging config that prints all messages to `console.log` with
111
- * timestamp, level and message. It takes an optional `level` parameter which represents the maximum log level to be logged. Default value is 'info'.
112
- */
113
- const logging = {
114
- console : level => {
115
- return {
116
- level : level ,
117
- logger : ( level , message ) =>
118
- console . log ( `${ global . Date . now ( ) } ${ level . toUpperCase ( ) } ${ message } ` )
119
- }
120
- }
121
- }
122
-
123
59
/**
124
60
* Construct a new Neo4j Driver. This is your main entry point for this
125
61
* library.
@@ -234,7 +170,7 @@ const logging = {
234
170
* },
235
171
* }
236
172
*
237
- * @param {string } url The URL for the Neo4j database, for instance "bolt://localhost"
173
+ * @param {string } url The URL for the Neo4j database, for instance "neo4j://localhost" and/or " bolt://localhost"
238
174
* @param {Map<string,string> } authToken Authentication credentials. See {@link auth} for helpers.
239
175
* @param {Object } config Configuration object. See the configuration section above for details.
240
176
* @returns {Driver }
@@ -267,6 +203,70 @@ function driver (url, authToken, config = {}) {
267
203
}
268
204
}
269
205
206
+ /**
207
+ * @property {function(username: string, password: string, realm: ?string) } basic the function to create a
208
+ * basic authentication token.
209
+ * @property {function(base64EncodedTicket: string) } kerberos the function to create a Kerberos authentication token.
210
+ * Accepts a single string argument - base64 encoded Kerberos ticket.
211
+ * @property {function(principal: string, credentials: string, realm: string, scheme: string, parameters: ?object) } custom
212
+ * the function to create a custom authentication token.
213
+ */
214
+ const auth = {
215
+ basic : ( username , password , realm = undefined ) => {
216
+ if ( realm ) {
217
+ return {
218
+ scheme : 'basic' ,
219
+ principal : username ,
220
+ credentials : password ,
221
+ realm : realm
222
+ }
223
+ } else {
224
+ return { scheme : 'basic' , principal : username , credentials : password }
225
+ }
226
+ } ,
227
+ kerberos : base64EncodedTicket => {
228
+ return {
229
+ scheme : 'kerberos' ,
230
+ principal : '' , // This empty string is required for backwards compatibility.
231
+ credentials : base64EncodedTicket
232
+ }
233
+ } ,
234
+ custom : ( principal , credentials , realm , scheme , parameters = undefined ) => {
235
+ if ( parameters ) {
236
+ return {
237
+ scheme : scheme ,
238
+ principal : principal ,
239
+ credentials : credentials ,
240
+ realm : realm ,
241
+ parameters : parameters
242
+ }
243
+ } else {
244
+ return {
245
+ scheme : scheme ,
246
+ principal : principal ,
247
+ credentials : credentials ,
248
+ realm : realm
249
+ }
250
+ }
251
+ }
252
+ }
253
+ const USER_AGENT = 'neo4j-javascript/' + VERSION
254
+
255
+ /**
256
+ * Object containing predefined logging configurations. These are expected to be used as values of the driver config's `logging` property.
257
+ * @property {function(level: ?string): object } console the function to create a logging config that prints all messages to `console.log` with
258
+ * timestamp, level and message. It takes an optional `level` parameter which represents the maximum log level to be logged. Default value is 'info'.
259
+ */
260
+ const logging = {
261
+ console : level => {
262
+ return {
263
+ level : level ,
264
+ logger : ( level , message ) =>
265
+ console . log ( `${ global . Date . now ( ) } ${ level . toUpperCase ( ) } ${ message } ` )
266
+ }
267
+ }
268
+ }
269
+
270
270
/**
271
271
* Object containing constructors for all neo4j types.
272
272
*/
0 commit comments