UNPKG

@vulcan-sql/core

Version:
86 lines (85 loc) 2.13 kB
import { Constraint } from '../lib/validators/constraints'; import 'reflect-metadata'; import { Request as KoaRequest } from 'koa'; import { IncomingHttpHeaders } from 'http'; export type { KoaRequest }; export type { IncomingHttpHeaders }; export declare enum PaginationMode { CURSOR = "CURSOR", OFFSET = "OFFSET", KEYSET = "KEYSET" } export declare enum FieldInType { QUERY = "QUERY", HEADER = "HEADER", PATH = "PATH" } export declare enum FieldDataType { BOOLEAN = "BOOLEAN", NUMBER = "NUMBER", STRING = "STRING" } export declare class ValidatorDefinition<T = any> { name: string; args: T; } export declare class RequestSchema { fieldName: string; fieldIn: FieldInType; description: string; type: FieldDataType; validators: Array<ValidatorDefinition>; constraints: Array<Constraint>; } export declare class ResponseProperty { name: string; description?: string; type: FieldDataType | Array<ResponseProperty>; required?: boolean; } export declare class PaginationSchema { mode: PaginationMode; keyName?: string; } export declare class ErrorInfo { code: string; message: string; } export declare class Sample { profile: string; parameters: Record<string, any>; req?: KoaRequest; } export declare class RefreshTime { every: string; } export declare class RefreshExpression { expression: string; every: string; } export declare class CacheLayerInfo { cacheTableName: string; profile: string; sql: string; refreshTime?: RefreshTime; refreshExpression?: RefreshExpression; indexes?: Record<string, string>; folderSubpath?: string; options?: any; } export declare class APISchema { operationName: string; urlPath: string; templateSource: string; request: Array<RequestSchema>; errors: Array<ErrorInfo>; response: Array<ResponseProperty>; description?: string; pagination?: PaginationSchema; sample?: Sample; profiles: Array<string>; cache: Array<CacheLayerInfo>; } export declare class BuiltArtifact { schemas: Array<APISchema>; }