import { type GlobOptionsWithoutFileTypes } from 'fs'; import * as doctrine from 'doctrine'; import * as acorn from 'acorn'; import Entitles from '../entities/index.js'; import { StandardException, type ExceptionInput } from '../exceptions/index.js'; export declare class AcornParsingException extends StandardException { } export declare class YamlParsingException extends StandardException { annotation: Partial; setAnnotation(annotation: Annotation): this; getAnnotation(): Partial; toString(): string; constructor(exceptionOrMsg: ExceptionInput); } export declare const MODEL_TO_FRAGMENT_TYPES_MAPPING: Record; export declare class Fragment { getTypes(): string[]; isPath(): boolean; isDefinition(): boolean; isUnknown(): boolean; isException(): boolean; setParentFragment(fragment: Fragment): this; getParentFragment(): Fragment | null; correctSwaggerPath(swaggerDoc?: object): object; toSwaggerDoc(exceptions?: Record): { paths: { [x: string]: { [x: string]: object; }; }; definitions?: undefined; } | { definitions: { [x: string]: object; }; paths?: undefined; } | { definitions?: undefined; paths?: undefined; } | { definitions: { [x: string]: { properties: { code: { type: string; format: string; }; message: { type: string; }; }; required: string[]; example: { code: number; message: string; }; }; }; paths: { [x: string]: { [x: string]: { responses: { [x: number]: { description: string; schema: { $ref: string; }; }; }; }; }; }; }; static exceptionMapping(exception: StandardException): { properties: { code: { type: string; format: string; }; message: { type: string; }; }; required: string[]; example: { code: number; message: string; }; }; static factory(jsdoc: doctrine.AnnotationTag, annotation: Annotation): Fragment; type: string; description: string; value: unknown; file: string; start: number; end: number; parent: Fragment | null; constructor({ type, description, value, file, start, end }: { type: string; description: string; value: unknown; file: string; start: number; end: number; }); } export declare class Annotation { getFragments(): Fragment[]; toString(): string; getYamlErrors(): YamlParsingException[]; value: string; file: string; start: number; end: number; yamlErrors: YamlParsingException[]; fragments: Fragment[] | null; constructor({ type, //Block value, //Long string file, //String start, end }: { type: string; value: string; file: string; start: number; end: number; }); } export declare class AnnotationsContainer { getFile(): string; hasAnnotations(): boolean; getAnnotations(): Annotation[]; collectFragments(): Fragment[]; collectYamlErrors(): YamlParsingException[]; file: string; annotations: Annotation[]; fragments: Fragment[]; constructor(file: string, acornComments: acorn.Comment[]); } type SwaggerLogger = { debug: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; error: (...args: unknown[]) => void; }; type ExceptionInterface = abstract new (...args: never[]) => object; type ModelAttributeLike = { type: { key: string; }; comment?: string | null; defaultValue?: unknown; allowNull?: boolean; }; type SwaggerModelProperty = { type: string; description?: string | null; default?: unknown; }; type SwaggerModelDefinition = { type: string; properties: Record; required?: string[]; }; interface ExSwaggerOptions { sourceRootPath: string; compileDistPath: string; models?: Entitles | null; modelBlacklist?: string[]; swaggerDocsTemplate?: Record; logger?: SwaggerLogger | null; swaggerUIPath?: string; swaggerDocsPath?: string; sourceFilesPath?: string | string[]; exceptionInterface?: ExceptionInterface; extraSourcePaths?: string[]; exceptionPaths?: string[]; } /** * A Swagger Json document generator * Generate document from * - JS source code annotations (Parser is Doctrine) * - ORM entities (Based on Sequelize) * - EvaEngine Exceptions */ export declare class ExSwagger { /** * Get file path array by glob */ static scanFiles(path: string, options?: GlobOptionsWithoutFileTypes): Promise; /** * Get annotations from comments * An annotation MUST start with double stars */ static filesToAnnotationsContainers(files: string[]): Promise; static modelToSwaggerDefinition(model: Record): SwaggerModelDefinition; static modelsToSwaggerDefinitions(models: Record, blacklist?: string[]): Map; static scanExceptions(path: string, exceptionInterface?: ExceptionInterface): Promise>; exportJson(dist?: string): Promise>; static mergeAll(_template: Record, fragments: Fragment[], exceptions: Record, modelDefinitions: Map): Record; getStates(): { swaggerTemplate: Record; modelBlacklist: string[]; sourceFilesPath: string[]; exceptionPaths: string[]; compileDistPath: string; swaggerUIPath: string; swaggerDocsPath: string; }; getSwaggerUIPath(): string; getSwaggerIndexHtml(): Promise; getCompileDistPath(): string; logger: SwaggerLogger; swaggerDocsTemplate: Record; models: Record | null; modelBlacklist: string[]; sourceFilesPath: string[]; exceptionPaths: string[]; exceptionInterface: ExceptionInterface; compileDistPath: string; swaggerUIPath: string; swaggerDocsPath: string; constructor({ sourceRootPath, compileDistPath, models, modelBlacklist, swaggerDocsTemplate, logger, swaggerUIPath, swaggerDocsPath, sourceFilesPath, exceptionInterface, extraSourcePaths, exceptionPaths }: ExSwaggerOptions); } export {};