Skip to main content
Version: v10.0.0

SyncConfig


Import
import { SyncConfig } from "@hyper-fetch/db"

Preview​

type SyncConfig = {
byKey?: (key: RowKey) => ListenerPatch;
changes?: (event: unknown) => { delete: readonly RowKey[]; refetch?: readonly RowKey[]; upsert: readonly unknown[] };
incomplete?: refetch;
key?: (message: unknown) => RowKey;
listener: ListenerInstance;
notation?: (conditions: readonly ComparisonNode[]) => ListenerPatch;
resumes?: boolean;
row?: (message: unknown) => unknown;
type: SyncType | changes;
where?: Record<string, { eq: (value: unknown) => ListenerPatch }>;
}

Structure​

SyncConfig
NameTypeDescription
incomplete
refetch
listener
ListenerInstance
resumes
boolean
type
SyncType | changes

changes syncs read inserts and deletes from one event, such as a Firestore snapshot

where
Record<string, { eq: (value: unknown) => ListenerPatch }>
byKey
(key: RowKey) => ListenerPatch
changes
(event: unknown) => { delete: readonly RowKey[]; refetch?: readonly RowKey[]; upsert: readonly unknown[] }
key
(message: unknown) => RowKey
notation
(conditions: readonly ComparisonNode[]) => ListenerPatch

Covers every subset by turning its sent conditions into listener params, as adapter presets do

row
(message: unknown) => unknown