@platforma-sdk/model 1.79.24 → 1.80.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 (356) hide show
  1. package/dist/block_model.d.ts +2 -0
  2. package/dist/block_model.d.ts.map +1 -1
  3. package/dist/columns/column.cjs +28 -0
  4. package/dist/columns/column.cjs.map +1 -0
  5. package/dist/columns/column.d.ts +30 -0
  6. package/dist/columns/column.d.ts.map +1 -0
  7. package/dist/columns/column.js +27 -0
  8. package/dist/columns/column.js.map +1 -0
  9. package/dist/columns/column_lazy.cjs +248 -0
  10. package/dist/columns/column_lazy.cjs.map +1 -0
  11. package/dist/columns/column_lazy.d.ts +137 -0
  12. package/dist/columns/column_lazy.d.ts.map +1 -0
  13. package/dist/columns/column_lazy.js +245 -0
  14. package/dist/columns/column_lazy.js.map +1 -0
  15. package/dist/columns/column_providers/index.cjs +62 -0
  16. package/dist/columns/column_providers/index.cjs.map +1 -0
  17. package/dist/columns/column_providers/index.d.ts +30 -0
  18. package/dist/columns/column_providers/index.d.ts.map +1 -0
  19. package/dist/columns/column_providers/index.js +53 -0
  20. package/dist/columns/column_providers/index.js.map +1 -0
  21. package/dist/columns/column_providers/providers.cjs +123 -0
  22. package/dist/columns/column_providers/providers.cjs.map +1 -0
  23. package/dist/columns/column_providers/providers.d.ts +75 -0
  24. package/dist/columns/column_providers/providers.d.ts.map +1 -0
  25. package/dist/columns/column_providers/providers.js +118 -0
  26. package/dist/columns/column_providers/providers.js.map +1 -0
  27. package/dist/columns/column_providers/types.d.ts +23 -0
  28. package/dist/columns/column_providers/types.d.ts.map +1 -0
  29. package/dist/columns/column_recipes/column_discovered_recipe.cjs +180 -0
  30. package/dist/columns/column_recipes/column_discovered_recipe.cjs.map +1 -0
  31. package/dist/columns/column_recipes/column_discovered_recipe.d.ts +120 -0
  32. package/dist/columns/column_recipes/column_discovered_recipe.d.ts.map +1 -0
  33. package/dist/columns/column_recipes/column_discovered_recipe.js +180 -0
  34. package/dist/columns/column_recipes/column_discovered_recipe.js.map +1 -0
  35. package/dist/columns/column_recipes/column_filtered_recipe.cjs +133 -0
  36. package/dist/columns/column_recipes/column_filtered_recipe.cjs.map +1 -0
  37. package/dist/columns/column_recipes/column_filtered_recipe.d.ts +75 -0
  38. package/dist/columns/column_recipes/column_filtered_recipe.d.ts.map +1 -0
  39. package/dist/columns/column_recipes/column_filtered_recipe.js +133 -0
  40. package/dist/columns/column_recipes/column_filtered_recipe.js.map +1 -0
  41. package/dist/columns/column_recipes/column_overrided_recipe.cjs +101 -0
  42. package/dist/columns/column_recipes/column_overrided_recipe.cjs.map +1 -0
  43. package/dist/columns/column_recipes/column_overrided_recipe.d.ts +73 -0
  44. package/dist/columns/column_recipes/column_overrided_recipe.d.ts.map +1 -0
  45. package/dist/columns/column_recipes/column_overrided_recipe.js +101 -0
  46. package/dist/columns/column_recipes/column_overrided_recipe.js.map +1 -0
  47. package/dist/columns/column_recipes/index.cjs +72 -0
  48. package/dist/columns/column_recipes/index.cjs.map +1 -0
  49. package/dist/columns/column_recipes/index.d.ts +52 -0
  50. package/dist/columns/column_recipes/index.d.ts.map +1 -0
  51. package/dist/columns/column_recipes/index.js +68 -0
  52. package/dist/columns/column_recipes/index.js.map +1 -0
  53. package/dist/columns/column_recipes/leaf_rebrand.cjs +22 -0
  54. package/dist/columns/column_recipes/leaf_rebrand.cjs.map +1 -0
  55. package/dist/columns/column_recipes/leaf_rebrand.js +22 -0
  56. package/dist/columns/column_recipes/leaf_rebrand.js.map +1 -0
  57. package/dist/columns/column_recipes/types.d.ts +101 -0
  58. package/dist/columns/column_recipes/types.d.ts.map +1 -0
  59. package/dist/columns/columns_collection.cjs +124 -0
  60. package/dist/columns/columns_collection.cjs.map +1 -0
  61. package/dist/columns/columns_collection.d.ts +64 -0
  62. package/dist/columns/columns_collection.d.ts.map +1 -0
  63. package/dist/columns/columns_collection.js +122 -0
  64. package/dist/columns/columns_collection.js.map +1 -0
  65. package/dist/columns/derive_axis_values_labels.cjs +76 -0
  66. package/dist/columns/derive_axis_values_labels.cjs.map +1 -0
  67. package/dist/columns/derive_axis_values_labels.d.ts +30 -0
  68. package/dist/columns/derive_axis_values_labels.d.ts.map +1 -0
  69. package/dist/columns/derive_axis_values_labels.js +76 -0
  70. package/dist/columns/derive_axis_values_labels.js.map +1 -0
  71. package/dist/columns/expand_by_partition.cjs +53 -56
  72. package/dist/columns/expand_by_partition.cjs.map +1 -1
  73. package/dist/columns/expand_by_partition.d.ts +22 -18
  74. package/dist/columns/expand_by_partition.d.ts.map +1 -1
  75. package/dist/columns/expand_by_partition.js +55 -58
  76. package/dist/columns/expand_by_partition.js.map +1 -1
  77. package/dist/columns/index.cjs +44 -18
  78. package/dist/columns/index.d.ts +15 -7
  79. package/dist/columns/index.js +12 -6
  80. package/dist/columns/utils.cjs +186 -0
  81. package/dist/columns/utils.cjs.map +1 -0
  82. package/dist/columns/utils.d.ts +96 -0
  83. package/dist/columns/utils.d.ts.map +1 -0
  84. package/dist/columns/utils.js +179 -0
  85. package/dist/columns/utils.js.map +1 -0
  86. package/dist/components/PFrameForGraphs.cjs +1 -0
  87. package/dist/components/PFrameForGraphs.cjs.map +1 -1
  88. package/dist/components/PFrameForGraphs.d.ts +1 -1
  89. package/dist/components/PFrameForGraphs.d.ts.map +1 -1
  90. package/dist/components/PFrameForGraphs.js +1 -0
  91. package/dist/components/PFrameForGraphs.js.map +1 -1
  92. package/dist/components/PlDataTable/columnResolver.cjs +28 -0
  93. package/dist/components/PlDataTable/columnResolver.cjs.map +1 -0
  94. package/dist/components/PlDataTable/columnResolver.js +28 -0
  95. package/dist/components/PlDataTable/columnResolver.js.map +1 -0
  96. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs +4 -2
  97. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs.map +1 -1
  98. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js +4 -2
  99. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js.map +1 -1
  100. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs +20 -25
  101. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs.map +1 -1
  102. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js +20 -25
  103. package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js.map +1 -1
  104. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs +58 -26
  105. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs.map +1 -1
  106. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts +1 -1
  107. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts.map +1 -1
  108. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js +60 -28
  109. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js.map +1 -1
  110. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs +224 -194
  111. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
  112. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +13 -16
  113. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts.map +1 -1
  114. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js +228 -198
  115. package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
  116. package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs +40 -98
  117. package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs.map +1 -1
  118. package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts +17 -8
  119. package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts.map +1 -1
  120. package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js +40 -98
  121. package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js.map +1 -1
  122. package/dist/components/PlDataTable/createPlDataTable/index.cjs +1 -1
  123. package/dist/components/PlDataTable/createPlDataTable/index.cjs.map +1 -1
  124. package/dist/components/PlDataTable/createPlDataTable/index.d.ts +2 -2
  125. package/dist/components/PlDataTable/createPlDataTable/index.js +2 -2
  126. package/dist/components/PlDataTable/createPlDataTable/index.js.map +1 -1
  127. package/dist/components/PlDataTable/createPlDataTable/utils.cjs +51 -169
  128. package/dist/components/PlDataTable/createPlDataTable/utils.cjs.map +1 -1
  129. package/dist/components/PlDataTable/createPlDataTable/utils.d.ts +1 -1
  130. package/dist/components/PlDataTable/createPlDataTable/utils.d.ts.map +1 -1
  131. package/dist/components/PlDataTable/createPlDataTable/utils.js +52 -166
  132. package/dist/components/PlDataTable/createPlDataTable/utils.js.map +1 -1
  133. package/dist/components/PlDataTable/createPlDataTableSheet.cjs.map +1 -1
  134. package/dist/components/PlDataTable/createPlDataTableSheet.d.ts +1 -1
  135. package/dist/components/PlDataTable/createPlDataTableSheet.js.map +1 -1
  136. package/dist/components/PlDataTable/index.cjs +1 -1
  137. package/dist/components/PlDataTable/index.d.ts +4 -4
  138. package/dist/components/PlDataTable/index.js +2 -2
  139. package/dist/components/PlDataTable/labels.cjs +0 -1
  140. package/dist/components/PlDataTable/labels.cjs.map +1 -1
  141. package/dist/components/PlDataTable/labels.js +0 -1
  142. package/dist/components/PlDataTable/labels.js.map +1 -1
  143. package/dist/components/PlDataTable/state-migration.cjs +107 -10
  144. package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
  145. package/dist/components/PlDataTable/state-migration.d.ts +5 -4
  146. package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
  147. package/dist/components/PlDataTable/state-migration.js +107 -10
  148. package/dist/components/PlDataTable/state-migration.js.map +1 -1
  149. package/dist/components/PlDataTable/typesV7.d.ts +1 -36
  150. package/dist/components/PlDataTable/typesV7.d.ts.map +1 -1
  151. package/dist/components/PlDataTable/typesV8.d.ts +123 -0
  152. package/dist/components/PlDataTable/typesV8.d.ts.map +1 -0
  153. package/dist/components/PlDatasetSelector/build_dataset_options.cjs +27 -34
  154. package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
  155. package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
  156. package/dist/components/PlDatasetSelector/build_dataset_options.js +27 -34
  157. package/dist/components/PlDatasetSelector/build_dataset_options.js.map +1 -1
  158. package/dist/components/PlDatasetSelector/enrichment_discovery.cjs +28 -33
  159. package/dist/components/PlDatasetSelector/enrichment_discovery.cjs.map +1 -1
  160. package/dist/components/PlDatasetSelector/enrichment_discovery.js +29 -34
  161. package/dist/components/PlDatasetSelector/enrichment_discovery.js.map +1 -1
  162. package/dist/components/PlDatasetSelector/filter_discovery.cjs +27 -17
  163. package/dist/components/PlDatasetSelector/filter_discovery.cjs.map +1 -1
  164. package/dist/components/PlDatasetSelector/filter_discovery.d.ts +24 -10
  165. package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
  166. package/dist/components/PlDatasetSelector/filter_discovery.js +28 -18
  167. package/dist/components/PlDatasetSelector/filter_discovery.js.map +1 -1
  168. package/dist/components/PlDatasetSelector/index.d.ts +2 -2
  169. package/dist/components/index.cjs +1 -1
  170. package/dist/components/index.d.ts +5 -5
  171. package/dist/components/index.js +2 -2
  172. package/dist/filters/converters/filterToQuery.cjs +5 -6
  173. package/dist/filters/converters/filterToQuery.cjs.map +1 -1
  174. package/dist/filters/converters/filterToQuery.d.ts +12 -3
  175. package/dist/filters/converters/filterToQuery.d.ts.map +1 -1
  176. package/dist/filters/converters/filterToQuery.js +5 -6
  177. package/dist/filters/converters/filterToQuery.js.map +1 -1
  178. package/dist/filters/converters/index.d.ts +2 -2
  179. package/dist/filters/index.d.ts +2 -2
  180. package/dist/index.cjs +64 -35
  181. package/dist/index.d.ts +23 -15
  182. package/dist/index.js +15 -9
  183. package/dist/labels/derive_distinct_labels.cjs.map +1 -1
  184. package/dist/labels/derive_distinct_labels.d.ts +1 -2
  185. package/dist/labels/derive_distinct_labels.d.ts.map +1 -1
  186. package/dist/labels/derive_distinct_labels.js.map +1 -1
  187. package/dist/labels/derive_distinct_tooltips.cjs +1 -1
  188. package/dist/labels/derive_distinct_tooltips.cjs.map +1 -1
  189. package/dist/labels/derive_distinct_tooltips.d.ts +6 -3
  190. package/dist/labels/derive_distinct_tooltips.d.ts.map +1 -1
  191. package/dist/labels/derive_distinct_tooltips.js +1 -1
  192. package/dist/labels/derive_distinct_tooltips.js.map +1 -1
  193. package/dist/package.cjs +1 -1
  194. package/dist/package.js +1 -1
  195. package/dist/pframe_utils/axes.cjs.map +1 -1
  196. package/dist/pframe_utils/axes.d.ts +2 -2
  197. package/dist/pframe_utils/axes.d.ts.map +1 -1
  198. package/dist/pframe_utils/axes.js.map +1 -1
  199. package/dist/pframe_utils/columns.cjs +6 -10
  200. package/dist/pframe_utils/columns.cjs.map +1 -1
  201. package/dist/pframe_utils/columns.d.ts +4 -4
  202. package/dist/pframe_utils/columns.d.ts.map +1 -1
  203. package/dist/pframe_utils/columns.js +7 -11
  204. package/dist/pframe_utils/columns.js.map +1 -1
  205. package/dist/pframe_utils/index.cjs.map +1 -1
  206. package/dist/pframe_utils/index.d.ts +1 -1
  207. package/dist/pframe_utils/index.d.ts.map +1 -1
  208. package/dist/pframe_utils/index.js.map +1 -1
  209. package/dist/render/accessor.cjs +15 -16
  210. package/dist/render/accessor.cjs.map +1 -1
  211. package/dist/render/accessor.d.ts +7 -10
  212. package/dist/render/accessor.d.ts.map +1 -1
  213. package/dist/render/accessor.js +15 -16
  214. package/dist/render/accessor.js.map +1 -1
  215. package/dist/render/api.cjs +34 -36
  216. package/dist/render/api.cjs.map +1 -1
  217. package/dist/render/api.d.ts +30 -20
  218. package/dist/render/api.d.ts.map +1 -1
  219. package/dist/render/api.js +35 -38
  220. package/dist/render/api.js.map +1 -1
  221. package/dist/render/index.cjs +4 -0
  222. package/dist/render/index.d.ts +4 -4
  223. package/dist/render/index.js +3 -2
  224. package/dist/render/internal.cjs +3 -2
  225. package/dist/render/internal.cjs.map +1 -1
  226. package/dist/render/internal.d.ts +17 -9
  227. package/dist/render/internal.d.ts.map +1 -1
  228. package/dist/render/internal.js +3 -2
  229. package/dist/render/internal.js.map +1 -1
  230. package/dist/render/util/axis_filtering.cjs.map +1 -1
  231. package/dist/render/util/axis_filtering.js.map +1 -1
  232. package/dist/render/util/column_collection.cjs +6 -4
  233. package/dist/render/util/column_collection.cjs.map +1 -1
  234. package/dist/render/util/column_collection.d.ts +9 -9
  235. package/dist/render/util/column_collection.d.ts.map +1 -1
  236. package/dist/render/util/column_collection.js +6 -4
  237. package/dist/render/util/column_collection.js.map +1 -1
  238. package/dist/render/util/index.d.ts +2 -2
  239. package/dist/render/util/pcolumn_data.cjs +1 -1
  240. package/dist/render/util/pcolumn_data.cjs.map +1 -1
  241. package/dist/render/util/pcolumn_data.d.ts +3 -3
  242. package/dist/render/util/pcolumn_data.d.ts.map +1 -1
  243. package/dist/render/util/pcolumn_data.js +1 -1
  244. package/dist/render/util/pcolumn_data.js.map +1 -1
  245. package/dist/services/block_services.cjs +2 -1
  246. package/dist/services/block_services.cjs.map +1 -1
  247. package/dist/services/block_services.d.ts +1 -0
  248. package/dist/services/block_services.d.ts.map +1 -1
  249. package/dist/services/block_services.js +2 -1
  250. package/dist/services/block_services.js.map +1 -1
  251. package/dist/services/get_services.cjs +2 -2
  252. package/dist/services/get_services.cjs.map +1 -1
  253. package/dist/services/get_services.d.ts +4 -1
  254. package/dist/services/get_services.d.ts.map +1 -1
  255. package/dist/services/get_services.js +2 -2
  256. package/dist/services/get_services.js.map +1 -1
  257. package/package.json +9 -7
  258. package/src/columns/__test_helpers__/collection_driver.ts +197 -0
  259. package/src/columns/__test_helpers__/stub_registry.ts +134 -0
  260. package/src/columns/column.ts +46 -0
  261. package/src/columns/column_lazy.test.ts +201 -0
  262. package/src/columns/column_lazy.ts +311 -0
  263. package/src/columns/column_providers/index.ts +78 -0
  264. package/src/columns/column_providers/providers.ts +193 -0
  265. package/src/columns/column_providers/types.ts +24 -0
  266. package/src/columns/column_recipes/column_discovered_recipe.ts +231 -0
  267. package/src/columns/column_recipes/column_filtered_recipe.ts +184 -0
  268. package/src/columns/column_recipes/column_overrided_recipe.ts +146 -0
  269. package/src/columns/column_recipes/column_recipes.test.ts +681 -0
  270. package/src/columns/column_recipes/index.ts +127 -0
  271. package/src/columns/column_recipes/leaf_rebrand.ts +28 -0
  272. package/src/columns/column_recipes/types.ts +113 -0
  273. package/src/columns/columns_collection.test.ts +164 -0
  274. package/src/columns/columns_collection.ts +170 -0
  275. package/src/columns/derive_axis_values_labels.ts +98 -0
  276. package/src/columns/expand_by_partition.test.ts +146 -110
  277. package/src/columns/expand_by_partition.ts +72 -84
  278. package/src/columns/index.ts +7 -5
  279. package/src/columns/utils.test.ts +249 -0
  280. package/src/columns/utils.ts +226 -0
  281. package/src/components/PFrameForGraphs.ts +3 -1
  282. package/src/components/PlAnnotations/filters_ui.test.ts +46 -47
  283. package/src/components/PlDataTable/columnResolver.test.ts +122 -0
  284. package/src/components/PlDataTable/columnResolver.ts +57 -0
  285. package/src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts +9 -9
  286. package/src/components/PlDataTable/createPlDataTable/createPTableDefV3.ts +31 -63
  287. package/src/components/PlDataTable/createPlDataTable/createPlDataTableV2.ts +85 -58
  288. package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +316 -354
  289. package/src/components/PlDataTable/createPlDataTable/discoverColumns.ts +48 -144
  290. package/src/components/PlDataTable/createPlDataTable/index.ts +2 -2
  291. package/src/components/PlDataTable/createPlDataTable/utils.test.ts +60 -69
  292. package/src/components/PlDataTable/createPlDataTable/utils.ts +65 -173
  293. package/src/components/PlDataTable/createPlDataTableSheet.ts +1 -1
  294. package/src/components/PlDataTable/index.ts +4 -2
  295. package/src/components/PlDataTable/labels.ts +4 -33
  296. package/src/components/PlDataTable/state-migration.ts +151 -22
  297. package/src/components/PlDataTable/typesV8.ts +188 -0
  298. package/src/components/PlDatasetSelector/build_dataset_options.ts +35 -60
  299. package/src/components/PlDatasetSelector/enrichment_discovery.ts +65 -61
  300. package/src/components/PlDatasetSelector/filter_discovery.test.ts +110 -72
  301. package/src/components/PlDatasetSelector/filter_discovery.ts +51 -31
  302. package/src/filters/converters/filterToQuery.test.ts +15 -8
  303. package/src/filters/converters/filterToQuery.ts +22 -9
  304. package/src/filters/converters/filterUiToExpressionImpl.test.ts +35 -36
  305. package/src/labels/derive_distinct_labels.ts +1 -1
  306. package/src/labels/derive_distinct_tooltips.test.ts +7 -4
  307. package/src/labels/derive_distinct_tooltips.ts +3 -3
  308. package/src/pframe_utils/axes.ts +2 -2
  309. package/src/pframe_utils/columns.ts +14 -23
  310. package/src/pframe_utils/index.ts +1 -1
  311. package/src/render/accessor.ts +35 -38
  312. package/src/render/api.ts +45 -61
  313. package/src/render/index.ts +2 -1
  314. package/src/render/internal.ts +43 -10
  315. package/src/render/util/axis_filtering.ts +0 -1
  316. package/src/render/util/column_collection.ts +17 -17
  317. package/src/render/util/pcolumn_data.ts +5 -9
  318. package/src/services/block_services.ts +1 -0
  319. package/src/services/get_services.ts +5 -2
  320. package/dist/columns/column_collection_builder.cjs +0 -241
  321. package/dist/columns/column_collection_builder.cjs.map +0 -1
  322. package/dist/columns/column_collection_builder.d.ts +0 -119
  323. package/dist/columns/column_collection_builder.d.ts.map +0 -1
  324. package/dist/columns/column_collection_builder.js +0 -241
  325. package/dist/columns/column_collection_builder.js.map +0 -1
  326. package/dist/columns/column_selector.cjs +0 -49
  327. package/dist/columns/column_selector.cjs.map +0 -1
  328. package/dist/columns/column_selector.d.ts +0 -33
  329. package/dist/columns/column_selector.d.ts.map +0 -1
  330. package/dist/columns/column_selector.js +0 -47
  331. package/dist/columns/column_selector.js.map +0 -1
  332. package/dist/columns/column_snapshot.cjs +0 -19
  333. package/dist/columns/column_snapshot.cjs.map +0 -1
  334. package/dist/columns/column_snapshot.d.ts +0 -39
  335. package/dist/columns/column_snapshot.d.ts.map +0 -1
  336. package/dist/columns/column_snapshot.js +0 -18
  337. package/dist/columns/column_snapshot.js.map +0 -1
  338. package/dist/columns/column_snapshot_provider.cjs +0 -137
  339. package/dist/columns/column_snapshot_provider.cjs.map +0 -1
  340. package/dist/columns/column_snapshot_provider.d.ts +0 -74
  341. package/dist/columns/column_snapshot_provider.d.ts.map +0 -1
  342. package/dist/columns/column_snapshot_provider.js +0 -133
  343. package/dist/columns/column_snapshot_provider.js.map +0 -1
  344. package/dist/columns/ctx_column_sources.cjs +0 -80
  345. package/dist/columns/ctx_column_sources.cjs.map +0 -1
  346. package/dist/columns/ctx_column_sources.d.ts +0 -30
  347. package/dist/columns/ctx_column_sources.d.ts.map +0 -1
  348. package/dist/columns/ctx_column_sources.js +0 -79
  349. package/dist/columns/ctx_column_sources.js.map +0 -1
  350. package/src/columns/column_collection_builder.test.ts +0 -484
  351. package/src/columns/column_collection_builder.ts +0 -485
  352. package/src/columns/column_selector.test.ts +0 -90
  353. package/src/columns/column_selector.ts +0 -100
  354. package/src/columns/column_snapshot.ts +0 -58
  355. package/src/columns/column_snapshot_provider.ts +0 -194
  356. package/src/columns/ctx_column_sources.ts +0 -99
@@ -0,0 +1,101 @@
1
+ import { ColumnUniversalId, PColumnSpec, PObjectId, SpecOverrides, SpecQuery as SpecQuery$1 } from "@milaboratories/pl-model-common";
2
+
3
+ //#region src/columns/column_recipes/types.d.ts
4
+ /**
5
+ * Stable identifier of a recipe: either the canonical {@link PObjectId} of a
6
+ * leaf or a {@link ColumnUniversalId} encoding `Overridden / Discovered /
7
+ * Filtered` layers on top of it.
8
+ *
9
+ * Recipes are equivalent as value-objects iff their `id`s match (structurally,
10
+ * after canonicalization).
11
+ */
12
+ type ColumnRecipeId = ColumnUniversalId;
13
+ /**
14
+ * Aggregate data status of a recipe: the "worst" status across every
15
+ * PObjectId the recipe references (the leaf itself plus any refs inside
16
+ * overrides/discovery).
17
+ *
18
+ * "All or nothing" semantics: spec/query built from a recipe are meaningful
19
+ * only when every referenced column is `present`.
20
+ */
21
+ type ColumnFieldStatus = "resolving" | "absent" | "present";
22
+ /**
23
+ * Resolution status of a recipe — whether the recipe is meaningful in the
24
+ * active render ctx. Aggregates spec readiness (the recipe can be
25
+ * constructed/used) and data readiness (the underlying leaves can be read).
26
+ *
27
+ * - `present`: spec + data readable end-to-end.
28
+ * - `resolving`: more accessor inputs may still arrive — recheck later.
29
+ * - `absent`: every relevant accessor is `inputsLocked`; nothing more will
30
+ * appear. Used at boundaries to throw early instead of silently
31
+ * producing an empty/broken recipe.
32
+ *
33
+ * Distinct from {@link ColumnFieldStatus}: that one is the leaf's data field
34
+ * status only. {@link ColumnResolutionStatus} also folds in spec/registry
35
+ * readiness, so the recipe interface exposes both.
36
+ */
37
+ type ColumnResolutionStatus = "present" | "resolving" | "absent";
38
+ /**
39
+ * Base contract of a column recipe — an immutable description of HOW to
40
+ * obtain a column, not the column itself.
41
+ *
42
+ * A recipe is a value-object. The only transformation exposed via the
43
+ * interface is {@link withSpecs}: it overlays overrides on the spec.
44
+ * `withDiscovery` / `withAxisFilters` are intentionally absent — discovered
45
+ * and filtered recipes are built only via their own factory constructors
46
+ * from a leaf recipe; nothing further can be stacked on top of Discovered
47
+ * or Filtered.
48
+ *
49
+ * Invariant: `withSpecs` never nests. A recipe is either bare or wrapped
50
+ * in exactly one Overridden layer. Repeated `withSpecs` merges the new
51
+ * overrides into the existing ones, keeping the same depth.
52
+ *
53
+ * A recipe intentionally exposes no `getSpecOverrides / getDiscovery /
54
+ * getAxisFilters` getters: those encoding pieces are details of the id.
55
+ * Consumers that need to decompose call utilities from `pl-model-common`
56
+ * over `recipe.id`.
57
+ */
58
+ interface ColumnRecipe<ID extends ColumnRecipeId = ColumnRecipeId> {
59
+ /** Canonical recipe identifier. */
60
+ readonly id: ID;
61
+ /** PObjectIds referenced by this recipe (leaf + any nested refs). */
62
+ getReferencedIds(): PObjectId[];
63
+ /**
64
+ * Final spec — built via `pframespec` from id + base spec of the source.
65
+ * No partial JS logic: the result matches what the engine returns when
66
+ * executing {@link getQuery}.
67
+ *
68
+ * Always returns a value: the recipe factories validate all referenced
69
+ * specs at construction time and return `undefined` from the factory if
70
+ * anything is missing. A constructed recipe is by contract spec-complete.
71
+ */
72
+ getSpec(): PColumnSpec;
73
+ /**
74
+ * IR describing how to obtain the column — a {@link SpecQuery} from
75
+ * `pl-model-common`. The recipe builds the description; execution belongs
76
+ * to the layer above (pframespec/engine).
77
+ *
78
+ * The return is parameterized with default `C = PObjectId`. Concrete
79
+ * recipes may narrow the parameter (e.g. `SpecQuery<ColumnRecipeId>`) if
80
+ * they need to thread nested id variants.
81
+ */
82
+ getQuery(): SpecQuery$1;
83
+ /**
84
+ * Aggregate status across ALL PObjectIds this recipe reaches: own leaf +
85
+ * refs from overrides + the parent chain of discovery.
86
+ *
87
+ * Rule: `absent ▸ resolving ▸ present` ("worst wins").
88
+ */
89
+ getDataStatus(): ColumnFieldStatus;
90
+ /**
91
+ * Apply overrides on the spec. Always returns a new recipe.
92
+ *
93
+ * Flat-merge invariant: if `self` is already Overridden, the implementation
94
+ * merges `overrides` with the existing ones and returns the same depth
95
+ * (one Overridden wrapper). No `Overridden<Overridden<...>>`.
96
+ */
97
+ withSpecs(overrides: SpecOverrides): ColumnRecipe;
98
+ }
99
+ //#endregion
100
+ export { ColumnFieldStatus, ColumnRecipe, ColumnRecipeId, ColumnResolutionStatus, type SpecQuery$1 as SpecQuery };
101
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/columns/column_recipes/types.ts"],"mappings":";;;;AAkBA;;;;AAA8C;AAU9C;;KAVY,cAAA,GAAiB,iBAAiB;;AAUjB;AAiB7B;;;;AAAkC;AAsBlC;KAvCY,iBAAA;;;;;;;;;;;;;;;;KAiBA,sBAAA;;;;;;;;;;;;;;;AAkEuC;;;;;;UA5ClC,YAAA,YAAwB,cAAA,GAAiB,cAAA;;WAE/C,EAAA,EAAI,EAAA;;EAGb,gBAAA,IAAoB,SAAA;;;;;;;;;;EAWpB,OAAA,IAAW,WAAA;;;;;;;;;;EAWX,QAAA,IAAY,WAAA;;;;;;;EAQZ,aAAA,IAAiB,iBAAA;;;;;;;;EASjB,SAAA,CAAU,SAAA,EAAW,aAAA,GAAgB,YAAA;AAAA"}
@@ -0,0 +1,124 @@
1
+ const require_internal = require("../internal.cjs");
2
+ const require_accessor = require("../render/accessor.cjs");
3
+ const require_internal$1 = require("../render/internal.cjs");
4
+ const require_get_services = require("../services/get_services.cjs");
5
+ const require_index = require("./column_recipes/index.cjs");
6
+ const require_index$1 = require("./column_providers/index.cjs");
7
+ let es_toolkit = require("es-toolkit");
8
+ //#region src/columns/columns_collection.ts
9
+ /**
10
+ * Build a {@link ColumnsCollection} from sandbox-side source descriptors.
11
+ * Resolves the `columnsCollection` driver (either from `deps.driver` or via
12
+ * `getService("columnsCollection")`) and asks the host to mint a fresh
13
+ * handle covering the supplied sources. Pass `sources === undefined` to
14
+ * fall back to the active render ctx (main outputs + prerun + result pool).
15
+ *
16
+ * `sources` accepts {@link ColumnsSourceShorthand} string literals
17
+ * (`"result_pool"`, `"current_block"`) for the common ctx-derived sources.
18
+ */
19
+ function ColumnsCollection(sources, deps) {
20
+ const driver = deps?.driver ?? require_get_services.getService("columnsCollection", { ctx: deps?.ctx });
21
+ const serialized = sources ? sources.flatMap((s) => toSerializedSources(s, deps?.ctx)) : defaultCtxSources(deps?.ctx);
22
+ return new ColumnsCollectionImpl(driver.create(serialized), driver);
23
+ }
24
+ function isColumnsCollection(value) {
25
+ return value instanceof ColumnsCollectionImpl;
26
+ }
27
+ /**
28
+ * Sandbox proxy over the host-side `ColumnsCollection` driver. The driver
29
+ * owns all column-set state; this object only carries an opaque
30
+ * {@link CollectionHandle} plus a reference to the driver service.
31
+ *
32
+ * Construct via {@link ColumnsCollection} — the bare constructor is a
33
+ * trivial `(handle, driver)` pair so that `addSource` / `discover` / `filter`
34
+ * can rebind a freshly-minted handle without going through source
35
+ * serialisation again.
36
+ *
37
+ * Every method returning a `ColumnsCollection` mints a fresh handle on the
38
+ * host — the host VM bridge pins it to the active render ctx, so the sandbox
39
+ * never has to manage refcounts.
40
+ */
41
+ var ColumnsCollectionImpl = class ColumnsCollectionImpl {
42
+ handle;
43
+ driver;
44
+ constructor(handle, driver) {
45
+ this.handle = handle;
46
+ this.driver = driver;
47
+ }
48
+ isEmpty() {
49
+ return this.driver.isEmpty(this.handle);
50
+ }
51
+ isFinal() {
52
+ return this.driver.isFinal(this.handle);
53
+ }
54
+ getColumnIds() {
55
+ return this.driver.getColumns(this.handle);
56
+ }
57
+ getColumns() {
58
+ return this.getColumnIds().map((id) => require_index.ColumnRecipe(id)).filter((c) => !(0, es_toolkit.isNil)(c));
59
+ }
60
+ addSource(source) {
61
+ return new ColumnsCollectionImpl(this.driver.addSource(this.handle, toSerializedSources(source)), this.driver);
62
+ }
63
+ discover(options) {
64
+ return new ColumnsCollectionImpl(this.driver.discover(this.handle, options), this.driver);
65
+ }
66
+ filter(options) {
67
+ return new ColumnsCollectionImpl(this.driver.filter(this.handle, options), this.driver);
68
+ }
69
+ };
70
+ function toSerializedSources(source, ctx) {
71
+ if (source === "result_pool") return [{ kind: "result_pool" }];
72
+ if (source === "current_block") return currentBlockSources(ctx);
73
+ if (source instanceof ColumnsCollectionImpl) return [{
74
+ kind: "collection",
75
+ handle: source.handle
76
+ }];
77
+ if (source instanceof require_accessor.TreeNodeAccessor) return [{
78
+ kind: "accessor",
79
+ accessor: source.handle,
80
+ path: source.resolvePath
81
+ }];
82
+ if (isColumnArray(source)) return [{
83
+ kind: "ids",
84
+ ids: source.columns.map((c) => c.id),
85
+ isFinal: source.isFinal
86
+ }];
87
+ if (require_index$1.isColumnProvider(source)) return [{
88
+ kind: "ids",
89
+ ids: source.getColumns().map((c) => c.id),
90
+ isFinal: source.isFinal()
91
+ }];
92
+ throw new Error("ColumnsCollection: unrecognised ColumnsSource shape");
93
+ }
94
+ function isColumnArray(source) {
95
+ if (typeof source !== "object" || source === null) return false;
96
+ const s = source;
97
+ return Array.isArray(s.columns) && typeof s.isFinal === "boolean";
98
+ }
99
+ function currentBlockSources(ctx) {
100
+ const renderCtx = ctx ?? require_internal.getCfgRenderCtx();
101
+ const sources = [];
102
+ const outputs = renderCtx.getAccessorHandleByName(require_internal$1.MainAccessorName);
103
+ if (outputs !== void 0) sources.push({
104
+ kind: "accessor",
105
+ accessor: outputs,
106
+ path: [require_internal$1.MainAccessorName]
107
+ });
108
+ const prerun = renderCtx.getAccessorHandleByName(require_internal$1.StagingAccessorName);
109
+ if (prerun !== void 0) sources.push({
110
+ kind: "accessor",
111
+ accessor: prerun,
112
+ path: [require_internal$1.StagingAccessorName]
113
+ });
114
+ return sources;
115
+ }
116
+ function defaultCtxSources(ctx) {
117
+ return [...currentBlockSources(ctx), { kind: "result_pool" }];
118
+ }
119
+ //#endregion
120
+ exports.ColumnsCollection = ColumnsCollection;
121
+ exports.ColumnsCollectionImpl = ColumnsCollectionImpl;
122
+ exports.isColumnsCollection = isColumnsCollection;
123
+
124
+ //# sourceMappingURL=columns_collection.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns_collection.cjs","names":["getService","ColumnRecipe","TreeNodeAccessor","isColumnProvider","getCfgRenderCtx","MainAccessorName","StagingAccessorName"],"sources":["../../src/columns/columns_collection.ts"],"sourcesContent":["import type {\n CollectionHandle,\n ColumnUniversalId,\n ColumnsCollectionDriverModel,\n ColumnsDiscoverOptions,\n ColumnsFilterOptions,\n SerializedColumnsSource,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx } from \"../render/internal\";\nimport { MainAccessorName, StagingAccessorName } from \"../render/internal\";\nimport type { ColumnsSource } from \"./column_providers\";\nimport { isColumnProvider } from \"./column_providers\";\nimport { TreeNodeAccessor } from \"../render/accessor\";\nimport { getService } from \"../services/get_services\";\nimport { getCfgRenderCtx } from \"../internal\";\nimport { ColumnRecipe } from \"./column_recipes\";\nimport { isNil } from \"es-toolkit\";\n\nexport interface ColumnsCollectionDeps {\n /** Render ctx used both for service resolution and for default ctx sources. */\n readonly ctx?: GlobalCfgRenderCtx;\n /** Override the resolved `columnsCollection` service — primarily for tests. */\n readonly driver?: ColumnsCollectionDriverModel;\n}\n\n/**\n * Shorthand literals accepted inside `ColumnsCollection`'s `sources`\n * array, expanded against the active render ctx:\n *\n * - `\"result_pool\"` – fan-out into the host's upstream-block result pool.\n * - `\"current_block\"` – main outputs + prerun (staging) accessors of the\n * current block, when present.\n */\nexport type ColumnsSourceShorthand = \"result_pool\" | \"current_block\";\n\n/**\n * Build a {@link ColumnsCollection} from sandbox-side source descriptors.\n * Resolves the `columnsCollection` driver (either from `deps.driver` or via\n * `getService(\"columnsCollection\")`) and asks the host to mint a fresh\n * handle covering the supplied sources. Pass `sources === undefined` to\n * fall back to the active render ctx (main outputs + prerun + result pool).\n *\n * `sources` accepts {@link ColumnsSourceShorthand} string literals\n * (`\"result_pool\"`, `\"current_block\"`) for the common ctx-derived sources.\n */\nexport function ColumnsCollection(\n sources?: (ColumnsCollection | ColumnsSource | ColumnsSourceShorthand)[],\n deps?: ColumnsCollectionDeps,\n): ColumnsCollection {\n const driver = deps?.driver ?? getService(\"columnsCollection\", { ctx: deps?.ctx });\n const serialized: SerializedColumnsSource[] = sources\n ? sources.flatMap((s) => toSerializedSources(s, deps?.ctx))\n : defaultCtxSources(deps?.ctx);\n return new ColumnsCollectionImpl(driver.create(serialized), driver);\n}\n\nexport function isColumnsCollection(value: unknown): value is ColumnsCollection {\n return value instanceof ColumnsCollectionImpl;\n}\n\n/**\n * Sandbox proxy over the host-side `ColumnsCollection` driver. The driver\n * owns all column-set state; this object only carries an opaque\n * {@link CollectionHandle} plus a reference to the driver service.\n *\n * Construct via {@link ColumnsCollection} — the bare constructor is a\n * trivial `(handle, driver)` pair so that `addSource` / `discover` / `filter`\n * can rebind a freshly-minted handle without going through source\n * serialisation again.\n *\n * Every method returning a `ColumnsCollection` mints a fresh handle on the\n * host — the host VM bridge pins it to the active render ctx, so the sandbox\n * never has to manage refcounts.\n */\nexport class ColumnsCollectionImpl {\n constructor(\n public readonly handle: CollectionHandle,\n private readonly driver: ColumnsCollectionDriverModel,\n ) {}\n\n isEmpty(): boolean {\n return this.driver.isEmpty(this.handle);\n }\n\n isFinal(): boolean {\n return this.driver.isFinal(this.handle);\n }\n\n getColumnIds(): ColumnUniversalId[] {\n return this.driver.getColumns(this.handle);\n }\n\n getColumns(): ColumnRecipe[] {\n return this.getColumnIds()\n .map((id) => ColumnRecipe(id))\n .filter((c): c is ColumnRecipe => !isNil(c));\n }\n\n addSource(source: ColumnsSource | ColumnsCollection): ColumnsCollection {\n return new ColumnsCollectionImpl(\n this.driver.addSource(this.handle, toSerializedSources(source)),\n this.driver,\n );\n }\n\n discover(options: ColumnsDiscoverOptions): ColumnsCollection {\n return new ColumnsCollectionImpl(this.driver.discover(this.handle, options), this.driver);\n }\n\n filter(options: ColumnsFilterOptions): ColumnsCollection {\n return new ColumnsCollectionImpl(this.driver.filter(this.handle, options), this.driver);\n }\n}\n\n/** Public type alias — value of the same name is the factory function above. */\nexport type ColumnsCollection = ColumnsCollectionImpl;\n\nfunction toSerializedSources(\n source: ColumnsCollection | ColumnsSource | ColumnsSourceShorthand,\n ctx?: GlobalCfgRenderCtx,\n): SerializedColumnsSource[] {\n if (source === \"result_pool\") {\n return [{ kind: \"result_pool\" }];\n }\n if (source === \"current_block\") {\n return currentBlockSources(ctx);\n }\n if (source instanceof ColumnsCollectionImpl) {\n return [{ kind: \"collection\", handle: source.handle }];\n }\n if (source instanceof TreeNodeAccessor) {\n return [{ kind: \"accessor\", accessor: source.handle, path: source.resolvePath }];\n }\n if (isColumnArray(source)) {\n return [{ kind: \"ids\", ids: source.columns.map((c) => c.id), isFinal: source.isFinal }];\n }\n if (isColumnProvider(source)) {\n return [{ kind: \"ids\", ids: source.getColumns().map((c) => c.id), isFinal: source.isFinal() }];\n }\n throw new Error(\"ColumnsCollection: unrecognised ColumnsSource shape\");\n}\n\nfunction isColumnArray(source: unknown): source is {\n columns: ReadonlyArray<{ id: ColumnUniversalId; spec?: unknown; data?: unknown }>;\n isFinal: boolean;\n} {\n if (typeof source !== \"object\" || source === null) return false;\n const s = source as { columns?: unknown; isFinal?: unknown };\n return Array.isArray(s.columns) && typeof s.isFinal === \"boolean\";\n}\n\nfunction currentBlockSources(ctx?: GlobalCfgRenderCtx): SerializedColumnsSource[] {\n const renderCtx = ctx ?? getCfgRenderCtx();\n const sources: SerializedColumnsSource[] = [];\n\n const outputs = renderCtx.getAccessorHandleByName(MainAccessorName);\n if (outputs !== undefined) {\n sources.push({ kind: \"accessor\", accessor: outputs, path: [MainAccessorName] });\n }\n const prerun = renderCtx.getAccessorHandleByName(StagingAccessorName);\n if (prerun !== undefined) {\n sources.push({ kind: \"accessor\", accessor: prerun, path: [StagingAccessorName] });\n }\n\n return sources;\n}\n\nfunction defaultCtxSources(ctx?: GlobalCfgRenderCtx): SerializedColumnsSource[] {\n return [...currentBlockSources(ctx), { kind: \"result_pool\" }];\n}\n"],"mappings":"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"}
@@ -0,0 +1,64 @@
1
+ import { GlobalCfgRenderCtx } from "../render/internal.js";
2
+ import { ColumnRecipe } from "./column_recipes/index.js";
3
+ import { ColumnsSource } from "./column_providers/types.js";
4
+ import { CollectionHandle, ColumnUniversalId, ColumnsCollectionDriverModel, ColumnsDiscoverOptions, ColumnsFilterOptions } from "@milaboratories/pl-model-common";
5
+
6
+ //#region src/columns/columns_collection.d.ts
7
+ interface ColumnsCollectionDeps {
8
+ /** Render ctx used both for service resolution and for default ctx sources. */
9
+ readonly ctx?: GlobalCfgRenderCtx;
10
+ /** Override the resolved `columnsCollection` service — primarily for tests. */
11
+ readonly driver?: ColumnsCollectionDriverModel;
12
+ }
13
+ /**
14
+ * Shorthand literals accepted inside `ColumnsCollection`'s `sources`
15
+ * array, expanded against the active render ctx:
16
+ *
17
+ * - `"result_pool"` – fan-out into the host's upstream-block result pool.
18
+ * - `"current_block"` – main outputs + prerun (staging) accessors of the
19
+ * current block, when present.
20
+ */
21
+ type ColumnsSourceShorthand = "result_pool" | "current_block";
22
+ /**
23
+ * Build a {@link ColumnsCollection} from sandbox-side source descriptors.
24
+ * Resolves the `columnsCollection` driver (either from `deps.driver` or via
25
+ * `getService("columnsCollection")`) and asks the host to mint a fresh
26
+ * handle covering the supplied sources. Pass `sources === undefined` to
27
+ * fall back to the active render ctx (main outputs + prerun + result pool).
28
+ *
29
+ * `sources` accepts {@link ColumnsSourceShorthand} string literals
30
+ * (`"result_pool"`, `"current_block"`) for the common ctx-derived sources.
31
+ */
32
+ declare function ColumnsCollection(sources?: (ColumnsCollection | ColumnsSource | ColumnsSourceShorthand)[], deps?: ColumnsCollectionDeps): ColumnsCollection;
33
+ declare function isColumnsCollection(value: unknown): value is ColumnsCollection;
34
+ /**
35
+ * Sandbox proxy over the host-side `ColumnsCollection` driver. The driver
36
+ * owns all column-set state; this object only carries an opaque
37
+ * {@link CollectionHandle} plus a reference to the driver service.
38
+ *
39
+ * Construct via {@link ColumnsCollection} — the bare constructor is a
40
+ * trivial `(handle, driver)` pair so that `addSource` / `discover` / `filter`
41
+ * can rebind a freshly-minted handle without going through source
42
+ * serialisation again.
43
+ *
44
+ * Every method returning a `ColumnsCollection` mints a fresh handle on the
45
+ * host — the host VM bridge pins it to the active render ctx, so the sandbox
46
+ * never has to manage refcounts.
47
+ */
48
+ declare class ColumnsCollectionImpl {
49
+ readonly handle: CollectionHandle;
50
+ private readonly driver;
51
+ constructor(handle: CollectionHandle, driver: ColumnsCollectionDriverModel);
52
+ isEmpty(): boolean;
53
+ isFinal(): boolean;
54
+ getColumnIds(): ColumnUniversalId[];
55
+ getColumns(): ColumnRecipe[];
56
+ addSource(source: ColumnsSource | ColumnsCollection): ColumnsCollection;
57
+ discover(options: ColumnsDiscoverOptions): ColumnsCollection;
58
+ filter(options: ColumnsFilterOptions): ColumnsCollection;
59
+ }
60
+ /** Public type alias — value of the same name is the factory function above. */
61
+ type ColumnsCollection = ColumnsCollectionImpl;
62
+ //#endregion
63
+ export { ColumnsCollection, ColumnsCollectionDeps, ColumnsCollectionImpl, ColumnsSourceShorthand, isColumnsCollection };
64
+ //# sourceMappingURL=columns_collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns_collection.d.ts","names":[],"sources":["../../src/columns/columns_collection.ts"],"mappings":";;;;;;UAkBiB,qBAAA;;WAEN,GAAA,GAAM,kBAAA;EAFA;EAAA,SAIN,MAAA,GAAS,4BAA4B;AAAA;;;;;;;AAAA;AAWhD;KAAY,sBAAA;;;AAAsB;AAYlC;;;;;;;iBAAgB,iBAAA,CACd,OAAA,IAAW,iBAAA,GAAoB,aAAA,GAAgB,sBAAA,KAC/C,IAAA,GAAO,qBAAA,GACN,iBAAA;AAAA,iBAQa,mBAAA,CAAoB,KAAA,YAAiB,KAAA,IAAS,iBAAiB;;;;;;;;;;AAR3D;AAQpB;;;;cAkBa,qBAAA;EAAA,SAEO,MAAA,EAAQ,gBAAA;EAAA,iBACP,MAAA;cADD,MAAA,EAAQ,gBAAA,EACP,MAAA,EAAQ,4BAAA;EAG3B,OAAA;EAIA,OAAA;EAIA,YAAA,IAAgB,iBAAA;EAIhB,UAAA,IAAc,YAAA;EAMd,SAAA,CAAU,MAAA,EAAQ,aAAA,GAAgB,iBAAA,GAAoB,iBAAA;EAOtD,QAAA,CAAS,OAAA,EAAS,sBAAA,GAAyB,iBAAA;EAI3C,MAAA,CAAO,OAAA,EAAS,oBAAA,GAAuB,iBAAA;AAAA;;KAM7B,iBAAA,GAAoB,qBAAqB"}
@@ -0,0 +1,122 @@
1
+ import { getCfgRenderCtx } from "../internal.js";
2
+ import { TreeNodeAccessor } from "../render/accessor.js";
3
+ import { MainAccessorName, StagingAccessorName } from "../render/internal.js";
4
+ import { getService } from "../services/get_services.js";
5
+ import { ColumnRecipe } from "./column_recipes/index.js";
6
+ import { isColumnProvider } from "./column_providers/index.js";
7
+ import { isNil } from "es-toolkit";
8
+ //#region src/columns/columns_collection.ts
9
+ /**
10
+ * Build a {@link ColumnsCollection} from sandbox-side source descriptors.
11
+ * Resolves the `columnsCollection` driver (either from `deps.driver` or via
12
+ * `getService("columnsCollection")`) and asks the host to mint a fresh
13
+ * handle covering the supplied sources. Pass `sources === undefined` to
14
+ * fall back to the active render ctx (main outputs + prerun + result pool).
15
+ *
16
+ * `sources` accepts {@link ColumnsSourceShorthand} string literals
17
+ * (`"result_pool"`, `"current_block"`) for the common ctx-derived sources.
18
+ */
19
+ function ColumnsCollection(sources, deps) {
20
+ const driver = deps?.driver ?? getService("columnsCollection", { ctx: deps?.ctx });
21
+ const serialized = sources ? sources.flatMap((s) => toSerializedSources(s, deps?.ctx)) : defaultCtxSources(deps?.ctx);
22
+ return new ColumnsCollectionImpl(driver.create(serialized), driver);
23
+ }
24
+ function isColumnsCollection(value) {
25
+ return value instanceof ColumnsCollectionImpl;
26
+ }
27
+ /**
28
+ * Sandbox proxy over the host-side `ColumnsCollection` driver. The driver
29
+ * owns all column-set state; this object only carries an opaque
30
+ * {@link CollectionHandle} plus a reference to the driver service.
31
+ *
32
+ * Construct via {@link ColumnsCollection} — the bare constructor is a
33
+ * trivial `(handle, driver)` pair so that `addSource` / `discover` / `filter`
34
+ * can rebind a freshly-minted handle without going through source
35
+ * serialisation again.
36
+ *
37
+ * Every method returning a `ColumnsCollection` mints a fresh handle on the
38
+ * host — the host VM bridge pins it to the active render ctx, so the sandbox
39
+ * never has to manage refcounts.
40
+ */
41
+ var ColumnsCollectionImpl = class ColumnsCollectionImpl {
42
+ handle;
43
+ driver;
44
+ constructor(handle, driver) {
45
+ this.handle = handle;
46
+ this.driver = driver;
47
+ }
48
+ isEmpty() {
49
+ return this.driver.isEmpty(this.handle);
50
+ }
51
+ isFinal() {
52
+ return this.driver.isFinal(this.handle);
53
+ }
54
+ getColumnIds() {
55
+ return this.driver.getColumns(this.handle);
56
+ }
57
+ getColumns() {
58
+ return this.getColumnIds().map((id) => ColumnRecipe(id)).filter((c) => !isNil(c));
59
+ }
60
+ addSource(source) {
61
+ return new ColumnsCollectionImpl(this.driver.addSource(this.handle, toSerializedSources(source)), this.driver);
62
+ }
63
+ discover(options) {
64
+ return new ColumnsCollectionImpl(this.driver.discover(this.handle, options), this.driver);
65
+ }
66
+ filter(options) {
67
+ return new ColumnsCollectionImpl(this.driver.filter(this.handle, options), this.driver);
68
+ }
69
+ };
70
+ function toSerializedSources(source, ctx) {
71
+ if (source === "result_pool") return [{ kind: "result_pool" }];
72
+ if (source === "current_block") return currentBlockSources(ctx);
73
+ if (source instanceof ColumnsCollectionImpl) return [{
74
+ kind: "collection",
75
+ handle: source.handle
76
+ }];
77
+ if (source instanceof TreeNodeAccessor) return [{
78
+ kind: "accessor",
79
+ accessor: source.handle,
80
+ path: source.resolvePath
81
+ }];
82
+ if (isColumnArray(source)) return [{
83
+ kind: "ids",
84
+ ids: source.columns.map((c) => c.id),
85
+ isFinal: source.isFinal
86
+ }];
87
+ if (isColumnProvider(source)) return [{
88
+ kind: "ids",
89
+ ids: source.getColumns().map((c) => c.id),
90
+ isFinal: source.isFinal()
91
+ }];
92
+ throw new Error("ColumnsCollection: unrecognised ColumnsSource shape");
93
+ }
94
+ function isColumnArray(source) {
95
+ if (typeof source !== "object" || source === null) return false;
96
+ const s = source;
97
+ return Array.isArray(s.columns) && typeof s.isFinal === "boolean";
98
+ }
99
+ function currentBlockSources(ctx) {
100
+ const renderCtx = ctx ?? getCfgRenderCtx();
101
+ const sources = [];
102
+ const outputs = renderCtx.getAccessorHandleByName(MainAccessorName);
103
+ if (outputs !== void 0) sources.push({
104
+ kind: "accessor",
105
+ accessor: outputs,
106
+ path: [MainAccessorName]
107
+ });
108
+ const prerun = renderCtx.getAccessorHandleByName(StagingAccessorName);
109
+ if (prerun !== void 0) sources.push({
110
+ kind: "accessor",
111
+ accessor: prerun,
112
+ path: [StagingAccessorName]
113
+ });
114
+ return sources;
115
+ }
116
+ function defaultCtxSources(ctx) {
117
+ return [...currentBlockSources(ctx), { kind: "result_pool" }];
118
+ }
119
+ //#endregion
120
+ export { ColumnsCollection, ColumnsCollectionImpl, isColumnsCollection };
121
+
122
+ //# sourceMappingURL=columns_collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns_collection.js","names":[],"sources":["../../src/columns/columns_collection.ts"],"sourcesContent":["import type {\n CollectionHandle,\n ColumnUniversalId,\n ColumnsCollectionDriverModel,\n ColumnsDiscoverOptions,\n ColumnsFilterOptions,\n SerializedColumnsSource,\n} from \"@milaboratories/pl-model-common\";\nimport type { GlobalCfgRenderCtx } from \"../render/internal\";\nimport { MainAccessorName, StagingAccessorName } from \"../render/internal\";\nimport type { ColumnsSource } from \"./column_providers\";\nimport { isColumnProvider } from \"./column_providers\";\nimport { TreeNodeAccessor } from \"../render/accessor\";\nimport { getService } from \"../services/get_services\";\nimport { getCfgRenderCtx } from \"../internal\";\nimport { ColumnRecipe } from \"./column_recipes\";\nimport { isNil } from \"es-toolkit\";\n\nexport interface ColumnsCollectionDeps {\n /** Render ctx used both for service resolution and for default ctx sources. */\n readonly ctx?: GlobalCfgRenderCtx;\n /** Override the resolved `columnsCollection` service — primarily for tests. */\n readonly driver?: ColumnsCollectionDriverModel;\n}\n\n/**\n * Shorthand literals accepted inside `ColumnsCollection`'s `sources`\n * array, expanded against the active render ctx:\n *\n * - `\"result_pool\"` – fan-out into the host's upstream-block result pool.\n * - `\"current_block\"` – main outputs + prerun (staging) accessors of the\n * current block, when present.\n */\nexport type ColumnsSourceShorthand = \"result_pool\" | \"current_block\";\n\n/**\n * Build a {@link ColumnsCollection} from sandbox-side source descriptors.\n * Resolves the `columnsCollection` driver (either from `deps.driver` or via\n * `getService(\"columnsCollection\")`) and asks the host to mint a fresh\n * handle covering the supplied sources. Pass `sources === undefined` to\n * fall back to the active render ctx (main outputs + prerun + result pool).\n *\n * `sources` accepts {@link ColumnsSourceShorthand} string literals\n * (`\"result_pool\"`, `\"current_block\"`) for the common ctx-derived sources.\n */\nexport function ColumnsCollection(\n sources?: (ColumnsCollection | ColumnsSource | ColumnsSourceShorthand)[],\n deps?: ColumnsCollectionDeps,\n): ColumnsCollection {\n const driver = deps?.driver ?? getService(\"columnsCollection\", { ctx: deps?.ctx });\n const serialized: SerializedColumnsSource[] = sources\n ? sources.flatMap((s) => toSerializedSources(s, deps?.ctx))\n : defaultCtxSources(deps?.ctx);\n return new ColumnsCollectionImpl(driver.create(serialized), driver);\n}\n\nexport function isColumnsCollection(value: unknown): value is ColumnsCollection {\n return value instanceof ColumnsCollectionImpl;\n}\n\n/**\n * Sandbox proxy over the host-side `ColumnsCollection` driver. The driver\n * owns all column-set state; this object only carries an opaque\n * {@link CollectionHandle} plus a reference to the driver service.\n *\n * Construct via {@link ColumnsCollection} — the bare constructor is a\n * trivial `(handle, driver)` pair so that `addSource` / `discover` / `filter`\n * can rebind a freshly-minted handle without going through source\n * serialisation again.\n *\n * Every method returning a `ColumnsCollection` mints a fresh handle on the\n * host — the host VM bridge pins it to the active render ctx, so the sandbox\n * never has to manage refcounts.\n */\nexport class ColumnsCollectionImpl {\n constructor(\n public readonly handle: CollectionHandle,\n private readonly driver: ColumnsCollectionDriverModel,\n ) {}\n\n isEmpty(): boolean {\n return this.driver.isEmpty(this.handle);\n }\n\n isFinal(): boolean {\n return this.driver.isFinal(this.handle);\n }\n\n getColumnIds(): ColumnUniversalId[] {\n return this.driver.getColumns(this.handle);\n }\n\n getColumns(): ColumnRecipe[] {\n return this.getColumnIds()\n .map((id) => ColumnRecipe(id))\n .filter((c): c is ColumnRecipe => !isNil(c));\n }\n\n addSource(source: ColumnsSource | ColumnsCollection): ColumnsCollection {\n return new ColumnsCollectionImpl(\n this.driver.addSource(this.handle, toSerializedSources(source)),\n this.driver,\n );\n }\n\n discover(options: ColumnsDiscoverOptions): ColumnsCollection {\n return new ColumnsCollectionImpl(this.driver.discover(this.handle, options), this.driver);\n }\n\n filter(options: ColumnsFilterOptions): ColumnsCollection {\n return new ColumnsCollectionImpl(this.driver.filter(this.handle, options), this.driver);\n }\n}\n\n/** Public type alias — value of the same name is the factory function above. */\nexport type ColumnsCollection = ColumnsCollectionImpl;\n\nfunction toSerializedSources(\n source: ColumnsCollection | ColumnsSource | ColumnsSourceShorthand,\n ctx?: GlobalCfgRenderCtx,\n): SerializedColumnsSource[] {\n if (source === \"result_pool\") {\n return [{ kind: \"result_pool\" }];\n }\n if (source === \"current_block\") {\n return currentBlockSources(ctx);\n }\n if (source instanceof ColumnsCollectionImpl) {\n return [{ kind: \"collection\", handle: source.handle }];\n }\n if (source instanceof TreeNodeAccessor) {\n return [{ kind: \"accessor\", accessor: source.handle, path: source.resolvePath }];\n }\n if (isColumnArray(source)) {\n return [{ kind: \"ids\", ids: source.columns.map((c) => c.id), isFinal: source.isFinal }];\n }\n if (isColumnProvider(source)) {\n return [{ kind: \"ids\", ids: source.getColumns().map((c) => c.id), isFinal: source.isFinal() }];\n }\n throw new Error(\"ColumnsCollection: unrecognised ColumnsSource shape\");\n}\n\nfunction isColumnArray(source: unknown): source is {\n columns: ReadonlyArray<{ id: ColumnUniversalId; spec?: unknown; data?: unknown }>;\n isFinal: boolean;\n} {\n if (typeof source !== \"object\" || source === null) return false;\n const s = source as { columns?: unknown; isFinal?: unknown };\n return Array.isArray(s.columns) && typeof s.isFinal === \"boolean\";\n}\n\nfunction currentBlockSources(ctx?: GlobalCfgRenderCtx): SerializedColumnsSource[] {\n const renderCtx = ctx ?? getCfgRenderCtx();\n const sources: SerializedColumnsSource[] = [];\n\n const outputs = renderCtx.getAccessorHandleByName(MainAccessorName);\n if (outputs !== undefined) {\n sources.push({ kind: \"accessor\", accessor: outputs, path: [MainAccessorName] });\n }\n const prerun = renderCtx.getAccessorHandleByName(StagingAccessorName);\n if (prerun !== undefined) {\n sources.push({ kind: \"accessor\", accessor: prerun, path: [StagingAccessorName] });\n }\n\n return sources;\n}\n\nfunction defaultCtxSources(ctx?: GlobalCfgRenderCtx): SerializedColumnsSource[] {\n return [...currentBlockSources(ctx), { kind: \"result_pool\" }];\n}\n"],"mappings":"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"}
@@ -0,0 +1,76 @@
1
+ const require_accessor = require("../render/accessor.cjs");
2
+ require("../render/index.cjs");
3
+ const require_column_lazy = require("./column_lazy.cjs");
4
+ const require_columns_collection = require("./columns_collection.cjs");
5
+ let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
6
+ //#region src/columns/derive_axis_values_labels.ts
7
+ const RT_JSON = "PColumnData/Json";
8
+ const RT_JSON_PARTITIONED = "PColumnData/JsonPartitioned";
9
+ /**
10
+ * Build an `axisValuesLabels` callback by discovering `pl7.app/label` columns
11
+ * from the given source, eagerly materialising their value→label maps, and
12
+ * keying them by canonical axis id.
13
+ *
14
+ * Modern replacement for `ctx.resultPool.findLabels` — uses the new
15
+ * column-access mechanism (filtered {@link ColumnsCollection}) instead of
16
+ * walking the raw result pool.
17
+ *
18
+ * Pair with {@link expandByPartition} (or any consumer expecting the
19
+ * `(axisId) => Record<axisValue, label>` shape).
20
+ *
21
+ * Skips:
22
+ * - non-leaf recipes (only direct `ColumnLazy` data is read);
23
+ * - label columns whose `axesSpec.length !== 1`;
24
+ * - label columns whose data resource type isn't `PColumnData/Json` /
25
+ * `PColumnData/JsonPartitioned`.
26
+ */
27
+ function deriveAxisValuesLabels(source, opts) {
28
+ const byAxis = (source === void 0 ? require_columns_collection.ColumnsCollection(void 0, opts) : require_columns_collection.isColumnsCollection(source) ? source : require_columns_collection.ColumnsCollection(source, opts)).filter({ include: { name: [{
29
+ type: "exact",
30
+ value: _milaboratories_pl_model_common.PColumnName.Label
31
+ }] } }).getColumns().reduce((map, col) => {
32
+ if (!require_column_lazy.isColumnLazy(col)) return map;
33
+ const spec = col.getSpec();
34
+ if (spec.axesSpec.length !== 1) return map;
35
+ const data = col.getData();
36
+ if (!(data instanceof require_accessor.TreeNodeAccessor)) return map;
37
+ const labelMap = readLabelMap(data);
38
+ if (!labelMap) return map;
39
+ map.set((0, _milaboratories_pl_model_common.canonicalizeAxisId)((0, _milaboratories_pl_model_common.getAxisId)(spec.axesSpec[0])), labelMap);
40
+ return map;
41
+ }, /* @__PURE__ */ new Map());
42
+ return (axisId) => byAxis.get((0, _milaboratories_pl_model_common.canonicalizeAxisId)(axisId));
43
+ }
44
+ function readLabelMap(acc) {
45
+ const rt = acc.resourceType.name;
46
+ if (rt === RT_JSON) {
47
+ const json = acc.getDataAsJson();
48
+ return json?.data ? parseLabelKeys(json.data) : void 0;
49
+ }
50
+ if (rt === RT_JSON_PARTITIONED) return acc.listInputFields().reduce((merged, partKey) => {
51
+ const part = acc.resolve({
52
+ field: partKey,
53
+ assertFieldType: "Input",
54
+ ignoreError: true
55
+ });
56
+ if (!part) return merged;
57
+ const json = part.getDataAsJson();
58
+ if (!json?.data) return merged;
59
+ return Object.assign(merged, parseLabelKeys(json.data));
60
+ }, {});
61
+ }
62
+ function parseLabelKeys(raw) {
63
+ return Object.entries(raw).reduce((acc, [k, v]) => {
64
+ try {
65
+ const parsed = JSON.parse(k);
66
+ acc[Array.isArray(parsed) ? parsed[0] : parsed] = v;
67
+ } catch {
68
+ acc[k] = v;
69
+ }
70
+ return acc;
71
+ }, {});
72
+ }
73
+ //#endregion
74
+ exports.deriveAxisValuesLabels = deriveAxisValuesLabels;
75
+
76
+ //# sourceMappingURL=derive_axis_values_labels.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive_axis_values_labels.cjs","names":["ColumnsCollection","isColumnsCollection","PColumnName","isColumnLazy","TreeNodeAccessor"],"sources":["../../src/columns/derive_axis_values_labels.ts"],"sourcesContent":["import type { AxisId } from \"@milaboratories/pl-model-common\";\nimport { canonicalizeAxisId, getAxisId, PColumnName } from \"@milaboratories/pl-model-common\";\nimport type { ColumnsSource } from \"./column_providers\";\nimport { ColumnsCollection, isColumnsCollection } from \"./columns_collection\";\nimport type { GlobalCfgRenderCtx } from \"../render/internal\";\nimport { TreeNodeAccessor } from \"../render\";\nimport { isColumnLazy } from \"./column_lazy\";\n\nconst RT_JSON = \"PColumnData/Json\";\nconst RT_JSON_PARTITIONED = \"PColumnData/JsonPartitioned\";\n\n/**\n * Build an `axisValuesLabels` callback by discovering `pl7.app/label` columns\n * from the given source, eagerly materialising their value→label maps, and\n * keying them by canonical axis id.\n *\n * Modern replacement for `ctx.resultPool.findLabels` — uses the new\n * column-access mechanism (filtered {@link ColumnsCollection}) instead of\n * walking the raw result pool.\n *\n * Pair with {@link expandByPartition} (or any consumer expecting the\n * `(axisId) => Record<axisValue, label>` shape).\n *\n * Skips:\n * - non-leaf recipes (only direct `ColumnLazy` data is read);\n * - label columns whose `axesSpec.length !== 1`;\n * - label columns whose data resource type isn't `PColumnData/Json` /\n * `PColumnData/JsonPartitioned`.\n */\nexport function deriveAxisValuesLabels(\n source?: ColumnsCollection | (ColumnsCollection | ColumnsSource)[],\n opts?: { ctx?: GlobalCfgRenderCtx },\n): (axisId: AxisId) => Record<string | number, string> | undefined {\n const collection =\n source === undefined\n ? ColumnsCollection(undefined, opts)\n : isColumnsCollection(source)\n ? source\n : ColumnsCollection(source, opts);\n\n const labelCols = collection\n .filter({ include: { name: [{ type: \"exact\", value: PColumnName.Label }] } })\n .getColumns();\n\n const byAxis = labelCols.reduce<Map<string, Record<string | number, string>>>((map, col) => {\n if (!isColumnLazy(col)) return map;\n const spec = col.getSpec();\n if (spec.axesSpec.length !== 1) return map;\n\n const data = col.getData();\n if (!(data instanceof TreeNodeAccessor)) return map;\n\n const labelMap = readLabelMap(data);\n if (!labelMap) return map;\n\n map.set(canonicalizeAxisId(getAxisId(spec.axesSpec[0])), labelMap);\n return map;\n }, new Map());\n\n return (axisId) => byAxis.get(canonicalizeAxisId(axisId));\n}\n\nfunction readLabelMap(acc: TreeNodeAccessor): undefined | Record<string | number, string> {\n const rt = acc.resourceType.name;\n\n if (rt === RT_JSON) {\n const json = acc.getDataAsJson<{ data?: Record<string, string> }>();\n return json?.data ? parseLabelKeys(json.data) : undefined;\n }\n\n if (rt === RT_JSON_PARTITIONED) {\n return acc.listInputFields().reduce<Record<string | number, string>>((merged, partKey) => {\n const part = acc.resolve({\n field: partKey,\n assertFieldType: \"Input\",\n ignoreError: true,\n });\n if (!part) return merged;\n const json = part.getDataAsJson<{ data?: Record<string, string> }>();\n if (!json?.data) return merged;\n return Object.assign(merged, parseLabelKeys(json.data));\n }, {});\n }\n\n return undefined;\n}\n\nfunction parseLabelKeys(raw: Record<string, string>): Record<string | number, string> {\n return Object.entries(raw).reduce<Record<string | number, string>>((acc, [k, v]) => {\n try {\n const parsed = JSON.parse(k);\n acc[Array.isArray(parsed) ? parsed[0] : parsed] = v;\n } catch {\n acc[k] = v;\n }\n return acc;\n }, {});\n}\n"],"mappings":";;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;AAoB5B,SAAgB,uBACd,QACA,MACiE;CAYjE,MAAM,UAVJ,WAAW,KAAA,IACPA,2BAAAA,kBAAkB,KAAA,GAAW,IAAI,IACjCC,2BAAAA,oBAAoB,MAAM,IACxB,SACAD,2BAAAA,kBAAkB,QAAQ,IAAI,EAAA,CAGnC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;EAAE,MAAM;EAAS,OAAOE,gCAAAA,YAAY;CAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAC5E,WAEoB,CAAC,CAAC,QAAsD,KAAK,QAAQ;EAC1F,IAAI,CAACC,oBAAAA,aAAa,GAAG,GAAG,OAAO;EAC/B,MAAM,OAAO,IAAI,QAAQ;EACzB,IAAI,KAAK,SAAS,WAAW,GAAG,OAAO;EAEvC,MAAM,OAAO,IAAI,QAAQ;EACzB,IAAI,EAAE,gBAAgBC,iBAAAA,mBAAmB,OAAO;EAEhD,MAAM,WAAW,aAAa,IAAI;EAClC,IAAI,CAAC,UAAU,OAAO;EAEtB,IAAI,KAAA,GAAA,gCAAA,mBAAA,EAAA,GAAA,gCAAA,UAAA,CAAiC,KAAK,SAAS,EAAE,CAAC,GAAG,QAAQ;EACjE,OAAO;CACT,mBAAG,IAAI,IAAI,CAAC;CAEZ,QAAQ,WAAW,OAAO,KAAA,GAAA,gCAAA,mBAAA,CAAuB,MAAM,CAAC;AAC1D;AAEA,SAAS,aAAa,KAAoE;CACxF,MAAM,KAAK,IAAI,aAAa;CAE5B,IAAI,OAAO,SAAS;EAClB,MAAM,OAAO,IAAI,cAAiD;EAClE,OAAO,MAAM,OAAO,eAAe,KAAK,IAAI,IAAI,KAAA;CAClD;CAEA,IAAI,OAAO,qBACT,OAAO,IAAI,gBAAgB,CAAC,CAAC,QAAyC,QAAQ,YAAY;EACxF,MAAM,OAAO,IAAI,QAAQ;GACvB,OAAO;GACP,iBAAiB;GACjB,aAAa;EACf,CAAC;EACD,IAAI,CAAC,MAAM,OAAO;EAClB,MAAM,OAAO,KAAK,cAAiD;EACnE,IAAI,CAAC,MAAM,MAAM,OAAO;EACxB,OAAO,OAAO,OAAO,QAAQ,eAAe,KAAK,IAAI,CAAC;CACxD,GAAG,CAAC,CAAC;AAIT;AAEA,SAAS,eAAe,KAA8D;CACpF,OAAO,OAAO,QAAQ,GAAG,CAAC,CAAC,QAAyC,KAAK,CAAC,GAAG,OAAO;EAClF,IAAI;GACF,MAAM,SAAS,KAAK,MAAM,CAAC;GAC3B,IAAI,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK,UAAU;EACpD,QAAQ;GACN,IAAI,KAAK;EACX;EACA,OAAO;CACT,GAAG,CAAC,CAAC;AACP"}
@@ -0,0 +1,30 @@
1
+ import { GlobalCfgRenderCtx } from "../render/internal.js";
2
+ import { ColumnsSource } from "./column_providers/types.js";
3
+ import { ColumnsCollection } from "./columns_collection.js";
4
+ import { AxisId } from "@milaboratories/pl-model-common";
5
+
6
+ //#region src/columns/derive_axis_values_labels.d.ts
7
+ /**
8
+ * Build an `axisValuesLabels` callback by discovering `pl7.app/label` columns
9
+ * from the given source, eagerly materialising their value→label maps, and
10
+ * keying them by canonical axis id.
11
+ *
12
+ * Modern replacement for `ctx.resultPool.findLabels` — uses the new
13
+ * column-access mechanism (filtered {@link ColumnsCollection}) instead of
14
+ * walking the raw result pool.
15
+ *
16
+ * Pair with {@link expandByPartition} (or any consumer expecting the
17
+ * `(axisId) => Record<axisValue, label>` shape).
18
+ *
19
+ * Skips:
20
+ * - non-leaf recipes (only direct `ColumnLazy` data is read);
21
+ * - label columns whose `axesSpec.length !== 1`;
22
+ * - label columns whose data resource type isn't `PColumnData/Json` /
23
+ * `PColumnData/JsonPartitioned`.
24
+ */
25
+ declare function deriveAxisValuesLabels(source?: ColumnsCollection | (ColumnsCollection | ColumnsSource)[], opts?: {
26
+ ctx?: GlobalCfgRenderCtx;
27
+ }): (axisId: AxisId) => Record<string | number, string> | undefined;
28
+ //#endregion
29
+ export { deriveAxisValuesLabels };
30
+ //# sourceMappingURL=derive_axis_values_labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive_axis_values_labels.d.ts","names":[],"sources":["../../src/columns/derive_axis_values_labels.ts"],"mappings":";;;;;;;;;AA6BA;;;;;;;;;;;;;;;iBAAgB,sBAAA,CACd,MAAA,GAAS,iBAAA,IAAqB,iBAAA,GAAoB,aAAA,KAClD,IAAA;EAAS,GAAA,GAAM,kBAAA;AAAA,KACb,MAAA,EAAQ,MAAA,KAAW,MAAA"}