UNPKG

jsm-core

Version:
60 lines (59 loc) 2.59 kB
/** * @description This file exports all the middlewares * @generator Jsm * @author dr. Salmi <reevosolutions@gmail.com> * @since 05-03-2024 06:54:22 */ declare const _default: { AUTH: { requireUser: (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => Promise<any>; userHasPermission: (permission: string | (string | string[])[]) => (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => Promise<any>; }; UPLOADING: { uploadMiddleware: import("multer").Multer; }; /** * @description Middleware to attach auth data to the request */ gateAttachAuthDataMiddleWare: ({ usersService, }: { usersService?: { getById: (id: string, config?: { [key: string]: any; }) => Promise<{ data: any; }>; internalAuthData: { [key: string]: any; }; }; }) => (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => Promise<any>; /** * @description Middleware to authenticate service */ authenticateService: (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => Promise<any>; /** * @description Middleware to handle JWT */ handleJWT: any; /** * @description Middleware to handle 404 errors */ endpointNotFoundHandler: () => (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => void; /** * @description Middleware to handle errors */ errorHandler: () => (err: Error | Jsm.Core.Utils.Api.Response.Error, req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => void; /** * @description Rate limiter middleware */ rateLimiter: (options: Partial<import("express-rate-limit").Options>) => import("express-rate-limit").RateLimitRequestHandler; /** * @description Secure Api with signature */ secureApiWithAppKeyMiddleware: (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => void; /** * @description Attach the calling service to req.attached_entities or apply the middleware if no service is found */ unlessFromService: (middleware: import("express").RequestHandler) => import("express").RequestHandler; }; export default _default;