UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

40 lines (39 loc) • 2.85 kB
import { VIRTUAL_PROP_NAMES } from "../../virtual-props.cjs"; import { NamespacedRow } from "../../types.cjs"; export declare const INCLUDES_PUBLIC_KEY: unique symbol; export declare const SOURCE_METADATA: unique symbol; export declare const ROW_METADATA: unique symbol; export type RowMetadata = Partial<Record<(typeof VIRTUAL_PROP_NAMES)[number], unknown>>; export declare const INCLUDES_ROUTING: unique symbol; export type RouteMetadata = { correlationKey: unknown; parentContext: unknown; }; export type RoutedScalarMetadata = { value: unknown; correlationKey: unknown; parentContext: unknown; publicKey: unknown; }; export declare function attachRouteMetadata<T extends object>(value: T, correlationKey: unknown, parentContext: unknown): T; export declare function getRouteMetadata(value: unknown): RouteMetadata | undefined; export declare function getNamespacedRouteMetadata(row: unknown, source: string): RouteMetadata | undefined; export declare function attachRouteMetadataToResult(value: unknown, correlationKey: unknown, parentContext: unknown, publicKey: unknown): unknown; export declare function getRoutedScalarMetadata(value: unknown): RoutedScalarMetadata | undefined; /** Give FROM and JOIN rows the same route and callback namespace. */ export declare function wrapInputRow(alias: string, row: unknown, metadata?: RowMetadata | null, hasInternalState?: boolean): NamespacedRow; /** Attribution and include routing belong to the namespace, never source data. */ export declare function getSourceMetadata(row: Record<PropertyKey, unknown>, alias: string): RowMetadata | null; export declare function getSourceRouting(row: Record<PropertyKey, unknown>, alias: string): unknown; export declare function mergeSourceContext(target: Record<PropertyKey, unknown>, left: Record<PropertyKey, unknown> | undefined, right: Record<PropertyKey, unknown> | undefined): void; /** Restore namespace state after resolving its public include paths. */ export declare function restoreInternalRouteMetadata(target: Record<PropertyKey, unknown>, source: object): void; /** Remove private route state from a known result root. */ export declare function stripInternalRouteMetadata(value: unknown): unknown; /** Remove compiler-owned keys before invoking user code, at the known scope. */ export declare function stripInternalCallbackMetadata(value: unknown): unknown; /** Copy only paths changed by a leaf transform or an omitted private key. */ export declare function transformPublicContainers(value: unknown, transformLeaf: (value: unknown) => unknown, omittedKeys: ReadonlySet<PropertyKey>): unknown; /** Allocate a descriptor-copy target without losing array prototypes. */ export declare function createPublicContainerShell(value: object): object; export declare function isPublicContainer(value: unknown): value is object;