import type { EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, IMetadataStorage, Primary } from '../typings.js'; import type { Platform } from '../platforms/Platform.js'; import type { Configuration } from './Configuration.js'; type Comparator = (a: T, b: T, options?: { includeInverseSides?: boolean; }) => EntityData; type ResultMapper = (result: EntityData) => EntityData | null; type SnapshotGenerator = (entity: T) => EntityData; type PkGetter = (entity: T) => Primary; type PkSerializer = (entity: T) => string; type CompositeKeyPart = string | CompositeKeyPart[]; /** @internal Generates and caches JIT-compiled functions for comparing, snapshotting, and mapping entity data. */ export declare class EntityComparator { #private; constructor(metadata: IMetadataStorage, platform: Platform, config?: Configuration); /** * Computes difference between two entities. */ diffEntities(entityName: EntityName, a: EntityData, b: EntityData, options?: { includeInverseSides?: boolean; }): EntityData; /** Returns true if two entity snapshots are identical (no differences). */ matching(entityName: EntityName, a: EntityData, b: EntityData): boolean; /** * Removes ORM specific code from entities and prepares it for serializing. Used before change set computation. * References will be mapped to primary keys, collections to arrays of primary keys. */ prepareEntity(entity: T): EntityData; /** * Maps database columns to properties. */ mapResult(meta: EntityMetadata, result: EntityDictionary): EntityData; /** * @internal Highly performance-sensitive method. */ getPkGetter(meta: EntityMetadata): PkGetter; /** * @internal Highly performance-sensitive method. */ getPkGetterConverted(meta: EntityMetadata): PkGetter; /** * @internal Highly performance-sensitive method. */ getPkSerializer(meta: EntityMetadata): PkSerializer; /** * @internal Highly performance-sensitive method. */ getSnapshotGenerator(entityName: EntityName): SnapshotGenerator; /** * @internal */ propName(name: string, parent?: string): string; /** * @internal respects nested composite keys, e.g. `[1, [2, 3]]` */ createCompositeKeyArray(prop: EntityProperty, parents?: EntityProperty[]): string; /** * @internal */ formatCompositeKeyPart(part: CompositeKeyPart): string; /** * @internal Highly performance-sensitive method. */ getResultMapper(meta: EntityMetadata): ResultMapper; private getPropertyCondition; private getEmbeddedArrayPropertySnapshot; /** * we need to serialize only object embeddables, and only the top level ones, so root object embeddable * properties and first child nested object embeddables with inlined parent */ private shouldSerialize; private getEmbeddedPropertySnapshot; private getInlineEmbeddedNullLines; private registerCustomType; private getPropertySnapshot; /** * @internal Highly performance-sensitive method. */ getEntityComparator(entityName: EntityName): Comparator; private getGenericComparator; private getPropertyComparator; private wrap; private safeKey; /** * Sets the toArray helper in the context if not already set. * Used for converting composite PKs to arrays. */ private setToArrayHelper; /** * perf: used to generate list of comparable properties during discovery, so we speed up the runtime comparison */ static isComparable(prop: EntityProperty, root: EntityMetadata): boolean; } export {};