export = Clearer; /** * @exports Clearer * @class Clearer * @author 7kasper * @classdesc * Utility class to 'clear' a route before its function gets executed. * Clearing entails that permissions are checked, parameters are verified * by the checks and pre-checks inside the route-definition and also * that the parameters are sanitised and formatted also according to * the route definition. All these checks are in this clearing-class * splitted into a few methods. */ declare class Clearer { /** * Verifies all non-parameter specific permissions * and compiles a list of all not-yet-checked * parameter specific permissions. * The parameter specific permissions ought to be checked * after the parameters have been checked and sanitiz * @param {string[]} requiredPermissions * @param {PermissionSet} clientPermissions */ static clearPermissions(requiredPermissions: string[], clientPermissions: PermissionSet): Promise>; /** * Verifies the client has all permissions. * The parameters in the permission list are replaced with values * of the parameters present. * This is usually a list of parameters generated by the function * `clearPermissions();` * @param {string[]} paramPermissions - a list of permissions required to execute the function. * @param {PermissionSet} clientPermissions - the permissions the client has. * @param {Object.} params - a map of paramnames and the values belonging to them. */ static clearParamPermissions(paramPermissions: string[], clientPermissions: PermissionSet, params: { [x: string]: any; }): Promise; /** * Verifies and sanitises all params. * @param {Object.} paramdefs - a map of paramnames and their param definitions. * @param {Object.} params - a map of paramnames and the values belonging to them. * @returns params, formatted and well. * @throws an error upon failed param check or format. */ static clearParams(paramdefs: { [x: string]: import("../routes/Route").ParamDef; }, params: { [x: string]: any; }): Promise<{ [x: string]: any; }>; /** * Verifies and sanitises a param. * @param {ParamDef} paramdef * @param {Object} param * @param {string} paramname */ static clearParam(paramdef: ParamDef, param: any, paramname: string): any; /** * Check can fail by using throw, or returning false. * @param {ParamCheck[]} checks - a list of parameter checks to run on this parameter. * @param {Object} param - the actual value of the param to be checked. * @param {string} checktype - mainly used to distinguish `Check`s * from `Pre-Check`s. This is used for the standard rejection messages * if a simple false is returned in the ParamCheck. */ static checkParam(checks: ParamCheck[], param: any, paramname: any, checktype?: string): void; /** * Format can fail by using throw. * Param is always altered to return value. * @param {ParamFormatter[]} formatters - a list of formatters to apply to this parameter. * @param {Object} param - the value of the actual parameter to be formatted. * @returns param, formatted and well. */ static formatParam(formatters: ParamFormatter[], param: any, paramname: any): any; } declare namespace Clearer { export { PermissionSet, ParamDef, ParamCheck, ParamFormatter }; } type PermissionSet = import("../util/PermissionSet"); type ParamDef = import("../routes/Route").ParamDef; type ParamCheck = import("../routes/Route").ParamCheck; type ParamFormatter = import("../routes/Route").ParamFormatter;