@signaldb/sync
Version:
This is the sync implementation of [SignalDB](https://github.com/maxnowack/signaldb). SignalDB is a local-first JavaScript database with real-time sync, enabling optimistic UI with signal-based reactivity across multiple frameworks.
21 lines (20 loc) • 740 B
TypeScript
import type { BaseItem } from '@signaldb/core';
/**
* Computes the modified fields between two items recursively.
* @param oldItem The old item
* @param newItem The new item
* @returns The modified fields
*/
export declare function computeModifiedFields<T extends Record<string, any>>(oldItem: T, newItem: T): string[];
/**
* Compute changes between two arrays of items.
* @param oldItems Array of the old items
* @param newItems Array of the new items
* @returns The changeset
*/
export default function computeChanges<ItemType extends BaseItem<IdType>, IdType>(oldItems: ItemType[], newItems: ItemType[]): {
added: ItemType[];
modified: ItemType[];
modifiedFields: Map<IdType, string[]>;
removed: ItemType[];
};