import { BaseControler } from '../controller'; import { DataSource, Model } from '../core'; import { EndpointNamingConvention } from '../utils/constant'; import { LOG_FORMATS, LOG_LEVELS } from '../utils/logger'; import { IQueryParseOptions } from './queryParser.types'; export * from './entitySchema.types'; export * from './model.types'; export * from './queryDecorator.types'; export * from './queryParser.types'; type Dialect = 'mysql' | 'postgres' | 'sqlite' | 'mariadb' | 'mssql' | 'db2' | 'snowflake' | 'oracle'; interface PoolOptions { max?: number; min?: number; idle?: number; acquire?: number; evict?: number; maxUses?: number; } interface IDbConfig { database: string; username: string; password: string; host: string; dialect: Dialect; port: number; pool: PoolOptions; schema: string; ssl?: boolean; models?: (typeof Model)[]; dialectOptions?: { ssl?: { require?: boolean; rejectUnauthorized?: boolean; }; }; } type IMethod = 'get' | 'post' | 'put' | 'delete'; interface IControllerConfig { endpoint?: string; allowedMethod?: IMethod[]; model: typeof Model; } interface IExpressRouterConfig { controllers: BaseControler[]; dataSource: DataSource; logger?: ILoggerOptions; queryOptions?: IQueryParseOptions; endpointNamingConvention?: EndpointNamingConvention; } interface IOpenRouterConfig { dataSource: DataSource; logger?: ILoggerOptions; queryOptions?: IQueryParseOptions; pathMapping: Record; } interface ILoggerOptions { enabled?: boolean; logLevel?: LOG_LEVELS | 'INFO' | 'ERROR' | 'WARN'; format?: LOG_FORMATS | 'JSON' | 'STRING'; advancedOptions?: IAdvancedLoggerOptions; } interface IAdvancedLoggerOptions { logSqlQuery?: boolean; logDbExecutionTime?: boolean; logDbQueryParameters?: boolean; } interface IQueryExecutionResponse { '@odata.count'?: number; '@odata.context': string; value: T[] | Record; meta: { queryExecutionTime?: number; totalExecutionTime?: number; }; } interface ODataMetadata { $Version: string; $EntityContainer: string; entities: Record; functions?: Record; metadata: ODataMetadataInfo; } interface ODataEntityType { $Kind: 'EntityType'; $Key: string[]; $Endpoint: string; [propertyName: string]: ODataProperty | ODataNavigationProperty | string | string[]; } interface ODataProperty { $Kind: 'Property'; $Type: string; $Nullable: boolean; $DefaultValue?: unknown; $AutoIncrement?: boolean; } interface ODataNavigationProperty { $Kind: 'NavigationProperty'; $Type: string; $ReferentialConstraint?: Record; } interface ODataFunction { $Kind: 'QueryModel'; resultModel: string; $Endpoint: string; properties: Record; } interface ODataFunctionProperty { $Type: string; $Nullable?: boolean; } interface ODataMetadataInfo { title: string; baseUrl?: string; generatedAt: string; format: string; $Endpoint: string; } interface ControllerEndpointInfo { modelName: string; endpoint: string; isQueryModel: boolean; queryMethods?: QueryMethodEndpointInfo[]; } interface QueryMethodEndpointInfo { methodName: string; endpoint: string; httpMethod: string; } interface QueryControllerEvent { path: string; basepath: string; queryParams: Record; } type CustomControllerEvent = QueryControllerEvent; export { ControllerEndpointInfo, CustomControllerEvent, Dialect, IAdvancedLoggerOptions, IControllerConfig, IDbConfig, IExpressRouterConfig, ILoggerOptions, IMethod, IOpenRouterConfig, IQueryExecutionResponse, ODataEntityType, ODataFunction, ODataFunctionProperty, ODataMetadata, ODataMetadataInfo, ODataNavigationProperty, ODataProperty, PoolOptions, QueryControllerEvent, QueryMethodEndpointInfo, };