Skip to content

Commit fe66d06

Browse files
authored
Bump RxJS to 7.5.5 (#927)
The breaking changes present on this update was already gone through deprecation in the last releases. Some adjustments in the driver code was needed. * `concat` was replaced by `concatWith` * `flatMap` was replaced by `mergeMap` * `throwError` was change for receiving an error supplier instead of an error
1 parent 89d4b32 commit fe66d06

14 files changed

+88
-89
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ rxSession
222222
.records()
223223
.pipe(
224224
map(record => record.get('name')),
225-
concat(rxSession.close())
225+
concatWith(rxSession.close())
226226
)
227227
.subscribe({
228228
next: data => console.log(data),
@@ -373,8 +373,8 @@ try {
373373
rxSession
374374
.beginTransaction()
375375
.pipe(
376-
flatMap(txc =>
377-
concat(
376+
mergeMap(txc =>
377+
concatWith(
378378
txc
379379
.run(
380380
'MERGE (bob:Person {name: $nameParam}) RETURN bob.name AS name',
@@ -397,7 +397,7 @@ rxSession
397397
of('Second query completed'),
398398
txc.commit(),
399399
of('committed')
400-
).pipe(catchError(err => txc.rollback().pipe(throwError(err))))
400+
).pipe(catchError(err => txc.rollback().pipe(throwError(() => err))))
401401
)
402402
)
403403
.subscribe({

packages/neo4j-driver/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ rxSession
222222
.records()
223223
.pipe(
224224
map(record => record.get('name')),
225-
concat(rxSession.close())
225+
concatWith(rxSession.close())
226226
)
227227
.subscribe({
228228
next: data => console.log(data),
@@ -373,8 +373,8 @@ try {
373373
rxSession
374374
.beginTransaction()
375375
.pipe(
376-
flatMap(txc =>
377-
concat(
376+
mergeMap(txc =>
377+
concatWith(
378378
txc
379379
.run(
380380
'MERGE (bob:Person {name: $nameParam}) RETURN bob.name AS name',
@@ -397,7 +397,7 @@ rxSession
397397
of('Second query completed'),
398398
txc.commit(),
399399
of('committed')
400-
).pipe(catchError(err => txc.rollback().pipe(throwError(err))))
400+
).pipe(catchError(err => txc.rollback().pipe(throwError(() => err))))
401401
)
402402
)
403403
.subscribe({

packages/neo4j-driver/package-lock.json

Lines changed: 15 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/neo4j-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@
8787
"@babel/runtime": "^7.17.8",
8888
"neo4j-driver-bolt-connection": "5.0.0-dev",
8989
"neo4j-driver-core": "5.0.0-dev",
90-
"rxjs": "^6.6.7"
90+
"rxjs": "^7.5.5"
9191
}
9292
}

packages/neo4j-driver/src/internal/retry-logic-rx.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import { newError, error, internal, isRetriableError } from 'neo4j-driver-core'
2121
// eslint-disable-next-line no-unused-vars
2222
import { Observable, throwError, of } from 'rxjs'
23-
import { retryWhen, flatMap, delay } from 'rxjs/operators'
23+
import { retryWhen, mergeMap, delay } from 'rxjs/operators'
2424

2525
const {
2626
logger: {
@@ -80,9 +80,9 @@ export default class RxRetryLogic {
8080
let delayDuration = this._initialDelay
8181

8282
return failedWork.pipe(
83-
flatMap(err => {
83+
mergeMap(err => {
8484
if (!isRetriableError(err)) {
85-
return throwError(err)
85+
return throwError(() => err)
8686
}
8787

8888
handledExceptions.push(err)
@@ -98,7 +98,7 @@ export default class RxRetryLogic {
9898

9999
error.seenErrors = handledExceptions
100100

101-
return throwError(error)
101+
return throwError(() => error)
102102
}
103103

104104
const nextDelayDuration = this._computeNextDelay(delayDuration)

packages/neo4j-driver/src/result-rx.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/* eslint-disable-next-line no-unused-vars */
2020
import { newError, Record, ResultSummary } from 'neo4j-driver-core'
2121
import { Observable, Subject, ReplaySubject, from } from 'rxjs'
22-
import { flatMap, publishReplay, refCount } from 'rxjs/operators'
22+
import { mergeMap, publishReplay, refCount } from 'rxjs/operators'
2323

2424
const States = {
2525
READY: 0,
@@ -41,7 +41,7 @@ export default class RxResult {
4141

4242
this._result = replayedResult
4343
this._keys = replayedResult.pipe(
44-
flatMap(r => from(r.keys())),
44+
mergeMap(r => from(r.keys())),
4545
publishReplay(1),
4646
refCount()
4747
)
@@ -75,7 +75,7 @@ export default class RxResult {
7575
*/
7676
records () {
7777
const result = this._result.pipe(
78-
flatMap(
78+
mergeMap(
7979
result =>
8080
new Observable(recordsObserver =>
8181
this._startStreaming({ result, recordsObserver })
@@ -97,7 +97,7 @@ export default class RxResult {
9797
*/
9898
consume () {
9999
return this._result.pipe(
100-
flatMap(
100+
mergeMap(
101101
result =>
102102
new Observable(summaryObserver =>
103103
this._startStreaming({ result, summaryObserver })

packages/neo4j-driver/src/session-rx.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
*/
1919
import { defer, Observable, throwError } from 'rxjs'
20-
import { flatMap, catchError, concat } from 'rxjs/operators'
20+
import { mergeMap, catchError, concatWith } from 'rxjs/operators'
2121
import RxResult from './result-rx'
2222
// eslint-disable-next-line no-unused-vars
2323
import { Session, internal } from 'neo4j-driver-core'
@@ -230,16 +230,16 @@ export default class RxSession {
230230

231231
return this._retryLogic.retry(
232232
this._beginTransaction(accessMode, txConfig).pipe(
233-
flatMap(txc =>
233+
mergeMap(txc =>
234234
defer(() => {
235235
try {
236236
return work(transactionWrapper(txc))
237237
} catch (err) {
238-
return throwError(err)
238+
return throwError(() => err)
239239
}
240240
}).pipe(
241-
catchError(err => txc.rollback().pipe(concat(throwError(err)))),
242-
concat(txc.commit())
241+
catchError(err => txc.rollback().pipe(concatWith(throwError(() => err)))),
242+
concatWith(txc.commit())
243243
)
244244
)
245245
)

packages/neo4j-driver/test/internal/retry-logic-rx.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ describe('#unit-rx retrylogic', () => {
245245
clock.tick(delayBy)
246246
}
247247
if (index < errors.length) {
248-
return throwError(errors[index++])
248+
const i = index++
249+
return throwError(() => errors[i])
249250
} else {
250251
return of(value)
251252
}

packages/neo4j-driver/test/rx/nested-statements.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
import { Notification, throwError } from 'rxjs'
2121
import {
22-
flatMap,
22+
mergeMap,
2323
materialize,
2424
toArray,
25-
concat,
2625
map,
2726
bufferCount,
28-
catchError
27+
catchError,
28+
concatWith
2929
} from 'rxjs/operators'
3030
import neo4j from '../../src'
3131
// eslint-disable-next-line no-unused-vars
@@ -65,23 +65,23 @@ describe('#integration-rx transaction', () => {
6565
const messages = await session
6666
.beginTransaction()
6767
.pipe(
68-
flatMap(txc =>
68+
mergeMap(txc =>
6969
txc
7070
.run('UNWIND RANGE(1, $size) AS x RETURN x', { size })
7171
.records()
7272
.pipe(
7373
map(r => r.get(0)),
7474
bufferCount(50),
75-
flatMap(x =>
75+
mergeMap(x =>
7676
txc
7777
.run('UNWIND $x AS id CREATE (n:Node {id: id}) RETURN n.id', {
7878
x
7979
})
8080
.records()
8181
),
8282
map(r => r.get(0)),
83-
concat(txc.commit()),
84-
catchError(err => txc.rollback().pipe(concat(throwError(err)))),
83+
concatWith(txc.commit()),
84+
catchError(err => txc.rollback().pipe(concatWith(throwError(() => err)))),
8585
materialize(),
8686
toArray()
8787
)
@@ -105,7 +105,7 @@ describe('#integration-rx transaction', () => {
105105
.pipe(
106106
map(r => r.get(0)),
107107
bufferCount(50),
108-
flatMap(x =>
108+
mergeMap(x =>
109109
session
110110
.run('UNWIND $x AS id CREATE (n:Node {id: id}) RETURN n.id', {
111111
x

packages/neo4j-driver/test/rx/session.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { Notification, throwError } from 'rxjs'
21-
import { map, materialize, toArray, concat } from 'rxjs/operators'
21+
import { map, materialize, toArray, concatWith } from 'rxjs/operators'
2222
import neo4j from '../../src'
2323
import RxSession from '../../src/session-rx'
2424
import sharedNeo4j from '../internal/shared-neo4j'
@@ -377,7 +377,7 @@ describe('#integration rx-session', () => {
377377
.records()
378378
.pipe(
379379
map(r => r.get(0).toInt()),
380-
concat(session.close())
380+
concatWith(session.close())
381381
)
382382
.toPromise()
383383
}
@@ -403,7 +403,8 @@ describe('#integration rx-session', () => {
403403
}
404404

405405
if (this._reactiveFailuresIndex < this._reactiveFailures.length) {
406-
return throwError(this._reactiveFailures[this._reactiveFailuresIndex++])
406+
const i = this._reactiveFailuresIndex++
407+
return throwError(() => this._reactiveFailures[i])
407408
}
408409

409410
return txc

0 commit comments

Comments
 (0)