import 'reflect-metadata'; import { Router } from 'express'; import Class from './features/orm/class'; import Query from './features/orm/query'; import User from './features/auth/user'; import Function from './features/functions/function'; import ClassManager from './features/orm/class-manager'; import FunctionManager from './features/functions/function-manager'; import { ServerConfigType } from './types/server'; import { ResponseFunctionsType } from './types/response'; import { ILogger } from './types/logger'; import ClassController from './controllers/class'; import FunctionController from './controllers/function'; import Collection from './utils/collection'; /** * @class Warp * @description Warp definition */ export default class Warp { private loggerInstance; private security; private classManager; private functionManager; private routerInstance; private responseInstance; private classController; private functionController; /** * Constructor * @param {Object} config */ constructor({ databaseURI, apiKey, masterKey, persistent, customResponse, restful, }: ServerConfigType); static readonly Class: typeof Class; static readonly User: typeof User; static readonly Query: typeof Query; /** * API Key */ readonly apiKey: string; /** * Master Key */ readonly masterKey: string; /** * Class operations */ readonly classes: ClassManager; /** * Function operations */ readonly functions: FunctionManager; /** * Logger */ readonly logger: ILogger; /** * Response format */ readonly response: ResponseFunctionsType; /** * Get controllers */ readonly controllers: Readonly<{ class: ClassController; function: FunctionController; }>; readonly _classController: ClassController; readonly _functionController: FunctionController; /** * Get express router */ readonly router: Router; /** * Set logger * @param customResponse */ private setLogger; /** * Set security configuration * @param {Object} config */ private setSecurity; /** * Set data mapper configuration * @param {Object} config */ private setClassManager; /** * Set action mapper configuration */ private setFunctionManager; /** * Set response format * @param customResponse */ private setResponse; /** * Set router * @param restful */ private setRouter; /** * Initialize the server and connect to the database */ initialize(): Promise; } /** * Export types */ export { ClassId, ClassOptions } from './types/class'; export { Request } from './types/request'; /** * Export features */ export { define } from './features/orm/class'; export { key } from './features/orm/keys/key'; export { hidden } from './features/orm/keys/modifiers/hidden'; export { guarded } from './features/orm/keys/modifiers/guarded'; export { length } from './features/orm/keys/modifiers/length'; export { min } from './features/orm/keys/modifiers/min'; export { max } from './features/orm/keys/modifiers/max'; export { between } from './features/orm/keys/modifiers/between'; export { rounded } from './features/orm/keys/modifiers/rounded'; export { enumerated } from './features/orm/keys/modifiers/enumerated'; export { beforeFind, beforeFirst, beforeGet, beforeSave, afterSave, beforeDestroy, afterDestroy, } from './features/orm/keys/modifiers/triggers'; /** * Export features */ export { Class, Query, Collection, User, Function, Warp, ClassManager, };