@platforma-sdk/model 1.58.3 → 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 (366) 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 -50
  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 -48
  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 +9 -3
  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/filters/distill.ts +17 -6
  272. package/src/index.ts +12 -11
  273. package/src/internal.ts +0 -1
  274. package/src/platforma.ts +4 -4
  275. package/src/plugin_handle.ts +1 -1
  276. package/src/plugin_model.test.ts +217 -21
  277. package/src/plugin_model.ts +450 -55
  278. package/src/raw_globals.ts +0 -1
  279. package/dist/annotations/converter.d.ts.map +0 -1
  280. package/dist/annotations/index.d.ts.map +0 -1
  281. package/dist/annotations/types.d.ts.map +0 -1
  282. package/dist/bconfig/index.d.ts.map +0 -1
  283. package/dist/bconfig/lambdas.d.ts.map +0 -1
  284. package/dist/bconfig/normalization.d.ts.map +0 -1
  285. package/dist/bconfig/types.d.ts.map +0 -1
  286. package/dist/bconfig/util.d.ts.map +0 -1
  287. package/dist/bconfig/v3.d.ts.map +0 -1
  288. package/dist/block_api_v1.d.ts.map +0 -1
  289. package/dist/block_api_v2.d.ts.map +0 -1
  290. package/dist/block_api_v3.d.ts.map +0 -1
  291. package/dist/block_migrations.d.ts.map +0 -1
  292. package/dist/block_model.d.ts.map +0 -1
  293. package/dist/block_model_legacy.d.ts.map +0 -1
  294. package/dist/block_state_patch.d.ts.map +0 -1
  295. package/dist/block_state_util.d.ts.map +0 -1
  296. package/dist/block_storage.d.ts.map +0 -1
  297. package/dist/block_storage_callbacks.d.ts +0 -115
  298. package/dist/block_storage_callbacks.d.ts.map +0 -1
  299. package/dist/block_storage_facade.d.ts.map +0 -1
  300. package/dist/components/PFrameForGraphs.d.ts.map +0 -1
  301. package/dist/components/PlAnnotations/filter.d.ts.map +0 -1
  302. package/dist/components/PlAnnotations/filters_ui.d.ts.map +0 -1
  303. package/dist/components/PlAnnotations/index.d.ts.map +0 -1
  304. package/dist/components/PlAnnotations/types.d.ts +0 -3
  305. package/dist/components/PlAnnotations/types.d.ts.map +0 -1
  306. package/dist/components/PlDataTable/index.d.ts.map +0 -1
  307. package/dist/components/PlDataTable/labels.d.ts +0 -7
  308. package/dist/components/PlDataTable/labels.d.ts.map +0 -1
  309. package/dist/components/PlDataTable/state-migration.d.ts.map +0 -1
  310. package/dist/components/PlDataTable/table.d.ts.map +0 -1
  311. package/dist/components/PlDataTable/v4.d.ts.map +0 -1
  312. package/dist/components/PlDataTable/v5.d.ts.map +0 -1
  313. package/dist/components/PlMultiSequenceAlignment.d.ts.map +0 -1
  314. package/dist/components/PlSelectionModel.d.ts.map +0 -1
  315. package/dist/components/index.d.ts.map +0 -1
  316. package/dist/config/actions.d.ts.map +0 -1
  317. package/dist/config/actions_kinds.d.ts.map +0 -1
  318. package/dist/config/index.d.ts.map +0 -1
  319. package/dist/config/model.d.ts.map +0 -1
  320. package/dist/config/model_meta.d.ts.map +0 -1
  321. package/dist/config/type_engine.d.ts.map +0 -1
  322. package/dist/config/type_util.d.ts.map +0 -1
  323. package/dist/env_value.d.ts.map +0 -1
  324. package/dist/filters/converters/filterToQuery.d.ts.map +0 -1
  325. package/dist/filters/converters/filterUiToExpressionImpl.d.ts.map +0 -1
  326. package/dist/filters/converters/index.d.ts.map +0 -1
  327. package/dist/filters/distill.d.ts.map +0 -1
  328. package/dist/filters/index.d.ts.map +0 -1
  329. package/dist/filters/traverse.d.ts +0 -27
  330. package/dist/filters/traverse.d.ts.map +0 -1
  331. package/dist/filters/types.d.ts.map +0 -1
  332. package/dist/index.cjs.map +0 -1
  333. package/dist/index.d.ts.map +0 -1
  334. package/dist/index.js.map +0 -1
  335. package/dist/internal.d.ts +0 -36
  336. package/dist/internal.d.ts.map +0 -1
  337. package/dist/package.json.cjs +0 -6
  338. package/dist/package.json.cjs.map +0 -1
  339. package/dist/package.json.js +0 -4
  340. package/dist/package.json.js.map +0 -1
  341. package/dist/pframe.d.ts.map +0 -1
  342. package/dist/pframe_utils/axes.d.ts.map +0 -1
  343. package/dist/pframe_utils/columns.d.ts.map +0 -1
  344. package/dist/pframe_utils/index.d.ts.map +0 -1
  345. package/dist/pframe_utils/querySpec.d.ts +0 -2
  346. package/dist/pframe_utils/querySpec.d.ts.map +0 -1
  347. package/dist/platforma.d.ts.map +0 -1
  348. package/dist/plugin_handle.d.ts.map +0 -1
  349. package/dist/plugin_model.d.ts.map +0 -1
  350. package/dist/raw_globals.d.ts.map +0 -1
  351. package/dist/ref_util.d.ts.map +0 -1
  352. package/dist/render/accessor.d.ts.map +0 -1
  353. package/dist/render/api.d.ts.map +0 -1
  354. package/dist/render/future.d.ts.map +0 -1
  355. package/dist/render/index.d.ts.map +0 -1
  356. package/dist/render/internal.d.ts.map +0 -1
  357. package/dist/render/traversal_ops.d.ts.map +0 -1
  358. package/dist/render/util/axis_filtering.d.ts.map +0 -1
  359. package/dist/render/util/column_collection.d.ts.map +0 -1
  360. package/dist/render/util/index.d.ts.map +0 -1
  361. package/dist/render/util/label.d.ts.map +0 -1
  362. package/dist/render/util/pcolumn_data.d.ts.map +0 -1
  363. package/dist/render/util/pframe_upgraders.d.ts +0 -3
  364. package/dist/render/util/pframe_upgraders.d.ts.map +0 -1
  365. package/dist/render/util/split_selectors.d.ts.map +0 -1
  366. package/dist/version.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
- 'use strict';
2
-
3
- var plModelCommon = require('@milaboratories/pl-model-common');
4
- var accessor = require('../accessor.cjs');
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+ const require_accessor = require('../accessor.cjs');
3
+ let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
5
4
 
5
+ //#region src/render/util/pcolumn_data.ts
6
6
  const PCD_PREFIX = "PColumnData/";
7
7
  const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
8
8
  const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
@@ -14,400 +14,340 @@ const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX + "JsonPartitioned";
14
14
  const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX + "BinaryPartitioned";
15
15
  const RT_PARQUET_SUPER_PARTITIONED = PCD_SUP_PREFIX + "ParquetPartitioned";
16
16
  function populateResourceMapData(acc, resourceParser, data, keyPrefix = [], addEntriesWithNoData) {
17
- if (acc === undefined)
18
- return false;
19
- switch (acc.resourceType.name) {
20
- case RT_RESOURCE_MAP: {
21
- let isComplete = acc.getInputsLocked();
22
- for (const keyStr of acc.listInputFields()) {
23
- const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
24
- const key = [...keyPrefix, ...JSON.parse(keyStr)];
25
- const converted = value === undefined ? undefined : resourceParser(value);
26
- if (converted === undefined)
27
- isComplete = false;
28
- if (converted !== undefined || addEntriesWithNoData)
29
- data.push({ key, value: converted });
30
- }
31
- return isComplete;
32
- }
33
- case RT_RESOURCE_MAP_PARTITIONED: {
34
- let isComplete = acc.getInputsLocked();
35
- for (const keyStr of acc.listInputFields()) {
36
- const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
37
- if (value === undefined)
38
- isComplete = false;
39
- else {
40
- const key = [...keyPrefix, ...JSON.parse(keyStr)];
41
- const populateResult = populateResourceMapData(value, resourceParser, data, key, addEntriesWithNoData);
42
- isComplete = isComplete && populateResult;
43
- }
44
- }
45
- return isComplete;
46
- }
47
- default:
48
- throw new Error(`Unknown resource type: ${acc.resourceType.name}`);
49
- }
17
+ if (acc === void 0) return false;
18
+ switch (acc.resourceType.name) {
19
+ case RT_RESOURCE_MAP: {
20
+ let isComplete = acc.getInputsLocked();
21
+ for (const keyStr of acc.listInputFields()) {
22
+ const value = acc.resolve({
23
+ field: keyStr,
24
+ assertFieldType: "Input"
25
+ });
26
+ const key = [...keyPrefix, ...JSON.parse(keyStr)];
27
+ const converted = value === void 0 ? void 0 : resourceParser(value);
28
+ if (converted === void 0) isComplete = false;
29
+ if (converted !== void 0 || addEntriesWithNoData) data.push({
30
+ key,
31
+ value: converted
32
+ });
33
+ }
34
+ return isComplete;
35
+ }
36
+ case RT_RESOURCE_MAP_PARTITIONED: {
37
+ let isComplete = acc.getInputsLocked();
38
+ for (const keyStr of acc.listInputFields()) {
39
+ const value = acc.resolve({
40
+ field: keyStr,
41
+ assertFieldType: "Input"
42
+ });
43
+ if (value === void 0) isComplete = false;
44
+ else {
45
+ const populateResult = populateResourceMapData(value, resourceParser, data, [...keyPrefix, ...JSON.parse(keyStr)], addEntriesWithNoData);
46
+ isComplete = isComplete && populateResult;
47
+ }
48
+ }
49
+ return isComplete;
50
+ }
51
+ default: throw new Error(`Unknown resource type: ${acc.resourceType.name}`);
52
+ }
50
53
  }
51
54
  function parseResourceMap(acc, resourceParser, addEntriesWithNoData = false) {
52
- const data = [];
53
- const isComplete = populateResourceMapData(acc, resourceParser, data, [], addEntriesWithNoData);
54
- return { isComplete, data };
55
+ const data = [];
56
+ return {
57
+ isComplete: populateResourceMapData(acc, resourceParser, data, [], addEntriesWithNoData),
58
+ data
59
+ };
55
60
  }
56
61
  const removeIndexSuffix = (keyStr) => {
57
- if (keyStr.endsWith(".index")) {
58
- return { baseKey: keyStr.substring(0, keyStr.length - 6), type: "index" };
59
- }
60
- else if (keyStr.endsWith(".values")) {
61
- return { baseKey: keyStr.substring(0, keyStr.length - 7), type: "values" };
62
- }
63
- else {
64
- throw new Error(`key must ends on .index/.values for binary p-column, got: ${keyStr}`);
65
- }
62
+ if (keyStr.endsWith(".index")) return {
63
+ baseKey: keyStr.substring(0, keyStr.length - 6),
64
+ type: "index"
65
+ };
66
+ else if (keyStr.endsWith(".values")) return {
67
+ baseKey: keyStr.substring(0, keyStr.length - 7),
68
+ type: "values"
69
+ };
70
+ else throw new Error(`key must ends on .index/.values for binary p-column, got: ${keyStr}`);
66
71
  };
67
- // @TODO define a class with various resource map operations
68
72
  /** Returns a list of all partition keys appeared in the p-column */
69
73
  function getPartitionKeysList(acc) {
70
- if (!acc)
71
- return undefined;
72
- const rt = acc.resourceType.name;
73
- const meta = acc.getDataAsJson();
74
- const data = [];
75
- let keyLength = 0;
76
- // @TODO validate meta shape
77
- switch (rt) {
78
- case RT_RESOURCE_MAP:
79
- keyLength = meta["keyLength"];
80
- break;
81
- case RT_RESOURCE_MAP_PARTITIONED:
82
- keyLength = meta["partitionKeyLength"] + meta["keyLength"];
83
- break;
84
- case RT_JSON_PARTITIONED:
85
- case RT_BINARY_PARTITIONED:
86
- case RT_PARQUET_PARTITIONED:
87
- keyLength = meta["partitionKeyLength"];
88
- break;
89
- case RT_BINARY_SUPER_PARTITIONED:
90
- case RT_JSON_SUPER_PARTITIONED:
91
- case RT_PARQUET_SUPER_PARTITIONED:
92
- keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
93
- break;
94
- }
95
- switch (rt) {
96
- case RT_RESOURCE_MAP:
97
- case RT_JSON_PARTITIONED:
98
- case RT_BINARY_PARTITIONED:
99
- case RT_PARQUET_PARTITIONED:
100
- for (let keyStr of acc.listInputFields()) {
101
- if (rt === RT_BINARY_PARTITIONED) {
102
- keyStr = removeIndexSuffix(keyStr).baseKey;
103
- }
104
- const key = [...JSON.parse(keyStr)];
105
- data.push(key);
106
- }
107
- break;
108
- case RT_RESOURCE_MAP_PARTITIONED:
109
- case RT_BINARY_SUPER_PARTITIONED:
110
- case RT_JSON_SUPER_PARTITIONED:
111
- case RT_PARQUET_SUPER_PARTITIONED:
112
- for (const supKeyStr of acc.listInputFields()) {
113
- const keyPrefix = [...JSON.parse(supKeyStr)];
114
- const value = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
115
- if (value !== undefined) {
116
- for (let keyStr of value.listInputFields()) {
117
- if (rt === RT_BINARY_SUPER_PARTITIONED) {
118
- keyStr = removeIndexSuffix(keyStr).baseKey;
119
- }
120
- const key = [...keyPrefix, ...JSON.parse(keyStr)];
121
- data.push(key);
122
- }
123
- }
124
- }
125
- break;
126
- }
127
- return { data, keyLength };
74
+ if (!acc) return void 0;
75
+ const rt = acc.resourceType.name;
76
+ const meta = acc.getDataAsJson();
77
+ const data = [];
78
+ let keyLength = 0;
79
+ switch (rt) {
80
+ case RT_RESOURCE_MAP:
81
+ keyLength = meta["keyLength"];
82
+ break;
83
+ case RT_RESOURCE_MAP_PARTITIONED:
84
+ keyLength = meta["partitionKeyLength"] + meta["keyLength"];
85
+ break;
86
+ case RT_JSON_PARTITIONED:
87
+ case RT_BINARY_PARTITIONED:
88
+ case RT_PARQUET_PARTITIONED:
89
+ keyLength = meta["partitionKeyLength"];
90
+ break;
91
+ case RT_BINARY_SUPER_PARTITIONED:
92
+ case RT_JSON_SUPER_PARTITIONED:
93
+ case RT_PARQUET_SUPER_PARTITIONED:
94
+ keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
95
+ break;
96
+ }
97
+ switch (rt) {
98
+ case RT_RESOURCE_MAP:
99
+ case RT_JSON_PARTITIONED:
100
+ case RT_BINARY_PARTITIONED:
101
+ case RT_PARQUET_PARTITIONED:
102
+ for (let keyStr of acc.listInputFields()) {
103
+ if (rt === RT_BINARY_PARTITIONED) keyStr = removeIndexSuffix(keyStr).baseKey;
104
+ const key = [...JSON.parse(keyStr)];
105
+ data.push(key);
106
+ }
107
+ break;
108
+ case RT_RESOURCE_MAP_PARTITIONED:
109
+ case RT_BINARY_SUPER_PARTITIONED:
110
+ case RT_JSON_SUPER_PARTITIONED:
111
+ case RT_PARQUET_SUPER_PARTITIONED:
112
+ for (const supKeyStr of acc.listInputFields()) {
113
+ const keyPrefix = [...JSON.parse(supKeyStr)];
114
+ const value = acc.resolve({
115
+ field: supKeyStr,
116
+ assertFieldType: "Input"
117
+ });
118
+ if (value !== void 0) for (let keyStr of value.listInputFields()) {
119
+ if (rt === RT_BINARY_SUPER_PARTITIONED) keyStr = removeIndexSuffix(keyStr).baseKey;
120
+ const key = [...keyPrefix, ...JSON.parse(keyStr)];
121
+ data.push(key);
122
+ }
123
+ }
124
+ break;
125
+ }
126
+ return {
127
+ data,
128
+ keyLength
129
+ };
128
130
  }
129
131
  function getUniquePartitionKeysForDataEntries(list) {
130
- if (list.type !== "JsonPartitioned" &&
131
- list.type !== "BinaryPartitioned" &&
132
- list.type !== "ParquetPartitioned")
133
- throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${list.type}`);
134
- const { parts, partitionKeyLength } = list;
135
- const result = [];
136
- for (let i = 0; i < partitionKeyLength; ++i) {
137
- result.push(new Set());
138
- }
139
- for (const part of parts) {
140
- const key = part.key;
141
- if (key.length !== partitionKeyLength) {
142
- throw new Error(`Key length (${key.length}) does not match partition length (${partitionKeyLength}) for key: ${JSON.stringify(key)}`);
143
- }
144
- for (let i = 0; i < partitionKeyLength; ++i) {
145
- result[i].add(key[i]);
146
- }
147
- }
148
- return result.map((s) => Array.from(s.values()));
132
+ if (list.type !== "JsonPartitioned" && list.type !== "BinaryPartitioned" && list.type !== "ParquetPartitioned") throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${list.type}`);
133
+ const { parts, partitionKeyLength } = list;
134
+ const result = [];
135
+ for (let i = 0; i < partitionKeyLength; ++i) result.push(/* @__PURE__ */ new Set());
136
+ for (const part of parts) {
137
+ const key = part.key;
138
+ if (key.length !== partitionKeyLength) throw new Error(`Key length (${key.length}) does not match partition length (${partitionKeyLength}) for key: ${JSON.stringify(key)}`);
139
+ for (let i = 0; i < partitionKeyLength; ++i) result[i].add(key[i]);
140
+ }
141
+ return result.map((s) => Array.from(s.values()));
149
142
  }
150
143
  function getUniquePartitionKeys(acc) {
151
- if (acc === undefined)
152
- return undefined;
153
- if (plModelCommon.isDataInfoEntries(acc))
154
- return getUniquePartitionKeysForDataEntries(acc);
155
- const list = getPartitionKeysList(acc);
156
- if (!list)
157
- return undefined;
158
- const { data, keyLength } = list;
159
- const result = [];
160
- for (let i = 0; i < keyLength; ++i) {
161
- result.push(new Set());
162
- }
163
- for (const l of data) {
164
- if (l.length !== keyLength) {
165
- throw new Error("key length does not match partition length");
166
- }
167
- for (let i = 0; i < keyLength; ++i) {
168
- result[i].add(l[i]);
169
- }
170
- }
171
- return result.map((s) => Array.from(s.values()));
144
+ if (acc === void 0) return void 0;
145
+ if ((0, _milaboratories_pl_model_common.isDataInfoEntries)(acc)) return getUniquePartitionKeysForDataEntries(acc);
146
+ const list = getPartitionKeysList(acc);
147
+ if (!list) return void 0;
148
+ const { data, keyLength } = list;
149
+ const result = [];
150
+ for (let i = 0; i < keyLength; ++i) result.push(/* @__PURE__ */ new Set());
151
+ for (const l of data) {
152
+ if (l.length !== keyLength) throw new Error("key length does not match partition length");
153
+ for (let i = 0; i < keyLength; ++i) result[i].add(l[i]);
154
+ }
155
+ return result.map((s) => Array.from(s.values()));
172
156
  }
173
157
  /**
174
- * Parses the PColumn data from a TreeNodeAccessor into a DataInfoEntries structure.
175
- * Returns undefined if any required data is missing.
176
- * Throws error on validation failures.
177
- *
178
- * @param acc - The TreeNodeAccessor containing PColumn data
179
- * @param keyPrefix - Optional key prefix for recursive calls
180
- * @returns DataInfoEntries representation of the PColumn data, or undefined if incomplete
181
- */
158
+ * Parses the PColumn data from a TreeNodeAccessor into a DataInfoEntries structure.
159
+ * Returns undefined if any required data is missing.
160
+ * Throws error on validation failures.
161
+ *
162
+ * @param acc - The TreeNodeAccessor containing PColumn data
163
+ * @param keyPrefix - Optional key prefix for recursive calls
164
+ * @returns DataInfoEntries representation of the PColumn data, or undefined if incomplete
165
+ */
182
166
  function parsePColumnData(acc, keyPrefix = []) {
183
- if (acc === undefined)
184
- return undefined;
185
- if (!acc.getIsReadyOrError())
186
- return undefined;
187
- const resourceType = acc.resourceType.name;
188
- const meta = acc.getDataAsJson();
189
- // Prevent recursive super-partitioned resources
190
- if (keyPrefix.length > 0 &&
191
- (resourceType === RT_JSON_SUPER_PARTITIONED ||
192
- resourceType === RT_BINARY_SUPER_PARTITIONED ||
193
- resourceType === RT_PARQUET_SUPER_PARTITIONED)) {
194
- throw new Error(`Unexpected nested super-partitioned resource: ${resourceType}`);
195
- }
196
- switch (resourceType) {
197
- case RT_RESOURCE_MAP:
198
- case RT_RESOURCE_MAP_PARTITIONED:
199
- throw new Error(`Only data columns are supported, got: ${resourceType}`);
200
- case RT_JSON_PARTITIONED: {
201
- if (typeof meta?.partitionKeyLength !== "number") {
202
- throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
203
- }
204
- const parts = [];
205
- for (const keyStr of acc.listInputFields()) {
206
- const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
207
- if (value === undefined)
208
- return undefined;
209
- const key = [...keyPrefix, ...JSON.parse(keyStr)];
210
- parts.push({ key, value });
211
- }
212
- return {
213
- type: "JsonPartitioned",
214
- partitionKeyLength: meta.partitionKeyLength,
215
- parts,
216
- };
217
- }
218
- case RT_BINARY_PARTITIONED: {
219
- if (typeof meta?.partitionKeyLength !== "number") {
220
- throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
221
- }
222
- const parts = [];
223
- const baseKeys = new Map();
224
- // Group fields by base key (without .index/.values suffix)
225
- for (const keyStr of acc.listInputFields()) {
226
- const suffix = removeIndexSuffix(keyStr);
227
- const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
228
- if (value === undefined)
229
- return undefined;
230
- let entry = baseKeys.get(suffix.baseKey);
231
- if (!entry) {
232
- entry = {};
233
- baseKeys.set(suffix.baseKey, entry);
234
- }
235
- if (suffix.type === "index") {
236
- entry.index = value;
237
- }
238
- else {
239
- entry.values = value;
240
- }
241
- }
242
- // Process complete binary chunks only
243
- for (const [baseKeyStr, entry] of baseKeys.entries()) {
244
- if (!entry.index || !entry.values)
245
- return undefined;
246
- const key = [...keyPrefix, ...JSON.parse(baseKeyStr)];
247
- parts.push({
248
- key,
249
- value: {
250
- index: entry.index,
251
- values: entry.values,
252
- },
253
- });
254
- }
255
- return {
256
- type: "BinaryPartitioned",
257
- partitionKeyLength: meta.partitionKeyLength,
258
- parts,
259
- };
260
- }
261
- case RT_PARQUET_PARTITIONED: {
262
- if (typeof meta?.partitionKeyLength !== "number") {
263
- throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
264
- }
265
- const parts = [];
266
- for (const keyStr of acc.listInputFields()) {
267
- const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
268
- if (value === undefined)
269
- return undefined;
270
- const key = [...keyPrefix, ...JSON.parse(keyStr)];
271
- parts.push({ key, value });
272
- }
273
- return {
274
- type: "ParquetPartitioned",
275
- partitionKeyLength: meta.partitionKeyLength,
276
- parts,
277
- };
278
- }
279
- case RT_JSON_SUPER_PARTITIONED: {
280
- if (typeof meta?.superPartitionKeyLength !== "number" ||
281
- typeof meta?.partitionKeyLength !== "number") {
282
- throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
283
- }
284
- const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
285
- const parts = [];
286
- // Process all super partitions
287
- for (const supKeyStr of acc.listInputFields()) {
288
- const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
289
- if (superPartition === undefined)
290
- return undefined;
291
- // Validate inner type
292
- if (superPartition.resourceType.name !== RT_JSON_PARTITIONED) {
293
- throw new Error(`Expected ${RT_JSON_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
294
- }
295
- const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
296
- if (innerResult === undefined)
297
- return undefined;
298
- if (innerResult.type !== "JsonPartitioned")
299
- throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
300
- parts.push(...innerResult.parts);
301
- }
302
- return {
303
- type: "JsonPartitioned",
304
- partitionKeyLength: totalKeyLength,
305
- parts,
306
- };
307
- }
308
- case RT_BINARY_SUPER_PARTITIONED: {
309
- if (typeof meta?.superPartitionKeyLength !== "number" ||
310
- typeof meta?.partitionKeyLength !== "number") {
311
- throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
312
- }
313
- const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
314
- const parts = [];
315
- // Process all super partitions
316
- for (const supKeyStr of acc.listInputFields()) {
317
- const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
318
- if (superPartition === undefined)
319
- return undefined;
320
- // Validate inner type
321
- if (superPartition.resourceType.name !== RT_BINARY_PARTITIONED) {
322
- throw new Error(`Expected ${RT_BINARY_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
323
- }
324
- const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
325
- if (innerResult === undefined)
326
- return undefined;
327
- if (innerResult.type !== "BinaryPartitioned")
328
- throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
329
- parts.push(...innerResult.parts);
330
- }
331
- return {
332
- type: "BinaryPartitioned",
333
- partitionKeyLength: totalKeyLength,
334
- parts,
335
- };
336
- }
337
- case RT_PARQUET_SUPER_PARTITIONED: {
338
- if (typeof meta?.superPartitionKeyLength !== "number" ||
339
- typeof meta?.partitionKeyLength !== "number") {
340
- throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
341
- }
342
- const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
343
- const parts = [];
344
- // Process all super partitions
345
- for (const supKeyStr of acc.listInputFields()) {
346
- const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
347
- if (superPartition === undefined)
348
- return undefined;
349
- // Validate inner type
350
- if (superPartition.resourceType.name !== RT_PARQUET_PARTITIONED) {
351
- throw new Error(`Expected ${RT_PARQUET_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
352
- }
353
- const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
354
- if (innerResult === undefined)
355
- return undefined;
356
- if (innerResult.type !== "ParquetPartitioned")
357
- throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
358
- parts.push(...innerResult.parts);
359
- }
360
- return {
361
- type: "ParquetPartitioned",
362
- partitionKeyLength: totalKeyLength,
363
- parts,
364
- };
365
- }
366
- default:
367
- throw new Error(`Unknown resource type: ${resourceType}`);
368
- }
167
+ if (acc === void 0) return void 0;
168
+ if (!acc.getIsReadyOrError()) return void 0;
169
+ const resourceType = acc.resourceType.name;
170
+ const meta = acc.getDataAsJson();
171
+ if (keyPrefix.length > 0 && (resourceType === RT_JSON_SUPER_PARTITIONED || resourceType === RT_BINARY_SUPER_PARTITIONED || resourceType === RT_PARQUET_SUPER_PARTITIONED)) throw new Error(`Unexpected nested super-partitioned resource: ${resourceType}`);
172
+ switch (resourceType) {
173
+ case RT_RESOURCE_MAP:
174
+ case RT_RESOURCE_MAP_PARTITIONED: throw new Error(`Only data columns are supported, got: ${resourceType}`);
175
+ case RT_JSON_PARTITIONED: {
176
+ if (typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
177
+ const parts = [];
178
+ for (const keyStr of acc.listInputFields()) {
179
+ const value = acc.resolve({
180
+ field: keyStr,
181
+ assertFieldType: "Input"
182
+ });
183
+ if (value === void 0) return void 0;
184
+ const key = [...keyPrefix, ...JSON.parse(keyStr)];
185
+ parts.push({
186
+ key,
187
+ value
188
+ });
189
+ }
190
+ return {
191
+ type: "JsonPartitioned",
192
+ partitionKeyLength: meta.partitionKeyLength,
193
+ parts
194
+ };
195
+ }
196
+ case RT_BINARY_PARTITIONED: {
197
+ if (typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
198
+ const parts = [];
199
+ const baseKeys = /* @__PURE__ */ new Map();
200
+ for (const keyStr of acc.listInputFields()) {
201
+ const suffix = removeIndexSuffix(keyStr);
202
+ const value = acc.resolve({
203
+ field: keyStr,
204
+ assertFieldType: "Input"
205
+ });
206
+ if (value === void 0) return void 0;
207
+ let entry = baseKeys.get(suffix.baseKey);
208
+ if (!entry) {
209
+ entry = {};
210
+ baseKeys.set(suffix.baseKey, entry);
211
+ }
212
+ if (suffix.type === "index") entry.index = value;
213
+ else entry.values = value;
214
+ }
215
+ for (const [baseKeyStr, entry] of baseKeys.entries()) {
216
+ if (!entry.index || !entry.values) return void 0;
217
+ const key = [...keyPrefix, ...JSON.parse(baseKeyStr)];
218
+ parts.push({
219
+ key,
220
+ value: {
221
+ index: entry.index,
222
+ values: entry.values
223
+ }
224
+ });
225
+ }
226
+ return {
227
+ type: "BinaryPartitioned",
228
+ partitionKeyLength: meta.partitionKeyLength,
229
+ parts
230
+ };
231
+ }
232
+ case RT_PARQUET_PARTITIONED: {
233
+ if (typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
234
+ const parts = [];
235
+ for (const keyStr of acc.listInputFields()) {
236
+ const value = acc.resolve({
237
+ field: keyStr,
238
+ assertFieldType: "Input"
239
+ });
240
+ if (value === void 0) return void 0;
241
+ const key = [...keyPrefix, ...JSON.parse(keyStr)];
242
+ parts.push({
243
+ key,
244
+ value
245
+ });
246
+ }
247
+ return {
248
+ type: "ParquetPartitioned",
249
+ partitionKeyLength: meta.partitionKeyLength,
250
+ parts
251
+ };
252
+ }
253
+ case RT_JSON_SUPER_PARTITIONED: {
254
+ if (typeof meta?.superPartitionKeyLength !== "number" || typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
255
+ const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
256
+ const parts = [];
257
+ for (const supKeyStr of acc.listInputFields()) {
258
+ const superPartition = acc.resolve({
259
+ field: supKeyStr,
260
+ assertFieldType: "Input"
261
+ });
262
+ if (superPartition === void 0) return void 0;
263
+ if (superPartition.resourceType.name !== RT_JSON_PARTITIONED) throw new Error(`Expected ${RT_JSON_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
264
+ const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
265
+ if (innerResult === void 0) return void 0;
266
+ if (innerResult.type !== "JsonPartitioned") throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
267
+ parts.push(...innerResult.parts);
268
+ }
269
+ return {
270
+ type: "JsonPartitioned",
271
+ partitionKeyLength: totalKeyLength,
272
+ parts
273
+ };
274
+ }
275
+ case RT_BINARY_SUPER_PARTITIONED: {
276
+ if (typeof meta?.superPartitionKeyLength !== "number" || typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
277
+ const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
278
+ const parts = [];
279
+ for (const supKeyStr of acc.listInputFields()) {
280
+ const superPartition = acc.resolve({
281
+ field: supKeyStr,
282
+ assertFieldType: "Input"
283
+ });
284
+ if (superPartition === void 0) return void 0;
285
+ if (superPartition.resourceType.name !== RT_BINARY_PARTITIONED) throw new Error(`Expected ${RT_BINARY_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
286
+ const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
287
+ if (innerResult === void 0) return void 0;
288
+ if (innerResult.type !== "BinaryPartitioned") throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
289
+ parts.push(...innerResult.parts);
290
+ }
291
+ return {
292
+ type: "BinaryPartitioned",
293
+ partitionKeyLength: totalKeyLength,
294
+ parts
295
+ };
296
+ }
297
+ case RT_PARQUET_SUPER_PARTITIONED: {
298
+ if (typeof meta?.superPartitionKeyLength !== "number" || typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
299
+ const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
300
+ const parts = [];
301
+ for (const supKeyStr of acc.listInputFields()) {
302
+ const superPartition = acc.resolve({
303
+ field: supKeyStr,
304
+ assertFieldType: "Input"
305
+ });
306
+ if (superPartition === void 0) return void 0;
307
+ if (superPartition.resourceType.name !== RT_PARQUET_PARTITIONED) throw new Error(`Expected ${RT_PARQUET_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
308
+ const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
309
+ if (innerResult === void 0) return void 0;
310
+ if (innerResult.type !== "ParquetPartitioned") throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
311
+ parts.push(...innerResult.parts);
312
+ }
313
+ return {
314
+ type: "ParquetPartitioned",
315
+ partitionKeyLength: totalKeyLength,
316
+ parts
317
+ };
318
+ }
319
+ default: throw new Error(`Unknown resource type: ${resourceType}`);
320
+ }
369
321
  }
370
322
  /**
371
- * Converts or parses the input into DataInfoEntries format.
323
+ * Converts or parses the input into DataInfoEntries format.
372
324
 
373
- * @param acc - The input data, which can be TreeNodeAccessor, DataInfoEntries, DataInfo, or undefined.
374
- * @returns The data in DataInfoEntries format, or undefined if the input was undefined or data is not ready.
375
- */
325
+ * @param acc - The input data, which can be TreeNodeAccessor, DataInfoEntries, DataInfo, or undefined.
326
+ * @returns The data in DataInfoEntries format, or undefined if the input was undefined or data is not ready.
327
+ */
376
328
  function convertOrParsePColumnData(acc) {
377
- if (acc === undefined)
378
- return undefined;
379
- if (plModelCommon.isDataInfoEntries(acc))
380
- return acc;
381
- if (plModelCommon.isDataInfo(acc))
382
- return plModelCommon.dataInfoToEntries(acc);
383
- if (acc instanceof accessor.TreeNodeAccessor)
384
- return parsePColumnData(acc);
385
- throw new Error(`Unexpected input type: ${typeof acc}`);
329
+ if (acc === void 0) return void 0;
330
+ if ((0, _milaboratories_pl_model_common.isDataInfoEntries)(acc)) return acc;
331
+ if ((0, _milaboratories_pl_model_common.isDataInfo)(acc)) return (0, _milaboratories_pl_model_common.dataInfoToEntries)(acc);
332
+ if (acc instanceof require_accessor.TreeNodeAccessor) return parsePColumnData(acc);
333
+ throw new Error(`Unexpected input type: ${typeof acc}`);
386
334
  }
387
335
  function isPColumnReady(c) {
388
- const isValues = (d) => Array.isArray(d);
389
- const isAccessor = (d) => d instanceof accessor.TreeNodeAccessor;
390
- let ready = true;
391
- const data = typeof c.data === "function" ? c.data() : c.data;
392
- if (data == null) {
393
- return false;
394
- }
395
- else if (isAccessor(data)) {
396
- ready &&= data.getIsReadyOrError();
397
- }
398
- else if (plModelCommon.isDataInfo(data)) {
399
- plModelCommon.visitDataInfo(data, (v) => (ready &&= v.getIsReadyOrError()));
400
- }
401
- else if (!isValues(data)) {
402
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
403
- throw Error(`unsupported column data type: ${data}`);
404
- }
405
- return ready;
336
+ const isValues = (d) => Array.isArray(d);
337
+ const isAccessor = (d) => d instanceof require_accessor.TreeNodeAccessor;
338
+ let ready = true;
339
+ const data = typeof c.data === "function" ? c.data() : c.data;
340
+ if (data == null) return false;
341
+ else if (isAccessor(data)) ready &&= data.getIsReadyOrError();
342
+ else if ((0, _milaboratories_pl_model_common.isDataInfo)(data)) (0, _milaboratories_pl_model_common.visitDataInfo)(data, (v) => ready &&= v.getIsReadyOrError());
343
+ else if (!isValues(data)) throw Error(`unsupported column data type: ${data}`);
344
+ return ready;
406
345
  }
407
346
  function allPColumnsReady(columns) {
408
- return columns.every(isPColumnReady);
347
+ return columns.every(isPColumnReady);
409
348
  }
410
349
 
350
+ //#endregion
411
351
  exports.RT_BINARY_PARTITIONED = RT_BINARY_PARTITIONED;
412
352
  exports.RT_BINARY_SUPER_PARTITIONED = RT_BINARY_SUPER_PARTITIONED;
413
353
  exports.RT_JSON_PARTITIONED = RT_JSON_PARTITIONED;
@@ -423,4 +363,4 @@ exports.getUniquePartitionKeys = getUniquePartitionKeys;
423
363
  exports.isPColumnReady = isPColumnReady;
424
364
  exports.parsePColumnData = parsePColumnData;
425
365
  exports.parseResourceMap = parseResourceMap;
426
- //# sourceMappingURL=pcolumn_data.cjs.map
366
+ //# sourceMappingURL=pcolumn_data.cjs.map