@platforma-sdk/model 1.86.5 → 1.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/columns/column_providers/providers.cjs +2 -10
- package/dist/columns/column_providers/providers.cjs.map +1 -1
- package/dist/columns/column_providers/providers.d.ts.map +1 -1
- package/dist/columns/column_providers/providers.js +3 -11
- package/dist/columns/column_providers/providers.js.map +1 -1
- package/dist/columns/column_recipes/index.cjs +2 -2
- package/dist/columns/column_recipes/index.cjs.map +1 -1
- package/dist/columns/column_recipes/index.d.ts +2 -3
- package/dist/columns/column_recipes/index.d.ts.map +1 -1
- package/dist/columns/column_recipes/index.js +2 -2
- package/dist/columns/column_recipes/index.js.map +1 -1
- package/dist/columns/data_column.cjs +12 -42
- package/dist/columns/data_column.cjs.map +1 -1
- package/dist/columns/data_column.d.ts +10 -26
- package/dist/columns/data_column.d.ts.map +1 -1
- package/dist/columns/data_column.js +13 -42
- package/dist/columns/data_column.js.map +1 -1
- package/dist/columns/index.cjs +0 -1
- package/dist/columns/index.d.ts +2 -2
- package/dist/columns/index.js +2 -2
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/package.json +1 -1
- package/src/columns/column_providers/providers.ts +3 -15
- package/src/columns/column_recipes/column_recipes.test.ts +11 -15
- package/src/columns/column_recipes/index.ts +2 -3
- package/src/columns/data_column.test.ts +13 -14
- package/src/columns/data_column.ts +12 -41
|
@@ -5,25 +5,6 @@ import { isNil } from "es-toolkit";
|
|
|
5
5
|
import { LRUCache } from "lru-cache";
|
|
6
6
|
// src/columns/data_column.ts
|
|
7
7
|
/**
|
|
8
|
-
* Thrown by leaf-recipe factories when the requested column is provably
|
|
9
|
-
* absent in the active render ctx — i.e. every relevant accessor reports
|
|
10
|
-
* `inputsLocked` and the column did not appear. Distinct from the
|
|
11
|
-
* `undefined` return that the factories still use for the "resolving" case
|
|
12
|
-
* (the column may still appear later).
|
|
13
|
-
*
|
|
14
|
-
* Catch at the boundary (resolver / filter+sort wiring / data-table assembly)
|
|
15
|
-
* when partial absence should be surfaced to the user rather than silently
|
|
16
|
-
* producing an empty result.
|
|
17
|
-
*/
|
|
18
|
-
var ColumnAbsentError = class extends Error {
|
|
19
|
-
id;
|
|
20
|
-
constructor(id) {
|
|
21
|
-
super(`Column is absent in the active render ctx and will not appear: ${id}`);
|
|
22
|
-
this.id = id;
|
|
23
|
-
this.name = "ColumnAbsentError";
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
8
|
* The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare
|
|
28
9
|
* {@link PObjectId} and whose readers are bound to a single tree-accessor
|
|
29
10
|
* leaf. Layered encodings (Overridden / Discovered / Filtered) are reified
|
|
@@ -75,19 +56,14 @@ var DataColumnImpl = class DataColumnImpl {
|
|
|
75
56
|
}
|
|
76
57
|
/**
|
|
77
58
|
* Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:
|
|
78
|
-
* returns `undefined`
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* exist in this ctx. Data and dataStatus stay lazy.
|
|
59
|
+
* returns `undefined` unless the id names a column whose spec is readable in
|
|
60
|
+
* this ctx — while it is resolving, when it is absent, and when the id names
|
|
61
|
+
* an export that is not a column (a `kind: "File"` object, for example).
|
|
62
|
+
* Data and dataStatus stay lazy.
|
|
83
63
|
*/
|
|
84
64
|
static fromId(id, { ctx } = {}) {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
if (isNil(leaf)) {
|
|
88
|
-
if (registry.isFinal()) throw new ColumnAbsentError(id);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
65
|
+
const leaf = new ColumnRegistry(getCtxProviders({ ctx })).resolve(id);
|
|
66
|
+
if (isNil(leaf)) return void 0;
|
|
91
67
|
return DataColumnImpl.fromAccessor(leaf);
|
|
92
68
|
}
|
|
93
69
|
/** {@link PlRef} wrapper over {@link fromId}. */
|
|
@@ -96,18 +72,13 @@ var DataColumnImpl = class DataColumnImpl {
|
|
|
96
72
|
}
|
|
97
73
|
/**
|
|
98
74
|
* Bind directly to an accessor-backed {@link LeafEntry} — no registry.
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
75
|
+
* Returns `undefined` unless the leaf's spec is readable and is a column
|
|
76
|
+
* spec: while the spec is resolving, when it is absent, and for an export
|
|
77
|
+
* that is not a column.
|
|
102
78
|
*/
|
|
103
79
|
static fromAccessor(entry) {
|
|
104
|
-
if (isNil(readSpecAccessor(entry))) {
|
|
105
|
-
if (entry.accessor.getInputsLocked()) throw new ColumnAbsentError(entry.id);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
80
|
const spec = readSpec(entry);
|
|
109
|
-
if (spec === void 0) return void 0;
|
|
110
|
-
if (!isPColumnSpec(spec)) throw new ColumnAbsentError(entry.id);
|
|
81
|
+
if (spec === void 0 || !isPColumnSpec(spec)) return void 0;
|
|
111
82
|
return new DataColumnImpl(entry.id, {
|
|
112
83
|
getSpec: () => spec,
|
|
113
84
|
getData: () => readDataAccessor(entry),
|
|
@@ -132,8 +103,8 @@ var DataColumnImpl = class DataColumnImpl {
|
|
|
132
103
|
* in the active render ctx. Falls back to the registry's `isFinal()`
|
|
133
104
|
* when the id has no entry — only then we can say `absent` instead of
|
|
134
105
|
* `resolving`. The status tells only whether the spec is readable: for an
|
|
135
|
-
* export that is not a column it is `present`, and the factories
|
|
136
|
-
*
|
|
106
|
+
* export that is not a column it is `present`, and the factories return
|
|
107
|
+
* `undefined`.
|
|
137
108
|
*/
|
|
138
109
|
static getStatusById(id, { ctx } = {}) {
|
|
139
110
|
const registry = new ColumnRegistry(getCtxProviders({ ctx }));
|
|
@@ -243,6 +214,6 @@ function memoizeByEntry(fn) {
|
|
|
243
214
|
return hit.value;
|
|
244
215
|
};
|
|
245
216
|
}
|
|
246
|
-
export {
|
|
217
|
+
export { DataColumn, DataColumnImpl, isDataColumn };
|
|
247
218
|
|
|
248
219
|
//# sourceMappingURL=data_column.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data_column.js","names":[],"sources":["../../src/columns/data_column.ts"],"sourcesContent":["import {\n ColumnRegistry,\n createGlobalPObjectId,\n isPColumn,\n isPColumnSpec,\n isPlRef,\n PlRef,\n PObjectId,\n type ColumnUniversalId,\n type LeafEntry,\n type PColumn,\n type PColumnSpec,\n type PObjectSpec,\n type SpecOverrides,\n type SpecQuery,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx, PColumnDataUniversal } from \"../render/internal\";\nimport { getCtxProviders } from \"./column_providers\";\nimport { isNil } from \"es-toolkit\";\nimport { LRUCache } from \"lru-cache\";\nimport { TreeNodeAccessor } from \"../render\";\nimport type {\n ColumnFieldStatus,\n ColumnRecipe,\n ColumnRecipeId,\n ColumnResolutionStatus,\n} from \"./column_recipes/types\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\n\nexport type DataColumnId = PObjectId;\nexport type ColumnData = undefined | PColumnDataUniversal;\nexport type { ColumnFieldStatus, ColumnResolutionStatus } from \"./column_recipes/types\";\n\n/**\n * A {@link ColumnRecipe} that can be read directly in the sandbox: its\n * {@link getData} is guaranteed to be consistent with {@link getSpec}.\n *\n * This is a *capability*, not a class. Only two recipe shapes carry it — a\n * bare leaf and a spec-override over a bare leaf — because those are the only\n * ones whose data still matches their spec. An axis-filtered recipe drops axes\n * from its spec while the underlying data keeps them, and a discovered recipe\n * only materialises after a join; neither can be read here, so neither\n * implements this interface.\n *\n * Narrow to it with `hasReachableData(recipe)` rather than testing for a concrete\n * class — which recipe classes exist is an implementation detail behind\n * `recipe.id`.\n */\nexport interface DataColumnRecipe<\n ID extends ColumnRecipeId = ColumnRecipeId,\n> extends ColumnRecipe<ID> {\n /** Column data, consistent with {@link ColumnRecipe.getSpec}. */\n getData(): ColumnData;\n}\n\n/**\n * Thrown by leaf-recipe factories when the requested column is provably\n * absent in the active render ctx — i.e. every relevant accessor reports\n * `inputsLocked` and the column did not appear. Distinct from the\n * `undefined` return that the factories still use for the \"resolving\" case\n * (the column may still appear later).\n *\n * Catch at the boundary (resolver / filter+sort wiring / data-table assembly)\n * when partial absence should be surfaced to the user rather than silently\n * producing an empty result.\n */\nexport class ColumnAbsentError extends Error {\n constructor(public readonly id: ColumnUniversalId) {\n super(`Column is absent in the active render ctx and will not appear: ${id}`);\n this.name = \"ColumnAbsentError\";\n }\n}\n\n/**\n * The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare\n * {@link PObjectId} and whose readers are bound to a single tree-accessor\n * leaf. Layered encodings (Overridden / Discovered / Filtered) are reified\n * through their dedicated recipe classes and reference leaf columns by id.\n *\n * Internal — consumers hold the {@link DataColumnRecipe} interface and construct\n * through the {@link DataColumnRecipe} dispatcher.\n */\nexport class DataColumnImpl implements DataColumnRecipe<PObjectId> {\n private specCache?: { readonly value: PColumnSpec };\n private dataCache?: { readonly value: ColumnData };\n private dataStatusCache?: { readonly value: ColumnFieldStatus };\n\n private constructor(\n public readonly id: PObjectId,\n private readonly options: {\n getSpec: () => PColumnSpec;\n getData: () => ColumnData;\n getDataStatus: () => ColumnFieldStatus;\n },\n ) {}\n\n /** A leaf-recipe references exactly one column — its own id. */\n getReferencedIds(): PObjectId[] {\n return [this.id];\n }\n\n getSpec(): PColumnSpec {\n if (this.specCache === undefined) {\n this.specCache = { value: this.options.getSpec() };\n }\n return this.specCache.value;\n }\n\n /** Leaf-shaped — points straight at `this.id`. */\n getQuery(): SpecQuery {\n return { type: \"column\", column: this.id } as SpecQuery;\n }\n\n getData(): ColumnData {\n if (this.dataCache === undefined) this.dataCache = { value: this.options.getData() };\n return this.dataCache.value;\n }\n\n getDataStatus(): ColumnFieldStatus {\n if (this.dataStatusCache === undefined) {\n this.dataStatusCache = { value: this.options.getDataStatus() };\n }\n return this.dataStatusCache.value;\n }\n\n /**\n * Overlay overrides → produces a {@link ColumnOverriddenRecipe} wrapping\n * this leaf. The leaf itself stays bare (id remains a plain PObjectId);\n * layering lives entirely in the recipe wrappers.\n */\n withSpecs(overrides: SpecOverrides): ColumnRecipe {\n return ColumnOverriddenRecipe.wrap(this, overrides);\n }\n\n /**\n * Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:\n * returns `undefined` if the leaf isn't reachable yet (resolving). Throws\n * {@link ColumnAbsentError} when every relevant accessor is `inputsLocked`\n * and the column did not appear, or when the id names an export that is not\n * a column (a `kind: \"File\"` object, for example) — the column will not\n * exist in this ctx. Data and dataStatus stay lazy.\n */\n static fromId(\n id: PObjectId,\n { ctx }: { ctx?: GlobalCfgRenderCtx } = {},\n ): undefined | DataColumnRecipe<PObjectId> {\n const registry = new ColumnRegistry(getCtxProviders({ ctx }));\n const leaf = registry.resolve(id);\n if (isNil(leaf)) {\n if (registry.isFinal()) throw new ColumnAbsentError(id);\n return undefined;\n }\n return DataColumnImpl.fromAccessor(leaf);\n }\n\n /** {@link PlRef} wrapper over {@link fromId}. */\n static fromPlRef(ref: PlRef): undefined | DataColumnRecipe<PObjectId> {\n return DataColumnImpl.fromId(createGlobalPObjectId(ref.blockId, ref.name));\n }\n\n /**\n * Bind directly to an accessor-backed {@link LeafEntry} — no registry.\n * Throws {@link ColumnAbsentError} if the leaf has no spec field and its\n * accessor is `inputsLocked`, or if it names an export that is not a column.\n * Returns `undefined` while still resolving.\n */\n static fromAccessor(entry: LeafEntry<TreeNodeAccessor>): undefined | DataColumnRecipe<PObjectId> {\n if (isNil(readSpecAccessor(entry))) {\n if (entry.accessor.getInputsLocked()) throw new ColumnAbsentError(entry.id);\n return undefined;\n }\n const spec = readSpec(entry);\n if (spec === undefined) return undefined;\n if (!isPColumnSpec(spec)) throw new ColumnAbsentError(entry.id);\n return new DataColumnImpl(entry.id, {\n getSpec: () => spec,\n getData: () => readDataAccessor(entry),\n getDataStatus: () => readDataStatus(entry),\n });\n }\n\n /**\n * Wrap a materialised {@link PColumn}. If the input is already a\n * {@link DataColumnRecipe} leaf it is returned as-is.\n */\n static fromColumn(\n column: PColumn<ColumnData> | DataColumnRecipe<PObjectId>,\n ): DataColumnRecipe<PObjectId> {\n if (column instanceof DataColumnImpl) return column;\n // `DataColumnRecipe` is an interface, so `instanceof` above does not remove it\n // from the union. The only implementation carrying a bare `PObjectId` is\n // `DataColumnImpl` (wrappers expose `ColumnUniversalId`), so anything\n // reaching here is a materialised `PColumn`.\n const pColumn = column as PColumn<ColumnData>;\n return new DataColumnImpl(pColumn.id, {\n getSpec: () => pColumn.spec,\n getData: () => pColumn.data,\n getDataStatus: () => \"present\",\n });\n }\n\n /**\n * Distinguishes `present` / `resolving` / `absent` for a {@link PObjectId}\n * in the active render ctx. Falls back to the registry's `isFinal()`\n * when the id has no entry — only then we can say `absent` instead of\n * `resolving`. The status tells only whether the spec is readable: for an\n * export that is not a column it is `present`, and the factories throw\n * {@link ColumnAbsentError}.\n */\n static getStatusById(\n id: PObjectId,\n { ctx }: { ctx?: GlobalCfgRenderCtx } = {},\n ): ColumnResolutionStatus {\n const registry = new ColumnRegistry(getCtxProviders({ ctx }));\n const leaf = registry.resolve(id);\n if (isNil(leaf)) return registry.isFinal() ? \"absent\" : \"resolving\";\n return getLeafEntryStatus(leaf);\n }\n\n /** {@link PlRef} wrapper over {@link getStatusById}. */\n static getStatusByPlRef(\n ref: PlRef,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n ): ColumnResolutionStatus {\n return DataColumnImpl.getStatusById(createGlobalPObjectId(ref.blockId, ref.name), opts);\n }\n\n /** No registry — reads straight off the entry's accessor. */\n static getStatusByAccessor(entry: LeafEntry<TreeNodeAccessor>): ColumnResolutionStatus {\n return getLeafEntryStatus(entry);\n }\n}\n\n/** Anything the {@link DataColumnRecipe} dispatcher can build a leaf from. */\nexport type DataColumnSource =\n | PObjectId\n | PlRef\n | LeafEntry<TreeNodeAccessor>\n | PColumn<ColumnData>\n | DataColumnRecipe<PObjectId>;\n\n/**\n * Unified dispatcher — picks the right `DataColumnImpl.fromX` by source\n * shape. For ambiguous inputs callers can still use the explicit factories\n * (also attached as properties: `DataColumn.fromId`, `.fromPlRef`,\n * `.fromAccessor`, `.fromColumn`).\n */\nfunction DataColumnDispatch(\n source: DataColumnSource,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): undefined | DataColumnRecipe<PObjectId> {\n if (typeof source === \"string\") return DataColumnImpl.fromId(source, opts);\n if (source instanceof DataColumnImpl) return source;\n // `DataColumnRecipe` is an interface — `instanceof` above cannot remove it from\n // the union, and only `DataColumnImpl` implements it with a bare id.\n const rest = source as LeafEntry<TreeNodeAccessor> | PlRef | PColumn<ColumnData>;\n if (\"accessor\" in rest) return DataColumnImpl.fromAccessor(rest);\n if (isPlRef(rest)) return DataColumnImpl.fromPlRef(rest);\n if (isPColumn(rest)) return DataColumnImpl.fromColumn(rest);\n throw new Error(\"DataColumn: unknown source shape\");\n}\n\n/**\n * Polymorphic counterpart to {@link DataColumnDispatch}: returns the\n * {@link ColumnResolutionStatus} for any factory input without constructing\n * the recipe. For already-materialised sources ({@link PColumn} value,\n * existing {@link DataColumnRecipe}) status is `present` by construction.\n */\nfunction DataColumnGetStatus(\n source: DataColumnSource,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnResolutionStatus {\n if (typeof source === \"string\") return DataColumnImpl.getStatusById(source, opts);\n if (source instanceof DataColumnImpl) return \"present\";\n const rest = source as LeafEntry<TreeNodeAccessor> | PlRef | PColumn<ColumnData>;\n if (\"accessor\" in rest) return DataColumnImpl.getStatusByAccessor(rest);\n if (isPlRef(rest)) return DataColumnImpl.getStatusByPlRef(rest, opts);\n if (isPColumn(rest)) return \"present\";\n throw new Error(\"DataColumn.getStatus: unknown source shape\");\n}\n\nexport const DataColumn = Object.assign(DataColumnDispatch, {\n fromId: DataColumnImpl.fromId,\n fromPlRef: DataColumnImpl.fromPlRef,\n fromAccessor: DataColumnImpl.fromAccessor,\n fromColumn: DataColumnImpl.fromColumn,\n getStatus: DataColumnGetStatus,\n getStatusById: DataColumnImpl.getStatusById,\n getStatusByPlRef: DataColumnImpl.getStatusByPlRef,\n getStatusByAccessor: DataColumnImpl.getStatusByAccessor,\n});\n\n/**\n * Type-guard narrowing to a bare leaf — a {@link DataColumnRecipe} whose `id` is a\n * plain {@link PObjectId}.\n */\nexport function isDataColumn(value: unknown): value is DataColumnRecipe<PObjectId> {\n return value instanceof DataColumnImpl;\n}\n\nconst readSpecAccessor = memoizeByEntry(\n ({ accessor, name }: LeafEntry<TreeNodeAccessor>): undefined | TreeNodeAccessor =>\n accessor.traverse({ field: `${name}.spec`, assertFieldType: \"Input\", ignoreError: true }),\n);\n\n/** The leaf's spec, or `undefined` until the spec resource has data. */\nconst readSpec = memoizeByEntry((entry: LeafEntry<TreeNodeAccessor>): undefined | PObjectSpec => {\n const spec = readSpecAccessor(entry);\n if (isNil(spec) || !spec.hasData()) return undefined;\n return spec.getDataAsJson<PObjectSpec>();\n});\n\n/**\n * Per-entry counterpart to {@link readDataStatus}: tells whether the leaf's\n * **spec** can be read in this ctx, and — for the negative cases —\n * distinguishes `resolving` from `absent` via `getInputsLocked()`.\n *\n * - spec field not yet on the entry's accessor + inputs locked → `absent`\n * - spec field not yet on the entry's accessor + still resolving → `resolving`\n * - spec resource present but bytes not yet written → `resolving`\n * (transient — the spec resource is connected, just unfilled)\n * - spec resource present and `hasData()` → `present`\n */\nfunction getLeafEntryStatus(entry: LeafEntry<TreeNodeAccessor>): ColumnResolutionStatus {\n const spec = readSpecAccessor(entry);\n if (isNil(spec)) return entry.accessor.getInputsLocked() ? \"absent\" : \"resolving\";\n if (!spec.hasData()) return \"resolving\";\n return \"present\";\n}\n\nconst readDataAccessor = memoizeByEntry(\n ({ accessor, name }: LeafEntry<TreeNodeAccessor>): undefined | TreeNodeAccessor =>\n accessor.traverse({ field: `${name}.data`, assertFieldType: \"Input\", ignoreError: true }),\n);\n\nconst readDataStatus = memoizeByEntry(\n ({ accessor, name }: LeafEntry<TreeNodeAccessor>): ColumnFieldStatus => {\n if (accessor.listInputFields().includes(`${name}.data`)) return \"present\";\n return accessor.getInputsLocked() ? \"absent\" : \"resolving\";\n },\n);\n\nfunction memoizeByEntry<R>(\n fn: (entry: LeafEntry<TreeNodeAccessor>) => R,\n): (entry: LeafEntry<TreeNodeAccessor>) => R {\n const cache = new LRUCache<string, { value: R }>({ max: 1000 });\n return (entry) => {\n const key = `${entry.accessor.handle}:${entry.name}`;\n let hit = cache.get(key);\n if (!hit) cache.set(key, (hit = { value: fn(entry) }));\n return hit.value;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkEA,IAAa,oBAAb,cAAuC,MAAM;CACf;CAA5B,YAAY,IAAuC;EACjD,MAAM,kEAAkE,IAAI;EADlD,KAAA,KAAA;EAE1B,KAAK,OAAO;CACd;AACF;;;;;;;;;;AAWA,IAAa,iBAAb,MAAa,eAAsD;CAM/C;CACC;CANnB;CACA;CACA;CAEA,YACE,IACA,SAKA;EANgB,KAAA,KAAA;EACC,KAAA,UAAA;CAKhB;;CAGH,mBAAgC;EAC9B,OAAO,CAAC,KAAK,EAAE;CACjB;CAEA,UAAuB;EACrB,IAAI,KAAK,cAAc,KAAA,GACrB,KAAK,YAAY,EAAE,OAAO,KAAK,QAAQ,QAAQ,EAAE;EAEnD,OAAO,KAAK,UAAU;CACxB;;CAGA,WAAsB;EACpB,OAAO;GAAE,MAAM;GAAU,QAAQ,KAAK;EAAG;CAC3C;CAEA,UAAsB;EACpB,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,EAAE,OAAO,KAAK,QAAQ,QAAQ,EAAE;EACnF,OAAO,KAAK,UAAU;CACxB;CAEA,gBAAmC;EACjC,IAAI,KAAK,oBAAoB,KAAA,GAC3B,KAAK,kBAAkB,EAAE,OAAO,KAAK,QAAQ,cAAc,EAAE;EAE/D,OAAO,KAAK,gBAAgB;CAC9B;;;;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B;AAC1B;AAEA,MAAM,mBAAmB,gBACtB,EAAE,UAAU,WACX,SAAS,SAAS;CAAE,OAAO,GAAG,KAAK;CAAQ,iBAAiB;CAAS,aAAa;AAAK,CAAC,CAC5F;;AAGA,MAAM,WAAW,gBAAgB,UAAgE;CAC/F,MAAM,OAAO,iBAAiB,KAAK;CACnC,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,QAAQ,GAAG,OAAO,KAAA;CAC3C,OAAO,KAAK,cAA2B;AACzC,CAAC;;;;;;;;;;;;AAaD,SAAS,mBAAmB,OAA4D;CACtF,MAAM,OAAO,iBAAiB,KAAK;CACnC,IAAI,MAAM,IAAI,GAAG,OAAO,MAAM,SAAS,gBAAgB,IAAI,WAAW;CACtE,IAAI,CAAC,KAAK,QAAQ,GAAG,OAAO;CAC5B,OAAO;AACT;AAEA,MAAM,mBAAmB,gBACtB,EAAE,UAAU,WACX,SAAS,SAAS;CAAE,OAAO,GAAG,KAAK;CAAQ,iBAAiB;CAAS,aAAa;AAAK,CAAC,CAC5F;AAEA,MAAM,iBAAiB,gBACpB,EAAE,UAAU,WAA2D;CACtE,IAAI,SAAS,gBAAgB,CAAC,CAAC,SAAS,GAAG,KAAK,MAAM,GAAG,OAAO;CAChE,OAAO,SAAS,gBAAgB,IAAI,WAAW;AACjD,CACF;AAEA,SAAS,eACP,IAC2C;CAC3C,MAAM,QAAQ,IAAI,SAA+B,EAAE,KAAK,IAAK,CAAC;CAC9D,QAAQ,UAAU;EAChB,MAAM,MAAM,GAAG,MAAM,SAAS,OAAO,GAAG,MAAM;EAC9C,IAAI,MAAM,MAAM,IAAI,GAAG;EACvB,IAAI,CAAC,KAAK,MAAM,IAAI,KAAM,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,CAAE;EACrD,OAAO,IAAI;CACb;AACF"}
|
|
1
|
+
{"version":3,"file":"data_column.js","names":[],"sources":["../../src/columns/data_column.ts"],"sourcesContent":["import {\n ColumnRegistry,\n createGlobalPObjectId,\n isPColumn,\n isPColumnSpec,\n isPlRef,\n PlRef,\n PObjectId,\n type LeafEntry,\n type PColumn,\n type PColumnSpec,\n type PObjectSpec,\n type SpecOverrides,\n type SpecQuery,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx, PColumnDataUniversal } from \"../render/internal\";\nimport { getCtxProviders } from \"./column_providers\";\nimport { isNil } from \"es-toolkit\";\nimport { LRUCache } from \"lru-cache\";\nimport { TreeNodeAccessor } from \"../render\";\nimport type {\n ColumnFieldStatus,\n ColumnRecipe,\n ColumnRecipeId,\n ColumnResolutionStatus,\n} from \"./column_recipes/types\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\n\nexport type DataColumnId = PObjectId;\nexport type ColumnData = undefined | PColumnDataUniversal;\nexport type { ColumnFieldStatus, ColumnResolutionStatus } from \"./column_recipes/types\";\n\n/**\n * A {@link ColumnRecipe} that can be read directly in the sandbox: its\n * {@link getData} is guaranteed to be consistent with {@link getSpec}.\n *\n * This is a *capability*, not a class. Only two recipe shapes carry it — a\n * bare leaf and a spec-override over a bare leaf — because those are the only\n * ones whose data still matches their spec. An axis-filtered recipe drops axes\n * from its spec while the underlying data keeps them, and a discovered recipe\n * only materialises after a join; neither can be read here, so neither\n * implements this interface.\n *\n * Narrow to it with `hasReachableData(recipe)` rather than testing for a concrete\n * class — which recipe classes exist is an implementation detail behind\n * `recipe.id`.\n */\nexport interface DataColumnRecipe<\n ID extends ColumnRecipeId = ColumnRecipeId,\n> extends ColumnRecipe<ID> {\n /** Column data, consistent with {@link ColumnRecipe.getSpec}. */\n getData(): ColumnData;\n}\n\n/**\n * The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare\n * {@link PObjectId} and whose readers are bound to a single tree-accessor\n * leaf. Layered encodings (Overridden / Discovered / Filtered) are reified\n * through their dedicated recipe classes and reference leaf columns by id.\n *\n * Internal — consumers hold the {@link DataColumnRecipe} interface and construct\n * through the {@link DataColumnRecipe} dispatcher.\n */\nexport class DataColumnImpl implements DataColumnRecipe<PObjectId> {\n private specCache?: { readonly value: PColumnSpec };\n private dataCache?: { readonly value: ColumnData };\n private dataStatusCache?: { readonly value: ColumnFieldStatus };\n\n private constructor(\n public readonly id: PObjectId,\n private readonly options: {\n getSpec: () => PColumnSpec;\n getData: () => ColumnData;\n getDataStatus: () => ColumnFieldStatus;\n },\n ) {}\n\n /** A leaf-recipe references exactly one column — its own id. */\n getReferencedIds(): PObjectId[] {\n return [this.id];\n }\n\n getSpec(): PColumnSpec {\n if (this.specCache === undefined) {\n this.specCache = { value: this.options.getSpec() };\n }\n return this.specCache.value;\n }\n\n /** Leaf-shaped — points straight at `this.id`. */\n getQuery(): SpecQuery {\n return { type: \"column\", column: this.id } as SpecQuery;\n }\n\n getData(): ColumnData {\n if (this.dataCache === undefined) this.dataCache = { value: this.options.getData() };\n return this.dataCache.value;\n }\n\n getDataStatus(): ColumnFieldStatus {\n if (this.dataStatusCache === undefined) {\n this.dataStatusCache = { value: this.options.getDataStatus() };\n }\n return this.dataStatusCache.value;\n }\n\n /**\n * Overlay overrides → produces a {@link ColumnOverriddenRecipe} wrapping\n * this leaf. The leaf itself stays bare (id remains a plain PObjectId);\n * layering lives entirely in the recipe wrappers.\n */\n withSpecs(overrides: SpecOverrides): ColumnRecipe {\n return ColumnOverriddenRecipe.wrap(this, overrides);\n }\n\n /**\n * Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:\n * returns `undefined` unless the id names a column whose spec is readable in\n * this ctx — while it is resolving, when it is absent, and when the id names\n * an export that is not a column (a `kind: \"File\"` object, for example).\n * Data and dataStatus stay lazy.\n */\n static fromId(\n id: PObjectId,\n { ctx }: { ctx?: GlobalCfgRenderCtx } = {},\n ): undefined | DataColumnRecipe<PObjectId> {\n const leaf = new ColumnRegistry(getCtxProviders({ ctx })).resolve(id);\n if (isNil(leaf)) return undefined;\n return DataColumnImpl.fromAccessor(leaf);\n }\n\n /** {@link PlRef} wrapper over {@link fromId}. */\n static fromPlRef(ref: PlRef): undefined | DataColumnRecipe<PObjectId> {\n return DataColumnImpl.fromId(createGlobalPObjectId(ref.blockId, ref.name));\n }\n\n /**\n * Bind directly to an accessor-backed {@link LeafEntry} — no registry.\n * Returns `undefined` unless the leaf's spec is readable and is a column\n * spec: while the spec is resolving, when it is absent, and for an export\n * that is not a column.\n */\n static fromAccessor(entry: LeafEntry<TreeNodeAccessor>): undefined | DataColumnRecipe<PObjectId> {\n const spec = readSpec(entry);\n if (spec === undefined || !isPColumnSpec(spec)) return undefined;\n return new DataColumnImpl(entry.id, {\n getSpec: () => spec,\n getData: () => readDataAccessor(entry),\n getDataStatus: () => readDataStatus(entry),\n });\n }\n\n /**\n * Wrap a materialised {@link PColumn}. If the input is already a\n * {@link DataColumnRecipe} leaf it is returned as-is.\n */\n static fromColumn(\n column: PColumn<ColumnData> | DataColumnRecipe<PObjectId>,\n ): DataColumnRecipe<PObjectId> {\n if (column instanceof DataColumnImpl) return column;\n // `DataColumnRecipe` is an interface, so `instanceof` above does not remove it\n // from the union. The only implementation carrying a bare `PObjectId` is\n // `DataColumnImpl` (wrappers expose `ColumnUniversalId`), so anything\n // reaching here is a materialised `PColumn`.\n const pColumn = column as PColumn<ColumnData>;\n return new DataColumnImpl(pColumn.id, {\n getSpec: () => pColumn.spec,\n getData: () => pColumn.data,\n getDataStatus: () => \"present\",\n });\n }\n\n /**\n * Distinguishes `present` / `resolving` / `absent` for a {@link PObjectId}\n * in the active render ctx. Falls back to the registry's `isFinal()`\n * when the id has no entry — only then we can say `absent` instead of\n * `resolving`. The status tells only whether the spec is readable: for an\n * export that is not a column it is `present`, and the factories return\n * `undefined`.\n */\n static getStatusById(\n id: PObjectId,\n { ctx }: { ctx?: GlobalCfgRenderCtx } = {},\n ): ColumnResolutionStatus {\n const registry = new ColumnRegistry(getCtxProviders({ ctx }));\n const leaf = registry.resolve(id);\n if (isNil(leaf)) return registry.isFinal() ? \"absent\" : \"resolving\";\n return getLeafEntryStatus(leaf);\n }\n\n /** {@link PlRef} wrapper over {@link getStatusById}. */\n static getStatusByPlRef(\n ref: PlRef,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n ): ColumnResolutionStatus {\n return DataColumnImpl.getStatusById(createGlobalPObjectId(ref.blockId, ref.name), opts);\n }\n\n /** No registry — reads straight off the entry's accessor. */\n static getStatusByAccessor(entry: LeafEntry<TreeNodeAccessor>): ColumnResolutionStatus {\n return getLeafEntryStatus(entry);\n }\n}\n\n/** Anything the {@link DataColumnRecipe} dispatcher can build a leaf from. */\nexport type DataColumnSource =\n | PObjectId\n | PlRef\n | LeafEntry<TreeNodeAccessor>\n | PColumn<ColumnData>\n | DataColumnRecipe<PObjectId>;\n\n/**\n * Unified dispatcher — picks the right `DataColumnImpl.fromX` by source\n * shape. For ambiguous inputs callers can still use the explicit factories\n * (also attached as properties: `DataColumn.fromId`, `.fromPlRef`,\n * `.fromAccessor`, `.fromColumn`).\n */\nfunction DataColumnDispatch(\n source: DataColumnSource,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): undefined | DataColumnRecipe<PObjectId> {\n if (typeof source === \"string\") return DataColumnImpl.fromId(source, opts);\n if (source instanceof DataColumnImpl) return source;\n // `DataColumnRecipe` is an interface — `instanceof` above cannot remove it from\n // the union, and only `DataColumnImpl` implements it with a bare id.\n const rest = source as LeafEntry<TreeNodeAccessor> | PlRef | PColumn<ColumnData>;\n if (\"accessor\" in rest) return DataColumnImpl.fromAccessor(rest);\n if (isPlRef(rest)) return DataColumnImpl.fromPlRef(rest);\n if (isPColumn(rest)) return DataColumnImpl.fromColumn(rest);\n throw new Error(\"DataColumn: unknown source shape\");\n}\n\n/**\n * Polymorphic counterpart to {@link DataColumnDispatch}: returns the\n * {@link ColumnResolutionStatus} for any factory input without constructing\n * the recipe. For already-materialised sources ({@link PColumn} value,\n * existing {@link DataColumnRecipe}) status is `present` by construction.\n */\nfunction DataColumnGetStatus(\n source: DataColumnSource,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnResolutionStatus {\n if (typeof source === \"string\") return DataColumnImpl.getStatusById(source, opts);\n if (source instanceof DataColumnImpl) return \"present\";\n const rest = source as LeafEntry<TreeNodeAccessor> | PlRef | PColumn<ColumnData>;\n if (\"accessor\" in rest) return DataColumnImpl.getStatusByAccessor(rest);\n if (isPlRef(rest)) return DataColumnImpl.getStatusByPlRef(rest, opts);\n if (isPColumn(rest)) return \"present\";\n throw new Error(\"DataColumn.getStatus: unknown source shape\");\n}\n\nexport const DataColumn = Object.assign(DataColumnDispatch, {\n fromId: DataColumnImpl.fromId,\n fromPlRef: DataColumnImpl.fromPlRef,\n fromAccessor: DataColumnImpl.fromAccessor,\n fromColumn: DataColumnImpl.fromColumn,\n getStatus: DataColumnGetStatus,\n getStatusById: DataColumnImpl.getStatusById,\n getStatusByPlRef: DataColumnImpl.getStatusByPlRef,\n getStatusByAccessor: DataColumnImpl.getStatusByAccessor,\n});\n\n/**\n * Type-guard narrowing to a bare leaf — a {@link DataColumnRecipe} whose `id` is a\n * plain {@link PObjectId}.\n */\nexport function isDataColumn(value: unknown): value is DataColumnRecipe<PObjectId> {\n return value instanceof DataColumnImpl;\n}\n\nconst readSpecAccessor = memoizeByEntry(\n ({ accessor, name }: LeafEntry<TreeNodeAccessor>): undefined | TreeNodeAccessor =>\n accessor.traverse({ field: `${name}.spec`, assertFieldType: \"Input\", ignoreError: true }),\n);\n\n/** The leaf's spec, or `undefined` until the spec resource has data. */\nconst readSpec = memoizeByEntry((entry: LeafEntry<TreeNodeAccessor>): undefined | PObjectSpec => {\n const spec = readSpecAccessor(entry);\n if (isNil(spec) || !spec.hasData()) return undefined;\n return spec.getDataAsJson<PObjectSpec>();\n});\n\n/**\n * Per-entry counterpart to {@link readDataStatus}: tells whether the leaf's\n * **spec** can be read in this ctx, and — for the negative cases —\n * distinguishes `resolving` from `absent` via `getInputsLocked()`.\n *\n * - spec field not yet on the entry's accessor + inputs locked → `absent`\n * - spec field not yet on the entry's accessor + still resolving → `resolving`\n * - spec resource present but bytes not yet written → `resolving`\n * (transient — the spec resource is connected, just unfilled)\n * - spec resource present and `hasData()` → `present`\n */\nfunction getLeafEntryStatus(entry: LeafEntry<TreeNodeAccessor>): ColumnResolutionStatus {\n const spec = readSpecAccessor(entry);\n if (isNil(spec)) return entry.accessor.getInputsLocked() ? \"absent\" : \"resolving\";\n if (!spec.hasData()) return \"resolving\";\n return \"present\";\n}\n\nconst readDataAccessor = memoizeByEntry(\n ({ accessor, name }: LeafEntry<TreeNodeAccessor>): undefined | TreeNodeAccessor =>\n accessor.traverse({ field: `${name}.data`, assertFieldType: \"Input\", ignoreError: true }),\n);\n\nconst readDataStatus = memoizeByEntry(\n ({ accessor, name }: LeafEntry<TreeNodeAccessor>): ColumnFieldStatus => {\n if (accessor.listInputFields().includes(`${name}.data`)) return \"present\";\n return accessor.getInputsLocked() ? \"absent\" : \"resolving\";\n },\n);\n\nfunction memoizeByEntry<R>(\n fn: (entry: LeafEntry<TreeNodeAccessor>) => R,\n): (entry: LeafEntry<TreeNodeAccessor>) => R {\n const cache = new LRUCache<string, { value: R }>({ max: 1000 });\n return (entry) => {\n const key = `${entry.accessor.handle}:${entry.name}`;\n let hit = cache.get(key);\n if (!hit) cache.set(key, (hit = { value: fn(entry) }));\n return hit.value;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+DA,IAAa,iBAAb,MAAa,eAAsD;CAM/C;CACC;CANnB;CACA;CACA;CAEA,YACE,IACA,SAKA;EANgB,KAAA,KAAA;EACC,KAAA,UAAA;CAKhB;;CAGH,mBAAgC;EAC9B,OAAO,CAAC,KAAK,EAAE;CACjB;CAEA,UAAuB;EACrB,IAAI,KAAK,cAAc,KAAA,GACrB,KAAK,YAAY,EAAE,OAAO,KAAK,QAAQ,QAAQ,EAAE;EAEnD,OAAO,KAAK,UAAU;CACxB;;CAGA,WAAsB;EACpB,OAAO;GAAE,MAAM;GAAU,QAAQ,KAAK;EAAG;CAC3C;CAEA,UAAsB;EACpB,IAAI,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.AccessorColumnsProviderImpl = require_providers.AccessorColumnsProviderImpl;
|
|
16
16
|
exports.ArrayColumnsProvider = require_providers.ArrayColumnsProvider;
|
|
17
17
|
exports.Column = require_column.Column;
|
|
18
|
-
exports.ColumnAbsentError = require_data_column.ColumnAbsentError;
|
|
19
18
|
exports.ColumnDiscoveredRecipe = require_column_discovered_recipe.ColumnDiscoveredRecipe;
|
|
20
19
|
exports.ColumnFilteredRecipe = require_column_filtered_recipe.ColumnFilteredRecipe;
|
|
21
20
|
exports.ColumnOverriddenRecipe = require_column_overrided_recipe.ColumnOverriddenRecipe;
|
package/dist/columns/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from "./column_recipes/types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ColumnData, DataColumn, DataColumnId, DataColumnImpl, DataColumnRecipe, DataColumnSource, isDataColumn } from "./data_column.js";
|
|
3
3
|
import { ColumnDiscoveredRecipe } from "./column_recipes/column_discovered_recipe.js";
|
|
4
4
|
import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe.js";
|
|
5
5
|
import { Column, ColumnSource, isColumn } from "./column.js";
|
|
@@ -13,4 +13,4 @@ import { ColumnsCollection, ColumnsCollectionDeps, ColumnsCollectionImpl, Column
|
|
|
13
13
|
import { deriveAxisValuesLabels } from "./derive_axis_values_labels.js";
|
|
14
14
|
import { ColumnOption, collectLinkerColumns, collectLinkerIds, createPeerLinkFinder, deriveColumnOptions, deriveRecipeOptions, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, isLeafColumn, queriesQualifications } from "./utils.js";
|
|
15
15
|
import { DatasetAxes, collectDatasetAxes, describePeerLinks, findPeerLinks, getResultPoolDatasetAxes, peerLinkedLast } from "./peer_links.js";
|
|
16
|
-
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, Column,
|
|
16
|
+
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, Column, ColumnData, ColumnDiscoveredRecipe, type ColumnFieldStatus, ColumnFilteredRecipe, ColumnOption, ColumnOverriddenRecipe, ColumnRecipe, type ColumnRecipeId, type ColumnResolutionStatus, ColumnSource, ColumnsCollection, ColumnsCollectionDeps, ColumnsCollectionImpl, ColumnsProvider, ColumnsSource, ColumnsSourceShorthand, DataColumn, DataColumnId, DataColumnImpl, DataColumnRecipe, DataColumnSource, DatasetAxes, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl, type SpecQuery, SplitAxis, SplitByAxesOpts, _ctxProvidersCache, collectDatasetAxes, collectLinkerColumns, collectLinkerIds, createPeerLinkFinder, deriveAxisValuesLabels, deriveColumnOptions, deriveRecipeOptions, describePeerLinks, findPeerLinks, getCtxProviders, getResultPoolDatasetAxes, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, isColumn, isColumnProvider, isColumnsCollection, isDataColumn, isLeafColumn, peerLinkedLast, queriesQualifications, splitByAxes, toColumnProvider };
|
package/dist/columns/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ColumnDiscoveredRecipe } from "./column_recipes/column_discovered_recip
|
|
|
3
3
|
import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe.js";
|
|
4
4
|
import { ColumnRecipe } from "./column_recipes/index.js";
|
|
5
5
|
import { ColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe.js";
|
|
6
|
-
import {
|
|
6
|
+
import { DataColumn, DataColumnImpl, isDataColumn } from "./data_column.js";
|
|
7
7
|
import { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, ColumnsProvider, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl } from "./column_providers/providers.js";
|
|
8
8
|
import { _ctxProvidersCache, getCtxProviders, isColumnProvider, toColumnProvider } from "./column_providers/index.js";
|
|
9
9
|
import { ColumnsCollection, ColumnsCollectionImpl, isColumnsCollection } from "./columns_collection.js";
|
|
@@ -11,4 +11,4 @@ import { collectDatasetAxes, describePeerLinks, findPeerLinks, getResultPoolData
|
|
|
11
11
|
import { collectLinkerColumns, collectLinkerIds, createPeerLinkFinder, deriveColumnOptions, deriveRecipeOptions, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, isLeafColumn, queriesQualifications } from "./utils.js";
|
|
12
12
|
import { deriveAxisValuesLabels } from "./derive_axis_values_labels.js";
|
|
13
13
|
import { splitByAxes } from "./split_by_axes.js";
|
|
14
|
-
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, Column,
|
|
14
|
+
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, Column, ColumnDiscoveredRecipe, ColumnFilteredRecipe, ColumnOverriddenRecipe, ColumnRecipe, ColumnsCollection, ColumnsCollectionImpl, ColumnsProvider, DataColumn, DataColumnImpl, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl, _ctxProvidersCache, collectDatasetAxes, collectLinkerColumns, collectLinkerIds, createPeerLinkFinder, deriveAxisValuesLabels, deriveColumnOptions, deriveRecipeOptions, describePeerLinks, findPeerLinks, getCtxProviders, getResultPoolDatasetAxes, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, isColumn, isColumnProvider, isColumnsCollection, isDataColumn, isLeafColumn, peerLinkedLast, queriesQualifications, splitByAxes, toColumnProvider };
|
package/dist/index.cjs
CHANGED
|
@@ -77,7 +77,6 @@ exports.BlockRenderCtx = require_api.BlockRenderCtx;
|
|
|
77
77
|
exports.BlockStorageFacadeCallbacks = require_block_storage_facade.BlockStorageFacadeCallbacks;
|
|
78
78
|
exports.BlockStorageFacadeHandles = require_block_storage_facade.BlockStorageFacadeHandles;
|
|
79
79
|
exports.Column = require_column.Column;
|
|
80
|
-
exports.ColumnAbsentError = require_data_column.ColumnAbsentError;
|
|
81
80
|
exports.ColumnDiscoveredRecipe = require_column_discovered_recipe.ColumnDiscoveredRecipe;
|
|
82
81
|
exports.ColumnFilteredRecipe = require_column_filtered_recipe.ColumnFilteredRecipe;
|
|
83
82
|
exports.ColumnOverriddenRecipe = require_column_overrided_recipe.ColumnOverriddenRecipe;
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ import "./annotations/index.js";
|
|
|
46
46
|
import { AnnotationScriptUi, AnnotationStepUi, AnyForm, FilterUi, FilterUiOfType, FilterUiType, FormField, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, compileAnnotationScript, compileFilter, compileFilters, unreachable } from "./components/PlAnnotations/filters_ui.js";
|
|
47
47
|
import { DatasetOption, DatasetSelection, createDatasetSelection, isDatasetSelection } from "./components/PlDatasetSelector/dataset_selection.js";
|
|
48
48
|
import { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from "./columns/column_recipes/types.js";
|
|
49
|
-
import {
|
|
49
|
+
import { ColumnData, DataColumn, DataColumnId, DataColumnImpl, DataColumnRecipe, DataColumnSource, isDataColumn } from "./columns/data_column.js";
|
|
50
50
|
import { ColumnDiscoveredRecipe } from "./columns/column_recipes/column_discovered_recipe.js";
|
|
51
51
|
import { ColumnFilteredRecipe } from "./columns/column_recipes/column_filtered_recipe.js";
|
|
52
52
|
import { Column, ColumnSource, isColumn } from "./columns/column.js";
|
|
@@ -86,4 +86,4 @@ import "./services/index.js";
|
|
|
86
86
|
import { getEnvironmentValue } from "./env_value.js";
|
|
87
87
|
export * from "@milaboratories/pl-model-common";
|
|
88
88
|
export * from "@milaboratories/pl-error-like";
|
|
89
|
-
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, type AccessorHandle, AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationScriptUi, AnnotationSpec, AnnotationSpecUi, AnnotationStep, AnnotationStepUi, AnyForm, ArrayColumnsProvider, type AxesVault, AxisLabelProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockApiV1, BlockApiV2, BlockConfig, BlockConfigV3, BlockConfigV4, BlockDefaultModelServices, BlockDefaultUiServices, BlockModelInfo, BlockModelV3, BlockRenderCtx, BlockServiceFlags, BlockStatePatch, type BlockStorage, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, type BlockStorageSchemaVersion, BuildDatasetOptions, CancelSubscription, Cfg, CfgAnd, CfgBlobContent, CfgBlobContentAsJson, CfgBlobContentAsString, CfgDownloadedBlobContent, CfgExtractArchiveAndGetURL, CfgFlatten, CfgGetFromCtx, CfgGetJsonField, CfgGetResourceField, CfgImmediate, CfgImportProgress, CfgIsEmpty, CfgIsolate, CfgLastLogs, CfgLogHandle, CfgMakeArray, CfgMakeObject, CfgMapArrayValues, CfgMapRecordValues, CfgMapResourceFields, CfgNot, CfgOnDemandBlobContent, CfgOr, CfgProgressLog, CfgProgressLogWithInfo, CfgResourceValueAsJson, Column,
|
|
89
|
+
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, type AccessorHandle, AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationScriptUi, AnnotationSpec, AnnotationSpecUi, AnnotationStep, AnnotationStepUi, AnyForm, ArrayColumnsProvider, type AxesVault, AxisLabelProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockApiV1, BlockApiV2, BlockConfig, BlockConfigV3, BlockConfigV4, BlockDefaultModelServices, BlockDefaultUiServices, BlockModelInfo, BlockModelV3, BlockRenderCtx, BlockServiceFlags, BlockStatePatch, type BlockStorage, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, type BlockStorageSchemaVersion, BuildDatasetOptions, CancelSubscription, Cfg, CfgAnd, CfgBlobContent, CfgBlobContentAsJson, CfgBlobContentAsString, CfgDownloadedBlobContent, CfgExtractArchiveAndGetURL, CfgFlatten, CfgGetFromCtx, CfgGetJsonField, CfgGetResourceField, CfgImmediate, CfgImportProgress, CfgIsEmpty, CfgIsolate, CfgLastLogs, CfgLogHandle, CfgMakeArray, CfgMakeObject, CfgMapArrayValues, CfgMapRecordValues, CfgMapResourceFields, CfgNot, CfgOnDemandBlobContent, CfgOr, CfgProgressLog, CfgProgressLogWithInfo, CfgResourceValueAsJson, Column, ColumnData, ColumnDiscoveredRecipe, type ColumnFieldStatus, ColumnFilteredRecipe, ColumnOption, type ColumnOrderRule, ColumnOverriddenRecipe, ColumnProvider, ColumnRecipe, type ColumnRecipeId, type ColumnResolutionStatus, ColumnSource, type ColumnVisibilityRule, ColumnsCollection, ColumnsCollectionDeps, ColumnsCollectionImpl, type ColumnsDisplayOptions, ColumnsProvider, type ColumnsSelectorConfig, ColumnsSource, ColumnsSourceShorthand, CommonFieldTraverseOps, CommonTraversalOps, ConfigRenderLambda, ConfigRenderLambdaFlags, CurrentSdkInfo, DataColumn, DataColumnId, DataColumnImpl, DataColumnRecipe, DataColumnSource, DataModel, DataModelBuilder, DatasetAxes, DatasetOption, DatasetSelection, DeriveHref, DeriveLabelsFormatters, DeriveLabelsOptions, Entry, ExpressionSpec, ExtractFunctionHandleReturn, type ExtractFutureRefType, FieldTraversalStep, FieldType, FilterMatchOptions, type FilterSpec, type FilterSpecLeaf, type FilterSpecNode, type FilterSpecOfType, type FilterSpecType, FilterSpecUi, FilterUi, FilterUiOfType, FilterUiType, FindFilterColumnsOptions, FormField, FutureRef, GetFieldStep, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferFactoryData, InferFactoryModelServices, InferFactoryOutputs, InferFactoryParams, InferFactoryUiServices, InferHrefType, InferOutputsFromLambdas, InferOutputsType, InferPluginData, InferPluginHandle, InferPluginNames, InferPluginUiEntries, InferRenderFunctionReturn, InferUiState, IsNA, internal_d_exports as JsRenderInternal, type DeriveLabelsOptions as LabelDerivationOps, LinkerStep, Log10, MainAccessorName, type MigrateBlockStorageConfig, type MigrationFailure, type MigrationResult, type MigrationSuccess, type ModelServices, type MutateStoragePayload, NotFilter, NumericalComparisonFilter, OptionalPlResourceEntry, OrFilter, OutputError, PColumnCollection, type PColumnDataUniversal, PColumnEntryUniversal, PColumnEntryWithLabel, PColumnKeyList, PColumnPredicate, PColumnResourceMapData, PColumnResourceMapEntry, PColumnUniversal, PColumnWithLabel, PFrameImpl, PTableKey, type PTableParamsV2, type ParamsInput, Patch, PatternFilter, PatternPredicate, PatternPredicateContainSubsequence, PatternPredicateEquals, type PlDataTableAxisMeta, type PlDataTableColumnMeta, type PlDataTableColumnsMeta, type PlDataTableFilterMeta, type PlDataTableFilterSpecLeaf, type PlDataTableFilters, type PlDataTableFiltersWithMeta, type PlDataTableGridStateCore, type PlDataTableModel, type PlDataTableSheet, type PlDataTableSheetState, type PlDataTableStateV2, type PlDataTableStateV2CacheEntry, type PlDataTableStateV2Normalized, PlMultiSequenceAlignmentColorSchemeOption, PlMultiSequenceAlignmentModel, PlMultiSequenceAlignmentSettings, PlMultiSequenceAlignmentWidget, PlResourceEntry, PlSelectionModel, type PlTableColumnIdJson, Platforma, PlatformaApiVersion, PlatformaExtended, PlatformaFactory, PlatformaSDKVersion, PlatformaV1, PlatformaV2, PlatformaV3, type PluginConfig, type PluginData, PluginDataModel, PluginDataModelBuilder, type PluginDataModelVersions, type PluginFactory, PluginFactoryLike, PluginHandle, PluginInstance, PluginModel, type PluginName, type PluginOutputs, type PluginParams, type PluginPublicOutputs, type PluginRecord, type PluginRegistry, PluginRenderCtx, type PublicOutputFieldDef, QueryColumnId, QueryColumnIdAxis, QueryColumnIdColumn, RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, RenderCtx, RenderCtxBase, RenderFunction, ResolveModelServices, ResolveUiServices, ResourceTraversalOps, ResourceType, ResultPool, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl, SdkInfo, ServiceProxy, SimplifiedPColumnSpec, SimplifiedUniversalPColumnEntry, SortedCumulativeSum, type Entry as SpecExtractorResult, type SpecQuery, SplitAxis, SplitByAxesOpts, StagingAccessorName, StdCtx, StdCtxArgsOnly, TooltipEntry, type Trace, type TraceEntry, TransformedColumn, TreeNodeAccessor, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, TypedConfig, TypedConfigOrConfigLambda, TypedConfigOrString, type UiServices, Unionize, UniversalColumnOption, UnwrapFutureRef, ValueRank, type VersionedData, _ctxProvidersCache, allPColumnsReady, blockServiceNames, buildDatasetOptions, buildRefMap, buildServices, collectDatasetAxes, collectLinkerColumns, collectLinkerIds, compileAnnotationScript, compileFilter, compileFilters, convertFilterSpecsToExpressionSpecs, convertFilterUiToExpressionImpl, convertFilterUiToExpressions, convertOrParsePColumnData, createBlockStorage, createDatasetSelection, createDefaultPTableParams, createPFrameForGraphs, createPeerLinkFinder, createPlDataTable, type createPlDataTableOptionsV3, createPlDataTableSheet, createPlDataTableStateV2, createPlDataTableV2, createPlDataTableV3, createPlSelectionModel, createRowSelectionColumn, createServiceProxy, deriveAxisValuesLabels, deriveColumnOptions, deriveDataFromStorage, deriveDistinctLabels, deriveDistinctTooltips, deriveLabels, deriveRecipeOptions, describePeerLinks, discoverTableColumns as discoverTableColumnSnaphots, distillFilterSpec, downgradeCfgOrLambda, enrichCompatible, extractConfig, filterDataInfoEntries, filterMatchesToOptions, filterSpecToSpecQueryExpr, finalizePColumnData, findFilterColumns, findPeerLinks, getAllRelatedColumns, getAvailableWithLinkersAxes, getAxisUniqueValues, getColumnOrAxisValueLabelsId, getColumnSpecById, getColumnUniqueValues, getColumnsFull, getCtxProviders, getEffectiveVisibility, getEnvironmentValue, getNumberOfRows, getOrderPriority, getPartitionKeysList, getPlatformaApiVersion, getPluginData, getRawPlatformaInstance, getRelatedColumns, getRequestColumnsFromSelectedSources, getResultPoolDatasetAxes, getService, getSingleColumnData, getStorageData, getUniqueAxisValuesWithLabels, getUniquePartitionKeys, getUniqueSourceValuesWithLabels, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, ifDef, isBlockStorage, isColumn, isColumnHidden, isColumnOptional, isColumnProvider, isColumnsCollection, isConfigLambda, isDataColumn, isDatasetSelection, isHiddenFromGraphColumn, isHiddenFromUIColumn, isLeafColumn, isPColumnReady, isPluginOutputKey, migrateBlockStorage, normalizeBlockStorage, parsePColumnData, parseResourceMap, peerLinkedLast, pluginOutputKey, pluginOutputPrefix, queriesQualifications, readOutput, registerFacadeCallbacks, splitByAxes, toColumnProvider, unreachable, updateStorageData, upgradePlDataTableStateV2, wrapOutputs };
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import { ColumnDiscoveredRecipe } from "./columns/column_recipes/column_discover
|
|
|
29
29
|
import { ColumnFilteredRecipe } from "./columns/column_recipes/column_filtered_recipe.js";
|
|
30
30
|
import { ColumnRecipe } from "./columns/column_recipes/index.js";
|
|
31
31
|
import { ColumnOverriddenRecipe } from "./columns/column_recipes/column_overrided_recipe.js";
|
|
32
|
-
import {
|
|
32
|
+
import { DataColumn, DataColumnImpl, isDataColumn } from "./columns/data_column.js";
|
|
33
33
|
import { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, ColumnsProvider, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl } from "./columns/column_providers/providers.js";
|
|
34
34
|
import { _ctxProvidersCache, getCtxProviders, isColumnProvider, toColumnProvider } from "./columns/column_providers/index.js";
|
|
35
35
|
import { ColumnsCollection, ColumnsCollectionImpl, isColumnsCollection } from "./columns/columns_collection.js";
|
|
@@ -68,4 +68,4 @@ import { getAxisUniqueValues, getColumnOrAxisValueLabelsId, getColumnSpecById, g
|
|
|
68
68
|
import { getEnvironmentValue } from "./env_value.js";
|
|
69
69
|
export * from "@milaboratories/pl-model-common";
|
|
70
70
|
export * from "@milaboratories/pl-error-like";
|
|
71
|
-
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockModelV3, BlockRenderCtx, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, Column,
|
|
71
|
+
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockModelV3, BlockRenderCtx, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, Column, ColumnDiscoveredRecipe, ColumnFilteredRecipe, ColumnOverriddenRecipe, ColumnRecipe, ColumnsCollection, ColumnsCollectionImpl, ColumnsProvider, CurrentSdkInfo, DataColumn, DataColumnImpl, DataModel, DataModelBuilder, FutureRef, internal_exports as JsRenderInternal, MainAccessorName, OutputError, PColumnCollection, PFrameImpl, PlatformaSDKVersion, PluginDataModel, PluginDataModelBuilder, PluginInstance, PluginModel, PluginRenderCtx, RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, RenderCtxBase, ResultPool, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl, StagingAccessorName, TreeNodeAccessor, _ctxProvidersCache, allPColumnsReady, blockServiceNames, buildDatasetOptions, buildRefMap, buildServices, collectDatasetAxes, collectLinkerColumns, collectLinkerIds, compileAnnotationScript, compileFilter, compileFilters, convertFilterSpecsToExpressionSpecs, convertFilterUiToExpressionImpl, convertFilterUiToExpressions, convertOrParsePColumnData, createBlockStorage, createDatasetSelection, createDefaultPTableParams, createPFrameForGraphs, createPeerLinkFinder, createPlDataTable, createPlDataTableSheet, createPlDataTableStateV2, createPlDataTableV2, createPlDataTableV3, createPlSelectionModel, createRowSelectionColumn, createServiceProxy, deriveAxisValuesLabels, deriveColumnOptions, deriveDataFromStorage, deriveDistinctLabels, deriveDistinctTooltips, deriveLabels, deriveRecipeOptions, describePeerLinks, discoverTableColumns as discoverTableColumnSnaphots, distillFilterSpec, downgradeCfgOrLambda, enrichCompatible, extractConfig, filterDataInfoEntries, filterMatchesToOptions, filterSpecToSpecQueryExpr, finalizePColumnData, findFilterColumns, findPeerLinks, getAllRelatedColumns, getAvailableWithLinkersAxes, getAxisUniqueValues, getColumnOrAxisValueLabelsId, getColumnSpecById, getColumnUniqueValues, getColumnsFull, getCtxProviders, getEffectiveVisibility, getEnvironmentValue, getNumberOfRows, getOrderPriority, getPartitionKeysList, getPlatformaApiVersion, getPluginData, getRawPlatformaInstance, getRelatedColumns, getRequestColumnsFromSelectedSources, getResultPoolDatasetAxes, getService, getSingleColumnData, getStorageData, getUniqueAxisValuesWithLabels, getUniquePartitionKeys, getUniqueSourceValuesWithLabels, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, ifDef, isBlockStorage, isColumn, isColumnHidden, isColumnOptional, isColumnProvider, isColumnsCollection, isConfigLambda, isDataColumn, isDatasetSelection, isHiddenFromGraphColumn, isHiddenFromUIColumn, isLeafColumn, isPColumnReady, isPluginOutputKey, migrateBlockStorage, normalizeBlockStorage, parsePColumnData, parseResourceMap, peerLinkedLast, pluginOutputKey, pluginOutputPrefix, queriesQualifications, readOutput, registerFacadeCallbacks, splitByAxes, toColumnProvider, unreachable, updateStorageData, upgradePlDataTableStateV2, wrapOutputs };
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccessorEntriesProvider,
|
|
3
3
|
ResultPoolEntriesProvider,
|
|
4
|
-
type LeafEntry,
|
|
5
4
|
type PColumn,
|
|
6
5
|
type PObjectId,
|
|
7
6
|
type UpstreamBlockCtx,
|
|
8
7
|
} from "@milaboratories/pl-model-common";
|
|
9
8
|
import { AccessorHandle, PColumnDataUniversal, TreeNodeAccessor } from "../../render";
|
|
10
|
-
import {
|
|
9
|
+
import { DataColumn, DataColumnRecipe } from "../data_column";
|
|
11
10
|
import { getCfgRenderCtx } from "../../internal";
|
|
12
11
|
import { isNil } from "es-toolkit";
|
|
13
12
|
import { LRUCache } from "lru-cache";
|
|
@@ -130,7 +129,7 @@ export class AccessorColumnsProviderImpl
|
|
|
130
129
|
|
|
131
130
|
getColumns(): DataColumnRecipe<PObjectId>[] {
|
|
132
131
|
if (this.cachedColumns !== undefined) return this.cachedColumns;
|
|
133
|
-
return (this.cachedColumns = Array.from(this.entries.values(),
|
|
132
|
+
return (this.cachedColumns = Array.from(this.entries.values(), DataColumn.fromAccessor).filter(
|
|
134
133
|
(column) => column !== undefined,
|
|
135
134
|
));
|
|
136
135
|
}
|
|
@@ -176,7 +175,7 @@ export class ResultPoolColumnsProviderImpl
|
|
|
176
175
|
if (this.cachedColumns !== undefined) return this.cachedColumns;
|
|
177
176
|
return (this.cachedColumns = Array.from(
|
|
178
177
|
this.getPObjectEntries().values(),
|
|
179
|
-
|
|
178
|
+
DataColumn.fromAccessor,
|
|
180
179
|
).filter((column) => column !== undefined));
|
|
181
180
|
}
|
|
182
181
|
}
|
|
@@ -184,17 +183,6 @@ export class ResultPoolColumnsProviderImpl
|
|
|
184
183
|
/** Public type alias — value of the same name is the memoised factory above. */
|
|
185
184
|
export type ResultPoolColumnsProvider = ResultPoolColumnsProviderImpl;
|
|
186
185
|
|
|
187
|
-
function columnUnlessAbsent(
|
|
188
|
-
entry: LeafEntry<TreeNodeAccessor>,
|
|
189
|
-
): DataColumnRecipe<PObjectId> | undefined {
|
|
190
|
-
try {
|
|
191
|
-
return DataColumn.fromAccessor(entry);
|
|
192
|
-
} catch (error) {
|
|
193
|
-
if (error instanceof ColumnAbsentError) return undefined;
|
|
194
|
-
throw error;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
186
|
function hashRawPool(rawPool: ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>): string {
|
|
199
187
|
return rawPool
|
|
200
188
|
.map(
|
|
@@ -24,7 +24,6 @@ import { ColumnDiscoveredRecipe } from "./column_discovered_recipe";
|
|
|
24
24
|
import { ColumnOverriddenRecipe } from "./column_overrided_recipe";
|
|
25
25
|
import { ColumnFilteredRecipe } from "./column_filtered_recipe";
|
|
26
26
|
import { ColumnRecipe } from "./index";
|
|
27
|
-
import { ColumnAbsentError } from "../data_column";
|
|
28
27
|
import type { ColumnFieldStatus } from "./types";
|
|
29
28
|
import { installStubRegistry } from "../__test_helpers__/stub_registry";
|
|
30
29
|
import { throwError } from "@milaboratories/helpers";
|
|
@@ -403,11 +402,9 @@ describe("ColumnDiscoveredRecipe", () => {
|
|
|
403
402
|
).toThrow(/Unsupported ColumnRecipe id variant/);
|
|
404
403
|
});
|
|
405
404
|
|
|
406
|
-
test("fromKey
|
|
407
|
-
// Default ctx mock has no providers → empty registry → leaf id is
|
|
408
|
-
|
|
409
|
-
// unchanged through `fromKey`.
|
|
410
|
-
expect(() => ColumnDiscoveredRecipe.fromKey(trivialKey)).toThrow(ColumnAbsentError);
|
|
405
|
+
test("fromKey returns undefined when a referenced column is absent", () => {
|
|
406
|
+
// Default ctx mock has no providers → empty registry → leaf id is absent.
|
|
407
|
+
expect(ColumnDiscoveredRecipe.fromKey(trivialKey)).toBeUndefined();
|
|
411
408
|
});
|
|
412
409
|
|
|
413
410
|
test("id is the canonical stringify(ColumnDiscoveredKey)", () => {
|
|
@@ -611,10 +608,9 @@ describe("ColumnRecipe.getStatus (top-level dispatcher)", () => {
|
|
|
611
608
|
});
|
|
612
609
|
});
|
|
613
610
|
|
|
614
|
-
describe("ColumnRecipe(id)
|
|
615
|
-
test("filtered id over an absent source
|
|
616
|
-
// Empty registry with isFinal=true → leaf is
|
|
617
|
-
// propagates through the Filtered dispatch branch.
|
|
611
|
+
describe("ColumnRecipe(id) over absent leaves", () => {
|
|
612
|
+
test("filtered id over an absent source returns undefined", () => {
|
|
613
|
+
// Empty registry with isFinal=true → leaf is absent.
|
|
618
614
|
const ctx = makeCtx();
|
|
619
615
|
(globalThis as { cfgRenderCtx?: unknown }).cfgRenderCtx = ctx;
|
|
620
616
|
installStubRegistry(ctx, {}, { isFinal: true });
|
|
@@ -622,10 +618,10 @@ describe("ColumnRecipe(id) throw propagation on absent leaves", () => {
|
|
|
622
618
|
source: baseLeaf,
|
|
623
619
|
axisFilters: [],
|
|
624
620
|
});
|
|
625
|
-
expect(
|
|
621
|
+
expect(ColumnRecipe(id)).toBeUndefined();
|
|
626
622
|
});
|
|
627
623
|
|
|
628
|
-
test("overrided id over an absent source
|
|
624
|
+
test("overrided id over an absent source returns undefined", () => {
|
|
629
625
|
const ctx = makeCtx();
|
|
630
626
|
(globalThis as { cfgRenderCtx?: unknown }).cfgRenderCtx = ctx;
|
|
631
627
|
installStubRegistry(ctx, {}, { isFinal: true });
|
|
@@ -633,15 +629,15 @@ describe("ColumnRecipe(id) throw propagation on absent leaves", () => {
|
|
|
633
629
|
source: baseLeaf,
|
|
634
630
|
specOverrides: overrides({}),
|
|
635
631
|
});
|
|
636
|
-
expect(
|
|
632
|
+
expect(ColumnRecipe(id)).toBeUndefined();
|
|
637
633
|
});
|
|
638
634
|
|
|
639
|
-
test("discovered id over an absent hit
|
|
635
|
+
test("discovered id over an absent hit returns undefined", () => {
|
|
640
636
|
const ctx = makeCtx();
|
|
641
637
|
(globalThis as { cfgRenderCtx?: unknown }).cfgRenderCtx = ctx;
|
|
642
638
|
installStubRegistry(ctx, {}, { isFinal: true });
|
|
643
639
|
const id = stringifyColumnDiscoveredId({ column: baseLeaf });
|
|
644
|
-
expect(
|
|
640
|
+
expect(ColumnRecipe(id)).toBeUndefined();
|
|
645
641
|
});
|
|
646
642
|
});
|
|
647
643
|
|
|
@@ -19,7 +19,6 @@ import type {
|
|
|
19
19
|
} from "./types";
|
|
20
20
|
|
|
21
21
|
export type { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from "./types";
|
|
22
|
-
export { ColumnAbsentError } from "../data_column";
|
|
23
22
|
export { ColumnDiscoveredRecipe } from "./column_discovered_recipe";
|
|
24
23
|
export { ColumnFilteredRecipe } from "./column_filtered_recipe";
|
|
25
24
|
export { ColumnOverriddenRecipe } from "./column_overrided_recipe";
|
|
@@ -90,8 +89,8 @@ function ColumnRecipeBuild(
|
|
|
90
89
|
* Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on
|
|
91
90
|
* the parsed id shape to the matching `getStatusBy*` static — never
|
|
92
91
|
* constructs the recipe. Use this at boundaries (resolver, filter/sort
|
|
93
|
-
* targets) to
|
|
94
|
-
*
|
|
92
|
+
* targets) to tell an `absent` column from a `resolving` one: the recipe
|
|
93
|
+
* factory returns `undefined` for both.
|
|
95
94
|
*/
|
|
96
95
|
function ColumnRecipeGetStatus(
|
|
97
96
|
id: ColumnUniversalId,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type PObjectId,
|
|
8
8
|
type PObjectSpec,
|
|
9
9
|
} from "@milaboratories/pl-model-common";
|
|
10
|
-
import {
|
|
10
|
+
import { DataColumnImpl } from "./data_column";
|
|
11
11
|
import { _ctxProvidersCache } from "./column_providers";
|
|
12
12
|
import { installStubRegistry } from "./__test_helpers__/stub_registry";
|
|
13
13
|
|
|
@@ -86,10 +86,9 @@ describe("DataColumnImpl.spec — applySpecOverrides", () => {
|
|
|
86
86
|
expect(c.getSpec()).toBe(stubSpec);
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
test("fromId
|
|
90
|
-
// Empty registry — `isFinal()` returns true vacuously, so the leaf is
|
|
91
|
-
|
|
92
|
-
expect(() => DataColumnImpl.fromId(baseLeaf)).toThrow(ColumnAbsentError);
|
|
89
|
+
test("fromId returns undefined when ctx has no handles", () => {
|
|
90
|
+
// Empty registry — `isFinal()` returns true vacuously, so the leaf is absent.
|
|
91
|
+
expect(DataColumnImpl.fromId(baseLeaf)).toBeUndefined();
|
|
93
92
|
});
|
|
94
93
|
|
|
95
94
|
test("appends axes at indices past base.axesSpec.length", () => {
|
|
@@ -130,7 +129,7 @@ describe("DataColumnImpl.spec — applySpecOverrides", () => {
|
|
|
130
129
|
});
|
|
131
130
|
});
|
|
132
131
|
|
|
133
|
-
// --- resolution status / absent
|
|
132
|
+
// --- resolution status / absent column --------------------------------------
|
|
134
133
|
|
|
135
134
|
describe("DataColumnImpl resolution: fromId / fromAccessor / getStatus", () => {
|
|
136
135
|
test("fromId returns undefined when registry is unfinalized and id not found", () => {
|
|
@@ -139,10 +138,10 @@ describe("DataColumnImpl resolution: fromId / fromAccessor / getStatus", () => {
|
|
|
139
138
|
expect(DataColumnImpl.fromId(baseLeaf)).toBeUndefined();
|
|
140
139
|
});
|
|
141
140
|
|
|
142
|
-
test("fromId
|
|
143
|
-
// Leaf entry present, no spec field, accessor locked → absent
|
|
141
|
+
test("fromId returns undefined when leaf has no spec field on locked accessor", () => {
|
|
142
|
+
// Leaf entry present, no spec field, accessor locked → absent.
|
|
144
143
|
installStubRegistry(mockCtx, { [baseLeaf]: { accessorLocked: true } });
|
|
145
|
-
expect(
|
|
144
|
+
expect(DataColumnImpl.fromId(baseLeaf)).toBeUndefined();
|
|
146
145
|
});
|
|
147
146
|
|
|
148
147
|
test("fromId returns undefined when leaf has no spec field on unlocked accessor", () => {
|
|
@@ -157,10 +156,10 @@ describe("DataColumnImpl resolution: fromId / fromAccessor / getStatus", () => {
|
|
|
157
156
|
expect(DataColumnImpl.fromId(baseLeaf)).toBeUndefined();
|
|
158
157
|
});
|
|
159
158
|
|
|
160
|
-
test("fromAccessor
|
|
159
|
+
test("fromAccessor returns undefined when accessor is locked without spec", () => {
|
|
161
160
|
installStubRegistry(mockCtx, { [baseLeaf]: { accessorLocked: true } });
|
|
162
161
|
const entry = pluckLeafEntry(baseLeaf);
|
|
163
|
-
expect(
|
|
162
|
+
expect(DataColumnImpl.fromAccessor(entry)).toBeUndefined();
|
|
164
163
|
});
|
|
165
164
|
|
|
166
165
|
test("fromAccessor returns undefined when accessor is unlocked without spec", () => {
|
|
@@ -169,10 +168,10 @@ describe("DataColumnImpl resolution: fromId / fromAccessor / getStatus", () => {
|
|
|
169
168
|
expect(DataColumnImpl.fromAccessor(entry)).toBeUndefined();
|
|
170
169
|
});
|
|
171
170
|
|
|
172
|
-
test("an export that is not a column: fromId and fromAccessor
|
|
171
|
+
test("an export that is not a column: fromId and fromAccessor return undefined, status tracks only resolution", () => {
|
|
173
172
|
installStubRegistry(mockCtx, { [baseLeaf]: { spec: fileSpec } });
|
|
174
|
-
expect(
|
|
175
|
-
expect(
|
|
173
|
+
expect(DataColumnImpl.fromId(baseLeaf)).toBeUndefined();
|
|
174
|
+
expect(DataColumnImpl.fromAccessor(pluckLeafEntry(baseLeaf))).toBeUndefined();
|
|
176
175
|
expect(DataColumnImpl.getStatusById(baseLeaf)).toBe("present");
|
|
177
176
|
});
|
|
178
177
|
|