UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

29 lines (28 loc) • 1.47 kB
import { HealthNode } from '../types.js'; import { CollectionImpl } from './index.js'; /** A Collection that another Collection reads, under its query alias. */ export interface HealthSource { readonly alias: string; /** Tells apart two sources under one alias, such as two includes. */ readonly id?: string; readonly collection: CollectionImpl<any, any, any, any, any>; readonly kind?: HealthNode[`kind`]; } /** * Build the health tree for a Collection. A base Collection is one node. A live * query is a node with one child per source alias, in query order, and each * child that is itself a live query recurses. The tree is read from current * state, so every node mirrors its Collection at the moment it is read. */ export declare function buildHealthTree(collection: CollectionImpl<any, any, any, any, any>, { alias, id, kind }?: Omit<HealthSource, `collection`>, owner?: object): HealthNode; /** * A node from its own facts and its children. It has errors when it or * anything below it has a `failureReason` or an `error`. */ export declare function healthNode(owner: object, id: string | undefined, fields: Omit<HealthNode, `hasErrors`>): HealthNode; /** * Every node in a health tree that shows a problem of its own, in tree order: * a `failureReason` or an `error`. A node whose only problems are below it is * not listed; its descendants are. */ export declare function findProblems(health: HealthNode): Array<HealthNode>;