import { dbConfig } from './config'; import mysqlConnect from './persistence/mysql'; import mongooseConnect from './persistence/mongoose'; import Joi from 'joi'; import { Config } from 'convict'; import { Server, ServerOptions, ServerRoute } from '@hapi/hapi'; import { SchemaBuilder } from 'knex'; import { Mongoose } from 'mongoose'; export declare const server: ({ dbConnect, schema, serverOptions, config, configOptions, configFiles, routes, services, plugins, postRegisterHook, swaggerOptions, loggerOptions, dockerized, intializers, }: CrudApiArgs) => Promise; declare const config: { mongo: { host: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; database: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; user: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; pass: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; }; env: { doc: string; format: string[]; default: string; env: string; }; dockerizedHostname: { doc: string; format: StringConstructor; default: string; env: string; }; server: { hostname: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; port: { doc: string; format: string; default: number; env: string; arg: string; }; tlsCert: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; tlsKey: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; tlsCa: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; secure: { doc: string; format: BooleanConstructor; default: boolean; env: string; arg: string; }; db: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; }; db: { dump: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; }; mysql: { host: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; database: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; user: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; pass: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; }; jwt: { secret: { doc: string; format: StringConstructor; default: string; env: string; arg: string; }; expires: { doc: string; format: NumberConstructor; default: number; env: string; arg: string; }; }; }; export { mysqlConnect, mongooseConnect, config, dbConfig }; export declare type DbClient = Promise | SchemaBuilder; interface Args { payload?: any; config?: Config; } export declare type CrudJson = (shema: object) => (payload: object) => string; interface LoggableArgs extends Args { log?: Function; json?: CrudJson; } export interface ServiceArgs extends LoggableArgs { db: Dict; } export interface RouteArgs extends LoggableArgs { services?: Dict; validate?: typeof Joi; } export declare type CrudServer = Server & { db?: DbClient; schema?: Dict; }; export interface QueryArgs extends Args { client: DbClient; } export interface Crud { create?(CrudArgs: any): Promise; findAll?(CrudArgs: any): Promise; findById?(CrudArgs: any): Promise; removeById?(CrudApiArgs: any): Promise; updateById?(CrudApiArgs: any): Promise; } export declare type Dict = { [k: string]: Crud; }; export declare type Schema = (client: DbClient) => Dict; export declare type Route = ({ services, config, validate }: RouteArgs) => ServerRoute; export declare type Service = (db: Dict) => Dict; export declare type Query = Crud; interface BaseArgs { services: Service; dbConnect(config: Config<{}>): DbClient; schema: Schema; serverOptions: ServerOptions; config: Config | object; routes(): Route[]; plugins: object[]; postRegisterHook?(app: any): Promise; swaggerOptions: object; loggerOptions: object; dockerized?: boolean; intializers?: ((app?: CrudServer, config?: Config) => Promise)[]; } export interface ServerArgs extends BaseArgs { config: Config; } export interface CrudApiArgs extends BaseArgs { configOptions: object; configFiles: Array; } //# sourceMappingURL=index.d.ts.map