/// /// import * as http from "http"; import * as http2 from "http2"; import { FastifyRequest, FastifyReply, Plugin } from "fastify"; import { Observable } from "rxjs"; import * as Knex from "knex"; import * as Bookshelf from "bookshelf"; 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 = Plugin; export interface IPlugin { handler: PluginHandler; options?: any; } export interface IMigration { up: (knex: Knex) => Knex.SchemaBuilder; down: (knex: Knex) => Knex.SchemaBuilder; } export interface ISeed { seed: (knex: Knex) => Promise; } export interface IModule { name: string; controllers: IController[]; repositories: IRepository[]; migrationsPath: string; seedsPath: string; } export interface IBootstrapOptions { modules: IModule[]; port?: string; withDefault?: boolean; withAuth?: boolean; fullstack?: boolean; rest?: boolean; sse?: boolean; batch?: boolean; serverOptions?: any; prefix?: string; plugins?: IPlugin[]; } export interface IExtendedModel extends Partial> { findAll: (...args) => Promise; findById: (...args) => Promise; upsert: (...args) => Promise; remove: (...args) => Promise; recover: (...args) => Promise; forge(props?: any, options?: any): any; watch(opts?: any): Observable; watchAll(opts?: any): Observable; } export interface IRepositoryOptions { fetch?: any; listenTo?: any; disable?: Array<"findAll" | "findById" | "upsert" | "remove" | "recover">; sse?: boolean; rest?: boolean; } export interface IRepository { name: string; path: string; model: IExtendedModel; controller: IController; sseController: IController; options?: IRepositoryOptions; makeCrud: () => void; makeReactive: () => void; setupRestController: () => void; setupSseController: () => void; }