/**
 * Single source of truth for the diff engine:
 *  - the rule tree describing how each patchable property of the canonical
 *    documents maps to a JSON Patch path;
 *  - a mirror of the server's whitelisted patch patterns (matchesWhitelist),
 *    used to pre-validate every generated op before sending.
 *
 * Mirrored from forestadmin-server make-layout-patch-patterns.ts (+ folder and
 * workflow patterns).
 */
import type { LayoutDomain } from './types';
export type ScalarRule = {
    kind: 'scalar';
    premiumPack?: string;
    prop: string;
};
export type OpaqueRule = {
    kind: 'opaque';
    premiumPack?: string;
    prop: string;
};
export type KeyedArrayRule = {
    addable?: boolean;
    /** Fill write-required fields the rendering read omits (only when absent), so an `add` passes the server validator. */
    addDefaults?: (value: Record<string, unknown>) => Record<string, unknown>;
    children: Rule[];
    /** When add/remove of items is detected, replace the whole array instead. */
    fallbackReplaceWhole?: boolean;
    kind: 'keyedArray';
    premiumPack?: string;
    prop: string;
    removable?: boolean;
    /** Path segment template under the parent, e.g. 'layout/segments'. */
    segment: string;
    /**
     * Name of a boolean flag marking a server-managed singleton (e.g. the main
     * folder's `isMain`): the local and remote items carrying it are matched to each
     * other regardless of `id`/`name`, so the singleton is never recreated/removed
     * across environments (its `id` is per-environment).
     */
    singletonFlag?: string;
    /** Keys stripped from the value sent in an `add` op. */
    stripOnAdd?: string[];
};
/** A nested object (e.g. viewEdit): children apply under a fixed path segment. */
export type ObjectRule = {
    children: Rule[];
    kind: 'object';
    prop: string;
    segment: string;
};
export type Rule = KeyedArrayRule | ObjectRule | OpaqueRule | ScalarRule;
export type DomainRules = {
    /** Rules of the document root. */
    root: Rule[];
};
export declare const DOMAIN_RULES: Record<LayoutDomain, DomainRules>;
export declare const NUM_OR_UUID: string;
/** True when an op matches the mirrored server whitelist for this domain. */
export declare function matchesWhitelist(domain: LayoutDomain, op: {
    op: string;
    path: string;
}): boolean;
//# sourceMappingURL=patch-rules.d.ts.map