/** @ignore */ export type Patch = { /** Property path (array indices, object keys, synthetic Set entry ids) from the root to the mutated location. */ path: string; valType?: string & {}; value?: unknown; } & (SetAddPatch | SetRemovePatch | RemovePatch | LiteralAddPatch); /** @ignore */ export interface SetAddPatch { /** Mutation kind applied at the resolved `path`. */ op: "add"; valType: "set"; /** * New value for set mutations: * - A single primitive * - An array of primitives */ value: number | string | boolean | (number | string | boolean)[]; } /** @ignore */ export interface SetRemovePatch { /** Mutation kind applied at the resolved `path`. */ op: "remove"; valType: "set"; /** * The value(s) to be removed from the set. Either: * - A single primitive * - An array of primitives */ value: number | string | boolean | object | (number | string | boolean | object)[]; } /** @ignore */ export interface RemovePatch { /** Mutation kind applied at the resolved `path`. */ op: "remove"; } /** @ignore */ export interface LiteralAddPatch { /** Mutation kind applied at the resolved `path`. */ op: "add"; /** The literal value to be added at the resolved `path` */ value: string | number | boolean | object; } /** * @ignore * * Apply a diff to an object. * * The syntax is inspired by RFC 6902 but it is not compatible. * * It supports Sets for multi-valued properties: * - Primitive values are added as Sets (Set) * - Multi-valued objects are stored in Sets, accessed by their `@id` property * - Single objects are plain objects with an `@id` property * * Path traversal: * - When traversing through a Set, the path segment is treated as an `@id` to find the object * - When traversing through a plain object, the path segment is a property name * * @param currentState The object before the patch * @param patches An array of patches to apply to the object. * @param ensurePathExists If true, create nested objects along the path if the path does not exist. * * Note: When creating new objects, this function pre-scans upcoming patches to find `@id` and `@graph` * values that will be assigned to the object. This prevents the signal library's propGenerator * from being triggered before these identity fields are set, which would cause it to generate * random IDs unnecessarily. */ export declare function applyPatches(currentState: Record, patches: Patch[], ormType: "set" | "discrete", ensurePathExists?: boolean): void; /** * @ignore * * See documentation for applyPatches */ export declare function applyPatchesToDeepSignal(currentState: object, patch: Patch[], ormType: "set" | "discrete"): void; //# sourceMappingURL=applyPatches.d.ts.map