import express from 'express'; import { AuthMetadataMiddlewareFunction, PostRequestMiddlewareFunction, PreRequestMiddlewareFunction } from '../../middleware'; import { Response, ResponseBody } from './response'; export declare const USER_TOKEN_KEY = "userToken"; export declare type FunctionRequestType any> = Parameters[0]; export declare type FunctionCallback = (req: BodyType, res: Response, data: MetadataType) => Promise; export declare type CachedResponse = { code: number; body?: ResponseBody; }; export interface EndpointOptions { /** * If present and true, applies all auth middleware to the endpoint and supplies * the resulting metadata into each function. */ auth?: boolean; /** * If present and true, applies all secret auth middleware to the endpoint and supplies * the resulting metadata into each function. Usually used for admin authentication, * where the metadata should not be persisted. */ secretAuth?: boolean; /** * If present, caches request/response pairs for the given duration. */ cacheMs?: number; /** * If present, ignores all props in this list during caching. Useful when auth is required * but the resulting data is not specific to a given user. */ cacheIgnoreProps?: string[]; } export declare class Route { private router; private baseEndpoint; private cache; private preRequestMiddleware; private postRequestMiddleware; private authMetadataMiddleware; private secretAuthMiddleware; constructor(baseEndpoint: string); getRouter: () => express.Router; getBaseEndpoint: () => string; function: any>(endpoint: string, options: EndpointOptions, callback: FunctionCallback, MetadataType>) => void; setAuthMiddleware: (...middleware: AuthMetadataMiddlewareFunction[]) => void; setSecretMiddleware: (...middleware: AuthMetadataMiddlewareFunction[]) => void; setPreRequestMiddleware: (...middleware: PreRequestMiddlewareFunction[]) => void; setPostRequestMiddleware: (...middleware: PostRequestMiddlewareFunction[]) => void; private getEndpointRequestKey; }