import { GlobalCfgRenderCtx, PColumnDataUniversal } from "../render/internal.js"; import { TreeNodeAccessor } from "../render/accessor.js"; import "../render/index.js"; import { ColumnFieldStatus, ColumnRecipe, ColumnRecipeId, ColumnResolutionStatus } from "./column_recipes/types.js"; import { LeafEntry, PColumn, PColumnSpec, PObjectId, PlRef, SpecOverrides, SpecQuery } from "@milaboratories/pl-model-common"; export type DataColumnId = PObjectId; export type ColumnData = undefined | PColumnDataUniversal; /** * A {@link ColumnRecipe} that can be read directly in the sandbox: its * {@link getData} is guaranteed to be consistent with {@link getSpec}. * * This is a *capability*, not a class. Only two recipe shapes carry it — a * bare leaf and a spec-override over a bare leaf — because those are the only * ones whose data still matches their spec. An axis-filtered recipe drops axes * from its spec while the underlying data keeps them, and a discovered recipe * only materialises after a join; neither can be read here, so neither * implements this interface. * * Narrow to it with `hasReachableData(recipe)` rather than testing for a concrete * class — which recipe classes exist is an implementation detail behind * `recipe.id`. */ export interface DataColumnRecipe extends ColumnRecipe { /** Column data, consistent with {@link ColumnRecipe.getSpec}. */ getData(): ColumnData; } /** * The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare * {@link PObjectId} and whose readers are bound to a single tree-accessor * leaf. Layered encodings (Overridden / Discovered / Filtered) are reified * through their dedicated recipe classes and reference leaf columns by id. * * Internal — consumers hold the {@link DataColumnRecipe} interface and construct * through the {@link DataColumnRecipe} dispatcher. */ export declare class DataColumnImpl implements DataColumnRecipe { readonly id: PObjectId; private readonly options; private specCache?; private dataCache?; private dataStatusCache?; private constructor(); /** A leaf-recipe references exactly one column — its own id. */ getReferencedIds(): PObjectId[]; getSpec(): PColumnSpec; /** Leaf-shaped — points straight at `this.id`. */ getQuery(): SpecQuery; getData(): ColumnData; getDataStatus(): ColumnFieldStatus; /** * Overlay overrides → produces a {@link ColumnOverriddenRecipe} wrapping * this leaf. The leaf itself stays bare (id remains a plain PObjectId); * layering lives entirely in the recipe wrappers. */ withSpecs(overrides: SpecOverrides): ColumnRecipe; /** * Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly: * returns `undefined` unless the id names a column whose spec is readable in * this ctx — while it is resolving, when it is absent, and when the id names * an export that is not a column (a `kind: "File"` object, for example). * Data and dataStatus stay lazy. */ static fromId(id: PObjectId, { ctx }?: { ctx?: GlobalCfgRenderCtx; }): undefined | DataColumnRecipe; /** {@link PlRef} wrapper over {@link fromId}. */ static fromPlRef(ref: PlRef): undefined | DataColumnRecipe; /** * Bind directly to an accessor-backed {@link LeafEntry} — no registry. * Returns `undefined` unless the leaf's spec is readable and is a column * spec: while the spec is resolving, when it is absent, and for an export * that is not a column. */ static fromAccessor(entry: LeafEntry): undefined | DataColumnRecipe; /** * Wrap a materialised {@link PColumn}. If the input is already a * {@link DataColumnRecipe} leaf it is returned as-is. */ static fromColumn(column: PColumn | DataColumnRecipe): DataColumnRecipe; /** * Distinguishes `present` / `resolving` / `absent` for a {@link PObjectId} * in the active render ctx. Falls back to the registry's `isFinal()` * when the id has no entry — only then we can say `absent` instead of * `resolving`. The status tells only whether the spec is readable: for an * export that is not a column it is `present`, and the factories return * `undefined`. */ static getStatusById(id: PObjectId, { ctx }?: { ctx?: GlobalCfgRenderCtx; }): ColumnResolutionStatus; /** {@link PlRef} wrapper over {@link getStatusById}. */ static getStatusByPlRef(ref: PlRef, opts?: { ctx?: GlobalCfgRenderCtx; }): ColumnResolutionStatus; /** No registry — reads straight off the entry's accessor. */ static getStatusByAccessor(entry: LeafEntry): ColumnResolutionStatus; } /** Anything the {@link DataColumnRecipe} dispatcher can build a leaf from. */ export type DataColumnSource = PObjectId | PlRef | LeafEntry | PColumn | DataColumnRecipe; /** * Unified dispatcher — picks the right `DataColumnImpl.fromX` by source * shape. For ambiguous inputs callers can still use the explicit factories * (also attached as properties: `DataColumn.fromId`, `.fromPlRef`, * `.fromAccessor`, `.fromColumn`). */ declare function DataColumnDispatch(source: DataColumnSource, opts?: { ctx?: GlobalCfgRenderCtx; }): undefined | DataColumnRecipe; /** * Polymorphic counterpart to {@link DataColumnDispatch}: returns the * {@link ColumnResolutionStatus} for any factory input without constructing * the recipe. For already-materialised sources ({@link PColumn} value, * existing {@link DataColumnRecipe}) status is `present` by construction. */ declare function DataColumnGetStatus(source: DataColumnSource, opts?: { ctx?: GlobalCfgRenderCtx; }): ColumnResolutionStatus; export declare const DataColumn: typeof DataColumnDispatch & { fromId: typeof DataColumnImpl.fromId; fromPlRef: typeof DataColumnImpl.fromPlRef; fromAccessor: typeof DataColumnImpl.fromAccessor; fromColumn: typeof DataColumnImpl.fromColumn; getStatus: typeof DataColumnGetStatus; getStatusById: typeof DataColumnImpl.getStatusById; getStatusByPlRef: typeof DataColumnImpl.getStatusByPlRef; getStatusByAccessor: typeof DataColumnImpl.getStatusByAccessor; }; /** * Type-guard narrowing to a bare leaf — a {@link DataColumnRecipe} whose `id` is a * plain {@link PObjectId}. */ export declare function isDataColumn(value: unknown): value is DataColumnRecipe; export type { ColumnFieldStatus, ColumnResolutionStatus }; //# sourceMappingURL=data_column.d.ts.map