import { Request, Response } from 'express'; import { DyFM_Endpoint_SettingsBase, DyFM_HttpCallType } from '@futdevpro/fsm-dynamo'; import { DyNTS_RouteSecurity } from '../../_enums/route-security.enum'; /** * High level endpoint for API * used for specific events such as saving or getting data, * triggering events, logging in or out, and much more * * (You'll need to add them to a {@link DyNTS_Controller} through the {@link DyNTS_Controller.addEndpoint} method) * * @example * ```typescript * // Example from note-book controller implementation * new DyNTS_Endpoint_Params({ * name: 'getMyNoteBooks', * type: DyFM_HttpCallType.get, * endpoint: '/:userId/get-my', * preProcesses: [ authService.authenticate_tokenSelf ], * tasks: [ * async (req: Request, res: Response, issuer: string): Promise => { * const notes_DS = new NoteBook_DataService({ * issuer: issuer, * }); * * const notes = await notes_DS.getMyNoteBooks(req.params.userId); * res.send(notes); * }, * ], * }) * ``` */ export declare class DyNTS_Endpoint_Params = [], T_Body = undefined> extends DyFM_Endpoint_SettingsBase { security: DyNTS_RouteSecurity; private readonly pathParams; private readonly preProcesses; private readonly tasks; private readonly logRequest; private readonly logRequestsParams; private readonly logRequestsContent; private readonly logResponseContent; readonly stackLocation: string; private readonly autoResolveCirculation; constructor(set: { /** * naming the endpoint will help to follow events on service */ name: string; /** * security settings for API, different security paths will need different handlers * * open; http, secure; https or both */ security?: DyNTS_RouteSecurity; /** * define basic Http Call Type such as; get, post, put, patch, delete */ type: DyFM_HttpCallType; /** * set endpoint here, without baseUrl and route module path * * NOTE: the endpoint will already include the routing module's endpoint. * like: '/get-user/:userId' will be like: '/api/user/get-user/:userId' */ endpoint: string; /** * preProcesses are the functions you need to run before the actual function, * such as authentications */ preProcesses?: ((req: Request, res: Response) => Promise)[]; /** * the actual tasks to run, * the last one should contain the res.send(); execution to send response on API requests */ tasks: ((req: Request, res: Response, issuer: string) => Promise)[]; /** * log settings for request and response */ logRequest?: boolean; /** * log settings for request params */ logRequestsParams?: boolean; /** * log settings for request content */ logRequestsContent?: boolean; /** * log settings for response content */ logResponseContent?: boolean; /** * auto resolve circulation errors */ autoResolveCirculation?: boolean; }); /** * * @returns */ private preLog; /** * * @returns */ getFullExecution(): (req: Request, res: Response) => Promise; /** * * @param res * @param error */ private error; private multiLevelError; private getPathParamsLogContent; } //# sourceMappingURL=endpoint-params.control-model.d.ts.map