@finos/legend-cube-builder 0.0.0-stage → 0.0.2

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 (301) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -2
  3. package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
  4. package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
  5. package/lib/__lib__/LegendCubeCommand.js +40 -0
  6. package/lib/__lib__/LegendCubeCommand.js.map +1 -0
  7. package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
  8. package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
  9. package/lib/__lib__/LegendCubeHelpText.js +27 -0
  10. package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
  11. package/lib/__lib__/LegendCubeLabels.d.ts +68 -0
  12. package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
  13. package/lib/__lib__/LegendCubeLabels.js +109 -0
  14. package/lib/__lib__/LegendCubeLabels.js.map +1 -0
  15. package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
  16. package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
  17. package/lib/__lib__/LegendCubeTesting.js +34 -0
  18. package/lib/__lib__/LegendCubeTesting.js.map +1 -0
  19. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
  20. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
  21. package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
  22. package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
  23. package/lib/__test-utils__/CubeEngineTestSupport.d.ts +41 -0
  24. package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
  25. package/lib/__test-utils__/CubeEngineTestSupport.js +76 -0
  26. package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
  27. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
  28. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
  29. package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
  30. package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
  31. package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
  32. package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
  33. package/lib/__test-utils__/CubePageTestUtils.js +68 -0
  34. package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
  35. package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
  36. package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
  37. package/lib/__test-utils__/CubeTestApplication.js +57 -0
  38. package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
  39. package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
  40. package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
  41. package/lib/__test-utils__/FakeCubeEngine.js +85 -0
  42. package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
  43. package/lib/components/CubeButton.d.ts +20 -0
  44. package/lib/components/CubeButton.d.ts.map +1 -0
  45. package/lib/components/CubeButton.js +24 -0
  46. package/lib/components/CubeButton.js.map +1 -0
  47. package/lib/components/CubeEditor.d.ts +31 -0
  48. package/lib/components/CubeEditor.d.ts.map +1 -0
  49. package/lib/components/CubeEditor.js +90 -0
  50. package/lib/components/CubeEditor.js.map +1 -0
  51. package/lib/components/CubeNodeIcon.d.ts +23 -0
  52. package/lib/components/CubeNodeIcon.d.ts.map +1 -0
  53. package/lib/components/CubeNodeIcon.js +32 -0
  54. package/lib/components/CubeNodeIcon.js.map +1 -0
  55. package/lib/components/canvas/CubeCanvas.d.ts +37 -0
  56. package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
  57. package/lib/components/canvas/CubeCanvas.js +135 -0
  58. package/lib/components/canvas/CubeCanvas.js.map +1 -0
  59. package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
  60. package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
  61. package/lib/components/canvas/CubeCanvasContext.js +22 -0
  62. package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
  63. package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
  64. package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
  65. package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
  66. package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
  67. package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
  68. package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
  69. package/lib/components/canvas/CubeCanvasDnd.js +51 -0
  70. package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
  71. package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
  72. package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
  73. package/lib/components/canvas/CubeCanvasEdge.js +33 -0
  74. package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
  75. package/lib/components/canvas/CubeCanvasElements.d.ts +64 -0
  76. package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
  77. package/lib/components/canvas/CubeCanvasElements.js +96 -0
  78. package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
  79. package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
  80. package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
  81. package/lib/components/canvas/CubeCanvasLayout.js +63 -0
  82. package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
  83. package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
  84. package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
  85. package/lib/components/canvas/CubeCanvasNode.js +72 -0
  86. package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
  87. package/lib/components/editors/CubeColumnPicker.d.ts +40 -0
  88. package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
  89. package/lib/components/editors/CubeColumnPicker.js +51 -0
  90. package/lib/components/editors/CubeColumnPicker.js.map +1 -0
  91. package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
  92. package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
  93. package/lib/components/editors/CubeFilterEditor.js +90 -0
  94. package/lib/components/editors/CubeFilterEditor.js.map +1 -0
  95. package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
  96. package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
  97. package/lib/components/editors/CubeJoinEditor.js +76 -0
  98. package/lib/components/editors/CubeJoinEditor.js.map +1 -0
  99. package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
  100. package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
  101. package/lib/components/editors/CubeNodeEditorPanel.js +71 -0
  102. package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
  103. package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
  104. package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
  105. package/lib/components/editors/CubeNodeEditorRegistry.js +30 -0
  106. package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
  107. package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
  108. package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
  109. package/lib/components/editors/CubeSourceEditor.js +42 -0
  110. package/lib/components/editors/CubeSourceEditor.js.map +1 -0
  111. package/lib/components/editors/CubeValueEditor.d.ts +40 -0
  112. package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
  113. package/lib/components/editors/CubeValueEditor.js +177 -0
  114. package/lib/components/editors/CubeValueEditor.js.map +1 -0
  115. package/lib/components/grid/CubeGridRegion.d.ts +23 -0
  116. package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
  117. package/lib/components/grid/CubeGridRegion.js +94 -0
  118. package/lib/components/grid/CubeGridRegion.js.map +1 -0
  119. package/lib/components/grid/CubeGridValues.d.ts +25 -0
  120. package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
  121. package/lib/components/grid/CubeGridValues.js +95 -0
  122. package/lib/components/grid/CubeGridValues.js.map +1 -0
  123. package/lib/components/grid/CubeResultGrid.d.ts +26 -0
  124. package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
  125. package/lib/components/grid/CubeResultGrid.js +50 -0
  126. package/lib/components/grid/CubeResultGrid.js.map +1 -0
  127. package/lib/components/palette/CubePalette.d.ts +29 -0
  128. package/lib/components/palette/CubePalette.d.ts.map +1 -0
  129. package/lib/components/palette/CubePalette.js +73 -0
  130. package/lib/components/palette/CubePalette.js.map +1 -0
  131. package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
  132. package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
  133. package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
  134. package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
  135. package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
  136. package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
  137. package/lib/components/source-picker/CubeSourcePicker.js +89 -0
  138. package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
  139. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
  140. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
  141. package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
  142. package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
  143. package/lib/graph-manager/CubeEngine.d.ts +115 -0
  144. package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
  145. package/lib/graph-manager/CubeEngine.js +61 -0
  146. package/lib/graph-manager/CubeEngine.js.map +1 -0
  147. package/lib/graph-manager/CubeModelOutlineHelper.d.ts +25 -0
  148. package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
  149. package/lib/graph-manager/CubeModelOutlineHelper.js +24 -0
  150. package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
  151. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
  152. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
  153. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
  154. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
  155. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
  156. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
  157. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
  158. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
  159. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
  160. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
  161. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
  162. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
  163. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
  164. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
  165. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
  166. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
  167. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
  168. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
  169. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +121 -0
  170. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
  171. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
  172. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
  173. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
  174. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
  175. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
  176. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
  177. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
  178. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
  179. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
  180. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
  181. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
  182. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
  183. package/lib/index.css +17 -0
  184. package/lib/index.css.map +1 -0
  185. package/lib/index.d.ts +25 -0
  186. package/lib/index.d.ts.map +1 -0
  187. package/lib/index.js +24 -0
  188. package/lib/index.js.map +1 -0
  189. package/lib/stores/CubeEditorState.d.ts +206 -0
  190. package/lib/stores/CubeEditorState.d.ts.map +1 -0
  191. package/lib/stores/CubeEditorState.js +551 -0
  192. package/lib/stores/CubeEditorState.js.map +1 -0
  193. package/lib/stores/CubeExecutionState.d.ts +67 -0
  194. package/lib/stores/CubeExecutionState.d.ts.map +1 -0
  195. package/lib/stores/CubeExecutionState.js +196 -0
  196. package/lib/stores/CubeExecutionState.js.map +1 -0
  197. package/lib/stores/CubeHost.d.ts +31 -0
  198. package/lib/stores/CubeHost.d.ts.map +1 -0
  199. package/lib/stores/CubeHost.js +17 -0
  200. package/lib/stores/CubeHost.js.map +1 -0
  201. package/lib/stores/CubeNodeEditorState.d.ts +85 -0
  202. package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
  203. package/lib/stores/CubeNodeEditorState.js +207 -0
  204. package/lib/stores/CubeNodeEditorState.js.map +1 -0
  205. package/lib/stores/CubeShowPureState.d.ts +38 -0
  206. package/lib/stores/CubeShowPureState.d.ts.map +1 -0
  207. package/lib/stores/CubeShowPureState.js +83 -0
  208. package/lib/stores/CubeShowPureState.js.map +1 -0
  209. package/lib/stores/CubeSourcePickerState.d.ts +98 -0
  210. package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
  211. package/lib/stores/CubeSourcePickerState.js +334 -0
  212. package/lib/stores/CubeSourcePickerState.js.map +1 -0
  213. package/lib/stores/CubeSpecTransferState.d.ts +60 -0
  214. package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
  215. package/lib/stores/CubeSpecTransferState.js +167 -0
  216. package/lib/stores/CubeSpecTransferState.js.map +1 -0
  217. package/lib/stores/LocalModelCatalog.d.ts +37 -0
  218. package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
  219. package/lib/stores/LocalModelCatalog.js +49 -0
  220. package/lib/stores/LocalModelCatalog.js.map +1 -0
  221. package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
  222. package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
  223. package/lib/stores/editors/CubeFilterDraft.js +186 -0
  224. package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
  225. package/lib/stores/editors/CubeJoinDraft.d.ts +63 -0
  226. package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
  227. package/lib/stores/editors/CubeJoinDraft.js +136 -0
  228. package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
  229. package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
  230. package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
  231. package/lib/stores/editors/CubeNodeDraft.js +35 -0
  232. package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
  233. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +29 -0
  234. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
  235. package/lib/stores/editors/CubeNodeDraftRegistry.js +33 -0
  236. package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
  237. package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
  238. package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
  239. package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
  240. package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
  241. package/package.json +81 -3
  242. package/src/__lib__/LegendCubeCommand.ts +44 -0
  243. package/src/__lib__/LegendCubeHelpText.ts +38 -0
  244. package/src/__lib__/LegendCubeLabels.ts +141 -0
  245. package/src/__lib__/LegendCubeTesting.ts +33 -0
  246. package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
  247. package/src/__test-utils__/CubeEngineTestSupport.ts +137 -0
  248. package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
  249. package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
  250. package/src/__test-utils__/CubeTestApplication.ts +82 -0
  251. package/src/__test-utils__/FakeCubeEngine.ts +139 -0
  252. package/src/components/CubeButton.tsx +35 -0
  253. package/src/components/CubeEditor.tsx +239 -0
  254. package/src/components/CubeNodeIcon.tsx +47 -0
  255. package/src/components/canvas/CubeCanvas.tsx +260 -0
  256. package/src/components/canvas/CubeCanvasContext.ts +31 -0
  257. package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
  258. package/src/components/canvas/CubeCanvasDnd.ts +82 -0
  259. package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
  260. package/src/components/canvas/CubeCanvasElements.ts +150 -0
  261. package/src/components/canvas/CubeCanvasLayout.ts +88 -0
  262. package/src/components/canvas/CubeCanvasNode.tsx +141 -0
  263. package/src/components/editors/CubeColumnPicker.tsx +114 -0
  264. package/src/components/editors/CubeFilterEditor.tsx +309 -0
  265. package/src/components/editors/CubeJoinEditor.tsx +224 -0
  266. package/src/components/editors/CubeNodeEditorPanel.tsx +204 -0
  267. package/src/components/editors/CubeNodeEditorRegistry.ts +61 -0
  268. package/src/components/editors/CubeSourceEditor.tsx +116 -0
  269. package/src/components/editors/CubeValueEditor.tsx +332 -0
  270. package/src/components/grid/CubeGridRegion.tsx +274 -0
  271. package/src/components/grid/CubeGridValues.ts +125 -0
  272. package/src/components/grid/CubeResultGrid.tsx +84 -0
  273. package/src/components/palette/CubePalette.tsx +177 -0
  274. package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
  275. package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
  276. package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
  277. package/src/graph-manager/CubeEngine.ts +155 -0
  278. package/src/graph-manager/CubeModelOutlineHelper.ts +32 -0
  279. package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
  280. package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
  281. package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
  282. package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
  283. package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +157 -0
  284. package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
  285. package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
  286. package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +124 -0
  287. package/src/index.ts +41 -0
  288. package/src/stores/CubeEditorState.ts +702 -0
  289. package/src/stores/CubeExecutionState.ts +255 -0
  290. package/src/stores/CubeHost.ts +32 -0
  291. package/src/stores/CubeNodeEditorState.ts +255 -0
  292. package/src/stores/CubeShowPureState.ts +96 -0
  293. package/src/stores/CubeSourcePickerState.ts +426 -0
  294. package/src/stores/CubeSpecTransferState.ts +198 -0
  295. package/src/stores/LocalModelCatalog.ts +70 -0
  296. package/src/stores/editors/CubeFilterDraft.ts +241 -0
  297. package/src/stores/editors/CubeJoinDraft.ts +197 -0
  298. package/src/stores/editors/CubeNodeDraft.ts +46 -0
  299. package/src/stores/editors/CubeNodeDraftRegistry.ts +49 -0
  300. package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
  301. package/tsconfig.json +118 -0
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CubeSpecDecodeError, MAX_SPEC_BYTES, parseCubeSpec, serializeCubeSpec, } from '@finos/legend-cube';
17
+ import { ContentType, downloadFileUsingDataURI, readFileAsText, } from '@finos/legend-shared';
18
+ import { action, flow, makeObservable, observable } from 'mobx';
19
+ export var CUBE_SPEC_TRANSFER_MODE;
20
+ (function (CUBE_SPEC_TRANSFER_MODE) {
21
+ CUBE_SPEC_TRANSFER_MODE["EXPORT"] = "export";
22
+ CUBE_SPEC_TRANSFER_MODE["IMPORT"] = "import";
23
+ })(CUBE_SPEC_TRANSFER_MODE || (CUBE_SPEC_TRANSFER_MODE = {}));
24
+ const errorMessage = (error) => error instanceof Error ? error.message : String(error);
25
+ /** Why a spec can't be imported; a broken document names the path of the problem */
26
+ export const getSpecImportError = (error) => error instanceof CubeSpecDecodeError
27
+ ? error.path
28
+ ? `Can't import the spec: ${error.path} ${error.detail}`
29
+ : `Can't import the spec: it ${error.detail}`
30
+ : `Can't import the spec: ${errorMessage(error)}`;
31
+ /** A file name for a cube's spec, from its name */
32
+ export const getCubeSpecFileName = (name) => {
33
+ const base = name?.trim().replace(/[^\w.-]+/gu, '_') ?? '';
34
+ return `${base.length ? base : 'cube'}.cube.json`;
35
+ };
36
+ /**
37
+ * Export and import of the saved spec (PLAN §10.3), the only way to keep a
38
+ * cube until the Cube store (M8). Both are developer tools for now, labelled
39
+ * "(dev)" (Settled before M1.8).
40
+ */
41
+ export class CubeSpecTransferState {
42
+ editorState;
43
+ mode;
44
+ /** The spec to export, once written */
45
+ exportText;
46
+ /** The spec text to import, pasted or read from a file */
47
+ importText = '';
48
+ /** Why the export or the import failed */
49
+ error;
50
+ isReadingFile = false;
51
+ /** Counts file reads, so a read that finishes after another starts is dropped */
52
+ fileRequest = 0;
53
+ constructor(editorState) {
54
+ makeObservable(this, {
55
+ mode: observable,
56
+ exportText: observable,
57
+ importText: observable,
58
+ error: observable,
59
+ isReadingFile: observable,
60
+ fileRequest: observable,
61
+ openExport: action,
62
+ openImport: action,
63
+ close: action,
64
+ setImportText: action,
65
+ importSpec: action,
66
+ readImportFile: flow,
67
+ });
68
+ this.editorState = editorState;
69
+ }
70
+ /** Writes the cube's spec, invalid queries included; a spec over the size cap is refused */
71
+ openExport() {
72
+ this.mode = CUBE_SPEC_TRANSFER_MODE.EXPORT;
73
+ this.error = undefined;
74
+ this.exportText = undefined;
75
+ const { document, registry } = this.editorState;
76
+ try {
77
+ this.exportText = serializeCubeSpec(document, registry);
78
+ }
79
+ catch (error) {
80
+ this.error = errorMessage(error);
81
+ }
82
+ }
83
+ openImport() {
84
+ this.mode = CUBE_SPEC_TRANSFER_MODE.IMPORT;
85
+ this.error = undefined;
86
+ this.importText = '';
87
+ this.isReadingFile = false;
88
+ }
89
+ close() {
90
+ this.mode = undefined;
91
+ this.exportText = undefined;
92
+ this.importText = '';
93
+ this.error = undefined;
94
+ this.fileRequest++;
95
+ this.isReadingFile = false;
96
+ }
97
+ setImportText(text) {
98
+ this.importText = text;
99
+ this.error = undefined;
100
+ }
101
+ async copyExport() {
102
+ if (this.exportText !== undefined) {
103
+ await this.editorState.host.applicationStore.clipboardService.copyTextToClipboard(this.exportText, { notifySuccessMessage: 'Cube spec copied to the clipboard' });
104
+ }
105
+ }
106
+ downloadExport() {
107
+ if (this.exportText !== undefined) {
108
+ downloadFileUsingDataURI(getCubeSpecFileName(this.editorState.document.name), this.exportText, ContentType.APPLICATION_JSON);
109
+ }
110
+ }
111
+ /** Reads a spec file into the import text; a file over the size cap is refused unread */
112
+ *readImportFile(file) {
113
+ const request = ++this.fileRequest;
114
+ this.error = undefined;
115
+ if (file.size > MAX_SPEC_BYTES) {
116
+ // a file being read before this one is dropped
117
+ this.isReadingFile = false;
118
+ this.error = `The file is too large to import: a spec is at most ${MAX_SPEC_BYTES} bytes`;
119
+ return;
120
+ }
121
+ this.isReadingFile = true;
122
+ try {
123
+ const text = (yield readFileAsText(file));
124
+ if (request === this.fileRequest) {
125
+ this.importText = text;
126
+ }
127
+ }
128
+ catch (error) {
129
+ if (request === this.fileRequest) {
130
+ // the browser's FileReader rejects with its error event, not an Error
131
+ const reason = error instanceof Error
132
+ ? error.message
133
+ : error instanceof ProgressEvent &&
134
+ error.target instanceof FileReader
135
+ ? (error.target.error?.message ?? 'the browser could not read it')
136
+ : String(error);
137
+ this.error = `Can't read the file: ${reason}`;
138
+ }
139
+ }
140
+ finally {
141
+ if (request === this.fileRequest) {
142
+ this.isReadingFile = false;
143
+ }
144
+ }
145
+ }
146
+ /**
147
+ * Opens the spec in place of the cube, as one undo step, and never runs it.
148
+ * A spec that can't be read leaves the cube as it was and says why: a
149
+ * broken document names the path of the problem, e.g. `query.nodes[2].database`.
150
+ */
151
+ importSpec() {
152
+ let decoded;
153
+ try {
154
+ decoded = parseCubeSpec(this.importText, {
155
+ registry: this.editorState.registry,
156
+ });
157
+ }
158
+ catch (error) {
159
+ this.error = getSpecImportError(error);
160
+ return false;
161
+ }
162
+ this.editorState.importDocument(decoded.document, decoded.readOnly);
163
+ this.close();
164
+ return true;
165
+ }
166
+ }
167
+ //# sourceMappingURL=CubeSpecTransferState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeSpecTransferState.js","sourceRoot":"","sources":["../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,CAAC,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ModelContext } from '@finos/legend-cube';
17
+ import type { CubeEngine, CubeModelOutline } from '../graph-manager/CubeEngine.js';
18
+ export interface BundledModel {
19
+ readonly id: string;
20
+ readonly label: string;
21
+ readonly model: ModelContext;
22
+ }
23
+ export declare const BUNDLED_MODELS: readonly BundledModel[];
24
+ /** The model context of pasted Pure text */
25
+ export declare const createTextModel: (code: string) => ModelContext;
26
+ /**
27
+ * Loads the outlines of models through the engine port, each model's once:
28
+ * the picker asks again whenever it opens
29
+ */
30
+ export declare class LocalModelCatalog {
31
+ readonly models: readonly BundledModel[];
32
+ private readonly engine;
33
+ private readonly outlines;
34
+ constructor(engine: CubeEngine);
35
+ loadOutline(model: ModelContext): Promise<CubeModelOutline>;
36
+ }
37
+ //# sourceMappingURL=LocalModelCatalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalModelCatalog.d.ts","sourceRoot":"","sources":["../../src/stores/LocalModelCatalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAOxC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAMhD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,YACP,CAAC;AAEzC;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,MAAM,0BAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgD;gBAE7D,MAAM,EAAE,UAAU;IAI9B,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAW5D"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CUBE_NORTHWIND_MODEL } from './fixtures/CubeNorthwindModel.js';
17
+ export const BUNDLED_MODELS = Object.freeze([
18
+ {
19
+ id: 'cube-northwind',
20
+ label: 'Northwind (Cube fixture)',
21
+ model: CUBE_NORTHWIND_MODEL,
22
+ },
23
+ ]);
24
+ /** The model context of pasted Pure text */
25
+ export const createTextModel = (code) => Object.freeze({ _type: 'text', code });
26
+ /**
27
+ * Loads the outlines of models through the engine port, each model's once:
28
+ * the picker asks again whenever it opens
29
+ */
30
+ export class LocalModelCatalog {
31
+ models = BUNDLED_MODELS;
32
+ engine;
33
+ outlines = new Map();
34
+ constructor(engine) {
35
+ this.engine = engine;
36
+ }
37
+ loadOutline(model) {
38
+ const key = JSON.stringify(model);
39
+ let outline = this.outlines.get(key);
40
+ if (!outline) {
41
+ outline = this.engine.loadModel(model);
42
+ // a failed load is tried again next time
43
+ outline.catch(() => this.outlines.delete(key));
44
+ this.outlines.set(key, outline);
45
+ }
46
+ return outline;
47
+ }
48
+ }
49
+ //# sourceMappingURL=LocalModelCatalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalModelCatalog.js","sourceRoot":"","sources":["../../src/stores/LocalModelCatalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAYxE,MAAM,CAAC,MAAM,cAAc,GAA4B,MAAM,CAAC,MAAM,CAAC;IACnE;QACE,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,0BAA0B;QACjC,KAAK,EAAE,oBAAoB;KAC5B;CACF,CAAC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAgB,EAAE,CAC5D,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACnB,MAAM,GAAG,cAAc,CAAC;IAChB,MAAM,CAAa;IACnB,QAAQ,GAAG,IAAI,GAAG,EAAqC,CAAC;IAEzE,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,WAAW,CAAC,KAAmB;QAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACvC,yCAAyC;YACzC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CompositeFilter, CompositeFilterOperator, type Filter, type FilterOperator, type FilterRule, type FilterValue, type Schema } from '@finos/legend-cube';
17
+ import { CubeNodeDraft } from './CubeNodeDraft.js';
18
+ /** A condition with no column picked and no value: what Add puts in a group */
19
+ export declare const isBlankFilterRow: (rule: FilterRule) => boolean;
20
+ /**
21
+ * The rule without its blank conditions, and without the groups and
22
+ * negations left empty by that; `undefined` when nothing else is left
23
+ */
24
+ export declare const pruneBlankFilterRows: (rule: FilterRule) => FilterRule | undefined;
25
+ /**
26
+ * The Filter editor's draft (spec §8.5, §17.6): the filter as a tree that
27
+ * always has an And/Or group at its top, so rows can be added to it. Each
28
+ * rule keeps its key across edits, so the editor's rows keep theirs.
29
+ *
30
+ * When built, blank conditions are left out, and a tree of nothing else
31
+ * stores no filter at all (user's choice, 2026-10-07): an Apply with an
32
+ * untouched blank row changes nothing. Rules this version can't read are
33
+ * kept as they were.
34
+ */
35
+ export declare class CubeFilterDraft extends CubeNodeDraft<Filter> {
36
+ tree: CompositeFilter;
37
+ /** Anything was changed; until then, `build()` gives the original back */
38
+ private touched;
39
+ constructor(original: Filter);
40
+ private update;
41
+ setGroupOperator(groupKey: number, operator: CompositeFilterOperator): void;
42
+ /** Adds a blank condition at the end of the group */
43
+ addCondition(groupKey: number): void;
44
+ /** Adds a group holding one blank condition at the end of the group */
45
+ addGroup(groupKey: number): void;
46
+ /** Removes a rule; the top group stays */
47
+ removeRule(key: number): void;
48
+ /**
49
+ * Negates a rule as simply as it can (`negateFilter`): a comparison takes
50
+ * its negated operator, e.g. `is` and `is not`, a negation gives back its
51
+ * rule, anything else is wrapped in Not. The top group can't be negated.
52
+ */
53
+ toggleNegation(key: number): void;
54
+ /** Changes a condition's column, keeping its operator and value when they still fit */
55
+ setColumn(key: number, columnName: string, schema: Schema): void;
56
+ /** Changes a condition's operator, dropping its value when the operator takes another shape */
57
+ setOperator(key: number, operator: FilterOperator): void;
58
+ setValue(key: number, value: FilterValue | undefined): void;
59
+ build(): Filter;
60
+ }
61
+ //# sourceMappingURL=CubeFilterDraft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeFilterDraft.d.ts","sourceRoot":"","sources":["../../../src/stores/editors/CubeFilterDraft.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAIL,eAAe,EACf,uBAAuB,EAEvB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAIhB,KAAK,MAAM,EAEZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,GAAI,MAAM,UAAU,KAAG,OAG1B,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,UAAU,KACf,UAAU,GAAG,SAyBf,CAAC;AAqCF;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,aAAa,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,eAAe,CAAC;IACtB,0EAA0E;IAC1E,OAAO,CAAC,OAAO,CAAS;gBAEZ,QAAQ,EAAE,MAAM;IAiB5B,OAAO,CAAC,MAAM;IAYd,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI;IAM3E,qDAAqD;IACrD,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQpC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAWhC,0CAA0C;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM7B;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMjC,uFAAuF;IACvF,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQhE,+FAA+F;IAC/F,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;IAQxD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI;IAM3D,KAAK,IAAI,MAAM;CAiBhB"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { changeFilterColumn, changeFilterOperator, ColumnComparisonFilter, CompositeFilter, CompositeFilterOperator, encodeFilterRule, negateFilter, normalizeFilter, NotFilter, unwrapFilter, } from '@finos/legend-cube';
17
+ import { action, makeObservable, observable } from 'mobx';
18
+ import { CubeNodeDraft } from './CubeNodeDraft.js';
19
+ /** A condition with no column picked and no value: what Add puts in a group */
20
+ export const isBlankFilterRow = (rule) => rule instanceof ColumnComparisonFilter &&
21
+ rule.columnName === '' &&
22
+ rule.value === undefined;
23
+ /**
24
+ * The rule without its blank conditions, and without the groups and
25
+ * negations left empty by that; `undefined` when nothing else is left
26
+ */
27
+ export const pruneBlankFilterRows = (rule) => {
28
+ if (isBlankFilterRow(rule)) {
29
+ return undefined;
30
+ }
31
+ if (rule instanceof CompositeFilter) {
32
+ const rules = rule.rules
33
+ .map(pruneBlankFilterRows)
34
+ .filter((child) => child !== undefined);
35
+ if (!rules.length) {
36
+ return undefined;
37
+ }
38
+ return rules.length === rule.rules.length &&
39
+ rules.every((child, index) => child === rule.rules[index])
40
+ ? rule
41
+ : rule.withRules(rules);
42
+ }
43
+ if (rule instanceof NotFilter) {
44
+ const inner = pruneBlankFilterRows(rule.rule);
45
+ return inner === undefined
46
+ ? undefined
47
+ : inner === rule.rule
48
+ ? rule
49
+ : rule.withRule(inner);
50
+ }
51
+ return rule;
52
+ };
53
+ /**
54
+ * The tree with the rule of `key` replaced by what `replace` gives, or
55
+ * removed when it gives `undefined`; a negation whose rule is removed goes
56
+ * too. Rules that don't change stay the same objects.
57
+ */
58
+ const replaceRule = (rule, key, replace) => {
59
+ if (rule.key === key) {
60
+ return replace(rule);
61
+ }
62
+ if (rule instanceof CompositeFilter) {
63
+ const rules = rule.rules
64
+ .map((child) => replaceRule(child, key, replace))
65
+ .filter((child) => child !== undefined);
66
+ return rules.length === rule.rules.length &&
67
+ rules.every((child, index) => child === rule.rules[index])
68
+ ? rule
69
+ : rule.withRules(rules);
70
+ }
71
+ if (rule instanceof NotFilter) {
72
+ const inner = replaceRule(rule.rule, key, replace);
73
+ return inner === undefined
74
+ ? undefined
75
+ : inner === rule.rule
76
+ ? rule
77
+ : rule.withRule(inner);
78
+ }
79
+ return rule;
80
+ };
81
+ const blankRow = () => new ColumnComparisonFilter('');
82
+ /**
83
+ * The Filter editor's draft (spec §8.5, §17.6): the filter as a tree that
84
+ * always has an And/Or group at its top, so rows can be added to it. Each
85
+ * rule keeps its key across edits, so the editor's rows keep theirs.
86
+ *
87
+ * When built, blank conditions are left out, and a tree of nothing else
88
+ * stores no filter at all (user's choice, 2026-10-07): an Apply with an
89
+ * untouched blank row changes nothing. Rules this version can't read are
90
+ * kept as they were.
91
+ */
92
+ export class CubeFilterDraft extends CubeNodeDraft {
93
+ tree;
94
+ /** Anything was changed; until then, `build()` gives the original back */
95
+ touched = false;
96
+ constructor(original) {
97
+ super(original);
98
+ makeObservable(this, {
99
+ tree: observable.ref,
100
+ touched: observable,
101
+ setGroupOperator: action,
102
+ addCondition: action,
103
+ addGroup: action,
104
+ removeRule: action,
105
+ toggleNegation: action,
106
+ setColumn: action,
107
+ setOperator: action,
108
+ setValue: action,
109
+ });
110
+ this.tree = normalizeFilter(original.filter);
111
+ }
112
+ update(key, replace) {
113
+ const tree = replaceRule(this.tree, key, replace);
114
+ // the top group stays a group
115
+ if (tree instanceof CompositeFilter && tree !== this.tree) {
116
+ this.tree = tree;
117
+ this.touched = true;
118
+ }
119
+ }
120
+ setGroupOperator(groupKey, operator) {
121
+ this.update(groupKey, (rule) => rule instanceof CompositeFilter ? rule.withOperator(operator) : rule);
122
+ }
123
+ /** Adds a blank condition at the end of the group */
124
+ addCondition(groupKey) {
125
+ this.update(groupKey, (rule) => rule instanceof CompositeFilter
126
+ ? rule.withRules([...rule.rules, blankRow()])
127
+ : rule);
128
+ }
129
+ /** Adds a group holding one blank condition at the end of the group */
130
+ addGroup(groupKey) {
131
+ this.update(groupKey, (rule) => rule instanceof CompositeFilter
132
+ ? rule.withRules([
133
+ ...rule.rules,
134
+ new CompositeFilter(CompositeFilterOperator.AND, [blankRow()]),
135
+ ])
136
+ : rule);
137
+ }
138
+ /** Removes a rule; the top group stays */
139
+ removeRule(key) {
140
+ if (key !== this.tree.key) {
141
+ this.update(key, () => undefined);
142
+ }
143
+ }
144
+ /**
145
+ * Negates a rule as simply as it can (`negateFilter`): a comparison takes
146
+ * its negated operator, e.g. `is` and `is not`, a negation gives back its
147
+ * rule, anything else is wrapped in Not. The top group can't be negated.
148
+ */
149
+ toggleNegation(key) {
150
+ if (key !== this.tree.key) {
151
+ this.update(key, negateFilter);
152
+ }
153
+ }
154
+ /** Changes a condition's column, keeping its operator and value when they still fit */
155
+ setColumn(key, columnName, schema) {
156
+ this.update(key, (rule) => rule instanceof ColumnComparisonFilter
157
+ ? changeFilterColumn(rule, columnName, schema)
158
+ : rule);
159
+ }
160
+ /** Changes a condition's operator, dropping its value when the operator takes another shape */
161
+ setOperator(key, operator) {
162
+ this.update(key, (rule) => rule instanceof ColumnComparisonFilter
163
+ ? changeFilterOperator(rule, operator)
164
+ : rule);
165
+ }
166
+ setValue(key, value) {
167
+ this.update(key, (rule) => rule instanceof ColumnComparisonFilter ? rule.withValue(value) : rule);
168
+ }
169
+ build() {
170
+ const { original } = this;
171
+ if (!this.touched) {
172
+ return original;
173
+ }
174
+ const pruned = pruneBlankFilterRows(this.tree);
175
+ const filter = pruned === undefined ? undefined : unwrapFilter(pruned);
176
+ // a saved group of one rule comes back as the rule: it saves differently
177
+ // but means the same, so it is no change
178
+ const isUnchanged = filter === undefined
179
+ ? original.filter === undefined
180
+ : original.filter !== undefined &&
181
+ JSON.stringify(encodeFilterRule(filter)) ===
182
+ JSON.stringify(encodeFilterRule(unwrapFilter(original.filter)));
183
+ return isUnchanged ? original : original.withFilter(filter);
184
+ }
185
+ }
186
+ //# sourceMappingURL=CubeFilterDraft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeFilterDraft.js","sourceRoot":"","sources":["../../../src/stores/editors/CubeFilterDraft.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAKhB,YAAY,EACZ,eAAe,EACf,SAAS,EAET,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAgB,EAAW,EAAE,CAC5D,IAAI,YAAY,sBAAsB;IACtC,IAAI,CAAC,UAAU,KAAK,EAAE;IACtB,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;AAE3B;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAgB,EACQ,EAAE;IAC1B,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK;aACrB,GAAG,CAAC,oBAAoB,CAAC;aACzB,MAAM,CAAC,CAAC,KAAK,EAAuB,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,CAA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,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACvE,yEAAyE;QACzE,yCAAyC;QACzC,MAAM,WAAW,GACf,MAAM,KAAK,SAAS;YAClB,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS;YAC/B,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS;gBAC7B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBACtC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACxE,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Join, JoinType, type Query, RelationalTableSource, type SchemaInferenceResult } from '@finos/legend-cube';
17
+ import type { CubeModelOutline } from '../../graph-manager/CubeEngine.js';
18
+ import { CubeNodeDraft } from './CubeNodeDraft.js';
19
+ /** One pair of key columns, matched by position; `''` until a column is picked */
20
+ export interface CubeJoinKeyPair {
21
+ /** Identifies the row in the editor */
22
+ readonly key: number;
23
+ readonly left: string;
24
+ readonly right: string;
25
+ }
26
+ /**
27
+ * The Join editor's draft (spec §17.6): the join type and the key column
28
+ * pairs. A pair with no column picked on either side is left out when built,
29
+ * as a Filter's blank rows are (user's choice, 2026-10-07).
30
+ */
31
+ export declare class CubeJoinDraft extends CubeNodeDraft<Join> {
32
+ joinType: JoinType;
33
+ pairs: CubeJoinKeyPair[];
34
+ /** Anything was changed; until then, `build()` gives the original back */
35
+ private touched;
36
+ /**
37
+ * The key lists the pairs built before any edit, so edits undone by hand
38
+ * give the original back, even for saved lists of unequal length
39
+ */
40
+ private readonly initialKeyLists;
41
+ constructor(original: Join);
42
+ setJoinType(joinType: JoinType): void;
43
+ addPair(): void;
44
+ removePair(key: number): void;
45
+ setLeftColumn(key: number, left: string): void;
46
+ setRightColumn(key: number, right: string): void;
47
+ build(): Join;
48
+ }
49
+ /**
50
+ * The table sources a column of a node's output comes from: followed back
51
+ * through the inputs whose output has the column. A join key of the same name
52
+ * on both sides comes from the side the join keeps (the left for INNER and
53
+ * LEFT OUTER, the right for RIGHT OUTER), and from both for FULL OUTER, which
54
+ * merges them.
55
+ */
56
+ export declare const findColumnSources: (query: Query, analysis: SchemaInferenceResult, nodeId: string, columnName: string) => RelationalTableSource[];
57
+ /**
58
+ * Whether the column of the node's output comes from a table column whose
59
+ * type Cube can't read (OTHER or ARRAY), so it was typed as a bare String
60
+ * (PLAN §8.7). Unknown until the model's outline has loaded.
61
+ */
62
+ export declare const isUntypedColumn: (outline: CubeModelOutline | undefined, query: Query, analysis: SchemaInferenceResult, nodeId: string, columnName: string) => boolean;
63
+ //# sourceMappingURL=CubeJoinDraft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJoinDraft.d.ts","sourceRoot":"","sources":["../../../src/stores/editors/CubeJoinDraft.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,IAAI,EACJ,QAAQ,EACR,KAAK,KAAK,EACV,qBAAqB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,oBAAoB,CA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