express-jwt-authz icon indicating copy to clipboard operation
express-jwt-authz copied to clipboard

Feature/migrate to typescript

Open DanOnCall opened this issue 8 months ago • 3 comments

Please see the Changelog.md file for an outline of the changes this PR introduces. In summary:

  • Migrate to TypeScript.
  • Add support for Express v5.x.x.
  • Improve testing.
  • Align API with express-jwt.
  • Bump version to 3.0.0.

Testing Done

The existing test suite was migrated to TypeScript and expanded to validate all new and existing functionality. All tests pass successfully.

The testing strategy includes:

  • Full API Coverage: Validated all public functions and configuration options, including checkAllScopes, customUserKey, customScopeKey, and failWithError.
  • Authorization Logic: Confirmed correct handling of "any" vs. "all" scope checks, for both string-based and array-based scope claims in the JWT.
  • Robust Error Handling: Ensured that all documented error scenarios—such as insufficient scope, malformed JWT payloads, or invalid scope formats—produce the correct 403 error response or call next(err) as expected.
  • Express Compatibility: The full test suite was executed against both Express v4 and Express v5 to guarantee compatibility.
  • Static Type-Checking: The entire project, including tests, now passes strict TypeScript validation, ensuring the new type definitions are accurate and effective.

This ensures the v3.0.0 release is robust, type-safe, and backward-compatible with supported Express versions.

DanOnCall avatar Apr 28 '25 21:04 DanOnCall