SudoSOS Back-end API / internal/middleware
internal/middleware ​
This is the module page of the async-validator-middleware.
Classes ​
| Class | Description |
|---|---|
| AsyncValidatorMiddleware | Middleware that runs async (potentially DB-hitting) validation specs against the request body before passing to the handler. Runs after RequestValidatorMiddleware (structural Swagger check) and returns the same { valid, errors[] } shape on failure, ensuring a consistent 400 response regardless of which layer caught the error. |
| AsyncValidatorRegistry | - |
| PolicyMiddleware | This class is responsible for: - enforcing a given policy implementation as middleware. |
| RequestValidatorMiddleware | This class is responsible for: - validating request models as middleware. |
| RestrictionMiddleware | - |
| TokenMiddleware | This class is responsible for: - parsing JWT tokens in the request Authorization header. - validating parsed JWT tokens. - refreshing the JWT tokens in the request header allowing sliding expiration. |
Interfaces ​
| Interface | Description |
|---|---|
| MiddlewareOptions | The configuration options for the token middleware. |
| RequestWithToken | Extend the Express request interface with a token property, which will be filled by this middleware. |
| TokenRestrictions | - |
Type Aliases ​
| Type Alias | Description |
|---|---|
| SpecificationFactory | A factory function that returns a fresh Specification per call. This prevents ValidationError.join() from mutating shared trace instances across requests. |
Variables ​
| Variable | Description |
|---|---|
| globalAsyncValidatorRegistry | Global singleton registry instance shared across all controllers. |