diff --git a/packages/hawtio/jest.config.ts b/packages/hawtio/jest.config.ts index d9d79a75..a38e5b72 100644 --- a/packages/hawtio/jest.config.ts +++ b/packages/hawtio/jest.config.ts @@ -15,6 +15,7 @@ const config: Config = { '\\.(css|less)$': '/src/__mocks__/styleMock.js', '@hawtiosrc/(.*)': '/src/$1', 'react-markdown': '/../../node_modules/react-markdown/react-markdown.min.js', + 'keycloak-js': path.resolve(__dirname, './src/__mocks__/keycloak.js'), 'monaco-editor': path.resolve(__dirname, './src/__mocks__/monacoEditor.js'), '@monaco-editor/react': path.resolve(__dirname, './src/__mocks__/monacoEditor.js'), '@patternfly/react-code-editor': path.resolve(__dirname, './src/__mocks__/codeEditorMock.js'), diff --git a/packages/hawtio/package.json b/packages/hawtio/package.json index 67d16abd..dd380b74 100644 --- a/packages/hawtio/package.json +++ b/packages/hawtio/package.json @@ -61,7 +61,7 @@ "jquery": "^3.7.1", "js-logger": "^1.6.1", "jwt-decode": "^4.0.0", - "keycloak-js": "^23.0.7", + "keycloak-js": "^26.0.6", "monaco-editor": "^0.52.0", "oauth4webapi": "^2.17.0", "react": "^18.3.1", diff --git a/packages/hawtio/src/__mocks__/keycloak.js b/packages/hawtio/src/__mocks__/keycloak.js new file mode 100644 index 00000000..c3769a17 --- /dev/null +++ b/packages/hawtio/src/__mocks__/keycloak.js @@ -0,0 +1,3 @@ +module.exports = { + Keycloak: () => {}, +} diff --git a/packages/hawtio/src/plugins/auth/keycloak/keycloak-service.ts b/packages/hawtio/src/plugins/auth/keycloak/keycloak-service.ts index 0b451cb8..37eaff23 100644 --- a/packages/hawtio/src/plugins/auth/keycloak/keycloak-service.ts +++ b/packages/hawtio/src/plugins/auth/keycloak/keycloak-service.ts @@ -242,7 +242,7 @@ class KeycloakService implements IKeycloakService { keycloak .updateToken(KEYCLOAK_TOKEN_MINIMUM_VALIDITY) - .then(refreshed => { + .then((refreshed: boolean) => { if (refreshed) { const token = keycloak.token if (token) { @@ -252,7 +252,7 @@ class KeycloakService implements IKeycloakService { log.debug('Token is still valid') } }) - .catch(reason => { + .catch((reason: Error) => { log.error("Couldn't update token:", reason) errorFn?.() }) diff --git a/packages/hawtio/tsconfig.json b/packages/hawtio/tsconfig.json index 1440b66c..63068776 100644 --- a/packages/hawtio/tsconfig.json +++ b/packages/hawtio/tsconfig.json @@ -16,7 +16,7 @@ "noImplicitThis": true, "noUncheckedIndexedAccess": true, "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, diff --git a/yarn.lock b/yarn.lock index 2f48b289..a23ae45f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2051,7 +2051,7 @@ __metadata: jquery: "npm:^3.7.1" js-logger: "npm:^1.6.1" jwt-decode: "npm:^4.0.0" - keycloak-js: "npm:^23.0.7" + keycloak-js: "npm:^26.0.6" monaco-editor: "npm:^0.52.0" oauth4webapi: "npm:^2.17.0" react: "npm:^18.3.1" @@ -5169,7 +5169,7 @@ __metadata: languageName: node linkType: hard -"base64-js@npm:^1.3.1, base64-js@npm:^1.5.1": +"base64-js@npm:^1.3.1": version: 1.5.1 resolution: "base64-js@npm:1.5.1" checksum: 10/669632eb3745404c2f822a18fc3a0122d2f9a7a13f7fb8b5823ee19d1d2ff9ee5b52c53367176ea4ad093c332fd5ab4bd0ebae5a8e27917a4105a4cfc86b1005 @@ -10238,13 +10238,6 @@ __metadata: languageName: node linkType: hard -"js-sha256@npm:^0.10.1": - version: 0.10.1 - resolution: "js-sha256@npm:0.10.1" - checksum: 10/6bae235dd458744e573876cc0875e21ea18a84e3aec4ba82d0efdb28537366e225304d93072789883500ca995fcc7c4500528c66d02da88cc5d6ab4554ce2b8c - languageName: node - linkType: hard - "js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" @@ -10465,14 +10458,10 @@ __metadata: languageName: node linkType: hard -"keycloak-js@npm:^23.0.7": - version: 23.0.7 - resolution: "keycloak-js@npm:23.0.7" - dependencies: - base64-js: "npm:^1.5.1" - js-sha256: "npm:^0.10.1" - jwt-decode: "npm:^4.0.0" - checksum: 10/61c127a9ac4954d1d0f7f1eee2348043322e21ec956f1ac7819bced39ce1360470cbbb5bd6f81ac1ee59a6fecc1cc5c2667f4e4f249c9c9b86a747a3654efb97 +"keycloak-js@npm:^26.0.6": + version: 26.0.6 + resolution: "keycloak-js@npm:26.0.6" + checksum: 10/f4cd1a46f379f38bd426076ab40625602226d8fc8565857d44d97bd408a2604864e567e129526ffe9a4be3bab2955d496aa5f09cda9c59e7eaf5e65eb95de197 languageName: node linkType: hard