Skip to content

Commit

Permalink
version bumps and code updates to support ts upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
daveajrussell committed Oct 23, 2024
1 parent 5fb7184 commit dd7f38d
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 83 deletions.
11 changes: 6 additions & 5 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": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"autoprefixer": "^7.1.4",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.2.4",
Expand Down Expand Up @@ -155,9 +155,9 @@
"react-test-renderer": "^17.0.2",
"redux-mock-store": "^1.2.3",
"style-loader": "^0.23.1",
"ts-jest": "^25.0.0",
"ts-jest": "^29.2.5",
"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.26.0",
"neo4j-driver": "5.25.0",
"neo4j-driver-core": "5.25.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/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>
}
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
}
}
6 changes: 5 additions & 1 deletion 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,11 @@ export const buildGlobalDriversObject = async (
routed && (await routed.verifyConnectivity())
routingSupported = true
} catch (e) {
if (e && isNonSupportedRoutingSchemeError(e)) {
if (e && isBrowserError(e) && isNonSupportedRoutingSchemeError(e)) {
routingSupported = false
}

if (isError(e)) {
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 && 'message' in error
}
Loading

0 comments on commit dd7f38d

Please sign in to comment.