@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.
- package/LICENSE +201 -0
- package/README.md +5 -2
- package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
- package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeCommand.js +40 -0
- package/lib/__lib__/LegendCubeCommand.js.map +1 -0
- package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
- package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeHelpText.js +27 -0
- package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
- package/lib/__lib__/LegendCubeLabels.d.ts +68 -0
- package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeLabels.js +109 -0
- package/lib/__lib__/LegendCubeLabels.js.map +1 -0
- package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
- package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeTesting.js +34 -0
- package/lib/__lib__/LegendCubeTesting.js.map +1 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
- package/lib/__test-utils__/CubeEngineTestSupport.d.ts +41 -0
- package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
- package/lib/__test-utils__/CubeEngineTestSupport.js +76 -0
- package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
- package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
- package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubePageTestUtils.js +68 -0
- package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
- package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
- package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
- package/lib/__test-utils__/CubeTestApplication.js +57 -0
- package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
- package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
- package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
- package/lib/__test-utils__/FakeCubeEngine.js +85 -0
- package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
- package/lib/components/CubeButton.d.ts +20 -0
- package/lib/components/CubeButton.d.ts.map +1 -0
- package/lib/components/CubeButton.js +24 -0
- package/lib/components/CubeButton.js.map +1 -0
- package/lib/components/CubeEditor.d.ts +31 -0
- package/lib/components/CubeEditor.d.ts.map +1 -0
- package/lib/components/CubeEditor.js +90 -0
- package/lib/components/CubeEditor.js.map +1 -0
- package/lib/components/CubeNodeIcon.d.ts +23 -0
- package/lib/components/CubeNodeIcon.d.ts.map +1 -0
- package/lib/components/CubeNodeIcon.js +32 -0
- package/lib/components/CubeNodeIcon.js.map +1 -0
- package/lib/components/canvas/CubeCanvas.d.ts +37 -0
- package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvas.js +135 -0
- package/lib/components/canvas/CubeCanvas.js.map +1 -0
- package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
- package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasContext.js +22 -0
- package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
- package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
- package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
- package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
- package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
- package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasDnd.js +51 -0
- package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
- package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
- package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasEdge.js +33 -0
- package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
- package/lib/components/canvas/CubeCanvasElements.d.ts +64 -0
- package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasElements.js +96 -0
- package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
- package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
- package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasLayout.js +63 -0
- package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
- package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
- package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasNode.js +72 -0
- package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
- package/lib/components/editors/CubeColumnPicker.d.ts +40 -0
- package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
- package/lib/components/editors/CubeColumnPicker.js +51 -0
- package/lib/components/editors/CubeColumnPicker.js.map +1 -0
- package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
- package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeFilterEditor.js +90 -0
- package/lib/components/editors/CubeFilterEditor.js.map +1 -0
- package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
- package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeJoinEditor.js +76 -0
- package/lib/components/editors/CubeJoinEditor.js.map +1 -0
- package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
- package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
- package/lib/components/editors/CubeNodeEditorPanel.js +71 -0
- package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
- package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
- package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
- package/lib/components/editors/CubeNodeEditorRegistry.js +30 -0
- package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
- package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
- package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeSourceEditor.js +42 -0
- package/lib/components/editors/CubeSourceEditor.js.map +1 -0
- package/lib/components/editors/CubeValueEditor.d.ts +40 -0
- package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeValueEditor.js +177 -0
- package/lib/components/editors/CubeValueEditor.js.map +1 -0
- package/lib/components/grid/CubeGridRegion.d.ts +23 -0
- package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
- package/lib/components/grid/CubeGridRegion.js +94 -0
- package/lib/components/grid/CubeGridRegion.js.map +1 -0
- package/lib/components/grid/CubeGridValues.d.ts +25 -0
- package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
- package/lib/components/grid/CubeGridValues.js +95 -0
- package/lib/components/grid/CubeGridValues.js.map +1 -0
- package/lib/components/grid/CubeResultGrid.d.ts +26 -0
- package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
- package/lib/components/grid/CubeResultGrid.js +50 -0
- package/lib/components/grid/CubeResultGrid.js.map +1 -0
- package/lib/components/palette/CubePalette.d.ts +29 -0
- package/lib/components/palette/CubePalette.d.ts.map +1 -0
- package/lib/components/palette/CubePalette.js +73 -0
- package/lib/components/palette/CubePalette.js.map +1 -0
- package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
- package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
- package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
- package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
- package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
- package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
- package/lib/components/source-picker/CubeSourcePicker.js +89 -0
- package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
- package/lib/graph-manager/CubeEngine.d.ts +115 -0
- package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
- package/lib/graph-manager/CubeEngine.js +61 -0
- package/lib/graph-manager/CubeEngine.js.map +1 -0
- package/lib/graph-manager/CubeModelOutlineHelper.d.ts +25 -0
- package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
- package/lib/graph-manager/CubeModelOutlineHelper.js +24 -0
- package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +121 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
- package/lib/index.css +17 -0
- package/lib/index.css.map +1 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/stores/CubeEditorState.d.ts +206 -0
- package/lib/stores/CubeEditorState.d.ts.map +1 -0
- package/lib/stores/CubeEditorState.js +551 -0
- package/lib/stores/CubeEditorState.js.map +1 -0
- package/lib/stores/CubeExecutionState.d.ts +67 -0
- package/lib/stores/CubeExecutionState.d.ts.map +1 -0
- package/lib/stores/CubeExecutionState.js +196 -0
- package/lib/stores/CubeExecutionState.js.map +1 -0
- package/lib/stores/CubeHost.d.ts +31 -0
- package/lib/stores/CubeHost.d.ts.map +1 -0
- package/lib/stores/CubeHost.js +17 -0
- package/lib/stores/CubeHost.js.map +1 -0
- package/lib/stores/CubeNodeEditorState.d.ts +85 -0
- package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
- package/lib/stores/CubeNodeEditorState.js +207 -0
- package/lib/stores/CubeNodeEditorState.js.map +1 -0
- package/lib/stores/CubeShowPureState.d.ts +38 -0
- package/lib/stores/CubeShowPureState.d.ts.map +1 -0
- package/lib/stores/CubeShowPureState.js +83 -0
- package/lib/stores/CubeShowPureState.js.map +1 -0
- package/lib/stores/CubeSourcePickerState.d.ts +98 -0
- package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
- package/lib/stores/CubeSourcePickerState.js +334 -0
- package/lib/stores/CubeSourcePickerState.js.map +1 -0
- package/lib/stores/CubeSpecTransferState.d.ts +60 -0
- package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
- package/lib/stores/CubeSpecTransferState.js +167 -0
- package/lib/stores/CubeSpecTransferState.js.map +1 -0
- package/lib/stores/LocalModelCatalog.d.ts +37 -0
- package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
- package/lib/stores/LocalModelCatalog.js +49 -0
- package/lib/stores/LocalModelCatalog.js.map +1 -0
- package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
- package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeFilterDraft.js +186 -0
- package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
- package/lib/stores/editors/CubeJoinDraft.d.ts +63 -0
- package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeJoinDraft.js +136 -0
- package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
- package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
- package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeNodeDraft.js +35 -0
- package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +29 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.js +33 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
- package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
- package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
- package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
- package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
- package/package.json +81 -3
- package/src/__lib__/LegendCubeCommand.ts +44 -0
- package/src/__lib__/LegendCubeHelpText.ts +38 -0
- package/src/__lib__/LegendCubeLabels.ts +141 -0
- package/src/__lib__/LegendCubeTesting.ts +33 -0
- package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
- package/src/__test-utils__/CubeEngineTestSupport.ts +137 -0
- package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
- package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
- package/src/__test-utils__/CubeTestApplication.ts +82 -0
- package/src/__test-utils__/FakeCubeEngine.ts +139 -0
- package/src/components/CubeButton.tsx +35 -0
- package/src/components/CubeEditor.tsx +239 -0
- package/src/components/CubeNodeIcon.tsx +47 -0
- package/src/components/canvas/CubeCanvas.tsx +260 -0
- package/src/components/canvas/CubeCanvasContext.ts +31 -0
- package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
- package/src/components/canvas/CubeCanvasDnd.ts +82 -0
- package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
- package/src/components/canvas/CubeCanvasElements.ts +150 -0
- package/src/components/canvas/CubeCanvasLayout.ts +88 -0
- package/src/components/canvas/CubeCanvasNode.tsx +141 -0
- package/src/components/editors/CubeColumnPicker.tsx +114 -0
- package/src/components/editors/CubeFilterEditor.tsx +309 -0
- package/src/components/editors/CubeJoinEditor.tsx +224 -0
- package/src/components/editors/CubeNodeEditorPanel.tsx +204 -0
- package/src/components/editors/CubeNodeEditorRegistry.ts +61 -0
- package/src/components/editors/CubeSourceEditor.tsx +116 -0
- package/src/components/editors/CubeValueEditor.tsx +332 -0
- package/src/components/grid/CubeGridRegion.tsx +274 -0
- package/src/components/grid/CubeGridValues.ts +125 -0
- package/src/components/grid/CubeResultGrid.tsx +84 -0
- package/src/components/palette/CubePalette.tsx +177 -0
- package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
- package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
- package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
- package/src/graph-manager/CubeEngine.ts +155 -0
- package/src/graph-manager/CubeModelOutlineHelper.ts +32 -0
- package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +157 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
- package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
- package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +124 -0
- package/src/index.ts +41 -0
- package/src/stores/CubeEditorState.ts +702 -0
- package/src/stores/CubeExecutionState.ts +255 -0
- package/src/stores/CubeHost.ts +32 -0
- package/src/stores/CubeNodeEditorState.ts +255 -0
- package/src/stores/CubeShowPureState.ts +96 -0
- package/src/stores/CubeSourcePickerState.ts +426 -0
- package/src/stores/CubeSpecTransferState.ts +198 -0
- package/src/stores/LocalModelCatalog.ts +70 -0
- package/src/stores/editors/CubeFilterDraft.ts +241 -0
- package/src/stores/editors/CubeJoinDraft.ts +197 -0
- package/src/stores/editors/CubeNodeDraft.ts +46 -0
- package/src/stores/editors/CubeNodeDraftRegistry.ts +49 -0
- package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
- package/tsconfig.json +118 -0
|
@@ -0,0 +1,171 @@
|
|
|
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 { EmitRole, lambda, storeAccessor, } from '@finos/legend-cube';
|
|
17
|
+
import { V1_EngineServerClient, V1_RenderStyle } from '@finos/legend-graph';
|
|
18
|
+
import { stringifyLosslessJSON, } from '@finos/legend-shared';
|
|
19
|
+
import { CubeEngineError, CubeEngineErrorKind, } from '../../../CubeEngine.js';
|
|
20
|
+
import { V1_buildCubeEngineError, V1_toCubeEngineError, } from './V1_CubeEngineErrors.js';
|
|
21
|
+
import { V1_CubeUnreadableResultError, V1_readCubeExecutionResult, } from './V1_CubeExecutionResultReader.js';
|
|
22
|
+
import { V1_serializeCubeLambda } from './V1_CubeLambdaSerializer.js';
|
|
23
|
+
import { V1_buildCubeModelOutline } from './V1_CubeModelOutlineBuilder.js';
|
|
24
|
+
import { V1_buildCubeSchema } from './V1_CubeRelationTypeAdapter.js';
|
|
25
|
+
/** The only model kind the slice runs: Pure text (PLAN §6.2.2) */
|
|
26
|
+
const TEXT_MODEL_TYPE = 'text';
|
|
27
|
+
const EXECUTION_CLIENT_VERSION = 'vX_X_X';
|
|
28
|
+
/**
|
|
29
|
+
* The node an execution lambda runs: the one its `from` call is stamped with
|
|
30
|
+
* (`{| <relation>->limit(…)->from(runtime)}`), where errors without a stamp go
|
|
31
|
+
*/
|
|
32
|
+
const captureNodeOf = (executionLambda) => {
|
|
33
|
+
const from = executionLambda.k === 'lambda' ? executionLambda.body[0] : undefined;
|
|
34
|
+
return from?.k === 'func' ? from.origin?.nodeId : undefined;
|
|
35
|
+
};
|
|
36
|
+
/** The message for a model of a kind this version can't run (PLAN §8.7) */
|
|
37
|
+
export const V1_unsupportedModelMessage = (type) => `This cube's model kind "${type}" isn't supported yet.`;
|
|
38
|
+
/**
|
|
39
|
+
* The Legend engine behind the Cube engine port (PLAN §8.7). It sends the
|
|
40
|
+
* cube's saved model context as it is, lambdas as protocol JSON with lossless
|
|
41
|
+
* numbers, and reads every response itself: the graph manager's wrappers drop
|
|
42
|
+
* type parameters and read numbers lossily (D8).
|
|
43
|
+
*/
|
|
44
|
+
export class V1_LegendCubeEngine {
|
|
45
|
+
client;
|
|
46
|
+
constructor(config, tracerService) {
|
|
47
|
+
this.client = new V1_EngineServerClient(config);
|
|
48
|
+
// every call throws without one
|
|
49
|
+
this.client.setTracerService(tracerService);
|
|
50
|
+
}
|
|
51
|
+
/** The model's Pure text, or an unsupported-model error for any other kind */
|
|
52
|
+
textOf(model, nodeId) {
|
|
53
|
+
if (model._type !== TEXT_MODEL_TYPE || typeof model.code !== 'string') {
|
|
54
|
+
throw new CubeEngineError(CubeEngineErrorKind.UNSUPPORTED_MODEL, V1_unsupportedModelMessage(model._type), nodeId);
|
|
55
|
+
}
|
|
56
|
+
return model.code;
|
|
57
|
+
}
|
|
58
|
+
async loadModel(model) {
|
|
59
|
+
const code = this.textOf(model);
|
|
60
|
+
try {
|
|
61
|
+
return V1_buildCubeModelOutline(await this.client.grammarToJSON_model(code));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw V1_toCubeEngineError(error, undefined, CubeEngineErrorKind.COMPILE);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
resolveSchemas(model, accessors) {
|
|
68
|
+
return this.typeAll(model, new Map([...accessors].map(([nodeId, path]) => [
|
|
69
|
+
nodeId,
|
|
70
|
+
lambda([], [storeAccessor(path, { nodeId, role: EmitRole.ACCESSOR })]),
|
|
71
|
+
])));
|
|
72
|
+
}
|
|
73
|
+
typeLambdas(model, lambdas) {
|
|
74
|
+
return this.typeAll(model, lambdas);
|
|
75
|
+
}
|
|
76
|
+
/** Types every lambda in one batch call: one entry per key, whatever fails */
|
|
77
|
+
async typeAll(model, lambdas) {
|
|
78
|
+
const typed = new Map();
|
|
79
|
+
if (!lambdas.size) {
|
|
80
|
+
return typed;
|
|
81
|
+
}
|
|
82
|
+
const failAll = (error) => new Map([...lambdas.keys()].map((nodeId) => [
|
|
83
|
+
nodeId,
|
|
84
|
+
V1_toCubeEngineError(error, nodeId, CubeEngineErrorKind.COMPILE),
|
|
85
|
+
]));
|
|
86
|
+
let response;
|
|
87
|
+
try {
|
|
88
|
+
this.textOf(model);
|
|
89
|
+
const body = stringifyLosslessJSON({
|
|
90
|
+
model,
|
|
91
|
+
lambdas: Object.fromEntries([...lambdas].map(([nodeId, ir]) => [
|
|
92
|
+
nodeId,
|
|
93
|
+
V1_serializeCubeLambda(ir),
|
|
94
|
+
])),
|
|
95
|
+
});
|
|
96
|
+
// sent as text, so numbers keep every digit; the client sends a string body as it is
|
|
97
|
+
response = (await this.client.batchLambdasRelationType(body));
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return failAll(error);
|
|
101
|
+
}
|
|
102
|
+
// the engine answers `result`; legend-graph's response type says `results` (LG-1)
|
|
103
|
+
const results = (response.result ?? response.results ?? {});
|
|
104
|
+
const errors = (response.errors ?? {});
|
|
105
|
+
// own keys only: a node id like `__proto__` mustn't read Object.prototype
|
|
106
|
+
lambdas.forEach((_, nodeId) => {
|
|
107
|
+
const relationType = Object.hasOwn(results, nodeId)
|
|
108
|
+
? results[nodeId]
|
|
109
|
+
: undefined;
|
|
110
|
+
if (relationType) {
|
|
111
|
+
try {
|
|
112
|
+
typed.set(nodeId, V1_buildCubeSchema(relationType));
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
typed.set(nodeId, new CubeEngineError(CubeEngineErrorKind.COMPILE, error.message, nodeId));
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
typed.set(nodeId, V1_buildCubeEngineError(Object.hasOwn(errors, nodeId) ? errors[nodeId] : undefined, nodeId, CubeEngineErrorKind.COMPILE) ??
|
|
120
|
+
new CubeEngineError(CubeEngineErrorKind.NETWORK, `The engine gave no type for this node`, nodeId));
|
|
121
|
+
});
|
|
122
|
+
return typed;
|
|
123
|
+
}
|
|
124
|
+
async execute(model, executionLambda, options) {
|
|
125
|
+
const captureId = captureNodeOf(executionLambda);
|
|
126
|
+
const startedAt = Date.now();
|
|
127
|
+
let text;
|
|
128
|
+
try {
|
|
129
|
+
this.textOf(model);
|
|
130
|
+
const body = stringifyLosslessJSON({
|
|
131
|
+
clientVersion: EXECUTION_CLIENT_VERSION,
|
|
132
|
+
function: V1_serializeCubeLambda(executionLambda),
|
|
133
|
+
model,
|
|
134
|
+
context: { _type: 'BaseExecutionContext' },
|
|
135
|
+
parameterValues: [],
|
|
136
|
+
});
|
|
137
|
+
// `returnAsResponse` leaves the body unread, so it can be read losslessly
|
|
138
|
+
const response = (await this.client.runQuery(body, {
|
|
139
|
+
returnAsResponse: true,
|
|
140
|
+
abortController: options?.abortController,
|
|
141
|
+
}));
|
|
142
|
+
text = await response.text();
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
throw V1_toCubeEngineError(error, captureId, CubeEngineErrorKind.EXECUTION);
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
return {
|
|
149
|
+
...V1_readCubeExecutionResult(text),
|
|
150
|
+
durationMs: Date.now() - startedAt,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error instanceof V1_CubeUnreadableResultError) {
|
|
155
|
+
throw new CubeEngineError(CubeEngineErrorKind.EXECUTION, error.message, captureId);
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async renderPure(lambdaIR) {
|
|
161
|
+
try {
|
|
162
|
+
// sent as text, as typing and execution are: the serialized lambda holds
|
|
163
|
+
// lossless numbers, which plain JSON.stringify would write as objects
|
|
164
|
+
return await this.client.JSONToGrammar_lambda(stringifyLosslessJSON(V1_serializeCubeLambda(lambdaIR)), V1_RenderStyle.PRETTY);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
throw V1_toCubeEngineError(error, undefined, CubeEngineErrorKind.COMPILE);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=V1_LegendCubeEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"V1_LegendCubeEngine.js","sourceRoot":"","sources":["../../../../../src/graph-manager/protocol/pure/v1/V1_L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sB,CAAC,QAAQ,CAAC,CACP,EAC3B,cAAc,CAAC,MAAM,CACtB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { jest } from '@jest/globals';
|
|
17
|
+
import { V1_LegendCubeEngine } from '../V1_LegendCubeEngine.js';
|
|
18
|
+
export declare const V1_createEngineBackedCubeEngine: () => {
|
|
19
|
+
engine: V1_LegendCubeEngine;
|
|
20
|
+
calls: Record<"grammarToJSON_model" | "batchLambdasRelationType" | "runQuery", jest.Mock>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=V1_CubeEngineTestUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"V1_CubeEngineTestUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAarC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAuChE,eAAO,MAAM,+BAA+B,QAAO;IACjD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,MAAM,CACX,qBAAqB,GAAG,0BAA0B,GAAG,UAAU,EAC/D,IAAI,CAAC,IAAI,CACV,CAAC;CAkDH,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
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 { jest } from '@jest/globals';
|
|
17
|
+
import { ENGINE_TEST_SUPPORT__grammarToJSON_model } from '@finos/legend-graph/test';
|
|
18
|
+
import { NetworkClientError, TracerService, } from '@finos/legend-shared';
|
|
19
|
+
import { AxiosError } from 'axios';
|
|
20
|
+
import { CUBE_ENGINE_TEST__execute, CUBE_ENGINE_TEST__jsonToGrammar_lambda, CUBE_ENGINE_TEST__lambdaRelationTypeBatch, } from '../../../../../__test-utils__/CubeEngineTestSupport.js';
|
|
21
|
+
import { V1_LegendCubeEngine } from '../V1_LegendCubeEngine.js';
|
|
22
|
+
// The real Cube engine, its client's calls routed to the engine on :6300 by
|
|
23
|
+
// Cube's own test helpers (PLAN §3.4): the test environment refuses network
|
|
24
|
+
// calls, and the execute helper hands back the body unread, so the lossless
|
|
25
|
+
// reader runs as in the browser. Every helper fails as the client does.
|
|
26
|
+
/** A failed call, as the engine client throws it: a `NetworkClientError` with the engine's payload */
|
|
27
|
+
const clientError = (status, payload) => new NetworkClientError({
|
|
28
|
+
status,
|
|
29
|
+
statusText: String(status),
|
|
30
|
+
url: 'http://localhost:6300/api',
|
|
31
|
+
}, payload);
|
|
32
|
+
/** The payload of a failed call, as the client reads it: JSON when it parses, else its text */
|
|
33
|
+
const parseOrText = (text) => {
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(text);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return text;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/** A helper's non-2xx response, rethrown as the client throws it */
|
|
42
|
+
const rethrowAsClientError = (error) => {
|
|
43
|
+
if (error instanceof AxiosError && error.response) {
|
|
44
|
+
const data = error.response.data;
|
|
45
|
+
throw clientError(error.response.status, typeof data === 'string' ? parseOrText(data) : data);
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
};
|
|
49
|
+
export const V1_createEngineBackedCubeEngine = () => {
|
|
50
|
+
const engine = new V1_LegendCubeEngine({ baseUrl: 'http://localhost:6300/api' }, new TracerService());
|
|
51
|
+
const { client } = engine;
|
|
52
|
+
const grammarToJSON_model = jest
|
|
53
|
+
.spyOn(client, 'grammarToJSON_model')
|
|
54
|
+
.mockImplementation(async (code) => (await ENGINE_TEST_SUPPORT__grammarToJSON_model(code).catch(rethrowAsClientError)));
|
|
55
|
+
const batchLambdasRelationType = jest
|
|
56
|
+
.spyOn(client, 'batchLambdasRelationType')
|
|
57
|
+
.mockImplementation(async (input) => (await CUBE_ENGINE_TEST__lambdaRelationTypeBatch(input).catch(rethrowAsClientError)));
|
|
58
|
+
const runQuery = jest
|
|
59
|
+
.spyOn(client, 'runQuery')
|
|
60
|
+
.mockImplementation(async (input) => {
|
|
61
|
+
const response = await CUBE_ENGINE_TEST__execute(input);
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
throw clientError(response.status, parseOrText(await response.text()));
|
|
64
|
+
}
|
|
65
|
+
return response;
|
|
66
|
+
});
|
|
67
|
+
jest
|
|
68
|
+
.spyOn(client, 'JSONToGrammar_lambda')
|
|
69
|
+
.mockImplementation(async (lambda, renderStyle) => CUBE_ENGINE_TEST__jsonToGrammar_lambda(lambda, renderStyle).catch(rethrowAsClientError));
|
|
70
|
+
return {
|
|
71
|
+
engine,
|
|
72
|
+
calls: {
|
|
73
|
+
grammarToJSON_model: grammarToJSON_model,
|
|
74
|
+
batchLambdasRelationType: batchLambdasRelationType,
|
|
75
|
+
runQuery: runQuery,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=V1_CubeEngineTestUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"V1_CubeEngineTestUtils.js","sourceRoot":"","sources":["../../../../../../src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,wCAAwC,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EACL,kBAAkB,EAElB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,sCAAsC,EACtC,yCAAyC,GAC1C,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,wEAAwE;AAExE,sGAAsG;AACtG,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,OAAgB,EAAsB,EAAE,CAC3E,IAAI,kBAAkB,CACpB;IACE,MAAM;IACN,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;IAC1B,GAAG,EAA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E,CACd,CAAC,MAAM,yCAAyC,CAAC,KAAK,CAAC,CAAC,KAAK,CAC3D,oBAAoB,CACrB,CAAU,CACd,CAAC;IACJ,MAAM,QAAQ,GAAG,IAAI;SAClB,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC;SACzB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAClC,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAC9C,KAA0B,CAC3B,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,QAA+B,CAAC;IACzC,CAAC,CAAC,CAAC;IACL,IAAI;SACD,KAAK,CAAC,MAAM,EAAE,sBAAsB,CAAC;SACrC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAChD,sCAAsC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAK,CAC/D,oBAAoB,CACrB,CACF,CAAC;IACJ,OAAO;QACL,MAAM;QACN,KAAK,EAAE;YACL,mBAAmB,EAAE,mBAA2C;YAChE,wBAAwB,EACtB,wBAAgD;YAClD,QAAQ,EAAE,QAAgC;SAC3C;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/index.css
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @license @finos/legend-cube-builder v0.0.2
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.legend-cube{height:100%;width:100%}/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../style/index.scss"],"names":[],"mappings":"AAmBA,aACE,YACA","file":"index.css"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export { LEGEND_CUBE_COMMAND_CONFIG, LEGEND_CUBE_COMMAND_KEY, } from './__lib__/LegendCubeCommand.js';
|
|
17
|
+
export { LEGEND_CUBE_TEST_ID } from './__lib__/LegendCubeTesting.js';
|
|
18
|
+
export { CubeEditor } from './components/CubeEditor.js';
|
|
19
|
+
export * from './graph-manager/CubeEngine.js';
|
|
20
|
+
export { getRuntimesForDatabase } from './graph-manager/CubeModelOutlineHelper.js';
|
|
21
|
+
export { buildCubeEngine, type CubeEngineConfig, } from './graph-manager/protocol/pure/CubeEngineBuilder.js';
|
|
22
|
+
export type { CubeHost } from './stores/CubeHost.js';
|
|
23
|
+
export { BUNDLED_MODELS, type BundledModel, createTextModel, LocalModelCatalog, } from './stores/LocalModelCatalog.js';
|
|
24
|
+
export { CUBE_NORTHWIND_DATABASE, CUBE_NORTHWIND_MODEL, CUBE_NORTHWIND_RUNTIME, } from './stores/fixtures/CubeNorthwindModel.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,oDAAoD,CAAC;AAC5D,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,yCAAyC,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
export { LEGEND_CUBE_COMMAND_CONFIG, LEGEND_CUBE_COMMAND_KEY, } from './__lib__/LegendCubeCommand.js';
|
|
17
|
+
export { LEGEND_CUBE_TEST_ID } from './__lib__/LegendCubeTesting.js';
|
|
18
|
+
export { CubeEditor } from './components/CubeEditor.js';
|
|
19
|
+
export * from './graph-manager/CubeEngine.js';
|
|
20
|
+
export { getRuntimesForDatabase } from './graph-manager/CubeModelOutlineHelper.js';
|
|
21
|
+
export { buildCubeEngine, } from './graph-manager/protocol/pure/CubeEngineBuilder.js';
|
|
22
|
+
export { BUNDLED_MODELS, createTextModel, LocalModelCatalog, } from './stores/LocalModelCatalog.js';
|
|
23
|
+
export { CUBE_NORTHWIND_DATABASE, CUBE_NORTHWIND_MODEL, CUBE_NORTHWIND_RUNTIME, } from './stores/fixtures/CubeNorthwindModel.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EACL,eAAe,GAEhB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EACL,cAAc,EAEd,eAAe,EACf,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
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 { CubeDocument, type NodeRegistry, type Query, QueryEmitter, type QueryNode, RelationalTableSource, type SchemaInferenceResult } from '@finos/legend-cube';
|
|
17
|
+
import type { CommandRegistrar } from '@finos/legend-application';
|
|
18
|
+
import type { GeneratorFn } from '@finos/legend-shared';
|
|
19
|
+
import { CubeEngineError, type CubeModelOutline } from '../graph-manager/CubeEngine.js';
|
|
20
|
+
import { CubeExecutionState } from './CubeExecutionState.js';
|
|
21
|
+
import type { CubeHost } from './CubeHost.js';
|
|
22
|
+
import { CubeNodeEditorState } from './CubeNodeEditorState.js';
|
|
23
|
+
import { CubeShowPureState } from './CubeShowPureState.js';
|
|
24
|
+
import { CubeSourcePickerState } from './CubeSourcePickerState.js';
|
|
25
|
+
import { CubeSpecTransferState } from './CubeSpecTransferState.js';
|
|
26
|
+
/** An engine error placed on a node: its first line shows on the node, its detail in the grid */
|
|
27
|
+
export interface CubeHostIssue {
|
|
28
|
+
readonly firstLine: string;
|
|
29
|
+
readonly detail: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The state of one Cube page (PLAN §7.8). The document is immutable: every
|
|
33
|
+
* edit makes a new one through `applyDocument`, which keeps the previous one
|
|
34
|
+
* for undo. Domain and port values are held by reference, never observed
|
|
35
|
+
* deeply.
|
|
36
|
+
*/
|
|
37
|
+
export declare class CubeEditorState implements CommandRegistrar {
|
|
38
|
+
readonly host: CubeHost;
|
|
39
|
+
/** One registry for inference, emission and the saved spec */
|
|
40
|
+
readonly registry: NodeRegistry;
|
|
41
|
+
readonly execution: CubeExecutionState;
|
|
42
|
+
readonly sourcePicker: CubeSourcePickerState;
|
|
43
|
+
readonly specTransfer: CubeSpecTransferState;
|
|
44
|
+
readonly showPure: CubeShowPureState;
|
|
45
|
+
readonly nodeEditor: CubeNodeEditorState;
|
|
46
|
+
document: CubeDocument;
|
|
47
|
+
/** Earlier documents, oldest first */
|
|
48
|
+
history: readonly CubeDocument[];
|
|
49
|
+
/** Engine errors by node id: shown with the node's own errors, never part of inference */
|
|
50
|
+
hostIssues: ReadonlyMap<string, CubeHostIssue>;
|
|
51
|
+
/**
|
|
52
|
+
* Warnings by node key, e.g. a table that changed since the cube was saved:
|
|
53
|
+
* shown on the node, never errors, and gone once the node is replaced
|
|
54
|
+
*/
|
|
55
|
+
warnings: ReadonlyMap<number, readonly string[]>;
|
|
56
|
+
/**
|
|
57
|
+
* The outline of each model the cube used, loaded when an editor needs it,
|
|
58
|
+
* e.g. for the Join's 'type unknown' warning; by reference, never observed
|
|
59
|
+
* deeply
|
|
60
|
+
*/
|
|
61
|
+
private modelOutlines;
|
|
62
|
+
/** Sources sent to the engine to be typed again, until it answers */
|
|
63
|
+
private pendingSources;
|
|
64
|
+
/** The rows a run returns; kept per user, never in the cube */
|
|
65
|
+
rowLimit: number;
|
|
66
|
+
/** The palette shows icons only; kept per user, never in the cube */
|
|
67
|
+
isPaletteCollapsed: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The cube was saved by a newer version of Cube: it can be viewed and run,
|
|
70
|
+
* but not changed, undone or exported (Settled before M1.8)
|
|
71
|
+
*/
|
|
72
|
+
readOnly: boolean;
|
|
73
|
+
/** Documents in the undo history that were read-only, so undo restores the flag */
|
|
74
|
+
private readonly readOnlyDocuments;
|
|
75
|
+
/** Documents an import replaced: undoing back to one opens another cube again */
|
|
76
|
+
private readonly importedOver;
|
|
77
|
+
constructor(host: CubeHost, document?: CubeDocument);
|
|
78
|
+
/** Each node's schema and errors, query-level rules included, as the emitter sees them */
|
|
79
|
+
get analysis(): SchemaInferenceResult;
|
|
80
|
+
get emitter(): QueryEmitter;
|
|
81
|
+
/** The cube shown has tables being typed again, after an import */
|
|
82
|
+
get isResolvingSources(): boolean;
|
|
83
|
+
/** The source is being typed again by the engine, e.g. after an import */
|
|
84
|
+
isPendingSource(node: QueryNode): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The node's errors, each once: its own and those of the query rules, then
|
|
87
|
+
* the first line of the engine's error on it
|
|
88
|
+
*/
|
|
89
|
+
getNodeErrors(nodeId: string): readonly string[];
|
|
90
|
+
/** The outline of the cube's model, once an editor has loaded it */
|
|
91
|
+
get modelOutline(): CubeModelOutline | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Loads the outline of the cube's model, once per model. It only adds
|
|
94
|
+
* warnings, so a model that fails to load shows none.
|
|
95
|
+
*/
|
|
96
|
+
loadModelOutline(): GeneratorFn<void>;
|
|
97
|
+
/** One of Cube's dialogs is open: the source picker, Import or Export, Show Pure */
|
|
98
|
+
get isDialogOpen(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The page's keyboard shortcuts, while it is open (spec §17.12). Each does
|
|
101
|
+
* nothing when its button can't be used, and nothing while a Cube dialog
|
|
102
|
+
* is open, since a dialog doesn't stop the app's shortcuts (user's choice,
|
|
103
|
+
* 2026-10-07). Undo leaves Ctrl+Z to a text field that has the focus.
|
|
104
|
+
*/
|
|
105
|
+
registerCommands(): void;
|
|
106
|
+
deregisterCommands(): void;
|
|
107
|
+
get canUndo(): boolean;
|
|
108
|
+
/** The one way to change the cube; the document before goes to the undo history */
|
|
109
|
+
applyDocument(next: CubeDocument): void;
|
|
110
|
+
/**
|
|
111
|
+
* Opens another cube in place of this one, e.g. an imported spec: one undo
|
|
112
|
+
* step. Stops any run and any table being added, closes the node editor
|
|
113
|
+
* without applying its edits, and drops the last run's rows and errors,
|
|
114
|
+
* which belong to the cube before. Never runs the cube.
|
|
115
|
+
*/
|
|
116
|
+
importDocument(next: CubeDocument, readOnly: boolean): void;
|
|
117
|
+
/**
|
|
118
|
+
* Types the cube's tables again, in one engine call, outside the undo
|
|
119
|
+
* history (PLAN §10.3, Settled before M1.8):
|
|
120
|
+
* - a table whose columns are the saved ones is left as it is;
|
|
121
|
+
* - a table that changed takes its new columns, with a warning listing the
|
|
122
|
+
* changes;
|
|
123
|
+
* - a table with saved columns that can't be typed keeps them, with a
|
|
124
|
+
* warning; one without them shows the engine's error.
|
|
125
|
+
*
|
|
126
|
+
* Then filter values saved as invalid text are read again against the
|
|
127
|
+
* columns. The answer goes to every document holding the very source
|
|
128
|
+
* objects that were typed: the cube shown and the undo snapshots taken
|
|
129
|
+
* meanwhile, so undoing an edit made while the tables were typed keeps
|
|
130
|
+
* them typed. A source the user changed meanwhile is a new object, and is
|
|
131
|
+
* left alone.
|
|
132
|
+
*
|
|
133
|
+
* `only` types just these sources of the cube shown, e.g. one Refresh. A
|
|
134
|
+
* table found unchanged loses any earlier warning.
|
|
135
|
+
*/
|
|
136
|
+
reresolveSources(only?: readonly RelationalTableSource[]): GeneratorFn<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Types a table again with the engine, from its Source panel (spec §17.6),
|
|
139
|
+
* as a re-check after an import does: no undo step, nothing changes when
|
|
140
|
+
* its columns are the same, and a warning lists any change.
|
|
141
|
+
*/
|
|
142
|
+
refreshSource(nodeId: string): GeneratorFn<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Restores the document before the last edit; does nothing when there is
|
|
145
|
+
* no history. A restored query is a new object (PLAN §4.3), so rows that
|
|
146
|
+
* ran before the edit show as stale. An edit that left the query alone,
|
|
147
|
+
* such as a rename, keeps it, with its rows and engine errors. Undoing an
|
|
148
|
+
* import closes the node editor and the picker, as the import did.
|
|
149
|
+
*/
|
|
150
|
+
undo(): void;
|
|
151
|
+
private pushHistory;
|
|
152
|
+
/** Engine errors belong to the query they came from, so they are dropped when the query changes */
|
|
153
|
+
private replaceDocument;
|
|
154
|
+
applyQuery(next: Query): void;
|
|
155
|
+
/** Makes a node the capture node, the one Execute runs */
|
|
156
|
+
select(nodeId: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* Feeds a node into another, on the port if given, else the first free one.
|
|
159
|
+
* Does nothing when the query doesn't allow it or the cube is read-only.
|
|
160
|
+
*/
|
|
161
|
+
connect(sourceId: string, targetId: string, port?: string): void;
|
|
162
|
+
/**
|
|
163
|
+
* Whether a node of the type can be added: a transform, unconnected or
|
|
164
|
+
* spliced in after `afterId`, when the query allows it; a source only
|
|
165
|
+
* unconnected, through the source picker. Never while the cube is read-only.
|
|
166
|
+
*/
|
|
167
|
+
canAddNode(type: string, afterId?: string): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Adds a node of the type, as the palette and the context menu do (spec
|
|
170
|
+
* §17.4): a transform with its default settings, unconnected or spliced in
|
|
171
|
+
* after `afterId`; a source opens the source picker, which adds it once
|
|
172
|
+
* the engine has typed it. Does nothing `canAddNode` refuses.
|
|
173
|
+
*/
|
|
174
|
+
addNode(type: string, afterId?: string): void;
|
|
175
|
+
/** Whether dropping a node on another does anything: connect it, or else move it after it */
|
|
176
|
+
canDropNode(nodeId: string, targetId: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Drops a node on another (spec §17.4): it feeds the target's first free
|
|
179
|
+
* port if it can, else it moves to after the target
|
|
180
|
+
*/
|
|
181
|
+
dropNode(nodeId: string, targetId: string): void;
|
|
182
|
+
canRemoveNode(nodeId: string): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Removes a node, healing the chain around it. Removing the last node also
|
|
185
|
+
* clears the cube's model and runtime, in the same undo step, so the next
|
|
186
|
+
* table can come from any model (user's choice, 2026-10-07).
|
|
187
|
+
*/
|
|
188
|
+
removeNode(nodeId: string): void;
|
|
189
|
+
canSwapInputs(nodeId: string): boolean;
|
|
190
|
+
/** Swaps a binary node's two inputs; its settings follow them, e.g. a Join's key columns */
|
|
191
|
+
swapInputs(nodeId: string): void;
|
|
192
|
+
/**
|
|
193
|
+
* Shows or hides the graph, which the cube saves (spec §17.1). An undoable
|
|
194
|
+
* edit that leaves the query, and so the rows, as they are (M1.8b).
|
|
195
|
+
*/
|
|
196
|
+
setShowGraph(showGraph: boolean): void;
|
|
197
|
+
setHostIssue(nodeId: string, error: CubeEngineError): void;
|
|
198
|
+
clearHostIssues(): void;
|
|
199
|
+
/** Sets and remembers the row limit; a value that isn't a whole number of at least 1 is refused */
|
|
200
|
+
setRowLimit(value: number): boolean;
|
|
201
|
+
/** Collapses or expands the palette, and remembers it for the user */
|
|
202
|
+
setPaletteCollapsed(collapsed: boolean): void;
|
|
203
|
+
/** Stops any run; call when the page closes */
|
|
204
|
+
dispose(): void;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=CubeEditorState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeEditorState.d.ts","sourceRoot":"","sources":["../../src/stores/CubeEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,YAAY,EAGZ,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,YAAY,EACZ,KAAK,SAAS,EACd,qBAAqB,EAGrB,KAAK,qBAAqB,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAkBxD,OAAO,EACL,eAAe,EAEf,KAAK,gBAAgB,EACtB,MAAM,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