import type { z } from 'zod'; import type { PartialProjectDefinitionInput, ProjectDefinition } from '#src/schema/index.js'; type PlainObject = Record; /** * A single diff entry representing a changed entity or section. */ export interface DefinitionDiffEntry { /** Top-level key in the definition (e.g., "models", "settings") */ path: string; /** * Human-readable label for this entry. * * Entity arrays: `"Model: User"`, `"App: backend"` * Other fields: `"Settings"`, `"Features"` */ label: string; /** Type of change */ type: 'added' | 'updated' | 'removed'; /** The current serialized value (undefined for additions) */ current: unknown; /** The merged serialized value (undefined for removals) */ merged: unknown; } /** * Result of diffing a project definition against a partial merge. */ export interface DefinitionDiff { /** Whether there are any changes */ hasChanges: boolean; /** Individual diff entries grouped by entity/section */ entries: DefinitionDiffEntry[]; } export interface DiffSerializedDefinitionsOptions { /** * When provided, only these top-level keys are compared. * When omitted, all keys from both definitions are compared. */ scopeToKeys?: Set; /** * When provided, entity array diffs are scoped to only these entity names * per top-level key. When omitted, all entities in both arrays are compared. */ entityNamesByKey?: Map>; } /** * Compares two serialized project definitions at the entity level, producing * diff entries for added, updated, and removed entities/fields. * * Both definitions should be in serialized form (with entity names, not IDs). * * @param schema - The project definition Zod schema * @param currentDef - The current serialized definition * @param otherDef - The other serialized definition to compare against * @param options - Optional scoping options * @returns Entity-level diff entries */ export declare function diffSerializedDefinitions(schema: z.ZodType, currentDef: PlainObject, otherDef: PlainObject, options?: DiffSerializedDefinitionsOptions): DefinitionDiff; /** * Computes a structured, entity-grouped diff between the current project definition * and the result of merging a partial definition into it. * * For top-level entity arrays (models, apps, enums, libraries, features), produces * one entry per entity that was added, updated, or removed — detected via schema * entity metadata (`withEnt` annotations) using `collectEntityArrays`. For other * top-level fields (settings, plugins, etc.), produces one entry per changed field. * * @param schema - The project definition Zod schema * @param definition - The current parsed project definition (with IDs) * @param partialDef - A partial serialized definition to merge in * @returns A structured diff with entity-level entries */ export declare function diffDefinition(schema: z.ZodType, definition: ProjectDefinition, partialDef: PartialProjectDefinitionInput): DefinitionDiff; export {}; //# sourceMappingURL=diff-definition.d.ts.map