import { Cloneable } from '../classes/Cloneable.js'; import { Data } from '../classes/Data.js'; import { Decoder } from '../classes/Decoder.js'; import { Encodeable, PlainObject } from '../classes/Encodeable.js'; import { EncodeContext } from '../classes/EncodeContext.js'; import { Identifiable } from '../classes/Identifiable.js'; import { Patchable } from '../classes/Patchable.js'; type PutAfter = { afterId?: Id | null; put: Put; }; type MoveAfter = { afterId: Id | null; move: Id; }; type PatchItem = { patch: Patch; }; type DeleteItem = { delete: Id; }; type Change = PutAfter | MoveAfter | DeleteItem | PatchItem; /** * Helps with synchronizing changes to an array. As long as every element in the array has a unique identifier. */ export declare class PatchableArray & Encodeable & Patchable) | Id, Patch extends (Identifiable & Encodeable) | Put> implements Encodeable, Patchable>, Cloneable { _isPatchableArray: boolean; changes: Change[]; constructor(changes?: Change[]); clone(this: T): this; merge(other: PatchableArray): void; patch(patch: PatchableArray | Put[]): this; /** * @param value Value to insert in the array * @param after * - undefined (or not provided) = insert at the end * - null = insert at the start * - id = insert after the provided id. If the provided id is not found, it is appended at the end */ addPut(value: Put, after?: Id | null): void; addMove(item: Id, after: Id | null): void; hasChanges(item: Id): boolean; filter(item: Id): PatchableArray; addPatch(value: Patch): void; addDelete(id: Id): void; applyTo(array: Put[]): Put[]; encode(context: EncodeContext): { _isPatch: boolean; changes: PlainObject[]; }; getPuts(): PutAfter[]; getPatches(): Patch[]; getDeletes(): Id[]; getMoves(): MoveAfter[]; } export declare class PatchableArrayItemDecoder & Encodeable & Patchable) | Id, Patch extends (Identifiable & Encodeable) | Put> implements Decoder> { putDecoder: Decoder; patchDecoder: Decoder; idDecoder: Decoder; constructor(putDecoder: Decoder, patchDecoder: Decoder, idDecoder: Decoder); decode(data: Data): Change; } export declare class PatchableArrayDecoder & Encodeable & Patchable) | Id, Patch extends (Identifiable & Encodeable) | Put> implements Decoder> { putDecoder: Decoder; patchDecoder: Decoder; idDecoder: Decoder; constructor(putDecoder: Decoder, patchDecoder: Decoder, idDecoder: Decoder); decode(data: Data): PatchableArray; isDefaultValue(value: unknown): boolean; getDefaultValue(): PatchableArray; } export {}; //# sourceMappingURL=PatchableArray.d.ts.map