Skip to content

Commit 0971ccb

Browse files
committed
changes made after rebase onto re-auth
1 parent f53ae8a commit 0971ccb

File tree

16 files changed

+86
-58
lines changed

16 files changed

+86
-58
lines changed

packages/bolt-connection/src/connection-provider/authentication-provider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class AuthenticationProvider {
4747
const authToken = await this._authTokenManager.getToken()
4848

4949
if (!object.equals(authToken, connection.authToken)) {
50-
return await connection.connect(this._userAgent, authToken)
50+
return await connection.connect(this._userAgent, this._boltAgent, authToken, false)
5151
}
5252

5353
return connection

packages/bolt-connection/src/connection/connection-channel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export default class ChannelConnection extends Connection {
185185
* @param {string} userAgent the user agent for this driver.
186186
* @param {string} boltAgent the bolt agent for this driver.
187187
* @param {Object} authToken the object containing auth information.
188+
* @param {boolean} waitReAuth whether ot not the connection will wait for re-authentication to happen
188189
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
189190
*/
190191
async connect (userAgent, boltAgent, authToken, waitReAuth) {

packages/bolt-connection/src/connection/connection-delegate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default class DelegateConnection extends Connection {
8484
}
8585

8686
connect (userAgent, boltAgent, authToken, waitReAuth) {
87-
return this._delegate.connect(userAgent, authToken, boltAgent, waitReAuth)
87+
return this._delegate.connect(userAgent, boltAgent, authToken, waitReAuth)
8888
}
8989

9090
write (message, observer, flush) {

packages/bolt-connection/src/connection/connection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ export default class Connection {
9292
* @param {string} userAgent the user agent for this driver.
9393
* @param {string} boltAgent the bolt agent for this driver.
9494
* @param {Object} authToken the object containing auth information.
95+
* @param {boolean} shouldWaitReAuth whether ot not the connection will wait for re-authentication to happen
9596
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
9697
*/
97-
connect (userAgent, boltAgent, authToken) {
98+
connect (userAgent, boltAgent, authToken, shouldWaitReAuth) {
9899
throw new Error('not implemented')
99100
}
100101

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`#unit BoltProtocolV5x3 .packable() should pack not pack graph types (Node) 1`] = `"It is not allowed to pass nodes in query parameters, given: (c:a {a:\\"b\\"})"`;
4+
5+
exports[`#unit BoltProtocolV5x3 .packable() should pack not pack graph types (Path) 1`] = `"It is not allowed to pass paths in query parameters, given: [object Object]"`;
6+
7+
exports[`#unit BoltProtocolV5x3 .packable() should pack not pack graph types (Relationship) 1`] = `"It is not allowed to pass relationships in query parameters, given: (e)-[:a {b:\\"c\\"}]->(f)"`;
8+
9+
exports[`#unit BoltProtocolV5x3 .packable() should pack not pack graph types (UnboundRelationship) 1`] = `"It is not allowed to pass unbound relationships in query parameters, given: -[:a {b:\\"c\\"}]->"`;
10+
11+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Date with less fields) 1`] = `"Wrong struct size for Date, expected 1 but was 0"`;
12+
13+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Date with more fields) 1`] = `"Wrong struct size for Date, expected 1 but was 2"`;
14+
15+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (DateTimeWithZoneId with less fields) 1`] = `"Wrong struct size for DateTimeWithZoneId, expected 3 but was 2"`;
16+
17+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (DateTimeWithZoneId with more fields) 1`] = `"Wrong struct size for DateTimeWithZoneId, expected 3 but was 4"`;
18+
19+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (DateTimeWithZoneOffset with less fields) 1`] = `"Wrong struct size for DateTimeWithZoneOffset, expected 3 but was 2"`;
20+
21+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (DateTimeWithZoneOffset with more fields) 1`] = `"Wrong struct size for DateTimeWithZoneOffset, expected 3 but was 4"`;
22+
23+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Duration with less fields) 1`] = `"Wrong struct size for Duration, expected 4 but was 3"`;
24+
25+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Duration with more fields) 1`] = `"Wrong struct size for Duration, expected 4 but was 5"`;
26+
27+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (LocalDateTime with less fields) 1`] = `"Wrong struct size for LocalDateTime, expected 2 but was 1"`;
28+
29+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (LocalDateTime with more fields) 1`] = `"Wrong struct size for LocalDateTime, expected 2 but was 3"`;
30+
31+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (LocalTime with less fields) 1`] = `"Wrong struct size for LocalTime, expected 1 but was 0"`;
32+
33+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (LocalTime with more fields) 1`] = `"Wrong struct size for LocalTime, expected 1 but was 2"`;
34+
35+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Node with less fields) 1`] = `"Wrong struct size for Node, expected 4 but was 3"`;
36+
37+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Node with more fields) 1`] = `"Wrong struct size for Node, expected 4 but was 5"`;
38+
39+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Path with less fields) 1`] = `"Wrong struct size for Path, expected 3 but was 2"`;
40+
41+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Path with more fields) 1`] = `"Wrong struct size for Path, expected 3 but was 4"`;
42+
43+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Point with less fields) 1`] = `"Wrong struct size for Point2D, expected 3 but was 2"`;
44+
45+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Point with more fields) 1`] = `"Wrong struct size for Point2D, expected 3 but was 4"`;
46+
47+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Point3D with less fields) 1`] = `"Wrong struct size for Point3D, expected 4 but was 3"`;
48+
49+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Point3D with more fields) 1`] = `"Wrong struct size for Point3D, expected 4 but was 5"`;
50+
51+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Relationship with less fields) 1`] = `"Wrong struct size for Relationship, expected 8 but was 5"`;
52+
53+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Relationship with more fields) 1`] = `"Wrong struct size for Relationship, expected 8 but was 9"`;
54+
55+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Time with less fields) 1`] = `"Wrong struct size for Time, expected 2 but was 1"`;
56+
57+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (Time with more fileds) 1`] = `"Wrong struct size for Time, expected 2 but was 3"`;
58+
59+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (UnboundRelationship with less fields) 1`] = `"Wrong struct size for UnboundRelationship, expected 4 but was 3"`;
60+
61+
exports[`#unit BoltProtocolV5x3 .unpack() should not unpack with wrong size (UnboundRelationship with more fields) 1`] = `"Wrong struct size for UnboundRelationship, expected 4 but was 5"`;

packages/bolt-connection/test/bolt/bolt-protocol-v5x3.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ describe('#unit BoltProtocolV5x3', () => {
245245
it('should return correct bolt version number', () => {
246246
const protocol = new BoltProtocolV5x3(null, null, false)
247247

248-
expect(protocol.version).toBe(5.2)
248+
expect(protocol.version).toBe(5.3)
249249
})
250250

251251
it('should update metadata', () => {

packages/neo4j-driver-deno/lib/bolt-connection/connection-provider/authentication-provider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class AuthenticationProvider {
4747
const authToken = await this._authTokenManager.getToken()
4848

4949
if (!object.equals(authToken, connection.authToken)) {
50-
return await connection.connect(this._userAgent, authToken)
50+
return await connection.connect(this._userAgent, this._boltAgent, authToken, false)
5151
}
5252

5353
return connection

packages/neo4j-driver-deno/lib/bolt-connection/connection-provider/connection-provider-direct.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,8 @@ const {
3737
const { SERVICE_UNAVAILABLE } = error
3838

3939
export default class DirectConnectionProvider extends PooledConnectionProvider {
40-
<<<<<<< HEAD
41-
constructor ({ id, config, log, address, userAgent, authTokenManager, newPool }) {
42-
super({ id, config, log, userAgent, authTokenManager, newPool })
43-
=======
44-
constructor ({ id, config, log, address, userAgent, boltAgent, authToken }) {
45-
super({ id, config, log, userAgent, boltAgent, authToken })
46-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
40+
constructor ({ id, config, log, address, userAgent, boltAgent, authTokenManager, newPool }) {
41+
super({ id, config, log, userAgent, boltAgent, authTokenManager, newPool })
4742

4843
this._address = address
4944
}

packages/neo4j-driver-deno/lib/bolt-connection/connection-provider/connection-provider-pooled.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,18 @@ const AUTHENTICATION_ERRORS = [
3333

3434
export default class PooledConnectionProvider extends ConnectionProvider {
3535
constructor (
36-
<<<<<<< HEAD
3736
{ id, config, log, userAgent, boltAgent, authTokenManager, newPool = (...args) => new Pool(...args) },
38-
=======
39-
{ id, config, log, userAgent, boltAgent, authToken },
40-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
4137
createChannelConnectionHook = null
4238
) {
4339
super()
4440

4541
this._id = id
4642
this._config = config
4743
this._log = log
48-
<<<<<<< HEAD
4944
this._authTokenManager = authTokenManager
5045
this._authenticationProvider = new AuthenticationProvider({ authTokenManager, userAgent, boltAgent })
51-
=======
5246
this._userAgent = userAgent
5347
this._boltAgent = boltAgent
54-
this._authToken = authToken
55-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
5648
this._createChannelConnection =
5749
createChannelConnectionHook ||
5850
(address => {
@@ -95,12 +87,8 @@ export default class PooledConnectionProvider extends ConnectionProvider {
9587
return release(address, connection)
9688
}
9789
this._openConnections[connection.id] = connection
98-
<<<<<<< HEAD
90+
9991
return this._authenticationProvider.authenticate({ connection, auth })
100-
=======
101-
return connection
102-
.connect(this._userAgent, this._boltAgent, this._authToken)
103-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
10492
.catch(error => {
10593
// let's destroy this connection
10694
this._destroyConnection(connection)

packages/neo4j-driver-deno/lib/bolt-connection/connection-provider/connection-provider-routing.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,12 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
6767
config,
6868
log,
6969
userAgent,
70-
<<<<<<< HEAD
70+
boltAgent,
7171
authTokenManager,
7272
routingTablePurgeDelay,
7373
newPool
7474
}) {
75-
super({ id, config, log, userAgent, authTokenManager, newPool }, address => {
76-
=======
77-
boltAgent,
78-
authToken,
79-
routingTablePurgeDelay
80-
}) {
81-
super({ id, config, log, userAgent, boltAgent, authToken }, address => {
82-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
75+
super({ id, config, log, userAgent, boltAgent, authTokenManager, newPool }, address => {
8376
return createChannelConnection(
8477
address,
8578
this._config,

packages/neo4j-driver-deno/lib/bolt-connection/connection/connection-channel.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,18 @@ export default class ChannelConnection extends Connection {
185185
* @param {string} userAgent the user agent for this driver.
186186
* @param {string} boltAgent the bolt agent for this driver.
187187
* @param {Object} authToken the object containing auth information.
188+
* @param {boolean} waitReAuth whether ot not the connection will wait for re-authentication to happen
188189
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
189190
*/
190-
<<<<<<< HEAD
191-
async connect (userAgent, authToken, waitReAuth) {
191+
async connect (userAgent, boltAgent, authToken, waitReAuth) {
192192
if (this._protocol.initialized && !this._protocol.supportsReAuth) {
193193
throw newError('Connection does not support re-auth')
194194
}
195195

196196
this._authToken = authToken
197197

198198
if (!this._protocol.initialized) {
199-
return await this._initialize(userAgent, authToken)
199+
return await this._initialize(userAgent, boltAgent, authToken)
200200
}
201201

202202
if (waitReAuth) {
@@ -218,10 +218,6 @@ export default class ChannelConnection extends Connection {
218218
this._protocol.logon({ authToken, flush: true })
219219

220220
return this
221-
=======
222-
connect (userAgent, boltAgent, authToken) {
223-
return this._initialize(userAgent, boltAgent, authToken)
224-
>>>>>>> dce70ae8 (Bolt agent added to hello metadata)
225221
}
226222

227223
/**

packages/neo4j-driver-deno/lib/bolt-connection/connection/connection-delegate.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,8 @@ export default class DelegateConnection extends Connection {
8383
return this._delegate.protocol()
8484
}
8585

86-
<<<<<<< HEAD
87-
connect (userAgent, authToken, waitReAuth) {
88-
return this._delegate.connect(userAgent, authToken, waitReAuth)
89-
=======
90-
connect (userAgent, boltAgent, authToken) {
91-
return this._delegate.connect(userAgent, boltAgent, authToken)
92-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
86+
connect (userAgent, boltAgent, authToken, waitReAuth) {
87+
return this._delegate.connect(userAgent, boltAgent, authToken, waitReAuth)
9388
}
9489

9590
write (message, observer, flush) {

packages/neo4j-driver-deno/lib/bolt-connection/connection/connection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ export default class Connection {
9292
* @param {string} userAgent the user agent for this driver.
9393
* @param {string} boltAgent the bolt agent for this driver.
9494
* @param {Object} authToken the object containing auth information.
95+
* @param {boolean} shouldWaitReAuth whether ot not the connection will wait for re-authentication to happen
9596
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
9697
*/
97-
connect (userAgent, boltAgent, authToken) {
98+
connect (userAgent, boltAgent, authToken, shouldWaitReAuth) {
9899
throw new Error('not implemented')
99100
}
100101

packages/neo4j-driver-deno/lib/core/connection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ class Connection {
8585
* @param {string} userAgent the user agent for this driver.
8686
* @param {string} boltAgent the bolt agent for this driver.
8787
* @param {Object} authToken the object containing auth information.
88+
* @param {Object} waitReAuth whether to connect method should wait until re-Authorised
8889
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
8990
*/
90-
connect (userAgent: string, boltAgent: string, authToken: any): Promise<Connection> {
91+
connect (userAgent: string, boltAgent: string, authToken: any, waitReAuth: false): Promise<Connection> {
9192
throw Error('Not implemented')
9293
}
9394

packages/neo4j-driver-deno/lib/mod.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
*/
1919
import VERSION from './version.ts'
20-
import {logging} from './logging.ts'
20+
import { logging } from './logging.ts'
2121

2222
import {
2323
auth,
@@ -62,13 +62,10 @@ import {
6262
NotificationFilter,
6363
NotificationFilterDisabledCategory,
6464
notificationFilterDisabledCategory,
65-
<<<<<<< HEAD
66-
notificationFilterMinimumSeverityLevel,
6765
AuthTokenManager,
6866
expirationBasedAuthTokenManager,
6967
AuthTokenAndExpiration,
70-
staticAuthTokenManager
71-
=======
68+
staticAuthTokenManager,
7269
NotificationFilterMinimumSeverityLevel,
7370
notificationFilterMinimumSeverityLevel,
7471
NotificationPosition,
@@ -101,10 +98,9 @@ import {
10198
TransactionPromise,
10299
types as coreTypes,
103100
UnboundRelationship
104-
>>>>>>> 0b8c1b40 (Fix useragent string on metadata object in 5.3)
105101
} from './core/index.ts'
106102
// @deno-types=./bolt-connection/types/index.d.ts
107-
import {DirectConnectionProvider, RoutingConnectionProvider} from './bolt-connection/index.js'
103+
import { DirectConnectionProvider, RoutingConnectionProvider } from './bolt-connection/index.js'
108104

109105
type AuthToken = coreTypes.AuthToken
110106
type Config = coreTypes.Config

packages/neo4j-driver-lite/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import {
6565
AuthTokenManager,
6666
expirationBasedAuthTokenManager,
6767
AuthTokenAndExpiration,
68-
staticAuthTokenManager
68+
staticAuthTokenManager,
6969
NotificationFilterMinimumSeverityLevel,
7070
notificationFilterMinimumSeverityLevel,
7171
NotificationPosition,

0 commit comments

Comments
 (0)