@tanstack/db
Version:
A reactive client store for building super fast apps on sync
40 lines (39 loc) • 1.47 kB
TypeScript
import { CompilationResult } from '../compiler/index.js';
import { IStreamBuilder } from '@tanstack/db-ivm';
import { ResultStream } from '../../types.js';
export type BucketRow = {
publicKey: unknown;
value: Record<PropertyKey, any>;
order: string | undefined;
};
export type BucketFacadeCompilation = {
edgeId: string;
rows: IStreamBuilder<[string, BucketRow]>;
activeBuckets: IStreamBuilder<[string, true]>;
hasOrderBy: boolean;
};
export declare const BUCKET_FACADE_REF: unique symbol;
export type BucketFacadeRef = {
[BUCKET_FACADE_REF]: {
edgeId: string;
bucketKey: string;
};
};
export type MaterializedCompilation = {
pipeline: ResultStream;
facades: Array<BucketFacadeCompilation>;
};
export type MaterializedRootCompilation = {
pipeline: ResultStream;
/**
* Undefined when the compiled pipeline passes through unchanged. Its rows
* then carry no facade references or private route state to resolve.
*/
facades: Array<BucketFacadeCompilation> | undefined;
};
/**
* Compiles inline includes into the same D2 graph as their parent relation.
* Collection-valued includes become inert bucket references. The public facade
* adapter resolves those references after the graph reaches quiescence.
*/
export declare function materializeCompilation(compilation: CompilationResult, getRootKey?: (row: any) => unknown, reduceJoinedPublicKeys?: boolean): MaterializedRootCompilation;