import type { EntityRegistration } from '../registered-entities'; import type { OpenContainerDataType, RegisteredOpenContainerEntity } from '../schema-types'; import type { EntityType, Subtree } from '../types'; declare type EntityIdsOrLabels = Record; export declare type IdMap = { entityIds: Record; labels: EntityIdsOrLabels; }; /** * * @param label string to parse * @returns a list of strings, separated per number at the end * e.g. stripe-text-123-container-456 will return ['stripe-text-123', 'container-456'] */ export declare const splitLabelPerNumber: (label: string) => RegExpMatchArray; /** * * Takes a given label and returns a labels * * @param label * @param labelMap * @param newNumberToAdd * @returns split labels to update, and label name to add post fix number at the end */ export declare const parseLabelForUpdating: (label: string) => { splitLabels: RegExpMatchArray; labelName: string; }; /** * Updates parent labels by separating it per number, and updating each id. * Updates the labelToUpdate by removing the old post fixed number, then taking the associated entity id's post fixed number and adding it to the label * (e.g. 'stripe-text-123-first-container-345' to 'stripe-text-1-first-container-2' * * @param labelToUpdate * @param newEntityId * @param labelMap * @returns updated label */ export declare const updateLabel: (labelToUpdate: string, newEntityId: string, labelMap: EntityIdsOrLabels) => string; export declare const updateContainerChildEntityIds: (entity: EntityType, entityIdMap: EntityIdsOrLabels) => { children: { child: { entityId: string; __type: "reference"; }; }[]; }; /** * * Instead of a generic recursive function, it was easier to locate which values need to be updated: * id * path (and all parent entityIds in path) * children in containers * second order labels * * @param entity entity data to update * @param idMap idMap to get new ids * @returns updated Entity */ export declare const updateIds: (entity: EntityType, idMap: IdMap, pageRootId: string) => EntityType; /** * Iterates over a given subtree and updates ids using an idMap * * @param subtree * @param idMap * @returns a new subtree with updated ids */ export declare const contextualizeSubtreeData: (subtree: Subtree, idMap: IdMap, pageRootId: string) => Subtree; export declare const updateChildPaths: (registeredEntities: EntityRegistration, entityId: string, parentPath: string[], modifiedEntities?: RegisteredOpenContainerEntity[]) => RegisteredOpenContainerEntity[]; export {};