import { type PrimativeKey, type ReadKeyFunction } from '../key'; /** * How the value's presence changed from one set to the next. */ export declare enum SetDeltaChange { REMOVED = -1, NONE = 0,// No change ADDED = 1 } /** * Returns true if the next value has been modified compared to the past value. */ export type SetValueIsModifiedFunction = (past: T, next: T) => boolean; /** * Represents the change status of a single value between two sets, including its past and next values. */ export interface SetDeltaChangePair { /** * Key for this pair */ readonly key: K; /** * Value as it was in the past set, if applicable. */ readonly pastValue?: T; /** * Value as it was in the next set, if applicable. */ readonly nextValue?: T; /** * Evaluated value. */ readonly value: T; /** * How the value changed. */ readonly change: SetDeltaChange; /** * Whether or not the value was modified. */ readonly isModified?: boolean; } /** * Function that builds an array of changes based on the values in the past array to the next array. */ export type SetDeltaFunction = (past: Iterable, next: Iterable) => SetDeltaChangePair[]; /** * Configuration for creating a {@link SetDeltaFunction}. */ export interface SetDeltaFunctionConfig { /** * Reads the identifying key from each input value. */ readKey: ReadKeyFunction; /** * Whether or not the value is modified. */ isModifiedFunction?: SetValueIsModifiedFunction; } /** * Creates a {@link SetDeltaFunction} that computes the differences between two iterables, * identifying which items were added, removed, or unchanged. * * @param config - Configuration with the key reader and optional modification detector. * @returns A function that compares two iterables and returns an array of change pairs. */ export declare function setDeltaFunction(config: SetDeltaFunctionConfig): SetDeltaFunction; /** * Keys mapped by their change type. */ export interface SetDeltaChangeKeys { readonly removed: K[]; readonly none: K[]; readonly added: K[]; } /** * Groups the keys from an array of {@link SetDeltaChangePair} values by their change type. * * @param pairs - The delta change pairs to categorize. * @returns An object with `added`, `removed`, and `none` key arrays. */ export declare function setDeltaChangeKeys(pairs: SetDeltaChangePair[]): SetDeltaChangeKeys; /** * Pre-configured SetDeltaFunction for PrimativeKey values. */ export declare const primativeValuesDelta: (past: Iterable, next: Iterable) => SetDeltaChangePair[];