typenexus
Version:
TypeNexus is a good tool for API encapsulation and management. It provides a clean and lightweight way to package TypeORM functionality, helping you build applications faster while reducing template code redundancy and type conversion work.
130 lines (129 loc) • 3.62 kB
TypeScript
import { ActionType } from './types/ActionType.js';
import { ControllerMetadata } from './ControllerMetadata.js';
import { ActionMetadataArgs } from './args/ActionMetadataArgs.js';
import { ResponseHandlerMetadata } from './ResponseHandleMetadata.js';
import { Action } from '../Action.js';
import { ParamMetadata } from './ParamMetadata.js';
import { ParamConstructorMetadata } from './ParamConstructorMetadata.js';
import { UseMetadata } from './UseMetadata.js';
import { TypeNexusOptions } from '../DriverOptions.js';
/**
* Action metadata.
*/
export declare class ActionMetadata {
private globalOptions;
/**
* Action's controller.
*/
controllerMetadata: ControllerMetadata;
/**
* Class on which's method this action is attached.
*/
target: Function;
/**
* Object's method that will be executed on this action.
*/
method: string;
/**
* Route to be registered for the action.
*/
route: string | RegExp;
/**
* Indicates if this action uses Body.
*/
isBodyUsed: boolean;
/**
* Indicates if this action uses Uploaded File.
*/
isFileUsed: boolean;
/**
* Indicates if this action uses Uploaded Files.
*/
isFilesUsed: boolean;
/**
* Extra options used by @Body decorator.
*/
bodyExtraOptions: any;
/**
* Action type represents http method used for the registered route. Can be one of the value defined in ActionTypes
* class.
*/
type: ActionType;
/**
* Action's parameters.
*/
params: ParamMetadata[];
/**
* Action's constructor parameters.
*/
paramsConstructor: ParamConstructorMetadata[];
/**
* Full route to this action (includes controller base route).
*/
fullRoute: string | RegExp;
/**
* Indicates if this action uses Authorized decorator.
*/
isAuthorizedUsed: boolean;
/**
* Roles set by @Authorized decorator.
*/
authorizedRoles: any[];
/**
* Indicates if controller of this action is json-typed.
*/
isJsonTyped: boolean;
/**
* Action's use metadatas.
*/
uses: UseMetadata[];
/**
* Http code to be used on undefined action returned content.
*/
undefinedResultCode: number | Function;
/**
* Http code to be used on null action returned content.
*/
nullResultCode: number | Function;
/**
* Http code to be set on successful response.
*/
successHttpCode: number;
/**
* Specifies redirection url for this action.
*/
redirect: string;
/**
* Rendered template to be used for this controller action.
*/
renderedTemplate: string;
/**
* Response headers to be set.
*/
headers: {
[name: string]: any;
};
constructor(controllerMetadata: ControllerMetadata, args: ActionMetadataArgs, globalOptions: TypeNexusOptions);
/**
* Builds everything action metadata needs.
* Action metadata can be used only after its build.
*/
build(responseHandlers: ResponseHandlerMetadata[]): void;
/**
* Appends base route to a given regexp route.
*/
static appendBaseRoute(baseRoute: string, route: RegExp | string): string | RegExp;
/**
* Builds full action route.
*/
private buildFullRoute;
/**
* Calls action method.
* Action method is an action defined in a user controller.
*/
callMethod(params: any[], paramsConstructor: any[], action: Action): any;
/**
* Builds action response headers.
*/
private buildHeaders;
}