@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,125 @@
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 { TypeFamily } from '@finos/legend-cube';
18
+ import type { CubeResultValue } from '../../graph-manager/CubeEngine.js';
19
+
20
+ // How the grid shows and sorts values (PLAN §9, Settled before M1.8).
21
+ // Integer and Decimal values arrive as their exact text and are never turned
22
+ // into JS numbers, which would lose digits.
23
+
24
+ const NUMERIC_FAMILIES: ReadonlySet<TypeFamily> = new Set([
25
+ TypeFamily.INTEGER,
26
+ TypeFamily.FLOAT,
27
+ TypeFamily.DECIMAL,
28
+ TypeFamily.NUMBER,
29
+ ]);
30
+
31
+ export const isNumericFamily = (family: TypeFamily): boolean =>
32
+ NUMERIC_FAMILIES.has(family);
33
+
34
+ const NUMBER_TEXT =
35
+ /^(?<sign>[+-]?)(?<whole>\d*)(?:\.(?<fraction>\d*))?(?:[eE](?<exponent>[+-]?\d+))?$/u;
36
+
37
+ /** A number's text as sign, digits without leading or trailing zeros, and the position of the decimal point */
38
+ const parseNumberText = (
39
+ text: string,
40
+ ): { negative: boolean; digits: string; point: number } | undefined => {
41
+ const groups = NUMBER_TEXT.exec(text.trim())?.groups;
42
+ if (!groups || (!groups.whole && !groups.fraction)) {
43
+ return undefined;
44
+ }
45
+ const {
46
+ sign,
47
+ whole = '',
48
+ fraction = '',
49
+ exponent = '0',
50
+ } = groups as Partial<Record<string, string>>;
51
+ const allDigits = whole + fraction;
52
+ const leadingZeros = allDigits.length - allDigits.replace(/^0+/u, '').length;
53
+ const digits = allDigits.slice(leadingZeros).replace(/0+$/u, '');
54
+ return {
55
+ negative: sign === '-' && digits !== '',
56
+ digits,
57
+ point: whole.length - leadingZeros + Number(exponent),
58
+ };
59
+ };
60
+
61
+ const compareMagnitudes = (
62
+ left: { digits: string; point: number },
63
+ right: { digits: string; point: number },
64
+ ): number => {
65
+ if (!left.digits || !right.digits) {
66
+ return (left.digits ? 1 : 0) - (right.digits ? 1 : 0);
67
+ }
68
+ if (left.point !== right.point) {
69
+ return left.point < right.point ? -1 : 1;
70
+ }
71
+ const length = Math.max(left.digits.length, right.digits.length);
72
+ const a = left.digits.padEnd(length, '0');
73
+ const b = right.digits.padEnd(length, '0');
74
+ return a === b ? 0 : a < b ? -1 : 1;
75
+ };
76
+
77
+ /** Compares two numbers written as text, digit for digit: `'9' < '10'`, `'9007199254740993' > '9007199254740992'` */
78
+ export const compareNumberText = (left: string, right: string): number => {
79
+ const a = parseNumberText(left);
80
+ const b = parseNumberText(right);
81
+ if (!a || !b) {
82
+ // not a number: keep a stable order by text
83
+ return left < right ? -1 : left > right ? 1 : 0;
84
+ }
85
+ if (a.negative !== b.negative) {
86
+ return a.negative ? -1 : 1;
87
+ }
88
+ const magnitude = compareMagnitudes(a, b);
89
+ return a.negative ? -magnitude : magnitude;
90
+ };
91
+
92
+ /** Orders a column's values: nulls first, then numbers by value whether they are JS numbers or exact text */
93
+ export const compareCellValues = (
94
+ left: CubeResultValue | undefined,
95
+ right: CubeResultValue | undefined,
96
+ ): number => {
97
+ if (
98
+ left === null ||
99
+ left === undefined ||
100
+ right === null ||
101
+ right === undefined
102
+ ) {
103
+ return (left ?? null) === null ? ((right ?? null) === null ? 0 : -1) : 1;
104
+ }
105
+ if (typeof left === 'number' && typeof right === 'number') {
106
+ return left - right;
107
+ }
108
+ if (
109
+ (typeof left === 'string' || typeof left === 'number') &&
110
+ (typeof right === 'string' || typeof right === 'number')
111
+ ) {
112
+ return compareNumberText(String(left), String(right));
113
+ }
114
+ return String(left) < String(right)
115
+ ? -1
116
+ : String(left) > String(right)
117
+ ? 1
118
+ : 0;
119
+ };
120
+
121
+ /** A run's duration for the toolbar: milliseconds under a second, else seconds */
122
+ export const formatDuration = (durationMs: number): string =>
123
+ durationMs < 1000
124
+ ? `${Math.round(durationMs)} ms`
125
+ : `${(durationMs / 1000).toFixed(1)} s`;
@@ -0,0 +1,84 @@
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 { clsx } from '@finos/legend-art';
18
+ import {
19
+ DataGrid,
20
+ type DataGridCellRendererParams,
21
+ type DataGridColumnDefinition,
22
+ } from '@finos/legend-lego/data-grid';
23
+ import { memo, useMemo } from 'react';
24
+ import { NULL_CELL_TEXT } from '../../__lib__/LegendCubeLabels.js';
25
+ import { LEGEND_CUBE_TEST_ID } from '../../__lib__/LegendCubeTesting.js';
26
+ import type { CubeResultValue } from '../../graph-manager/CubeEngine.js';
27
+ import type { CubeExecutionResult } from '../../stores/CubeExecutionState.js';
28
+ import { compareCellValues, isNumericFamily } from './CubeGridValues.js';
29
+
30
+ type CubeRow = readonly CubeResultValue[];
31
+
32
+ const CubeCell: React.FC<
33
+ DataGridCellRendererParams<CubeRow, CubeResultValue>
34
+ > = (props) =>
35
+ props.value === null || props.value === undefined ? (
36
+ <span className="text-[var(--color-text-muted)]">{NULL_CELL_TEXT}</span>
37
+ ) : (
38
+ <>{String(props.value)}</>
39
+ );
40
+
41
+ /**
42
+ * The rows of a run (PLAN §9): columns from Cube's own schema of the capture
43
+ * node, by position, so any column name works. Numbers are right-aligned and
44
+ * shown and sorted exactly as the engine wrote them.
45
+ */
46
+ export const CubeResultGrid = memo(
47
+ (props: { result: CubeExecutionResult; darkMode: boolean }) => {
48
+ const { result, darkMode } = props;
49
+ const columnDefs = useMemo(
50
+ (): DataGridColumnDefinition<CubeRow, CubeResultValue>[] =>
51
+ result.schema.columns.map((column, position) => {
52
+ const numeric = isNumericFamily(column.type.family);
53
+ return {
54
+ colId: `c${position}`,
55
+ headerName: column.name,
56
+ headerTooltip: `${column.type.displayName}${column.nullable ? '?' : ''} (${column.type.fullName})`,
57
+ valueGetter: (params) => params.data?.[position] ?? null,
58
+ cellRenderer: CubeCell,
59
+ ...(numeric
60
+ ? { type: 'rightAligned', comparator: compareCellValues }
61
+ : {}),
62
+ };
63
+ }),
64
+ [result],
65
+ );
66
+ return (
67
+ <div
68
+ className={clsx('h-full w-full', {
69
+ 'ag-theme-balham': !darkMode,
70
+ 'ag-theme-balham-dark': darkMode,
71
+ })}
72
+ data-testid={LEGEND_CUBE_TEST_ID.RESULT_GRID}
73
+ >
74
+ <DataGrid<CubeRow>
75
+ rowData={result.rows as CubeRow[]}
76
+ columnDefs={columnDefs}
77
+ suppressFieldDotNotation={true}
78
+ tooltipShowDelay={500}
79
+ />
80
+ </div>
81
+ );
82
+ },
83
+ );
84
+ CubeResultGrid.displayName = 'CubeResultGrid';
@@ -0,0 +1,177 @@
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 { ChevronLeftIcon, ChevronRightIcon, clsx } from '@finos/legend-art';
18
+ import type { AnyNodeDefinition } from '@finos/legend-cube';
19
+ import { observer } from 'mobx-react-lite';
20
+ import { useRef } from 'react';
21
+ import { useDrag } from 'react-dnd';
22
+ import { READ_ONLY_CUBE_TITLE } from '../../__lib__/LegendCubeLabels.js';
23
+ import { LEGEND_CUBE_TEST_ID } from '../../__lib__/LegendCubeTesting.js';
24
+ import type { CubeEditorState } from '../../stores/CubeEditorState.js';
25
+ import {
26
+ CUBE_DND_TYPE,
27
+ type CubePaletteDragItem,
28
+ } from '../canvas/CubeCanvasDnd.js';
29
+ import { CubeNodeIcon } from '../CubeNodeIcon.js';
30
+
31
+ /** Shown in the palette while the cube has no node yet (spec §17.2, worded for the canvas) */
32
+ export const PALETTE_EMPTY_HINT = 'Drag items onto the canvas.';
33
+
34
+ /** What an item does, for its tooltip */
35
+ const describeItem = (definition: AnyNodeDefinition): string =>
36
+ definition.kind === 'source'
37
+ ? 'Click, or drop it on the canvas, to pick a table'
38
+ : 'Drag it onto a node to add it after that node, or onto the canvas to add it on its own; click to add it on its own';
39
+
40
+ const CubePaletteItem = observer(
41
+ (props: {
42
+ editorState: CubeEditorState;
43
+ definition: AnyNodeDefinition;
44
+ collapsed: boolean;
45
+ }) => {
46
+ const { editorState, definition, collapsed } = props;
47
+ const { readOnly } = editorState;
48
+ const ref = useRef<HTMLDivElement>(null);
49
+ const [, dragConnector] = useDrag<CubePaletteDragItem>(
50
+ () => ({
51
+ type: CUBE_DND_TYPE.PALETTE_ITEM,
52
+ item: { nodeType: definition.type },
53
+ canDrag: () => !editorState.readOnly,
54
+ }),
55
+ [editorState, definition.type],
56
+ );
57
+ dragConnector(ref);
58
+ const label = `${definition.label}${definition.beta ? ' (BETA)' : ''}`;
59
+ const add = (): void => {
60
+ if (!readOnly) {
61
+ editorState.addNode(definition.type);
62
+ }
63
+ };
64
+ return (
65
+ // a div, not a button: browsers won't drag a button
66
+ <div
67
+ ref={ref}
68
+ role="button"
69
+ tabIndex={readOnly ? -1 : 0}
70
+ aria-disabled={readOnly}
71
+ aria-label={label}
72
+ className={clsx(
73
+ 'flex h-8 shrink-0 items-center gap-2 px-3 text-base',
74
+ readOnly
75
+ ? 'cursor-not-allowed text-[var(--color-text-disabled)]'
76
+ : 'cursor-grab hover:bg-[var(--color-bg-hover)]',
77
+ )}
78
+ title={
79
+ readOnly
80
+ ? READ_ONLY_CUBE_TITLE
81
+ : collapsed
82
+ ? `${label}: ${describeItem(definition)}`
83
+ : describeItem(definition)
84
+ }
85
+ onClick={add}
86
+ onKeyDown={(event) => {
87
+ if (event.key === 'Enter' || event.key === ' ') {
88
+ event.preventDefault();
89
+ add();
90
+ }
91
+ }}
92
+ data-testid={LEGEND_CUBE_TEST_ID.PALETTE_ITEM}
93
+ >
94
+ <CubeNodeIcon
95
+ icon={definition.icon}
96
+ className="shrink-0 text-[var(--color-text-secondary)]"
97
+ />
98
+ {!collapsed && (
99
+ <span className="min-w-0 flex-1 truncate">{definition.label}</span>
100
+ )}
101
+ {!collapsed && definition.beta && (
102
+ <span className="shrink-0 rounded-sm bg-[var(--color-accent)] px-1 text-xs font-medium text-[var(--color-text-on-accent)]">
103
+ BETA
104
+ </span>
105
+ )}
106
+ </div>
107
+ );
108
+ },
109
+ );
110
+
111
+ /**
112
+ * The sidebar of node types to add (spec §17.2): the sources, then the
113
+ * transforms in menu order, read from the registry, as the context menu is.
114
+ * Collapsed, it shows icons only; that choice is kept per user.
115
+ */
116
+ export const CubePalette = observer(
117
+ (props: { editorState: CubeEditorState }) => {
118
+ const { editorState } = props;
119
+ const collapsed = editorState.isPaletteCollapsed;
120
+ const { registry } = editorState;
121
+ return (
122
+ <div
123
+ className={clsx(
124
+ 'flex h-full shrink-0 flex-col border-r border-[var(--color-border-default)] bg-[var(--color-bg-panel)]',
125
+ collapsed ? 'w-10' : 'w-56',
126
+ )}
127
+ data-testid={LEGEND_CUBE_TEST_ID.PALETTE}
128
+ >
129
+ <div className="flex h-8 shrink-0 items-center border-b border-[var(--color-border-default)] bg-[var(--color-bg-panel-header)] px-2">
130
+ {!collapsed && (
131
+ <span className="min-w-0 flex-1 truncate text-base font-medium">
132
+ Add to the query
133
+ </span>
134
+ )}
135
+ <button
136
+ className="flex h-6 w-6 shrink-0 items-center justify-center text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]"
137
+ title={collapsed ? 'Expand the palette' : 'Collapse the palette'}
138
+ onClick={() => editorState.setPaletteCollapsed(!collapsed)}
139
+ >
140
+ {collapsed ? <ChevronRightIcon /> : <ChevronLeftIcon />}
141
+ </button>
142
+ </div>
143
+ <div
144
+ className="flex min-h-0 shrink flex-col overflow-auto py-1"
145
+ role="group"
146
+ aria-label="Palette"
147
+ >
148
+ {registry.sources.map((definition) => (
149
+ <CubePaletteItem
150
+ key={definition.type}
151
+ editorState={editorState}
152
+ definition={definition}
153
+ collapsed={collapsed}
154
+ />
155
+ ))}
156
+ <div
157
+ className="mx-2 my-1 shrink-0 border-t border-[var(--color-border-default)]"
158
+ role="separator"
159
+ />
160
+ {registry.transforms.map((definition) => (
161
+ <CubePaletteItem
162
+ key={definition.type}
163
+ editorState={editorState}
164
+ definition={definition}
165
+ collapsed={collapsed}
166
+ />
167
+ ))}
168
+ </div>
169
+ {!collapsed && editorState.document.query.isEmpty && (
170
+ <div className="shrink-0 px-3 py-2 text-sm text-[var(--color-text-muted)]">
171
+ {PALETTE_EMPTY_HINT}
172
+ </div>
173
+ )}
174
+ </div>
175
+ );
176
+ },
177
+ );
@@ -0,0 +1,101 @@
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 {
18
+ Dialog,
19
+ Modal,
20
+ ModalBody,
21
+ ModalFooter,
22
+ ModalFooterButton,
23
+ ModalHeader,
24
+ PanelLoadingIndicator,
25
+ } from '@finos/legend-art';
26
+ import { observer } from 'mobx-react-lite';
27
+ import { CUBE_PENDING_LABEL } from '../../__lib__/LegendCubeLabels.js';
28
+ import type { CubeEditorState } from '../../stores/CubeEditorState.js';
29
+
30
+ /** The Pure text of what Execute would run, read-only, with Copy */
31
+ export const CubeShowPureDialog = observer(
32
+ (props: { editorState: CubeEditorState }) => {
33
+ const { editorState } = props;
34
+ const showPure = editorState.showPure;
35
+ const { applicationStore } = editorState.host;
36
+ const darkMode =
37
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled;
38
+ const { text, error } = showPure;
39
+
40
+ return (
41
+ <Dialog open={showPure.isOpen} onClose={() => showPure.close()}>
42
+ <Modal darkMode={darkMode} className="w-[800px] max-w-full">
43
+ <ModalHeader>
44
+ <div className="modal__title">Pure query</div>
45
+ </ModalHeader>
46
+ <PanelLoadingIndicator isLoading={showPure.isRendering} />
47
+ <ModalBody>
48
+ <div className="flex flex-col gap-2">
49
+ {showPure.isRendering && (
50
+ <div className="text-base text-[var(--color-text-secondary)]">
51
+ {CUBE_PENDING_LABEL.RENDERING_QUERY}
52
+ </div>
53
+ )}
54
+ {text !== undefined && (
55
+ <pre
56
+ className="max-h-[60vh] overflow-auto whitespace-pre rounded-sm border border-[var(--color-border-default)] bg-[var(--color-bg-input)] p-2 font-mono text-sm text-[var(--color-text-primary)]"
57
+ aria-label="Pure query"
58
+ >
59
+ {text}
60
+ </pre>
61
+ )}
62
+ {error && (
63
+ <div
64
+ className="whitespace-pre-wrap break-words text-base text-[var(--color-status-error)]"
65
+ role="alert"
66
+ >
67
+ {error.detail}
68
+ </div>
69
+ )}
70
+ </div>
71
+ </ModalBody>
72
+ <ModalFooter>
73
+ <ModalFooterButton
74
+ darkMode={darkMode}
75
+ formatText={false}
76
+ text="Copy to Clipboard"
77
+ disabled={text === undefined}
78
+ onClick={() => {
79
+ if (text !== undefined) {
80
+ applicationStore.clipboardService
81
+ .copyTextToClipboard(text, {
82
+ notifySuccessMessage:
83
+ 'Pure query copied to the clipboard',
84
+ })
85
+ .catch(applicationStore.alertUnhandledError);
86
+ }
87
+ }}
88
+ />
89
+ <ModalFooterButton
90
+ darkMode={darkMode}
91
+ formatText={false}
92
+ type="secondary"
93
+ text="Close"
94
+ onClick={() => showPure.close()}
95
+ />
96
+ </ModalFooter>
97
+ </Modal>
98
+ </Dialog>
99
+ );
100
+ },
101
+ );