@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,59 +1,14 @@
1
- /**
2
- * Block Storage Facade - Contract between bundled blocks and middle layer.
3
- *
4
- * ============================================================================
5
- * VERSIONING
6
- * ============================================================================
7
- *
8
- * Blocks declare their model API version via the `requiresModelAPIVersion` feature flag
9
- * (see BlockCodeKnownFeatureFlags). This determines how the middle layer manages block state:
10
- *
11
- * - Version 1: Legacy BlockModel - state is {args, uiState}, managed directly by middle layer
12
- * - Version 2: BlockModelV3 - uses blockStorage with VM-based callbacks (this facade)
13
- *
14
- * This facade (BlockStorageFacade) is used by blocks with `requiresModelAPIVersion: 2`.
15
- * The version number matches the model API version for clarity.
16
- *
17
- * ============================================================================
18
- * BACKWARD COMPATIBILITY WARNING
19
- * ============================================================================
20
- *
21
- * This file documents the FACADE between the SDK (bundled into blocks) and the
22
- * middle layer. Once a block is published, its SDK version is frozen. The middle
23
- * layer must support ALL previously released callback signatures indefinitely.
24
- *
25
- * RULES:
26
- * 1. NEVER change the signature of existing callbacks
27
- * 2. NEVER remove existing callbacks
28
- * 3. New callbacks CAN be added (old blocks won't register them, middle layer
29
- * should handle missing callbacks gracefully)
30
- * 4. Callback return types can be EXTENDED (add optional fields) but not changed
31
- * 5. Callback parameter types should remain compatible (middle layer may need
32
- * to handle both old and new formats)
33
- *
34
- * The facade consists of callbacks registered via `tryRegisterCallback()` with
35
- * the `__pl_` prefix. These are registered by the SDK when a block loads and
36
- * called by the middle layer to perform operations.
37
- *
38
- * ============================================================================
39
- * WHAT CAN BE CHANGED FREELY
40
- * ============================================================================
41
- *
42
- * - Middle layer code (lib/node/pl-middle-layer)
43
- * - SDK internal implementation (as long as callback contracts are preserved)
44
- * - SDK exports used ONLY by middle layer (not by blocks themselves)
45
- * - New SDK features that don't affect existing callbacks
46
- *
47
- * @module block_storage_facade
48
- */
49
- import type { MutateStoragePayload } from "./block_storage";
50
- import type { ConfigRenderLambda } from "./bconfig";
51
- import type { StringifiedJson } from "@milaboratories/pl-model-common";
1
+ import { MutateStoragePayload } from "./block_storage.js";
2
+ import { ConfigRenderLambda } from "./bconfig/lambdas.js";
3
+ import "./bconfig/index.js";
4
+ import { StringifiedJson } from "@milaboratories/pl-model-common";
5
+
6
+ //#region src/block_storage_facade.d.ts
52
7
  /**
53
8
  * The current facade version. This value is used for `requiresModelAPIVersion`
54
9
  * feature flag in BlockModelV3.
55
10
  */
56
- export declare const BLOCK_STORAGE_FACADE_VERSION = 2;
11
+ declare const BLOCK_STORAGE_FACADE_VERSION = 2;
57
12
  /**
58
13
  * All facade callback names as constants.
59
14
  * These are the source of truth - the interface is derived from these.
@@ -63,25 +18,25 @@ export declare const BLOCK_STORAGE_FACADE_VERSION = 2;
63
18
  * 2. Add the callback signature to FacadeCallbackTypes below
64
19
  * 3. The BlockStorageFacade type will automatically include it
65
20
  */
66
- export declare const BlockStorageFacadeCallbacks: {
67
- readonly StorageApplyUpdate: "__pl_storage_applyUpdate";
68
- readonly StorageDebugView: "__pl_storage_debugView";
69
- readonly StorageMigrate: "__pl_storage_migrate";
70
- readonly ArgsDerive: "__pl_args_derive";
71
- readonly PrerunArgsDerive: "__pl_prerunArgs_derive";
72
- readonly StorageInitial: "__pl_storage_initial";
21
+ declare const BlockStorageFacadeCallbacks: {
22
+ readonly StorageApplyUpdate: "__pl_storage_applyUpdate";
23
+ readonly StorageDebugView: "__pl_storage_debugView";
24
+ readonly StorageMigrate: "__pl_storage_migrate";
25
+ readonly ArgsDerive: "__pl_args_derive";
26
+ readonly PrerunArgsDerive: "__pl_prerunArgs_derive";
27
+ readonly StorageInitial: "__pl_storage_initial";
73
28
  };
74
29
  /**
75
30
  * Lambda handles for facade callbacks.
76
31
  * Used by the middle layer to invoke callbacks via executeSingleLambda().
77
32
  */
78
- export declare const BlockStorageFacadeHandles: {
79
- __pl_storage_applyUpdate: ConfigRenderLambda<unknown>;
80
- __pl_storage_debugView: ConfigRenderLambda<unknown>;
81
- __pl_storage_migrate: ConfigRenderLambda<unknown>;
82
- __pl_args_derive: ConfigRenderLambda<unknown>;
83
- __pl_prerunArgs_derive: ConfigRenderLambda<unknown>;
84
- __pl_storage_initial: ConfigRenderLambda<unknown>;
33
+ declare const BlockStorageFacadeHandles: {
34
+ __pl_storage_applyUpdate: ConfigRenderLambda<unknown>;
35
+ __pl_storage_debugView: ConfigRenderLambda<unknown>;
36
+ __pl_storage_migrate: ConfigRenderLambda<unknown>;
37
+ __pl_args_derive: ConfigRenderLambda<unknown>;
38
+ __pl_prerunArgs_derive: ConfigRenderLambda<unknown>;
39
+ __pl_storage_initial: ConfigRenderLambda<unknown>;
85
40
  };
86
41
  /**
87
42
  * The complete facade interface between bundled blocks (SDK) and middle layer.
@@ -103,66 +58,68 @@ export declare const BlockStorageFacadeHandles: {
103
58
  * - Parameter descriptions
104
59
  * - Return value description
105
60
  */
106
- export interface BlockStorageFacade {
107
- /**
108
- * Apply state update to storage.
109
- * Called when UI updates block state (setState) or plugin data.
110
- * @param currentStorageJson - Current storage as JSON string
111
- * @param payload - Update payload with operation type and value
112
- * @returns Updated storage as JSON string
113
- */
114
- [BlockStorageFacadeCallbacks.StorageApplyUpdate]: (currentStorageJson: StringifiedJson, payload: MutateStoragePayload) => StringifiedJson;
115
- /**
116
- * Get debug view of storage.
117
- * Called by developer tools to inspect storage state.
118
- * @param storageJson - Storage as JSON string (or undefined for new blocks)
119
- * @returns JSON string containing StorageDebugView
120
- */
121
- [BlockStorageFacadeCallbacks.StorageDebugView]: (storageJson: StringifiedJson | undefined) => StringifiedJson;
122
- /**
123
- * Run storage migration.
124
- * Called when block loads to migrate data to latest version.
125
- * @param currentStorageJson - Current storage as JSON string (or undefined for new blocks)
126
- * @returns Migration result - either error or success with new storage
127
- */
128
- [BlockStorageFacadeCallbacks.StorageMigrate]: (currentStorageJson: StringifiedJson | undefined) => {
129
- error: string;
130
- } | {
131
- error?: undefined;
132
- newStorageJson: StringifiedJson;
133
- info: string;
134
- };
135
- /**
136
- * Derive args from storage.
137
- * Called to get block configuration args from storage.
138
- * @param storageJson - Storage as JSON string
139
- * @returns Args derivation result - either error or derived value
140
- */
141
- [BlockStorageFacadeCallbacks.ArgsDerive]: (storageJson: StringifiedJson) => {
142
- error: string;
143
- } | {
144
- error?: undefined;
145
- value: unknown;
146
- };
147
- /**
148
- * Derive prerunArgs from storage.
149
- * Called to get prerun args; falls back to args callback if not registered.
150
- * @param storageJson - Storage as JSON string
151
- * @returns Args derivation result - either error or derived value
152
- */
153
- [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (storageJson: StringifiedJson) => {
154
- error: string;
155
- } | {
156
- error?: undefined;
157
- value: unknown;
158
- };
159
- /**
160
- * Get initial storage JSON for new blocks.
161
- * Called when creating a new block to get complete initial storage.
162
- * @returns Initial storage as JSON string
163
- */
164
- [BlockStorageFacadeCallbacks.StorageInitial]: () => StringifiedJson;
61
+ interface BlockStorageFacade {
62
+ /**
63
+ * Apply state update to storage.
64
+ * Called when UI updates block state (setState) or plugin data.
65
+ * @param currentStorageJson - Current storage as JSON string
66
+ * @param payload - Update payload with operation type and value
67
+ * @returns Updated storage as JSON string
68
+ */
69
+ [BlockStorageFacadeCallbacks.StorageApplyUpdate]: (currentStorageJson: StringifiedJson, payload: MutateStoragePayload) => StringifiedJson;
70
+ /**
71
+ * Get debug view of storage.
72
+ * Called by developer tools to inspect storage state.
73
+ * @param storageJson - Storage as JSON string (or undefined for new blocks)
74
+ * @returns JSON string containing StorageDebugView
75
+ */
76
+ [BlockStorageFacadeCallbacks.StorageDebugView]: (storageJson: StringifiedJson | undefined) => StringifiedJson;
77
+ /**
78
+ * Run storage migration.
79
+ * Called when block loads to migrate data to latest version.
80
+ * @param currentStorageJson - Current storage as JSON string (or undefined for new blocks)
81
+ * @returns Migration result - either error or success with new storage
82
+ */
83
+ [BlockStorageFacadeCallbacks.StorageMigrate]: (currentStorageJson: StringifiedJson | undefined) => {
84
+ error: string;
85
+ } | {
86
+ error?: undefined;
87
+ newStorageJson: StringifiedJson;
88
+ info: string;
89
+ };
90
+ /**
91
+ * Derive args from storage.
92
+ * Called to get block configuration args from storage.
93
+ * @param storageJson - Storage as JSON string
94
+ * @returns Args derivation result - either error or derived value
95
+ */
96
+ [BlockStorageFacadeCallbacks.ArgsDerive]: (storageJson: StringifiedJson) => {
97
+ error: string;
98
+ } | {
99
+ error?: undefined;
100
+ value: unknown;
101
+ };
102
+ /**
103
+ * Derive prerunArgs from storage.
104
+ * Called to get prerun args; falls back to args callback if not registered.
105
+ * @param storageJson - Storage as JSON string
106
+ * @returns Args derivation result - either error or derived value
107
+ */
108
+ [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (storageJson: StringifiedJson) => {
109
+ error: string;
110
+ } | {
111
+ error?: undefined;
112
+ value: unknown;
113
+ };
114
+ /**
115
+ * Get initial storage JSON for new blocks.
116
+ * Called when creating a new block to get complete initial storage.
117
+ * @returns Initial storage as JSON string
118
+ */
119
+ [BlockStorageFacadeCallbacks.StorageInitial]: () => StringifiedJson;
165
120
  }
166
121
  /** Register all facade callbacks at once. Ensures all required callbacks are provided. */
167
- export declare function registerFacadeCallbacks(callbacks: BlockStorageFacade): void;
122
+ declare function registerFacadeCallbacks(callbacks: BlockStorageFacade): void;
123
+ //#endregion
124
+ export { BLOCK_STORAGE_FACADE_VERSION, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, registerFacadeCallbacks };
168
125
  //# sourceMappingURL=block_storage_facade.d.ts.map
@@ -1,99 +1,45 @@
1
- import { createRenderLambda, tryRegisterCallback } from './internal.js';
1
+ import { createRenderLambda, tryRegisterCallback } from "./internal.js";
2
2
 
3
+ //#region src/block_storage_facade.ts
3
4
  /**
4
- * Block Storage Facade - Contract between bundled blocks and middle layer.
5
- *
6
- * ============================================================================
7
- * VERSIONING
8
- * ============================================================================
9
- *
10
- * Blocks declare their model API version via the `requiresModelAPIVersion` feature flag
11
- * (see BlockCodeKnownFeatureFlags). This determines how the middle layer manages block state:
12
- *
13
- * - Version 1: Legacy BlockModel - state is {args, uiState}, managed directly by middle layer
14
- * - Version 2: BlockModelV3 - uses blockStorage with VM-based callbacks (this facade)
15
- *
16
- * This facade (BlockStorageFacade) is used by blocks with `requiresModelAPIVersion: 2`.
17
- * The version number matches the model API version for clarity.
18
- *
19
- * ============================================================================
20
- * BACKWARD COMPATIBILITY WARNING
21
- * ============================================================================
22
- *
23
- * This file documents the FACADE between the SDK (bundled into blocks) and the
24
- * middle layer. Once a block is published, its SDK version is frozen. The middle
25
- * layer must support ALL previously released callback signatures indefinitely.
26
- *
27
- * RULES:
28
- * 1. NEVER change the signature of existing callbacks
29
- * 2. NEVER remove existing callbacks
30
- * 3. New callbacks CAN be added (old blocks won't register them, middle layer
31
- * should handle missing callbacks gracefully)
32
- * 4. Callback return types can be EXTENDED (add optional fields) but not changed
33
- * 5. Callback parameter types should remain compatible (middle layer may need
34
- * to handle both old and new formats)
35
- *
36
- * The facade consists of callbacks registered via `tryRegisterCallback()` with
37
- * the `__pl_` prefix. These are registered by the SDK when a block loads and
38
- * called by the middle layer to perform operations.
39
- *
40
- * ============================================================================
41
- * WHAT CAN BE CHANGED FREELY
42
- * ============================================================================
43
- *
44
- * - Middle layer code (lib/node/pl-middle-layer)
45
- * - SDK internal implementation (as long as callback contracts are preserved)
46
- * - SDK exports used ONLY by middle layer (not by blocks themselves)
47
- * - New SDK features that don't affect existing callbacks
48
- *
49
- * @module block_storage_facade
50
- */
51
- // =============================================================================
52
- // Facade Version
53
- // =============================================================================
54
- /**
55
- * The current facade version. This value is used for `requiresModelAPIVersion`
56
- * feature flag in BlockModelV3.
57
- */
5
+ * The current facade version. This value is used for `requiresModelAPIVersion`
6
+ * feature flag in BlockModelV3.
7
+ */
58
8
  const BLOCK_STORAGE_FACADE_VERSION = 2;
59
- // =============================================================================
60
- // Facade Callback Names
61
- // =============================================================================
62
9
  /**
63
- * All facade callback names as constants.
64
- * These are the source of truth - the interface is derived from these.
65
- *
66
- * IMPORTANT: When adding a new callback:
67
- * 1. Add the constant here
68
- * 2. Add the callback signature to FacadeCallbackTypes below
69
- * 3. The BlockStorageFacade type will automatically include it
70
- */
10
+ * All facade callback names as constants.
11
+ * These are the source of truth - the interface is derived from these.
12
+ *
13
+ * IMPORTANT: When adding a new callback:
14
+ * 1. Add the constant here
15
+ * 2. Add the callback signature to FacadeCallbackTypes below
16
+ * 3. The BlockStorageFacade type will automatically include it
17
+ */
71
18
  const BlockStorageFacadeCallbacks = {
72
- StorageApplyUpdate: "__pl_storage_applyUpdate",
73
- StorageDebugView: "__pl_storage_debugView",
74
- StorageMigrate: "__pl_storage_migrate",
75
- ArgsDerive: "__pl_args_derive",
76
- PrerunArgsDerive: "__pl_prerunArgs_derive",
77
- StorageInitial: "__pl_storage_initial",
19
+ StorageApplyUpdate: "__pl_storage_applyUpdate",
20
+ StorageDebugView: "__pl_storage_debugView",
21
+ StorageMigrate: "__pl_storage_migrate",
22
+ ArgsDerive: "__pl_args_derive",
23
+ PrerunArgsDerive: "__pl_prerunArgs_derive",
24
+ StorageInitial: "__pl_storage_initial"
78
25
  };
79
26
  /**
80
- * Creates a map of lambda handles from a callbacks constant object.
81
- * Keys are the callback string values (e.g., '__pl_storage_applyUpdate').
82
- */
27
+ * Creates a map of lambda handles from a callbacks constant object.
28
+ * Keys are the callback string values (e.g., '__pl_storage_applyUpdate').
29
+ */
83
30
  function createFacadeHandles(callbacks) {
84
- return Object.fromEntries(Object.values(callbacks).map((handle) => [handle, createRenderLambda({ handle })]));
31
+ return Object.fromEntries(Object.values(callbacks).map((handle) => [handle, createRenderLambda({ handle })]));
85
32
  }
86
33
  /**
87
- * Lambda handles for facade callbacks.
88
- * Used by the middle layer to invoke callbacks via executeSingleLambda().
89
- */
34
+ * Lambda handles for facade callbacks.
35
+ * Used by the middle layer to invoke callbacks via executeSingleLambda().
36
+ */
90
37
  const BlockStorageFacadeHandles = createFacadeHandles(BlockStorageFacadeCallbacks);
91
38
  /** Register all facade callbacks at once. Ensures all required callbacks are provided. */
92
39
  function registerFacadeCallbacks(callbacks) {
93
- for (const key of Object.values(BlockStorageFacadeCallbacks)) {
94
- tryRegisterCallback(key, callbacks[key]);
95
- }
40
+ for (const key of Object.values(BlockStorageFacadeCallbacks)) tryRegisterCallback(key, callbacks[key]);
96
41
  }
97
42
 
43
+ //#endregion
98
44
  export { BLOCK_STORAGE_FACADE_VERSION, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, registerFacadeCallbacks };
99
- //# sourceMappingURL=block_storage_facade.js.map
45
+ //# sourceMappingURL=block_storage_facade.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"block_storage_facade.js","sources":["../src/block_storage_facade.ts"],"sourcesContent":["/**\n * Block Storage Facade - Contract between bundled blocks and middle layer.\n *\n * ============================================================================\n * VERSIONING\n * ============================================================================\n *\n * Blocks declare their model API version via the `requiresModelAPIVersion` feature flag\n * (see BlockCodeKnownFeatureFlags). This determines how the middle layer manages block state:\n *\n * - Version 1: Legacy BlockModel - state is {args, uiState}, managed directly by middle layer\n * - Version 2: BlockModelV3 - uses blockStorage with VM-based callbacks (this facade)\n *\n * This facade (BlockStorageFacade) is used by blocks with `requiresModelAPIVersion: 2`.\n * The version number matches the model API version for clarity.\n *\n * ============================================================================\n * BACKWARD COMPATIBILITY WARNING\n * ============================================================================\n *\n * This file documents the FACADE between the SDK (bundled into blocks) and the\n * middle layer. Once a block is published, its SDK version is frozen. The middle\n * layer must support ALL previously released callback signatures indefinitely.\n *\n * RULES:\n * 1. NEVER change the signature of existing callbacks\n * 2. NEVER remove existing callbacks\n * 3. New callbacks CAN be added (old blocks won't register them, middle layer\n * should handle missing callbacks gracefully)\n * 4. Callback return types can be EXTENDED (add optional fields) but not changed\n * 5. Callback parameter types should remain compatible (middle layer may need\n * to handle both old and new formats)\n *\n * The facade consists of callbacks registered via `tryRegisterCallback()` with\n * the `__pl_` prefix. These are registered by the SDK when a block loads and\n * called by the middle layer to perform operations.\n *\n * ============================================================================\n * WHAT CAN BE CHANGED FREELY\n * ============================================================================\n *\n * - Middle layer code (lib/node/pl-middle-layer)\n * - SDK internal implementation (as long as callback contracts are preserved)\n * - SDK exports used ONLY by middle layer (not by blocks themselves)\n * - New SDK features that don't affect existing callbacks\n *\n * @module block_storage_facade\n */\n\nimport type { MutateStoragePayload } from \"./block_storage\";\nimport type { ConfigRenderLambda } from \"./bconfig\";\nimport { createRenderLambda, tryRegisterCallback } from \"./internal\";\nimport type { StringifiedJson } from \"@milaboratories/pl-model-common\";\n\n// =============================================================================\n// Facade Version\n// =============================================================================\n\n/**\n * The current facade version. This value is used for `requiresModelAPIVersion`\n * feature flag in BlockModelV3.\n */\nexport const BLOCK_STORAGE_FACADE_VERSION = 2;\n\n// =============================================================================\n// Facade Callback Names\n// =============================================================================\n\n/**\n * All facade callback names as constants.\n * These are the source of truth - the interface is derived from these.\n *\n * IMPORTANT: When adding a new callback:\n * 1. Add the constant here\n * 2. Add the callback signature to FacadeCallbackTypes below\n * 3. The BlockStorageFacade type will automatically include it\n */\nexport const BlockStorageFacadeCallbacks = {\n StorageApplyUpdate: \"__pl_storage_applyUpdate\",\n StorageDebugView: \"__pl_storage_debugView\",\n StorageMigrate: \"__pl_storage_migrate\",\n ArgsDerive: \"__pl_args_derive\",\n PrerunArgsDerive: \"__pl_prerunArgs_derive\",\n StorageInitial: \"__pl_storage_initial\",\n} as const;\n\n/**\n * Creates a map of lambda handles from a callbacks constant object.\n * Keys are the callback string values (e.g., '__pl_storage_applyUpdate').\n */\nfunction createFacadeHandles<T extends Record<string, string>>(\n callbacks: T,\n): { [K in T[keyof T]]: ConfigRenderLambda } {\n return Object.fromEntries(\n Object.values(callbacks).map((handle) => [handle, createRenderLambda({ handle })]),\n ) as { [K in T[keyof T]]: ConfigRenderLambda };\n}\n\n/**\n * Lambda handles for facade callbacks.\n * Used by the middle layer to invoke callbacks via executeSingleLambda().\n */\nexport const BlockStorageFacadeHandles = createFacadeHandles(BlockStorageFacadeCallbacks);\n\n// =============================================================================\n// Facade Interface (source of truth for callback signatures)\n// =============================================================================\n\n/**\n * The complete facade interface between bundled blocks (SDK) and middle layer.\n *\n * This interface defines ALL callbacks that a block registers. The middle layer\n * calls these callbacks to perform storage operations.\n *\n * ALL types are inlined to simplify versioning - when a callback changes,\n * the entire signature is visible in one place.\n *\n * BACKWARD COMPATIBILITY:\n * - This interface can only be EXTENDED, never shrunk\n * - Existing callback signatures MUST NOT change\n * - Middle layer should use Partial<BlockStorageFacade> when dealing with\n * blocks of unknown version (older blocks may not have all callbacks)\n *\n * Each callback is documented with:\n * - Purpose and when it's called\n * - Parameter descriptions\n * - Return value description\n */\nexport interface BlockStorageFacade {\n /**\n * Apply state update to storage.\n * Called when UI updates block state (setState) or plugin data.\n * @param currentStorageJson - Current storage as JSON string\n * @param payload - Update payload with operation type and value\n * @returns Updated storage as JSON string\n */\n [BlockStorageFacadeCallbacks.StorageApplyUpdate]: (\n currentStorageJson: StringifiedJson,\n payload: MutateStoragePayload,\n ) => StringifiedJson;\n\n /**\n * Get debug view of storage.\n * Called by developer tools to inspect storage state.\n * @param storageJson - Storage as JSON string (or undefined for new blocks)\n * @returns JSON string containing StorageDebugView\n */\n [BlockStorageFacadeCallbacks.StorageDebugView]: (\n storageJson: StringifiedJson | undefined,\n ) => StringifiedJson;\n\n /**\n * Run storage migration.\n * Called when block loads to migrate data to latest version.\n * @param currentStorageJson - Current storage as JSON string (or undefined for new blocks)\n * @returns Migration result - either error or success with new storage\n */\n [BlockStorageFacadeCallbacks.StorageMigrate]: (currentStorageJson: StringifiedJson | undefined) =>\n | { error: string }\n | {\n error?: undefined;\n newStorageJson: StringifiedJson;\n info: string;\n };\n\n /**\n * Derive args from storage.\n * Called to get block configuration args from storage.\n * @param storageJson - Storage as JSON string\n * @returns Args derivation result - either error or derived value\n */\n [BlockStorageFacadeCallbacks.ArgsDerive]: (\n storageJson: StringifiedJson,\n ) => { error: string } | { error?: undefined; value: unknown };\n\n /**\n * Derive prerunArgs from storage.\n * Called to get prerun args; falls back to args callback if not registered.\n * @param storageJson - Storage as JSON string\n * @returns Args derivation result - either error or derived value\n */\n [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (\n storageJson: StringifiedJson,\n ) => { error: string } | { error?: undefined; value: unknown };\n\n /**\n * Get initial storage JSON for new blocks.\n * Called when creating a new block to get complete initial storage.\n * @returns Initial storage as JSON string\n */\n [BlockStorageFacadeCallbacks.StorageInitial]: () => StringifiedJson;\n}\n\n/** Register all facade callbacks at once. Ensures all required callbacks are provided. */\nexport function registerFacadeCallbacks(callbacks: BlockStorageFacade): void {\n for (const key of Object.values(BlockStorageFacadeCallbacks)) {\n tryRegisterCallback(key, callbacks[key] as (...args: any[]) => any);\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CG;AAOH;AACA;AACA;AAEA;;;AAGG;AACI,MAAM,4BAA4B,GAAG;AAE5C;AACA;AACA;AAEA;;;;;;;;AAQG;AACI,MAAM,2BAA2B,GAAG;AACzC,IAAA,kBAAkB,EAAE,0BAA0B;AAC9C,IAAA,gBAAgB,EAAE,wBAAwB;AAC1C,IAAA,cAAc,EAAE,sBAAsB;AACtC,IAAA,UAAU,EAAE,kBAAkB;AAC9B,IAAA,gBAAgB,EAAE,wBAAwB;AAC1C,IAAA,cAAc,EAAE,sBAAsB;;AAGxC;;;AAGG;AACH,SAAS,mBAAmB,CAC1B,SAAY,EAAA;AAEZ,IAAA,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CACtC;AAChD;AAEA;;;AAGG;MACU,yBAAyB,GAAG,mBAAmB,CAAC,2BAA2B;AA2FxF;AACM,SAAU,uBAAuB,CAAC,SAA6B,EAAA;IACnE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,EAAE;QAC5D,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAA4B,CAAC;IACrE;AACF;;;;"}
1
+ {"version":3,"file":"block_storage_facade.js","names":[],"sources":["../src/block_storage_facade.ts"],"sourcesContent":["/**\n * Block Storage Facade - Contract between bundled blocks and middle layer.\n *\n * ============================================================================\n * VERSIONING\n * ============================================================================\n *\n * Blocks declare their model API version via the `requiresModelAPIVersion` feature flag\n * (see BlockCodeKnownFeatureFlags). This determines how the middle layer manages block state:\n *\n * - Version 1: Legacy BlockModel - state is {args, uiState}, managed directly by middle layer\n * - Version 2: BlockModelV3 - uses blockStorage with VM-based callbacks (this facade)\n *\n * This facade (BlockStorageFacade) is used by blocks with `requiresModelAPIVersion: 2`.\n * The version number matches the model API version for clarity.\n *\n * ============================================================================\n * BACKWARD COMPATIBILITY WARNING\n * ============================================================================\n *\n * This file documents the FACADE between the SDK (bundled into blocks) and the\n * middle layer. Once a block is published, its SDK version is frozen. The middle\n * layer must support ALL previously released callback signatures indefinitely.\n *\n * RULES:\n * 1. NEVER change the signature of existing callbacks\n * 2. NEVER remove existing callbacks\n * 3. New callbacks CAN be added (old blocks won't register them, middle layer\n * should handle missing callbacks gracefully)\n * 4. Callback return types can be EXTENDED (add optional fields) but not changed\n * 5. Callback parameter types should remain compatible (middle layer may need\n * to handle both old and new formats)\n *\n * The facade consists of callbacks registered via `tryRegisterCallback()` with\n * the `__pl_` prefix. These are registered by the SDK when a block loads and\n * called by the middle layer to perform operations.\n *\n * ============================================================================\n * WHAT CAN BE CHANGED FREELY\n * ============================================================================\n *\n * - Middle layer code (lib/node/pl-middle-layer)\n * - SDK internal implementation (as long as callback contracts are preserved)\n * - SDK exports used ONLY by middle layer (not by blocks themselves)\n * - New SDK features that don't affect existing callbacks\n *\n * @module block_storage_facade\n */\n\nimport type { MutateStoragePayload } from \"./block_storage\";\nimport type { ConfigRenderLambda } from \"./bconfig\";\nimport { createRenderLambda, tryRegisterCallback } from \"./internal\";\nimport type { StringifiedJson } from \"@milaboratories/pl-model-common\";\n\n// =============================================================================\n// Facade Version\n// =============================================================================\n\n/**\n * The current facade version. This value is used for `requiresModelAPIVersion`\n * feature flag in BlockModelV3.\n */\nexport const BLOCK_STORAGE_FACADE_VERSION = 2;\n\n// =============================================================================\n// Facade Callback Names\n// =============================================================================\n\n/**\n * All facade callback names as constants.\n * These are the source of truth - the interface is derived from these.\n *\n * IMPORTANT: When adding a new callback:\n * 1. Add the constant here\n * 2. Add the callback signature to FacadeCallbackTypes below\n * 3. The BlockStorageFacade type will automatically include it\n */\nexport const BlockStorageFacadeCallbacks = {\n StorageApplyUpdate: \"__pl_storage_applyUpdate\",\n StorageDebugView: \"__pl_storage_debugView\",\n StorageMigrate: \"__pl_storage_migrate\",\n ArgsDerive: \"__pl_args_derive\",\n PrerunArgsDerive: \"__pl_prerunArgs_derive\",\n StorageInitial: \"__pl_storage_initial\",\n} as const;\n\n/**\n * Creates a map of lambda handles from a callbacks constant object.\n * Keys are the callback string values (e.g., '__pl_storage_applyUpdate').\n */\nfunction createFacadeHandles<T extends Record<string, string>>(\n callbacks: T,\n): { [K in T[keyof T]]: ConfigRenderLambda } {\n return Object.fromEntries(\n Object.values(callbacks).map((handle) => [handle, createRenderLambda({ handle })]),\n ) as { [K in T[keyof T]]: ConfigRenderLambda };\n}\n\n/**\n * Lambda handles for facade callbacks.\n * Used by the middle layer to invoke callbacks via executeSingleLambda().\n */\nexport const BlockStorageFacadeHandles = createFacadeHandles(BlockStorageFacadeCallbacks);\n\n// =============================================================================\n// Facade Interface (source of truth for callback signatures)\n// =============================================================================\n\n/**\n * The complete facade interface between bundled blocks (SDK) and middle layer.\n *\n * This interface defines ALL callbacks that a block registers. The middle layer\n * calls these callbacks to perform storage operations.\n *\n * ALL types are inlined to simplify versioning - when a callback changes,\n * the entire signature is visible in one place.\n *\n * BACKWARD COMPATIBILITY:\n * - This interface can only be EXTENDED, never shrunk\n * - Existing callback signatures MUST NOT change\n * - Middle layer should use Partial<BlockStorageFacade> when dealing with\n * blocks of unknown version (older blocks may not have all callbacks)\n *\n * Each callback is documented with:\n * - Purpose and when it's called\n * - Parameter descriptions\n * - Return value description\n */\nexport interface BlockStorageFacade {\n /**\n * Apply state update to storage.\n * Called when UI updates block state (setState) or plugin data.\n * @param currentStorageJson - Current storage as JSON string\n * @param payload - Update payload with operation type and value\n * @returns Updated storage as JSON string\n */\n [BlockStorageFacadeCallbacks.StorageApplyUpdate]: (\n currentStorageJson: StringifiedJson,\n payload: MutateStoragePayload,\n ) => StringifiedJson;\n\n /**\n * Get debug view of storage.\n * Called by developer tools to inspect storage state.\n * @param storageJson - Storage as JSON string (or undefined for new blocks)\n * @returns JSON string containing StorageDebugView\n */\n [BlockStorageFacadeCallbacks.StorageDebugView]: (\n storageJson: StringifiedJson | undefined,\n ) => StringifiedJson;\n\n /**\n * Run storage migration.\n * Called when block loads to migrate data to latest version.\n * @param currentStorageJson - Current storage as JSON string (or undefined for new blocks)\n * @returns Migration result - either error or success with new storage\n */\n [BlockStorageFacadeCallbacks.StorageMigrate]: (currentStorageJson: StringifiedJson | undefined) =>\n | { error: string }\n | {\n error?: undefined;\n newStorageJson: StringifiedJson;\n info: string;\n };\n\n /**\n * Derive args from storage.\n * Called to get block configuration args from storage.\n * @param storageJson - Storage as JSON string\n * @returns Args derivation result - either error or derived value\n */\n [BlockStorageFacadeCallbacks.ArgsDerive]: (\n storageJson: StringifiedJson,\n ) => { error: string } | { error?: undefined; value: unknown };\n\n /**\n * Derive prerunArgs from storage.\n * Called to get prerun args; falls back to args callback if not registered.\n * @param storageJson - Storage as JSON string\n * @returns Args derivation result - either error or derived value\n */\n [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (\n storageJson: StringifiedJson,\n ) => { error: string } | { error?: undefined; value: unknown };\n\n /**\n * Get initial storage JSON for new blocks.\n * Called when creating a new block to get complete initial storage.\n * @returns Initial storage as JSON string\n */\n [BlockStorageFacadeCallbacks.StorageInitial]: () => StringifiedJson;\n}\n\n/** Register all facade callbacks at once. Ensures all required callbacks are provided. */\nexport function registerFacadeCallbacks(callbacks: BlockStorageFacade): void {\n for (const key of Object.values(BlockStorageFacadeCallbacks)) {\n tryRegisterCallback(key, callbacks[key] as (...args: any[]) => any);\n }\n}\n"],"mappings":";;;;;;;AA8DA,MAAa,+BAA+B;;;;;;;;;;AAe5C,MAAa,8BAA8B;CACzC,oBAAoB;CACpB,kBAAkB;CAClB,gBAAgB;CAChB,YAAY;CACZ,kBAAkB;CAClB,gBAAgB;CACjB;;;;;AAMD,SAAS,oBACP,WAC2C;AAC3C,QAAO,OAAO,YACZ,OAAO,OAAO,UAAU,CAAC,KAAK,WAAW,CAAC,QAAQ,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAC,CACnF;;;;;;AAOH,MAAa,4BAA4B,oBAAoB,4BAA4B;;AA4FzF,SAAgB,wBAAwB,WAAqC;AAC3E,MAAK,MAAM,OAAO,OAAO,OAAO,4BAA4B,CAC1D,qBAAoB,KAAK,UAAU,KAAgC"}
@@ -1,36 +1,38 @@
1
- 'use strict';
2
-
3
- var plModelCommon = require('@milaboratories/pl-model-common');
4
- var columns = require('../pframe_utils/columns.cjs');
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_axes = require('../pframe_utils/axes.cjs');
3
+ const require_columns = require('../pframe_utils/columns.cjs');
4
+ let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
5
5
 
6
+ //#region src/components/PFrameForGraphs.ts
6
7
  function isHiddenFromGraphColumn(column) {
7
- return !!plModelCommon.readAnnotationJson(column, plModelCommon.Annotation.HideDataFromGraphs);
8
+ return !!(0, _milaboratories_pl_model_common.readAnnotationJson)(column, _milaboratories_pl_model_common.Annotation.HideDataFromGraphs);
8
9
  }
9
10
  function isHiddenFromUIColumn(column) {
10
- return !!plModelCommon.readAnnotationJson(column, plModelCommon.Annotation.HideDataFromUi);
11
+ return !!(0, _milaboratories_pl_model_common.readAnnotationJson)(column, _milaboratories_pl_model_common.Annotation.HideDataFromUi);
11
12
  }
12
13
  /**
13
- The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
14
- (including linker columns and all label columns).
15
- Block’s columns are added to pframe as is.
16
- Other columns are added basing on set of axes of block’s columns, considering available with linker columns.
17
- Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from
18
- result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values
19
- among existing ones).
20
- In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case
21
- of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
22
- and modified label (with added domain values in case if more than one copy with different domains exist).
23
- */
14
+ The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
15
+ (including linker columns and all label columns).
16
+ Block’s columns are added to pframe as is.
17
+ Other columns are added basing on set of axes of block’s columns, considering available with linker columns.
18
+ Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from
19
+ result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values
20
+ among existing ones).
21
+ In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case
22
+ of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
23
+ and modified label (with added domain values in case if more than one copy with different domains exist).
24
+ */
24
25
  function createPFrameForGraphs(ctx, blockColumns) {
25
- const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
26
- // if current block doesn't produce own columns then use all columns from result pool
27
- if (!blockColumns) {
28
- return ctx.createPFrame(columns.getAllRelatedColumns(ctx, suitableSpec));
29
- }
30
- return ctx.createPFrame(columns.getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }));
26
+ const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
27
+ if (!blockColumns) return ctx.createPFrame(require_columns.getAllRelatedColumns(ctx, suitableSpec));
28
+ return ctx.createPFrame(require_columns.getRelatedColumns(ctx, {
29
+ columns: blockColumns,
30
+ predicate: suitableSpec
31
+ }));
31
32
  }
32
33
 
34
+ //#endregion
33
35
  exports.createPFrameForGraphs = createPFrameForGraphs;
34
36
  exports.isHiddenFromGraphColumn = isHiddenFromGraphColumn;
35
37
  exports.isHiddenFromUIColumn = isHiddenFromUIColumn;
36
- //# sourceMappingURL=PFrameForGraphs.cjs.map
38
+ //# sourceMappingURL=PFrameForGraphs.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PFrameForGraphs.cjs","sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type { PColumn, PColumnSpec, PFrameHandle } from \"@milaboratories/pl-model-common\";\nimport { Annotation, readAnnotationJson } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal, RenderCtxBase } from \"../render\";\nimport { getAllRelatedColumns, getRelatedColumns } from \"../pframe_utils/columns\";\nexport type { AxesVault } from \"../pframe_utils/axes\";\nexport { enrichCompatible, getAvailableWithLinkersAxes } from \"../pframe_utils/axes\";\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtxBase<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n const suitableSpec = (spec: PColumnSpec) =>\n !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));\n }\n\n return ctx.createPFrame(\n getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }),\n );\n}\n"],"names":["readAnnotationJson","Annotation","getAllRelatedColumns","getRelatedColumns"],"mappings":";;;;;AAOM,SAAU,uBAAuB,CAAC,MAAmB,EAAA;IACzD,OAAO,CAAC,CAACA,gCAAkB,CAAC,MAAM,EAAEC,wBAAU,CAAC,kBAAkB,CAAC;AACpE;AAEM,SAAU,oBAAoB,CAAC,MAAmB,EAAA;IACtD,OAAO,CAAC,CAACD,gCAAkB,CAAC,MAAM,EAAEC,wBAAU,CAAC,cAAc,CAAC;AAChE;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,qBAAqB,CACnC,GAAwB,EACxB,YAA8C,EAAA;AAE9C,IAAA,MAAM,YAAY,GAAG,CAAC,IAAiB,KACrC,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC;;IAE/D,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,GAAG,CAAC,YAAY,CAACC,4BAAoB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAClE;AAEA,IAAA,OAAO,GAAG,CAAC,YAAY,CACrBC,yBAAiB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAC3E;AACH;;;;;;"}
1
+ {"version":3,"file":"PFrameForGraphs.cjs","names":["Annotation","getAllRelatedColumns","getRelatedColumns"],"sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type { PColumn, PColumnSpec, PFrameHandle } from \"@milaboratories/pl-model-common\";\nimport { Annotation, readAnnotationJson } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal, RenderCtxBase } from \"../render\";\nimport { getAllRelatedColumns, getRelatedColumns } from \"../pframe_utils/columns\";\nexport type { AxesVault } from \"../pframe_utils/axes\";\nexport { enrichCompatible, getAvailableWithLinkersAxes } from \"../pframe_utils/axes\";\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtxBase<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n const suitableSpec = (spec: PColumnSpec) =>\n !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));\n }\n\n return ctx.createPFrame(\n getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }),\n );\n}\n"],"mappings":";;;;;;AAOA,SAAgB,wBAAwB,QAA8B;AACpE,QAAO,CAAC,yDAAoB,QAAQA,2CAAW,mBAAmB;;AAGpE,SAAgB,qBAAqB,QAA8B;AACjE,QAAO,CAAC,yDAAoB,QAAQA,2CAAW,eAAe;;;;;;;;;;;;;;AAehE,SAAgB,sBACd,KACA,cAC0B;CAC1B,MAAM,gBAAgB,SACpB,CAAC,qBAAqB,KAAK,IAAI,CAAC,wBAAwB,KAAK;AAE/D,KAAI,CAAC,aACH,QAAO,IAAI,aAAaC,qCAAqB,KAAK,aAAa,CAAC;AAGlE,QAAO,IAAI,aACTC,kCAAkB,KAAK;EAAE,SAAS;EAAc,WAAW;EAAc,CAAC,CAC3E"}
@@ -1,9 +1,12 @@
1
- import type { PColumn, PColumnSpec, PFrameHandle } from "@milaboratories/pl-model-common";
2
- import type { PColumnDataUniversal, RenderCtxBase } from "../render";
3
- export type { AxesVault } from "../pframe_utils/axes";
4
- export { enrichCompatible, getAvailableWithLinkersAxes } from "../pframe_utils/axes";
5
- export declare function isHiddenFromGraphColumn(column: PColumnSpec): boolean;
6
- export declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
1
+ import { PColumnDataUniversal } from "../render/internal.js";
2
+ import { RenderCtxBase } from "../render/api.js";
3
+ import "../render/index.js";
4
+ import { AxesVault, enrichCompatible, getAvailableWithLinkersAxes } from "../pframe_utils/axes.js";
5
+ import { PColumn, PColumnSpec, PFrameHandle } from "@milaboratories/pl-model-common";
6
+
7
+ //#region src/components/PFrameForGraphs.d.ts
8
+ declare function isHiddenFromGraphColumn(column: PColumnSpec): boolean;
9
+ declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
7
10
  /**
8
11
  The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
9
12
  (including linker columns and all label columns).
@@ -16,5 +19,7 @@ export declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
16
19
  of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
17
20
  and modified label (with added domain values in case if more than one copy with different domains exist).
18
21
  */
19
- export declare function createPFrameForGraphs<A, U>(ctx: RenderCtxBase<A, U>, blockColumns?: PColumn<PColumnDataUniversal>[]): PFrameHandle | undefined;
22
+ declare function createPFrameForGraphs<A, U>(ctx: RenderCtxBase<A, U>, blockColumns?: PColumn<PColumnDataUniversal>[]): PFrameHandle | undefined;
23
+ //#endregion
24
+ export { createPFrameForGraphs, isHiddenFromGraphColumn, isHiddenFromUIColumn };
20
25
  //# sourceMappingURL=PFrameForGraphs.d.ts.map
@@ -1,32 +1,35 @@
1
- import { readAnnotationJson, Annotation } from '@milaboratories/pl-model-common';
2
- import { getAllRelatedColumns, getRelatedColumns } from '../pframe_utils/columns.js';
1
+ import { enrichCompatible, getAvailableWithLinkersAxes } from "../pframe_utils/axes.js";
2
+ import { getAllRelatedColumns, getRelatedColumns } from "../pframe_utils/columns.js";
3
+ import { Annotation, readAnnotationJson } from "@milaboratories/pl-model-common";
3
4
 
5
+ //#region src/components/PFrameForGraphs.ts
4
6
  function isHiddenFromGraphColumn(column) {
5
- return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
7
+ return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
6
8
  }
7
9
  function isHiddenFromUIColumn(column) {
8
- return !!readAnnotationJson(column, Annotation.HideDataFromUi);
10
+ return !!readAnnotationJson(column, Annotation.HideDataFromUi);
9
11
  }
10
12
  /**
11
- The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
12
- (including linker columns and all label columns).
13
- Block’s columns are added to pframe as is.
14
- Other columns are added basing on set of axes of block’s columns, considering available with linker columns.
15
- Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from
16
- result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values
17
- among existing ones).
18
- In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case
19
- of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
20
- and modified label (with added domain values in case if more than one copy with different domains exist).
21
- */
13
+ The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
14
+ (including linker columns and all label columns).
15
+ Block’s columns are added to pframe as is.
16
+ Other columns are added basing on set of axes of block’s columns, considering available with linker columns.
17
+ Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from
18
+ result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values
19
+ among existing ones).
20
+ In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case
21
+ of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
22
+ and modified label (with added domain values in case if more than one copy with different domains exist).
23
+ */
22
24
  function createPFrameForGraphs(ctx, blockColumns) {
23
- const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
24
- // if current block doesn't produce own columns then use all columns from result pool
25
- if (!blockColumns) {
26
- return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));
27
- }
28
- return ctx.createPFrame(getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }));
25
+ const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
26
+ if (!blockColumns) return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));
27
+ return ctx.createPFrame(getRelatedColumns(ctx, {
28
+ columns: blockColumns,
29
+ predicate: suitableSpec
30
+ }));
29
31
  }
30
32
 
33
+ //#endregion
31
34
  export { createPFrameForGraphs, isHiddenFromGraphColumn, isHiddenFromUIColumn };
32
- //# sourceMappingURL=PFrameForGraphs.js.map
35
+ //# sourceMappingURL=PFrameForGraphs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PFrameForGraphs.js","sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type { PColumn, PColumnSpec, PFrameHandle } from \"@milaboratories/pl-model-common\";\nimport { Annotation, readAnnotationJson } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal, RenderCtxBase } from \"../render\";\nimport { getAllRelatedColumns, getRelatedColumns } from \"../pframe_utils/columns\";\nexport type { AxesVault } from \"../pframe_utils/axes\";\nexport { enrichCompatible, getAvailableWithLinkersAxes } from \"../pframe_utils/axes\";\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtxBase<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n const suitableSpec = (spec: PColumnSpec) =>\n !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));\n }\n\n return ctx.createPFrame(\n getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }),\n );\n}\n"],"names":[],"mappings":";;;AAOM,SAAU,uBAAuB,CAAC,MAAmB,EAAA;IACzD,OAAO,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC;AACpE;AAEM,SAAU,oBAAoB,CAAC,MAAmB,EAAA;IACtD,OAAO,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,cAAc,CAAC;AAChE;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,qBAAqB,CACnC,GAAwB,EACxB,YAA8C,EAAA;AAE9C,IAAA,MAAM,YAAY,GAAG,CAAC,IAAiB,KACrC,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC;;IAE/D,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,GAAG,CAAC,YAAY,CAAC,oBAAoB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAClE;AAEA,IAAA,OAAO,GAAG,CAAC,YAAY,CACrB,iBAAiB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAC3E;AACH;;;;"}
1
+ {"version":3,"file":"PFrameForGraphs.js","names":[],"sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type { PColumn, PColumnSpec, PFrameHandle } from \"@milaboratories/pl-model-common\";\nimport { Annotation, readAnnotationJson } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal, RenderCtxBase } from \"../render\";\nimport { getAllRelatedColumns, getRelatedColumns } from \"../pframe_utils/columns\";\nexport type { AxesVault } from \"../pframe_utils/axes\";\nexport { enrichCompatible, getAvailableWithLinkersAxes } from \"../pframe_utils/axes\";\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtxBase<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n const suitableSpec = (spec: PColumnSpec) =>\n !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));\n }\n\n return ctx.createPFrame(\n getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }),\n );\n}\n"],"mappings":";;;;;AAOA,SAAgB,wBAAwB,QAA8B;AACpE,QAAO,CAAC,CAAC,mBAAmB,QAAQ,WAAW,mBAAmB;;AAGpE,SAAgB,qBAAqB,QAA8B;AACjE,QAAO,CAAC,CAAC,mBAAmB,QAAQ,WAAW,eAAe;;;;;;;;;;;;;;AAehE,SAAgB,sBACd,KACA,cAC0B;CAC1B,MAAM,gBAAgB,SACpB,CAAC,qBAAqB,KAAK,IAAI,CAAC,wBAAwB,KAAK;AAE/D,KAAI,CAAC,aACH,QAAO,IAAI,aAAa,qBAAqB,KAAK,aAAa,CAAC;AAGlE,QAAO,IAAI,aACT,kBAAkB,KAAK;EAAE,SAAS;EAAc,WAAW;EAAc,CAAC,CAC3E"}