Skip to content

Commit 13ee734

Browse files
jescalada06kellyjackriswest
authored
refactor: service module to TS + ESM (v2) (#1166)
* refactor(ts): passport/activeDirectory * chore: add missing types * refactor(ts): JWT handler and utils * refactor(ts): passport/index * refactor(ts): passport/local * refactor(ts): passport/ldaphelper * refactor(ts): passport/oidc * refactor(ts): auth routes * refactor(ts): config routes * refactor(ts): misc routes and index * refactor(ts): push routes and update related types/db handlers * refactor(ts): repo routes * refactor(ts): user routes * refactor(ts): emailSender and missing implementation * refactor(ts): service/index and missing types * refactor(ts): urls * fix: failing tests due to incorrect imports * chore: update .eslintrc * chore: fix type checks * chore: fix CLI service imports * chore: run npm format * test: add basic oidc tests and ignore openid-client type error on import * test: increase testOidc and testPush coverage * test: improve push test coverage * test: add missing smtp tests * Update .eslintrc.json Co-authored-by: j-k <dev@j-k.io> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * Update src/db/file/users.ts Co-authored-by: j-k <dev@j-k.io> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * Update src/service/passport/jwtAuthHandler.ts Co-authored-by: j-k <dev@j-k.io> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * Update src/service/passport/index.ts Co-authored-by: j-k <dev@j-k.io> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * chore: fix service/index proxy type and npm run format * Update src/service/passport/jwtAuthHandler.ts Co-authored-by: j-k <dev@j-k.io> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * Update src/service/passport/jwtUtils.ts Co-authored-by: j-k <dev@j-k.io> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * chore: add getSessionStore helper for fs sink and fix types * chore: remove unnecessary casting for JWT verifiedPayload * chore: update getSessionStore call * chore: replace unused UserInfoResponse with imported version * chore: improve userEmail checks on push routes * chore: update packages * chore: add typing for thirdPartyApiConfig * chore: fix AD passport types * chore: replace AD type with activedirectory2 * chore: improve loginSuccessHandler * chore: fix PushQuery typing * chore: fix "any" in repo and users routes and fix failing tests * refactor: flatten push routes and fix typings * chore: add isAdminUser check to repo routes * test: improve push test checks for cancel endpoint * chore: fix createDefaultAdmin and isAdminUser functions * chore: fix thirdPartyApiConfig and AD type errors * chore: remove nodemailer and unused functionality This fixes the package bloat due to the nodemailer types library which relies on aws-sdk. It also fixes a license issue caused by an aws-sdk dependency. In the future, we should use a library other than nodemailer when we implement a working email sender. * chore: fix failing CLI test (email not unique) * chore: remove unused smtp config variables * Update src/service/routes/publicApi.ts Co-authored-by: Kris West <kristopher.west@natwest.com> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * chore: fix toPublicUser calls and typing * chore: update sample test src/service import * chore: fix type error on AuthenticationElement rename * chore: remove unused types file and references * Update src/service/passport/ldaphelper.ts Co-authored-by: Kris West <kristopher.west@natwest.com> Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> * chore: improve jwtAuthHandler checks * fix: remove gitAccount and fix authorise push route conflicts fix: return on /create-user fix: cast res,data to Boolean in ldaHelper * chore: remove unused reviewerGitAccount processing and fix getProxyUrl url processing * chore: fix type errors * fix: convert imports to ESM to fix CLI test failures * feat: add reviewer email to push authorise endpoint * chore: remove service parameter from testCliUtils start/stop calls * chore: add test-package/package-lock.json to .gitignore * Delete test/fixtures/test-package/package-lock.json --------- Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com> Co-authored-by: j-k <dev@j-k.io> Co-authored-by: Kris West <kristopher.west@natwest.com>
1 parent 0b64e7f commit 13ee734

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1613
-1262
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,6 @@ website/.docusaurus
269269

270270
# Jetbrains IDE
271271
.idea
272+
273+
# Generated from testing
274+
/test/fixtures/test-package/package-lock.json

package-lock.json

Lines changed: 116 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"lusca": "^1.7.0",
6969
"moment": "^2.30.1",
7070
"mongodb": "^5.9.2",
71-
"nodemailer": "^6.10.1",
7271
"openid-client": "^6.8.1",
7372
"parse-diff": "^0.11.1",
7473
"passport": "^0.7.0",
@@ -93,12 +92,20 @@
9392
"@eslint/compat": "^1.4.0",
9493
"@eslint/js": "^9.37.0",
9594
"@eslint/json": "^0.13.2",
95+
"@types/activedirectory2": "^1.2.6",
96+
"@types/cors": "^2.8.19",
9697
"@types/domutils": "^1.7.8",
9798
"@types/express": "^5.0.3",
9899
"@types/express-http-proxy": "^1.6.7",
100+
"@types/express-session": "^1.18.2",
101+
"@types/jsonwebtoken": "^9.0.10",
102+
"@types/jwk-to-pem": "^2.0.3",
99103
"@types/lodash": "^4.17.20",
104+
"@types/lusca": "^1.7.5",
100105
"@types/mocha": "^10.0.10",
101106
"@types/node": "^22.18.10",
107+
"@types/passport": "^1.0.17",
108+
"@types/passport-local": "^1.0.38",
102109
"@types/react-dom": "^17.0.26",
103110
"@types/react-html-parser": "^2.0.7",
104111
"@types/validator": "^13.15.3",

0 commit comments

Comments
 (0)