import type { EntityMetadata, EntityName } from '../typings.js'; import type { Routine } from './Routine.js'; import { type MetadataDiscoveryOptions } from '../utils/Configuration.js'; import type { MetadataStorage } from './MetadataStorage.js'; /** * @internal */ export declare class MetadataValidator { validateEntityDefinition(metadata: MetadataStorage, name: EntityName, options: MetadataDiscoveryOptions): void; validateRoutineDefinition(routine: Routine): void; validateDiscovered(discovered: EntityMetadata[], options: MetadataDiscoveryOptions): void; private validatePartitioning; /** * Find the first partition name whose normalized form (case-folded for unquoted segments, * quoted segments preserved) has already been seen. Returns the offending name in its * original form for the error message. */ private findDuplicatePartitionName; /** * Partition names may be bare (`child`), schema-qualified (`schema.child`), or use quoted * identifiers (`"my.schema"."child"`). Reject anything with more than one unquoted `.`. */ private hasValidPartitionName; private hasPartitionExpression; private validatePartitionKeyConstraints; /** * Returns the list of physical field names that a partition expression references, or * `undefined` when the expression is opaque (callback, or raw SQL like `date_trunc('day', x)` * that we cannot statically parse). Opaque expressions intentionally bypass the primary-key / * unique-constraint coverage checks — users are trusted to ensure the referenced columns are * part of the partition key, since PostgreSQL will surface the violation at DDL execution. */ private getPartitionKeyFields; private resolvePartitionKeyField; private getConstraintFields; private validateReference; private validateTargetKey; /** * Checks if a property has a unique constraint (either via `unique: true` or single-property `@Unique` decorator). * Composite unique constraints are not sufficient for targetKey. */ private isPropertyUnique; private validatePolymorphicTargets; private validateBidirectional; private validateOwningSide; private validateInverseSide; private validateIndexes; private validateDuplicateFieldNames; private validateVersionField; /** * Validates that entity properties do not use dangerous names that could lead to * prototype pollution vulnerabilities. This validation ensures that property names * cannot be exploited to modify object prototypes when values are assigned during * entity hydration or persistence operations. * * @internal */ private validatePropertyNames; /** * Validates view entity configuration. * View entities must have an expression. */ private validateViewEntity; /** * Validates that STI and TPT are not mixed in the same inheritance hierarchy. * An entity hierarchy can use either STI (discriminatorColumn) or TPT (inheritance: 'tpt'), * but not both. * * Note: This validation runs before `initTablePerTypeInheritance` sets `inheritanceType`, * so we check the raw `inheritance` option from the decorator/schema. */ private validateInheritanceStrategies; }