UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

1 lines • 1.31 kB
{"version":3,"file":"persisted-readiness.cjs","sources":["../../src/persisted-readiness.ts"],"sourcesContent":["/** The local-restore boundary of one opted-in persisted Collection. */\nexport type PersistedReadinessSnapshot =\n | { status: `loading`; error?: never }\n | { status: `ready`; error?: never }\n | { status: `error`; error: unknown }\n\n/** @internal Capability supplied by a persistence adapter, not by core sync. */\nexport interface PersistedReadinessSource {\n /** Time to prefer network before a completed persisted restore may render. */\n networkTimeoutMs: number\n /** Anchor the deadline to this Collection's current sync run. */\n getOrStartNetworkDeadline: () => number\n getSnapshot: () => PersistedReadinessSnapshot\n subscribe: (listener: () => void) => () => void\n}\n\n/** @internal Config capability shared with first-party persistence adapters. */\nexport const PERSISTED_READINESS = Symbol.for(`@tanstack/db.persistedReadiness`)\n\nexport function getPersistedReadinessSource(\n config: object,\n): PersistedReadinessSource | undefined {\n return (config as { [PERSISTED_READINESS]?: PersistedReadinessSource })[\n PERSISTED_READINESS\n ]\n}\n"],"names":[],"mappings":";;AAiBO,MAAM,sBAAsB,uBAAO,IAAI,iCAAiC;AAExE,SAAS,4BACd,QACsC;AACtC,SAAQ,OACN,mBACF;AACF;;;"}