@platforma-sdk/model 1.86.3 → 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.
Files changed (41) hide show
  1. package/dist/columns/column_providers/providers.cjs +2 -2
  2. package/dist/columns/column_providers/providers.cjs.map +1 -1
  3. package/dist/columns/column_providers/providers.d.ts.map +1 -1
  4. package/dist/columns/column_providers/providers.js +2 -2
  5. package/dist/columns/column_providers/providers.js.map +1 -1
  6. package/dist/columns/column_recipes/index.cjs +2 -2
  7. package/dist/columns/column_recipes/index.cjs.map +1 -1
  8. package/dist/columns/column_recipes/index.d.ts +2 -3
  9. package/dist/columns/column_recipes/index.d.ts.map +1 -1
  10. package/dist/columns/column_recipes/index.js +2 -2
  11. package/dist/columns/column_recipes/index.js.map +1 -1
  12. package/dist/columns/data_column.cjs +21 -50
  13. package/dist/columns/data_column.cjs.map +1 -1
  14. package/dist/columns/data_column.d.ts +10 -22
  15. package/dist/columns/data_column.d.ts.map +1 -1
  16. package/dist/columns/data_column.js +23 -51
  17. package/dist/columns/data_column.js.map +1 -1
  18. package/dist/columns/index.cjs +0 -1
  19. package/dist/columns/index.d.ts +2 -2
  20. package/dist/columns/index.js +2 -2
  21. package/dist/components/PlDatasetSelector/build_dataset_options.cjs +1 -1
  22. package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
  23. package/dist/components/PlDatasetSelector/build_dataset_options.js +2 -2
  24. package/dist/components/PlDatasetSelector/build_dataset_options.js.map +1 -1
  25. package/dist/index.cjs +0 -1
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +2 -2
  28. package/dist/package.cjs +1 -1
  29. package/dist/package.js +1 -1
  30. package/package.json +7 -7
  31. package/src/columns/__test_helpers__/collection_driver.ts +10 -8
  32. package/src/columns/__test_helpers__/stub_registry.ts +6 -8
  33. package/src/columns/column_providers/providers.test.ts +45 -0
  34. package/src/columns/column_providers/providers.ts +7 -6
  35. package/src/columns/column_recipes/column_recipes.test.ts +11 -15
  36. package/src/columns/column_recipes/index.ts +2 -3
  37. package/src/columns/columns_collection.test.ts +39 -0
  38. package/src/columns/data_column.test.ts +20 -11
  39. package/src/columns/data_column.ts +24 -49
  40. package/src/components/PlDatasetSelector/build_dataset_options.ts +7 -4
  41. package/src/labels/derive_distinct_labels.test.ts +1 -1
@@ -84,7 +84,7 @@ var AccessorColumnsProviderImpl = class extends _milaboratories_pl_model_common.
84
84
  }
85
85
  getColumns() {
86
86
  if (this.cachedColumns !== void 0) return this.cachedColumns;
87
- return this.cachedColumns = Array.from(this.entries.values()).map((e) => require_data_column.DataColumn.fromAccessor(e)).filter((v) => !(0, es_toolkit.isNil)(v));
87
+ return this.cachedColumns = Array.from(this.entries.values(), require_data_column.DataColumn.fromAccessor).filter((column) => column !== void 0);
88
88
  }
89
89
  };
90
90
  /**
@@ -106,7 +106,7 @@ var ResultPoolColumnsProviderImpl = class extends _milaboratories_pl_model_commo
106
106
  }
107
107
  getColumns() {
108
108
  if (this.cachedColumns !== void 0) return this.cachedColumns;
109
- return this.cachedColumns = Array.from(this.getPObjectEntries().values()).map((e) => require_data_column.DataColumn.fromAccessor(e)).filter((v) => !(0, es_toolkit.isNil)(v));
109
+ return this.cachedColumns = Array.from(this.getPObjectEntries().values(), require_data_column.DataColumn.fromAccessor).filter((column) => column !== void 0);
110
110
  }
111
111
  };
112
112
  function hashRawPool(rawPool) {
@@ -1 +1 @@
1
- {"version":3,"file":"providers.cjs","names":["isNil","TreeNodeAccessor","LRUCache","getCfgRenderCtx","DataColumn","AccessorEntriesProvider","ResultPoolEntriesProvider"],"sources":["../../../src/columns/column_providers/providers.ts"],"sourcesContent":["import {\n AccessorEntriesProvider,\n ResultPoolEntriesProvider,\n type PColumn,\n type PObjectId,\n type UpstreamBlockCtx,\n} from \"@milaboratories/pl-model-common\";\nimport { AccessorHandle, PColumnDataUniversal, TreeNodeAccessor } from \"../../render\";\nimport { DataColumn, DataColumnRecipe } from \"../data_column\";\nimport { getCfgRenderCtx } from \"../../internal\";\nimport { isNil } from \"es-toolkit\";\nimport { LRUCache } from \"lru-cache\";\n\n/**\n * Data source for sandbox column-list builders. Has nothing to say about\n * id-resolution — `ColumnRegistry` (in `@milaboratories/pl-model-common`)\n * consumes the separate `ColumnEntriesProvider` interface for that.\n *\n * Same name as the factory function below — they merge into one TS\n * declaration: `ColumnsProvider` is callable AND the interface type.\n */\nexport interface ColumnsProvider {\n /** Returns all currently known PColumn columns as lazy views. */\n getColumns(): DataColumnRecipe<PObjectId>[];\n /** Whether the provider has finished enumerating all its columns. */\n isFinal(): boolean;\n}\n\n/**\n * Unified memoised factory dispatching to the right provider flavour by the\n * source shape:\n * - `TreeNodeAccessor` → {@link AccessorColumnsProvider}\n * (indexed by `root.handle`, walks the accessor tree once per root).\n * - `UpstreamBlockCtx<AccessorHandle>[]` (or omitted — pulled from the\n * ambient ctx) → {@link ResultPoolColumnsProvider}\n * (indexed by a content-hash of the block list).\n *\n * Both branches return cached instances within their LRU window, so repeated\n * calls with the same source skip re-walking / re-hashing.\n */\nexport function ColumnsProvider(\n source?: TreeNodeAccessor | ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>,\n) {\n if (isNil(source) || Array.isArray(source)) {\n return ResultPoolColumnsProvider(source);\n } else if (source instanceof TreeNodeAccessor) {\n return AccessorColumnsProvider(source);\n } else {\n throw new Error(\"Unknown columns provider source\");\n }\n}\n\n/**\n * Memoised constructor — same `root.handle` returns the same\n * {@link AccessorColumnsProviderImpl}, so `indexAccessorRoot` runs once per\n * accessor root (within the LRU window).\n */\nconst _accessorProviderCache = new LRUCache<AccessorHandle, AccessorColumnsProviderImpl>({\n max: 64,\n});\nexport function AccessorColumnsProvider(root: TreeNodeAccessor): AccessorColumnsProvider {\n let provider = _accessorProviderCache.get(root.handle);\n if (provider === undefined) {\n provider = new AccessorColumnsProviderImpl(root);\n _accessorProviderCache.set(root.handle, provider);\n }\n return provider;\n}\n\n/**\n * Memoised constructor — same `rawPool` content returns the same\n * {@link ResultPoolColumnsProviderImpl}, so `indexPoolBlock` runs once per\n * pool snapshot (within the LRU window).\n */\nconst _resultPoolProviderCache = new LRUCache<string, ResultPoolColumnsProviderImpl>({ max: 4 });\nexport function ResultPoolColumnsProvider(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n): ResultPoolColumnsProvider {\n const key = hashRawPool(rawPool);\n let provider = _resultPoolProviderCache.get(key);\n if (provider === undefined) {\n provider = new ResultPoolColumnsProviderImpl(rawPool);\n _resultPoolProviderCache.set(key, provider);\n }\n return provider;\n}\n\n/**\n * Simple provider wrapping an array of PColumns. Sandbox-only —\n * implements {@link ColumnsProvider} (lazy-view enumeration). It is *not* an\n * id-index source — `ColumnRegistry` does not consume it.\n */\nexport class ArrayColumnsProvider implements ColumnsProvider {\n private readonly columns: DataColumnRecipe<PObjectId>[];\n\n constructor(\n columns: ReadonlyArray<PColumn<undefined | PColumnDataUniversal> | DataColumnRecipe<PObjectId>>,\n private readonly _isFinal: boolean,\n ) {\n this.columns = columns.map((c) => DataColumn.fromColumn(c));\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n return this.columns;\n }\n\n isFinal(): boolean {\n return this._isFinal;\n }\n}\n\n/**\n * Sandbox-specific provider over a {@link TreeNodeAccessor} root. Uses the\n * accessor's own `resolvePath` as the canonical root path for id construction,\n * and adds `getColumns()` returning {@link DataColumnRecipe<PObjectId>}s on top of the generic\n * entries index.\n */\nexport class AccessorColumnsProviderImpl\n extends AccessorEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(root: TreeNodeAccessor) {\n super(root, root.resolvePath);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(this.entries.values())\n .map((e) => DataColumn.fromAccessor(e))\n .filter((v): v is DataColumnRecipe<PObjectId> => !isNil(v)));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type AccessorColumnsProvider = AccessorColumnsProviderImpl;\n\n/**\n * Sandbox-specific result-pool provider. Accepts the raw handle-shaped blocks\n * returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx} and\n * wraps them into {@link TreeNodeAccessor}s, then adds `getColumns()`.\n */\nexport class ResultPoolColumnsProviderImpl\n extends ResultPoolEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n ) {\n const blocks = rawPool.map((b) => ({\n blockId: b.blockId,\n prodCtx:\n b.prodCtx !== undefined\n ? new TreeNodeAccessor(b.prodCtx, [b.blockId, \"prodCtx\"])\n : undefined,\n stagingCtx:\n b.stagingCtx !== undefined\n ? new TreeNodeAccessor(b.stagingCtx, [b.blockId, \"stagingCtx\"])\n : undefined,\n prodIncomplete: b.prodIncomplete,\n stagingIncomplete: b.stagingIncomplete,\n }));\n\n super(blocks);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(this.getPObjectEntries().values())\n .map((e) => DataColumn.fromAccessor(e))\n .filter((v): v is DataColumnRecipe<PObjectId> => !isNil(v)));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type ResultPoolColumnsProvider = ResultPoolColumnsProviderImpl;\n\nfunction hashRawPool(rawPool: ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>): string {\n return rawPool\n .map(\n (b) =>\n `${b.blockId}\\x1f${b.prodCtx ?? \"\"}\\x1f${b.stagingCtx ?? \"\"}\\x1f${\n b.prodIncomplete ? 1 : 0\n }\\x1f${b.stagingIncomplete ? 1 : 0}`,\n )\n .join(\"\\x1e\");\n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3,"file":"providers.cjs","names":["isNil","TreeNodeAccessor","LRUCache","getCfgRenderCtx","DataColumn","AccessorEntriesProvider","ResultPoolEntriesProvider"],"sources":["../../../src/columns/column_providers/providers.ts"],"sourcesContent":["import {\n AccessorEntriesProvider,\n ResultPoolEntriesProvider,\n type PColumn,\n type PObjectId,\n type UpstreamBlockCtx,\n} from \"@milaboratories/pl-model-common\";\nimport { AccessorHandle, PColumnDataUniversal, TreeNodeAccessor } from \"../../render\";\nimport { DataColumn, DataColumnRecipe } from \"../data_column\";\nimport { getCfgRenderCtx } from \"../../internal\";\nimport { isNil } from \"es-toolkit\";\nimport { LRUCache } from \"lru-cache\";\n\n/**\n * Data source for sandbox column-list builders. Has nothing to say about\n * id-resolution — `ColumnRegistry` (in `@milaboratories/pl-model-common`)\n * consumes the separate `ColumnEntriesProvider` interface for that.\n *\n * Same name as the factory function below — they merge into one TS\n * declaration: `ColumnsProvider` is callable AND the interface type.\n */\nexport interface ColumnsProvider {\n /** Returns all currently known PColumn columns as lazy views. */\n getColumns(): DataColumnRecipe<PObjectId>[];\n /** Whether the provider has finished enumerating all its columns. */\n isFinal(): boolean;\n}\n\n/**\n * Unified memoised factory dispatching to the right provider flavour by the\n * source shape:\n * - `TreeNodeAccessor` → {@link AccessorColumnsProvider}\n * (indexed by `root.handle`, walks the accessor tree once per root).\n * - `UpstreamBlockCtx<AccessorHandle>[]` (or omitted — pulled from the\n * ambient ctx) → {@link ResultPoolColumnsProvider}\n * (indexed by a content-hash of the block list).\n *\n * Both branches return cached instances within their LRU window, so repeated\n * calls with the same source skip re-walking / re-hashing.\n */\nexport function ColumnsProvider(\n source?: TreeNodeAccessor | ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>,\n) {\n if (isNil(source) || Array.isArray(source)) {\n return ResultPoolColumnsProvider(source);\n } else if (source instanceof TreeNodeAccessor) {\n return AccessorColumnsProvider(source);\n } else {\n throw new Error(\"Unknown columns provider source\");\n }\n}\n\n/**\n * Memoised constructor — same `root.handle` returns the same\n * {@link AccessorColumnsProviderImpl}, so `indexAccessorRoot` runs once per\n * accessor root (within the LRU window).\n */\nconst _accessorProviderCache = new LRUCache<AccessorHandle, AccessorColumnsProviderImpl>({\n max: 64,\n});\nexport function AccessorColumnsProvider(root: TreeNodeAccessor): AccessorColumnsProvider {\n let provider = _accessorProviderCache.get(root.handle);\n if (provider === undefined) {\n provider = new AccessorColumnsProviderImpl(root);\n _accessorProviderCache.set(root.handle, provider);\n }\n return provider;\n}\n\n/**\n * Memoised constructor — same `rawPool` content returns the same\n * {@link ResultPoolColumnsProviderImpl}, so `indexPoolBlock` runs once per\n * pool snapshot (within the LRU window).\n */\nconst _resultPoolProviderCache = new LRUCache<string, ResultPoolColumnsProviderImpl>({ max: 4 });\nexport function ResultPoolColumnsProvider(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n): ResultPoolColumnsProvider {\n const key = hashRawPool(rawPool);\n let provider = _resultPoolProviderCache.get(key);\n if (provider === undefined) {\n provider = new ResultPoolColumnsProviderImpl(rawPool);\n _resultPoolProviderCache.set(key, provider);\n }\n return provider;\n}\n\n/**\n * Simple provider wrapping an array of PColumns. Sandbox-only —\n * implements {@link ColumnsProvider} (lazy-view enumeration). It is *not* an\n * id-index source — `ColumnRegistry` does not consume it.\n */\nexport class ArrayColumnsProvider implements ColumnsProvider {\n private readonly columns: DataColumnRecipe<PObjectId>[];\n\n constructor(\n columns: ReadonlyArray<PColumn<undefined | PColumnDataUniversal> | DataColumnRecipe<PObjectId>>,\n private readonly _isFinal: boolean,\n ) {\n this.columns = columns.map((c) => DataColumn.fromColumn(c));\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n return this.columns;\n }\n\n isFinal(): boolean {\n return this._isFinal;\n }\n}\n\n/**\n * Sandbox-specific provider over a {@link TreeNodeAccessor} root. Uses the\n * accessor's own `resolvePath` as the canonical root path for id construction,\n * and adds `getColumns()` returning {@link DataColumnRecipe<PObjectId>}s on top of the generic\n * entries index.\n */\nexport class AccessorColumnsProviderImpl\n extends AccessorEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(root: TreeNodeAccessor) {\n super(root, root.resolvePath);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(this.entries.values(), DataColumn.fromAccessor).filter(\n (column) => column !== undefined,\n ));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type AccessorColumnsProvider = AccessorColumnsProviderImpl;\n\n/**\n * Sandbox-specific result-pool provider. Accepts the raw handle-shaped blocks\n * returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx} and\n * wraps them into {@link TreeNodeAccessor}s, then adds `getColumns()`.\n */\nexport class ResultPoolColumnsProviderImpl\n extends ResultPoolEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n ) {\n const blocks = rawPool.map((b) => ({\n blockId: b.blockId,\n prodCtx:\n b.prodCtx !== undefined\n ? new TreeNodeAccessor(b.prodCtx, [b.blockId, \"prodCtx\"])\n : undefined,\n stagingCtx:\n b.stagingCtx !== undefined\n ? new TreeNodeAccessor(b.stagingCtx, [b.blockId, \"stagingCtx\"])\n : undefined,\n prodIncomplete: b.prodIncomplete,\n stagingIncomplete: b.stagingIncomplete,\n }));\n\n super(blocks);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(\n this.getPObjectEntries().values(),\n DataColumn.fromAccessor,\n ).filter((column) => column !== undefined));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type ResultPoolColumnsProvider = ResultPoolColumnsProviderImpl;\n\nfunction hashRawPool(rawPool: ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>): string {\n return rawPool\n .map(\n (b) =>\n `${b.blockId}\\x1f${b.prodCtx ?? \"\"}\\x1f${b.stagingCtx ?? \"\"}\\x1f${\n b.prodIncomplete ? 1 : 0\n }\\x1f${b.stagingIncomplete ? 1 : 0}`,\n )\n .join(\"\\x1e\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,gBACd,QACA;CACA,KAAA,GAAIA,WAAAA,MAAAA,CAAM,MAAM,KAAK,MAAM,QAAQ,MAAM,GACvC,OAAO,0BAA0B,MAAM;MAClC,IAAI,kBAAkBC,iBAAAA,kBAC3B,OAAO,wBAAwB,MAAM;MAErC,MAAM,IAAI,MAAM,iCAAiC;AAErD;;;;;;AAOA,MAAM,yBAAyB,IAAIC,UAAAA,SAAsD,EACvF,KAAK,GACP,CAAC;AACD,SAAgB,wBAAwB,MAAiD;CACvF,IAAI,WAAW,uBAAuB,IAAI,KAAK,MAAM;CACrD,IAAI,aAAa,KAAA,GAAW;EAC1B,WAAW,IAAI,4BAA4B,IAAI;EAC/C,uBAAuB,IAAI,KAAK,QAAQ,QAAQ;CAClD;CACA,OAAO;AACT;;;;;;AAOA,MAAM,2BAA2B,IAAIA,UAAAA,SAAgD,EAAE,KAAK,EAAE,CAAC;AAC/F,SAAgB,0BACd,UAEIC,iBAAAA,gBAAgB,CAAC,CAAC,oBAAoB,GACf;CAC3B,MAAM,MAAM,YAAY,OAAO;CAC/B,IAAI,WAAW,yBAAyB,IAAI,GAAG;CAC/C,IAAI,aAAa,KAAA,GAAW;EAC1B,WAAW,IAAI,8BAA8B,OAAO;EACpD,yBAAyB,IAAI,KAAK,QAAQ;CAC5C;CACA,OAAO;AACT;;;;;;AAOA,IAAa,uBAAb,MAA6D;CAKxC;CAJnB;CAEA,YACE,SACA,UACA;EADiB,KAAA,WAAA;EAEj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E,WAAW,GAAG,MAAM,EAAE,cAAc,GAAG,MAC1D,EAAE,iBAAiB,IAAI,EACxB,MAAM,EAAE,oBAAoB,IAAI,GACrC,CAAC,CACA,KAAK,GAAM;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.ts","names":[],"sources":["../../../src/columns/column_providers/providers.ts"],"mappings":";;;;;;;;;;;;;iBAqBiB;;EAEf,cAAc,iBAAiB;;EAE/B;;;;;;;;;;;;;;wBAec,gBACd,SAAS,mBAAmB,cAAc,iBAAiB,mBAAgB,8BAAA;wBAmB7D,wBAAwB,MAAM,mBAAmB;wBAejD,0BACd,UAAS,cACP,iBAAiB,mBAElB;;;;;;qBAeU,gCAAgC;mBAKxB;mBAJF;EAEjB,YACE,SAAS,cAAc,oBAAoB,wBAAwB,iBAAiB,aACnE;EAKnB,cAAc,iBAAiB;EAI/B;;;;;;;;qBAWW,oCACH,wBAAwB,6BACrB;UAEH;EAER,YAAY,MAAM;EAIlB,cAAc,iBAAiB;;;YASrB,0BAA0B;;;;;;qBAOzB,sCACH,0BAA0B,6BACvB;UAEH;EAER,YACE,UAAS,cACP,iBAAiB;EAoBrB,cAAc,iBAAiB;;;YASrB,4BAA4B"}
1
+ {"version":3,"file":"providers.d.ts","names":[],"sources":["../../../src/columns/column_providers/providers.ts"],"mappings":";;;;;;;;;;;;;iBAqBiB;;EAEf,cAAc,iBAAiB;;EAE/B;;;;;;;;;;;;;;wBAec,gBACd,SAAS,mBAAmB,cAAc,iBAAiB,mBAAgB,8BAAA;wBAmB7D,wBAAwB,MAAM,mBAAmB;wBAejD,0BACd,UAAS,cACP,iBAAiB,mBAElB;;;;;;qBAeU,gCAAgC;mBAKxB;mBAJF;EAEjB,YACE,SAAS,cAAc,oBAAoB,wBAAwB,iBAAiB,aACnE;EAKnB,cAAc,iBAAiB;EAI/B;;;;;;;;qBAWW,oCACH,wBAAwB,6BACrB;UAEH;EAER,YAAY,MAAM;EAIlB,cAAc,iBAAiB;;;YASrB,0BAA0B;;;;;;qBAOzB,sCACH,0BAA0B,6BACvB;UAEH;EAER,YACE,UAAS,cACP,iBAAiB;EAoBrB,cAAc,iBAAiB;;;YAUrB,4BAA4B"}
@@ -84,7 +84,7 @@ var AccessorColumnsProviderImpl = class extends AccessorEntriesProvider {
84
84
  }
85
85
  getColumns() {
86
86
  if (this.cachedColumns !== void 0) return this.cachedColumns;
87
- return this.cachedColumns = Array.from(this.entries.values()).map((e) => DataColumn.fromAccessor(e)).filter((v) => !isNil(v));
87
+ return this.cachedColumns = Array.from(this.entries.values(), DataColumn.fromAccessor).filter((column) => column !== void 0);
88
88
  }
89
89
  };
90
90
  /**
@@ -106,7 +106,7 @@ var ResultPoolColumnsProviderImpl = class extends ResultPoolEntriesProvider {
106
106
  }
107
107
  getColumns() {
108
108
  if (this.cachedColumns !== void 0) return this.cachedColumns;
109
- return this.cachedColumns = Array.from(this.getPObjectEntries().values()).map((e) => DataColumn.fromAccessor(e)).filter((v) => !isNil(v));
109
+ return this.cachedColumns = Array.from(this.getPObjectEntries().values(), DataColumn.fromAccessor).filter((column) => column !== void 0);
110
110
  }
111
111
  };
112
112
  function hashRawPool(rawPool) {
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","names":[],"sources":["../../../src/columns/column_providers/providers.ts"],"sourcesContent":["import {\n AccessorEntriesProvider,\n ResultPoolEntriesProvider,\n type PColumn,\n type PObjectId,\n type UpstreamBlockCtx,\n} from \"@milaboratories/pl-model-common\";\nimport { AccessorHandle, PColumnDataUniversal, TreeNodeAccessor } from \"../../render\";\nimport { DataColumn, DataColumnRecipe } from \"../data_column\";\nimport { getCfgRenderCtx } from \"../../internal\";\nimport { isNil } from \"es-toolkit\";\nimport { LRUCache } from \"lru-cache\";\n\n/**\n * Data source for sandbox column-list builders. Has nothing to say about\n * id-resolution — `ColumnRegistry` (in `@milaboratories/pl-model-common`)\n * consumes the separate `ColumnEntriesProvider` interface for that.\n *\n * Same name as the factory function below — they merge into one TS\n * declaration: `ColumnsProvider` is callable AND the interface type.\n */\nexport interface ColumnsProvider {\n /** Returns all currently known PColumn columns as lazy views. */\n getColumns(): DataColumnRecipe<PObjectId>[];\n /** Whether the provider has finished enumerating all its columns. */\n isFinal(): boolean;\n}\n\n/**\n * Unified memoised factory dispatching to the right provider flavour by the\n * source shape:\n * - `TreeNodeAccessor` → {@link AccessorColumnsProvider}\n * (indexed by `root.handle`, walks the accessor tree once per root).\n * - `UpstreamBlockCtx<AccessorHandle>[]` (or omitted — pulled from the\n * ambient ctx) → {@link ResultPoolColumnsProvider}\n * (indexed by a content-hash of the block list).\n *\n * Both branches return cached instances within their LRU window, so repeated\n * calls with the same source skip re-walking / re-hashing.\n */\nexport function ColumnsProvider(\n source?: TreeNodeAccessor | ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>,\n) {\n if (isNil(source) || Array.isArray(source)) {\n return ResultPoolColumnsProvider(source);\n } else if (source instanceof TreeNodeAccessor) {\n return AccessorColumnsProvider(source);\n } else {\n throw new Error(\"Unknown columns provider source\");\n }\n}\n\n/**\n * Memoised constructor — same `root.handle` returns the same\n * {@link AccessorColumnsProviderImpl}, so `indexAccessorRoot` runs once per\n * accessor root (within the LRU window).\n */\nconst _accessorProviderCache = new LRUCache<AccessorHandle, AccessorColumnsProviderImpl>({\n max: 64,\n});\nexport function AccessorColumnsProvider(root: TreeNodeAccessor): AccessorColumnsProvider {\n let provider = _accessorProviderCache.get(root.handle);\n if (provider === undefined) {\n provider = new AccessorColumnsProviderImpl(root);\n _accessorProviderCache.set(root.handle, provider);\n }\n return provider;\n}\n\n/**\n * Memoised constructor — same `rawPool` content returns the same\n * {@link ResultPoolColumnsProviderImpl}, so `indexPoolBlock` runs once per\n * pool snapshot (within the LRU window).\n */\nconst _resultPoolProviderCache = new LRUCache<string, ResultPoolColumnsProviderImpl>({ max: 4 });\nexport function ResultPoolColumnsProvider(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n): ResultPoolColumnsProvider {\n const key = hashRawPool(rawPool);\n let provider = _resultPoolProviderCache.get(key);\n if (provider === undefined) {\n provider = new ResultPoolColumnsProviderImpl(rawPool);\n _resultPoolProviderCache.set(key, provider);\n }\n return provider;\n}\n\n/**\n * Simple provider wrapping an array of PColumns. Sandbox-only —\n * implements {@link ColumnsProvider} (lazy-view enumeration). It is *not* an\n * id-index source — `ColumnRegistry` does not consume it.\n */\nexport class ArrayColumnsProvider implements ColumnsProvider {\n private readonly columns: DataColumnRecipe<PObjectId>[];\n\n constructor(\n columns: ReadonlyArray<PColumn<undefined | PColumnDataUniversal> | DataColumnRecipe<PObjectId>>,\n private readonly _isFinal: boolean,\n ) {\n this.columns = columns.map((c) => DataColumn.fromColumn(c));\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n return this.columns;\n }\n\n isFinal(): boolean {\n return this._isFinal;\n }\n}\n\n/**\n * Sandbox-specific provider over a {@link TreeNodeAccessor} root. Uses the\n * accessor's own `resolvePath` as the canonical root path for id construction,\n * and adds `getColumns()` returning {@link DataColumnRecipe<PObjectId>}s on top of the generic\n * entries index.\n */\nexport class AccessorColumnsProviderImpl\n extends AccessorEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(root: TreeNodeAccessor) {\n super(root, root.resolvePath);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(this.entries.values())\n .map((e) => DataColumn.fromAccessor(e))\n .filter((v): v is DataColumnRecipe<PObjectId> => !isNil(v)));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type AccessorColumnsProvider = AccessorColumnsProviderImpl;\n\n/**\n * Sandbox-specific result-pool provider. Accepts the raw handle-shaped blocks\n * returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx} and\n * wraps them into {@link TreeNodeAccessor}s, then adds `getColumns()`.\n */\nexport class ResultPoolColumnsProviderImpl\n extends ResultPoolEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n ) {\n const blocks = rawPool.map((b) => ({\n blockId: b.blockId,\n prodCtx:\n b.prodCtx !== undefined\n ? new TreeNodeAccessor(b.prodCtx, [b.blockId, \"prodCtx\"])\n : undefined,\n stagingCtx:\n b.stagingCtx !== undefined\n ? new TreeNodeAccessor(b.stagingCtx, [b.blockId, \"stagingCtx\"])\n : undefined,\n prodIncomplete: b.prodIncomplete,\n stagingIncomplete: b.stagingIncomplete,\n }));\n\n super(blocks);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(this.getPObjectEntries().values())\n .map((e) => DataColumn.fromAccessor(e))\n .filter((v): v is DataColumnRecipe<PObjectId> => !isNil(v)));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type ResultPoolColumnsProvider = ResultPoolColumnsProviderImpl;\n\nfunction hashRawPool(rawPool: ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>): string {\n return rawPool\n .map(\n (b) =>\n `${b.blockId}\\x1f${b.prodCtx ?? \"\"}\\x1f${b.stagingCtx ?? \"\"}\\x1f${\n b.prodIncomplete ? 1 : 0\n }\\x1f${b.stagingIncomplete ? 1 : 0}`,\n )\n .join(\"\\x1e\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,gBACd,QACA;CACA,IAAI,MAAM,MAAM,KAAK,MAAM,QAAQ,MAAM,GACvC,OAAO,0BAA0B,MAAM;MAClC,IAAI,kBAAkB,kBAC3B,OAAO,wBAAwB,MAAM;MAErC,MAAM,IAAI,MAAM,iCAAiC;AAErD;;;;;;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oB,GAC1C;EACA,MAAM,SAAS,QAAQ,KAAK,OAAO;GACjC,SAAS,EAAE;GACX,SACE,EAAE,YAAY,KAAA,IACV,IAAI,iBAAiB,EAAE,SAAS,CAAC,EAAE,SAAS,SAAS,CAAC,IACtD,KAAA;GACN,YACE,EAAE,eAAe,KAAA,IACb,IAAI,iBAAiB,EAAE,YAAY,CAAC,EAAE,SAAS,YAAY,CAAC,IAC5D,KAAA;GACN,gBAAgB,EAAE;GAClB,mBAAmB,EAAE;EACvB,EAAE;EAEF,MAAM,MAAM;CACd;CAEA,aAA4C;EAC1C,IAAI,KAAK,kBAAkB,KAAA,GAAW,OAAO,KAAK;EAClD,OAAQ,KAAK,gBAAgB,MAAM,KAAK,KAAK,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,CACvE,KAAK,MAAM,WAAW,aAAa,CAAC,CAAC,CAAC,CACtC,QAAQ,MAAwC,CAAC,MAAM,CAAC,CAAC;CAC9D;AACF;AAKA,SAAS,YAAY,SAAkE;CACrF,OAAO,QACJ,KACE,MACC,GAAG,EAAE,QAAQ,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,cAAc,GAAG,MAC1D,EAAE,iBAAiB,IAAI,EACxB,MAAM,EAAE,oBAAoB,IAAI,GACrC,CAAC,CACA,KAAK,GAAM;AAChB"}
1
+ {"version":3,"file":"providers.js","names":[],"sources":["../../../src/columns/column_providers/providers.ts"],"sourcesContent":["import {\n AccessorEntriesProvider,\n ResultPoolEntriesProvider,\n type PColumn,\n type PObjectId,\n type UpstreamBlockCtx,\n} from \"@milaboratories/pl-model-common\";\nimport { AccessorHandle, PColumnDataUniversal, TreeNodeAccessor } from \"../../render\";\nimport { DataColumn, DataColumnRecipe } from \"../data_column\";\nimport { getCfgRenderCtx } from \"../../internal\";\nimport { isNil } from \"es-toolkit\";\nimport { LRUCache } from \"lru-cache\";\n\n/**\n * Data source for sandbox column-list builders. Has nothing to say about\n * id-resolution — `ColumnRegistry` (in `@milaboratories/pl-model-common`)\n * consumes the separate `ColumnEntriesProvider` interface for that.\n *\n * Same name as the factory function below — they merge into one TS\n * declaration: `ColumnsProvider` is callable AND the interface type.\n */\nexport interface ColumnsProvider {\n /** Returns all currently known PColumn columns as lazy views. */\n getColumns(): DataColumnRecipe<PObjectId>[];\n /** Whether the provider has finished enumerating all its columns. */\n isFinal(): boolean;\n}\n\n/**\n * Unified memoised factory dispatching to the right provider flavour by the\n * source shape:\n * - `TreeNodeAccessor` → {@link AccessorColumnsProvider}\n * (indexed by `root.handle`, walks the accessor tree once per root).\n * - `UpstreamBlockCtx<AccessorHandle>[]` (or omitted — pulled from the\n * ambient ctx) → {@link ResultPoolColumnsProvider}\n * (indexed by a content-hash of the block list).\n *\n * Both branches return cached instances within their LRU window, so repeated\n * calls with the same source skip re-walking / re-hashing.\n */\nexport function ColumnsProvider(\n source?: TreeNodeAccessor | ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>,\n) {\n if (isNil(source) || Array.isArray(source)) {\n return ResultPoolColumnsProvider(source);\n } else if (source instanceof TreeNodeAccessor) {\n return AccessorColumnsProvider(source);\n } else {\n throw new Error(\"Unknown columns provider source\");\n }\n}\n\n/**\n * Memoised constructor — same `root.handle` returns the same\n * {@link AccessorColumnsProviderImpl}, so `indexAccessorRoot` runs once per\n * accessor root (within the LRU window).\n */\nconst _accessorProviderCache = new LRUCache<AccessorHandle, AccessorColumnsProviderImpl>({\n max: 64,\n});\nexport function AccessorColumnsProvider(root: TreeNodeAccessor): AccessorColumnsProvider {\n let provider = _accessorProviderCache.get(root.handle);\n if (provider === undefined) {\n provider = new AccessorColumnsProviderImpl(root);\n _accessorProviderCache.set(root.handle, provider);\n }\n return provider;\n}\n\n/**\n * Memoised constructor — same `rawPool` content returns the same\n * {@link ResultPoolColumnsProviderImpl}, so `indexPoolBlock` runs once per\n * pool snapshot (within the LRU window).\n */\nconst _resultPoolProviderCache = new LRUCache<string, ResultPoolColumnsProviderImpl>({ max: 4 });\nexport function ResultPoolColumnsProvider(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n): ResultPoolColumnsProvider {\n const key = hashRawPool(rawPool);\n let provider = _resultPoolProviderCache.get(key);\n if (provider === undefined) {\n provider = new ResultPoolColumnsProviderImpl(rawPool);\n _resultPoolProviderCache.set(key, provider);\n }\n return provider;\n}\n\n/**\n * Simple provider wrapping an array of PColumns. Sandbox-only —\n * implements {@link ColumnsProvider} (lazy-view enumeration). It is *not* an\n * id-index source — `ColumnRegistry` does not consume it.\n */\nexport class ArrayColumnsProvider implements ColumnsProvider {\n private readonly columns: DataColumnRecipe<PObjectId>[];\n\n constructor(\n columns: ReadonlyArray<PColumn<undefined | PColumnDataUniversal> | DataColumnRecipe<PObjectId>>,\n private readonly _isFinal: boolean,\n ) {\n this.columns = columns.map((c) => DataColumn.fromColumn(c));\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n return this.columns;\n }\n\n isFinal(): boolean {\n return this._isFinal;\n }\n}\n\n/**\n * Sandbox-specific provider over a {@link TreeNodeAccessor} root. Uses the\n * accessor's own `resolvePath` as the canonical root path for id construction,\n * and adds `getColumns()` returning {@link DataColumnRecipe<PObjectId>}s on top of the generic\n * entries index.\n */\nexport class AccessorColumnsProviderImpl\n extends AccessorEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(root: TreeNodeAccessor) {\n super(root, root.resolvePath);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(this.entries.values(), DataColumn.fromAccessor).filter(\n (column) => column !== undefined,\n ));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type AccessorColumnsProvider = AccessorColumnsProviderImpl;\n\n/**\n * Sandbox-specific result-pool provider. Accepts the raw handle-shaped blocks\n * returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx} and\n * wraps them into {@link TreeNodeAccessor}s, then adds `getColumns()`.\n */\nexport class ResultPoolColumnsProviderImpl\n extends ResultPoolEntriesProvider<TreeNodeAccessor>\n implements ColumnsProvider\n{\n private cachedColumns?: DataColumnRecipe<PObjectId>[];\n\n constructor(\n rawPool: ReadonlyArray<\n UpstreamBlockCtx<AccessorHandle>\n > = getCfgRenderCtx().getUpstreamBlockCtx(),\n ) {\n const blocks = rawPool.map((b) => ({\n blockId: b.blockId,\n prodCtx:\n b.prodCtx !== undefined\n ? new TreeNodeAccessor(b.prodCtx, [b.blockId, \"prodCtx\"])\n : undefined,\n stagingCtx:\n b.stagingCtx !== undefined\n ? new TreeNodeAccessor(b.stagingCtx, [b.blockId, \"stagingCtx\"])\n : undefined,\n prodIncomplete: b.prodIncomplete,\n stagingIncomplete: b.stagingIncomplete,\n }));\n\n super(blocks);\n }\n\n getColumns(): DataColumnRecipe<PObjectId>[] {\n if (this.cachedColumns !== undefined) return this.cachedColumns;\n return (this.cachedColumns = Array.from(\n this.getPObjectEntries().values(),\n DataColumn.fromAccessor,\n ).filter((column) => column !== undefined));\n }\n}\n\n/** Public type alias — value of the same name is the memoised factory above. */\nexport type ResultPoolColumnsProvider = ResultPoolColumnsProviderImpl;\n\nfunction hashRawPool(rawPool: ReadonlyArray<UpstreamBlockCtx<AccessorHandle>>): string {\n return rawPool\n .map(\n (b) =>\n `${b.blockId}\\x1f${b.prodCtx ?? \"\"}\\x1f${b.stagingCtx ?? \"\"}\\x1f${\n b.prodIncomplete ? 1 : 0\n }\\x1f${b.stagingIncomplete ? 1 : 0}`,\n )\n .join(\"\\x1e\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,gBACd,QACA;CACA,IAAI,MAAM,MAAM,KAAK,MAAM,QAAQ,MAAM,GACvC,OAAO,0BAA0B,MAAM;MAClC,IAAI,kBAAkB,kBAC3B,OAAO,wBAAwB,MAAM;MAErC,MAAM,IAAI,MA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AS,QAAQ,KAAK,OAAO;GACjC,SAAS,EAAE;GACX,SACE,EAAE,YAAY,KAAA,IACV,IAAI,iBAAiB,EAAE,SAAS,CAAC,EAAE,SAAS,SAAS,CAAC,IACtD,KAAA;GACN,YACE,EAAE,eAAe,KAAA,IACb,IAAI,iBAAiB,EAAE,YAAY,CAAC,EAAE,SAAS,YAAY,CAAC,IAC5D,KAAA;GACN,gBAAgB,EAAE;GAClB,mBAAmB,EAAE;EACvB,EAAE;EAEF,MAAM,MAAM;CACd;CAEA,aAA4C;EAC1C,IAAI,KAAK,kBAAkB,KAAA,GAAW,OAAO,KAAK;EAClD,OAAQ,KAAK,gBAAgB,MAAM,KACjC,KAAK,kBAAkB,CAAC,CAAC,OAAO,GAChC,WAAW,YACb,CAAC,CAAC,QAAQ,WAAW,WAAW,KAAA,CAAS;CAC3C;AACF;AAKA,SAAS,YAAY,SAAkE;CACrF,OAAO,QACJ,KACE,MACC,GAAG,EAAE,QAAQ,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,cAAc,GAAG,MAC1D,EAAE,iBAAiB,IAAI,EACxB,MAAM,EAAE,oBAAoB,IAAI,GACrC,CAAC,CACA,KAAK,GAAM;AAChB"}
@@ -41,8 +41,8 @@ function ColumnRecipeBuild(id, opts = {}) {
41
41
  * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on
42
42
  * the parsed id shape to the matching `getStatusBy*` static — never
43
43
  * constructs the recipe. Use this at boundaries (resolver, filter/sort
44
- * targets) to throw early on `absent` instead of silently producing an empty
45
- * recipe via {@link ColumnRecipeBuild}.
44
+ * targets) to tell an `absent` column from a `resolving` one: the recipe
45
+ * factory returns `undefined` for both.
46
46
  */
47
47
  function ColumnRecipeGetStatus(id, opts = {}) {
48
48
  const parsed = (0, _milaboratories_pl_model_common.parseColumnIdSafely)(id);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["parseColumnIdSafely","isPObjectKey","DataColumn","isColumnDiscoveredKey","ColumnDiscoveredRecipe","isColumnOverriddenKey","ColumnOverriddenRecipe","isColumnFilteredKey","ColumnFilteredRecipe"],"sources":["../../../src/columns/column_recipes/index.ts"],"sourcesContent":["import {\n isColumnDiscoveredKey,\n isColumnOverriddenKey,\n parseColumnIdSafely,\n type ColumnUniversalId,\n type PObjectId,\n isPObjectKey,\n isColumnFilteredKey,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx } from \"../../render/internal\";\nimport { DataColumn } from \"../data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\nimport type {\n ColumnRecipe as ColumnRecipeBase,\n ColumnRecipeId,\n ColumnResolutionStatus,\n} from \"./types\";\n\nexport type { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from \"./types\";\nexport { ColumnAbsentError } from \"../data_column\";\nexport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nexport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nexport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\n\n// Re-declare the interface locally so the name can merge with the dispatcher\n// value declared below: a single name `ColumnRecipe` resolves to the\n// interface in type position and to the factory function (`Object.assign`d\n// with `.getStatus`) in value position.\n// (Type-only re-exports do not participate in TS declaration merging.)\nexport interface ColumnRecipe<\n ID extends ColumnRecipeId = ColumnRecipeId,\n> extends ColumnRecipeBase<ID> {}\n\n/**\n * Build a `ColumnRecipe` from a stringified id. Dispatches to the matching\n * concrete recipe variant based on the id's encoding and recurses on\n * wrappers' inner `source`:\n *\n * - bare {@link PObjectId} (non-JSON) → `DataColumnRecipe.fromId`\n * - `ColumnDiscoveredKey` → {@link ColumnDiscoveredRecipe}\n * - `ColumnOverriddenKey { source, specOverrides }` → recurse on `source`,\n * then {@link ColumnOverriddenRecipe.wrap}\n * - `ColumnFilteredKey { source, axisFilters }` → recurse on `source`,\n * then {@link ColumnFilteredRecipe.wrap}\n *\n * Returns `undefined` for unsupported variants (e.g. AnchoredPColumnId,\n * which needs an anchor map to resolve) or when a nested source itself\n * cannot be built.\n */\nfunction ColumnRecipeBuild(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): undefined | ColumnRecipe {\n const parsed = parseColumnIdSafely(id);\n\n if (isPObjectKey(parsed)) {\n return DataColumn.fromId(id as PObjectId, opts);\n }\n\n if (isColumnDiscoveredKey(parsed)) {\n return ColumnDiscoveredRecipe.fromKey(parsed, opts);\n }\n\n if (isColumnOverriddenKey(parsed)) {\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnOverriddenRecipe.wrap(inner, parsed.specOverrides);\n }\n\n if (isColumnFilteredKey(parsed)) {\n // ColumnFilteredKey.source is a stringified ColumnUniversalId (leaf or\n // any nested wrapper). Legacy `FilteredPColumnId` with an AnchoredPColumnId\n // (object) source is not supported here — guard against it explicitly.\n if (typeof parsed.source !== \"string\") {\n throw new Error(\n `Unsupported ColumnRecipe id variant: filtered column with non-string source (${JSON.stringify(parsed.source)})`,\n );\n }\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnFilteredRecipe.wrap(inner, parsed.axisFilters);\n }\n\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\n/**\n * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on\n * the parsed id shape to the matching `getStatusBy*` static — never\n * constructs the recipe. Use this at boundaries (resolver, filter/sort\n * targets) to throw early on `absent` instead of silently producing an empty\n * recipe via {@link ColumnRecipeBuild}.\n */\nfunction ColumnRecipeGetStatus(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnResolutionStatus {\n const parsed = parseColumnIdSafely(id);\n if (isPObjectKey(parsed)) return DataColumn.getStatusById(id as PObjectId, opts);\n if (isColumnDiscoveredKey(parsed)) return ColumnDiscoveredRecipe.getStatusByKey(parsed, opts);\n if (isColumnOverriddenKey(parsed)) return ColumnOverriddenRecipe.getStatusByKey(parsed, opts);\n if (isColumnFilteredKey(parsed)) return ColumnFilteredRecipe.getStatusByKey(parsed, opts);\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\nexport const ColumnRecipe: typeof ColumnRecipeBuild & {\n readonly getStatus: typeof ColumnRecipeGetStatus;\n} = Object.assign(ColumnRecipeBuild, {\n getStatus: ColumnRecipeGetStatus,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAS,kBACP,IACA,OAAqC,CAAC,GACZ;CAC1B,MAAM,UAAA,GAASA,gCAAAA,oBAAAA,CAAoB,EAAE;CAErC,KAAA,GAAIC,gCAAAA,aAAAA,CAAa,MAAM,GACrB,OAAOC,oBAAAA,WAAW,OAAO,IAAiB,IAAI;CAGhD,KAAA,GAAIC,gCAAAA,sBAAAA,CAAsB,MAAM,GAC9B,OAAOC,iCAAAA,uBAAuB,QAAQ,QAAQ,IAAI;CAGpD,KAAA,GAAIC,gCAAAA,sBAAAA,CAAsB,MAAM,GAAG;EACjC,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI;EAC9C,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,OAAOC,gCAAAA,uBAAuB,KAAK,OAAO,OAAO,aAAa;CAChE;CAEA,KAAA,GAAIC,gCAAAA,oBAAAA,CAAoB,MAAM,GAAG;EAI/B,IAAI,OAAO,OAAO,WAAW,UAC3B,MAAM,IAAI,MACR,gFAAgF,KAAK,UAAU,OAAO,MAAM,EAAE,EAChH;EAEF,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI;EAC9C,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,OAAOC,+BAAAA,qBAAqB,KAAK,OAAO,OAAO,WAAW;CAC5D;CAEA,MAAM,IAAI,MAAM,wCAAwC,IAAI;AAC9D;;;;;;;;AASA,SAAS,sBACP,IACA,OAAqC,CAAC,GACd;CACxB,MAAM,UAAA,GAASR,gCAAAA,oBAAAA,CAAoB,EAAE;CACrC,KAAA,GAAIC,gCAAAA,aAAAA,CAAa,MAAM,GAAG,OAAOC,oBAAAA,WAAW,cAAc,IAAiB,IAAI;CAC/E,KAAA,GAAIC,gCAAAA,sBAAAA,CAAsB,MAAM,GAAG,OAAOC,iCAAAA,uBAAuB,eAAe,QAAQ,IAAI;CAC5F,KAAA,GAAIC,gCAAAA,sBAAAA,CAAsB,MAAM,GAAG,OAAOC,gCAAAA,uBAAuB,eAAe,QAAQ,IAAI;CAC5F,KAAA,GAAIC,gCAAAA,oBAAAA,CAAoB,MAAM,GAAG,OAAOC,+BAAAA,qBAAqB,eAAe,QAAQ,IAAI;CACxF,MAAM,IAAI,MAAM,wCAAwC,IAAI;AAC9D;AAEA,MAAa,eAET,OAAO,OAAO,mBAAmB,EACnC,WAAW,sBACb,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["parseColumnIdSafely","isPObjectKey","DataColumn","isColumnDiscoveredKey","ColumnDiscoveredRecipe","isColumnOverriddenKey","ColumnOverriddenRecipe","isColumnFilteredKey","ColumnFilteredRecipe"],"sources":["../../../src/columns/column_recipes/index.ts"],"sourcesContent":["import {\n isColumnDiscoveredKey,\n isColumnOverriddenKey,\n parseColumnIdSafely,\n type ColumnUniversalId,\n type PObjectId,\n isPObjectKey,\n isColumnFilteredKey,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx } from \"../../render/internal\";\nimport { DataColumn } from \"../data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\nimport type {\n ColumnRecipe as ColumnRecipeBase,\n ColumnRecipeId,\n ColumnResolutionStatus,\n} from \"./types\";\n\nexport type { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from \"./types\";\nexport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nexport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nexport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\n\n// Re-declare the interface locally so the name can merge with the dispatcher\n// value declared below: a single name `ColumnRecipe` resolves to the\n// interface in type position and to the factory function (`Object.assign`d\n// with `.getStatus`) in value position.\n// (Type-only re-exports do not participate in TS declaration merging.)\nexport interface ColumnRecipe<\n ID extends ColumnRecipeId = ColumnRecipeId,\n> extends ColumnRecipeBase<ID> {}\n\n/**\n * Build a `ColumnRecipe` from a stringified id. Dispatches to the matching\n * concrete recipe variant based on the id's encoding and recurses on\n * wrappers' inner `source`:\n *\n * - bare {@link PObjectId} (non-JSON) → `DataColumnRecipe.fromId`\n * - `ColumnDiscoveredKey` → {@link ColumnDiscoveredRecipe}\n * - `ColumnOverriddenKey { source, specOverrides }` → recurse on `source`,\n * then {@link ColumnOverriddenRecipe.wrap}\n * - `ColumnFilteredKey { source, axisFilters }` → recurse on `source`,\n * then {@link ColumnFilteredRecipe.wrap}\n *\n * Returns `undefined` for unsupported variants (e.g. AnchoredPColumnId,\n * which needs an anchor map to resolve) or when a nested source itself\n * cannot be built.\n */\nfunction ColumnRecipeBuild(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): undefined | ColumnRecipe {\n const parsed = parseColumnIdSafely(id);\n\n if (isPObjectKey(parsed)) {\n return DataColumn.fromId(id as PObjectId, opts);\n }\n\n if (isColumnDiscoveredKey(parsed)) {\n return ColumnDiscoveredRecipe.fromKey(parsed, opts);\n }\n\n if (isColumnOverriddenKey(parsed)) {\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnOverriddenRecipe.wrap(inner, parsed.specOverrides);\n }\n\n if (isColumnFilteredKey(parsed)) {\n // ColumnFilteredKey.source is a stringified ColumnUniversalId (leaf or\n // any nested wrapper). Legacy `FilteredPColumnId` with an AnchoredPColumnId\n // (object) source is not supported here — guard against it explicitly.\n if (typeof parsed.source !== \"string\") {\n throw new Error(\n `Unsupported ColumnRecipe id variant: filtered column with non-string source (${JSON.stringify(parsed.source)})`,\n );\n }\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnFilteredRecipe.wrap(inner, parsed.axisFilters);\n }\n\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\n/**\n * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on\n * the parsed id shape to the matching `getStatusBy*` static — never\n * constructs the recipe. Use this at boundaries (resolver, filter/sort\n * targets) to tell an `absent` column from a `resolving` one: the recipe\n * factory returns `undefined` for both.\n */\nfunction ColumnRecipeGetStatus(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnResolutionStatus {\n const parsed = parseColumnIdSafely(id);\n if (isPObjectKey(parsed)) return DataColumn.getStatusById(id as PObjectId, opts);\n if (isColumnDiscoveredKey(parsed)) return ColumnDiscoveredRecipe.getStatusByKey(parsed, opts);\n if (isColumnOverriddenKey(parsed)) return ColumnOverriddenRecipe.getStatusByKey(parsed, opts);\n if (isColumnFilteredKey(parsed)) return ColumnFilteredRecipe.getStatusByKey(parsed, opts);\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\nexport const ColumnRecipe: typeof ColumnRecipeBuild & {\n readonly getStatus: typeof ColumnRecipeGetStatus;\n} = Object.assign(ColumnRecipeBuild, {\n getStatus: ColumnRecipeGetStatus,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,kBACP,IACA,OAAqC,CAAC,GACZ;CAC1B,MAAM,UAAA,GAASA,gCAAAA,oBAAAA,CAAoB,EAAE;CAErC,KAAA,GAAIC,gCAAAA,aAAAA,CAAa,MAAM,GACrB,OAAOC,oBAAAA,WAAW,OAAO,IAAiB,IAAI;CAGhD,KAAA,GAAIC,gCAAAA,sBAAAA,CAAsB,MAAM,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
1
  import { GlobalCfgRenderCtx } from "../../render/internal.js";
2
2
  import { ColumnFieldStatus, ColumnRecipe as ColumnRecipe$1, ColumnRecipeId, ColumnResolutionStatus, SpecQuery as SpecQuery$1 } from "./types.js";
3
- import { ColumnAbsentError } from "../data_column.js";
4
3
  import { ColumnDiscoveredRecipe } from "./column_discovered_recipe.js";
5
4
  import { ColumnFilteredRecipe } from "./column_filtered_recipe.js";
6
5
  import { ColumnOverriddenRecipe } from "./column_overrided_recipe.js";
@@ -29,8 +28,8 @@ declare function ColumnRecipeBuild(id: ColumnUniversalId, opts?: {
29
28
  * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on
30
29
  * the parsed id shape to the matching `getStatusBy*` static — never
31
30
  * constructs the recipe. Use this at boundaries (resolver, filter/sort
32
- * targets) to throw early on `absent` instead of silently producing an empty
33
- * recipe via {@link ColumnRecipeBuild}.
31
+ * targets) to tell an `absent` column from a `resolving` one: the recipe
32
+ * factory returns `undefined` for both.
34
33
  */
35
34
  declare function ColumnRecipeGetStatus(id: ColumnUniversalId, opts?: {
36
35
  ctx?: GlobalCfgRenderCtx;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["ColumnRecipeBase"],"sources":["../../../src/columns/column_recipes/index.ts"],"mappings":";;;;;;;iBA+BiB,aACf,WAAW,iBAAiB,wBACpBA,eAAiB;;;;;;;;;;;;;;;;;iBAkBlB,kBACP,IAAI,mBACJ;EAAQ,MAAM;gBACD;;;;;;;;iBAyCN,sBACP,IAAI,mBACJ;EAAQ,MAAM;IACb;qBASU,qBAAqB;WACvB,kBAAkB"}
1
+ {"version":3,"file":"index.d.ts","names":["ColumnRecipeBase"],"sources":["../../../src/columns/column_recipes/index.ts"],"mappings":";;;;;;iBA8BiB,aACf,WAAW,iBAAiB,wBACpBA,eAAiB;;;;;;;;;;;;;;;;;iBAkBlB,kBACP,IAAI,mBACJ;EAAQ,MAAM;gBACD;;;;;;;;iBAyCN,sBACP,IAAI,mBACJ;EAAQ,MAAM;IACb;qBASU,qBAAqB;WACvB,kBAAkB"}
@@ -41,8 +41,8 @@ function ColumnRecipeBuild(id, opts = {}) {
41
41
  * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on
42
42
  * the parsed id shape to the matching `getStatusBy*` static — never
43
43
  * constructs the recipe. Use this at boundaries (resolver, filter/sort
44
- * targets) to throw early on `absent` instead of silently producing an empty
45
- * recipe via {@link ColumnRecipeBuild}.
44
+ * targets) to tell an `absent` column from a `resolving` one: the recipe
45
+ * factory returns `undefined` for both.
46
46
  */
47
47
  function ColumnRecipeGetStatus(id, opts = {}) {
48
48
  const parsed = parseColumnIdSafely(id);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/columns/column_recipes/index.ts"],"sourcesContent":["import {\n isColumnDiscoveredKey,\n isColumnOverriddenKey,\n parseColumnIdSafely,\n type ColumnUniversalId,\n type PObjectId,\n isPObjectKey,\n isColumnFilteredKey,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx } from \"../../render/internal\";\nimport { DataColumn } from \"../data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\nimport type {\n ColumnRecipe as ColumnRecipeBase,\n ColumnRecipeId,\n ColumnResolutionStatus,\n} from \"./types\";\n\nexport type { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from \"./types\";\nexport { ColumnAbsentError } from \"../data_column\";\nexport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nexport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nexport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\n\n// Re-declare the interface locally so the name can merge with the dispatcher\n// value declared below: a single name `ColumnRecipe` resolves to the\n// interface in type position and to the factory function (`Object.assign`d\n// with `.getStatus`) in value position.\n// (Type-only re-exports do not participate in TS declaration merging.)\nexport interface ColumnRecipe<\n ID extends ColumnRecipeId = ColumnRecipeId,\n> extends ColumnRecipeBase<ID> {}\n\n/**\n * Build a `ColumnRecipe` from a stringified id. Dispatches to the matching\n * concrete recipe variant based on the id's encoding and recurses on\n * wrappers' inner `source`:\n *\n * - bare {@link PObjectId} (non-JSON) → `DataColumnRecipe.fromId`\n * - `ColumnDiscoveredKey` → {@link ColumnDiscoveredRecipe}\n * - `ColumnOverriddenKey { source, specOverrides }` → recurse on `source`,\n * then {@link ColumnOverriddenRecipe.wrap}\n * - `ColumnFilteredKey { source, axisFilters }` → recurse on `source`,\n * then {@link ColumnFilteredRecipe.wrap}\n *\n * Returns `undefined` for unsupported variants (e.g. AnchoredPColumnId,\n * which needs an anchor map to resolve) or when a nested source itself\n * cannot be built.\n */\nfunction ColumnRecipeBuild(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): undefined | ColumnRecipe {\n const parsed = parseColumnIdSafely(id);\n\n if (isPObjectKey(parsed)) {\n return DataColumn.fromId(id as PObjectId, opts);\n }\n\n if (isColumnDiscoveredKey(parsed)) {\n return ColumnDiscoveredRecipe.fromKey(parsed, opts);\n }\n\n if (isColumnOverriddenKey(parsed)) {\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnOverriddenRecipe.wrap(inner, parsed.specOverrides);\n }\n\n if (isColumnFilteredKey(parsed)) {\n // ColumnFilteredKey.source is a stringified ColumnUniversalId (leaf or\n // any nested wrapper). Legacy `FilteredPColumnId` with an AnchoredPColumnId\n // (object) source is not supported here — guard against it explicitly.\n if (typeof parsed.source !== \"string\") {\n throw new Error(\n `Unsupported ColumnRecipe id variant: filtered column with non-string source (${JSON.stringify(parsed.source)})`,\n );\n }\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnFilteredRecipe.wrap(inner, parsed.axisFilters);\n }\n\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\n/**\n * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on\n * the parsed id shape to the matching `getStatusBy*` static — never\n * constructs the recipe. Use this at boundaries (resolver, filter/sort\n * targets) to throw early on `absent` instead of silently producing an empty\n * recipe via {@link ColumnRecipeBuild}.\n */\nfunction ColumnRecipeGetStatus(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnResolutionStatus {\n const parsed = parseColumnIdSafely(id);\n if (isPObjectKey(parsed)) return DataColumn.getStatusById(id as PObjectId, opts);\n if (isColumnDiscoveredKey(parsed)) return ColumnDiscoveredRecipe.getStatusByKey(parsed, opts);\n if (isColumnOverriddenKey(parsed)) return ColumnOverriddenRecipe.getStatusByKey(parsed, opts);\n if (isColumnFilteredKey(parsed)) return ColumnFilteredRecipe.getStatusByKey(parsed, opts);\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\nexport const ColumnRecipe: typeof ColumnRecipeBuild & {\n readonly getStatus: typeof ColumnRecipeGetStatus;\n} = Object.assign(ColumnRecipeBuild, {\n getStatus: ColumnRecipeGetStatus,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAS,kBACP,IACA,OAAqC,CAAC,GACZ;CAC1B,MAAM,SAAS,oBAAoB,EAAE;CAErC,IAAI,aAAa,MAAM,GACrB,OAAO,WAAW,OAAO,IAAiB,IAAI;CAGhD,IAAI,sBAAsB,MAAM,GAC9B,OAAO,uBAAuB,QAAQ,QAAQ,IAAI;CAGpD,IAAI,sBAAsB,MAAM,GAAG;EACjC,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI;EAC9C,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,OAAO,uBAAuB,KAAK,OAAO,OAAO,aAAa;CAChE;CAEA,IAAI,oBAAoB,MAAM,GAAG;EAI/B,IAAI,OAAO,OAAO,WAAW,UAC3B,MAAM,IAAI,MACR,gFAAgF,KAAK,UAAU,OAAO,MAAM,EAAE,EAChH;EAEF,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI;EAC9C,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,OAAO,qBAAqB,KAAK,OAAO,OAAO,WAAW;CAC5D;CAEA,MAAM,IAAI,MAAM,wCAAwC,IAAI;AAC9D;;;;;;;;AASA,SAAS,sBACP,IACA,OAAqC,CAAC,GACd;CACxB,MAAM,SAAS,oBAAoB,EAAE;CACrC,IAAI,aAAa,MAAM,GAAG,OAAO,WAAW,cAAc,IAAiB,IAAI;CAC/E,IAAI,sBAAsB,MAAM,GAAG,OAAO,uBAAuB,eAAe,QAAQ,IAAI;CAC5F,IAAI,sBAAsB,MAAM,GAAG,OAAO,uBAAuB,eAAe,QAAQ,IAAI;CAC5F,IAAI,oBAAoB,MAAM,GAAG,OAAO,qBAAqB,eAAe,QAAQ,IAAI;CACxF,MAAM,IAAI,MAAM,wCAAwC,IAAI;AAC9D;AAEA,MAAa,eAET,OAAO,OAAO,mBAAmB,EACnC,WAAW,sBACb,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/columns/column_recipes/index.ts"],"sourcesContent":["import {\n isColumnDiscoveredKey,\n isColumnOverriddenKey,\n parseColumnIdSafely,\n type ColumnUniversalId,\n type PObjectId,\n isPObjectKey,\n isColumnFilteredKey,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx } from \"../../render/internal\";\nimport { DataColumn } from \"../data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\nimport type {\n ColumnRecipe as ColumnRecipeBase,\n ColumnRecipeId,\n ColumnResolutionStatus,\n} from \"./types\";\n\nexport type { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from \"./types\";\nexport { ColumnDiscoveredRecipe } from \"./column_discovered_recipe\";\nexport { ColumnFilteredRecipe } from \"./column_filtered_recipe\";\nexport { ColumnOverriddenRecipe } from \"./column_overrided_recipe\";\n\n// Re-declare the interface locally so the name can merge with the dispatcher\n// value declared below: a single name `ColumnRecipe` resolves to the\n// interface in type position and to the factory function (`Object.assign`d\n// with `.getStatus`) in value position.\n// (Type-only re-exports do not participate in TS declaration merging.)\nexport interface ColumnRecipe<\n ID extends ColumnRecipeId = ColumnRecipeId,\n> extends ColumnRecipeBase<ID> {}\n\n/**\n * Build a `ColumnRecipe` from a stringified id. Dispatches to the matching\n * concrete recipe variant based on the id's encoding and recurses on\n * wrappers' inner `source`:\n *\n * - bare {@link PObjectId} (non-JSON) → `DataColumnRecipe.fromId`\n * - `ColumnDiscoveredKey` → {@link ColumnDiscoveredRecipe}\n * - `ColumnOverriddenKey { source, specOverrides }` → recurse on `source`,\n * then {@link ColumnOverriddenRecipe.wrap}\n * - `ColumnFilteredKey { source, axisFilters }` → recurse on `source`,\n * then {@link ColumnFilteredRecipe.wrap}\n *\n * Returns `undefined` for unsupported variants (e.g. AnchoredPColumnId,\n * which needs an anchor map to resolve) or when a nested source itself\n * cannot be built.\n */\nfunction ColumnRecipeBuild(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): undefined | ColumnRecipe {\n const parsed = parseColumnIdSafely(id);\n\n if (isPObjectKey(parsed)) {\n return DataColumn.fromId(id as PObjectId, opts);\n }\n\n if (isColumnDiscoveredKey(parsed)) {\n return ColumnDiscoveredRecipe.fromKey(parsed, opts);\n }\n\n if (isColumnOverriddenKey(parsed)) {\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnOverriddenRecipe.wrap(inner, parsed.specOverrides);\n }\n\n if (isColumnFilteredKey(parsed)) {\n // ColumnFilteredKey.source is a stringified ColumnUniversalId (leaf or\n // any nested wrapper). Legacy `FilteredPColumnId` with an AnchoredPColumnId\n // (object) source is not supported here — guard against it explicitly.\n if (typeof parsed.source !== \"string\") {\n throw new Error(\n `Unsupported ColumnRecipe id variant: filtered column with non-string source (${JSON.stringify(parsed.source)})`,\n );\n }\n const inner = ColumnRecipe(parsed.source, opts);\n if (inner === undefined) return undefined;\n return ColumnFilteredRecipe.wrap(inner, parsed.axisFilters);\n }\n\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\n/**\n * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on\n * the parsed id shape to the matching `getStatusBy*` static — never\n * constructs the recipe. Use this at boundaries (resolver, filter/sort\n * targets) to tell an `absent` column from a `resolving` one: the recipe\n * factory returns `undefined` for both.\n */\nfunction ColumnRecipeGetStatus(\n id: ColumnUniversalId,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnResolutionStatus {\n const parsed = parseColumnIdSafely(id);\n if (isPObjectKey(parsed)) return DataColumn.getStatusById(id as PObjectId, opts);\n if (isColumnDiscoveredKey(parsed)) return ColumnDiscoveredRecipe.getStatusByKey(parsed, opts);\n if (isColumnOverriddenKey(parsed)) return ColumnOverriddenRecipe.getStatusByKey(parsed, opts);\n if (isColumnFilteredKey(parsed)) return ColumnFilteredRecipe.getStatusByKey(parsed, opts);\n throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);\n}\n\nexport const ColumnRecipe: typeof ColumnRecipeBuild & {\n readonly getStatus: typeof ColumnRecipeGetStatus;\n} = Object.assign(ColumnRecipeBuild, {\n getStatus: ColumnRecipeGetStatus,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,kBACP,IACA,OAAqC,CAAC,GACZ;CAC1B,MAAM,SAAS,oBAAoB,EAAE;CAErC,IAAI,aAAa,MAAM,GACrB,OAAO,WAAW,OAAO,IAAiB,IAAI;CAGhD,IAAI,sBAAsB,MAAM,GAC9B,OAAO,uBAAuB,QAAQ,QAAQ,IAAI;CAGpD,IAAI,sBAAsB,MAAM,GAAG;EACjC,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI;EAC9C,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,OAAO,uBAAuB,KAAK,OAAO,OAAO,aAAa;CAChE;CAEA,IAAI,oBAAoB,MAAM,GAAG;EAI/B,IAAI,OAAO,OAAO,WAAW,UAC3B,MAAM,IAAI,MACR,gFAAgF,KAAK,UAAU,OAAO,MAAM,EAAE,EAChH;EAEF,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI;EAC9C,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,OAAO,qBAAqB,KAAK,OAAO,OAAO,WAAW;CAC5D;CAEA,MAAM,IAAI,MAAM,wCAAwC,IAAI;AAC9D;;;;;;;;AASA,SAAS,sBACP,IACA,OAAqC,CAAC,GACd;CACxB,MAAM,SAAS,oBAAoB,EAAE;CACrC,IAAI,aAAa,MAAM,GAAG,OAAO,WAAW,cAAc,IAAiB,IAAI;CAC/E,IAAI,sBAAsB,MAAM,GAAG,OAAO,uBAAuB,eAAe,QAAQ,IAAI;CAC5F,IAAI,sBAAsB,MAAM,GAAG,OAAO,uBAAuB,eAAe,QAAQ,IAAI;CAC5F,IAAI,oBAAoB,MAAM,GAAG,OAAO,qBAAqB,eAAe,QAAQ,IAAI;CACxF,MAAM,IAAI,MAAM,wCAAwC,IAAI;AAC9D;AAEA,MAAa,eAET,OAAO,OAAO,mBAAmB,EACnC,WAAW,sBACb,CAAC"}
@@ -5,25 +5,6 @@ let es_toolkit = require("es-toolkit");
5
5
  let lru_cache = require("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,29 +56,15 @@ var DataColumnImpl = class DataColumnImpl {
75
56
  }
76
57
  /**
77
58
  * Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:
78
- * returns `undefined` if the leaf isn't reachable yet (resolving). Throws
79
- * {@link ColumnAbsentError} when every relevant accessor is `inputsLocked`
80
- * and the column did not appear — the column will not exist in this ctx.
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).
81
62
  * Data and dataStatus stay lazy.
82
63
  */
83
64
  static fromId(id, { ctx } = {}) {
84
- const registry = new _milaboratories_pl_model_common.ColumnRegistry(require_index.getCtxProviders({ ctx }));
85
- const leaf = registry.resolve(id);
86
- if ((0, es_toolkit.isNil)(leaf)) {
87
- if (registry.isFinal()) throw new ColumnAbsentError(id);
88
- return;
89
- }
90
- const spec = readSpecAccessor(leaf);
91
- if ((0, es_toolkit.isNil)(spec)) {
92
- if (leaf.accessor.getInputsLocked()) throw new ColumnAbsentError(id);
93
- return;
94
- }
95
- if (!spec.hasData()) return void 0;
96
- return new DataColumnImpl(id, {
97
- getSpec: () => spec.getDataAsJson(),
98
- getData: () => readDataAccessor(leaf),
99
- getDataStatus: () => readDataStatus(leaf)
100
- });
65
+ const leaf = new _milaboratories_pl_model_common.ColumnRegistry(require_index.getCtxProviders({ ctx })).resolve(id);
66
+ if ((0, es_toolkit.isNil)(leaf)) return void 0;
67
+ return DataColumnImpl.fromAccessor(leaf);
101
68
  }
102
69
  /** {@link PlRef} wrapper over {@link fromId}. */
103
70
  static fromPlRef(ref) {
@@ -105,18 +72,15 @@ var DataColumnImpl = class DataColumnImpl {
105
72
  }
106
73
  /**
107
74
  * Bind directly to an accessor-backed {@link LeafEntry} — no registry.
108
- * Throws {@link ColumnAbsentError} if the leaf has no spec field and its
109
- * accessor is `inputsLocked`. Returns `undefined` while still resolving.
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.
110
78
  */
111
79
  static fromAccessor(entry) {
112
- const spec = readSpecAccessor(entry);
113
- if ((0, es_toolkit.isNil)(spec)) {
114
- if (entry.accessor.getInputsLocked()) throw new ColumnAbsentError(entry.id);
115
- return;
116
- }
117
- if (!spec.hasData()) return void 0;
80
+ const spec = readSpec(entry);
81
+ if (spec === void 0 || !(0, _milaboratories_pl_model_common.isPColumnSpec)(spec)) return void 0;
118
82
  return new DataColumnImpl(entry.id, {
119
- getSpec: () => spec.getDataAsJson(),
83
+ getSpec: () => spec,
120
84
  getData: () => readDataAccessor(entry),
121
85
  getDataStatus: () => readDataStatus(entry)
122
86
  });
@@ -138,7 +102,9 @@ var DataColumnImpl = class DataColumnImpl {
138
102
  * Distinguishes `present` / `resolving` / `absent` for a {@link PObjectId}
139
103
  * in the active render ctx. Falls back to the registry's `isFinal()`
140
104
  * when the id has no entry — only then we can say `absent` instead of
141
- * `resolving`.
105
+ * `resolving`. The status tells only whether the spec is readable: for an
106
+ * export that is not a column it is `present`, and the factories return
107
+ * `undefined`.
142
108
  */
143
109
  static getStatusById(id, { ctx } = {}) {
144
110
  const registry = new _milaboratories_pl_model_common.ColumnRegistry(require_index.getCtxProviders({ ctx }));
@@ -207,6 +173,12 @@ const readSpecAccessor = memoizeByEntry(({ accessor, name }) => accessor.travers
207
173
  assertFieldType: "Input",
208
174
  ignoreError: true
209
175
  }));
176
+ /** The leaf's spec, or `undefined` until the spec resource has data. */
177
+ const readSpec = memoizeByEntry((entry) => {
178
+ const spec = readSpecAccessor(entry);
179
+ if ((0, es_toolkit.isNil)(spec) || !spec.hasData()) return void 0;
180
+ return spec.getDataAsJson();
181
+ });
210
182
  /**
211
183
  * Per-entry counterpart to {@link readDataStatus}: tells whether the leaf's
212
184
  * **spec** can be read in this ctx, and — for the negative cases —
@@ -242,7 +214,6 @@ function memoizeByEntry(fn) {
242
214
  return hit.value;
243
215
  };
244
216
  }
245
- exports.ColumnAbsentError = ColumnAbsentError;
246
217
  exports.DataColumn = DataColumn;
247
218
  exports.DataColumnImpl = DataColumnImpl;
248
219
  exports.isDataColumn = isDataColumn;
@@ -1 +1 @@
1
- {"version":3,"file":"data_column.cjs","names":["ColumnOverriddenRecipe","ColumnRegistry","getCtxProviders","isNil","createGlobalPObjectId","isPlRef","isPColumn","LRUCache"],"sources":["../../src/columns/data_column.ts"],"sourcesContent":["import {\n ColumnRegistry,\n createGlobalPObjectId,\n isPColumn,\n isPlRef,\n PlRef,\n PObjectId,\n type ColumnUniversalId,\n type LeafEntry,\n type PColumn,\n type PColumnSpec,\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 — the column will not exist in this ctx.\n * 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 const spec = readSpecAccessor(leaf);\n if (isNil(spec)) {\n if (leaf.accessor.getInputsLocked()) throw new ColumnAbsentError(id);\n return undefined;\n }\n if (!spec.hasData()) return undefined;\n return new DataColumnImpl(id, {\n getSpec: () => spec.getDataAsJson<PColumnSpec>(),\n getData: () => readDataAccessor(leaf),\n getDataStatus: () => readDataStatus(leaf),\n });\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`. Returns `undefined` while still resolving.\n */\n static fromAccessor(entry: LeafEntry<TreeNodeAccessor>): undefined | DataColumnRecipe<PObjectId> {\n const spec = readSpecAccessor(entry);\n if (isNil(spec)) {\n if (entry.accessor.getInputsLocked()) throw new ColumnAbsentError(entry.id);\n return undefined;\n }\n if (!spec.hasData()) return undefined;\n return new DataColumnImpl(entry.id, {\n getSpec: () => spec.getDataAsJson<PColumnSpec>(),\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`.\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/**\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":";;;;;;;;;;;;;;;;;AAgEA,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,g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,OAAO,SAAS,gBAAgB,IAAI,WAAW;AACjD,CACF;AAEA,SAAS,eACP,IAC2C;CAC3C,MAAM,QAAQ,IAAII,UAAAA,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.cjs","names":["ColumnOverriddenRecipe","ColumnRegistry","getCtxProviders","isNil","createGlobalPObjectId","isPColumnSpec","isPlRef","isPColumn","LRUCache"],"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,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;;;;;;CAOA,UAAU,WAAwC;EAChD,OAAOA,gCAAAA,uBAAuB,KAAK,MAAM,SAAS;CACpD;;;;;;;;CASA,OAAO,OACL,IACA,EAAE,QAAsC,CAAC,GACA;EACzC,MAAM,OAAO,IAAIC,gCAAAA,eAAeC,cAAAA,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;EACpE,KAAA,GAAIC,WAAAA,MAAAA,CAAM,IAAI,GAAG,OAAO,KAAA;EACxB,OAAO,eAAe,aAAa,IAAI;CACzC;;CAGA,OAAO,UAAU,KAAqD;EACpE,OAAO,eAAe,QAAA,GAAOC,gCAAAA,sBAAAA,CAAsB,IAAI,SAAS,I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A,WAAAA,MAAAA,CAAM,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,IAAIK,UAAAA,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"}
@@ -2,7 +2,7 @@ import { GlobalCfgRenderCtx, PColumnDataUniversal } from "../render/internal.js"
2
2
  import { TreeNodeAccessor } from "../render/accessor.js";
3
3
  import "../render/index.js";
4
4
  import { ColumnFieldStatus, ColumnRecipe, ColumnRecipeId, ColumnResolutionStatus } from "./column_recipes/types.js";
5
- import { ColumnUniversalId, LeafEntry, PColumn, PColumnSpec, PObjectId, PlRef, SpecOverrides, SpecQuery } from "@milaboratories/pl-model-common";
5
+ import { LeafEntry, PColumn, PColumnSpec, PObjectId, PlRef, SpecOverrides, SpecQuery } from "@milaboratories/pl-model-common";
6
6
  export type DataColumnId = PObjectId;
7
7
  export type ColumnData = undefined | PColumnDataUniversal;
8
8
  /**
@@ -24,21 +24,6 @@ export interface DataColumnRecipe<ID extends ColumnRecipeId = ColumnRecipeId> ex
24
24
  /** Column data, consistent with {@link ColumnRecipe.getSpec}. */
25
25
  getData(): ColumnData;
26
26
  }
27
- /**
28
- * Thrown by leaf-recipe factories when the requested column is provably
29
- * absent in the active render ctx — i.e. every relevant accessor reports
30
- * `inputsLocked` and the column did not appear. Distinct from the
31
- * `undefined` return that the factories still use for the "resolving" case
32
- * (the column may still appear later).
33
- *
34
- * Catch at the boundary (resolver / filter+sort wiring / data-table assembly)
35
- * when partial absence should be surfaced to the user rather than silently
36
- * producing an empty result.
37
- */
38
- export declare class ColumnAbsentError extends Error {
39
- readonly id: ColumnUniversalId;
40
- constructor(id: ColumnUniversalId);
41
- }
42
27
  /**
43
28
  * The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare
44
29
  * {@link PObjectId} and whose readers are bound to a single tree-accessor
@@ -70,9 +55,9 @@ export declare class DataColumnImpl implements DataColumnRecipe<PObjectId> {
70
55
  withSpecs(overrides: SpecOverrides): ColumnRecipe;
71
56
  /**
72
57
  * Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:
73
- * returns `undefined` if the leaf isn't reachable yet (resolving). Throws
74
- * {@link ColumnAbsentError} when every relevant accessor is `inputsLocked`
75
- * and the column did not appear — the column will not exist in this ctx.
58
+ * returns `undefined` unless the id names a column whose spec is readable in
59
+ * this ctx — while it is resolving, when it is absent, and when the id names
60
+ * an export that is not a column (a `kind: "File"` object, for example).
76
61
  * Data and dataStatus stay lazy.
77
62
  */
78
63
  static fromId(id: PObjectId, { ctx }?: {
@@ -82,8 +67,9 @@ export declare class DataColumnImpl implements DataColumnRecipe<PObjectId> {
82
67
  static fromPlRef(ref: PlRef): undefined | DataColumnRecipe<PObjectId>;
83
68
  /**
84
69
  * Bind directly to an accessor-backed {@link LeafEntry} — no registry.
85
- * Throws {@link ColumnAbsentError} if the leaf has no spec field and its
86
- * accessor is `inputsLocked`. Returns `undefined` while still resolving.
70
+ * Returns `undefined` unless the leaf's spec is readable and is a column
71
+ * spec: while the spec is resolving, when it is absent, and for an export
72
+ * that is not a column.
87
73
  */
88
74
  static fromAccessor(entry: LeafEntry<TreeNodeAccessor>): undefined | DataColumnRecipe<PObjectId>;
89
75
  /**
@@ -95,7 +81,9 @@ export declare class DataColumnImpl implements DataColumnRecipe<PObjectId> {
95
81
  * Distinguishes `present` / `resolving` / `absent` for a {@link PObjectId}
96
82
  * in the active render ctx. Falls back to the registry's `isFinal()`
97
83
  * when the id has no entry — only then we can say `absent` instead of
98
- * `resolving`.
84
+ * `resolving`. The status tells only whether the spec is readable: for an
85
+ * export that is not a column it is `present`, and the factories return
86
+ * `undefined`.
99
87
  */
100
88
  static getStatusById(id: PObjectId, { ctx }?: {
101
89
  ctx?: GlobalCfgRenderCtx;
@@ -1 +1 @@
1
- {"version":3,"file":"data_column.d.ts","names":[],"sources":["../../src/columns/data_column.ts"],"mappings":";;;;;YA2BY,eAAe;YACf,yBAAyB;;;;;;;;;;;;;;;;iBAkBpB,iBACf,WAAW,iBAAiB,wBACpB,aAAa;;EAErB,WAAW;;;;;;;;;;;;;qBAcA,0BAA0B;WACT,IAAI;EAAhC,YAA4B,IAAI;;;;;;;;;;;qBAerB,0BAA0B,iBAAiB;WAMpC,IAAI;mBACH;UANX;UACA;UACA;UAED;;EAUP,oBAAoB;EAIpB,WAAW;;EAQX,YAAY;EAIZ,WAAW;EAKX,iBAAiB;;;;;;EAYjB,UAAU,WAAW,gBAAgB;;;;;;;;SAW9B,OACL,IAAI,aACF;IAAS,MAAM;kBACJ,iBAAiB;;SAqBzB,UAAU,KAAK,oBAAoB,iBAAiB;;;;;;SASpD,aAAa,OAAO,UAAU,gCAAgC,iBAAiB;;;;;SAkB/E,WACL,QAAQ,QAAQ,cAAc,iBAAiB,aAC9C,iBAAiB;;;;;;;SAoBb,cACL,IAAI,aACF;IAAS,MAAM;MAChB;;SAQI,iBACL,KAAK,OACL;IAAQ,MAAM;MACb;;SAKI,oBAAoB,OAAO,UAAU,oBAAoB;;;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