///
import { FastifyInstance } from "fastify";
import { DataSource, EntityTarget, Repository } from "typeorm";
import { z } from "zod";
import * as http from 'http';
export interface IFastiFoxPlugin {
name: string;
register: (data: R) => void;
execute?: (data: E) => void;
}
export interface IFoxFlowRoutePluginConnector {
start: IFastiFoxPlugin[];
middle: IFastiFoxPlugin[];
end: IFastiFoxPlugin[];
}
export interface IUniqueRoute {
status?: boolean;
inputPlugins?: Array<(input: any) => Promise>;
outputPlugins?: Array<(input: any) => Promise>;
}
export interface IFastiFoxRoute {
name?: {
singular: string;
plural: string;
};
listOne?: {
schema?: z.ZodObject;
} & IUniqueRoute;
listMany?: {
schema?: z.ZodObject;
withPagination?: boolean;
findableFields?: string[];
} & IUniqueRoute;
create?: {
findableFields?: string[];
schema?: z.ZodObject;
} & IUniqueRoute;
update?: {
schema?: z.ZodObject;
} & IUniqueRoute;
delete?: {} & IUniqueRoute;
addRoute?: Array;
}
export declare enum RouteMethod {
GET = "GET",
POST = "POST",
PUT = "PUT",
PATCH = "PATCH",
DELETE = "DELETE"
}
export interface IRouteMaker extends IUniqueRoute {
name: string;
method: RouteMethod;
schema?: z.ZodObject;
withPagination?: boolean;
findableFields?: string[];
}
export interface IGenerateCrudRouteMaker {
routes: IRouteMaker[];
}
export interface IGenerateCrudInitialize {
route: IFastiFoxRoute;
}
export interface IPluginContructor {
server: FastifyInstance;
entity?: EntityTarget;
datasource: DataSource;
}
export interface IGenerateCrudContructor {
entity: EntityTarget;
route: IFastiFoxRoute;
}
export interface IGenerateCrudRoute {
route: IFastiFoxRoute;
}
export interface IGenerateCrudModule {
server: FastifyInstance;
datasource: DataSource;
}
export declare abstract class FastiFoxPlugin {
repository: Repository;
entity?: EntityTarget;
server: FastifyInstance;
constructor({ datasource, entity, server }: IPluginContructor);
}
export interface IFastiFoxModuleContructor {
server: FastifyInstance;
datasource: DataSource;
}