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