@platforma-sdk/model 1.58.5 → 1.58.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +43 -0
  2. package/dist/_virtual/_rolldown/runtime.js +18 -0
  3. package/dist/annotations/converter.cjs +15 -20
  4. package/dist/annotations/converter.cjs.map +1 -1
  5. package/dist/annotations/converter.d.ts +6 -2
  6. package/dist/annotations/converter.js +14 -18
  7. package/dist/annotations/converter.js.map +1 -1
  8. package/dist/annotations/index.cjs +1 -0
  9. package/dist/annotations/index.d.ts +2 -3
  10. package/dist/annotations/index.js +1 -0
  11. package/dist/annotations/types.d.ts +21 -16
  12. package/dist/bconfig/index.cjs +2 -0
  13. package/dist/bconfig/index.d.ts +5 -6
  14. package/dist/bconfig/index.js +2 -0
  15. package/dist/bconfig/lambdas.d.ts +52 -52
  16. package/dist/bconfig/normalization.cjs +13 -18
  17. package/dist/bconfig/normalization.cjs.map +1 -1
  18. package/dist/bconfig/normalization.d.ts +10 -6
  19. package/dist/bconfig/normalization.js +12 -16
  20. package/dist/bconfig/normalization.js.map +1 -1
  21. package/dist/bconfig/types.cjs +4 -3
  22. package/dist/bconfig/types.cjs.map +1 -1
  23. package/dist/bconfig/types.d.ts +10 -5
  24. package/dist/bconfig/types.js +4 -2
  25. package/dist/bconfig/types.js.map +1 -1
  26. package/dist/bconfig/util.d.ts +7 -4
  27. package/dist/bconfig/v3.d.ts +10 -6
  28. package/dist/block_api_v1.d.ts +62 -58
  29. package/dist/block_api_v2.d.ts +51 -47
  30. package/dist/block_api_v3.d.ts +33 -29
  31. package/dist/block_migrations.cjs +481 -413
  32. package/dist/block_migrations.cjs.map +1 -1
  33. package/dist/block_migrations.d.ts +258 -204
  34. package/dist/block_migrations.js +482 -408
  35. package/dist/block_migrations.js.map +1 -1
  36. package/dist/block_model.cjs +312 -343
  37. package/dist/block_model.cjs.map +1 -1
  38. package/dist/block_model.d.ts +143 -147
  39. package/dist/block_model.js +312 -341
  40. package/dist/block_model.js.map +1 -1
  41. package/dist/block_model_legacy.cjs +231 -255
  42. package/dist/block_model_legacy.cjs.map +1 -1
  43. package/dist/block_model_legacy.d.ts +108 -106
  44. package/dist/block_model_legacy.js +231 -253
  45. package/dist/block_model_legacy.js.map +1 -1
  46. package/dist/block_state_patch.d.ts +10 -10
  47. package/dist/block_state_util.cjs +15 -19
  48. package/dist/block_state_util.cjs.map +1 -1
  49. package/dist/block_state_util.d.ts +14 -13
  50. package/dist/block_state_util.js +15 -18
  51. package/dist/block_state_util.js.map +1 -1
  52. package/dist/block_storage.cjs +233 -238
  53. package/dist/block_storage.cjs.map +1 -1
  54. package/dist/block_storage.d.ts +62 -78
  55. package/dist/block_storage.js +234 -237
  56. package/dist/block_storage.js.map +1 -1
  57. package/dist/block_storage_callbacks.cjs +156 -195
  58. package/dist/block_storage_callbacks.cjs.map +1 -1
  59. package/dist/block_storage_callbacks.js +156 -192
  60. package/dist/block_storage_callbacks.js.map +1 -1
  61. package/dist/block_storage_facade.cjs +29 -85
  62. package/dist/block_storage_facade.cjs.map +1 -1
  63. package/dist/block_storage_facade.d.ts +83 -126
  64. package/dist/block_storage_facade.js +29 -83
  65. package/dist/block_storage_facade.js.map +1 -1
  66. package/dist/components/PFrameForGraphs.cjs +26 -24
  67. package/dist/components/PFrameForGraphs.cjs.map +1 -1
  68. package/dist/components/PFrameForGraphs.d.ts +12 -7
  69. package/dist/components/PFrameForGraphs.js +25 -22
  70. package/dist/components/PFrameForGraphs.js.map +1 -1
  71. package/dist/components/PlAnnotations/filter.d.ts +62 -79
  72. package/dist/components/PlAnnotations/filters_ui.cjs +135 -171
  73. package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
  74. package/dist/components/PlAnnotations/filters_ui.d.ts +48 -46
  75. package/dist/components/PlAnnotations/filters_ui.js +135 -170
  76. package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
  77. package/dist/components/PlAnnotations/index.d.ts +2 -3
  78. package/dist/components/PlDataTable/index.cjs +2 -0
  79. package/dist/components/PlDataTable/index.d.ts +3 -5
  80. package/dist/components/PlDataTable/index.js +2 -0
  81. package/dist/components/PlDataTable/labels.cjs +59 -81
  82. package/dist/components/PlDataTable/labels.cjs.map +1 -1
  83. package/dist/components/PlDataTable/labels.js +58 -79
  84. package/dist/components/PlDataTable/labels.js.map +1 -1
  85. package/dist/components/PlDataTable/state-migration.cjs +186 -144
  86. package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
  87. package/dist/components/PlDataTable/state-migration.d.ts +85 -82
  88. package/dist/components/PlDataTable/state-migration.js +185 -142
  89. package/dist/components/PlDataTable/state-migration.js.map +1 -1
  90. package/dist/components/PlDataTable/table.cjs +172 -194
  91. package/dist/components/PlDataTable/table.cjs.map +1 -1
  92. package/dist/components/PlDataTable/table.d.ts +16 -12
  93. package/dist/components/PlDataTable/table.js +171 -192
  94. package/dist/components/PlDataTable/table.js.map +1 -1
  95. package/dist/components/PlDataTable/v4.d.ts +84 -119
  96. package/dist/components/PlDataTable/v5.d.ts +80 -103
  97. package/dist/components/PlMultiSequenceAlignment.cjs +27 -29
  98. package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
  99. package/dist/components/PlMultiSequenceAlignment.d.ts +36 -27
  100. package/dist/components/PlMultiSequenceAlignment.js +26 -27
  101. package/dist/components/PlMultiSequenceAlignment.js.map +1 -1
  102. package/dist/components/PlSelectionModel.cjs +7 -6
  103. package/dist/components/PlSelectionModel.cjs.map +1 -1
  104. package/dist/components/PlSelectionModel.d.ts +10 -8
  105. package/dist/components/PlSelectionModel.js +7 -5
  106. package/dist/components/PlSelectionModel.js.map +1 -1
  107. package/dist/components/index.cjs +8 -0
  108. package/dist/components/index.d.ts +11 -6
  109. package/dist/components/index.js +8 -0
  110. package/dist/config/actions.cjs +138 -171
  111. package/dist/config/actions.cjs.map +1 -1
  112. package/dist/config/actions.d.ts +47 -47
  113. package/dist/config/actions.js +146 -178
  114. package/dist/config/actions.js.map +1 -1
  115. package/dist/config/actions_kinds.d.ts +114 -121
  116. package/dist/config/index.cjs +1 -0
  117. package/dist/config/index.d.ts +6 -7
  118. package/dist/config/index.js +1 -0
  119. package/dist/config/model.d.ts +131 -127
  120. package/dist/config/model_meta.d.ts +4 -1
  121. package/dist/config/type_engine.d.ts +22 -21
  122. package/dist/config/type_util.d.ts +12 -10
  123. package/dist/env_value.cjs +5 -6
  124. package/dist/env_value.cjs.map +1 -1
  125. package/dist/env_value.d.ts +4 -1
  126. package/dist/env_value.js +5 -5
  127. package/dist/env_value.js.map +1 -1
  128. package/dist/filters/converters/filterToQuery.cjs +273 -239
  129. package/dist/filters/converters/filterToQuery.cjs.map +1 -1
  130. package/dist/filters/converters/filterToQuery.d.ts +6 -2
  131. package/dist/filters/converters/filterToQuery.js +272 -237
  132. package/dist/filters/converters/filterToQuery.js.map +1 -1
  133. package/dist/filters/converters/filterUiToExpressionImpl.cjs +56 -85
  134. package/dist/filters/converters/filterUiToExpressionImpl.cjs.map +1 -1
  135. package/dist/filters/converters/filterUiToExpressionImpl.d.ts +8 -4
  136. package/dist/filters/converters/filterUiToExpressionImpl.js +55 -83
  137. package/dist/filters/converters/filterUiToExpressionImpl.js.map +1 -1
  138. package/dist/filters/converters/index.cjs +2 -0
  139. package/dist/filters/converters/index.d.ts +2 -3
  140. package/dist/filters/converters/index.js +2 -0
  141. package/dist/filters/distill.cjs +59 -60
  142. package/dist/filters/distill.cjs.map +1 -1
  143. package/dist/filters/distill.d.ts +6 -3
  144. package/dist/filters/distill.js +58 -58
  145. package/dist/filters/distill.js.map +1 -1
  146. package/dist/filters/index.cjs +4 -0
  147. package/dist/filters/index.d.ts +5 -4
  148. package/dist/filters/index.js +4 -0
  149. package/dist/filters/traverse.cjs +31 -40
  150. package/dist/filters/traverse.cjs.map +1 -1
  151. package/dist/filters/traverse.js +31 -39
  152. package/dist/filters/traverse.js.map +1 -1
  153. package/dist/filters/types.d.ts +10 -7
  154. package/dist/index.cjs +193 -187
  155. package/dist/index.d.ts +61 -28
  156. package/dist/index.js +49 -41
  157. package/dist/internal.cjs +48 -62
  158. package/dist/internal.cjs.map +1 -1
  159. package/dist/internal.js +49 -60
  160. package/dist/internal.js.map +1 -1
  161. package/dist/package.cjs +12 -0
  162. package/dist/package.cjs.map +1 -0
  163. package/dist/package.js +6 -0
  164. package/dist/package.js.map +1 -0
  165. package/dist/pframe.cjs +32 -37
  166. package/dist/pframe.cjs.map +1 -1
  167. package/dist/pframe.d.ts +14 -10
  168. package/dist/pframe.js +32 -35
  169. package/dist/pframe.js.map +1 -1
  170. package/dist/pframe_utils/axes.cjs +81 -114
  171. package/dist/pframe_utils/axes.cjs.map +1 -1
  172. package/dist/pframe_utils/axes.d.ts +10 -13
  173. package/dist/pframe_utils/axes.js +80 -112
  174. package/dist/pframe_utils/axes.js.map +1 -1
  175. package/dist/pframe_utils/columns.cjs +61 -81
  176. package/dist/pframe_utils/columns.cjs.map +1 -1
  177. package/dist/pframe_utils/columns.d.ts +15 -6
  178. package/dist/pframe_utils/columns.js +60 -79
  179. package/dist/pframe_utils/columns.js.map +1 -1
  180. package/dist/pframe_utils/index.cjs +232 -253
  181. package/dist/pframe_utils/index.cjs.map +1 -1
  182. package/dist/pframe_utils/index.d.ts +39 -35
  183. package/dist/pframe_utils/index.js +231 -251
  184. package/dist/pframe_utils/index.js.map +1 -1
  185. package/dist/platforma.d.ts +48 -46
  186. package/dist/plugin_handle.cjs +6 -14
  187. package/dist/plugin_handle.cjs.map +1 -1
  188. package/dist/plugin_handle.d.ts +20 -25
  189. package/dist/plugin_handle.js +6 -13
  190. package/dist/plugin_handle.js.map +1 -1
  191. package/dist/plugin_model.cjs +364 -163
  192. package/dist/plugin_model.cjs.map +1 -1
  193. package/dist/plugin_model.d.ts +280 -129
  194. package/dist/plugin_model.js +362 -163
  195. package/dist/plugin_model.js.map +1 -1
  196. package/dist/raw_globals.cjs +10 -22
  197. package/dist/raw_globals.cjs.map +1 -1
  198. package/dist/raw_globals.d.ts +8 -5
  199. package/dist/raw_globals.js +10 -20
  200. package/dist/raw_globals.js.map +1 -1
  201. package/dist/ref_util.cjs +14 -13
  202. package/dist/ref_util.cjs.map +1 -1
  203. package/dist/ref_util.d.ts +18 -12
  204. package/dist/ref_util.js +14 -11
  205. package/dist/ref_util.js.map +1 -1
  206. package/dist/render/accessor.cjs +213 -226
  207. package/dist/render/accessor.cjs.map +1 -1
  208. package/dist/render/accessor.d.ts +115 -120
  209. package/dist/render/accessor.js +212 -224
  210. package/dist/render/accessor.js.map +1 -1
  211. package/dist/render/api.cjs +478 -580
  212. package/dist/render/api.cjs.map +1 -1
  213. package/dist/render/api.d.ts +207 -209
  214. package/dist/render/api.js +476 -578
  215. package/dist/render/api.js.map +1 -1
  216. package/dist/render/future.cjs +28 -32
  217. package/dist/render/future.cjs.map +1 -1
  218. package/dist/render/future.d.ts +15 -11
  219. package/dist/render/future.js +28 -30
  220. package/dist/render/future.js.map +1 -1
  221. package/dist/render/index.cjs +8 -0
  222. package/dist/render/index.d.ts +10 -8
  223. package/dist/render/index.js +8 -0
  224. package/dist/render/internal.cjs +33 -29
  225. package/dist/render/internal.cjs.map +1 -1
  226. package/dist/render/internal.d.ts +78 -72
  227. package/dist/render/internal.js +29 -26
  228. package/dist/render/internal.js.map +1 -1
  229. package/dist/render/traversal_ops.d.ts +42 -43
  230. package/dist/render/util/axis_filtering.cjs +63 -86
  231. package/dist/render/util/axis_filtering.cjs.map +1 -1
  232. package/dist/render/util/axis_filtering.d.ts +10 -7
  233. package/dist/render/util/axis_filtering.js +63 -85
  234. package/dist/render/util/axis_filtering.js.map +1 -1
  235. package/dist/render/util/column_collection.cjs +266 -321
  236. package/dist/render/util/column_collection.cjs.map +1 -1
  237. package/dist/render/util/column_collection.d.ts +47 -47
  238. package/dist/render/util/column_collection.js +264 -319
  239. package/dist/render/util/column_collection.js.map +1 -1
  240. package/dist/render/util/index.cjs +4 -0
  241. package/dist/render/util/index.d.ts +4 -5
  242. package/dist/render/util/index.js +4 -0
  243. package/dist/render/util/label.cjs +129 -163
  244. package/dist/render/util/label.cjs.map +1 -1
  245. package/dist/render/util/label.d.ts +45 -46
  246. package/dist/render/util/label.js +128 -161
  247. package/dist/render/util/label.js.map +1 -1
  248. package/dist/render/util/pcolumn_data.cjs +315 -375
  249. package/dist/render/util/pcolumn_data.cjs.map +1 -1
  250. package/dist/render/util/pcolumn_data.d.ts +33 -32
  251. package/dist/render/util/pcolumn_data.js +314 -373
  252. package/dist/render/util/pcolumn_data.js.map +1 -1
  253. package/dist/render/util/pframe_upgraders.cjs +37 -42
  254. package/dist/render/util/pframe_upgraders.cjs.map +1 -1
  255. package/dist/render/util/pframe_upgraders.js +37 -41
  256. package/dist/render/util/pframe_upgraders.js.map +1 -1
  257. package/dist/render/util/split_selectors.d.ts +13 -9
  258. package/dist/version.cjs +6 -8
  259. package/dist/version.cjs.map +1 -1
  260. package/dist/version.d.ts +7 -4
  261. package/dist/version.js +5 -5
  262. package/dist/version.js.map +1 -1
  263. package/package.json +10 -4
  264. package/src/block_migrations.test.ts +184 -14
  265. package/src/block_migrations.ts +185 -30
  266. package/src/block_model.ts +111 -66
  267. package/src/block_storage.test.ts +147 -3
  268. package/src/block_storage.ts +43 -8
  269. package/src/block_storage_callbacks.ts +9 -4
  270. package/src/env_value.ts +0 -2
  271. package/src/index.ts +12 -11
  272. package/src/internal.ts +0 -1
  273. package/src/platforma.ts +4 -4
  274. package/src/plugin_handle.ts +1 -1
  275. package/src/plugin_model.test.ts +217 -21
  276. package/src/plugin_model.ts +450 -55
  277. package/src/raw_globals.ts +0 -1
  278. package/dist/annotations/converter.d.ts.map +0 -1
  279. package/dist/annotations/index.d.ts.map +0 -1
  280. package/dist/annotations/types.d.ts.map +0 -1
  281. package/dist/bconfig/index.d.ts.map +0 -1
  282. package/dist/bconfig/lambdas.d.ts.map +0 -1
  283. package/dist/bconfig/normalization.d.ts.map +0 -1
  284. package/dist/bconfig/types.d.ts.map +0 -1
  285. package/dist/bconfig/util.d.ts.map +0 -1
  286. package/dist/bconfig/v3.d.ts.map +0 -1
  287. package/dist/block_api_v1.d.ts.map +0 -1
  288. package/dist/block_api_v2.d.ts.map +0 -1
  289. package/dist/block_api_v3.d.ts.map +0 -1
  290. package/dist/block_migrations.d.ts.map +0 -1
  291. package/dist/block_model.d.ts.map +0 -1
  292. package/dist/block_model_legacy.d.ts.map +0 -1
  293. package/dist/block_state_patch.d.ts.map +0 -1
  294. package/dist/block_state_util.d.ts.map +0 -1
  295. package/dist/block_storage.d.ts.map +0 -1
  296. package/dist/block_storage_callbacks.d.ts +0 -115
  297. package/dist/block_storage_callbacks.d.ts.map +0 -1
  298. package/dist/block_storage_facade.d.ts.map +0 -1
  299. package/dist/components/PFrameForGraphs.d.ts.map +0 -1
  300. package/dist/components/PlAnnotations/filter.d.ts.map +0 -1
  301. package/dist/components/PlAnnotations/filters_ui.d.ts.map +0 -1
  302. package/dist/components/PlAnnotations/index.d.ts.map +0 -1
  303. package/dist/components/PlAnnotations/types.d.ts +0 -3
  304. package/dist/components/PlAnnotations/types.d.ts.map +0 -1
  305. package/dist/components/PlDataTable/index.d.ts.map +0 -1
  306. package/dist/components/PlDataTable/labels.d.ts +0 -7
  307. package/dist/components/PlDataTable/labels.d.ts.map +0 -1
  308. package/dist/components/PlDataTable/state-migration.d.ts.map +0 -1
  309. package/dist/components/PlDataTable/table.d.ts.map +0 -1
  310. package/dist/components/PlDataTable/v4.d.ts.map +0 -1
  311. package/dist/components/PlDataTable/v5.d.ts.map +0 -1
  312. package/dist/components/PlMultiSequenceAlignment.d.ts.map +0 -1
  313. package/dist/components/PlSelectionModel.d.ts.map +0 -1
  314. package/dist/components/index.d.ts.map +0 -1
  315. package/dist/config/actions.d.ts.map +0 -1
  316. package/dist/config/actions_kinds.d.ts.map +0 -1
  317. package/dist/config/index.d.ts.map +0 -1
  318. package/dist/config/model.d.ts.map +0 -1
  319. package/dist/config/model_meta.d.ts.map +0 -1
  320. package/dist/config/type_engine.d.ts.map +0 -1
  321. package/dist/config/type_util.d.ts.map +0 -1
  322. package/dist/env_value.d.ts.map +0 -1
  323. package/dist/filters/converters/filterToQuery.d.ts.map +0 -1
  324. package/dist/filters/converters/filterUiToExpressionImpl.d.ts.map +0 -1
  325. package/dist/filters/converters/index.d.ts.map +0 -1
  326. package/dist/filters/distill.d.ts.map +0 -1
  327. package/dist/filters/index.d.ts.map +0 -1
  328. package/dist/filters/traverse.d.ts +0 -27
  329. package/dist/filters/traverse.d.ts.map +0 -1
  330. package/dist/filters/types.d.ts.map +0 -1
  331. package/dist/index.cjs.map +0 -1
  332. package/dist/index.d.ts.map +0 -1
  333. package/dist/index.js.map +0 -1
  334. package/dist/internal.d.ts +0 -36
  335. package/dist/internal.d.ts.map +0 -1
  336. package/dist/package.json.cjs +0 -6
  337. package/dist/package.json.cjs.map +0 -1
  338. package/dist/package.json.js +0 -4
  339. package/dist/package.json.js.map +0 -1
  340. package/dist/pframe.d.ts.map +0 -1
  341. package/dist/pframe_utils/axes.d.ts.map +0 -1
  342. package/dist/pframe_utils/columns.d.ts.map +0 -1
  343. package/dist/pframe_utils/index.d.ts.map +0 -1
  344. package/dist/pframe_utils/querySpec.d.ts +0 -2
  345. package/dist/pframe_utils/querySpec.d.ts.map +0 -1
  346. package/dist/platforma.d.ts.map +0 -1
  347. package/dist/plugin_handle.d.ts.map +0 -1
  348. package/dist/plugin_model.d.ts.map +0 -1
  349. package/dist/raw_globals.d.ts.map +0 -1
  350. package/dist/ref_util.d.ts.map +0 -1
  351. package/dist/render/accessor.d.ts.map +0 -1
  352. package/dist/render/api.d.ts.map +0 -1
  353. package/dist/render/future.d.ts.map +0 -1
  354. package/dist/render/index.d.ts.map +0 -1
  355. package/dist/render/internal.d.ts.map +0 -1
  356. package/dist/render/traversal_ops.d.ts.map +0 -1
  357. package/dist/render/util/axis_filtering.d.ts.map +0 -1
  358. package/dist/render/util/column_collection.d.ts.map +0 -1
  359. package/dist/render/util/index.d.ts.map +0 -1
  360. package/dist/render/util/label.d.ts.map +0 -1
  361. package/dist/render/util/pcolumn_data.d.ts.map +0 -1
  362. package/dist/render/util/pframe_upgraders.d.ts +0 -3
  363. package/dist/render/util/pframe_upgraders.d.ts.map +0 -1
  364. package/dist/render/util/split_selectors.d.ts.map +0 -1
  365. package/dist/version.d.ts.map +0 -1
@@ -1,233 +1,220 @@
1
- 'use strict';
2
-
3
- var plModelCommon = require('@milaboratories/pl-model-common');
4
- var internal = require('../internal.cjs');
5
- var future = require('./future.cjs');
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_internal = require('../internal.cjs');
3
+ const require_future = require('./future.cjs');
4
+ let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
6
5
 
6
+ //#region src/render/accessor.ts
7
7
  function ifDef(value, cb) {
8
- return value === undefined ? undefined : cb(value);
8
+ return value === void 0 ? void 0 : cb(value);
9
9
  }
10
10
  /** Represent resource tree node accessor */
11
- class TreeNodeAccessor {
12
- handle;
13
- resolvePath;
14
- constructor(handle, resolvePath) {
15
- this.handle = handle;
16
- this.resolvePath = resolvePath;
17
- }
18
- resolve(...steps) {
19
- const transformedSteps = steps.map((s) => ({
20
- assertFieldType: "Input",
21
- ...(typeof s === "string" ? { field: s } : s),
22
- }));
23
- return this.resolveWithCommon({}, ...transformedSteps);
24
- }
25
- resolveOutput(...steps) {
26
- const transformedSteps = steps.map((s) => ({
27
- assertFieldType: "Output",
28
- ...(typeof s === "string" ? { field: s } : s),
29
- }));
30
- return this.resolveWithCommon({}, ...transformedSteps);
31
- }
32
- resolveInput(...steps) {
33
- const transformedSteps = steps.map((s) => ({
34
- assertFieldType: "Input",
35
- ...(typeof s === "string" ? { field: s } : s),
36
- }));
37
- return this.resolveWithCommon({}, ...transformedSteps);
38
- }
39
- resolveAny(...steps) {
40
- return this.resolveWithCommon({}, ...steps);
41
- }
42
- resolveWithCommon(commonOptions, ...steps) {
43
- const resolvePath = [
44
- ...this.resolvePath,
45
- ...steps.map((step) => (typeof step === "string" ? step : step.field)),
46
- ];
47
- return ifDef(internal.getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps), (accessor) => new TreeNodeAccessor(accessor, resolvePath));
48
- }
49
- get resourceType() {
50
- return internal.getCfgRenderCtx().getResourceType(this.handle);
51
- }
52
- getInputsLocked() {
53
- return internal.getCfgRenderCtx().getInputsLocked(this.handle);
54
- }
55
- getOutputsLocked() {
56
- return internal.getCfgRenderCtx().getOutputsLocked(this.handle);
57
- }
58
- getIsReadyOrError() {
59
- return internal.getCfgRenderCtx().getIsReadyOrError(this.handle);
60
- }
61
- getIsFinal() {
62
- return internal.getCfgRenderCtx().getIsFinal(this.handle);
63
- }
64
- getError() {
65
- const resolvePath = [...this.resolvePath, "error"];
66
- return ifDef(internal.getCfgRenderCtx().getError(this.handle), (accsessor) => new TreeNodeAccessor(accsessor, resolvePath));
67
- }
68
- listInputFields() {
69
- return internal.getCfgRenderCtx().listInputFields(this.handle);
70
- }
71
- listOutputFields() {
72
- return internal.getCfgRenderCtx().listOutputFields(this.handle);
73
- }
74
- listDynamicFields() {
75
- return internal.getCfgRenderCtx().listDynamicFields(this.handle);
76
- }
77
- getKeyValueBase64(key) {
78
- return internal.getCfgRenderCtx().getKeyValueBase64(this.handle, key);
79
- }
80
- getKeyValueAsString(key) {
81
- return internal.getCfgRenderCtx().getKeyValueAsString(this.handle, key);
82
- }
83
- getKeyValueAsJson(key) {
84
- const content = this.getKeyValueAsString(key);
85
- if (content == undefined)
86
- throw new Error("Resource has no content.");
87
- return JSON.parse(content);
88
- }
89
- getDataBase64() {
90
- return internal.getCfgRenderCtx().getDataBase64(this.handle);
91
- }
92
- getDataAsString() {
93
- return internal.getCfgRenderCtx().getDataAsString(this.handle);
94
- }
95
- getDataAsJson() {
96
- const content = this.getDataAsString();
97
- if (content == undefined)
98
- throw new Error("Resource has no content.");
99
- return JSON.parse(content);
100
- }
101
- /**
102
- *
103
- */
104
- getPColumns(errorOnUnknownField = false, prefix = "") {
105
- const result = this.parsePObjectCollection(errorOnUnknownField, prefix);
106
- if (result === undefined)
107
- return undefined;
108
- const pf = Object.entries(result).map(([, obj]) => {
109
- if (!plModelCommon.isPColumn(obj))
110
- throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
111
- return obj;
112
- });
113
- return pf;
114
- }
115
- /**
116
- *
117
- */
118
- parsePObjectCollection(errorOnUnknownField = false, prefix = "") {
119
- const pObjects = internal.getCfgRenderCtx().parsePObjectCollection(this.handle, errorOnUnknownField, prefix, ...this.resolvePath);
120
- if (pObjects === undefined)
121
- return undefined;
122
- const result = {};
123
- for (const [key, value] of Object.entries(pObjects)) {
124
- const resolvePath = [...this.resolvePath, key];
125
- result[key] = plModelCommon.mapPObjectData(value, (c) => new TreeNodeAccessor(c, resolvePath));
126
- }
127
- return result;
128
- }
129
- getFileContentAsBase64(range) {
130
- return new future.FutureRef(internal.getCfgRenderCtx().getBlobContentAsBase64(this.handle, range));
131
- }
132
- getFileContentAsString(range) {
133
- return new future.FutureRef(internal.getCfgRenderCtx().getBlobContentAsString(this.handle, range));
134
- }
135
- getFileContentAsJson(range) {
136
- return new future.FutureRef(internal.getCfgRenderCtx().getBlobContentAsString(this.handle, range)).mapDefined((v) => JSON.parse(v));
137
- }
138
- /**
139
- * @deprecated use getFileContentAsBase64
140
- */
141
- getBlobContentAsBase64() {
142
- return this.getFileContentAsBase64();
143
- }
144
- /**
145
- * @deprecated use getFileContentAsString
146
- */
147
- getBlobContentAsString() {
148
- return this.getFileContentAsString();
149
- }
150
- /**
151
- * @returns downloaded file handle
152
- */
153
- getFileHandle() {
154
- return new future.FutureRef(internal.getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));
155
- }
156
- /**
157
- * @deprecated use getFileHandle
158
- */
159
- getDownloadedBlobHandle() {
160
- return this.getFileHandle();
161
- }
162
- /**
163
- * @returns downloaded file handle
164
- */
165
- getRemoteFileHandle() {
166
- return new future.FutureRef(internal.getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));
167
- }
168
- /**
169
- * @deprecated use getRemoteFileHandle
170
- */
171
- getOnDemandBlobHandle() {
172
- return this.getRemoteFileHandle();
173
- }
174
- /**
175
- * @returns the url to the extracted folder
176
- */
177
- extractArchiveAndGetURL(format) {
178
- return new future.FutureRef(internal.getCfgRenderCtx().extractArchiveAndGetURL(this.handle, format));
179
- }
180
- getImportProgress() {
181
- return new future.FutureRef(internal.getCfgRenderCtx().getImportProgress(this.handle));
182
- }
183
- getLastLogs(nLines) {
184
- return new future.FutureRef(internal.getCfgRenderCtx().getLastLogs(this.handle, nLines));
185
- }
186
- getProgressLog(patternToSearch) {
187
- return new future.FutureRef(internal.getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));
188
- }
189
- getProgressLogWithInfo(patternToSearch) {
190
- return new future.FutureRef(internal.getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));
191
- }
192
- getLogHandle() {
193
- return new future.FutureRef(internal.getCfgRenderCtx().getLogHandle(this.handle));
194
- }
195
- allFieldsResolved(fieldType = "Input") {
196
- switch (fieldType) {
197
- case "Input":
198
- return (this.getInputsLocked() &&
199
- this.listInputFields().every((field) => this.resolve({ field, assertFieldType: "Input" }) !== undefined));
200
- case "Output":
201
- return (this.getOutputsLocked() &&
202
- this.listOutputFields().every((field) => this.resolve({ field, assertFieldType: "Output" }) !== undefined));
203
- }
204
- }
205
- mapFields(_mapping, _ops) {
206
- const { fieldType, requireLocked, skipUnresolved } = {
207
- fieldType: "Input",
208
- requireLocked: true,
209
- skipUnresolved: false,
210
- ..._ops,
211
- };
212
- const mapping = _mapping;
213
- if (requireLocked) {
214
- if (fieldType === "Input" && !this.getInputsLocked())
215
- return undefined;
216
- if (fieldType === "Output" && !this.getOutputsLocked())
217
- return undefined;
218
- }
219
- const fieldList = fieldType === "Input"
220
- ? this.listInputFields()
221
- : fieldType === "Output"
222
- ? this.listOutputFields()
223
- : this.listDynamicFields();
224
- let fieldEntries = fieldList.map((field) => [field, this.resolve({ field, assertFieldType: fieldType })]);
225
- if (skipUnresolved)
226
- fieldEntries = fieldEntries.filter((e) => e[1] !== undefined);
227
- return fieldEntries.map(([name, value]) => mapping(name, value));
228
- }
229
- }
11
+ var TreeNodeAccessor = class TreeNodeAccessor {
12
+ constructor(handle, resolvePath) {
13
+ this.handle = handle;
14
+ this.resolvePath = resolvePath;
15
+ }
16
+ resolve(...steps) {
17
+ const transformedSteps = steps.map((s) => ({
18
+ assertFieldType: "Input",
19
+ ...typeof s === "string" ? { field: s } : s
20
+ }));
21
+ return this.resolveWithCommon({}, ...transformedSteps);
22
+ }
23
+ resolveOutput(...steps) {
24
+ const transformedSteps = steps.map((s) => ({
25
+ assertFieldType: "Output",
26
+ ...typeof s === "string" ? { field: s } : s
27
+ }));
28
+ return this.resolveWithCommon({}, ...transformedSteps);
29
+ }
30
+ resolveInput(...steps) {
31
+ const transformedSteps = steps.map((s) => ({
32
+ assertFieldType: "Input",
33
+ ...typeof s === "string" ? { field: s } : s
34
+ }));
35
+ return this.resolveWithCommon({}, ...transformedSteps);
36
+ }
37
+ resolveAny(...steps) {
38
+ return this.resolveWithCommon({}, ...steps);
39
+ }
40
+ resolveWithCommon(commonOptions, ...steps) {
41
+ const resolvePath = [...this.resolvePath, ...steps.map((step) => typeof step === "string" ? step : step.field)];
42
+ return ifDef(require_internal.getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps), (accessor) => new TreeNodeAccessor(accessor, resolvePath));
43
+ }
44
+ get resourceType() {
45
+ return require_internal.getCfgRenderCtx().getResourceType(this.handle);
46
+ }
47
+ getInputsLocked() {
48
+ return require_internal.getCfgRenderCtx().getInputsLocked(this.handle);
49
+ }
50
+ getOutputsLocked() {
51
+ return require_internal.getCfgRenderCtx().getOutputsLocked(this.handle);
52
+ }
53
+ getIsReadyOrError() {
54
+ return require_internal.getCfgRenderCtx().getIsReadyOrError(this.handle);
55
+ }
56
+ getIsFinal() {
57
+ return require_internal.getCfgRenderCtx().getIsFinal(this.handle);
58
+ }
59
+ getError() {
60
+ const resolvePath = [...this.resolvePath, "error"];
61
+ return ifDef(require_internal.getCfgRenderCtx().getError(this.handle), (accsessor) => new TreeNodeAccessor(accsessor, resolvePath));
62
+ }
63
+ listInputFields() {
64
+ return require_internal.getCfgRenderCtx().listInputFields(this.handle);
65
+ }
66
+ listOutputFields() {
67
+ return require_internal.getCfgRenderCtx().listOutputFields(this.handle);
68
+ }
69
+ listDynamicFields() {
70
+ return require_internal.getCfgRenderCtx().listDynamicFields(this.handle);
71
+ }
72
+ getKeyValueBase64(key) {
73
+ return require_internal.getCfgRenderCtx().getKeyValueBase64(this.handle, key);
74
+ }
75
+ getKeyValueAsString(key) {
76
+ return require_internal.getCfgRenderCtx().getKeyValueAsString(this.handle, key);
77
+ }
78
+ getKeyValueAsJson(key) {
79
+ const content = this.getKeyValueAsString(key);
80
+ if (content == void 0) throw new Error("Resource has no content.");
81
+ return JSON.parse(content);
82
+ }
83
+ getDataBase64() {
84
+ return require_internal.getCfgRenderCtx().getDataBase64(this.handle);
85
+ }
86
+ getDataAsString() {
87
+ return require_internal.getCfgRenderCtx().getDataAsString(this.handle);
88
+ }
89
+ getDataAsJson() {
90
+ const content = this.getDataAsString();
91
+ if (content == void 0) throw new Error("Resource has no content.");
92
+ return JSON.parse(content);
93
+ }
94
+ /**
95
+ *
96
+ */
97
+ getPColumns(errorOnUnknownField = false, prefix = "") {
98
+ const result = this.parsePObjectCollection(errorOnUnknownField, prefix);
99
+ if (result === void 0) return void 0;
100
+ return Object.entries(result).map(([, obj]) => {
101
+ if (!(0, _milaboratories_pl_model_common.isPColumn)(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
102
+ return obj;
103
+ });
104
+ }
105
+ /**
106
+ *
107
+ */
108
+ parsePObjectCollection(errorOnUnknownField = false, prefix = "") {
109
+ const pObjects = require_internal.getCfgRenderCtx().parsePObjectCollection(this.handle, errorOnUnknownField, prefix, ...this.resolvePath);
110
+ if (pObjects === void 0) return void 0;
111
+ const result = {};
112
+ for (const [key, value] of Object.entries(pObjects)) {
113
+ const resolvePath = [...this.resolvePath, key];
114
+ result[key] = (0, _milaboratories_pl_model_common.mapPObjectData)(value, (c) => new TreeNodeAccessor(c, resolvePath));
115
+ }
116
+ return result;
117
+ }
118
+ getFileContentAsBase64(range) {
119
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getBlobContentAsBase64(this.handle, range));
120
+ }
121
+ getFileContentAsString(range) {
122
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getBlobContentAsString(this.handle, range));
123
+ }
124
+ getFileContentAsJson(range) {
125
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getBlobContentAsString(this.handle, range)).mapDefined((v) => JSON.parse(v));
126
+ }
127
+ /**
128
+ * @deprecated use getFileContentAsBase64
129
+ */
130
+ getBlobContentAsBase64() {
131
+ return this.getFileContentAsBase64();
132
+ }
133
+ /**
134
+ * @deprecated use getFileContentAsString
135
+ */
136
+ getBlobContentAsString() {
137
+ return this.getFileContentAsString();
138
+ }
139
+ /**
140
+ * @returns downloaded file handle
141
+ */
142
+ getFileHandle() {
143
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));
144
+ }
145
+ /**
146
+ * @deprecated use getFileHandle
147
+ */
148
+ getDownloadedBlobHandle() {
149
+ return this.getFileHandle();
150
+ }
151
+ /**
152
+ * @returns downloaded file handle
153
+ */
154
+ getRemoteFileHandle() {
155
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));
156
+ }
157
+ /**
158
+ * @deprecated use getRemoteFileHandle
159
+ */
160
+ getOnDemandBlobHandle() {
161
+ return this.getRemoteFileHandle();
162
+ }
163
+ /**
164
+ * @returns the url to the extracted folder
165
+ */
166
+ extractArchiveAndGetURL(format) {
167
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().extractArchiveAndGetURL(this.handle, format));
168
+ }
169
+ getImportProgress() {
170
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getImportProgress(this.handle));
171
+ }
172
+ getLastLogs(nLines) {
173
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getLastLogs(this.handle, nLines));
174
+ }
175
+ getProgressLog(patternToSearch) {
176
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));
177
+ }
178
+ getProgressLogWithInfo(patternToSearch) {
179
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));
180
+ }
181
+ getLogHandle() {
182
+ return new require_future.FutureRef(require_internal.getCfgRenderCtx().getLogHandle(this.handle));
183
+ }
184
+ allFieldsResolved(fieldType = "Input") {
185
+ switch (fieldType) {
186
+ case "Input": return this.getInputsLocked() && this.listInputFields().every((field) => this.resolve({
187
+ field,
188
+ assertFieldType: "Input"
189
+ }) !== void 0);
190
+ case "Output": return this.getOutputsLocked() && this.listOutputFields().every((field) => this.resolve({
191
+ field,
192
+ assertFieldType: "Output"
193
+ }) !== void 0);
194
+ }
195
+ }
196
+ mapFields(_mapping, _ops) {
197
+ const { fieldType, requireLocked, skipUnresolved } = {
198
+ fieldType: "Input",
199
+ requireLocked: true,
200
+ skipUnresolved: false,
201
+ ..._ops
202
+ };
203
+ const mapping = _mapping;
204
+ if (requireLocked) {
205
+ if (fieldType === "Input" && !this.getInputsLocked()) return void 0;
206
+ if (fieldType === "Output" && !this.getOutputsLocked()) return void 0;
207
+ }
208
+ let fieldEntries = (fieldType === "Input" ? this.listInputFields() : fieldType === "Output" ? this.listOutputFields() : this.listDynamicFields()).map((field) => [field, this.resolve({
209
+ field,
210
+ assertFieldType: fieldType
211
+ })]);
212
+ if (skipUnresolved) fieldEntries = fieldEntries.filter((e) => e[1] !== void 0);
213
+ return fieldEntries.map(([name, value]) => mapping(name, value));
214
+ }
215
+ };
230
216
 
217
+ //#endregion
231
218
  exports.TreeNodeAccessor = TreeNodeAccessor;
232
219
  exports.ifDef = ifDef;
233
- //# sourceMappingURL=accessor.cjs.map
220
+ //# sourceMappingURL=accessor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessor.cjs","sources":["../../src/render/accessor.ts"],"sourcesContent":["import type {\n AnyLogHandle,\n ImportProgress,\n LocalBlobHandleAndSize,\n PColumn,\n PObject,\n RemoteBlobHandleAndSize,\n FolderURL,\n ArchiveFormat,\n ProgressLogWithInfo,\n RangeBytes,\n} from \"@milaboratories/pl-model-common\";\nimport { isPColumn, mapPObjectData } from \"@milaboratories/pl-model-common\";\nimport { getCfgRenderCtx } from \"../internal\";\nimport { FutureRef } from \"./future\";\nimport type { AccessorHandle } from \"./internal\";\nimport type { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from \"./traversal_ops\";\n\nexport function ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {\n return value === undefined ? undefined : cb(value);\n}\n\ntype FieldMapOps = {\n /**\n * Type of fields to iterate over.\n * (default 'Input')\n * */\n readonly fieldType?: \"Input\" | \"Output\" | \"Dynamic\";\n /**\n * If not locked, `undefined` value will be returned. Do nothing if mapping `Dynamic` fields.\n * (default true)\n * */\n readonly requireLocked?: boolean;\n /**\n * Will skip unresolved fields.\n * (default false)\n * */\n readonly skipUnresolved?: boolean;\n};\n\n/** Represent resource tree node accessor */\nexport class TreeNodeAccessor {\n constructor(\n public readonly handle: AccessorHandle,\n public readonly resolvePath: string[],\n ) {}\n\n /** Shortcut for {@link resolveInput} */\n public resolve(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n /** Shortcut for {@link resolveInput} */\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n const transformedSteps = steps.map(\n (s) =>\n ({\n assertFieldType: \"Input\",\n ...(typeof s === \"string\" ? { field: s } : s),\n }) satisfies FieldTraversalStep,\n );\n return this.resolveWithCommon({}, ...transformedSteps);\n }\n\n /** If field type assertion is not specified for the step, default is Output. */\n public resolveOutput(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n /** If field type assertion is not specified for the step, default is Output. */\n public resolveOutput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolveOutput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n const transformedSteps = steps.map(\n (s) =>\n ({\n assertFieldType: \"Output\",\n ...(typeof s === \"string\" ? { field: s } : s),\n }) satisfies FieldTraversalStep,\n );\n return this.resolveWithCommon({}, ...transformedSteps);\n }\n\n /** If field type assertion is not specified for the step, default is Input. */\n public resolveInput(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n /** If field type assertion is not specified for the step, default is Input. */\n public resolveInput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolveInput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n const transformedSteps = steps.map(\n (s) =>\n ({\n assertFieldType: \"Input\",\n ...(typeof s === \"string\" ? { field: s } : s),\n }) satisfies FieldTraversalStep,\n );\n return this.resolveWithCommon({}, ...transformedSteps);\n }\n\n public resolveAny(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n public resolveAny(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolveAny(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n return this.resolveWithCommon({}, ...steps);\n }\n\n public resolveWithCommon(\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): TreeNodeAccessor | undefined {\n const resolvePath = [\n ...this.resolvePath,\n ...steps.map((step) => (typeof step === \"string\" ? step : step.field)),\n ];\n return ifDef(\n getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps),\n (accessor) => new TreeNodeAccessor(accessor, resolvePath),\n );\n }\n\n public get resourceType(): ResourceType {\n return getCfgRenderCtx().getResourceType(this.handle);\n }\n\n public getInputsLocked(): boolean {\n return getCfgRenderCtx().getInputsLocked(this.handle);\n }\n\n public getOutputsLocked(): boolean {\n return getCfgRenderCtx().getOutputsLocked(this.handle);\n }\n\n public getIsReadyOrError(): boolean {\n return getCfgRenderCtx().getIsReadyOrError(this.handle);\n }\n\n public getIsFinal(): boolean {\n return getCfgRenderCtx().getIsFinal(this.handle);\n }\n\n public getError(): TreeNodeAccessor | undefined {\n const resolvePath = [...this.resolvePath, \"error\"];\n return ifDef(\n getCfgRenderCtx().getError(this.handle),\n (accsessor) => new TreeNodeAccessor(accsessor, resolvePath),\n );\n }\n\n public listInputFields(): string[] {\n return getCfgRenderCtx().listInputFields(this.handle);\n }\n\n public listOutputFields(): string[] {\n return getCfgRenderCtx().listOutputFields(this.handle);\n }\n\n public listDynamicFields(): string[] {\n return getCfgRenderCtx().listDynamicFields(this.handle);\n }\n\n public getKeyValueBase64(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueBase64(this.handle, key);\n }\n\n public getKeyValueAsString(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueAsString(this.handle, key);\n }\n\n public getKeyValueAsJson<T>(key: string): T {\n const content = this.getKeyValueAsString(key);\n if (content == undefined) throw new Error(\"Resource has no content.\");\n return JSON.parse(content);\n }\n\n public getDataBase64(): string | undefined {\n return getCfgRenderCtx().getDataBase64(this.handle);\n }\n\n public getDataAsString(): string | undefined {\n return getCfgRenderCtx().getDataAsString(this.handle);\n }\n\n public getDataAsJson<T>(): T {\n const content = this.getDataAsString();\n if (content == undefined) throw new Error(\"Resource has no content.\");\n return JSON.parse(content);\n }\n\n /**\n *\n */\n public getPColumns(\n errorOnUnknownField: boolean = false,\n prefix: string = \"\",\n ): PColumn<TreeNodeAccessor>[] | undefined {\n const result = this.parsePObjectCollection(errorOnUnknownField, prefix);\n if (result === undefined) return undefined;\n\n const pf = Object.entries(result).map(([, obj]) => {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n });\n\n return pf;\n }\n\n /**\n *\n */\n public parsePObjectCollection(\n errorOnUnknownField: boolean = false,\n prefix: string = \"\",\n ): Record<string, PObject<TreeNodeAccessor>> | undefined {\n const pObjects = getCfgRenderCtx().parsePObjectCollection(\n this.handle,\n errorOnUnknownField,\n prefix,\n ...this.resolvePath,\n );\n if (pObjects === undefined) return undefined;\n const result: Record<string, PObject<TreeNodeAccessor>> = {};\n for (const [key, value] of Object.entries(pObjects)) {\n const resolvePath = [...this.resolvePath, key];\n result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c, resolvePath));\n }\n return result;\n }\n\n public getFileContentAsBase64(range?: RangeBytes): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle, range));\n }\n\n public getFileContentAsString(range?: RangeBytes): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle, range));\n }\n\n public getFileContentAsJson<T>(range?: RangeBytes): FutureRef<T | undefined> {\n return new FutureRef<string | undefined>(\n getCfgRenderCtx().getBlobContentAsString(this.handle, range),\n ).mapDefined((v) => JSON.parse(v) as T);\n }\n\n /**\n * @deprecated use getFileContentAsBase64\n */\n public getBlobContentAsBase64(): FutureRef<string | undefined> {\n return this.getFileContentAsBase64();\n }\n\n /**\n * @deprecated use getFileContentAsString\n */\n public getBlobContentAsString(): FutureRef<string | undefined> {\n return this.getFileContentAsString();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getFileHandle\n */\n public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return this.getFileHandle();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getRemoteFileHandle\n */\n public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return this.getRemoteFileHandle();\n }\n\n /**\n * @returns the url to the extracted folder\n */\n public extractArchiveAndGetURL(format: ArchiveFormat): FutureRef<FolderURL | undefined> {\n return new FutureRef(getCfgRenderCtx().extractArchiveAndGetURL(this.handle, format));\n }\n\n public getImportProgress(): FutureRef<ImportProgress> {\n return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));\n }\n\n public getLastLogs(nLines: number): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));\n }\n\n public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));\n }\n\n public getProgressLogWithInfo(\n patternToSearch: string,\n ): FutureRef<ProgressLogWithInfo | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));\n }\n\n public getLogHandle(): FutureRef<AnyLogHandle | undefined> {\n return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));\n }\n\n public allFieldsResolved(fieldType: \"Input\" | \"Output\" = \"Input\"): boolean {\n switch (fieldType) {\n case \"Input\":\n return (\n this.getInputsLocked() &&\n this.listInputFields().every(\n (field) => this.resolve({ field, assertFieldType: \"Input\" }) !== undefined,\n )\n );\n case \"Output\":\n return (\n this.getOutputsLocked() &&\n this.listOutputFields().every(\n (field) => this.resolve({ field, assertFieldType: \"Output\" }) !== undefined,\n )\n );\n }\n }\n\n public mapFields<T>(\n _mapping: (name: string, value: TreeNodeAccessor) => T,\n _ops: FieldMapOps & { skipUnresolved: true },\n ): T[] | undefined;\n public mapFields<T>(\n _mapping: (name: string, value: TreeNodeAccessor | undefined) => T,\n _ops?: FieldMapOps,\n ): T[] | undefined;\n public mapFields<T>(\n _mapping: (name: string, value: TreeNodeAccessor) => T,\n _ops?: FieldMapOps,\n ): T[] | undefined {\n const { fieldType, requireLocked, skipUnresolved } = {\n fieldType: \"Input\" as const,\n requireLocked: true,\n skipUnresolved: false,\n ..._ops,\n };\n const mapping = _mapping as (name: string, value: TreeNodeAccessor | undefined) => T;\n if (requireLocked) {\n if (fieldType === \"Input\" && !this.getInputsLocked()) return undefined;\n if (fieldType === \"Output\" && !this.getOutputsLocked()) return undefined;\n }\n const fieldList =\n fieldType === \"Input\"\n ? this.listInputFields()\n : fieldType === \"Output\"\n ? this.listOutputFields()\n : this.listDynamicFields();\n let fieldEntries = fieldList.map(\n (field) => [field, this.resolve({ field, assertFieldType: fieldType })] as const,\n );\n if (skipUnresolved) fieldEntries = fieldEntries.filter((e) => e[1] !== undefined);\n return fieldEntries.map(([name, value]) => mapping(name, value));\n }\n}\n"],"names":["getCfgRenderCtx","isPColumn","mapPObjectData","FutureRef"],"mappings":";;;;;;AAkBM,SAAU,KAAK,CAAO,KAAoB,EAAE,EAAmB,EAAA;AACnE,IAAA,OAAO,KAAK,KAAK,SAAS,GAAG,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC;AACpD;AAoBA;MACa,gBAAgB,CAAA;AAET,IAAA,MAAA;AACA,IAAA,WAAA;IAFlB,WAAA,CACkB,MAAsB,EACtB,WAAqB,EAAA;QADrB,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,WAAW,GAAX,WAAW;IAC1B;IAYI,OAAO,CAAC,GAAG,KAAsC,EAAA;QACtD,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAChC,CAAC,CAAC,MACC;AACC,YAAA,eAAe,EAAE,OAAO;AACxB,YAAA,IAAI,OAAO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,MAAM,OAAO,GAAG,QAAoE;QACpF,IAAI,aAAa,EAAE;YACjB,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;AAAE,gBAAA,OAAO,SAAS;YACtE,IAAI,SAAS,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;AAAE,gBAAA,OAAO,SAAS;QAC1E;AACA,QAAA,MAAM,SAAS,GACb,SAAS,KAAK;AACZ,cAAE,IAAI,CAAC,eAAe;cACpB,SAAS,KAAK;AACd,kBAAE,IAAI,CAAC,gBAAgB;AACvB,kBAAE,IAAI,CAAC,iBAAiB,EAAE;AAChC,QAAA,IAAI,YAAY,GAAG,SAAS,CAAC,GAAG,CAC9B,CAAC,KAAK,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAU,CACjF;AACD,QAAA,IAAI,cAAc;AAAE,YAAA,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;QACjF,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClE;AACD;;;;;"}
1
+ {"version":3,"file":"accessor.cjs","names":["getCfgRenderCtx","FutureRef"],"sources":["../../src/render/accessor.ts"],"sourcesContent":["import type {\n AnyLogHandle,\n ImportProgress,\n LocalBlobHandleAndSize,\n PColumn,\n PObject,\n RemoteBlobHandleAndSize,\n FolderURL,\n ArchiveFormat,\n ProgressLogWithInfo,\n RangeBytes,\n} from \"@milaboratories/pl-model-common\";\nimport { isPColumn, mapPObjectData } from \"@milaboratories/pl-model-common\";\nimport { getCfgRenderCtx } from \"../internal\";\nimport { FutureRef } from \"./future\";\nimport type { AccessorHandle } from \"./internal\";\nimport type { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from \"./traversal_ops\";\n\nexport function ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {\n return value === undefined ? undefined : cb(value);\n}\n\ntype FieldMapOps = {\n /**\n * Type of fields to iterate over.\n * (default 'Input')\n * */\n readonly fieldType?: \"Input\" | \"Output\" | \"Dynamic\";\n /**\n * If not locked, `undefined` value will be returned. Do nothing if mapping `Dynamic` fields.\n * (default true)\n * */\n readonly requireLocked?: boolean;\n /**\n * Will skip unresolved fields.\n * (default false)\n * */\n readonly skipUnresolved?: boolean;\n};\n\n/** Represent resource tree node accessor */\nexport class TreeNodeAccessor {\n constructor(\n public readonly handle: AccessorHandle,\n public readonly resolvePath: string[],\n ) {}\n\n /** Shortcut for {@link resolveInput} */\n public resolve(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n /** Shortcut for {@link resolveInput} */\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n const transformedSteps = steps.map(\n (s) =>\n ({\n assertFieldType: \"Input\",\n ...(typeof s === \"string\" ? { field: s } : s),\n }) satisfies FieldTraversalStep,\n );\n return this.resolveWithCommon({}, ...transformedSteps);\n }\n\n /** If field type assertion is not specified for the step, default is Output. */\n public resolveOutput(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n /** If field type assertion is not specified for the step, default is Output. */\n public resolveOutput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolveOutput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n const transformedSteps = steps.map(\n (s) =>\n ({\n assertFieldType: \"Output\",\n ...(typeof s === \"string\" ? { field: s } : s),\n }) satisfies FieldTraversalStep,\n );\n return this.resolveWithCommon({}, ...transformedSteps);\n }\n\n /** If field type assertion is not specified for the step, default is Input. */\n public resolveInput(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n /** If field type assertion is not specified for the step, default is Input. */\n public resolveInput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolveInput(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n const transformedSteps = steps.map(\n (s) =>\n ({\n assertFieldType: \"Input\",\n ...(typeof s === \"string\" ? { field: s } : s),\n }) satisfies FieldTraversalStep,\n );\n return this.resolveWithCommon({}, ...transformedSteps);\n }\n\n public resolveAny(\n ...steps: [\n Omit<FieldTraversalStep, \"errorIfFieldNotSet\"> & {\n errorIfFieldNotAssigned: true;\n },\n ]\n ): TreeNodeAccessor;\n public resolveAny(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolveAny(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n return this.resolveWithCommon({}, ...steps);\n }\n\n public resolveWithCommon(\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): TreeNodeAccessor | undefined {\n const resolvePath = [\n ...this.resolvePath,\n ...steps.map((step) => (typeof step === \"string\" ? step : step.field)),\n ];\n return ifDef(\n getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps),\n (accessor) => new TreeNodeAccessor(accessor, resolvePath),\n );\n }\n\n public get resourceType(): ResourceType {\n return getCfgRenderCtx().getResourceType(this.handle);\n }\n\n public getInputsLocked(): boolean {\n return getCfgRenderCtx().getInputsLocked(this.handle);\n }\n\n public getOutputsLocked(): boolean {\n return getCfgRenderCtx().getOutputsLocked(this.handle);\n }\n\n public getIsReadyOrError(): boolean {\n return getCfgRenderCtx().getIsReadyOrError(this.handle);\n }\n\n public getIsFinal(): boolean {\n return getCfgRenderCtx().getIsFinal(this.handle);\n }\n\n public getError(): TreeNodeAccessor | undefined {\n const resolvePath = [...this.resolvePath, \"error\"];\n return ifDef(\n getCfgRenderCtx().getError(this.handle),\n (accsessor) => new TreeNodeAccessor(accsessor, resolvePath),\n );\n }\n\n public listInputFields(): string[] {\n return getCfgRenderCtx().listInputFields(this.handle);\n }\n\n public listOutputFields(): string[] {\n return getCfgRenderCtx().listOutputFields(this.handle);\n }\n\n public listDynamicFields(): string[] {\n return getCfgRenderCtx().listDynamicFields(this.handle);\n }\n\n public getKeyValueBase64(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueBase64(this.handle, key);\n }\n\n public getKeyValueAsString(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueAsString(this.handle, key);\n }\n\n public getKeyValueAsJson<T>(key: string): T {\n const content = this.getKeyValueAsString(key);\n if (content == undefined) throw new Error(\"Resource has no content.\");\n return JSON.parse(content);\n }\n\n public getDataBase64(): string | undefined {\n return getCfgRenderCtx().getDataBase64(this.handle);\n }\n\n public getDataAsString(): string | undefined {\n return getCfgRenderCtx().getDataAsString(this.handle);\n }\n\n public getDataAsJson<T>(): T {\n const content = this.getDataAsString();\n if (content == undefined) throw new Error(\"Resource has no content.\");\n return JSON.parse(content);\n }\n\n /**\n *\n */\n public getPColumns(\n errorOnUnknownField: boolean = false,\n prefix: string = \"\",\n ): PColumn<TreeNodeAccessor>[] | undefined {\n const result = this.parsePObjectCollection(errorOnUnknownField, prefix);\n if (result === undefined) return undefined;\n\n const pf = Object.entries(result).map(([, obj]) => {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n });\n\n return pf;\n }\n\n /**\n *\n */\n public parsePObjectCollection(\n errorOnUnknownField: boolean = false,\n prefix: string = \"\",\n ): Record<string, PObject<TreeNodeAccessor>> | undefined {\n const pObjects = getCfgRenderCtx().parsePObjectCollection(\n this.handle,\n errorOnUnknownField,\n prefix,\n ...this.resolvePath,\n );\n if (pObjects === undefined) return undefined;\n const result: Record<string, PObject<TreeNodeAccessor>> = {};\n for (const [key, value] of Object.entries(pObjects)) {\n const resolvePath = [...this.resolvePath, key];\n result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c, resolvePath));\n }\n return result;\n }\n\n public getFileContentAsBase64(range?: RangeBytes): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle, range));\n }\n\n public getFileContentAsString(range?: RangeBytes): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle, range));\n }\n\n public getFileContentAsJson<T>(range?: RangeBytes): FutureRef<T | undefined> {\n return new FutureRef<string | undefined>(\n getCfgRenderCtx().getBlobContentAsString(this.handle, range),\n ).mapDefined((v) => JSON.parse(v) as T);\n }\n\n /**\n * @deprecated use getFileContentAsBase64\n */\n public getBlobContentAsBase64(): FutureRef<string | undefined> {\n return this.getFileContentAsBase64();\n }\n\n /**\n * @deprecated use getFileContentAsString\n */\n public getBlobContentAsString(): FutureRef<string | undefined> {\n return this.getFileContentAsString();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getFileHandle\n */\n public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return this.getFileHandle();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getRemoteFileHandle\n */\n public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return this.getRemoteFileHandle();\n }\n\n /**\n * @returns the url to the extracted folder\n */\n public extractArchiveAndGetURL(format: ArchiveFormat): FutureRef<FolderURL | undefined> {\n return new FutureRef(getCfgRenderCtx().extractArchiveAndGetURL(this.handle, format));\n }\n\n public getImportProgress(): FutureRef<ImportProgress> {\n return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));\n }\n\n public getLastLogs(nLines: number): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));\n }\n\n public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));\n }\n\n public getProgressLogWithInfo(\n patternToSearch: string,\n ): FutureRef<ProgressLogWithInfo | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));\n }\n\n public getLogHandle(): FutureRef<AnyLogHandle | undefined> {\n return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));\n }\n\n public allFieldsResolved(fieldType: \"Input\" | \"Output\" = \"Input\"): boolean {\n switch (fieldType) {\n case \"Input\":\n return (\n this.getInputsLocked() &&\n this.listInputFields().every(\n (field) => this.resolve({ field, assertFieldType: \"Input\" }) !== undefined,\n )\n );\n case \"Output\":\n return (\n this.getOutputsLocked() &&\n this.listOutputFields().every(\n (field) => this.resolve({ field, assertFieldType: \"Output\" }) !== undefined,\n )\n );\n }\n }\n\n public mapFields<T>(\n _mapping: (name: string, value: TreeNodeAccessor) => T,\n _ops: FieldMapOps & { skipUnresolved: true },\n ): T[] | undefined;\n public mapFields<T>(\n _mapping: (name: string, value: TreeNodeAccessor | undefined) => T,\n _ops?: FieldMapOps,\n ): T[] | undefined;\n public mapFields<T>(\n _mapping: (name: string, value: TreeNodeAccessor) => T,\n _ops?: FieldMapOps,\n ): T[] | undefined {\n const { fieldType, requireLocked, skipUnresolved } = {\n fieldType: \"Input\" as const,\n requireLocked: true,\n skipUnresolved: false,\n ..._ops,\n };\n const mapping = _mapping as (name: string, value: TreeNodeAccessor | undefined) => T;\n if (requireLocked) {\n if (fieldType === \"Input\" && !this.getInputsLocked()) return undefined;\n if (fieldType === \"Output\" && !this.getOutputsLocked()) return undefined;\n }\n const fieldList =\n fieldType === \"Input\"\n ? this.listInputFields()\n : fieldType === \"Output\"\n ? this.listOutputFields()\n : this.listDynamicFields();\n let fieldEntries = fieldList.map(\n (field) => [field, this.resolve({ field, assertFieldType: fieldType })] as const,\n );\n if (skipUnresolved) fieldEntries = fieldEntries.filter((e) => e[1] !== undefined);\n return fieldEntries.map(([name, value]) => mapping(name, value));\n }\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,MAAY,OAAsB,IAAoC;AACpF,QAAO,UAAU,SAAY,SAAY,GAAG,MAAM;;;AAsBpD,IAAa,mBAAb,MAAa,iBAAiB;CAC5B,YACE,AAAgB,QAChB,AAAgB,aAChB;EAFgB;EACA;;CAalB,AAAO,QAAQ,GAAG,OAAsE;EACtF,MAAM,mBAAmB,MAAM,KAC5B,OACE;GACC,iBAAiB;GACjB,GAAI,OAAO,MAAM,WAAW,EAAE,OAAO,GAAG,GAAG;GAC5C,EACJ;AACD,SAAO,KAAK,kBAAkB,EAAE,EAAE,GAAG,iBAAiB;;CAaxD,AAAO,cAAc,GAAG,OAAsE;EAC5F,MAAM,mBAAmB,MAAM,KAC5B,OACE;GACC,iBAAiB;GACjB,GAAI,OAAO,MAAM,WAAW,EAAE,OAAO,GAAG,GAAG;GAC5C,EACJ;AACD,SAAO,KAAK,kBAAkB,EAAE,EAAE,GAAG,iBAAiB;;CAaxD,AAAO,aAAa,GAAG,OAAsE;EAC3F,MAAM,mBAAmB,MAAM,KAC5B,OACE;GACC,iBAAiB;GACjB,GAAI,OAAO,MAAM,WAAW,EAAE,OAAO,GAAG,GAAG;GAC5C,EACJ;AACD,SAAO,KAAK,kBAAkB,EAAE,EAAE,GAAG,iBAAiB;;CAWxD,AAAO,WAAW,GAAG,OAAsE;AACzF,SAAO,KAAK,kBAAkB,EAAE,EAAE,GAAG,MAAM;;CAG7C,AAAO,kBACL,eACA,GAAG,OAC2B;EAC9B,MAAM,cAAc,CAClB,GAAG,KAAK,aACR,GAAG,MAAM,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