@platforma-sdk/model 1.58.5 → 1.58.9

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 (365) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +43 -0
  2. package/dist/_virtual/_rolldown/runtime.js +18 -0
  3. package/dist/annotations/converter.cjs +15 -20
  4. package/dist/annotations/converter.cjs.map +1 -1
  5. package/dist/annotations/converter.d.ts +6 -2
  6. package/dist/annotations/converter.js +14 -18
  7. package/dist/annotations/converter.js.map +1 -1
  8. package/dist/annotations/index.cjs +1 -0
  9. package/dist/annotations/index.d.ts +2 -3
  10. package/dist/annotations/index.js +1 -0
  11. package/dist/annotations/types.d.ts +21 -16
  12. package/dist/bconfig/index.cjs +2 -0
  13. package/dist/bconfig/index.d.ts +5 -6
  14. package/dist/bconfig/index.js +2 -0
  15. package/dist/bconfig/lambdas.d.ts +52 -52
  16. package/dist/bconfig/normalization.cjs +13 -18
  17. package/dist/bconfig/normalization.cjs.map +1 -1
  18. package/dist/bconfig/normalization.d.ts +10 -6
  19. package/dist/bconfig/normalization.js +12 -16
  20. package/dist/bconfig/normalization.js.map +1 -1
  21. package/dist/bconfig/types.cjs +4 -3
  22. package/dist/bconfig/types.cjs.map +1 -1
  23. package/dist/bconfig/types.d.ts +10 -5
  24. package/dist/bconfig/types.js +4 -2
  25. package/dist/bconfig/types.js.map +1 -1
  26. package/dist/bconfig/util.d.ts +7 -4
  27. package/dist/bconfig/v3.d.ts +10 -6
  28. package/dist/block_api_v1.d.ts +62 -58
  29. package/dist/block_api_v2.d.ts +51 -47
  30. package/dist/block_api_v3.d.ts +33 -29
  31. package/dist/block_migrations.cjs +481 -413
  32. package/dist/block_migrations.cjs.map +1 -1
  33. package/dist/block_migrations.d.ts +258 -204
  34. package/dist/block_migrations.js +482 -408
  35. package/dist/block_migrations.js.map +1 -1
  36. package/dist/block_model.cjs +312 -343
  37. package/dist/block_model.cjs.map +1 -1
  38. package/dist/block_model.d.ts +143 -147
  39. package/dist/block_model.js +312 -341
  40. package/dist/block_model.js.map +1 -1
  41. package/dist/block_model_legacy.cjs +231 -255
  42. package/dist/block_model_legacy.cjs.map +1 -1
  43. package/dist/block_model_legacy.d.ts +108 -106
  44. package/dist/block_model_legacy.js +231 -253
  45. package/dist/block_model_legacy.js.map +1 -1
  46. package/dist/block_state_patch.d.ts +10 -10
  47. package/dist/block_state_util.cjs +15 -19
  48. package/dist/block_state_util.cjs.map +1 -1
  49. package/dist/block_state_util.d.ts +14 -13
  50. package/dist/block_state_util.js +15 -18
  51. package/dist/block_state_util.js.map +1 -1
  52. package/dist/block_storage.cjs +233 -238
  53. package/dist/block_storage.cjs.map +1 -1
  54. package/dist/block_storage.d.ts +62 -78
  55. package/dist/block_storage.js +234 -237
  56. package/dist/block_storage.js.map +1 -1
  57. package/dist/block_storage_callbacks.cjs +156 -195
  58. package/dist/block_storage_callbacks.cjs.map +1 -1
  59. package/dist/block_storage_callbacks.js +156 -192
  60. package/dist/block_storage_callbacks.js.map +1 -1
  61. package/dist/block_storage_facade.cjs +29 -85
  62. package/dist/block_storage_facade.cjs.map +1 -1
  63. package/dist/block_storage_facade.d.ts +83 -126
  64. package/dist/block_storage_facade.js +29 -83
  65. package/dist/block_storage_facade.js.map +1 -1
  66. package/dist/components/PFrameForGraphs.cjs +26 -24
  67. package/dist/components/PFrameForGraphs.cjs.map +1 -1
  68. package/dist/components/PFrameForGraphs.d.ts +12 -7
  69. package/dist/components/PFrameForGraphs.js +25 -22
  70. package/dist/components/PFrameForGraphs.js.map +1 -1
  71. package/dist/components/PlAnnotations/filter.d.ts +62 -79
  72. package/dist/components/PlAnnotations/filters_ui.cjs +135 -171
  73. package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
  74. package/dist/components/PlAnnotations/filters_ui.d.ts +48 -46
  75. package/dist/components/PlAnnotations/filters_ui.js +135 -170
  76. package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
  77. package/dist/components/PlAnnotations/index.d.ts +2 -3
  78. package/dist/components/PlDataTable/index.cjs +2 -0
  79. package/dist/components/PlDataTable/index.d.ts +3 -5
  80. package/dist/components/PlDataTable/index.js +2 -0
  81. package/dist/components/PlDataTable/labels.cjs +59 -81
  82. package/dist/components/PlDataTable/labels.cjs.map +1 -1
  83. package/dist/components/PlDataTable/labels.js +58 -79
  84. package/dist/components/PlDataTable/labels.js.map +1 -1
  85. package/dist/components/PlDataTable/state-migration.cjs +186 -144
  86. package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
  87. package/dist/components/PlDataTable/state-migration.d.ts +85 -82
  88. package/dist/components/PlDataTable/state-migration.js +185 -142
  89. package/dist/components/PlDataTable/state-migration.js.map +1 -1
  90. package/dist/components/PlDataTable/table.cjs +172 -194
  91. package/dist/components/PlDataTable/table.cjs.map +1 -1
  92. package/dist/components/PlDataTable/table.d.ts +16 -12
  93. package/dist/components/PlDataTable/table.js +171 -192
  94. package/dist/components/PlDataTable/table.js.map +1 -1
  95. package/dist/components/PlDataTable/v4.d.ts +84 -119
  96. package/dist/components/PlDataTable/v5.d.ts +80 -103
  97. package/dist/components/PlMultiSequenceAlignment.cjs +27 -29
  98. package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
  99. package/dist/components/PlMultiSequenceAlignment.d.ts +36 -27
  100. package/dist/components/PlMultiSequenceAlignment.js +26 -27
  101. package/dist/components/PlMultiSequenceAlignment.js.map +1 -1
  102. package/dist/components/PlSelectionModel.cjs +7 -6
  103. package/dist/components/PlSelectionModel.cjs.map +1 -1
  104. package/dist/components/PlSelectionModel.d.ts +10 -8
  105. package/dist/components/PlSelectionModel.js +7 -5
  106. package/dist/components/PlSelectionModel.js.map +1 -1
  107. package/dist/components/index.cjs +8 -0
  108. package/dist/components/index.d.ts +11 -6
  109. package/dist/components/index.js +8 -0
  110. package/dist/config/actions.cjs +138 -171
  111. package/dist/config/actions.cjs.map +1 -1
  112. package/dist/config/actions.d.ts +47 -47
  113. package/dist/config/actions.js +146 -178
  114. package/dist/config/actions.js.map +1 -1
  115. package/dist/config/actions_kinds.d.ts +114 -121
  116. package/dist/config/index.cjs +1 -0
  117. package/dist/config/index.d.ts +6 -7
  118. package/dist/config/index.js +1 -0
  119. package/dist/config/model.d.ts +131 -127
  120. package/dist/config/model_meta.d.ts +4 -1
  121. package/dist/config/type_engine.d.ts +22 -21
  122. package/dist/config/type_util.d.ts +12 -10
  123. package/dist/env_value.cjs +5 -6
  124. package/dist/env_value.cjs.map +1 -1
  125. package/dist/env_value.d.ts +4 -1
  126. package/dist/env_value.js +5 -5
  127. package/dist/env_value.js.map +1 -1
  128. package/dist/filters/converters/filterToQuery.cjs +273 -239
  129. package/dist/filters/converters/filterToQuery.cjs.map +1 -1
  130. package/dist/filters/converters/filterToQuery.d.ts +6 -2
  131. package/dist/filters/converters/filterToQuery.js +272 -237
  132. package/dist/filters/converters/filterToQuery.js.map +1 -1
  133. package/dist/filters/converters/filterUiToExpressionImpl.cjs +56 -85
  134. package/dist/filters/converters/filterUiToExpressionImpl.cjs.map +1 -1
  135. package/dist/filters/converters/filterUiToExpressionImpl.d.ts +8 -4
  136. package/dist/filters/converters/filterUiToExpressionImpl.js +55 -83
  137. package/dist/filters/converters/filterUiToExpressionImpl.js.map +1 -1
  138. package/dist/filters/converters/index.cjs +2 -0
  139. package/dist/filters/converters/index.d.ts +2 -3
  140. package/dist/filters/converters/index.js +2 -0
  141. package/dist/filters/distill.cjs +59 -60
  142. package/dist/filters/distill.cjs.map +1 -1
  143. package/dist/filters/distill.d.ts +6 -3
  144. package/dist/filters/distill.js +58 -58
  145. package/dist/filters/distill.js.map +1 -1
  146. package/dist/filters/index.cjs +4 -0
  147. package/dist/filters/index.d.ts +5 -4
  148. package/dist/filters/index.js +4 -0
  149. package/dist/filters/traverse.cjs +31 -40
  150. package/dist/filters/traverse.cjs.map +1 -1
  151. package/dist/filters/traverse.js +31 -39
  152. package/dist/filters/traverse.js.map +1 -1
  153. package/dist/filters/types.d.ts +10 -7
  154. package/dist/index.cjs +193 -187
  155. package/dist/index.d.ts +61 -28
  156. package/dist/index.js +49 -41
  157. package/dist/internal.cjs +48 -62
  158. package/dist/internal.cjs.map +1 -1
  159. package/dist/internal.js +49 -60
  160. package/dist/internal.js.map +1 -1
  161. package/dist/package.cjs +12 -0
  162. package/dist/package.cjs.map +1 -0
  163. package/dist/package.js +6 -0
  164. package/dist/package.js.map +1 -0
  165. package/dist/pframe.cjs +32 -37
  166. package/dist/pframe.cjs.map +1 -1
  167. package/dist/pframe.d.ts +14 -10
  168. package/dist/pframe.js +32 -35
  169. package/dist/pframe.js.map +1 -1
  170. package/dist/pframe_utils/axes.cjs +81 -114
  171. package/dist/pframe_utils/axes.cjs.map +1 -1
  172. package/dist/pframe_utils/axes.d.ts +10 -13
  173. package/dist/pframe_utils/axes.js +80 -112
  174. package/dist/pframe_utils/axes.js.map +1 -1
  175. package/dist/pframe_utils/columns.cjs +61 -81
  176. package/dist/pframe_utils/columns.cjs.map +1 -1
  177. package/dist/pframe_utils/columns.d.ts +15 -6
  178. package/dist/pframe_utils/columns.js +60 -79
  179. package/dist/pframe_utils/columns.js.map +1 -1
  180. package/dist/pframe_utils/index.cjs +232 -253
  181. package/dist/pframe_utils/index.cjs.map +1 -1
  182. package/dist/pframe_utils/index.d.ts +39 -35
  183. package/dist/pframe_utils/index.js +231 -251
  184. package/dist/pframe_utils/index.js.map +1 -1
  185. package/dist/platforma.d.ts +48 -46
  186. package/dist/plugin_handle.cjs +6 -14
  187. package/dist/plugin_handle.cjs.map +1 -1
  188. package/dist/plugin_handle.d.ts +20 -25
  189. package/dist/plugin_handle.js +6 -13
  190. package/dist/plugin_handle.js.map +1 -1
  191. package/dist/plugin_model.cjs +364 -163
  192. package/dist/plugin_model.cjs.map +1 -1
  193. package/dist/plugin_model.d.ts +280 -129
  194. package/dist/plugin_model.js +362 -163
  195. package/dist/plugin_model.js.map +1 -1
  196. package/dist/raw_globals.cjs +10 -22
  197. package/dist/raw_globals.cjs.map +1 -1
  198. package/dist/raw_globals.d.ts +8 -5
  199. package/dist/raw_globals.js +10 -20
  200. package/dist/raw_globals.js.map +1 -1
  201. package/dist/ref_util.cjs +14 -13
  202. package/dist/ref_util.cjs.map +1 -1
  203. package/dist/ref_util.d.ts +18 -12
  204. package/dist/ref_util.js +14 -11
  205. package/dist/ref_util.js.map +1 -1
  206. package/dist/render/accessor.cjs +213 -226
  207. package/dist/render/accessor.cjs.map +1 -1
  208. package/dist/render/accessor.d.ts +115 -120
  209. package/dist/render/accessor.js +212 -224
  210. package/dist/render/accessor.js.map +1 -1
  211. package/dist/render/api.cjs +478 -580
  212. package/dist/render/api.cjs.map +1 -1
  213. package/dist/render/api.d.ts +207 -209
  214. package/dist/render/api.js +476 -578
  215. package/dist/render/api.js.map +1 -1
  216. package/dist/render/future.cjs +28 -32
  217. package/dist/render/future.cjs.map +1 -1
  218. package/dist/render/future.d.ts +15 -11
  219. package/dist/render/future.js +28 -30
  220. package/dist/render/future.js.map +1 -1
  221. package/dist/render/index.cjs +8 -0
  222. package/dist/render/index.d.ts +10 -8
  223. package/dist/render/index.js +8 -0
  224. package/dist/render/internal.cjs +33 -29
  225. package/dist/render/internal.cjs.map +1 -1
  226. package/dist/render/internal.d.ts +78 -72
  227. package/dist/render/internal.js +29 -26
  228. package/dist/render/internal.js.map +1 -1
  229. package/dist/render/traversal_ops.d.ts +42 -43
  230. package/dist/render/util/axis_filtering.cjs +63 -86
  231. package/dist/render/util/axis_filtering.cjs.map +1 -1
  232. package/dist/render/util/axis_filtering.d.ts +10 -7
  233. package/dist/render/util/axis_filtering.js +63 -85
  234. package/dist/render/util/axis_filtering.js.map +1 -1
  235. package/dist/render/util/column_collection.cjs +266 -321
  236. package/dist/render/util/column_collection.cjs.map +1 -1
  237. package/dist/render/util/column_collection.d.ts +47 -47
  238. package/dist/render/util/column_collection.js +264 -319
  239. package/dist/render/util/column_collection.js.map +1 -1
  240. package/dist/render/util/index.cjs +4 -0
  241. package/dist/render/util/index.d.ts +4 -5
  242. package/dist/render/util/index.js +4 -0
  243. package/dist/render/util/label.cjs +129 -163
  244. package/dist/render/util/label.cjs.map +1 -1
  245. package/dist/render/util/label.d.ts +45 -46
  246. package/dist/render/util/label.js +128 -161
  247. package/dist/render/util/label.js.map +1 -1
  248. package/dist/render/util/pcolumn_data.cjs +315 -375
  249. package/dist/render/util/pcolumn_data.cjs.map +1 -1
  250. package/dist/render/util/pcolumn_data.d.ts +33 -32
  251. package/dist/render/util/pcolumn_data.js +314 -373
  252. package/dist/render/util/pcolumn_data.js.map +1 -1
  253. package/dist/render/util/pframe_upgraders.cjs +37 -42
  254. package/dist/render/util/pframe_upgraders.cjs.map +1 -1
  255. package/dist/render/util/pframe_upgraders.js +37 -41
  256. package/dist/render/util/pframe_upgraders.js.map +1 -1
  257. package/dist/render/util/split_selectors.d.ts +13 -9
  258. package/dist/version.cjs +6 -8
  259. package/dist/version.cjs.map +1 -1
  260. package/dist/version.d.ts +7 -4
  261. package/dist/version.js +5 -5
  262. package/dist/version.js.map +1 -1
  263. package/package.json +10 -4
  264. package/src/block_migrations.test.ts +184 -14
  265. package/src/block_migrations.ts +185 -30
  266. package/src/block_model.ts +111 -66
  267. package/src/block_storage.test.ts +147 -3
  268. package/src/block_storage.ts +43 -8
  269. package/src/block_storage_callbacks.ts +9 -4
  270. package/src/env_value.ts +0 -2
  271. package/src/index.ts +12 -11
  272. package/src/internal.ts +0 -1
  273. package/src/platforma.ts +4 -4
  274. package/src/plugin_handle.ts +1 -1
  275. package/src/plugin_model.test.ts +217 -21
  276. package/src/plugin_model.ts +450 -55
  277. package/src/raw_globals.ts +0 -1
  278. package/dist/annotations/converter.d.ts.map +0 -1
  279. package/dist/annotations/index.d.ts.map +0 -1
  280. package/dist/annotations/types.d.ts.map +0 -1
  281. package/dist/bconfig/index.d.ts.map +0 -1
  282. package/dist/bconfig/lambdas.d.ts.map +0 -1
  283. package/dist/bconfig/normalization.d.ts.map +0 -1
  284. package/dist/bconfig/types.d.ts.map +0 -1
  285. package/dist/bconfig/util.d.ts.map +0 -1
  286. package/dist/bconfig/v3.d.ts.map +0 -1
  287. package/dist/block_api_v1.d.ts.map +0 -1
  288. package/dist/block_api_v2.d.ts.map +0 -1
  289. package/dist/block_api_v3.d.ts.map +0 -1
  290. package/dist/block_migrations.d.ts.map +0 -1
  291. package/dist/block_model.d.ts.map +0 -1
  292. package/dist/block_model_legacy.d.ts.map +0 -1
  293. package/dist/block_state_patch.d.ts.map +0 -1
  294. package/dist/block_state_util.d.ts.map +0 -1
  295. package/dist/block_storage.d.ts.map +0 -1
  296. package/dist/block_storage_callbacks.d.ts +0 -115
  297. package/dist/block_storage_callbacks.d.ts.map +0 -1
  298. package/dist/block_storage_facade.d.ts.map +0 -1
  299. package/dist/components/PFrameForGraphs.d.ts.map +0 -1
  300. package/dist/components/PlAnnotations/filter.d.ts.map +0 -1
  301. package/dist/components/PlAnnotations/filters_ui.d.ts.map +0 -1
  302. package/dist/components/PlAnnotations/index.d.ts.map +0 -1
  303. package/dist/components/PlAnnotations/types.d.ts +0 -3
  304. package/dist/components/PlAnnotations/types.d.ts.map +0 -1
  305. package/dist/components/PlDataTable/index.d.ts.map +0 -1
  306. package/dist/components/PlDataTable/labels.d.ts +0 -7
  307. package/dist/components/PlDataTable/labels.d.ts.map +0 -1
  308. package/dist/components/PlDataTable/state-migration.d.ts.map +0 -1
  309. package/dist/components/PlDataTable/table.d.ts.map +0 -1
  310. package/dist/components/PlDataTable/v4.d.ts.map +0 -1
  311. package/dist/components/PlDataTable/v5.d.ts.map +0 -1
  312. package/dist/components/PlMultiSequenceAlignment.d.ts.map +0 -1
  313. package/dist/components/PlSelectionModel.d.ts.map +0 -1
  314. package/dist/components/index.d.ts.map +0 -1
  315. package/dist/config/actions.d.ts.map +0 -1
  316. package/dist/config/actions_kinds.d.ts.map +0 -1
  317. package/dist/config/index.d.ts.map +0 -1
  318. package/dist/config/model.d.ts.map +0 -1
  319. package/dist/config/model_meta.d.ts.map +0 -1
  320. package/dist/config/type_engine.d.ts.map +0 -1
  321. package/dist/config/type_util.d.ts.map +0 -1
  322. package/dist/env_value.d.ts.map +0 -1
  323. package/dist/filters/converters/filterToQuery.d.ts.map +0 -1
  324. package/dist/filters/converters/filterUiToExpressionImpl.d.ts.map +0 -1
  325. package/dist/filters/converters/index.d.ts.map +0 -1
  326. package/dist/filters/distill.d.ts.map +0 -1
  327. package/dist/filters/index.d.ts.map +0 -1
  328. package/dist/filters/traverse.d.ts +0 -27
  329. package/dist/filters/traverse.d.ts.map +0 -1
  330. package/dist/filters/types.d.ts.map +0 -1
  331. package/dist/index.cjs.map +0 -1
  332. package/dist/index.d.ts.map +0 -1
  333. package/dist/index.js.map +0 -1
  334. package/dist/internal.d.ts +0 -36
  335. package/dist/internal.d.ts.map +0 -1
  336. package/dist/package.json.cjs +0 -6
  337. package/dist/package.json.cjs.map +0 -1
  338. package/dist/package.json.js +0 -4
  339. package/dist/package.json.js.map +0 -1
  340. package/dist/pframe.d.ts.map +0 -1
  341. package/dist/pframe_utils/axes.d.ts.map +0 -1
  342. package/dist/pframe_utils/columns.d.ts.map +0 -1
  343. package/dist/pframe_utils/index.d.ts.map +0 -1
  344. package/dist/pframe_utils/querySpec.d.ts +0 -2
  345. package/dist/pframe_utils/querySpec.d.ts.map +0 -1
  346. package/dist/platforma.d.ts.map +0 -1
  347. package/dist/plugin_handle.d.ts.map +0 -1
  348. package/dist/plugin_model.d.ts.map +0 -1
  349. package/dist/raw_globals.d.ts.map +0 -1
  350. package/dist/ref_util.d.ts.map +0 -1
  351. package/dist/render/accessor.d.ts.map +0 -1
  352. package/dist/render/api.d.ts.map +0 -1
  353. package/dist/render/future.d.ts.map +0 -1
  354. package/dist/render/index.d.ts.map +0 -1
  355. package/dist/render/internal.d.ts.map +0 -1
  356. package/dist/render/traversal_ops.d.ts.map +0 -1
  357. package/dist/render/util/axis_filtering.d.ts.map +0 -1
  358. package/dist/render/util/column_collection.d.ts.map +0 -1
  359. package/dist/render/util/index.d.ts.map +0 -1
  360. package/dist/render/util/label.d.ts.map +0 -1
  361. package/dist/render/util/pcolumn_data.d.ts.map +0 -1
  362. package/dist/render/util/pframe_upgraders.d.ts +0 -3
  363. package/dist/render/util/pframe_upgraders.d.ts.map +0 -1
  364. package/dist/render/util/split_selectors.d.ts.map +0 -1
  365. package/dist/version.d.ts.map +0 -1
@@ -1,597 +1,495 @@
1
- 'use strict';
2
-
3
- var plModelCommon = require('@milaboratories/pl-model-common');
4
- var canonicalize = require('canonicalize');
5
- var internal = require('../internal.cjs');
6
- var block_storage = require('../block_storage.cjs');
7
- var accessor = require('./accessor.cjs');
8
- var internal$1 = require('./internal.cjs');
9
- var column_collection = require('./util/column_collection.cjs');
10
- var label = require('./util/label.cjs');
11
- var pframe_upgraders = require('./util/pframe_upgraders.cjs');
12
- var pcolumn_data = require('./util/pcolumn_data.cjs');
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_block_storage = require('../block_storage.cjs');
3
+ const require_internal = require('../internal.cjs');
4
+ const require_accessor = require('./accessor.cjs');
5
+ const require_internal$1 = require('./internal.cjs');
6
+ const require_label = require('./util/label.cjs');
7
+ const require_pcolumn_data = require('./util/pcolumn_data.cjs');
8
+ const require_column_collection = require('./util/column_collection.cjs');
9
+ const require_pframe_upgraders = require('./util/pframe_upgraders.cjs');
10
+ let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
11
+ let canonicalize = require("canonicalize");
12
+ canonicalize = require_runtime.__toESM(canonicalize);
13
13
 
14
+ //#region src/render/api.ts
14
15
  /**
15
- * Helper function to match domain objects
16
- * @param query Optional domain to match against
17
- * @param target Optional domain to match
18
- * @returns true if domains match, false otherwise
19
- */
16
+ * Helper function to match domain objects
17
+ * @param query Optional domain to match against
18
+ * @param target Optional domain to match
19
+ * @returns true if domains match, false otherwise
20
+ */
20
21
  function matchDomain(query, target) {
21
- if (query === undefined)
22
- return target === undefined;
23
- if (target === undefined)
24
- return true;
25
- for (const k in target) {
26
- if (query[k] !== target[k])
27
- return false;
28
- }
29
- return true;
22
+ if (query === void 0) return target === void 0;
23
+ if (target === void 0) return true;
24
+ for (const k in target) if (query[k] !== target[k]) return false;
25
+ return true;
30
26
  }
31
27
  /**
32
- * Transforms PColumn data into the internal representation expected by the platform
33
- * @param data Data from a PColumn to transform
34
- * @returns Transformed data compatible with platform API
35
- */
28
+ * Transforms PColumn data into the internal representation expected by the platform
29
+ * @param data Data from a PColumn to transform
30
+ * @returns Transformed data compatible with platform API
31
+ */
36
32
  function transformPColumnData(data) {
37
- return plModelCommon.mapPObjectData(data, (d) => {
38
- if (d instanceof accessor.TreeNodeAccessor) {
39
- return d.handle;
40
- }
41
- else if (plModelCommon.isDataInfo(d)) {
42
- return plModelCommon.mapDataInfo(d, (accessor) => accessor.handle);
43
- }
44
- else {
45
- return d;
46
- }
47
- });
48
- }
49
- class ResultPool {
50
- ctx = internal.getCfgRenderCtx();
51
- /**
52
- * @deprecated use getOptions()
53
- */
54
- calculateOptions(predicate) {
55
- return this.ctx.calculateOptions(predicate);
56
- }
57
- getOptions(predicateOrSelector, opts) {
58
- const predicate = typeof predicateOrSelector === "function"
59
- ? predicateOrSelector
60
- : plModelCommon.selectorsToPredicate(predicateOrSelector);
61
- const filtered = this.getSpecs().entries.filter((s) => predicate(s.obj));
62
- let labelOps = {};
63
- let refsWithEnrichments = false;
64
- if (typeof opts !== "undefined") {
65
- if (typeof opts === "function") {
66
- labelOps = opts;
67
- }
68
- else if (typeof opts === "object") {
69
- if ("includeNativeLabel" in opts || "separator" in opts || "addLabelAsSuffix" in opts) {
70
- labelOps = opts;
71
- }
72
- else {
73
- opts = opts;
74
- labelOps = opts.label ?? {};
75
- refsWithEnrichments = opts.refsWithEnrichments ?? false;
76
- }
77
- }
78
- }
79
- if (typeof labelOps === "object")
80
- return label.deriveLabels(filtered, (o) => o.obj, labelOps ?? {}).map(({ value: { ref }, label }) => ({
81
- ref: plModelCommon.withEnrichments(ref, refsWithEnrichments),
82
- label,
83
- }));
84
- else
85
- return filtered.map(({ ref, obj }) => ({
86
- ref: plModelCommon.withEnrichments(ref, refsWithEnrichments),
87
- label: labelOps(obj, ref),
88
- }));
89
- }
90
- resolveAnchorCtx(anchorsOrCtx) {
91
- if (anchorsOrCtx instanceof plModelCommon.AnchoredIdDeriver)
92
- return anchorsOrCtx;
93
- const resolvedAnchors = {};
94
- for (const [key, value] of Object.entries(anchorsOrCtx)) {
95
- if (plModelCommon.isPlRef(value)) {
96
- const resolvedSpec = this.getPColumnSpecByRef(value);
97
- if (!resolvedSpec)
98
- return undefined;
99
- resolvedAnchors[key] = resolvedSpec;
100
- }
101
- else {
102
- resolvedAnchors[key] = value;
103
- }
104
- }
105
- return new plModelCommon.AnchoredIdDeriver(resolvedAnchors);
106
- }
107
- /**
108
- * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
109
- *
110
- * @param anchorsOrCtx - Anchor context for column selection (same as in getCanonicalOptions)
111
- * @param predicateOrSelectors - Predicate or selectors for filtering columns (same as in getCanonicalOptions)
112
- * @param opts - Optional configuration for label generation and data waiting
113
- * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
114
- */
115
- getAnchoredPColumns(anchorsOrCtx, predicateOrSelectors, opts) {
116
- const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
117
- if (!anchorCtx)
118
- return undefined;
119
- return new column_collection.PColumnCollection()
120
- .addColumnProvider(this)
121
- .addAxisLabelProvider(this)
122
- .getColumns(predicateOrSelectors, {
123
- ...opts,
124
- anchorCtx,
125
- });
126
- }
127
- /**
128
- * Calculates anchored identifier options for columns matching a given predicate and returns their
129
- * canonicalized representations.
130
- *
131
- * This function filters column specifications from the result pool that match the provided predicate,
132
- * creates a standardized AnchorCtx from the provided anchors, and generates a list of label-value
133
- * pairs for UI components (like dropdowns).
134
- *
135
- * @param anchorsOrCtx - Either:
136
- * - An existing AnchorCtx instance
137
- * - A record mapping anchor IDs to PColumnSpec objects
138
- * - A record mapping anchor IDs to PlRef objects (which will be resolved to PColumnSpec)
139
- * @param predicateOrSelectors - Either:
140
- * - A predicate function that takes a PColumnSpec and returns a boolean.
141
- * Only specs that return true will be included.
142
- * - An APColumnSelector object for declarative filtering, which will be
143
- * resolved against the provided anchors and matched using matchPColumn.
144
- * - An array of APColumnSelector objects - columns matching ANY selector
145
- * in the array will be included (OR operation).
146
- * @param opts - Optional configuration for label generation:
147
- * - labelOps: Optional configuration for label generation:
148
- * - includeNativeLabel: Whether to include native column labels
149
- * - separator: String to use between label parts (defaults to " / ")
150
- * - addLabelAsSuffix: Whether to add labels as suffix instead of prefix
151
- * - dontWaitAllData: Whether to skip columns that don't have all data (if not set, will return undefined,
152
- * if at least one column that requires splitting is missing data)
153
- * @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
154
- * or undefined if any PlRef resolution fails.
155
- */
156
- getCanonicalOptions(anchorsOrCtx, predicateOrSelectors, opts) {
157
- const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
158
- if (!anchorCtx)
159
- return undefined;
160
- const entries = new column_collection.PColumnCollection()
161
- .addColumnProvider(this)
162
- .addAxisLabelProvider(this)
163
- .getUniversalEntries(predicateOrSelectors, {
164
- ...opts,
165
- anchorCtx,
166
- });
167
- if (!entries)
168
- return undefined;
169
- return entries.map((item) => ({
170
- value: item.id,
171
- label: item.label,
172
- }));
173
- }
174
- /**
175
- * @deprecated use getData()
176
- */
177
- getDataFromResultPool() {
178
- return this.getData();
179
- }
180
- getData() {
181
- const result = this.ctx.getDataFromResultPool();
182
- return {
183
- isComplete: result.isComplete,
184
- entries: result.entries.map((e) => ({
185
- ref: e.ref,
186
- obj: {
187
- ...e.obj,
188
- data: new accessor.TreeNodeAccessor(e.obj.data, [e.ref.blockId, e.ref.name]),
189
- },
190
- })),
191
- };
192
- }
193
- /**
194
- * @deprecated use getDataWithErrors()
195
- */
196
- getDataWithErrorsFromResultPool() {
197
- return this.getDataWithErrors();
198
- }
199
- getDataWithErrors() {
200
- const result = this.ctx.getDataWithErrorsFromResultPool();
201
- return {
202
- isComplete: result.isComplete,
203
- entries: result.entries.map((e) => ({
204
- ref: e.ref,
205
- obj: {
206
- ...e.obj,
207
- data: plModelCommon.mapValueInVOE(e.obj.data, (handle) => new accessor.TreeNodeAccessor(handle, [e.ref.blockId, e.ref.name])),
208
- },
209
- })),
210
- };
211
- }
212
- /**
213
- * @deprecated use getSpecs()
214
- */
215
- getSpecsFromResultPool() {
216
- return this.getSpecs();
217
- }
218
- getSpecs() {
219
- return this.ctx.getSpecsFromResultPool();
220
- }
221
- /**
222
- * @param ref a Ref
223
- * @returns data associated with the ref
224
- */
225
- getDataByRef(ref) {
226
- // @TODO remove after 1 Jan 2025; forward compatibility
227
- if (typeof this.ctx.getDataFromResultPoolByRef === "undefined")
228
- return this.getData().entries.find((f) => f.ref.blockId === ref.blockId && f.ref.name === ref.name)?.obj;
229
- const data = this.ctx.getDataFromResultPoolByRef(ref.blockId, ref.name); // Keep original call
230
- // Need to handle undefined case before mapping
231
- if (!data)
232
- return undefined;
233
- return plModelCommon.mapPObjectData(data, (handle) => new accessor.TreeNodeAccessor(handle, [ref.blockId, ref.name]));
234
- }
235
- /**
236
- * Returns data associated with the ref ensuring that it is a p-column.
237
- * @param ref a Ref
238
- * @returns p-column associated with the ref
239
- */
240
- getPColumnByRef(ref) {
241
- const data = this.getDataByRef(ref);
242
- if (!data)
243
- return undefined;
244
- return plModelCommon.ensurePColumn(data);
245
- }
246
- /**
247
- * Returns spec associated with the ref ensuring that it is a p-column spec.
248
- * @param ref a Ref
249
- * @returns p-column spec associated with the ref
250
- */
251
- getPColumnSpecByRef(ref) {
252
- const spec = this.getSpecByRef(ref);
253
- if (!spec)
254
- return undefined;
255
- if (!plModelCommon.isPColumnSpec(spec))
256
- throw new Error(`not a PColumn spec (kind = ${spec.kind})`);
257
- return spec;
258
- }
259
- /**
260
- * @param ref a Ref
261
- * @returns object spec associated with the ref
262
- */
263
- getSpecByRef(ref) {
264
- return this.ctx.getSpecFromResultPoolByRef(ref.blockId, ref.name);
265
- }
266
- /**
267
- * @param spec object specification
268
- * @returns array of data objects with compatible specs
269
- * @deprecated delete this method after Jan 1, 2025
270
- */
271
- findDataWithCompatibleSpec(spec) {
272
- const result = [];
273
- out: for (const data of this.getData().entries) {
274
- if (!plModelCommon.isPColumnSpec(data.obj.spec)) {
275
- continue;
276
- }
277
- const oth = data.obj.spec;
278
- if (spec.name !== oth.name) {
279
- continue;
280
- }
281
- if (spec.valueType !== oth.valueType) {
282
- continue;
283
- }
284
- if (spec.axesSpec.length !== oth.axesSpec.length) {
285
- continue;
286
- }
287
- if (!matchDomain(spec.domain, oth.domain)) {
288
- continue;
289
- }
290
- for (let i = 0; i < spec.axesSpec.length; ++i) {
291
- const qAx = spec.axesSpec[i];
292
- const tAx = oth.axesSpec[i];
293
- if (qAx.name !== tAx.name) {
294
- continue out;
295
- }
296
- if (qAx.type !== tAx.type) {
297
- continue out;
298
- }
299
- if (!matchDomain(qAx.domain, tAx.domain)) {
300
- continue out;
301
- }
302
- }
303
- result.push(data.obj);
304
- }
305
- return result;
306
- }
307
- /**
308
- * Find labels data for a given axis id. It will search for a label column and return its data as a map.
309
- * @returns a map of axis value => label
310
- */
311
- findLabels(axis) {
312
- const dataPool = this.getData();
313
- for (const column of dataPool.entries) {
314
- if (!plModelCommon.isPColumn(column.obj))
315
- continue;
316
- const spec = column.obj.spec;
317
- if (spec.name === plModelCommon.PColumnName.Label &&
318
- spec.axesSpec.length === 1 &&
319
- spec.axesSpec[0].name === axis.name &&
320
- spec.axesSpec[0].type === axis.type &&
321
- matchDomain(axis.domain, spec.axesSpec[0].domain)) {
322
- if (column.obj.data.resourceType.name !== "PColumnData/Json") {
323
- throw Error(`Expected JSON column for labels, got: ${column.obj.data.resourceType.name}`);
324
- }
325
- const labels = Object.fromEntries(Object.entries(column.obj.data.getDataAsJson().data).map((e) => [JSON.parse(e[0])[0], e[1]]));
326
- return labels;
327
- }
328
- }
329
- return undefined;
330
- }
331
- /**
332
- * Selects columns based on the provided selectors, returning PColumn objects
333
- * with lazily loaded data.
334
- *
335
- * @param selectors - A predicate function, a single selector, or an array of selectors.
336
- * @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
337
- */
338
- selectColumns(selectors) {
339
- const predicate = typeof selectors === "function" ? selectors : plModelCommon.selectorsToPredicate(selectors);
340
- const matchedSpecs = this.getSpecs().entries.filter(({ obj: spec }) => {
341
- if (!plModelCommon.isPColumnSpec(spec))
342
- return false;
343
- return predicate(spec);
344
- });
345
- // Map specs to PColumn objects with lazy data loading
346
- return matchedSpecs.map(({ ref, obj: spec }) => {
347
- // Type assertion needed because filter ensures it's PColumnSpec
348
- const pcolumnSpec = spec;
349
- let _cachedData = null; // Use null to distinguish initial state from undefined result
350
- // eslint-disable-next-line @typescript-eslint/no-this-alias
351
- const self = this; // Capture 'this' for use inside the getter
352
- return {
353
- id: canonicalize(ref),
354
- spec: pcolumnSpec,
355
- get data() {
356
- if (_cachedData !== null) {
357
- return _cachedData; // Return cached data (could be undefined if fetch failed)
358
- }
359
- _cachedData = self.getPColumnByRef(ref)?.data;
360
- return _cachedData;
361
- },
362
- }; // Cast needed because 'data' is a getter
363
- });
364
- }
365
- /**
366
- * Find labels data for a given axis id of a p-column.
367
- * @returns a map of axis value => label
368
- */
369
- findLabelsForColumnAxis(column, axisIdx) {
370
- const labels = this.findLabels(column.axesSpec[axisIdx]);
371
- if (!labels)
372
- return undefined;
373
- const axisKeys = plModelCommon.readAnnotation(column, `pl7.app/axisKeys/${axisIdx}`);
374
- if (axisKeys !== undefined) {
375
- const keys = JSON.parse(axisKeys);
376
- return Object.fromEntries(keys.map((key) => {
377
- return [key, labels[key] ?? "Unlabelled"];
378
- }));
379
- }
380
- else {
381
- return labels;
382
- }
383
- }
33
+ return (0, _milaboratories_pl_model_common.mapPObjectData)(data, (d) => {
34
+ if (d instanceof require_accessor.TreeNodeAccessor) return d.handle;
35
+ else if ((0, _milaboratories_pl_model_common.isDataInfo)(d)) return (0, _milaboratories_pl_model_common.mapDataInfo)(d, (accessor) => accessor.handle);
36
+ else return d;
37
+ });
384
38
  }
39
+ var ResultPool = class {
40
+ ctx = require_internal.getCfgRenderCtx();
41
+ /**
42
+ * @deprecated use getOptions()
43
+ */
44
+ calculateOptions(predicate) {
45
+ return this.ctx.calculateOptions(predicate);
46
+ }
47
+ getOptions(predicateOrSelector, opts) {
48
+ const predicate = typeof predicateOrSelector === "function" ? predicateOrSelector : (0, _milaboratories_pl_model_common.selectorsToPredicate)(predicateOrSelector);
49
+ const filtered = this.getSpecs().entries.filter((s) => predicate(s.obj));
50
+ let labelOps = {};
51
+ let refsWithEnrichments = false;
52
+ if (typeof opts !== "undefined") {
53
+ if (typeof opts === "function") labelOps = opts;
54
+ else if (typeof opts === "object") if ("includeNativeLabel" in opts || "separator" in opts || "addLabelAsSuffix" in opts) labelOps = opts;
55
+ else {
56
+ opts = opts;
57
+ labelOps = opts.label ?? {};
58
+ refsWithEnrichments = opts.refsWithEnrichments ?? false;
59
+ }
60
+ }
61
+ if (typeof labelOps === "object") return require_label.deriveLabels(filtered, (o) => o.obj, labelOps ?? {}).map(({ value: { ref }, label }) => ({
62
+ ref: (0, _milaboratories_pl_model_common.withEnrichments)(ref, refsWithEnrichments),
63
+ label
64
+ }));
65
+ else return filtered.map(({ ref, obj }) => ({
66
+ ref: (0, _milaboratories_pl_model_common.withEnrichments)(ref, refsWithEnrichments),
67
+ label: labelOps(obj, ref)
68
+ }));
69
+ }
70
+ resolveAnchorCtx(anchorsOrCtx) {
71
+ if (anchorsOrCtx instanceof _milaboratories_pl_model_common.AnchoredIdDeriver) return anchorsOrCtx;
72
+ const resolvedAnchors = {};
73
+ for (const [key, value] of Object.entries(anchorsOrCtx)) if ((0, _milaboratories_pl_model_common.isPlRef)(value)) {
74
+ const resolvedSpec = this.getPColumnSpecByRef(value);
75
+ if (!resolvedSpec) return void 0;
76
+ resolvedAnchors[key] = resolvedSpec;
77
+ } else resolvedAnchors[key] = value;
78
+ return new _milaboratories_pl_model_common.AnchoredIdDeriver(resolvedAnchors);
79
+ }
80
+ /**
81
+ * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
82
+ *
83
+ * @param anchorsOrCtx - Anchor context for column selection (same as in getCanonicalOptions)
84
+ * @param predicateOrSelectors - Predicate or selectors for filtering columns (same as in getCanonicalOptions)
85
+ * @param opts - Optional configuration for label generation and data waiting
86
+ * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
87
+ */
88
+ getAnchoredPColumns(anchorsOrCtx, predicateOrSelectors, opts) {
89
+ const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
90
+ if (!anchorCtx) return void 0;
91
+ return new require_column_collection.PColumnCollection().addColumnProvider(this).addAxisLabelProvider(this).getColumns(predicateOrSelectors, {
92
+ ...opts,
93
+ anchorCtx
94
+ });
95
+ }
96
+ /**
97
+ * Calculates anchored identifier options for columns matching a given predicate and returns their
98
+ * canonicalized representations.
99
+ *
100
+ * This function filters column specifications from the result pool that match the provided predicate,
101
+ * creates a standardized AnchorCtx from the provided anchors, and generates a list of label-value
102
+ * pairs for UI components (like dropdowns).
103
+ *
104
+ * @param anchorsOrCtx - Either:
105
+ * - An existing AnchorCtx instance
106
+ * - A record mapping anchor IDs to PColumnSpec objects
107
+ * - A record mapping anchor IDs to PlRef objects (which will be resolved to PColumnSpec)
108
+ * @param predicateOrSelectors - Either:
109
+ * - A predicate function that takes a PColumnSpec and returns a boolean.
110
+ * Only specs that return true will be included.
111
+ * - An APColumnSelector object for declarative filtering, which will be
112
+ * resolved against the provided anchors and matched using matchPColumn.
113
+ * - An array of APColumnSelector objects - columns matching ANY selector
114
+ * in the array will be included (OR operation).
115
+ * @param opts - Optional configuration for label generation:
116
+ * - labelOps: Optional configuration for label generation:
117
+ * - includeNativeLabel: Whether to include native column labels
118
+ * - separator: String to use between label parts (defaults to " / ")
119
+ * - addLabelAsSuffix: Whether to add labels as suffix instead of prefix
120
+ * - dontWaitAllData: Whether to skip columns that don't have all data (if not set, will return undefined,
121
+ * if at least one column that requires splitting is missing data)
122
+ * @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
123
+ * or undefined if any PlRef resolution fails.
124
+ */
125
+ getCanonicalOptions(anchorsOrCtx, predicateOrSelectors, opts) {
126
+ const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
127
+ if (!anchorCtx) return void 0;
128
+ const entries = new require_column_collection.PColumnCollection().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(predicateOrSelectors, {
129
+ ...opts,
130
+ anchorCtx
131
+ });
132
+ if (!entries) return void 0;
133
+ return entries.map((item) => ({
134
+ value: item.id,
135
+ label: item.label
136
+ }));
137
+ }
138
+ /**
139
+ * @deprecated use getData()
140
+ */
141
+ getDataFromResultPool() {
142
+ return this.getData();
143
+ }
144
+ getData() {
145
+ const result = this.ctx.getDataFromResultPool();
146
+ return {
147
+ isComplete: result.isComplete,
148
+ entries: result.entries.map((e) => ({
149
+ ref: e.ref,
150
+ obj: {
151
+ ...e.obj,
152
+ data: new require_accessor.TreeNodeAccessor(e.obj.data, [e.ref.blockId, e.ref.name])
153
+ }
154
+ }))
155
+ };
156
+ }
157
+ /**
158
+ * @deprecated use getDataWithErrors()
159
+ */
160
+ getDataWithErrorsFromResultPool() {
161
+ return this.getDataWithErrors();
162
+ }
163
+ getDataWithErrors() {
164
+ const result = this.ctx.getDataWithErrorsFromResultPool();
165
+ return {
166
+ isComplete: result.isComplete,
167
+ entries: result.entries.map((e) => ({
168
+ ref: e.ref,
169
+ obj: {
170
+ ...e.obj,
171
+ data: (0, _milaboratories_pl_model_common.mapValueInVOE)(e.obj.data, (handle) => new require_accessor.TreeNodeAccessor(handle, [e.ref.blockId, e.ref.name]))
172
+ }
173
+ }))
174
+ };
175
+ }
176
+ /**
177
+ * @deprecated use getSpecs()
178
+ */
179
+ getSpecsFromResultPool() {
180
+ return this.getSpecs();
181
+ }
182
+ getSpecs() {
183
+ return this.ctx.getSpecsFromResultPool();
184
+ }
185
+ /**
186
+ * @param ref a Ref
187
+ * @returns data associated with the ref
188
+ */
189
+ getDataByRef(ref) {
190
+ if (typeof this.ctx.getDataFromResultPoolByRef === "undefined") return this.getData().entries.find((f) => f.ref.blockId === ref.blockId && f.ref.name === ref.name)?.obj;
191
+ const data = this.ctx.getDataFromResultPoolByRef(ref.blockId, ref.name);
192
+ if (!data) return void 0;
193
+ return (0, _milaboratories_pl_model_common.mapPObjectData)(data, (handle) => new require_accessor.TreeNodeAccessor(handle, [ref.blockId, ref.name]));
194
+ }
195
+ /**
196
+ * Returns data associated with the ref ensuring that it is a p-column.
197
+ * @param ref a Ref
198
+ * @returns p-column associated with the ref
199
+ */
200
+ getPColumnByRef(ref) {
201
+ const data = this.getDataByRef(ref);
202
+ if (!data) return void 0;
203
+ return (0, _milaboratories_pl_model_common.ensurePColumn)(data);
204
+ }
205
+ /**
206
+ * Returns spec associated with the ref ensuring that it is a p-column spec.
207
+ * @param ref a Ref
208
+ * @returns p-column spec associated with the ref
209
+ */
210
+ getPColumnSpecByRef(ref) {
211
+ const spec = this.getSpecByRef(ref);
212
+ if (!spec) return void 0;
213
+ if (!(0, _milaboratories_pl_model_common.isPColumnSpec)(spec)) throw new Error(`not a PColumn spec (kind = ${spec.kind})`);
214
+ return spec;
215
+ }
216
+ /**
217
+ * @param ref a Ref
218
+ * @returns object spec associated with the ref
219
+ */
220
+ getSpecByRef(ref) {
221
+ return this.ctx.getSpecFromResultPoolByRef(ref.blockId, ref.name);
222
+ }
223
+ /**
224
+ * @param spec object specification
225
+ * @returns array of data objects with compatible specs
226
+ * @deprecated delete this method after Jan 1, 2025
227
+ */
228
+ findDataWithCompatibleSpec(spec) {
229
+ const result = [];
230
+ out: for (const data of this.getData().entries) {
231
+ if (!(0, _milaboratories_pl_model_common.isPColumnSpec)(data.obj.spec)) continue;
232
+ const oth = data.obj.spec;
233
+ if (spec.name !== oth.name) continue;
234
+ if (spec.valueType !== oth.valueType) continue;
235
+ if (spec.axesSpec.length !== oth.axesSpec.length) continue;
236
+ if (!matchDomain(spec.domain, oth.domain)) continue;
237
+ for (let i = 0; i < spec.axesSpec.length; ++i) {
238
+ const qAx = spec.axesSpec[i];
239
+ const tAx = oth.axesSpec[i];
240
+ if (qAx.name !== tAx.name) continue out;
241
+ if (qAx.type !== tAx.type) continue out;
242
+ if (!matchDomain(qAx.domain, tAx.domain)) continue out;
243
+ }
244
+ result.push(data.obj);
245
+ }
246
+ return result;
247
+ }
248
+ /**
249
+ * Find labels data for a given axis id. It will search for a label column and return its data as a map.
250
+ * @returns a map of axis value => label
251
+ */
252
+ findLabels(axis) {
253
+ const dataPool = this.getData();
254
+ for (const column of dataPool.entries) {
255
+ if (!(0, _milaboratories_pl_model_common.isPColumn)(column.obj)) continue;
256
+ const spec = column.obj.spec;
257
+ if (spec.name === _milaboratories_pl_model_common.PColumnName.Label && spec.axesSpec.length === 1 && spec.axesSpec[0].name === axis.name && spec.axesSpec[0].type === axis.type && matchDomain(axis.domain, spec.axesSpec[0].domain)) {
258
+ if (column.obj.data.resourceType.name !== "PColumnData/Json") throw Error(`Expected JSON column for labels, got: ${column.obj.data.resourceType.name}`);
259
+ return Object.fromEntries(Object.entries(column.obj.data.getDataAsJson().data).map((e) => [JSON.parse(e[0])[0], e[1]]));
260
+ }
261
+ }
262
+ }
263
+ /**
264
+ * Selects columns based on the provided selectors, returning PColumn objects
265
+ * with lazily loaded data.
266
+ *
267
+ * @param selectors - A predicate function, a single selector, or an array of selectors.
268
+ * @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
269
+ */
270
+ selectColumns(selectors) {
271
+ const predicate = typeof selectors === "function" ? selectors : (0, _milaboratories_pl_model_common.selectorsToPredicate)(selectors);
272
+ return this.getSpecs().entries.filter(({ obj: spec }) => {
273
+ if (!(0, _milaboratories_pl_model_common.isPColumnSpec)(spec)) return false;
274
+ return predicate(spec);
275
+ }).map(({ ref, obj: spec }) => {
276
+ const pcolumnSpec = spec;
277
+ let _cachedData = null;
278
+ const self = this;
279
+ return {
280
+ id: (0, canonicalize.default)(ref),
281
+ spec: pcolumnSpec,
282
+ get data() {
283
+ if (_cachedData !== null) return _cachedData;
284
+ _cachedData = self.getPColumnByRef(ref)?.data;
285
+ return _cachedData;
286
+ }
287
+ };
288
+ });
289
+ }
290
+ /**
291
+ * Find labels data for a given axis id of a p-column.
292
+ * @returns a map of axis value => label
293
+ */
294
+ findLabelsForColumnAxis(column, axisIdx) {
295
+ const labels = this.findLabels(column.axesSpec[axisIdx]);
296
+ if (!labels) return void 0;
297
+ const axisKeys = (0, _milaboratories_pl_model_common.readAnnotation)(column, `pl7.app/axisKeys/${axisIdx}`);
298
+ if (axisKeys !== void 0) {
299
+ const keys = JSON.parse(axisKeys);
300
+ return Object.fromEntries(keys.map((key) => {
301
+ return [key, labels[key] ?? "Unlabelled"];
302
+ }));
303
+ } else return labels;
304
+ }
305
+ };
385
306
  /** Main entry point to the API available within model lambdas (like outputs, sections, etc..) */
386
- class RenderCtxBase {
387
- ctx;
388
- constructor() {
389
- this.ctx = internal.getCfgRenderCtx();
390
- }
391
- dataCache;
392
- get data() {
393
- if (this.dataCache === undefined) {
394
- const raw = this.ctx.data;
395
- const value = typeof raw === "function" ? raw() : raw;
396
- this.dataCache = { v: value ? JSON.parse(value) : {} };
397
- }
398
- return this.dataCache.v;
399
- }
400
- // lazy rendering because this feature is rarely used
401
- activeArgsCache;
402
- /**
403
- * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
404
- * Returns undefined, if block was never executed or stopped mid-way execution, so that the result was cleared.
405
- * */
406
- get activeArgs() {
407
- if (this.activeArgsCache === undefined) {
408
- const raw = this.ctx.activeArgs;
409
- const value = typeof raw === "function" ? raw() : raw;
410
- this.activeArgsCache = {
411
- v: value ? JSON.parse(value) : undefined,
412
- };
413
- }
414
- return this.activeArgsCache.v;
415
- }
416
- // /** Can be used to determine features provided by the desktop instance. */
417
- // public get featureFlags() {
418
- // return this.ctx.featureFlags;
419
- // }
420
- getNamedAccessor(name) {
421
- return accessor.ifDef(this.ctx.getAccessorHandleByName(name), (accessor$1) => new accessor.TreeNodeAccessor(accessor$1, [name]));
422
- }
423
- get prerun() {
424
- return this.getNamedAccessor(internal$1.StagingAccessorName);
425
- }
426
- get outputs() {
427
- return this.getNamedAccessor(internal$1.MainAccessorName);
428
- }
429
- resultPool = new ResultPool();
430
- /**
431
- * Find labels data for a given axis id. It will search for a label column and return its data as a map.
432
- * @returns a map of axis value => label
433
- * @deprecated Use resultPool.findLabels instead
434
- */
435
- findLabels(axis) {
436
- return this.resultPool.findLabels(axis);
437
- }
438
- verifyInlineAndExplicitColumnsSupport(columns) {
439
- const hasInlineColumns = columns.some((c) => !(c.data instanceof accessor.TreeNodeAccessor) || plModelCommon.isDataInfo(c.data)); // Updated check for DataInfo
440
- const inlineColumnsSupport = this.ctx.featureFlags?.inlineColumnsSupport === true;
441
- if (hasInlineColumns && !inlineColumnsSupport)
442
- throw Error(`Inline or explicit columns not supported`); // Combined check
443
- // Removed redundant explicitColumns check
444
- }
445
- patchPTableDef(def) {
446
- if (!this.ctx.featureFlags?.pTablePartitionFiltersSupport) {
447
- // For old desktop move all partition filters to filters field as it doesn't read partitionFilters field
448
- def = {
449
- ...def,
450
- partitionFilters: [],
451
- filters: [...def.partitionFilters, ...def.filters],
452
- };
453
- }
454
- if (!this.ctx.featureFlags?.pFrameInSetFilterSupport) {
455
- def = {
456
- ...def,
457
- partitionFilters: pframe_upgraders.patchInSetFilters(def.partitionFilters),
458
- filters: pframe_upgraders.patchInSetFilters(def.filters),
459
- };
460
- }
461
- return def;
462
- }
463
- // TODO remove all non-PColumn fields
464
- createPFrame(def) {
465
- this.verifyInlineAndExplicitColumnsSupport(def);
466
- if (!pcolumn_data.allPColumnsReady(def))
467
- return undefined;
468
- return this.ctx.createPFrame(def.map((c) => transformPColumnData(c)));
469
- }
470
- createPTable(def) {
471
- let rawDef;
472
- if ("columns" in def) {
473
- rawDef = this.patchPTableDef({
474
- src: {
475
- type: "full",
476
- entries: def.columns.map((c) => ({ type: "column", column: c })),
477
- },
478
- partitionFilters: def.filters ?? [],
479
- filters: [],
480
- sorting: def.sorting ?? [],
481
- });
482
- }
483
- else {
484
- rawDef = this.patchPTableDef(def);
485
- }
486
- const columns = plModelCommon.extractAllColumns(rawDef.src);
487
- this.verifyInlineAndExplicitColumnsSupport(columns);
488
- if (!pcolumn_data.allPColumnsReady(columns))
489
- return undefined;
490
- return this.ctx.createPTable(plModelCommon.mapPTableDef(rawDef, (po) => transformPColumnData(po)));
491
- }
492
- createPTableV2(def) {
493
- const columns = plModelCommon.collectSpecQueryColumns(def.query);
494
- this.verifyInlineAndExplicitColumnsSupport(columns);
495
- if (!pcolumn_data.allPColumnsReady(columns))
496
- return undefined;
497
- return this.ctx.createPTableV2(plModelCommon.mapPTableDefV2(def, (po) => transformPColumnData(po)));
498
- }
499
- /** @deprecated scheduled for removal from SDK */
500
- getBlockLabel(blockId) {
501
- return this.ctx.getBlockLabel(blockId);
502
- }
503
- getCurrentUnstableMarker() {
504
- return this.ctx.getCurrentUnstableMarker();
505
- }
506
- logInfo(msg) {
507
- this.ctx.logInfo(msg);
508
- }
509
- logWarn(msg) {
510
- this.ctx.logWarn(msg);
511
- }
512
- logError(msg) {
513
- this.ctx.logError(msg);
514
- }
515
- }
307
+ var RenderCtxBase = class {
308
+ ctx;
309
+ constructor() {
310
+ this.ctx = require_internal.getCfgRenderCtx();
311
+ }
312
+ dataCache;
313
+ get data() {
314
+ if (this.dataCache === void 0) {
315
+ const raw = this.ctx.data;
316
+ const value = typeof raw === "function" ? raw() : raw;
317
+ this.dataCache = { v: value ? JSON.parse(value) : {} };
318
+ }
319
+ return this.dataCache.v;
320
+ }
321
+ activeArgsCache;
322
+ /**
323
+ * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
324
+ * Returns undefined, if block was never executed or stopped mid-way execution, so that the result was cleared.
325
+ * */
326
+ get activeArgs() {
327
+ if (this.activeArgsCache === void 0) {
328
+ const raw = this.ctx.activeArgs;
329
+ const value = typeof raw === "function" ? raw() : raw;
330
+ this.activeArgsCache = { v: value ? JSON.parse(value) : void 0 };
331
+ }
332
+ return this.activeArgsCache.v;
333
+ }
334
+ getNamedAccessor(name) {
335
+ return require_accessor.ifDef(this.ctx.getAccessorHandleByName(name), (accessor) => new require_accessor.TreeNodeAccessor(accessor, [name]));
336
+ }
337
+ get prerun() {
338
+ return this.getNamedAccessor(require_internal$1.StagingAccessorName);
339
+ }
340
+ get outputs() {
341
+ return this.getNamedAccessor(require_internal$1.MainAccessorName);
342
+ }
343
+ resultPool = new ResultPool();
344
+ /**
345
+ * Find labels data for a given axis id. It will search for a label column and return its data as a map.
346
+ * @returns a map of axis value => label
347
+ * @deprecated Use resultPool.findLabels instead
348
+ */
349
+ findLabels(axis) {
350
+ return this.resultPool.findLabels(axis);
351
+ }
352
+ verifyInlineAndExplicitColumnsSupport(columns) {
353
+ const hasInlineColumns = columns.some((c) => !(c.data instanceof require_accessor.TreeNodeAccessor) || (0, _milaboratories_pl_model_common.isDataInfo)(c.data));
354
+ const inlineColumnsSupport = this.ctx.featureFlags?.inlineColumnsSupport === true;
355
+ if (hasInlineColumns && !inlineColumnsSupport) throw Error(`Inline or explicit columns not supported`);
356
+ }
357
+ patchPTableDef(def) {
358
+ if (!this.ctx.featureFlags?.pTablePartitionFiltersSupport) def = {
359
+ ...def,
360
+ partitionFilters: [],
361
+ filters: [...def.partitionFilters, ...def.filters]
362
+ };
363
+ if (!this.ctx.featureFlags?.pFrameInSetFilterSupport) def = {
364
+ ...def,
365
+ partitionFilters: require_pframe_upgraders.patchInSetFilters(def.partitionFilters),
366
+ filters: require_pframe_upgraders.patchInSetFilters(def.filters)
367
+ };
368
+ return def;
369
+ }
370
+ createPFrame(def) {
371
+ this.verifyInlineAndExplicitColumnsSupport(def);
372
+ if (!require_pcolumn_data.allPColumnsReady(def)) return void 0;
373
+ return this.ctx.createPFrame(def.map((c) => transformPColumnData(c)));
374
+ }
375
+ createPTable(def) {
376
+ let rawDef;
377
+ if ("columns" in def) rawDef = this.patchPTableDef({
378
+ src: {
379
+ type: "full",
380
+ entries: def.columns.map((c) => ({
381
+ type: "column",
382
+ column: c
383
+ }))
384
+ },
385
+ partitionFilters: def.filters ?? [],
386
+ filters: [],
387
+ sorting: def.sorting ?? []
388
+ });
389
+ else rawDef = this.patchPTableDef(def);
390
+ const columns = (0, _milaboratories_pl_model_common.extractAllColumns)(rawDef.src);
391
+ this.verifyInlineAndExplicitColumnsSupport(columns);
392
+ if (!require_pcolumn_data.allPColumnsReady(columns)) return void 0;
393
+ return this.ctx.createPTable((0, _milaboratories_pl_model_common.mapPTableDef)(rawDef, (po) => transformPColumnData(po)));
394
+ }
395
+ createPTableV2(def) {
396
+ const columns = (0, _milaboratories_pl_model_common.collectSpecQueryColumns)(def.query);
397
+ this.verifyInlineAndExplicitColumnsSupport(columns);
398
+ if (!require_pcolumn_data.allPColumnsReady(columns)) return void 0;
399
+ return this.ctx.createPTableV2((0, _milaboratories_pl_model_common.mapPTableDefV2)(def, (po) => transformPColumnData(po)));
400
+ }
401
+ /** @deprecated scheduled for removal from SDK */
402
+ getBlockLabel(blockId) {
403
+ return this.ctx.getBlockLabel(blockId);
404
+ }
405
+ getCurrentUnstableMarker() {
406
+ return this.ctx.getCurrentUnstableMarker();
407
+ }
408
+ logInfo(msg) {
409
+ this.ctx.logInfo(msg);
410
+ }
411
+ logWarn(msg) {
412
+ this.ctx.logWarn(msg);
413
+ }
414
+ logError(msg) {
415
+ this.ctx.logError(msg);
416
+ }
417
+ };
516
418
  /** Main entry point to the API available within model lambdas (like outputs, sections, etc..) for v3+ blocks */
517
- class BlockRenderCtx extends RenderCtxBase {
518
- argsCache;
519
- get args() {
520
- if (this.argsCache === undefined) {
521
- const raw = this.ctx.args;
522
- const value = typeof raw === "function" ? raw() : raw;
523
- this.argsCache = { v: value === undefined ? undefined : JSON.parse(value) };
524
- }
525
- return this.argsCache.v;
526
- }
527
- }
419
+ var BlockRenderCtx = class extends RenderCtxBase {
420
+ argsCache;
421
+ get args() {
422
+ if (this.argsCache === void 0) {
423
+ const raw = this.ctx.args;
424
+ const value = typeof raw === "function" ? raw() : raw;
425
+ this.argsCache = { v: value === void 0 ? void 0 : JSON.parse(value) };
426
+ }
427
+ return this.argsCache.v;
428
+ }
429
+ };
528
430
  /** Render context for legacy v1/v2 blocks - provides backward compatibility */
529
- class RenderCtxLegacy extends RenderCtxBase {
530
- argsCache;
531
- get args() {
532
- if (this.argsCache === undefined) {
533
- const raw = this.ctx.args;
534
- const value = typeof raw === "function" ? raw() : raw;
535
- this.argsCache = { v: JSON.parse(value) };
536
- }
537
- return this.argsCache.v;
538
- }
539
- uiStateCache;
540
- get uiState() {
541
- if (this.uiStateCache === undefined) {
542
- const raw = this.ctx.uiState;
543
- const value = typeof raw === "function" ? raw() : raw;
544
- this.uiStateCache = { v: value ? JSON.parse(value) : {} };
545
- }
546
- return this.uiStateCache.v;
547
- }
548
- }
431
+ var RenderCtxLegacy = class extends RenderCtxBase {
432
+ argsCache;
433
+ get args() {
434
+ if (this.argsCache === void 0) {
435
+ const raw = this.ctx.args;
436
+ const value = typeof raw === "function" ? raw() : raw;
437
+ this.argsCache = { v: JSON.parse(value) };
438
+ }
439
+ return this.argsCache.v;
440
+ }
441
+ uiStateCache;
442
+ get uiState() {
443
+ if (this.uiStateCache === void 0) {
444
+ const raw = this.ctx.uiState;
445
+ const value = typeof raw === "function" ? raw() : raw;
446
+ this.uiStateCache = { v: value ? JSON.parse(value) : {} };
447
+ }
448
+ return this.uiStateCache.v;
449
+ }
450
+ };
549
451
  /**
550
- * Render context for plugin output functions.
551
- * Reads plugin data from blockStorage and derives params from pre-wrapped input callbacks.
552
- *
553
- * Parameterized on the factory-like phantom F so that getPluginData returns
554
- * InferFactoryData<F> directly — no casts needed for the data getter.
555
- *
556
- * @typeParam F - PluginFactoryLike phantom carrying data/params/outputs types
557
- */
558
- class PluginRenderCtx {
559
- ctx;
560
- handle;
561
- wrappedInputs;
562
- constructor(handle, wrappedInputs) {
563
- this.ctx = internal.getCfgRenderCtx();
564
- this.handle = handle;
565
- this.wrappedInputs = wrappedInputs;
566
- }
567
- dataCache;
568
- /** Plugin's persistent data from blockStorage.__plugins.{pluginId}.__data */
569
- get data() {
570
- if (this.dataCache === undefined) {
571
- const raw = this.ctx.blockStorage();
572
- this.dataCache = { v: block_storage.getPluginData(plModelCommon.parseJson(raw), this.handle) };
573
- }
574
- return this.dataCache.v;
575
- }
576
- paramsCache;
577
- /** Params derived from block context via pre-wrapped input callbacks */
578
- get params() {
579
- if (this.paramsCache === undefined) {
580
- const result = {};
581
- for (const [key, fn] of Object.entries(this.wrappedInputs)) {
582
- result[key] = fn();
583
- }
584
- this.paramsCache = { v: result };
585
- }
586
- return this.paramsCache.v;
587
- }
588
- /** Result pool — same as block, from cfgRenderCtx methods */
589
- resultPool = new ResultPool();
590
- }
452
+ * Render context for plugin output functions.
453
+ * Reads plugin data from blockStorage and derives params from pre-wrapped input callbacks.
454
+ *
455
+ * Parameterized on the factory-like phantom F so that getPluginData returns
456
+ * InferFactoryData<F> directly — no casts needed for the data getter.
457
+ *
458
+ * @typeParam F - PluginFactoryLike phantom carrying data/params/outputs types
459
+ */
460
+ var PluginRenderCtx = class {
461
+ ctx;
462
+ handle;
463
+ wrappedInputs;
464
+ constructor(handle, wrappedInputs) {
465
+ this.ctx = require_internal.getCfgRenderCtx();
466
+ this.handle = handle;
467
+ this.wrappedInputs = wrappedInputs;
468
+ }
469
+ dataCache;
470
+ /** Plugin's persistent data from blockStorage.__plugins.{pluginId}.__data */
471
+ get data() {
472
+ if (this.dataCache === void 0) this.dataCache = { v: require_block_storage.getPluginData((0, _milaboratories_pl_model_common.parseJson)(this.ctx.blockStorage()), this.handle) };
473
+ return this.dataCache.v;
474
+ }
475
+ paramsCache;
476
+ /** Params derived from block context via pre-wrapped input callbacks */
477
+ get params() {
478
+ if (this.paramsCache === void 0) {
479
+ const result = {};
480
+ for (const [key, fn] of Object.entries(this.wrappedInputs)) result[key] = fn();
481
+ this.paramsCache = { v: result };
482
+ }
483
+ return this.paramsCache.v;
484
+ }
485
+ /** Result pool — same as block, from cfgRenderCtx methods */
486
+ resultPool = new ResultPool();
487
+ };
591
488
 
489
+ //#endregion
592
490
  exports.BlockRenderCtx = BlockRenderCtx;
593
491
  exports.PluginRenderCtx = PluginRenderCtx;
594
492
  exports.RenderCtxBase = RenderCtxBase;
595
493
  exports.RenderCtxLegacy = RenderCtxLegacy;
596
494
  exports.ResultPool = ResultPool;
597
- //# sourceMappingURL=api.cjs.map
495
+ //# sourceMappingURL=api.cjs.map