Creates an isolated in-memory identity reconciler.
Required option:
getId(entity): returns the canonical ID orundefinedfor a non-canonical value.
Optional options:
getMutationId(entity): extracts a client mutation ID echoed by the server.merge(current, incoming, context): merges canonical data. The default returnsincoming.createViewKey(mutationId): custom optimistic view-key factory.createCanonicalViewKey(canonicalId): custom server-only view-key factory.
String and number IDs are supported and kept distinct.
Registers a local create. Mutation IDs and view keys must be unique.
Records an explicit receipt. If a canonical observation arrived earlier, its temporary entry is merged into the optimistic entry and removed.
Processes a canonical record from any transport. Explicit options override the configured extractors.
Marks an unsettled mutation as failed. It returns undefined for an unknown
mutation and leaves synced entries unchanged.
Removes an entry and its mutation/canonical mappings. Returns whether an entry was removed.
getSnapshot()returns a referentially stable readonly array until a mutation occurs.getByViewKey(viewKey)looks up the stable UI identity.getByMutationId(mutationId)looks up a create attempt.getByCanonicalId(canonicalId)looks up the server identity.canonicalIdFor(mutationId)returns a resolved canonical ID.subscribe(listener)registers an external-store listener and returns an unsubscribe function.