@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,334 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { getRelationalDisplayName, RELATIONAL_TABLE_SOURCE_DEFINITION, RelationalTableSource, } from '@finos/legend-cube';
17
+ import { assertErrorThrown } from '@finos/legend-shared';
18
+ import { action, computed, flow, flowResult, makeObservable, observable, } from 'mobx';
19
+ import { CubeEngineError, CubeEngineErrorKind, CubeTableFlag, } from '../graph-manager/CubeEngine.js';
20
+ import { getRuntimesForDatabase } from '../graph-manager/CubeModelOutlineHelper.js';
21
+ import { createTextModel } from './LocalModelCatalog.js';
22
+ const toMessage = (error) => {
23
+ assertErrorThrown(error);
24
+ return error instanceof CubeEngineError ? error.firstLine : error.message;
25
+ };
26
+ /** Whether a table can be picked: a table with a column Cube can't read can't */
27
+ export const isTableSelectable = (table) => !table.flags.includes(CubeTableFlag.UNAVAILABLE);
28
+ /**
29
+ * The source picker (PLAN §6.2.7, Settled before M1.8): model, then database,
30
+ * then a runtime keyed by that database, then schema and table. A step with
31
+ * a single choice is picked automatically. The first table fixes the cube's
32
+ * model and runtime; later tables come from the same database and runtime.
33
+ * A table is added only once its schema has resolved.
34
+ */
35
+ export class CubeSourcePickerState {
36
+ editorState;
37
+ isOpen = false;
38
+ model;
39
+ /** The model is Pure text the user pastes, not a bundled one */
40
+ isPastingModel = false;
41
+ pastedModelText = '';
42
+ /** The model the paste box last loaded: only it keeps the box shown */
43
+ pastedModel;
44
+ outline;
45
+ isLoadingModel = false;
46
+ databasePath;
47
+ runtimePath;
48
+ schemaName;
49
+ tableName;
50
+ tableSearch = '';
51
+ isResolving = false;
52
+ /** Why the outline or the table couldn't be loaded, shown in the dialog */
53
+ error;
54
+ /** Counts Add presses: closing the dialog moves it on, so the pending Add is dropped */
55
+ confirmRequest = 0;
56
+ constructor(editorState) {
57
+ makeObservable(this, {
58
+ isOpen: observable,
59
+ model: observable.ref,
60
+ isPastingModel: observable,
61
+ pastedModelText: observable,
62
+ outline: observable.ref,
63
+ isLoadingModel: observable,
64
+ databasePath: observable,
65
+ runtimePath: observable,
66
+ schemaName: observable,
67
+ tableName: observable,
68
+ tableSearch: observable,
69
+ isResolving: observable,
70
+ error: observable,
71
+ fixedContext: computed,
72
+ fixedDatabasePath: computed,
73
+ databases: computed,
74
+ runtimes: computed,
75
+ schemas: computed,
76
+ tables: computed,
77
+ canConfirm: computed,
78
+ open: action,
79
+ close: action,
80
+ selectDatabase: action,
81
+ selectRuntime: action,
82
+ selectSchema: action,
83
+ selectTable: action,
84
+ setTableSearch: action,
85
+ startPastingModel: action,
86
+ setPastedModelText: action,
87
+ selectModel: flow,
88
+ loadPastedModel: flow,
89
+ confirm: flow,
90
+ });
91
+ this.editorState = editorState;
92
+ }
93
+ get models() {
94
+ return this.editorState.host.modelCatalog.models;
95
+ }
96
+ /** Once the cube has a model, every table comes from it */
97
+ get fixedContext() {
98
+ return this.editorState.document.context;
99
+ }
100
+ /** Once the cube has a table, every other one comes from its database */
101
+ get fixedDatabasePath() {
102
+ return this.editorState.document.query.nodes.find((node) => node instanceof RelationalTableSource)?.database;
103
+ }
104
+ get databases() {
105
+ const databases = this.outline?.databases ?? [];
106
+ const fixedRuntime = this.fixedContext?.runtime;
107
+ return databases.filter((database) => (this.fixedDatabasePath === undefined ||
108
+ database.path === this.fixedDatabasePath) &&
109
+ (fixedRuntime === undefined ||
110
+ (this.outline &&
111
+ getRuntimesForDatabase(this.outline, database.path).some((runtime) => runtime.path === fixedRuntime))));
112
+ }
113
+ get runtimes() {
114
+ if (!this.outline || this.databasePath === undefined) {
115
+ return [];
116
+ }
117
+ const fixedRuntime = this.fixedContext?.runtime;
118
+ return getRuntimesForDatabase(this.outline, this.databasePath).filter((runtime) => fixedRuntime === undefined || runtime.path === fixedRuntime);
119
+ }
120
+ get schemas() {
121
+ return (this.databases.find((database) => database.path === this.databasePath)
122
+ ?.schemas ?? []);
123
+ }
124
+ /** The schema's tables, views left out, filtered by the search text */
125
+ get tables() {
126
+ const search = this.tableSearch.trim().toLowerCase();
127
+ return (this.schemas.find((schema) => schema.name === this.schemaName)?.tables ??
128
+ []).filter((table) => !table.isView &&
129
+ getRelationalDisplayName(table.name).toLowerCase().includes(search));
130
+ }
131
+ get canConfirm() {
132
+ const table = this.tables.find((candidate) => candidate.name === this.tableName);
133
+ return (!this.isLoadingModel &&
134
+ !this.isResolving &&
135
+ this.model !== undefined &&
136
+ this.runtimePath !== undefined &&
137
+ table !== undefined &&
138
+ isTableSelectable(table));
139
+ }
140
+ /**
141
+ * Opens the dialog on the cube's model, or on the only model offered. A
142
+ * model whose outline failed to load is loaded again. Does nothing while
143
+ * the cube is read-only.
144
+ */
145
+ open() {
146
+ if (this.editorState.readOnly) {
147
+ return;
148
+ }
149
+ this.isOpen = true;
150
+ this.error = undefined;
151
+ const model = this.fixedContext?.model ??
152
+ (this.models.length === 1 && !this.isPastingModel
153
+ ? this.models[0]?.model
154
+ : this.model);
155
+ if (!model) {
156
+ return;
157
+ }
158
+ if (model !== this.model || !this.outline) {
159
+ flowResult(this.selectModel(model)).catch(this.editorState.host.applicationStore.alertUnhandledError);
160
+ }
161
+ else if (this.databasePath !== undefined &&
162
+ !this.databases.some((database) => database.path === this.databasePath)) {
163
+ // the cube changed since the last pick, e.g. by undo
164
+ const [onlyDatabase, ...otherDatabases] = this.databases;
165
+ this.selectDatabase(onlyDatabase && !otherDatabases.length ? onlyDatabase.path : undefined);
166
+ }
167
+ }
168
+ /** Closes the dialog; a table still being typed is not added */
169
+ close() {
170
+ this.isOpen = false;
171
+ this.confirmRequest++;
172
+ this.isResolving = false;
173
+ }
174
+ /** Offers a text box for a Pure model in place of the bundled ones */
175
+ startPastingModel() {
176
+ this.isPastingModel = true;
177
+ this.model = undefined;
178
+ this.outline = undefined;
179
+ this.error = undefined;
180
+ this.isLoadingModel = false;
181
+ this.resetFrom('database');
182
+ }
183
+ setPastedModelText(text) {
184
+ this.pastedModelText = text;
185
+ }
186
+ /**
187
+ * Loads the pasted Pure text as the model: the cube will hold the text
188
+ * itself, so it counts towards the size a saved cube can have
189
+ */
190
+ *loadPastedModel() {
191
+ if (this.pastedModelText.trim()) {
192
+ this.pastedModel = createTextModel(this.pastedModelText);
193
+ yield flowResult(this.selectModel(this.pastedModel));
194
+ }
195
+ }
196
+ /**
197
+ * Loads a model's outline. Any model but the one the paste box loaded ends
198
+ * pasting, e.g. a bundled model, or the model of a cube opened meanwhile.
199
+ */
200
+ *selectModel(model) {
201
+ this.isPastingModel = model === this.pastedModel;
202
+ this.model = model;
203
+ this.outline = undefined;
204
+ this.error = undefined;
205
+ this.resetFrom('database');
206
+ this.isLoadingModel = true;
207
+ try {
208
+ const outline = (yield this.editorState.host.modelCatalog.loadOutline(model));
209
+ if (this.model !== model) {
210
+ return;
211
+ }
212
+ this.outline = outline;
213
+ const [onlyDatabase, ...otherDatabases] = this.databases;
214
+ if (onlyDatabase && !otherDatabases.length) {
215
+ this.selectDatabase(onlyDatabase.path);
216
+ }
217
+ }
218
+ catch (error) {
219
+ if (this.model === model) {
220
+ this.error = toMessage(error);
221
+ }
222
+ }
223
+ finally {
224
+ if (this.model === model) {
225
+ this.isLoadingModel = false;
226
+ }
227
+ }
228
+ }
229
+ selectDatabase(path) {
230
+ this.databasePath = path;
231
+ this.resetFrom('runtime');
232
+ const [onlyRuntime, ...otherRuntimes] = this.runtimes;
233
+ if (onlyRuntime && !otherRuntimes.length) {
234
+ this.runtimePath = onlyRuntime.path;
235
+ }
236
+ const [onlySchema, ...otherSchemas] = this.schemas;
237
+ if (onlySchema && !otherSchemas.length) {
238
+ this.schemaName = onlySchema.name;
239
+ }
240
+ }
241
+ selectRuntime(path) {
242
+ this.runtimePath = path;
243
+ }
244
+ selectSchema(name) {
245
+ this.schemaName = name;
246
+ this.resetFrom('table');
247
+ }
248
+ selectTable(name) {
249
+ this.tableName = name;
250
+ this.error = undefined;
251
+ }
252
+ setTableSearch(search) {
253
+ this.tableSearch = search;
254
+ }
255
+ /**
256
+ * Types the picked table with the engine, then adds it; the first table
257
+ * also sets the cube's model and runtime, in the same undo step. The cube
258
+ * may have changed while the engine answered: the table is added only if
259
+ * the cube still has the same model and runtime and can take it.
260
+ */
261
+ *confirm() {
262
+ if (!this.canConfirm) {
263
+ return;
264
+ }
265
+ const { editorState } = this;
266
+ const model = this.model;
267
+ const runtime = this.runtimePath;
268
+ const coordinates = {
269
+ database: this.databasePath,
270
+ schema: this.schemaName,
271
+ table: this.tableName,
272
+ };
273
+ const contextBefore = editorState.document.context;
274
+ // the engine stamps the table's accessor with its node id, so the id comes first
275
+ const id = editorState.document.query.generateId(RelationalTableSource.TYPE);
276
+ const request = ++this.confirmRequest;
277
+ this.isResolving = true;
278
+ this.error = undefined;
279
+ try {
280
+ const typed = (yield editorState.host.engine.resolveSchemas(model, new Map([
281
+ [id, [coordinates.database, coordinates.schema, coordinates.table]],
282
+ ])));
283
+ if (request !== this.confirmRequest) {
284
+ return;
285
+ }
286
+ const schema = typed.get(id);
287
+ if (schema === undefined || schema instanceof CubeEngineError) {
288
+ throw (schema ??
289
+ new CubeEngineError(CubeEngineErrorKind.COMPILE, `The engine gave no schema for this table`));
290
+ }
291
+ const node = RELATIONAL_TABLE_SOURCE_DEFINITION.resolve(RELATIONAL_TABLE_SOURCE_DEFINITION.fromCoordinates(id, coordinates), { kind: 'resolved', schema });
292
+ const { document } = editorState;
293
+ if (document.context !== contextBefore || !document.query.canAdd(node)) {
294
+ throw new Error(`The cube changed while the table was loading; pick the table again.`);
295
+ }
296
+ const query = document.query.add(node);
297
+ // the first table sets the model and runtime; a cube saved with a model
298
+ // but no runtime takes the picked runtime and keeps the rest
299
+ editorState.applyDocument(document.context?.runtime !== undefined
300
+ ? document.withQuery(query)
301
+ : document
302
+ .withContext({
303
+ ...document.context,
304
+ model: document.context?.model ?? model,
305
+ runtime,
306
+ })
307
+ .withQuery(query));
308
+ this.isOpen = false;
309
+ this.resetFrom('table');
310
+ }
311
+ catch (error) {
312
+ if (request === this.confirmRequest) {
313
+ this.error = toMessage(error);
314
+ }
315
+ }
316
+ finally {
317
+ if (request === this.confirmRequest) {
318
+ this.isResolving = false;
319
+ }
320
+ }
321
+ }
322
+ resetFrom(step) {
323
+ if (step === 'database') {
324
+ this.databasePath = undefined;
325
+ }
326
+ if (step === 'database' || step === 'runtime') {
327
+ this.runtimePath = undefined;
328
+ this.schemaName = undefined;
329
+ }
330
+ this.tableName = undefined;
331
+ this.tableSearch = '';
332
+ }
333
+ }
334
+ //# sourceMappingURL=CubeSourcePickerState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeSourcePickerState.js","sourceRoot":"","sources":["../../src/stores/CubeSourcePickerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,wBAAwB,EAExB,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAoB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,aAAa,GAMd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAqB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE5E,MAAM,SAAS,GAAG,CAAC,KAAc,EAAU,EAAE;IAC3C,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,KAAK,YAAY,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5E,CAAC,CAAC;AAEF,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAuB,EAAW,EAAE,CACpE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,OAAO,qBAAqB;IACvB,WAAW,CAAkB;IAEtC,MAAM,GAAG,KAAK,CAAC;IACf,KAAK,CAA2B;IAChC,gEAAgE;IAChE,cAAc,GAAG,KAAK,CAAC;IACvB,eAAe,GAAG,EAAE,CAAC;IACrB,uEAAuE;IAC/D,WAAW,CAA2B;IAC9C,OAAO,CAA+B;I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pB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,OAAO,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,OAAO,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,IAAsC;QACtD,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,CAAC;QACD,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9C,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type GeneratorFn } from '@finos/legend-shared';
17
+ import type { CubeEditorState } from './CubeEditorState.js';
18
+ export declare enum CUBE_SPEC_TRANSFER_MODE {
19
+ EXPORT = "export",
20
+ IMPORT = "import"
21
+ }
22
+ /** Why a spec can't be imported; a broken document names the path of the problem */
23
+ export declare const getSpecImportError: (error: unknown) => string;
24
+ /** A file name for a cube's spec, from its name */
25
+ export declare const getCubeSpecFileName: (name: string | undefined) => string;
26
+ /**
27
+ * Export and import of the saved spec (PLAN §10.3), the only way to keep a
28
+ * cube until the Cube store (M8). Both are developer tools for now, labelled
29
+ * "(dev)" (Settled before M1.8).
30
+ */
31
+ export declare class CubeSpecTransferState {
32
+ readonly editorState: CubeEditorState;
33
+ mode: CUBE_SPEC_TRANSFER_MODE | undefined;
34
+ /** The spec to export, once written */
35
+ exportText: string | undefined;
36
+ /** The spec text to import, pasted or read from a file */
37
+ importText: string;
38
+ /** Why the export or the import failed */
39
+ error: string | undefined;
40
+ isReadingFile: boolean;
41
+ /** Counts file reads, so a read that finishes after another starts is dropped */
42
+ private fileRequest;
43
+ constructor(editorState: CubeEditorState);
44
+ /** Writes the cube's spec, invalid queries included; a spec over the size cap is refused */
45
+ openExport(): void;
46
+ openImport(): void;
47
+ close(): void;
48
+ setImportText(text: string): void;
49
+ copyExport(): Promise<void>;
50
+ downloadExport(): void;
51
+ /** Reads a spec file into the import text; a file over the size cap is refused unread */
52
+ readImportFile(file: File): GeneratorFn<void>;
53
+ /**
54
+ * Opens the spec in place of the cube, as one undo step, and never runs it.
55
+ * A spec that can't be read leaves the cube as it was and says why: a
56
+ * broken document names the path of the problem, e.g. `query.nodes[2].database`.
57
+ */
58
+ importSpec(): boolean;
59
+ }
60
+ //# sourceMappingURL=CubeSpecTransferState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeSpecTransferState.d.ts","sourceRoot":"","sources":["../../src/stores/CubeSpecTransferState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAKD,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,MAKC,CAAC;AAEtD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAG9D,CAAC;AAEF;;;;GAIG;AACH,qBAAa,qBAAqB;IAChC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IAEtC,IAAI,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC1C,uCAAuC;IACvC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,0DAA0D;IAC1D,UAAU,SAAM;IAChB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,UAAS;IACtB,iFAAiF;IACjF,OAAO,CAAC,WAAW,CAAK;gBAEZ,WAAW,EAAE,eAAe;IAkBxC,4FAA4F;IAC5F,UAAU,IAAI,IAAI;IAYlB,UAAU,IAAI,IAAI;IAOlB,KAAK,IAAI,IAAI;IASb,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC,cAAc,IAAI,IAAI;IAUtB,yFAAyF;IACxF,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAkC9C;;;;OAIG;IACH,UAAU,IAAI,OAAO;CActB"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CubeSpecDecodeError, MAX_SPEC_BYTES, parseCubeSpec, serializeCubeSpec, } from '@finos/legend-cube';
17
+ import { ContentType, downloadFileUsingDataURI, readFileAsText, } from '@finos/legend-shared';
18
+ import { action, flow, makeObservable, observable } from 'mobx';
19
+ export var CUBE_SPEC_TRANSFER_MODE;
20
+ (function (CUBE_SPEC_TRANSFER_MODE) {
21
+ CUBE_SPEC_TRANSFER_MODE["EXPORT"] = "export";
22
+ CUBE_SPEC_TRANSFER_MODE["IMPORT"] = "import";
23
+ })(CUBE_SPEC_TRANSFER_MODE || (CUBE_SPEC_TRANSFER_MODE = {}));
24
+ const errorMessage = (error) => error instanceof Error ? error.message : String(error);
25
+ /** Why a spec can't be imported; a broken document names the path of the problem */
26
+ export const getSpecImportError = (error) => error instanceof CubeSpecDecodeError
27
+ ? error.path
28
+ ? `Can't import the spec: ${error.path} ${error.detail}`
29
+ : `Can't import the spec: it ${error.detail}`
30
+ : `Can't import the spec: ${errorMessage(error)}`;
31
+ /** A file name for a cube's spec, from its name */
32
+ export const getCubeSpecFileName = (name) => {
33
+ const base = name?.trim().replace(/[^\w.-]+/gu, '_') ?? '';
34
+ return `${base.length ? base : 'cube'}.cube.json`;
35
+ };
36
+ /**
37
+ * Export and import of the saved spec (PLAN §10.3), the only way to keep a
38
+ * cube until the Cube store (M8). Both are developer tools for now, labelled
39
+ * "(dev)" (Settled before M1.8).
40
+ */
41
+ export class CubeSpecTransferState {
42
+ editorState;
43
+ mode;
44
+ /** The spec to export, once written */
45
+ exportText;
46
+ /** The spec text to import, pasted or read from a file */
47
+ importText = '';
48
+ /** Why the export or the import failed */
49
+ error;
50
+ isReadingFile = false;
51
+ /** Counts file reads, so a read that finishes after another starts is dropped */
52
+ fileRequest = 0;
53
+ constructor(editorState) {
54
+ makeObservable(this, {
55
+ mode: observable,
56
+ exportText: observable,
57
+ importText: observable,
58
+ error: observable,
59
+ isReadingFile: observable,
60
+ fileRequest: observable,
61
+ openExport: action,
62
+ openImport: action,
63
+ close: action,
64
+ setImportText: action,
65
+ importSpec: action,
66
+ readImportFile: flow,
67
+ });
68
+ this.editorState = editorState;
69
+ }
70
+ /** Writes the cube's spec, invalid queries included; a spec over the size cap is refused */
71
+ openExport() {
72
+ this.mode = CUBE_SPEC_TRANSFER_MODE.EXPORT;
73
+ this.error = undefined;
74
+ this.exportText = undefined;
75
+ const { document, registry } = this.editorState;
76
+ try {
77
+ this.exportText = serializeCubeSpec(document, registry);
78
+ }
79
+ catch (error) {
80
+ this.error = errorMessage(error);
81
+ }
82
+ }
83
+ openImport() {
84
+ this.mode = CUBE_SPEC_TRANSFER_MODE.IMPORT;
85
+ this.error = undefined;
86
+ this.importText = '';
87
+ this.isReadingFile = false;
88
+ }
89
+ close() {
90
+ this.mode = undefined;
91
+ this.exportText = undefined;
92
+ this.importText = '';
93
+ this.error = undefined;
94
+ this.fileRequest++;
95
+ this.isReadingFile = false;
96
+ }
97
+ setImportText(text) {
98
+ this.importText = text;
99
+ this.error = undefined;
100
+ }
101
+ async copyExport() {
102
+ if (this.exportText !== undefined) {
103
+ await this.editorState.host.applicationStore.clipboardService.copyTextToClipboard(this.exportText, { notifySuccessMessage: 'Cube spec copied to the clipboard' });
104
+ }
105
+ }
106
+ downloadExport() {
107
+ if (this.exportText !== undefined) {
108
+ downloadFileUsingDataURI(getCubeSpecFileName(this.editorState.document.name), this.exportText, ContentType.APPLICATION_JSON);
109
+ }
110
+ }
111
+ /** Reads a spec file into the import text; a file over the size cap is refused unread */
112
+ *readImportFile(file) {
113
+ const request = ++this.fileRequest;
114
+ this.error = undefined;
115
+ if (file.size > MAX_SPEC_BYTES) {
116
+ // a file being read before this one is dropped
117
+ this.isReadingFile = false;
118
+ this.error = `The file is too large to import: a spec is at most ${MAX_SPEC_BYTES} bytes`;
119
+ return;
120
+ }
121
+ this.isReadingFile = true;
122
+ try {
123
+ const text = (yield readFileAsText(file));
124
+ if (request === this.fileRequest) {
125
+ this.importText = text;
126
+ }
127
+ }
128
+ catch (error) {
129
+ if (request === this.fileRequest) {
130
+ // the browser's FileReader rejects with its error event, not an Error
131
+ const reason = error instanceof Error
132
+ ? error.message
133
+ : error instanceof ProgressEvent &&
134
+ error.target instanceof FileReader
135
+ ? (error.target.error?.message ?? 'the browser could not read it')
136
+ : String(error);
137
+ this.error = `Can't read the file: ${reason}`;
138
+ }
139
+ }
140
+ finally {
141
+ if (request === this.fileRequest) {
142
+ this.isReadingFile = false;
143
+ }
144
+ }
145
+ }
146
+ /**
147
+ * Opens the spec in place of the cube, as one undo step, and never runs it.
148
+ * A spec that can't be read leaves the cube as it was and says why: a
149
+ * broken document names the path of the problem, e.g. `query.nodes[2].database`.
150
+ */
151
+ importSpec() {
152
+ let decoded;
153
+ try {
154
+ decoded = parseCubeSpec(this.importText, {
155
+ registry: this.editorState.registry,
156
+ });
157
+ }
158
+ catch (error) {
159
+ this.error = getSpecImportError(error);
160
+ return false;
161
+ }
162
+ this.editorState.importDocument(decoded.document, decoded.readOnly);
163
+ this.close();
164
+ return true;
165
+ }
166
+ }
167
+ //# sourceMappingURL=CubeSpecTransferState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeSpecTransferState.js","sourceRoot":"","sources":["../../src/stores/CubeSpecTransferState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,WAAW,EACX,wBAAwB,EAExB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGhE,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,4CAAiB,CAAA;IACjB,4CAAiB,CAAA;AACnB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AI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjC,sEAAsE;gBACtE,MAAM,MAAM,GACV,KAAK,YAAY,KAAK;oBACpB,CAAC,CAAC,KAAK,CAAC,OAAO;oBACf,CAAC,CAAC,KAAK,YAAY,aAAa;wBAC5B,KAAK,CAAC,MAAM,YAAY,UAAU;wBACpC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,+BAA+B,CAAC;wBAClE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtB,IAAI,CAAC,KAAK,GAAG,wBAAwB,MAAM,EAAE,CAAC;YAChD,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,UAAU;QACR,IAAI,OAAyC,CAAC;QAC9C,IAAI,CAAC;YACH,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE;gBACvC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ;aACpC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ModelContext } from '@finos/legend-cube';
17
+ import type { CubeEngine, CubeModelOutline } from '../graph-manager/CubeEngine.js';
18
+ export interface BundledModel {
19
+ readonly id: string;
20
+ readonly label: string;
21
+ readonly model: ModelContext;
22
+ }
23
+ export declare const BUNDLED_MODELS: readonly BundledModel[];
24
+ /** The model context of pasted Pure text */
25
+ export declare const createTextModel: (code: string) => ModelContext;
26
+ /**
27
+ * Loads the outlines of models through the engine port, each model's once:
28
+ * the picker asks again whenever it opens
29
+ */
30
+ export declare class LocalModelCatalog {
31
+ readonly models: readonly BundledModel[];
32
+ private readonly engine;
33
+ private readonly outlines;
34
+ constructor(engine: CubeEngine);
35
+ loadOutline(model: ModelContext): Promise<CubeModelOutline>;
36
+ }
37
+ //# sourceMappingURL=LocalModelCatalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalModelCatalog.d.ts","sourceRoot":"","sources":["../../src/stores/LocalModelCatalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAOxC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAMhD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,YACP,CAAC;AAEzC;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,MAAM,0BAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgD;gBAE7D,MAAM,EAAE,UAAU;IAI9B,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAW5D"}