import type { ContentTypeField } from "@repositories/content/types/TypesTypes.js"; /** * Pairs the fields sent for a content type with the fields it already has. * * The platform treats `fields` as nested attributes: a field without `id` is * created, one with `id` is updated, and a field left out is kept. Sending a * field again by name with `id: null` therefore creates a second field with * the same name, and the type stops accepting updates ("repeated field * names"). This helper gives each sent field the `id` of the existing field * with the same name, at the same level (root, or inside the same group). */ type SentField = ContentTypeField & { children?: SentField[] | undefined; }; export type FieldTypeConflict = { name: string; existingId: number; existingType: string; sentType: string; }; export type FieldMatch = { fields: SentField[]; created: string[]; updated: string[]; removed: string[]; conflicts: FieldTypeConflict[]; }; /** * @param sent - Fields as the caller sent them (groups carry `children`). * @param existing - Fields of the type as `GET /types/:id` returns them: * root fields, each group with its fields in `children` (each child with * the group's id in `parent_id`). A flat list with `parent_id` works too. */ export declare function matchFieldsToExisting(sent: SentField[], existing: ContentTypeField[] | undefined): FieldMatch; /** Message for fields sent with a name that exists with another type. */ export declare function describeFieldConflicts(conflicts: FieldTypeConflict[]): string; export {}; //# sourceMappingURL=matchFields.d.ts.map