Skip to content

Commit dd7f38d

Browse files
committed
version bumps and code updates to support ts upgrade
1 parent 5fb7184 commit dd7f38d

File tree

7 files changed

+224
-83
lines changed

7 files changed

+224
-83
lines changed

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
"@types/styled-components": "^5.1.1",
103103
"@types/uuid": "^8.3.0",
104104
"@types/whatwg-url": "^8.2.1",
105-
"@typescript-eslint/eslint-plugin": "^3.9.0",
106-
"@typescript-eslint/parser": "^3.9.0",
105+
"@typescript-eslint/eslint-plugin": "^8.11.0",
106+
"@typescript-eslint/parser": "^8.11.0",
107107
"autoprefixer": "^7.1.4",
108108
"babel-eslint": "^10.0.3",
109109
"babel-jest": "^25.2.4",
@@ -155,9 +155,9 @@
155155
"react-test-renderer": "^17.0.2",
156156
"redux-mock-store": "^1.2.3",
157157
"style-loader": "^0.23.1",
158-
"ts-jest": "^25.0.0",
158+
"ts-jest": "^29.2.5",
159159
"ts-loader": "^8.0.2",
160-
"typescript": "^3.9.5",
160+
"typescript": "^4.6.3",
161161
"typescript-plugin-styled-components": "^1.5.0",
162162
"url-loader": "^1.1.2",
163163
"wait-on": "^3.1.0",
@@ -206,7 +206,8 @@
206206
"memoize-one": "^5.2.1",
207207
"monaco-editor": "0.23.0",
208208
"neo4j-client-sso": "1.2.3",
209-
"neo4j-driver": "5.26.0",
209+
"neo4j-driver": "5.25.0",
210+
"neo4j-driver-core": "5.25.0",
210211
"re-resizable": "^6.9.9",
211212
"react": "^17.0.2",
212213
"react-dnd": "^11.1.3",

src/neo4j-arc/common/utils/objectUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ export function mapObjectValues<A, B>(
4040
)
4141
}
4242

43-
export function keys<T>(object: T): Array<keyof T> {
43+
export function keys<T extends {}>(object: T): Array<keyof T> {
4444
return Object.keys(object) as Array<keyof T>
4545
}

src/shared/services/bolt/driverFactory.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import neo4j, { AuthToken, Config, Driver } from 'neo4j-driver'
2121

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

2425
export const createDriverOrFailFn = (
2526
url: string,
@@ -34,7 +35,9 @@ export const createDriverOrFailFn = (
3435
const res = neo4j.driver(url, auth, spreadOpts)
3536
return res
3637
} catch (e) {
37-
failFn(e)
38+
if (isError(e)) {
39+
failFn(e)
40+
}
3841
return null
3942
}
4043
}

src/shared/services/bolt/globalDrivers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
toNonRoutingScheme
2828
} from 'services/boltscheme.utils'
2929
import { Connection } from 'shared/modules/connections/connectionsDuck'
30+
import { isBrowserError, isError } from 'shared/utils/typeguards'
3031

3132
interface GlobalDriversObject {
3233
getDirectDriver: () => Driver | null
@@ -64,8 +65,11 @@ export const buildGlobalDriversObject = async (
6465
routed && (await routed.verifyConnectivity())
6566
routingSupported = true
6667
} catch (e) {
67-
if (e && isNonSupportedRoutingSchemeError(e)) {
68+
if (e && isBrowserError(e) && isNonSupportedRoutingSchemeError(e)) {
6869
routingSupported = false
70+
}
71+
72+
if (isError(e)) {
6973
failFn(e)
7074
}
7175
}

src/shared/services/commandInterpreterHelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ import {
110110
getCurrentDatabase,
111111
isSystemOrCompositeDb
112112
} from 'shared/utils/selectors'
113+
import { isBrowserError } from 'shared/utils/typeguards'
113114

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

@@ -264,7 +265,7 @@ const availableCommands = [
264265
})
265266
)
266267
}
267-
if (action.requestId) {
268+
if (action.requestId && isBrowserError(error)) {
268269
put(updateQueryResult(action.requestId, error, 'error'))
269270
}
270271
}

src/shared/utils/typeguards.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { BrowserError } from 'services/exceptions'
2+
3+
export function isError(error: unknown): error is Error {
4+
return error instanceof Error
5+
}
6+
7+
export function isBrowserError(error: unknown): error is BrowserError {
8+
return error instanceof Error && 'code' in error && 'message' in error
9+
}

0 commit comments

Comments
 (0)