@creamapi/cream
Version:
Concise REST API Maker - An extension library for express to create REST APIs faster
32 lines (31 loc) • 1.59 kB
TypeScript
import { ParameterProp } from '../ExpressAdapter/ParameterProp';
/**
* @internal
* This class is used to define parameter prop for middleware data
* This is used to map parameters to the data in a middleware collection
*/
export declare class MiddlewareParameterProp extends ParameterProp {
readonly collection: string;
/**
* @param index the index of the parameter in the parameter call array
* @param name The name of the parameter in the data collection
* @param collection The collection that the data should be retrieved from
*
* @remarks The data is accessed like collection[name]
*/
constructor(index: number, name: string, collection: string);
}
/**
* @internal
* a type for easily defining arrays
*/
export type MiddlewareParameterProps = MiddlewareParameterProp[];
/**
* This decorator factory is used to declare that a parameter of a method should be filled <br>
* from the collection `collectionName`. The parameter will be filled either with the data or <br>
* undefined if the data is not found in the collection or the collection is not found in the map
* @param collectionName The collection the data should be retrieved from. The default collection name is 'default'
* @param dataName the name of the field in the collection. To retrieve the entire collection the string "*" is used.
* @returns the decorator that will effectively decorate the method
*/
export declare function MiddlewareData(collectionName?: string, dataName?: string): (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;