UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

31 lines (30 loc) • 1.37 kB
import { ValueIdentity } from "../equality-value-identity.cjs"; import { CompilationResult } from "../compiler/index.cjs"; import { ResultStream } from "../../types.cjs"; export type ResultTuple = [ value: Record<PropertyKey, any>, order: string | undefined, correlationKey?: unknown, parentContext?: Record<string, any> | null, routing?: IncludesRouting, publicKey?: unknown ]; export type IncludesRouting = Record<string, IncludeRoute>; export type IncludeRoute = { active: boolean; correlationKey: unknown; parentContext: Record<string, any> | null; }; export type CanonicalResult = { publicKey: unknown; tuple: ResultTuple; }; export type RelationScope = `root` | `child`; export declare function exposeRouting(pipeline: ResultStream): ResultStream; export declare function canonicalizeByPublicKey(pipeline: ResultStream, getKey: ((row: any) => unknown) | undefined, scope: RelationScope, valueIdentity: ValueIdentity): ResultStream; export declare function routeKey(correlationKey: unknown, parentContext: Record<string, any> | null | undefined, valueIdentity: ValueIdentity): string; /** Reduces a query without includes to one canonical row per public key. */ export declare function reducePublicKeys(compilation: CompilationResult, getKey: (row: any) => unknown): { pipeline: ResultStream; facades: undefined; };