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

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 (379) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +64 -2
  3. package/docs/adding-an-operation.md +92 -0
  4. package/docs/hosting.md +79 -0
  5. package/docs/testing.md +83 -0
  6. package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
  7. package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
  8. package/lib/__lib__/LegendCubeCommand.js +40 -0
  9. package/lib/__lib__/LegendCubeCommand.js.map +1 -0
  10. package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
  11. package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
  12. package/lib/__lib__/LegendCubeHelpText.js +35 -0
  13. package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
  14. package/lib/__lib__/LegendCubeLabels.d.ts +87 -0
  15. package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
  16. package/lib/__lib__/LegendCubeLabels.js +128 -0
  17. package/lib/__lib__/LegendCubeLabels.js.map +1 -0
  18. package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
  19. package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
  20. package/lib/__lib__/LegendCubeTesting.js +34 -0
  21. package/lib/__lib__/LegendCubeTesting.js.map +1 -0
  22. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
  23. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
  24. package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
  25. package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
  26. package/lib/__test-utils__/CubeEngineTestSupport.d.ts +47 -0
  27. package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
  28. package/lib/__test-utils__/CubeEngineTestSupport.js +106 -0
  29. package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
  30. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
  31. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
  32. package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
  33. package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
  34. package/lib/__test-utils__/CubeOperationsTestUtils.d.ts +42 -0
  35. package/lib/__test-utils__/CubeOperationsTestUtils.d.ts.map +1 -0
  36. package/lib/__test-utils__/CubeOperationsTestUtils.js +92 -0
  37. package/lib/__test-utils__/CubeOperationsTestUtils.js.map +1 -0
  38. package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
  39. package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
  40. package/lib/__test-utils__/CubePageTestUtils.js +68 -0
  41. package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
  42. package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
  43. package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
  44. package/lib/__test-utils__/CubeTestApplication.js +57 -0
  45. package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
  46. package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
  47. package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
  48. package/lib/__test-utils__/FakeCubeEngine.js +91 -0
  49. package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
  50. package/lib/components/CubeButton.d.ts +20 -0
  51. package/lib/components/CubeButton.d.ts.map +1 -0
  52. package/lib/components/CubeButton.js +24 -0
  53. package/lib/components/CubeButton.js.map +1 -0
  54. package/lib/components/CubeEditor.d.ts +31 -0
  55. package/lib/components/CubeEditor.d.ts.map +1 -0
  56. package/lib/components/CubeEditor.js +90 -0
  57. package/lib/components/CubeEditor.js.map +1 -0
  58. package/lib/components/CubeNodeIcon.d.ts +23 -0
  59. package/lib/components/CubeNodeIcon.d.ts.map +1 -0
  60. package/lib/components/CubeNodeIcon.js +42 -0
  61. package/lib/components/CubeNodeIcon.js.map +1 -0
  62. package/lib/components/canvas/CubeCanvas.d.ts +37 -0
  63. package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
  64. package/lib/components/canvas/CubeCanvas.js +137 -0
  65. package/lib/components/canvas/CubeCanvas.js.map +1 -0
  66. package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
  67. package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
  68. package/lib/components/canvas/CubeCanvasContext.js +22 -0
  69. package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
  70. package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
  71. package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
  72. package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
  73. package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
  74. package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
  75. package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
  76. package/lib/components/canvas/CubeCanvasDnd.js +51 -0
  77. package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
  78. package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
  79. package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
  80. package/lib/components/canvas/CubeCanvasEdge.js +33 -0
  81. package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
  82. package/lib/components/canvas/CubeCanvasElements.d.ts +66 -0
  83. package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
  84. package/lib/components/canvas/CubeCanvasElements.js +97 -0
  85. package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
  86. package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
  87. package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
  88. package/lib/components/canvas/CubeCanvasLayout.js +63 -0
  89. package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
  90. package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
  91. package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
  92. package/lib/components/canvas/CubeCanvasNode.js +75 -0
  93. package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
  94. package/lib/components/editors/CubeColumnPicker.d.ts +47 -0
  95. package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
  96. package/lib/components/editors/CubeColumnPicker.js +56 -0
  97. package/lib/components/editors/CubeColumnPicker.js.map +1 -0
  98. package/lib/components/editors/CubeDistinctEditor.d.ts +23 -0
  99. package/lib/components/editors/CubeDistinctEditor.d.ts.map +1 -0
  100. package/lib/components/editors/CubeDistinctEditor.js +24 -0
  101. package/lib/components/editors/CubeDistinctEditor.js.map +1 -0
  102. package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
  103. package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
  104. package/lib/components/editors/CubeFilterEditor.js +90 -0
  105. package/lib/components/editors/CubeFilterEditor.js.map +1 -0
  106. package/lib/components/editors/CubeIntegerField.d.ts +29 -0
  107. package/lib/components/editors/CubeIntegerField.d.ts.map +1 -0
  108. package/lib/components/editors/CubeIntegerField.js +30 -0
  109. package/lib/components/editors/CubeIntegerField.js.map +1 -0
  110. package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
  111. package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
  112. package/lib/components/editors/CubeJoinEditor.js +84 -0
  113. package/lib/components/editors/CubeJoinEditor.js.map +1 -0
  114. package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
  115. package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
  116. package/lib/components/editors/CubeNodeEditorPanel.js +72 -0
  117. package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
  118. package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
  119. package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
  120. package/lib/components/editors/CubeNodeEditorRegistry.js +43 -0
  121. package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
  122. package/lib/components/editors/CubeRenameEditor.d.ts +26 -0
  123. package/lib/components/editors/CubeRenameEditor.d.ts.map +1 -0
  124. package/lib/components/editors/CubeRenameEditor.js +58 -0
  125. package/lib/components/editors/CubeRenameEditor.js.map +1 -0
  126. package/lib/components/editors/CubeRestrictEditor.d.ts +26 -0
  127. package/lib/components/editors/CubeRestrictEditor.d.ts.map +1 -0
  128. package/lib/components/editors/CubeRestrictEditor.js +23 -0
  129. package/lib/components/editors/CubeRestrictEditor.js.map +1 -0
  130. package/lib/components/editors/CubeRowCountEditor.d.ts +25 -0
  131. package/lib/components/editors/CubeRowCountEditor.d.ts.map +1 -0
  132. package/lib/components/editors/CubeRowCountEditor.js +38 -0
  133. package/lib/components/editors/CubeRowCountEditor.js.map +1 -0
  134. package/lib/components/editors/CubeSliceEditor.d.ts +25 -0
  135. package/lib/components/editors/CubeSliceEditor.d.ts.map +1 -0
  136. package/lib/components/editors/CubeSliceEditor.js +40 -0
  137. package/lib/components/editors/CubeSliceEditor.js.map +1 -0
  138. package/lib/components/editors/CubeSortEditor.d.ts +27 -0
  139. package/lib/components/editors/CubeSortEditor.d.ts.map +1 -0
  140. package/lib/components/editors/CubeSortEditor.js +72 -0
  141. package/lib/components/editors/CubeSortEditor.js.map +1 -0
  142. package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
  143. package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
  144. package/lib/components/editors/CubeSourceEditor.js +41 -0
  145. package/lib/components/editors/CubeSourceEditor.js.map +1 -0
  146. package/lib/components/editors/CubeValueEditor.d.ts +40 -0
  147. package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
  148. package/lib/components/editors/CubeValueEditor.js +178 -0
  149. package/lib/components/editors/CubeValueEditor.js.map +1 -0
  150. package/lib/components/grid/CubeGridRegion.d.ts +23 -0
  151. package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
  152. package/lib/components/grid/CubeGridRegion.js +94 -0
  153. package/lib/components/grid/CubeGridRegion.js.map +1 -0
  154. package/lib/components/grid/CubeGridValues.d.ts +25 -0
  155. package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
  156. package/lib/components/grid/CubeGridValues.js +95 -0
  157. package/lib/components/grid/CubeGridValues.js.map +1 -0
  158. package/lib/components/grid/CubeResultGrid.d.ts +39 -0
  159. package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
  160. package/lib/components/grid/CubeResultGrid.js +86 -0
  161. package/lib/components/grid/CubeResultGrid.js.map +1 -0
  162. package/lib/components/palette/CubePalette.d.ts +29 -0
  163. package/lib/components/palette/CubePalette.d.ts.map +1 -0
  164. package/lib/components/palette/CubePalette.js +73 -0
  165. package/lib/components/palette/CubePalette.js.map +1 -0
  166. package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
  167. package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
  168. package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
  169. package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
  170. package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
  171. package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
  172. package/lib/components/source-picker/CubeSourcePicker.js +89 -0
  173. package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
  174. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
  175. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
  176. package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
  177. package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
  178. package/lib/graph-manager/CubeEngine.d.ts +128 -0
  179. package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
  180. package/lib/graph-manager/CubeEngine.js +61 -0
  181. package/lib/graph-manager/CubeEngine.js.map +1 -0
  182. package/lib/graph-manager/CubeModelOutlineHelper.d.ts +33 -0
  183. package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
  184. package/lib/graph-manager/CubeModelOutlineHelper.js +45 -0
  185. package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
  186. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
  187. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
  188. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
  189. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
  190. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
  191. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
  192. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
  193. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
  194. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
  195. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
  196. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
  197. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
  198. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
  199. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
  200. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
  201. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
  202. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
  203. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
  204. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +174 -0
  205. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
  206. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
  207. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
  208. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
  209. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
  210. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
  211. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
  212. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
  213. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
  214. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
  215. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
  216. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
  217. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
  218. package/lib/index.css +17 -0
  219. package/lib/index.css.map +1 -0
  220. package/lib/index.d.ts +25 -0
  221. package/lib/index.d.ts.map +1 -0
  222. package/lib/index.js +24 -0
  223. package/lib/index.js.map +1 -0
  224. package/lib/stores/CubeEditorState.d.ts +236 -0
  225. package/lib/stores/CubeEditorState.d.ts.map +1 -0
  226. package/lib/stores/CubeEditorState.js +632 -0
  227. package/lib/stores/CubeEditorState.js.map +1 -0
  228. package/lib/stores/CubeExecutionState.d.ts +67 -0
  229. package/lib/stores/CubeExecutionState.d.ts.map +1 -0
  230. package/lib/stores/CubeExecutionState.js +212 -0
  231. package/lib/stores/CubeExecutionState.js.map +1 -0
  232. package/lib/stores/CubeGridQuickActions.d.ts +40 -0
  233. package/lib/stores/CubeGridQuickActions.d.ts.map +1 -0
  234. package/lib/stores/CubeGridQuickActions.js +86 -0
  235. package/lib/stores/CubeGridQuickActions.js.map +1 -0
  236. package/lib/stores/CubeHost.d.ts +31 -0
  237. package/lib/stores/CubeHost.d.ts.map +1 -0
  238. package/lib/stores/CubeHost.js +17 -0
  239. package/lib/stores/CubeHost.js.map +1 -0
  240. package/lib/stores/CubeNodeEditorState.d.ts +103 -0
  241. package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
  242. package/lib/stores/CubeNodeEditorState.js +262 -0
  243. package/lib/stores/CubeNodeEditorState.js.map +1 -0
  244. package/lib/stores/CubeShowPureState.d.ts +41 -0
  245. package/lib/stores/CubeShowPureState.d.ts.map +1 -0
  246. package/lib/stores/CubeShowPureState.js +100 -0
  247. package/lib/stores/CubeShowPureState.js.map +1 -0
  248. package/lib/stores/CubeSourcePickerState.d.ts +98 -0
  249. package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
  250. package/lib/stores/CubeSourcePickerState.js +334 -0
  251. package/lib/stores/CubeSourcePickerState.js.map +1 -0
  252. package/lib/stores/CubeSpecTransferState.d.ts +60 -0
  253. package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
  254. package/lib/stores/CubeSpecTransferState.js +167 -0
  255. package/lib/stores/CubeSpecTransferState.js.map +1 -0
  256. package/lib/stores/LocalModelCatalog.d.ts +37 -0
  257. package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
  258. package/lib/stores/LocalModelCatalog.js +49 -0
  259. package/lib/stores/LocalModelCatalog.js.map +1 -0
  260. package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
  261. package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
  262. package/lib/stores/editors/CubeFilterDraft.js +186 -0
  263. package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
  264. package/lib/stores/editors/CubeIntegerText.d.ts +24 -0
  265. package/lib/stores/editors/CubeIntegerText.d.ts.map +1 -0
  266. package/lib/stores/editors/CubeIntegerText.js +33 -0
  267. package/lib/stores/editors/CubeIntegerText.js.map +1 -0
  268. package/lib/stores/editors/CubeJoinDraft.d.ts +71 -0
  269. package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
  270. package/lib/stores/editors/CubeJoinDraft.js +145 -0
  271. package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
  272. package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
  273. package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
  274. package/lib/stores/editors/CubeNodeDraft.js +35 -0
  275. package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
  276. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +35 -0
  277. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
  278. package/lib/stores/editors/CubeNodeDraftRegistry.js +55 -0
  279. package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
  280. package/lib/stores/editors/CubeRenameDraft.d.ts +44 -0
  281. package/lib/stores/editors/CubeRenameDraft.d.ts.map +1 -0
  282. package/lib/stores/editors/CubeRenameDraft.js +79 -0
  283. package/lib/stores/editors/CubeRenameDraft.js.map +1 -0
  284. package/lib/stores/editors/CubeRestrictDraft.d.ts +37 -0
  285. package/lib/stores/editors/CubeRestrictDraft.d.ts.map +1 -0
  286. package/lib/stores/editors/CubeRestrictDraft.js +73 -0
  287. package/lib/stores/editors/CubeRestrictDraft.js.map +1 -0
  288. package/lib/stores/editors/CubeRowCountDraft.d.ts +42 -0
  289. package/lib/stores/editors/CubeRowCountDraft.d.ts.map +1 -0
  290. package/lib/stores/editors/CubeRowCountDraft.js +55 -0
  291. package/lib/stores/editors/CubeRowCountDraft.js.map +1 -0
  292. package/lib/stores/editors/CubeSliceDraft.d.ts +42 -0
  293. package/lib/stores/editors/CubeSliceDraft.d.ts.map +1 -0
  294. package/lib/stores/editors/CubeSliceDraft.js +72 -0
  295. package/lib/stores/editors/CubeSliceDraft.js.map +1 -0
  296. package/lib/stores/editors/CubeSortDraft.d.ts +49 -0
  297. package/lib/stores/editors/CubeSortDraft.d.ts.map +1 -0
  298. package/lib/stores/editors/CubeSortDraft.js +99 -0
  299. package/lib/stores/editors/CubeSortDraft.js.map +1 -0
  300. package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
  301. package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
  302. package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
  303. package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
  304. package/package.json +81 -3
  305. package/src/__lib__/LegendCubeCommand.ts +44 -0
  306. package/src/__lib__/LegendCubeHelpText.ts +58 -0
  307. package/src/__lib__/LegendCubeLabels.ts +171 -0
  308. package/src/__lib__/LegendCubeTesting.ts +33 -0
  309. package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
  310. package/src/__test-utils__/CubeEngineTestSupport.ts +172 -0
  311. package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
  312. package/src/__test-utils__/CubeOperationsTestUtils.ts +177 -0
  313. package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
  314. package/src/__test-utils__/CubeTestApplication.ts +82 -0
  315. package/src/__test-utils__/FakeCubeEngine.ts +145 -0
  316. package/src/components/CubeButton.tsx +35 -0
  317. package/src/components/CubeEditor.tsx +239 -0
  318. package/src/components/CubeNodeIcon.tsx +64 -0
  319. package/src/components/canvas/CubeCanvas.tsx +262 -0
  320. package/src/components/canvas/CubeCanvasContext.ts +31 -0
  321. package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
  322. package/src/components/canvas/CubeCanvasDnd.ts +82 -0
  323. package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
  324. package/src/components/canvas/CubeCanvasElements.ts +153 -0
  325. package/src/components/canvas/CubeCanvasLayout.ts +88 -0
  326. package/src/components/canvas/CubeCanvasNode.tsx +149 -0
  327. package/src/components/editors/CubeColumnPicker.tsx +138 -0
  328. package/src/components/editors/CubeDistinctEditor.tsx +28 -0
  329. package/src/components/editors/CubeFilterEditor.tsx +309 -0
  330. package/src/components/editors/CubeIntegerField.tsx +51 -0
  331. package/src/components/editors/CubeJoinEditor.tsx +247 -0
  332. package/src/components/editors/CubeNodeEditorPanel.tsx +215 -0
  333. package/src/components/editors/CubeNodeEditorRegistry.ts +81 -0
  334. package/src/components/editors/CubeRenameEditor.tsx +143 -0
  335. package/src/components/editors/CubeRestrictEditor.tsx +103 -0
  336. package/src/components/editors/CubeRowCountEditor.tsx +53 -0
  337. package/src/components/editors/CubeSliceEditor.tsx +69 -0
  338. package/src/components/editors/CubeSortEditor.tsx +206 -0
  339. package/src/components/editors/CubeSourceEditor.tsx +106 -0
  340. package/src/components/editors/CubeValueEditor.tsx +333 -0
  341. package/src/components/grid/CubeGridRegion.tsx +275 -0
  342. package/src/components/grid/CubeGridValues.ts +125 -0
  343. package/src/components/grid/CubeResultGrid.tsx +138 -0
  344. package/src/components/palette/CubePalette.tsx +177 -0
  345. package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
  346. package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
  347. package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
  348. package/src/graph-manager/CubeEngine.ts +169 -0
  349. package/src/graph-manager/CubeModelOutlineHelper.ts +58 -0
  350. package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
  351. package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
  352. package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
  353. package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
  354. package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +243 -0
  355. package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
  356. package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
  357. package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +127 -0
  358. package/src/index.ts +41 -0
  359. package/src/stores/CubeEditorState.ts +807 -0
  360. package/src/stores/CubeExecutionState.ts +288 -0
  361. package/src/stores/CubeGridQuickActions.ts +129 -0
  362. package/src/stores/CubeHost.ts +32 -0
  363. package/src/stores/CubeNodeEditorState.ts +324 -0
  364. package/src/stores/CubeShowPureState.ts +118 -0
  365. package/src/stores/CubeSourcePickerState.ts +426 -0
  366. package/src/stores/CubeSpecTransferState.ts +198 -0
  367. package/src/stores/LocalModelCatalog.ts +70 -0
  368. package/src/stores/editors/CubeFilterDraft.ts +241 -0
  369. package/src/stores/editors/CubeIntegerText.ts +34 -0
  370. package/src/stores/editors/CubeJoinDraft.ts +224 -0
  371. package/src/stores/editors/CubeNodeDraft.ts +46 -0
  372. package/src/stores/editors/CubeNodeDraftRegistry.ts +83 -0
  373. package/src/stores/editors/CubeRenameDraft.ts +110 -0
  374. package/src/stores/editors/CubeRestrictDraft.ts +83 -0
  375. package/src/stores/editors/CubeRowCountDraft.ts +69 -0
  376. package/src/stores/editors/CubeSliceDraft.ts +87 -0
  377. package/src/stores/editors/CubeSortDraft.ts +135 -0
  378. package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
  379. package/tsconfig.json +133 -0
@@ -0,0 +1,165 @@
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
+ ColumnComparisonFilter,
19
+ CompositeFilter,
20
+ CompositeFilterOperator,
21
+ Connection,
22
+ Filter,
23
+ FilterOperator,
24
+ type FilterRule,
25
+ Join,
26
+ JoinType,
27
+ PrimitiveType,
28
+ Query,
29
+ RelationalTableSource,
30
+ Schema,
31
+ SchemaColumn,
32
+ } from '@finos/legend-cube';
33
+
34
+ // Cube queries over Northwind, typed as the engine types the Cube fixture
35
+ // (PLAN §8.5), for the serializer's and the engine's tests
36
+
37
+ export const NORTHWIND_DATABASE =
38
+ 'showcase::northwind::store::NorthwindDatabase';
39
+ export const NORTHWIND_RUNTIME = 'showcase::northwind::mapping::StoreRuntime';
40
+
41
+ const P = 'meta::pure::precisePrimitives::';
42
+
43
+ const column = (
44
+ name: string,
45
+ path: string,
46
+ nullable = true,
47
+ params: number[] = [],
48
+ ): SchemaColumn =>
49
+ new SchemaColumn(name, PrimitiveType.get(path, params), nullable);
50
+ const varchar = (name: string, length: number, nullable = true): SchemaColumn =>
51
+ column(name, `${P}Varchar`, nullable, [length]);
52
+ const smallInt = (name: string, nullable = true): SchemaColumn =>
53
+ column(name, `${P}SmallInt`, nullable);
54
+ const date = (name: string): SchemaColumn => column(name, 'StrictDate');
55
+
56
+ export const ORDERS_COLUMNS = [
57
+ smallInt('ORDER_ID', false),
58
+ varchar('CUSTOMER_ID', 5),
59
+ smallInt('EMPLOYEE_ID'),
60
+ date('ORDER_DATE'),
61
+ date('REQUIRED_DATE'),
62
+ date('SHIPPED_DATE'),
63
+ smallInt('SHIP_VIA'),
64
+ column('FREIGHT', `${P}Double`),
65
+ varchar('SHIP_NAME', 40),
66
+ varchar('SHIP_ADDRESS', 60),
67
+ varchar('SHIP_CITY', 15),
68
+ varchar('SHIP_REGION', 15),
69
+ varchar('SHIP_POSTAL_CODE', 10),
70
+ varchar('SHIP_COUNTRY', 15),
71
+ ];
72
+
73
+ export const CUSTOMERS_COLUMNS = [
74
+ varchar('CUSTOMER_ID', 5, false),
75
+ varchar('COMPANY_NAME', 40, false),
76
+ varchar('CONTACT_NAME', 30),
77
+ varchar('CONTACT_TITLE', 30),
78
+ varchar('ADDRESS', 60),
79
+ varchar('CITY', 15),
80
+ varchar('REGION', 15),
81
+ varchar('POSTAL_CODE', 10),
82
+ varchar('COUNTRY', 15),
83
+ varchar('PHONE', 24),
84
+ varchar('FAX', 24),
85
+ ];
86
+
87
+ export const northwindTable = (
88
+ id: string,
89
+ name: string,
90
+ columns: SchemaColumn[],
91
+ ): RelationalTableSource =>
92
+ new RelationalTableSource(
93
+ id,
94
+ { database: NORTHWIND_DATABASE, schema: 'NORTHWIND', table: name },
95
+ { kind: 'resolved', schema: new Schema(columns) },
96
+ );
97
+
98
+ /** France since 1997, by employees 1 and 4 (PLAN §8.5) */
99
+ export const SLICE_FILTER: FilterRule = new CompositeFilter(
100
+ CompositeFilterOperator.AND,
101
+ [
102
+ new ColumnComparisonFilter('SHIP_COUNTRY', FilterOperator.EQUAL, {
103
+ kind: 'string',
104
+ value: 'France',
105
+ }),
106
+ new ColumnComparisonFilter(
107
+ 'ORDER_DATE',
108
+ FilterOperator.GREATER_THAN_OR_EQUAL,
109
+ { kind: 'strictDate', value: '1997-01-01' },
110
+ ),
111
+ new ColumnComparisonFilter('EMPLOYEE_ID', FilterOperator.IN, [
112
+ { kind: 'integer', value: '1' },
113
+ { kind: 'integer', value: '4' },
114
+ ]),
115
+ ],
116
+ );
117
+
118
+ /** The slice (PLAN §8.5): ORDERS ⋈ CUSTOMERS on CUSTOMER_ID, then the filter, captured at the filter */
119
+ export const sliceQuery = (
120
+ filter: FilterRule = SLICE_FILTER,
121
+ joinType = JoinType.INNER,
122
+ ): Query =>
123
+ new Query(
124
+ [
125
+ northwindTable('relational101', 'ORDERS', ORDERS_COLUMNS),
126
+ northwindTable('relational102', 'CUSTOMERS', CUSTOMERS_COLUMNS),
127
+ new Join('join101', {
128
+ leftColumns: ['CUSTOMER_ID'],
129
+ rightColumns: ['CUSTOMER_ID'],
130
+ joinType,
131
+ }),
132
+ new Filter('filter101', filter),
133
+ ],
134
+ [
135
+ new Connection('relational101', 'join101', 'leftTds'),
136
+ new Connection('relational102', 'join101', 'rightTds'),
137
+ new Connection('join101', 'filter101', 'tds'),
138
+ ],
139
+ 'filter101',
140
+ );
141
+
142
+ /**
143
+ * ORDERS ⟗ a CUSTOMERS-like table on CUSTOMER_ID, nullable on both sides with
144
+ * different lengths (so `toOne()`, a merge and a cast), captured at the join
145
+ */
146
+ export const fullJoinQuery = (): Query =>
147
+ new Query(
148
+ [
149
+ northwindTable('relational101', 'ORDERS', ORDERS_COLUMNS),
150
+ northwindTable('relational102', 'CUSTOMERS', [
151
+ varchar('CUSTOMER_ID', 40),
152
+ varchar('COMPANY_NAME', 40),
153
+ ]),
154
+ new Join('join101', {
155
+ leftColumns: ['CUSTOMER_ID'],
156
+ rightColumns: ['CUSTOMER_ID'],
157
+ joinType: JoinType.FULL_OUTER,
158
+ }),
159
+ ],
160
+ [
161
+ new Connection('relational101', 'join101', 'leftTds'),
162
+ new Connection('relational102', 'join101', 'rightTds'),
163
+ ],
164
+ 'join101',
165
+ );
@@ -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 { expect } from '@jest/globals';
18
+ import {
19
+ buildSchemasAndValidity,
20
+ Connection,
21
+ createNodeRegistry,
22
+ Query,
23
+ type QueryNode,
24
+ QueryEmitter,
25
+ RelationalTableSource,
26
+ Schema,
27
+ } from '@finos/legend-cube';
28
+ import type {
29
+ CubeEngine,
30
+ CubeResult,
31
+ CubeResultValue,
32
+ } from '../graph-manager/CubeEngine.js';
33
+ import {
34
+ CUBE_NORTHWIND_DATABASE,
35
+ CUBE_NORTHWIND_MODEL,
36
+ CUBE_NORTHWIND_RUNTIME,
37
+ } from '../stores/fixtures/CubeNorthwindModel.js';
38
+
39
+ // Helpers for engine tests of operations on the Cube Northwind fixture,
40
+ // through the engine port only (no V1 classes), so any CubeEngine works
41
+
42
+ /** A table of the Cube Northwind model, not resolved yet */
43
+ export const TEST__northwindTable = (
44
+ id: string,
45
+ table: string,
46
+ schema = 'NORTHWIND',
47
+ ): RelationalTableSource =>
48
+ new RelationalTableSource(id, {
49
+ database: CUBE_NORTHWIND_DATABASE,
50
+ schema,
51
+ table,
52
+ });
53
+
54
+ /** The sources, resolved through the engine as the editor resolves them */
55
+ export const TEST__resolveSources = async (
56
+ engine: CubeEngine,
57
+ sources: readonly RelationalTableSource[],
58
+ ): Promise<RelationalTableSource[]> => {
59
+ const typed = await engine.resolveSchemas(
60
+ CUBE_NORTHWIND_MODEL,
61
+ new Map(
62
+ sources.map((source) => [
63
+ source.id,
64
+ [source.database, source.schema, source.table] as const,
65
+ ]),
66
+ ),
67
+ );
68
+ return sources.map((source) => {
69
+ const schema = typed.get(source.id);
70
+ if (!(schema instanceof Schema)) {
71
+ throw schema ?? new Error(`No schema for ${source.id}`);
72
+ }
73
+ return source.withResolution({ kind: 'resolved', schema });
74
+ });
75
+ };
76
+
77
+ /** A chain of nodes, each feeding the next on its first port, captured at the last */
78
+ export const TEST__chainOf = (nodes: readonly QueryNode[]): Query =>
79
+ new Query(
80
+ nodes,
81
+ nodes
82
+ .slice(1)
83
+ .map(
84
+ (node, index) =>
85
+ new Connection(
86
+ (nodes[index] as QueryNode).id,
87
+ node.id,
88
+ node.ports[0] as string,
89
+ ),
90
+ ),
91
+ nodes.at(-1)?.id,
92
+ );
93
+
94
+ /** Every node of the query is valid */
95
+ export const TEST__expectValidQuery = (query: Query): void => {
96
+ const { validity } = buildSchemasAndValidity(
97
+ query,
98
+ createNodeRegistry().queryRules,
99
+ );
100
+ expect([...validity].filter(([, errors]) => errors.length)).toEqual([]);
101
+ };
102
+
103
+ /**
104
+ * Runs the query up to its capture node, with this row limit; with a database
105
+ * type, written as for that database (on the fixture's H2 all the same, so a
106
+ * workaround's rows can be checked)
107
+ */
108
+ export const TEST__runQuery = async (
109
+ engine: CubeEngine,
110
+ query: Query,
111
+ rowLimit: number,
112
+ databaseType?: string,
113
+ ): Promise<CubeResult> => {
114
+ TEST__expectValidQuery(query);
115
+ return engine.execute(
116
+ CUBE_NORTHWIND_MODEL,
117
+ new QueryEmitter(query).emitExecutionLambda({
118
+ rowLimit,
119
+ runtime: CUBE_NORTHWIND_RUNTIME,
120
+ databaseType,
121
+ }),
122
+ );
123
+ };
124
+
125
+ /** The values of one column of a result */
126
+ export const TEST__columnValues = (
127
+ result: CubeResult,
128
+ column: string,
129
+ ): CubeResultValue[] => {
130
+ const index = result.columns.indexOf(column);
131
+ expect(index).toBeGreaterThanOrEqual(0);
132
+ return result.rows.map((row) => row[index] ?? null);
133
+ };
134
+
135
+ /** The schema Cube infers for a node of the query, its capture node by default */
136
+ export const TEST__inferredSchema = (
137
+ query: Query,
138
+ nodeId = query.selected ?? '',
139
+ ): Schema => {
140
+ const schema = buildSchemasAndValidity(
141
+ query,
142
+ createNodeRegistry().queryRules,
143
+ ).schemas.get(nodeId);
144
+ expect(schema).toBeDefined();
145
+ return schema as Schema;
146
+ };
147
+
148
+ /**
149
+ * The engine types the node as Cube infers it: the same names, in the same
150
+ * order, of the same types and parameters. Cube's nullability may only be
151
+ * wider, since the engine misreports it after outer joins (PLAN §4.7).
152
+ */
153
+ export const TEST__expectEngineTyping = async (
154
+ engine: CubeEngine,
155
+ query: Query,
156
+ nodeId = query.selected ?? '',
157
+ ): Promise<void> => {
158
+ const cube = TEST__inferredSchema(query, nodeId);
159
+ const typed = (
160
+ await engine.typeLambdas(
161
+ CUBE_NORTHWIND_MODEL,
162
+ new Map([[nodeId, new QueryEmitter(query).emitTypingLambda(nodeId)]]),
163
+ )
164
+ ).get(nodeId);
165
+ expect(typed).toBeInstanceOf(Schema);
166
+ const engineSchema = typed as Schema;
167
+ expect(
168
+ cube.columns.map((column) => [column.name, column.type.fullName]),
169
+ ).toEqual(
170
+ engineSchema.columns.map((column) => [column.name, column.type.fullName]),
171
+ );
172
+ cube.columns.forEach((column, index) => {
173
+ if (engineSchema.columns[index]?.nullable) {
174
+ expect([column.name, column.nullable]).toEqual([column.name, true]);
175
+ }
176
+ });
177
+ };
@@ -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 {
18
+ ApplicationFrameworkProvider,
19
+ ApplicationStoreProvider,
20
+ type GenericLegendApplicationStore,
21
+ } from '@finos/legend-application';
22
+ import { TEST__BrowserEnvironmentProvider } from '@finos/legend-application/test';
23
+ import type { CubeDocument } from '@finos/legend-cube';
24
+ import {
25
+ act,
26
+ type RenderResult,
27
+ render,
28
+ waitFor,
29
+ } from '@testing-library/react';
30
+ import type { CubeEditorState } from '../stores/CubeEditorState.js';
31
+
32
+ /** React Flow watches the canvas with an IntersectionObserver, which jsdom lacks */
33
+ class TEST__IntersectionObserver {
34
+ observe(): void {
35
+ // nothing is ever in view under jsdom
36
+ }
37
+ unobserve(): void {
38
+ // nothing to stop watching
39
+ }
40
+ disconnect(): void {
41
+ // nothing to stop watching
42
+ }
43
+ takeRecords(): IntersectionObserverEntry[] {
44
+ return [];
45
+ }
46
+ }
47
+
48
+ /** Lets the canvas mount under jsdom; call before rendering it */
49
+ export const TEST__installCanvasDomStubs = (): void => {
50
+ if (!('IntersectionObserver' in window)) {
51
+ Object.defineProperty(window, 'IntersectionObserver', {
52
+ configurable: true,
53
+ writable: true,
54
+ value: TEST__IntersectionObserver,
55
+ });
56
+ }
57
+ };
58
+
59
+ /**
60
+ * Renders an element inside a Legend application, as a host would, and waits
61
+ * for the element with the given test id: the framework renders nothing until
62
+ * the application store has initialized
63
+ */
64
+ export const TEST__renderInCubeApplication = async (
65
+ element: React.ReactNode,
66
+ applicationStore: GenericLegendApplicationStore,
67
+ readyTestId: string,
68
+ ): Promise<RenderResult> => {
69
+ TEST__installCanvasDomStubs();
70
+ const renderResult = render(
71
+ <ApplicationStoreProvider store={applicationStore}>
72
+ <TEST__BrowserEnvironmentProvider initialEntries={['/']}>
73
+ <ApplicationFrameworkProvider>{element}</ApplicationFrameworkProvider>
74
+ </TEST__BrowserEnvironmentProvider>
75
+ </ApplicationStoreProvider>,
76
+ );
77
+ await waitFor(() => renderResult.getByTestId(readyTestId));
78
+ return renderResult;
79
+ };
80
+
81
+ /**
82
+ * Imports a cube into a rendered page, as Import does, and waits for its
83
+ * tables to be typed again, so nothing changes after the test has ended
84
+ */
85
+ export const TEST__importDocument = async (
86
+ editorState: CubeEditorState,
87
+ document: CubeDocument,
88
+ readOnly = false,
89
+ ): Promise<void> => {
90
+ act(() => editorState.importDocument(document, readOnly));
91
+ await waitFor(() => {
92
+ if (editorState.isResolvingSources) {
93
+ throw new Error('The imported tables are still being typed');
94
+ }
95
+ });
96
+ };
@@ -0,0 +1,82 @@
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
+ ApplicationStore,
19
+ type GenericLegendApplicationStore,
20
+ LegendApplicationConfig,
21
+ type LegendApplicationPlugin,
22
+ LegendApplicationPluginManager,
23
+ } from '@finos/legend-application';
24
+ import { TEST__getApplicationVersionData } from '@finos/legend-application/test';
25
+ import type { CubeHost } from '../stores/CubeHost.js';
26
+ import { LocalModelCatalog } from '../stores/LocalModelCatalog.js';
27
+ import {
28
+ createFakeCubeEngine,
29
+ type FakeCubeEngine,
30
+ type FakeCubeEngineAnswers,
31
+ } from './FakeCubeEngine.js';
32
+
33
+ // A bare Legend application for Cube's jsdom tests, as the data-space viewer's
34
+ // tests build theirs: the builder may not use the query builder's test helpers
35
+
36
+ export class TEST__LegendCubePluginManager extends LegendApplicationPluginManager<LegendApplicationPlugin> {
37
+ private constructor() {
38
+ super();
39
+ }
40
+
41
+ static create(): TEST__LegendCubePluginManager {
42
+ return new TEST__LegendCubePluginManager();
43
+ }
44
+ }
45
+
46
+ class TEST__LegendCubeApplicationConfig extends LegendApplicationConfig {
47
+ override getDefaultApplicationStorageKey(): string {
48
+ return 'test';
49
+ }
50
+ }
51
+
52
+ /** A fresh application store: build one per test, since it initializes once */
53
+ export const TEST__createCubeApplicationStore = (
54
+ plugins: LegendApplicationPlugin[] = [],
55
+ ): GenericLegendApplicationStore => {
56
+ const pluginManager = TEST__LegendCubePluginManager.create();
57
+ pluginManager.usePlugins(plugins).install();
58
+ return new ApplicationStore(
59
+ new TEST__LegendCubeApplicationConfig({
60
+ configData: { env: 'TEST', appName: 'TEST' },
61
+ versionData: TEST__getApplicationVersionData(),
62
+ baseAddress: '/',
63
+ }),
64
+ pluginManager,
65
+ );
66
+ };
67
+
68
+ /** A host over a fake engine, with the bundled models */
69
+ export const TEST__createCubeHost = (
70
+ answers?: FakeCubeEngineAnswers,
71
+ applicationStore = TEST__createCubeApplicationStore(),
72
+ ): { host: CubeHost; fake: FakeCubeEngine } => {
73
+ const fake = createFakeCubeEngine(answers);
74
+ return {
75
+ host: {
76
+ applicationStore,
77
+ engine: fake.engine,
78
+ modelCatalog: new LocalModelCatalog(fake.engine),
79
+ },
80
+ fake,
81
+ };
82
+ };
@@ -0,0 +1,145 @@
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 { jest } from '@jest/globals';
18
+ import { Schema } from '@finos/legend-cube';
19
+ import {
20
+ type CubeEngine,
21
+ CubeEngineError,
22
+ CubeEngineErrorKind,
23
+ type CubeModelOutline,
24
+ type CubeResult,
25
+ } from '../graph-manager/CubeEngine.js';
26
+ import {
27
+ CUSTOMERS_COLUMNS,
28
+ NORTHWIND_DATABASE,
29
+ NORTHWIND_RUNTIME,
30
+ ORDERS_COLUMNS,
31
+ } from './CubeNorthwindTestQueries.js';
32
+
33
+ // A CubeEngine for jsdom tests (PLAN §11.1 M1.8a): canned answers, no network.
34
+ // Each method is a jest.fn, kept in its own variable so tests can read its
35
+ // calls or change its answer.
36
+
37
+ /** Northwind as the fake knows it: two tables, one runtime keyed by the database */
38
+ export const FAKE_NORTHWIND_OUTLINE: CubeModelOutline = {
39
+ databases: [
40
+ {
41
+ path: NORTHWIND_DATABASE,
42
+ schemas: [
43
+ {
44
+ name: 'NORTHWIND',
45
+ tables: [
46
+ {
47
+ name: 'ORDERS',
48
+ isView: false,
49
+ columnCount: ORDERS_COLUMNS.length,
50
+ flags: [],
51
+ untypedColumns: [],
52
+ },
53
+ {
54
+ name: 'CUSTOMERS',
55
+ isView: false,
56
+ columnCount: CUSTOMERS_COLUMNS.length,
57
+ flags: [],
58
+ untypedColumns: [],
59
+ },
60
+ ],
61
+ },
62
+ ],
63
+ },
64
+ ],
65
+ runtimes: [
66
+ {
67
+ path: NORTHWIND_RUNTIME,
68
+ storePaths: [NORTHWIND_DATABASE],
69
+ connections: [{ storePath: NORTHWIND_DATABASE, databaseType: 'H2' }],
70
+ },
71
+ ],
72
+ };
73
+
74
+ /** The schemas the fake gives, keyed by `<schema>.<table>` as the outline names them */
75
+ export const FAKE_NORTHWIND_SCHEMAS: ReadonlyMap<string, Schema> = new Map([
76
+ ['NORTHWIND.ORDERS', new Schema(ORDERS_COLUMNS)],
77
+ ['NORTHWIND.CUSTOMERS', new Schema(CUSTOMERS_COLUMNS)],
78
+ ]);
79
+
80
+ export const EMPTY_CUBE_RESULT: CubeResult = {
81
+ columns: [],
82
+ rows: [],
83
+ sql: [],
84
+ durationMs: 0,
85
+ };
86
+
87
+ export interface FakeCubeEngineAnswers {
88
+ readonly outline?: CubeModelOutline;
89
+ /** keyed by `<schema>.<table>`; a table not in it gets a compile error */
90
+ readonly schemas?: ReadonlyMap<string, Schema>;
91
+ readonly result?: CubeResult;
92
+ readonly pure?: string;
93
+ }
94
+
95
+ export interface FakeCubeEngine {
96
+ readonly engine: CubeEngine;
97
+ readonly loadModel: jest.Mock<CubeEngine['loadModel']>;
98
+ readonly resolveSchemas: jest.Mock<CubeEngine['resolveSchemas']>;
99
+ readonly typeLambdas: jest.Mock<CubeEngine['typeLambdas']>;
100
+ readonly execute: jest.Mock<CubeEngine['execute']>;
101
+ readonly renderPure: jest.Mock<CubeEngine['renderPure']>;
102
+ }
103
+
104
+ /** A fresh fake: build one per test, since jest.fn keeps its calls across tests */
105
+ export const createFakeCubeEngine = (
106
+ answers: FakeCubeEngineAnswers = {},
107
+ ): FakeCubeEngine => {
108
+ const schemas = answers.schemas ?? FAKE_NORTHWIND_SCHEMAS;
109
+ const loadModel = jest.fn<CubeEngine['loadModel']>(async () =>
110
+ Promise.resolve(answers.outline ?? FAKE_NORTHWIND_OUTLINE),
111
+ );
112
+ const resolveSchemas = jest.fn<CubeEngine['resolveSchemas']>(
113
+ async (_model, accessors) =>
114
+ Promise.resolve(
115
+ new Map(
116
+ [...accessors].map(([nodeId, [, schema, table]]) => [
117
+ nodeId,
118
+ schemas.get(`${schema}.${table}`) ??
119
+ new CubeEngineError(
120
+ CubeEngineErrorKind.COMPILE,
121
+ `The table "${schema}.${table}" can't be found`,
122
+ nodeId,
123
+ ),
124
+ ]),
125
+ ),
126
+ ),
127
+ );
128
+ const typeLambdas = jest.fn<CubeEngine['typeLambdas']>(async () =>
129
+ Promise.resolve(new Map()),
130
+ );
131
+ const execute = jest.fn<CubeEngine['execute']>(async () =>
132
+ Promise.resolve(answers.result ?? EMPTY_CUBE_RESULT),
133
+ );
134
+ const renderPure = jest.fn<CubeEngine['renderPure']>(async () =>
135
+ Promise.resolve(answers.pure ?? ''),
136
+ );
137
+ return {
138
+ engine: { loadModel, resolveSchemas, typeLambdas, execute, renderPure },
139
+ loadModel,
140
+ resolveSchemas,
141
+ typeLambdas,
142
+ execute,
143
+ renderPure,
144
+ };
145
+ };
@@ -0,0 +1,35 @@
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
+
19
+ /** A small text button in the page's toolbars and lists, coloured by the theme's tokens */
20
+ export const CubeButton: React.FC<
21
+ React.ButtonHTMLAttributes<HTMLButtonElement> & { primary?: boolean }
22
+ > = ({ className, primary, ...props }) => (
23
+ <button
24
+ {...props}
25
+ // these buttons never submit a form
26
+ type="button"
27
+ className={clsx(
28
+ 'h-6 shrink-0 rounded-sm border px-2 text-base enabled:cursor-pointer disabled:cursor-not-allowed disabled:text-[var(--color-text-disabled)]',
29
+ primary
30
+ ? 'border-[var(--color-accent)] bg-[var(--color-accent)] text-[var(--color-text-on-accent)] enabled:hover:bg-[var(--color-accent-hover)] disabled:border-[var(--color-border-default)] disabled:bg-[var(--color-bg-panel-header)]'
31
+ : 'border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)] enabled:hover:bg-[var(--color-bg-hover)]',
32
+ className,
33
+ )}
34
+ />
35
+ );