@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,255 @@
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
+
17
+ import { isSchemasError, type Query, type Schema } from '@finos/legend-cube';
18
+ import { assertErrorThrown, type GeneratorFn } from '@finos/legend-shared';
19
+ import { action, computed, flow, makeObservable, observable } from 'mobx';
20
+ import {
21
+ CubeEngineError,
22
+ CubeEngineErrorKind,
23
+ type CubeResult,
24
+ type CubeResultValue,
25
+ } from '../graph-manager/CubeEngine.js';
26
+ import type { CubeEditorState } from './CubeEditorState.js';
27
+
28
+ /** What the grid shows of a run: the rows within the limit, under the schema the run was made with */
29
+ export interface CubeExecutionResult {
30
+ /** Counts the page's runs: the grid is built anew for each */
31
+ readonly id: number;
32
+ /** The query that ran: results are stale once the document holds another */
33
+ readonly query: Query;
34
+ /** The capture node's schema when the run started; the grid's columns, by position */
35
+ readonly schema: Schema;
36
+ /** At most `rowLimit` rows */
37
+ readonly rows: readonly (readonly CubeResultValue[])[];
38
+ readonly rowLimit: number;
39
+ /** The engine returned more than `rowLimit` rows */
40
+ readonly limited: boolean;
41
+ readonly sql: readonly string[];
42
+ readonly durationMs: number;
43
+ }
44
+
45
+ /**
46
+ * The first error found walking up from the capture node, named by its node.
47
+ * A node that is invalid only because an input is gets passed over for that
48
+ * input's own error.
49
+ */
50
+ const findUpstreamError = (
51
+ query: Query,
52
+ validity: ReadonlyMap<string, readonly string[]>,
53
+ captureId: string,
54
+ ): string => {
55
+ const visit = (nodeId: string): string | undefined => {
56
+ const node = query.getNode(nodeId);
57
+ if (!node) {
58
+ return undefined;
59
+ }
60
+ for (const inputId of query.getInputIds(nodeId)) {
61
+ const error = inputId === undefined ? undefined : visit(inputId);
62
+ if (error) {
63
+ return error;
64
+ }
65
+ }
66
+ const error = (validity.get(nodeId) ?? []).find(
67
+ (message) => !isSchemasError(message),
68
+ );
69
+ return error === undefined ? undefined : `${node.describe()}: ${error}`;
70
+ };
71
+ return (
72
+ visit(captureId) ?? 'The node to run, or one of its inputs, has errors.'
73
+ );
74
+ };
75
+
76
+ /**
77
+ * Runs the query up to its capture node (PLAN §8.2, §9). Execution is
78
+ * explicit; while a run is in flight Execute becomes Stop, and only the latest
79
+ * run's answer is applied (Settled before M1.8).
80
+ */
81
+ export class CubeExecutionState {
82
+ readonly editorState: CubeEditorState;
83
+
84
+ result: CubeExecutionResult | undefined;
85
+ error: CubeEngineError | undefined;
86
+ /** The abort controller of the run in flight, if any */
87
+ private runController: AbortController | undefined;
88
+ private runCount = 0;
89
+
90
+ constructor(editorState: CubeEditorState) {
91
+ makeObservable<CubeExecutionState, 'runController'>(this, {
92
+ result: observable.ref,
93
+ error: observable.ref,
94
+ runController: observable.ref,
95
+ isRunning: computed,
96
+ isStale: computed,
97
+ disabledReasons: computed,
98
+ canExecute: computed,
99
+ execute: flow,
100
+ clearError: action,
101
+ stop: action,
102
+ reset: action,
103
+ });
104
+ this.editorState = editorState;
105
+ }
106
+
107
+ get isRunning(): boolean {
108
+ return this.runController !== undefined;
109
+ }
110
+
111
+ /** The shown result no longer matches the query or the row limit; it is kept until the next run */
112
+ get isStale(): boolean {
113
+ return (
114
+ this.result !== undefined &&
115
+ !this.isRunning &&
116
+ (this.result.query !== this.editorState.document.query ||
117
+ this.result.rowLimit !== this.editorState.rowLimit)
118
+ );
119
+ }
120
+
121
+ /**
122
+ * Why Execute is unavailable, if it is: it needs a source, a model and a
123
+ * runtime, and a valid capture node whose inputs are all valid. Invalid
124
+ * nodes elsewhere don't matter (PLAN §10.3).
125
+ */
126
+ get disabledReasons(): string[] {
127
+ const { document, emitter, analysis } = this.editorState;
128
+ const { query, context } = document;
129
+ if (!query.nodes.length) {
130
+ return ['Add a table first.'];
131
+ }
132
+ const reasons: string[] = [];
133
+ if (!context) {
134
+ reasons.push('The cube has no model.');
135
+ } else if (!context.runtime) {
136
+ reasons.push('The cube has no runtime.');
137
+ }
138
+ const captureId = query.selected;
139
+ if (captureId === undefined) {
140
+ reasons.push('Select the node to run.');
141
+ } else if (!emitter.canEmit(captureId)) {
142
+ reasons.push(findUpstreamError(query, analysis.validity, captureId));
143
+ }
144
+ return reasons;
145
+ }
146
+
147
+ get canExecute(): boolean {
148
+ return !this.disabledReasons.length;
149
+ }
150
+
151
+ *execute(): GeneratorFn<void> {
152
+ if (this.isRunning || !this.canExecute) {
153
+ return;
154
+ }
155
+ const { document, emitter, analysis, rowLimit, host } = this.editorState;
156
+ const { query, context } = document;
157
+ // checked by canExecute
158
+ const captureId = query.selected as string;
159
+ const model = context?.model;
160
+ const runtime = context?.runtime;
161
+ const schema = analysis.schemas.get(captureId);
162
+ if (!model || !runtime || !schema) {
163
+ return;
164
+ }
165
+ const lambda = emitter.emitExecutionLambda({ rowLimit, runtime });
166
+ const controller = new AbortController();
167
+ this.runController = controller;
168
+ this.error = undefined;
169
+ this.editorState.clearHostIssues();
170
+ try {
171
+ const response = (yield host.engine.execute(model, lambda, {
172
+ abortController: controller,
173
+ })) as CubeResult;
174
+ if (this.runController !== controller) {
175
+ return;
176
+ }
177
+ // rows are read by position, so the engine's columns must be the query's
178
+ if (response.columns.length !== schema.columns.length) {
179
+ throw new CubeEngineError(
180
+ CubeEngineErrorKind.EXECUTION,
181
+ `The engine returned ${response.columns.length} columns, but the query has ${schema.columns.length}`,
182
+ captureId,
183
+ );
184
+ }
185
+ const misplaced = schema.columns.findIndex(
186
+ (column, position) => response.columns[position] !== column.name,
187
+ );
188
+ if (misplaced !== -1) {
189
+ throw new CubeEngineError(
190
+ CubeEngineErrorKind.EXECUTION,
191
+ `The engine returned the column "${response.columns[misplaced]}" at position ${misplaced + 1}, but the query has "${schema.columns[misplaced]?.name}" there`,
192
+ captureId,
193
+ );
194
+ }
195
+ const limited = response.rows.length > rowLimit;
196
+ this.result = {
197
+ id: ++this.runCount,
198
+ query,
199
+ schema,
200
+ rows: limited ? response.rows.slice(0, rowLimit) : response.rows,
201
+ rowLimit,
202
+ limited,
203
+ sql: response.sql,
204
+ durationMs: response.durationMs,
205
+ };
206
+ } catch (error) {
207
+ // a stopped or replaced run shows nothing
208
+ if (this.runController !== controller || controller.signal.aborted) {
209
+ return;
210
+ }
211
+ assertErrorThrown(error);
212
+ const engineError =
213
+ error instanceof CubeEngineError
214
+ ? error
215
+ : new CubeEngineError(
216
+ CubeEngineErrorKind.EXECUTION,
217
+ error.message,
218
+ captureId,
219
+ );
220
+ // the rows of an earlier run are never shown as this run's
221
+ this.result = undefined;
222
+ // an error belongs to the query it came from: one that changed while
223
+ // the run was in flight drops it, as an edit after the run would
224
+ if (this.editorState.document.query === query) {
225
+ this.error = engineError;
226
+ this.editorState.setHostIssue(
227
+ engineError.nodeId ?? captureId,
228
+ engineError,
229
+ );
230
+ }
231
+ } finally {
232
+ if (this.runController === controller) {
233
+ this.runController = undefined;
234
+ }
235
+ }
236
+ }
237
+
238
+ /** Drops the last run's error: it described a query the cube no longer has */
239
+ clearError(): void {
240
+ this.error = undefined;
241
+ }
242
+
243
+ /** Cancels the run in flight; it shows no result and no error */
244
+ stop(): void {
245
+ this.runController?.abort();
246
+ this.runController = undefined;
247
+ }
248
+
249
+ /** Stops any run and forgets the last one's rows and error, e.g. when another cube is opened */
250
+ reset(): void {
251
+ this.stop();
252
+ this.result = undefined;
253
+ this.error = undefined;
254
+ }
255
+ }
@@ -0,0 +1,32 @@
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
+
17
+ import type { GenericLegendApplicationStore } from '@finos/legend-application';
18
+ import type { CubeEngine } from '../graph-manager/CubeEngine.js';
19
+ import type { LocalModelCatalog } from './LocalModelCatalog.js';
20
+
21
+ /**
22
+ * What the application hosting the Cube page gives it (PLAN §3.5, Settled
23
+ * before M1.8). The host chooses the engine and the models; Cube keeps no
24
+ * auth, config or telemetry of its own and uses the host's application store
25
+ * for commands, user data, the clipboard, the theme, notifications, alerts and
26
+ * telemetry.
27
+ */
28
+ export interface CubeHost {
29
+ readonly applicationStore: GenericLegendApplicationStore;
30
+ readonly engine: CubeEngine;
31
+ readonly modelCatalog: LocalModelCatalog;
32
+ }
@@ -0,0 +1,255 @@
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
+
17
+ import type { NodeRegistry, QueryNode } from '@finos/legend-cube';
18
+ import {
19
+ action,
20
+ computed,
21
+ type IReactionDisposer,
22
+ makeObservable,
23
+ observable,
24
+ reaction,
25
+ } from 'mobx';
26
+ import {
27
+ CUBE_EDITOR_CLOSED_REASON,
28
+ getEditorClosedNotice,
29
+ } from '../__lib__/LegendCubeLabels.js';
30
+ import type { CubeEditorState } from './CubeEditorState.js';
31
+ import type { CubeNodeDraft } from './editors/CubeNodeDraft.js';
32
+ import { createCubeNodeDraft } from './editors/CubeNodeDraftRegistry.js';
33
+
34
+ /**
35
+ * Whether two nodes of the same id save the same: their own fields, as the
36
+ * spec stores them, and the keys this version doesn't know. A node of a type
37
+ * the registry doesn't know is the same only as itself.
38
+ */
39
+ export const isSameNodeContent = (
40
+ registry: NodeRegistry,
41
+ a: QueryNode,
42
+ b: QueryNode,
43
+ ): boolean => {
44
+ if (a === b) {
45
+ return true;
46
+ }
47
+ const definition = registry.get(a.type);
48
+ return (
49
+ definition !== undefined &&
50
+ a.type === b.type &&
51
+ JSON.stringify([definition.spec.encode(a), a.rest]) ===
52
+ JSON.stringify([definition.spec.encode(b), b.rest])
53
+ );
54
+ };
55
+
56
+ /**
57
+ * The node editor in the side panel (PLAN §7.4, spec §17.5). Opening it
58
+ * never changes which node Execute runs. Edits go to a draft, and only Apply,
59
+ * or closing the panel, stores them, as one undo step; Cancel drops them.
60
+ *
61
+ * The panel follows the cube (user's choice, 2026-10-07): when the node it
62
+ * shows is replaced or removed underneath it, by Undo, a re-check or a
63
+ * Remove, a panel with edits closes without applying them and says so; one
64
+ * without edits shows the new node, or closes when the node is gone.
65
+ */
66
+ export class CubeNodeEditorState {
67
+ readonly editorState: CubeEditorState;
68
+
69
+ /** The id of the node the panel shows, while it is open */
70
+ nodeId: string | undefined;
71
+ /** The key of the node the draft was made from */
72
+ private nodeKey: number | undefined;
73
+ draft: CubeNodeDraft | undefined;
74
+ /** Why the panel closed by itself, until it opens again or is dismissed */
75
+ notice: string | undefined;
76
+
77
+ private readonly disposeSync: IReactionDisposer;
78
+
79
+ constructor(editorState: CubeEditorState) {
80
+ makeObservable<CubeNodeEditorState, 'nodeKey' | 'sync'>(this, {
81
+ nodeId: observable,
82
+ nodeKey: observable,
83
+ draft: observable.ref,
84
+ notice: observable,
85
+ node: computed,
86
+ edited: computed,
87
+ hasChanges: computed,
88
+ open: action,
89
+ canSwapInputs: computed,
90
+ apply: action,
91
+ swapInputs: action,
92
+ close: action,
93
+ cancel: action,
94
+ discard: action,
95
+ dismissNotice: action,
96
+ sync: action,
97
+ });
98
+ this.editorState = editorState;
99
+ this.disposeSync = reaction(
100
+ () => this.node,
101
+ () => this.sync(),
102
+ );
103
+ }
104
+
105
+ /** The node the panel shows, as the cube has it now */
106
+ get node(): QueryNode | undefined {
107
+ return this.nodeId === undefined
108
+ ? undefined
109
+ : this.editorState.document.query.getNode(this.nodeId);
110
+ }
111
+
112
+ /** The node Apply would store, built once per edit */
113
+ get edited(): QueryNode | undefined {
114
+ return this.draft?.build();
115
+ }
116
+
117
+ /** The draft saves differently from the node it was made from */
118
+ get hasChanges(): boolean {
119
+ const { draft, edited } = this;
120
+ return (
121
+ draft !== undefined &&
122
+ edited !== undefined &&
123
+ !isSameNodeContent(this.editorState.registry, edited, draft.original)
124
+ );
125
+ }
126
+
127
+ /** Opens the panel on a node, closing (and so applying) the one it showed */
128
+ open(nodeId: string): void {
129
+ if (nodeId === this.nodeId) {
130
+ this.notice = undefined;
131
+ return;
132
+ }
133
+ const node = this.editorState.document.query.getNode(nodeId);
134
+ if (!node) {
135
+ return;
136
+ }
137
+ this.close();
138
+ this.notice = undefined;
139
+ this.bind(node);
140
+ }
141
+
142
+ /**
143
+ * Stores the draft in place of the node, as one undo step, and goes on
144
+ * editing the stored node. Does nothing without changes, or while the cube
145
+ * is read-only.
146
+ */
147
+ apply(): void {
148
+ const { node, edited } = this;
149
+ if (
150
+ !node ||
151
+ !edited ||
152
+ node.key !== this.nodeKey ||
153
+ !this.hasChanges ||
154
+ this.editorState.readOnly
155
+ ) {
156
+ return;
157
+ }
158
+ const { query } = this.editorState.document;
159
+ if (query.canReplace(edited)) {
160
+ this.editorState.applyQuery(query.replace(edited));
161
+ this.bind(edited);
162
+ }
163
+ }
164
+
165
+ get canSwapInputs(): boolean {
166
+ const { node } = this;
167
+ return (
168
+ node !== undefined &&
169
+ !this.editorState.readOnly &&
170
+ this.editorState.document.query.canSwapInputs(node.id)
171
+ );
172
+ }
173
+
174
+ /**
175
+ * Swaps the node's two inputs (a Join's Swap Inputs, spec §17.6), applying
176
+ * the draft first, as one undo step, then goes on editing the swapped
177
+ * node, whose settings followed its inputs
178
+ */
179
+ swapInputs(): void {
180
+ const { node, edited } = this;
181
+ if (!node || !edited || node.key !== this.nodeKey || !this.canSwapInputs) {
182
+ return;
183
+ }
184
+ let { query } = this.editorState.document;
185
+ if (this.hasChanges && query.canReplace(edited)) {
186
+ query = query.replace(edited);
187
+ }
188
+ query = query.swapInputs(node.id);
189
+ this.editorState.applyQuery(query);
190
+ this.bind(query.getNode(node.id) ?? node);
191
+ }
192
+
193
+ /** Applies the draft, then closes the panel (spec §17.5: edits commit on close) */
194
+ close(): void {
195
+ this.apply();
196
+ this.reset();
197
+ }
198
+
199
+ /** Closes the panel, dropping the draft */
200
+ cancel(): void {
201
+ this.reset();
202
+ }
203
+
204
+ /**
205
+ * Closes the panel without applying the draft, e.g. when another cube is
206
+ * opened, saying so when that drops edits
207
+ */
208
+ discard(reason: CUBE_EDITOR_CLOSED_REASON): void {
209
+ const { nodeId } = this;
210
+ if (nodeId !== undefined && this.hasChanges) {
211
+ this.notice = getEditorClosedNotice(nodeId, reason);
212
+ }
213
+ this.reset();
214
+ }
215
+
216
+ dismissNotice(): void {
217
+ this.notice = undefined;
218
+ }
219
+
220
+ /** Stops following the cube; call when the page closes */
221
+ dispose(): void {
222
+ this.disposeSync();
223
+ }
224
+
225
+ private bind(node: QueryNode): void {
226
+ this.nodeId = node.id;
227
+ this.nodeKey = node.key;
228
+ this.draft = createCubeNodeDraft(node, this.editorState);
229
+ }
230
+
231
+ private reset(): void {
232
+ this.nodeId = undefined;
233
+ this.nodeKey = undefined;
234
+ this.draft = undefined;
235
+ }
236
+
237
+ /** Runs whenever the node with the panel's id is another object, or gone */
238
+ private sync(): void {
239
+ const { node } = this;
240
+ if (this.nodeId === undefined || node?.key === this.nodeKey) {
241
+ return;
242
+ }
243
+ if (this.hasChanges) {
244
+ this.discard(
245
+ node
246
+ ? CUBE_EDITOR_CLOSED_REASON.NODE_CHANGED
247
+ : CUBE_EDITOR_CLOSED_REASON.NODE_REMOVED,
248
+ );
249
+ } else if (node) {
250
+ this.bind(node);
251
+ } else {
252
+ this.reset();
253
+ }
254
+ }
255
+ }
@@ -0,0 +1,96 @@
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
+
17
+ import type { GeneratorFn } from '@finos/legend-shared';
18
+ import { action, flow, makeObservable, observable } from 'mobx';
19
+ import {
20
+ CubeEngineError,
21
+ CubeEngineErrorKind,
22
+ } from '../graph-manager/CubeEngine.js';
23
+ import type { CubeEditorState } from './CubeEditorState.js';
24
+
25
+ /**
26
+ * Show Pure: the Pure text of what Execute would run, the capture node's
27
+ * execution lambda with the row limit, as the engine renders it. For display
28
+ * only: the text is never parsed back (PLAN §8.7).
29
+ */
30
+ export class CubeShowPureState {
31
+ readonly editorState: CubeEditorState;
32
+
33
+ isOpen = false;
34
+ text: string | undefined;
35
+ /** Why the engine couldn't render the query; shown in the dialog */
36
+ error: CubeEngineError | undefined;
37
+ isRendering = false;
38
+ /** Counts renders, so one that finishes after the dialog closed is dropped */
39
+ private request = 0;
40
+
41
+ constructor(editorState: CubeEditorState) {
42
+ makeObservable(this, {
43
+ isOpen: observable,
44
+ text: observable,
45
+ error: observable.ref,
46
+ isRendering: observable,
47
+ open: flow,
48
+ close: action,
49
+ });
50
+ this.editorState = editorState;
51
+ }
52
+
53
+ /** Opens the dialog and renders the query; does nothing when Execute can't run */
54
+ *open(): GeneratorFn<void> {
55
+ const { execution, document, emitter, rowLimit, host } = this.editorState;
56
+ const runtime = document.context?.runtime;
57
+ if (!execution.canExecute || runtime === undefined) {
58
+ return;
59
+ }
60
+ const request = ++this.request;
61
+ this.isOpen = true;
62
+ this.text = undefined;
63
+ this.error = undefined;
64
+ this.isRendering = true;
65
+ try {
66
+ const text = (yield host.engine.renderPure(
67
+ emitter.emitExecutionLambda({ rowLimit, runtime }),
68
+ )) as string;
69
+ if (request === this.request) {
70
+ this.text = text;
71
+ }
72
+ } catch (error) {
73
+ if (request === this.request) {
74
+ this.error =
75
+ error instanceof CubeEngineError
76
+ ? error
77
+ : new CubeEngineError(
78
+ CubeEngineErrorKind.COMPILE,
79
+ error instanceof Error ? error.message : String(error),
80
+ );
81
+ }
82
+ } finally {
83
+ if (request === this.request) {
84
+ this.isRendering = false;
85
+ }
86
+ }
87
+ }
88
+
89
+ close(): void {
90
+ this.request++;
91
+ this.isOpen = false;
92
+ this.isRendering = false;
93
+ this.text = undefined;
94
+ this.error = undefined;
95
+ }
96
+ }