import { ValidationError } from "../validation-error.js"; import { BaseProps, HistoryEntry, DeepJsonResult, EntityHooks, EntityValidation } from "../types/index.js"; import { AggregateChanges } from "./aggregate-changes.js"; import { Id } from "./id.js"; export declare abstract class BaseEntity { private _props; private tracker; private proxiedProps; private snapshot; private validationConfig; private entityHooks?; private entitySchema?; private readonly issueCollector; protected static validation?: EntityValidation; protected static hooks?: EntityHooks; constructor(props: Omit & Partial> & { id?: Id; }); /** * Add a validation issue during rules hook execution (non-throwing mode). */ addValidationIssue(path: string | string[], message: string): void; private beginValidationCycle; private finalizeValidation; private runRulesHook; private validateProps; private validateSchema; private handleValidationFailure; private clearValidationError; /** * Validates the full current props (schema + rules). Used on updates when * throwOnError is false so validationErrors reflects every invalid field. */ private collectCurrentValidationIssues; /** * @returns true when the entity has no validation issues after refresh */ private refreshValidationStateFromCurrentProps; /** * When true, failed schema/rules updates keep the mutated value and refresh * validationErrors (dirty / form mode). Requires throwOnError: false and * persistInvalidMutations: true. */ private shouldPersistInvalidMutation; private extractPathKey; /** * Setup validation that runs on every property change. * Uses the ChangeTracker's onChangeValidator callback. */ private setupUpdateValidation; private takeSnapshot; private deepCloneProps; get id(): Id; isNew(): boolean; /** * Check equality with another entity by comparing IDs */ equals(other: BaseEntity | Id | string): boolean; get props(): T; /** * Check if entity has validation errors (when throwOnError is false) */ get hasValidationErrors(): boolean; /** * Get validation errors (when throwOnError is false) */ get validationErrors(): ValidationError | undefined; /** * Returns all detected changes as AggregateChanges. * * @example * ```typescript * const changes = user.getChanges(); * const batch = changes.toBatchOperations(); * * for (const del of batch.deletes) { ... } * for (const create of batch.creates) { ... } * for (const upd of batch.updates) { ... } * ``` */ getChanges>(): AggregateChanges; /** * Returns the change history (for debugging). */ getHistory(): HistoryEntry[]; /** * Clears history and marks entity as "clean". * Recursively marks all nested entities as clean. */ markAsClean(): void; /** * Clears history, marks entity as "clean" and marks the Id as not new. * Recursively marks all nested entities as persisted. * Call this after successfully persisting to the database. */ markAsPersisted(): void; /** * Iterates over all nested entities (direct children only) and executes a callback. * This includes entities in arrays and single entity properties. */ private forEachNestedEntity; toJSON(): DeepJsonResult; private deepToJson; private setValueAtPath; private getValueAtPath; } //# sourceMappingURL=base-entity.d.ts.map