gypsum
Version:
Simple and easy lightweight typescript server side framework on Node.js.
61 lines (60 loc) • 1.79 kB
TypeScript
import * as Validall from 'validall';
import { CorsOptions } from 'cors';
import { RESPONSE_DOMAINS, API_TYPES } from '../types';
import { IHookOptions } from './hook';
export interface IValidateOptions {
query?: Validall.ISchema;
body?: Validall.ISchema;
user?: Validall.ISchema;
params?: Validall.ISchema;
}
export interface IService {
isService: boolean;
__name: string;
secure: any;
authorize: any;
args: string[];
name: string;
method: "get" | "post" | "put" | "delete" | "patch" | "options" | "head";
crud: "create" | "read" | "update" | "delete";
apiType: API_TYPES;
domain: RESPONSE_DOMAINS;
path: string;
event: string;
params: string[];
before: IHookOptions[];
after: IHookOptions[];
validate: IValidateOptions | {
$or: IValidateOptions[];
} | {
$and: IValidateOptions[];
} | {
$nor: IValidateOptions[];
} | {
$xor: IValidateOptions[];
};
cors: CorsOptions;
}
export interface IServiceOptions {
args?: string[];
secure?: any;
authorize?: any;
method?: "get" | "post" | "put" | "delete" | "patch" | "options" | "head";
crud?: "create" | "read" | "update" | "delete";
apiType?: API_TYPES;
domain?: RESPONSE_DOMAINS;
params?: string[];
before?: IHookOptions[];
after?: IHookOptions[];
validate?: IValidateOptions | {
$or: IValidateOptions[];
} | {
$and: IValidateOptions[];
} | {
$nor: IValidateOptions[];
} | {
$xor: IValidateOptions[];
};
cors?: CorsOptions;
}
export declare function SERVICE(options?: IServiceOptions): (target: any, key: string, descriptor: PropertyDescriptor) => void;