/** * Resolved naming configuration — master toggle + per-category rules. * * Extends the existing top-level `naming` key. Legacy values * (`'snake_case'` / `{ table, column, pluralizeTables }`) remain valid and * mean: normalization OFF + physical projection convention only. */ import type { NamingConventionInput } from './projections/shared/naming.js'; /** How to handle a name that does not match the configured house form. */ export type NamingRuleSeverity = 'off' | 'warn' | 'error' | 'fix'; /** Configurable casing styles for identifiers / storage names. */ export type NamingCasing = 'preserve' | 'camel' | 'pascal' | 'snake' | 'kebab' | 'upper' | 'lower'; export type PluralizationMode = 'preserve' | 'automatic' | 'explicit'; export type SeparatorKind = 'underscore' | 'hyphen' | 'whitespace'; export interface NamingCategoryRule { casing?: NamingCasing; mismatch?: NamingRuleSeverity; } export interface NamingRelationshipRule extends NamingCategoryRule { /** Suffix for relationship foreign keys. Default `'Id'`. */ idSuffix?: string; } export interface NamingCollectionRule extends NamingCategoryRule { pluralization?: PluralizationMode; } export interface NamingProjectionStorageMappings { /** Canonical entity name → deployed table/collection name. */ tables?: Record; /** * Canonical field key → deployed column name. * Key forms: `Entity.field` or `Entity.relationship` (relationship FK). */ fields?: Record; } /** * Expanded naming block (normalization + rules). Legacy convention-only values * are accepted separately — see {@link ManifestNamingInput}. */ export interface NamingNormalizationConfig { /** Master switch. Default false (backward compatible). */ normalization?: boolean; /** * Physical DB/route convention inherited by projections (former top-level * `naming` value). Optional when using the expanded block. */ convention?: NamingConventionInput; entities?: NamingCategoryRule; fields?: NamingCategoryRule; relationships?: NamingRelationshipRule; commands?: NamingCategoryRule; events?: NamingCategoryRule; collections?: NamingCollectionRule; tables?: NamingCollectionRule; separators?: { normalize?: SeparatorKind[]; }; collisions?: 'off' | 'warn' | 'error'; conflictingDefinitions?: 'off' | 'warn' | 'error'; ambiguousWordBoundaries?: NamingRuleSeverity; irregularPlurals?: Record; /** Semantic aliases: different words intentionally the same (`writer` → `author`). */ aliases?: Record; /** Projection-only storage remaps; Manifest canonical names stay unchanged. */ projections?: { convex?: NamingProjectionStorageMappings; prisma?: NamingProjectionStorageMappings; }; /** * When normalization would change a storage name from the verbatim IR spelling, * require a legacy mapping or acknowledge drift. Default `'error'` when * normalization is on. */ storageNameChange?: 'off' | 'warn' | 'error'; } /** * Public config input for `naming:` — legacy convention OR expanded block. */ export type ManifestNamingInput = NamingConventionInput | NamingNormalizationConfig; export interface ResolvedCategoryRule { casing: NamingCasing; mismatch: NamingRuleSeverity; } export interface ResolvedRelationshipRule extends ResolvedCategoryRule { idSuffix: string; } export interface ResolvedCollectionRule extends ResolvedCategoryRule { pluralization: PluralizationMode; } export interface ResolvedNamingConfig { normalization: boolean; /** Physical convention for projections (may be undefined = preserve IR names). */ convention?: NamingConventionInput; entities: ResolvedCategoryRule; fields: ResolvedCategoryRule; relationships: ResolvedRelationshipRule; commands: ResolvedCategoryRule; events: ResolvedCategoryRule; collections: ResolvedCollectionRule; tables: ResolvedCollectionRule; separators: { normalize: SeparatorKind[]; }; collisions: 'off' | 'warn' | 'error'; conflictingDefinitions: 'off' | 'warn' | 'error'; ambiguousWordBoundaries: NamingRuleSeverity; irregularPlurals: Record; aliases: Record; projections: { convex?: NamingProjectionStorageMappings; prisma?: NamingProjectionStorageMappings; }; storageNameChange: 'off' | 'warn' | 'error'; } /** True when the value is the legacy physical-convention-only form. */ export declare function isLegacyNamingConvention(value: unknown): boolean; export type NamingConfigDiagnostic = { severity: 'error' | 'warning'; message: string; }; /** * Validate raw naming config. Returns diagnostics; does not throw. * Invalid casing/severity combos and alias cycles are errors. */ export declare function validateNamingConfig(raw: unknown): NamingConfigDiagnostic[]; export declare function resolveNamingConfig(raw?: ManifestNamingInput | null): ResolvedNamingConfig; /** Extract the physical convention for `resolveProjectionOptions` inheritance. */ export declare function extractNamingConvention(naming: ManifestNamingInput | undefined): NamingConventionInput | undefined; /** Follow alias chain to the terminal word (no cycles — validate first). */ export declare function resolveAlias(word: string, aliases: Record): string; /** Whether `normalizeNaming` would treat this as an active convention. */ export declare function hasActiveConvention(convention: NamingConventionInput | undefined): boolean; //# sourceMappingURL=naming-config.d.ts.map