import { type GroupOpts } from './group.js'; import type { DimInput } from './dims.js'; export interface SGContext { totalRecords: number; } export interface Agg { count: number; sum: number; mean: number; min: number; max: number; } export interface RollupOpts { value?: (r: R) => number; distinct?: (r: R) => unknown; } export interface CmpInfo { in: 'a' | 'b' | 'both'; a?: SGNode; b?: SGNode; countDelta: number; } export interface SGNodeInit { id: string; key: unknown; label: string; dim?: string; records?: R[]; depth?: number; synthetic?: boolean; direction?: 'forward' | 'backward'; ctx: SGContext; } export declare class SGNode { id: string; key: unknown; label: string; dim?: string; records: R[]; parents: SGNode[]; children: SGNode[]; depth: number; synthetic?: boolean; direction?: 'forward' | 'backward'; maxDepth?: number; height?: number; cmp?: CmpInfo; ctx: SGContext; constructor(init: SGNodeInit); toString(): string; ancestors(): SGNode[]; descendants(): SGNode[]; leaves(): SGNode[]; pedigree(): SGNode[]; path(): unknown[]; namePath(sep?: string): string; dimPath(sep?: string): string; agg(accessor: (r: R) => number): Agg; /** * Fraction of the collection's total records under this node. On dag * collections totalRecords is 0 until attachRecords runs (pct() = NaN), * and unmatched records still count in the denominator. */ pct(): number; /** * union-then-aggregate over this node and all descendants; never * sum-over-paths. `distinct` counts unique key values over the same * deduped union. */ rollup(arg?: ((r: R) => number) | RollupOpts): { count: number; distinct?: number; } & Partial; groupChildren(dim: DimInput, opts?: GroupOpts): SGNode[]; }