express-jwt-authz
express-jwt-authz copied to clipboard
Feature/migrate to typescript
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, andfailWithError. - 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
403error response or callnext(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.