import type { OpenAPIObject } from 'openapi3-ts/oas31'; import type { HttpMethod, VovkSchemaIdEnum } from './enums.js'; import type { VovkOperationObject } from './operation.js'; import type { PackageJson } from './package.js'; import type { KnownAny, RequireFields } from './utils.js'; export type VovkPackageJson = PackageJson & { rs_name?: string; py_name?: string; }; export type VovkReadmeConfig = { banner?: string; installCommand?: string; description?: string; }; export type VovkSamplesConfig = { apiRoot?: string; headers?: Record; }; type IncludeExcludeSegments = { excludeSegments?: never; includeSegments?: string[]; } | { excludeSegments?: string[]; includeSegments?: never; }; type ClientConfigCommon = { enabled?: boolean; outDir?: string; fromTemplates?: string[]; prettifyClient?: boolean; outputConfig?: VovkOutputConfig; } & IncludeExcludeSegments; type ClientConfigComposed = ClientConfigCommon; type ClientConfigSegmented = ClientConfigCommon; export type VovkBundleConfig = { requires?: Record; prebundleOutDir?: string; keepPrebundleDir?: boolean; outDir?: string; build: (options: { outDir: string; prebundleDir: string; entry: string; }) => Promise; outputConfig?: VovkOutputConfig; } & IncludeExcludeSegments; type GeneratorConfigImports = { fetcher?: string; validateOnClient?: string | null; createRPC?: string; }; type SegmentConfigImports = { fetcher?: string; validateOnClient?: string | null; }; export interface VovkOutputConfig { origin?: string | null; package?: VovkPackageJson; readme?: VovkReadmeConfig; samples?: VovkSamplesConfig; openAPIObject?: Partial; reExports?: Record; imports?: TImports; } export type ClientTemplateDef = { extends?: string; templatePath?: string | null; composedClient?: Omit; segmentedClient?: Omit; requires?: Record; outputConfig?: VovkOutputConfig; }; export type GetOpenAPINameFn = (config: { operationObject: VovkOperationObject; method: HttpMethod; path: string; openAPIObject: OpenAPIObject; }) => string; export interface VovkOpenAPIMixin { source: { file: string; } | { url: string; fallback?: string; } | { object: OpenAPIObject; }; apiRoot?: string; getModuleName?: (string & {}) | 'api' | GetOpenAPINameFn; getMethodName?: 'camel-case-operation-id' | 'auto' | GetOpenAPINameFn; /** * Keep only operations the predicate returns `true` for; omitted = keep all. Runs before * `getModuleName`/`getMethodName`, so a module whose operations are all filtered out is never created. */ filterOperations?: (config: Parameters[0]) => boolean; /** * Prune `meta.openAPIObject.components.schemas` to the `$ref` closure of kept operations (shrinks big * specs); removes unreferenced `Mixins.*` types, keep `false` (default) if you import those directly. */ pruneComponents?: boolean; errorMessageKey?: string; mixinName?: string; } export interface VovkOpenAPIMixinNormalized extends Omit { source: Exclude, { file: string; } | { url: string; }>; getMethodName: GetOpenAPINameFn; getModuleName: GetOpenAPINameFn; } export interface VovkSegmentConfig extends VovkOutputConfig { rootEntry?: string; segmentNameOverride?: string; openAPIMixin?: VovkOpenAPIMixin; } type VovkUserConfig = { $schema?: typeof VovkSchemaIdEnum.CONFIG | (string & {}); exposeConfigKeys?: boolean | (keyof VovkStrictConfig | (string & {}))[]; schemaOutDir?: string; modulesDir?: string; rootEntry?: string; logLevel?: 'error' | 'trace' | 'debug' | 'info' | 'warn'; libs?: { ajv?: KnownAny; [key: string]: KnownAny; }; devHttps?: boolean; composedClient?: ClientConfigComposed; segmentedClient?: ClientConfigSegmented; bundle?: VovkBundleConfig; clientTemplateDefs?: Record; rootSegmentModulesDirName?: string; moduleTemplates?: { service?: string; controller?: string; [key: string]: string | undefined; }; outputConfig?: VovkOutputConfig & { segments?: Record; }; }; /** * The user configuration for Vovk.ts * @see https://vovk.dev/config */ export type VovkConfig = VovkUserConfig; export type VovkStrictConfig = Required> & { exposeConfigKeys: (keyof VovkStrictConfig | string)[]; bundle: Required, 'includeSegments' | 'excludeSegments'>> & IncludeExcludeSegments; libs: Record; composedClient: RequireFields; segmentedClient: RequireFields; outputConfig: VovkOutputConfig & { segments?: Record & { openAPIMixin?: VovkOpenAPIMixinNormalized; }>; }; }; export {};