///
import http = require("http");
import http2 = require("http2");
import fastify = require("fastify");
import { FastifyRequest, FastifyReply } from "fastify";
import Bookshelf = require("bookshelf");
export declare type FastifyInstance = fastify.FastifyInstance;
export declare type HttpServer = http.Server | http2.Http2Server;
export declare type HttpRequest = http.IncomingMessage | http2.Http2ServerRequest;
export declare type HttpResponse = http.ServerResponse | http2.Http2ServerResponse;
export declare type Middleware = (request?: FastifyRequest, reply?: FastifyReply) => Promise;
export interface IController {
path: string;
handler: PluginHandler;
}
export declare type PluginHandler = fastify.Plugin;
export interface IPlugin {
handler: PluginHandler;
options?: any;
}
export interface IModule {
name: string;
controllers: IController[];
repositories: IRepository[];
middlewares?: Middleware[];
plugins?: IPlugin[];
}
export interface BootstrapOptions {
modules: IModule[];
}
export interface IExtendedModel extends Partial> {
findAll: Middleware;
findById: Middleware;
upsert: Middleware;
remove: Middleware;
recover: Middleware;
forge(props?: any, options?: any): any;
watch(options: any): any;
watchAll(options: any): any;
}
export interface IRepository {
name: string;
path: string;
model: IExtendedModel;
controller: IController;
websocket: boolean;
makeCrud(name: string, options: any): void;
makeReactive(name: string): void;
}