Skip to content

Commit

Permalink
Merge pull request #1983 from daveajrussell/bump-neo4j-driver-version
Browse files Browse the repository at this point in the history
Bump neo4j-driver to latest version, and update all requisite dependencies
  • Loading branch information
daveajrussell authored Oct 25, 2024
2 parents 8ea93d0 + 65c0906 commit 491bd1b
Show file tree
Hide file tree
Showing 11 changed files with 2,797 additions and 1,684 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-loss-of-precision": "warn",
"no-var": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "warn",
"react/no-unescaped-entities": "warn",
"react/no-unknown-property": "warn",
"react/prop-types": "error"
}
},
Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
"@types/styled-components": "^5.1.1",
"@types/uuid": "^8.3.0",
"@types/whatwg-url": "^8.2.1",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/parser": "^3.9.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"autoprefixer": "^7.1.4",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.2.4",
Expand All @@ -117,22 +117,22 @@
"cross-env": "^6.0.3",
"css-loader": "^1.0.0",
"cypress": "^8.3.1",
"eslint": "^7.7.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx": "^0.1.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2",
"express": "^4.15.4",
"file-loader": "^2.0.0",
"fork-ts-checker-notifier-webpack-plugin": "^3.0.0",
"fork-ts-checker-webpack-plugin": "^5.0.14",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^4.5.2",
"husky": "^0.14.3",
"jest": "^25.2.4",
"jest": "^26.6.3",
"jest-canvas-mock": "^1.1.0",
"js2xmlparser": "^3.0.0",
"json-loader": "^0.5.7",
Expand All @@ -146,18 +146,18 @@
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^3.0.2",
"precss": "^2.0.0",
"prettier-eslint": "^13.0.0",
"prettier-eslint-cli": "^5.0.0",
"prettier-eslint": "^16.3.0",
"prettier-eslint-cli": "^8.0.1",
"raf": "^3.4.0",
"raw-loader": "^0.5.1",
"react-hot-loader": "^4.13.0",
"react-refresh": "^0.11.0",
"react-test-renderer": "^17.0.2",
"redux-mock-store": "^1.2.3",
"style-loader": "^0.23.1",
"ts-jest": "^25.0.0",
"ts-jest": "^26.5.6",
"ts-loader": "^8.0.2",
"typescript": "^3.9.5",
"typescript": "^4.6.3",
"typescript-plugin-styled-components": "^1.5.0",
"url-loader": "^1.1.2",
"wait-on": "^3.1.0",
Expand Down Expand Up @@ -206,7 +206,8 @@
"memoize-one": "^5.2.1",
"monaco-editor": "0.23.0",
"neo4j-client-sso": "1.2.3",
"neo4j-driver": "5.9.2",
"neo4j-driver": "5.26.0",
"neo4j-driver-core": "5.26.0",
"re-resizable": "^6.9.9",
"react": "^17.0.2",
"react-dnd": "^11.1.3",
Expand Down
2 changes: 1 addition & 1 deletion src/neo4j-arc/common/types/cypherDataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export type CypherBasicPropertyType =
| number
| string
| Integer
| BigInt
| bigint
| Int8Array
| CypherTemporalType
| Point
Expand Down
2 changes: 1 addition & 1 deletion src/neo4j-arc/common/utils/objectUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export function mapObjectValues<A, B>(
)
}

export function keys<T>(object: T): Array<keyof T> {
export function keys<T extends {}>(object: T): Array<keyof T> {
return Object.keys(object) as Array<keyof T>
}
10 changes: 5 additions & 5 deletions src/shared/modules/commands/cypher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { version } from 'project-root/package.json'
import { flushPromises } from 'services/utils'

jest.mock('services/bolt/bolt', () => {
const orig = require.requireActual('services/bolt/bolt')
const orig = jest.requireActual('services/bolt/bolt')
return {
...orig,
routedWriteTransaction: jest.fn(() => [
Expand All @@ -39,26 +39,26 @@ jest.mock('services/bolt/bolt', () => {
])
}
})
const bolt = require.requireMock('services/bolt/bolt')
const bolt = jest.requireMock('services/bolt/bolt')

jest.mock('shared/modules/params/paramsDuck', () => {
const orig = require.requireActual('shared/modules/params/paramsDuck')
const orig = jest.requireActual('shared/modules/params/paramsDuck')
return {
...orig,
getParams: () => ({})
}
})

jest.mock('shared/modules/dbMeta/dbMetaDuck', () => {
const orig = require.requireActual('shared/modules/dbMeta/dbMetaDuck')
const orig = jest.requireActual('shared/modules/dbMeta/dbMetaDuck')
return {
...orig,
getRawVersion: () => '3.5.0' // support for tx metadata
}
})

jest.mock('shared/modules/settings/settingsDuck', () => {
const orig = require.requireActual('shared/modules/dbMeta/dbMetaDuck')
const orig = jest.requireActual('shared/modules/dbMeta/dbMetaDuck')
return {
...orig,
shouldUseReadTransactions: () => false
Expand Down
2 changes: 1 addition & 1 deletion src/shared/modules/commands/use-db-ww.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jest.mock('shared/modules/params/paramsDuck', () => {
})

jest.mock('shared/modules/settings/settingsDuck', () => {
const orig = require.requireActual('shared/modules/dbMeta/dbMetaDuck')
const orig = jest.requireActual('shared/modules/dbMeta/dbMetaDuck')
return {
...orig,
shouldUseReadTransactions: () => false
Expand Down
5 changes: 4 additions & 1 deletion src/shared/services/bolt/driverFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import neo4j, { AuthToken, Config, Driver } from 'neo4j-driver'

import { version } from 'project-root/package.json'
import { isError } from 'shared/utils/typeguards'

export const createDriverOrFailFn = (
url: string,
Expand All @@ -34,7 +35,9 @@ export const createDriverOrFailFn = (
const res = neo4j.driver(url, auth, spreadOpts)
return res
} catch (e) {
failFn(e)
if (isError(e)) {
failFn(e)
}
return null
}
}
7 changes: 5 additions & 2 deletions src/shared/services/bolt/globalDrivers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
toNonRoutingScheme
} from 'services/boltscheme.utils'
import { Connection } from 'shared/modules/connections/connectionsDuck'
import { isBrowserError, isError } from 'shared/utils/typeguards'

interface GlobalDriversObject {
getDirectDriver: () => Driver | null
Expand Down Expand Up @@ -64,8 +65,10 @@ export const buildGlobalDriversObject = async (
routed && (await routed.verifyConnectivity())
routingSupported = true
} catch (e) {
if (e && isNonSupportedRoutingSchemeError(e)) {
routingSupported = false
if (e && isError(e)) {
if (isBrowserError(e) && isNonSupportedRoutingSchemeError(e)) {
routingSupported = false
}
failFn(e)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/shared/services/commandInterpreterHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ import {
getCurrentDatabase,
isSystemOrCompositeDb
} from 'shared/utils/selectors'
import { isBrowserError } from 'shared/utils/typeguards'

const PLAY_FRAME_TYPES = ['play', 'play-remote']

Expand Down Expand Up @@ -264,7 +265,7 @@ const availableCommands = [
})
)
}
if (action.requestId) {
if (action.requestId && isBrowserError(error)) {
put(updateQueryResult(action.requestId, error, 'error'))
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/shared/utils/typeguards.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BrowserError } from 'services/exceptions'

export function isError(error: unknown): error is Error {
return error instanceof Error
}

export function isBrowserError(error: unknown): error is BrowserError {
return error instanceof Error && 'code' in error
}
Loading

0 comments on commit 491bd1b

Please sign in to comment.