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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -2
  3. package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
  4. package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
  5. package/lib/__lib__/LegendCubeCommand.js +40 -0
  6. package/lib/__lib__/LegendCubeCommand.js.map +1 -0
  7. package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
  8. package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
  9. package/lib/__lib__/LegendCubeHelpText.js +27 -0
  10. package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
  11. package/lib/__lib__/LegendCubeLabels.d.ts +68 -0
  12. package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
  13. package/lib/__lib__/LegendCubeLabels.js +109 -0
  14. package/lib/__lib__/LegendCubeLabels.js.map +1 -0
  15. package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
  16. package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
  17. package/lib/__lib__/LegendCubeTesting.js +34 -0
  18. package/lib/__lib__/LegendCubeTesting.js.map +1 -0
  19. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
  20. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
  21. package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
  22. package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
  23. package/lib/__test-utils__/CubeEngineTestSupport.d.ts +41 -0
  24. package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
  25. package/lib/__test-utils__/CubeEngineTestSupport.js +76 -0
  26. package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
  27. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
  28. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
  29. package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
  30. package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
  31. package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
  32. package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
  33. package/lib/__test-utils__/CubePageTestUtils.js +68 -0
  34. package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
  35. package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
  36. package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
  37. package/lib/__test-utils__/CubeTestApplication.js +57 -0
  38. package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
  39. package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
  40. package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
  41. package/lib/__test-utils__/FakeCubeEngine.js +85 -0
  42. package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
  43. package/lib/components/CubeButton.d.ts +20 -0
  44. package/lib/components/CubeButton.d.ts.map +1 -0
  45. package/lib/components/CubeButton.js +24 -0
  46. package/lib/components/CubeButton.js.map +1 -0
  47. package/lib/components/CubeEditor.d.ts +31 -0
  48. package/lib/components/CubeEditor.d.ts.map +1 -0
  49. package/lib/components/CubeEditor.js +90 -0
  50. package/lib/components/CubeEditor.js.map +1 -0
  51. package/lib/components/CubeNodeIcon.d.ts +23 -0
  52. package/lib/components/CubeNodeIcon.d.ts.map +1 -0
  53. package/lib/components/CubeNodeIcon.js +32 -0
  54. package/lib/components/CubeNodeIcon.js.map +1 -0
  55. package/lib/components/canvas/CubeCanvas.d.ts +37 -0
  56. package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
  57. package/lib/components/canvas/CubeCanvas.js +135 -0
  58. package/lib/components/canvas/CubeCanvas.js.map +1 -0
  59. package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
  60. package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
  61. package/lib/components/canvas/CubeCanvasContext.js +22 -0
  62. package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
  63. package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
  64. package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
  65. package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
  66. package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
  67. package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
  68. package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
  69. package/lib/components/canvas/CubeCanvasDnd.js +51 -0
  70. package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
  71. package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
  72. package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
  73. package/lib/components/canvas/CubeCanvasEdge.js +33 -0
  74. package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
  75. package/lib/components/canvas/CubeCanvasElements.d.ts +64 -0
  76. package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
  77. package/lib/components/canvas/CubeCanvasElements.js +96 -0
  78. package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
  79. package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
  80. package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
  81. package/lib/components/canvas/CubeCanvasLayout.js +63 -0
  82. package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
  83. package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
  84. package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
  85. package/lib/components/canvas/CubeCanvasNode.js +72 -0
  86. package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
  87. package/lib/components/editors/CubeColumnPicker.d.ts +40 -0
  88. package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
  89. package/lib/components/editors/CubeColumnPicker.js +51 -0
  90. package/lib/components/editors/CubeColumnPicker.js.map +1 -0
  91. package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
  92. package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
  93. package/lib/components/editors/CubeFilterEditor.js +90 -0
  94. package/lib/components/editors/CubeFilterEditor.js.map +1 -0
  95. package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
  96. package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
  97. package/lib/components/editors/CubeJoinEditor.js +76 -0
  98. package/lib/components/editors/CubeJoinEditor.js.map +1 -0
  99. package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
  100. package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
  101. package/lib/components/editors/CubeNodeEditorPanel.js +71 -0
  102. package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
  103. package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
  104. package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
  105. package/lib/components/editors/CubeNodeEditorRegistry.js +30 -0
  106. package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
  107. package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
  108. package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
  109. package/lib/components/editors/CubeSourceEditor.js +42 -0
  110. package/lib/components/editors/CubeSourceEditor.js.map +1 -0
  111. package/lib/components/editors/CubeValueEditor.d.ts +40 -0
  112. package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
  113. package/lib/components/editors/CubeValueEditor.js +177 -0
  114. package/lib/components/editors/CubeValueEditor.js.map +1 -0
  115. package/lib/components/grid/CubeGridRegion.d.ts +23 -0
  116. package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
  117. package/lib/components/grid/CubeGridRegion.js +94 -0
  118. package/lib/components/grid/CubeGridRegion.js.map +1 -0
  119. package/lib/components/grid/CubeGridValues.d.ts +25 -0
  120. package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
  121. package/lib/components/grid/CubeGridValues.js +95 -0
  122. package/lib/components/grid/CubeGridValues.js.map +1 -0
  123. package/lib/components/grid/CubeResultGrid.d.ts +26 -0
  124. package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
  125. package/lib/components/grid/CubeResultGrid.js +50 -0
  126. package/lib/components/grid/CubeResultGrid.js.map +1 -0
  127. package/lib/components/palette/CubePalette.d.ts +29 -0
  128. package/lib/components/palette/CubePalette.d.ts.map +1 -0
  129. package/lib/components/palette/CubePalette.js +73 -0
  130. package/lib/components/palette/CubePalette.js.map +1 -0
  131. package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
  132. package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
  133. package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
  134. package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
  135. package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
  136. package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
  137. package/lib/components/source-picker/CubeSourcePicker.js +89 -0
  138. package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
  139. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
  140. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
  141. package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
  142. package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
  143. package/lib/graph-manager/CubeEngine.d.ts +115 -0
  144. package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
  145. package/lib/graph-manager/CubeEngine.js +61 -0
  146. package/lib/graph-manager/CubeEngine.js.map +1 -0
  147. package/lib/graph-manager/CubeModelOutlineHelper.d.ts +25 -0
  148. package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
  149. package/lib/graph-manager/CubeModelOutlineHelper.js +24 -0
  150. package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
  151. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
  152. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
  153. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
  154. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
  155. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
  156. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
  157. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
  158. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
  159. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
  160. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
  161. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
  162. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
  163. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
  164. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
  165. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
  166. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
  167. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
  168. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
  169. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +121 -0
  170. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
  171. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
  172. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
  173. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
  174. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
  175. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
  176. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
  177. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
  178. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
  179. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
  180. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
  181. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
  182. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
  183. package/lib/index.css +17 -0
  184. package/lib/index.css.map +1 -0
  185. package/lib/index.d.ts +25 -0
  186. package/lib/index.d.ts.map +1 -0
  187. package/lib/index.js +24 -0
  188. package/lib/index.js.map +1 -0
  189. package/lib/stores/CubeEditorState.d.ts +206 -0
  190. package/lib/stores/CubeEditorState.d.ts.map +1 -0
  191. package/lib/stores/CubeEditorState.js +551 -0
  192. package/lib/stores/CubeEditorState.js.map +1 -0
  193. package/lib/stores/CubeExecutionState.d.ts +67 -0
  194. package/lib/stores/CubeExecutionState.d.ts.map +1 -0
  195. package/lib/stores/CubeExecutionState.js +196 -0
  196. package/lib/stores/CubeExecutionState.js.map +1 -0
  197. package/lib/stores/CubeHost.d.ts +31 -0
  198. package/lib/stores/CubeHost.d.ts.map +1 -0
  199. package/lib/stores/CubeHost.js +17 -0
  200. package/lib/stores/CubeHost.js.map +1 -0
  201. package/lib/stores/CubeNodeEditorState.d.ts +85 -0
  202. package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
  203. package/lib/stores/CubeNodeEditorState.js +207 -0
  204. package/lib/stores/CubeNodeEditorState.js.map +1 -0
  205. package/lib/stores/CubeShowPureState.d.ts +38 -0
  206. package/lib/stores/CubeShowPureState.d.ts.map +1 -0
  207. package/lib/stores/CubeShowPureState.js +83 -0
  208. package/lib/stores/CubeShowPureState.js.map +1 -0
  209. package/lib/stores/CubeSourcePickerState.d.ts +98 -0
  210. package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
  211. package/lib/stores/CubeSourcePickerState.js +334 -0
  212. package/lib/stores/CubeSourcePickerState.js.map +1 -0
  213. package/lib/stores/CubeSpecTransferState.d.ts +60 -0
  214. package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
  215. package/lib/stores/CubeSpecTransferState.js +167 -0
  216. package/lib/stores/CubeSpecTransferState.js.map +1 -0
  217. package/lib/stores/LocalModelCatalog.d.ts +37 -0
  218. package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
  219. package/lib/stores/LocalModelCatalog.js +49 -0
  220. package/lib/stores/LocalModelCatalog.js.map +1 -0
  221. package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
  222. package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
  223. package/lib/stores/editors/CubeFilterDraft.js +186 -0
  224. package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
  225. package/lib/stores/editors/CubeJoinDraft.d.ts +63 -0
  226. package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
  227. package/lib/stores/editors/CubeJoinDraft.js +136 -0
  228. package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
  229. package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
  230. package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
  231. package/lib/stores/editors/CubeNodeDraft.js +35 -0
  232. package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
  233. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +29 -0
  234. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
  235. package/lib/stores/editors/CubeNodeDraftRegistry.js +33 -0
  236. package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
  237. package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
  238. package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
  239. package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
  240. package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
  241. package/package.json +81 -3
  242. package/src/__lib__/LegendCubeCommand.ts +44 -0
  243. package/src/__lib__/LegendCubeHelpText.ts +38 -0
  244. package/src/__lib__/LegendCubeLabels.ts +141 -0
  245. package/src/__lib__/LegendCubeTesting.ts +33 -0
  246. package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
  247. package/src/__test-utils__/CubeEngineTestSupport.ts +137 -0
  248. package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
  249. package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
  250. package/src/__test-utils__/CubeTestApplication.ts +82 -0
  251. package/src/__test-utils__/FakeCubeEngine.ts +139 -0
  252. package/src/components/CubeButton.tsx +35 -0
  253. package/src/components/CubeEditor.tsx +239 -0
  254. package/src/components/CubeNodeIcon.tsx +47 -0
  255. package/src/components/canvas/CubeCanvas.tsx +260 -0
  256. package/src/components/canvas/CubeCanvasContext.ts +31 -0
  257. package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
  258. package/src/components/canvas/CubeCanvasDnd.ts +82 -0
  259. package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
  260. package/src/components/canvas/CubeCanvasElements.ts +150 -0
  261. package/src/components/canvas/CubeCanvasLayout.ts +88 -0
  262. package/src/components/canvas/CubeCanvasNode.tsx +141 -0
  263. package/src/components/editors/CubeColumnPicker.tsx +114 -0
  264. package/src/components/editors/CubeFilterEditor.tsx +309 -0
  265. package/src/components/editors/CubeJoinEditor.tsx +224 -0
  266. package/src/components/editors/CubeNodeEditorPanel.tsx +204 -0
  267. package/src/components/editors/CubeNodeEditorRegistry.ts +61 -0
  268. package/src/components/editors/CubeSourceEditor.tsx +116 -0
  269. package/src/components/editors/CubeValueEditor.tsx +332 -0
  270. package/src/components/grid/CubeGridRegion.tsx +274 -0
  271. package/src/components/grid/CubeGridValues.ts +125 -0
  272. package/src/components/grid/CubeResultGrid.tsx +84 -0
  273. package/src/components/palette/CubePalette.tsx +177 -0
  274. package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
  275. package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
  276. package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
  277. package/src/graph-manager/CubeEngine.ts +155 -0
  278. package/src/graph-manager/CubeModelOutlineHelper.ts +32 -0
  279. package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
  280. package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
  281. package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
  282. package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
  283. package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +157 -0
  284. package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
  285. package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
  286. package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +124 -0
  287. package/src/index.ts +41 -0
  288. package/src/stores/CubeEditorState.ts +702 -0
  289. package/src/stores/CubeExecutionState.ts +255 -0
  290. package/src/stores/CubeHost.ts +32 -0
  291. package/src/stores/CubeNodeEditorState.ts +255 -0
  292. package/src/stores/CubeShowPureState.ts +96 -0
  293. package/src/stores/CubeSourcePickerState.ts +426 -0
  294. package/src/stores/CubeSpecTransferState.ts +198 -0
  295. package/src/stores/LocalModelCatalog.ts +70 -0
  296. package/src/stores/editors/CubeFilterDraft.ts +241 -0
  297. package/src/stores/editors/CubeJoinDraft.ts +197 -0
  298. package/src/stores/editors/CubeNodeDraft.ts +46 -0
  299. package/src/stores/editors/CubeNodeDraftRegistry.ts +49 -0
  300. package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
  301. package/tsconfig.json +118 -0
@@ -0,0 +1,83 @@
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 { action, flow, makeObservable, observable } from 'mobx';
17
+ import { CubeEngineError, CubeEngineErrorKind, } from '../graph-manager/CubeEngine.js';
18
+ /**
19
+ * Show Pure: the Pure text of what Execute would run, the capture node's
20
+ * execution lambda with the row limit, as the engine renders it. For display
21
+ * only: the text is never parsed back (PLAN §8.7).
22
+ */
23
+ export class CubeShowPureState {
24
+ editorState;
25
+ isOpen = false;
26
+ text;
27
+ /** Why the engine couldn't render the query; shown in the dialog */
28
+ error;
29
+ isRendering = false;
30
+ /** Counts renders, so one that finishes after the dialog closed is dropped */
31
+ request = 0;
32
+ constructor(editorState) {
33
+ makeObservable(this, {
34
+ isOpen: observable,
35
+ text: observable,
36
+ error: observable.ref,
37
+ isRendering: observable,
38
+ open: flow,
39
+ close: action,
40
+ });
41
+ this.editorState = editorState;
42
+ }
43
+ /** Opens the dialog and renders the query; does nothing when Execute can't run */
44
+ *open() {
45
+ const { execution, document, emitter, rowLimit, host } = this.editorState;
46
+ const runtime = document.context?.runtime;
47
+ if (!execution.canExecute || runtime === undefined) {
48
+ return;
49
+ }
50
+ const request = ++this.request;
51
+ this.isOpen = true;
52
+ this.text = undefined;
53
+ this.error = undefined;
54
+ this.isRendering = true;
55
+ try {
56
+ const text = (yield host.engine.renderPure(emitter.emitExecutionLambda({ rowLimit, runtime })));
57
+ if (request === this.request) {
58
+ this.text = text;
59
+ }
60
+ }
61
+ catch (error) {
62
+ if (request === this.request) {
63
+ this.error =
64
+ error instanceof CubeEngineError
65
+ ? error
66
+ : new CubeEngineError(CubeEngineErrorKind.COMPILE, error instanceof Error ? error.message : String(error));
67
+ }
68
+ }
69
+ finally {
70
+ if (request === this.request) {
71
+ this.isRendering = false;
72
+ }
73
+ }
74
+ }
75
+ close() {
76
+ this.request++;
77
+ this.isOpen = false;
78
+ this.isRendering = false;
79
+ this.text = undefined;
80
+ this.error = undefined;
81
+ }
82
+ }
83
+ //# sourceMappingURL=CubeShowPureState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeShowPureState.js","sourceRoot":"","sources":["../../src/stores/CubeShowPureState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAChE,OAAO,EACL,eAAe,EACf,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AAGxC;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACnB,WAAW,CAAkB;IAEtC,MAAM,GAAG,KAAK,CAAC;IACf,IAAI,CAAqB;IACzB,oEAAoE;IACpE,KAAK,CAA8B;IACnC,WAAW,GAAG,KAAK,CAAC;IACpB,8EAA8E;IACtE,OAAO,GAAG,CAAC,CAAC;IAEpB,YAAY,WAA4B;QACtC,cAAc,CAAC,IAAI,EAAE;YACnB,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,UAAU,CAAC,GAAG;YACrB,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,kFA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,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,98 @@
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 CubeContext, type ModelContext } from '@finos/legend-cube';
17
+ import { type GeneratorFn } from '@finos/legend-shared';
18
+ import { type CubeModelOutline, type CubeOutlineDatabase, type CubeOutlineRuntime, type CubeOutlineSchema, type CubeOutlineTable } from '../graph-manager/CubeEngine.js';
19
+ import type { CubeEditorState } from './CubeEditorState.js';
20
+ import { type BundledModel } from './LocalModelCatalog.js';
21
+ /** Whether a table can be picked: a table with a column Cube can't read can't */
22
+ export declare const isTableSelectable: (table: CubeOutlineTable) => boolean;
23
+ /**
24
+ * The source picker (PLAN §6.2.7, Settled before M1.8): model, then database,
25
+ * then a runtime keyed by that database, then schema and table. A step with
26
+ * a single choice is picked automatically. The first table fixes the cube's
27
+ * model and runtime; later tables come from the same database and runtime.
28
+ * A table is added only once its schema has resolved.
29
+ */
30
+ export declare class CubeSourcePickerState {
31
+ readonly editorState: CubeEditorState;
32
+ isOpen: boolean;
33
+ model: ModelContext | undefined;
34
+ /** The model is Pure text the user pastes, not a bundled one */
35
+ isPastingModel: boolean;
36
+ pastedModelText: string;
37
+ /** The model the paste box last loaded: only it keeps the box shown */
38
+ private pastedModel;
39
+ outline: CubeModelOutline | undefined;
40
+ isLoadingModel: boolean;
41
+ databasePath: string | undefined;
42
+ runtimePath: string | undefined;
43
+ schemaName: string | undefined;
44
+ tableName: string | undefined;
45
+ tableSearch: string;
46
+ isResolving: boolean;
47
+ /** Why the outline or the table couldn't be loaded, shown in the dialog */
48
+ error: string | undefined;
49
+ /** Counts Add presses: closing the dialog moves it on, so the pending Add is dropped */
50
+ private confirmRequest;
51
+ constructor(editorState: CubeEditorState);
52
+ get models(): readonly BundledModel[];
53
+ /** Once the cube has a model, every table comes from it */
54
+ get fixedContext(): CubeContext | undefined;
55
+ /** Once the cube has a table, every other one comes from its database */
56
+ get fixedDatabasePath(): string | undefined;
57
+ get databases(): readonly CubeOutlineDatabase[];
58
+ get runtimes(): readonly CubeOutlineRuntime[];
59
+ get schemas(): readonly CubeOutlineSchema[];
60
+ /** The schema's tables, views left out, filtered by the search text */
61
+ get tables(): readonly CubeOutlineTable[];
62
+ get canConfirm(): boolean;
63
+ /**
64
+ * Opens the dialog on the cube's model, or on the only model offered. A
65
+ * model whose outline failed to load is loaded again. Does nothing while
66
+ * the cube is read-only.
67
+ */
68
+ open(): void;
69
+ /** Closes the dialog; a table still being typed is not added */
70
+ close(): void;
71
+ /** Offers a text box for a Pure model in place of the bundled ones */
72
+ startPastingModel(): void;
73
+ setPastedModelText(text: string): void;
74
+ /**
75
+ * Loads the pasted Pure text as the model: the cube will hold the text
76
+ * itself, so it counts towards the size a saved cube can have
77
+ */
78
+ loadPastedModel(): GeneratorFn<void>;
79
+ /**
80
+ * Loads a model's outline. Any model but the one the paste box loaded ends
81
+ * pasting, e.g. a bundled model, or the model of a cube opened meanwhile.
82
+ */
83
+ selectModel(model: ModelContext): GeneratorFn<void>;
84
+ selectDatabase(path: string | undefined): void;
85
+ selectRuntime(path: string | undefined): void;
86
+ selectSchema(name: string | undefined): void;
87
+ selectTable(name: string | undefined): void;
88
+ setTableSearch(search: string): void;
89
+ /**
90
+ * Types the picked table with the engine, then adds it; the first table
91
+ * also sets the cube's model and runtime, in the same undo step. The cube
92
+ * may have changed while the engine answered: the table is added only if
93
+ * the cube still has the same model and runtime and can take it.
94
+ */
95
+ confirm(): GeneratorFn<void>;
96
+ private resetFrom;
97
+ }
98
+ //# sourceMappingURL=CubeSourcePickerState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeSourcePickerState.d.ts","sourceRoot":"","sources":["../../src/stores/CubeSourcePickerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,YAAY,EAGlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAS3E,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,wBAAwB,CAAC;AAO5E,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,GAAI,OAAO,gBAAgB,KAAG,OACV,CAAC;AAEnD;;;;;;GAMG;AACH,qBAAa,qBAAqB;IAChC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IAEtC,MAAM,UAAS;IACf,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,gEAAgE;IAChE,cAAc,UAAS;IACvB,eAAe,SAAM;IACrB,uEAAuE;IACvE,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACtC,cAAc,UA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AE,MAAM,GAAG,SAAS,GAAG,IAAI;IAK5C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAK3C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC;;;;;OAKG;IACF,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC;IA6E7B,OAAO,CAAC,SAAS;CAWlB"}
@@ -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,eAA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C,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"}