Skip to content

Bump RxJS to 7.5.5 #927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ rxSession
.records()
.pipe(
map(record => record.get('name')),
concat(rxSession.close())
concatWith(rxSession.close())
)
.subscribe({
next: data => console.log(data),
Expand Down Expand Up @@ -373,8 +373,8 @@ try {
rxSession
.beginTransaction()
.pipe(
flatMap(txc =>
concat(
mergeMap(txc =>
concatWith(
txc
.run(
'MERGE (bob:Person {name: $nameParam}) RETURN bob.name AS name',
Expand All @@ -397,7 +397,7 @@ rxSession
of('Second query completed'),
txc.commit(),
of('committed')
).pipe(catchError(err => txc.rollback().pipe(throwError(err))))
).pipe(catchError(err => txc.rollback().pipe(throwError(() => err))))
)
)
.subscribe({
Expand Down
8 changes: 4 additions & 4 deletions packages/neo4j-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ rxSession
.records()
.pipe(
map(record => record.get('name')),
concat(rxSession.close())
concatWith(rxSession.close())
)
.subscribe({
next: data => console.log(data),
Expand Down Expand Up @@ -373,8 +373,8 @@ try {
rxSession
.beginTransaction()
.pipe(
flatMap(txc =>
concat(
mergeMap(txc =>
concatWith(
txc
.run(
'MERGE (bob:Person {name: $nameParam}) RETURN bob.name AS name',
Expand All @@ -397,7 +397,7 @@ rxSession
of('Second query completed'),
txc.commit(),
of('committed')
).pipe(catchError(err => txc.rollback().pipe(throwError(err))))
).pipe(catchError(err => txc.rollback().pipe(throwError(() => err))))
)
)
.subscribe({
Expand Down
34 changes: 16 additions & 18 deletions packages/neo4j-driver/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/neo4j-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@
"@babel/runtime": "^7.17.8",
"neo4j-driver-bolt-connection": "5.0.0-dev",
"neo4j-driver-core": "5.0.0-dev",
"rxjs": "^6.6.7"
"rxjs": "^7.5.5"
}
}
8 changes: 4 additions & 4 deletions packages/neo4j-driver/src/internal/retry-logic-rx.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { newError, error, internal, isRetriableError } from 'neo4j-driver-core'
// eslint-disable-next-line no-unused-vars
import { Observable, throwError, of } from 'rxjs'
import { retryWhen, flatMap, delay } from 'rxjs/operators'
import { retryWhen, mergeMap, delay } from 'rxjs/operators'

const {
logger: {
Expand Down Expand Up @@ -80,9 +80,9 @@ export default class RxRetryLogic {
let delayDuration = this._initialDelay

return failedWork.pipe(
flatMap(err => {
mergeMap(err => {
if (!isRetriableError(err)) {
return throwError(err)
return throwError(() => err)
}

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

error.seenErrors = handledExceptions

return throwError(error)
return throwError(() => error)
}

const nextDelayDuration = this._computeNextDelay(delayDuration)
Expand Down
8 changes: 4 additions & 4 deletions packages/neo4j-driver/src/result-rx.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/* eslint-disable-next-line no-unused-vars */
import { newError, Record, ResultSummary } from 'neo4j-driver-core'
import { Observable, Subject, ReplaySubject, from } from 'rxjs'
import { flatMap, publishReplay, refCount } from 'rxjs/operators'
import { mergeMap, publishReplay, refCount } from 'rxjs/operators'

const States = {
READY: 0,
Expand All @@ -41,7 +41,7 @@ export default class RxResult {

this._result = replayedResult
this._keys = replayedResult.pipe(
flatMap(r => from(r.keys())),
mergeMap(r => from(r.keys())),
publishReplay(1),
refCount()
)
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class RxResult {
*/
records () {
const result = this._result.pipe(
flatMap(
mergeMap(
result =>
new Observable(recordsObserver =>
this._startStreaming({ result, recordsObserver })
Expand All @@ -97,7 +97,7 @@ export default class RxResult {
*/
consume () {
return this._result.pipe(
flatMap(
mergeMap(
result =>
new Observable(summaryObserver =>
this._startStreaming({ result, summaryObserver })
Expand Down
10 changes: 5 additions & 5 deletions packages/neo4j-driver/src/session-rx.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/
import { defer, Observable, throwError } from 'rxjs'
import { flatMap, catchError, concat } from 'rxjs/operators'
import { mergeMap, catchError, concatWith } from 'rxjs/operators'
import RxResult from './result-rx'
// eslint-disable-next-line no-unused-vars
import { Session, internal } from 'neo4j-driver-core'
Expand Down Expand Up @@ -230,16 +230,16 @@ export default class RxSession {

return this._retryLogic.retry(
this._beginTransaction(accessMode, txConfig).pipe(
flatMap(txc =>
mergeMap(txc =>
defer(() => {
try {
return work(transactionWrapper(txc))
} catch (err) {
return throwError(err)
return throwError(() => err)
}
}).pipe(
catchError(err => txc.rollback().pipe(concat(throwError(err)))),
concat(txc.commit())
catchError(err => txc.rollback().pipe(concatWith(throwError(() => err)))),
concatWith(txc.commit())
)
)
)
Expand Down
3 changes: 2 additions & 1 deletion packages/neo4j-driver/test/internal/retry-logic-rx.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ describe('#unit-rx retrylogic', () => {
clock.tick(delayBy)
}
if (index < errors.length) {
return throwError(errors[index++])
const i = index++
return throwError(() => errors[i])
} else {
return of(value)
}
Expand Down
16 changes: 8 additions & 8 deletions packages/neo4j-driver/test/rx/nested-statements.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import { Notification, throwError } from 'rxjs'
import {
flatMap,
mergeMap,
materialize,
toArray,
concat,
map,
bufferCount,
catchError
catchError,
concatWith
} from 'rxjs/operators'
import neo4j from '../../src'
// eslint-disable-next-line no-unused-vars
Expand Down Expand Up @@ -65,23 +65,23 @@ describe('#integration-rx transaction', () => {
const messages = await session
.beginTransaction()
.pipe(
flatMap(txc =>
mergeMap(txc =>
txc
.run('UNWIND RANGE(1, $size) AS x RETURN x', { size })
.records()
.pipe(
map(r => r.get(0)),
bufferCount(50),
flatMap(x =>
mergeMap(x =>
txc
.run('UNWIND $x AS id CREATE (n:Node {id: id}) RETURN n.id', {
x
})
.records()
),
map(r => r.get(0)),
concat(txc.commit()),
catchError(err => txc.rollback().pipe(concat(throwError(err)))),
concatWith(txc.commit()),
catchError(err => txc.rollback().pipe(concatWith(throwError(() => err)))),
materialize(),
toArray()
)
Expand All @@ -105,7 +105,7 @@ describe('#integration-rx transaction', () => {
.pipe(
map(r => r.get(0)),
bufferCount(50),
flatMap(x =>
mergeMap(x =>
session
.run('UNWIND $x AS id CREATE (n:Node {id: id}) RETURN n.id', {
x
Expand Down
7 changes: 4 additions & 3 deletions packages/neo4j-driver/test/rx/session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { Notification, throwError } from 'rxjs'
import { map, materialize, toArray, concat } from 'rxjs/operators'
import { map, materialize, toArray, concatWith } from 'rxjs/operators'
import neo4j from '../../src'
import RxSession from '../../src/session-rx'
import sharedNeo4j from '../internal/shared-neo4j'
Expand Down Expand Up @@ -377,7 +377,7 @@ describe('#integration rx-session', () => {
.records()
.pipe(
map(r => r.get(0).toInt()),
concat(session.close())
concatWith(session.close())
)
.toPromise()
}
Expand All @@ -403,7 +403,8 @@ describe('#integration rx-session', () => {
}

if (this._reactiveFailuresIndex < this._reactiveFailures.length) {
return throwError(this._reactiveFailures[this._reactiveFailuresIndex++])
const i = this._reactiveFailuresIndex++
return throwError(() => this._reactiveFailures[i])
}

return txc
Expand Down
Loading