@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
package/package.json
CHANGED
|
@@ -1,6 +1,84 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-cube-builder",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Legend Cube builder: the canvas UI and the Legend engine adapter of the Legend Cube query builder",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"legend",
|
|
7
|
+
"legend-cube",
|
|
8
|
+
"legend-cube-builder",
|
|
9
|
+
"cube",
|
|
10
|
+
"query"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/finos/legend-studio/tree/master/packages/legend-cube-builder",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/finos/legend-studio/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/finos/legend-studio.git",
|
|
19
|
+
"directory": "packages/legend-cube-builder"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./lib/index.js",
|
|
26
|
+
"./lib/index.css": "./lib/index.css"
|
|
27
|
+
},
|
|
28
|
+
"module": "lib/index.js",
|
|
29
|
+
"types": "lib/index.d.ts",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "yarn clean && yarn build:sass && yarn build:ts",
|
|
32
|
+
"build:sass": "cross-env INIT_CWD=$INIT_CWD node ../../scripts/workflow/buildSass.js",
|
|
33
|
+
"build:ts": "tsc --project ./tsconfig.build.json",
|
|
34
|
+
"clean": "npm-run-all clean:cache clean:lib",
|
|
35
|
+
"clean:cache": "rimraf \"build\"",
|
|
36
|
+
"clean:lib": "rimraf \"lib\"",
|
|
37
|
+
"dev": "npm-run-all --parallel dev:sass dev:ts",
|
|
38
|
+
"dev:sass": "sass style:lib --watch --load-path=../../node_modules/@finos/legend-art/scss",
|
|
39
|
+
"dev:ts": "tsc --watch --preserveWatchOutput",
|
|
40
|
+
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location ./build/.eslintcache --report-unused-disable-directives --parser-options=project:\"./tsconfig.json\" \"./src/**/*.{js,ts,tsx}\"",
|
|
41
|
+
"publish:prepare": "node ../../scripts/release/preparePublishContent.js",
|
|
42
|
+
"publish:snapshot": "node ../../scripts/release/publishDevSnapshot.js",
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"test:watch": "jest --watch"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@dagrejs/dagre": "1.1.4",
|
|
48
|
+
"@finos/legend-application": "16.0.126",
|
|
49
|
+
"@finos/legend-art": "7.1.166",
|
|
50
|
+
"@finos/legend-cube": "0.0.2",
|
|
51
|
+
"@finos/legend-graph": "32.7.4",
|
|
52
|
+
"@finos/legend-lego": "2.0.228",
|
|
53
|
+
"@finos/legend-shared": "11.0.31",
|
|
54
|
+
"@types/react": "19.0.10",
|
|
55
|
+
"@types/react-dom": "19.0.4",
|
|
56
|
+
"@xyflow/react": "12.4.4",
|
|
57
|
+
"mobx": "6.13.6",
|
|
58
|
+
"mobx-react-lite": "4.1.0",
|
|
59
|
+
"react": "19.0.1",
|
|
60
|
+
"react-dnd": "16.0.1",
|
|
61
|
+
"react-dom": "19.0.1",
|
|
62
|
+
"serializr": "3.0.3"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@finos/legend-dev-utils": "2.2.8",
|
|
66
|
+
"@jest/globals": "29.7.0",
|
|
67
|
+
"@testing-library/dom": "10.4.0",
|
|
68
|
+
"@testing-library/react": "16.2.0",
|
|
69
|
+
"axios": "1.16.0",
|
|
70
|
+
"cross-env": "7.0.3",
|
|
71
|
+
"eslint": "9.22.0",
|
|
72
|
+
"jest": "29.7.0",
|
|
73
|
+
"npm-run-all": "4.1.5",
|
|
74
|
+
"rimraf": "6.0.1",
|
|
75
|
+
"sass": "1.85.1",
|
|
76
|
+
"typescript": "5.8.2"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"react": "^19.0.1"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"directory": "build/publishContent"
|
|
83
|
+
}
|
|
6
84
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { CommandConfigData } from '@finos/legend-application';
|
|
18
|
+
|
|
19
|
+
// The Cube page's keyboard shortcuts (spec §17.12, PLAN §3.5). A Legend
|
|
20
|
+
// application binds keys only through its plugins, so the host contributes
|
|
21
|
+
// this config from one of its plugins (`getExtraKeyedCommandConfigEntries`);
|
|
22
|
+
// the page registers the commands while it is open.
|
|
23
|
+
|
|
24
|
+
export enum LEGEND_CUBE_COMMAND_KEY {
|
|
25
|
+
EXECUTE = 'legend-cube.execute',
|
|
26
|
+
UNDO = 'legend-cube.undo',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Keys as `KeyboardEvent.code` names */
|
|
30
|
+
export const LEGEND_CUBE_COMMAND_CONFIG: CommandConfigData = {
|
|
31
|
+
[LEGEND_CUBE_COMMAND_KEY.EXECUTE]: {
|
|
32
|
+
title: 'Execute the query',
|
|
33
|
+
defaultKeyboardShortcut: 'F9',
|
|
34
|
+
},
|
|
35
|
+
[LEGEND_CUBE_COMMAND_KEY.UNDO]: {
|
|
36
|
+
title: 'Undo the last change',
|
|
37
|
+
defaultKeyboardShortcut: 'Control+KeyZ',
|
|
38
|
+
additionalKeyboardShortcuts: ['Meta+KeyZ'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** How the buttons' tooltips name the shortcuts */
|
|
43
|
+
export const EXECUTE_SHORTCUT_LABEL = 'F9';
|
|
44
|
+
export const UNDO_SHORTCUT_LABEL = 'Ctrl+Z / Cmd+Z';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
Filter,
|
|
19
|
+
Join,
|
|
20
|
+
RelationalTableSource,
|
|
21
|
+
UnknownNode,
|
|
22
|
+
} from '@finos/legend-cube';
|
|
23
|
+
|
|
24
|
+
// The node editor's help text, verbatim from the original (spec §17.9). A
|
|
25
|
+
// new node type adds its entry here.
|
|
26
|
+
|
|
27
|
+
export const CUBE_NODE_HELP_TEXT: Readonly<Record<string, string>> = {
|
|
28
|
+
[RelationalTableSource.TYPE]: 'Sources data from relational database table.',
|
|
29
|
+
[Filter.TYPE]:
|
|
30
|
+
'Reduces the number of rows in the previous data set, keeping only rows matching the specified criteria.',
|
|
31
|
+
[Join.TYPE]:
|
|
32
|
+
'Joins two previous data sets using specified columns as join keys.',
|
|
33
|
+
[UnknownNode.TYPE]: 'Source or transformation unknown to the application.',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** The tooltip of the editor's Select link (spec §17.9) */
|
|
37
|
+
export const SELECT_NODE_TOOLTIP =
|
|
38
|
+
'Selects this node as active and its output will be shown in the grid once query is executed.';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { SchemaColumn, SchemaDiff } from '@finos/legend-cube';
|
|
18
|
+
import { CubeTableFlag } from '../graph-manager/CubeEngine.js';
|
|
19
|
+
|
|
20
|
+
// The page's own text and settings; validation messages live in the core's
|
|
21
|
+
// CubeMessages (PLAN §4.11)
|
|
22
|
+
|
|
23
|
+
/** The rows a run returns by default (PLAN §9, Settled before M1.8) */
|
|
24
|
+
export const DEFAULT_ROW_LIMIT = 1000;
|
|
25
|
+
/** Above this, the row limit input warns that the tab may slow down; there is no hard cap */
|
|
26
|
+
export const ROW_LIMIT_WARNING_THRESHOLD = 100_000;
|
|
27
|
+
/** At most this many undo steps are kept */
|
|
28
|
+
export const MAX_UNDO_STEPS = 100;
|
|
29
|
+
|
|
30
|
+
export enum LEGEND_CUBE_USER_DATA_KEY {
|
|
31
|
+
ROW_LIMIT = 'legend-cube.row-limit',
|
|
32
|
+
PALETTE_COLLAPSED = 'legend-cube.palette-collapsed',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const UNSAVED_CUBE_NAME = 'Unsaved Query';
|
|
36
|
+
/** Why a cube's edits are disabled: it was saved by a newer version (Settled before M1.8) */
|
|
37
|
+
export const READ_ONLY_CUBE_TITLE =
|
|
38
|
+
"This cube was saved by a newer version of Legend Cube, so it can't be changed or exported";
|
|
39
|
+
/** How a SQL NULL shows in the grid, distinct from an empty string */
|
|
40
|
+
export const NULL_CELL_TEXT = '(null)';
|
|
41
|
+
|
|
42
|
+
/** Pending labels: lower-case gerunds, shown as they are (spec §17.13) */
|
|
43
|
+
export enum CUBE_PENDING_LABEL {
|
|
44
|
+
LOADING_MODEL = 'loading model',
|
|
45
|
+
RESOLVING_SOURCE = 'resolving source',
|
|
46
|
+
EXECUTING_QUERY = 'executing query',
|
|
47
|
+
RENDERING_QUERY = 'rendering query',
|
|
48
|
+
REFRESHING_SOURCE = 'refreshing source',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const getRowLimitError = (text: string): string | undefined => {
|
|
52
|
+
const value = Number(text.trim());
|
|
53
|
+
return text.trim() === '' || !Number.isSafeInteger(value) || value < 1
|
|
54
|
+
? 'The row limit must be a whole number of at least 1.'
|
|
55
|
+
: undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const getTruncationMessage = (rowLimit: number): string =>
|
|
59
|
+
`Showing the first ${rowLimit.toLocaleString('en-US')} rows; the query returned more.`;
|
|
60
|
+
|
|
61
|
+
/** How the picker shows a table's problem, and why (PLAN §6.2.6) */
|
|
62
|
+
export const CUBE_TABLE_FLAG_LABELS: Readonly<
|
|
63
|
+
Record<CubeTableFlag, { label: string; description: string }>
|
|
64
|
+
> = {
|
|
65
|
+
[CubeTableFlag.UNAVAILABLE]: {
|
|
66
|
+
label: 'unavailable',
|
|
67
|
+
description: "A column's type (BINARY or VARBINARY) can't be read by Cube.",
|
|
68
|
+
},
|
|
69
|
+
[CubeTableFlag.LENGTH_UNKNOWN]: {
|
|
70
|
+
label: 'length unknown',
|
|
71
|
+
description: 'A CHAR column: its length is not known to Cube.',
|
|
72
|
+
},
|
|
73
|
+
[CubeTableFlag.TYPE_UNKNOWN]: {
|
|
74
|
+
label: 'type unknown',
|
|
75
|
+
description: "A column's type (OTHER or ARRAY) is not known to Cube.",
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** A column's type as the editors show it: its display name, `?` when it takes NULL, e.g. `Varchar(5)?` */
|
|
80
|
+
export const getColumnTypeLabel = (column: SchemaColumn): string =>
|
|
81
|
+
`${column.type.displayName}${column.nullable ? '?' : ''}`;
|
|
82
|
+
|
|
83
|
+
const listColumns = (columns: readonly SchemaColumn[]): string =>
|
|
84
|
+
columns.map((column) => column.name).join(', ');
|
|
85
|
+
|
|
86
|
+
/** Why Execute (and Show Pure) can't run, one reason a line, for a tooltip */
|
|
87
|
+
export const formatDisabledReasons = (reasons: readonly string[]): string =>
|
|
88
|
+
reasons.map((reason) => `• ${reason}`).join('\n');
|
|
89
|
+
|
|
90
|
+
/** The warning on a source whose table changed since the cube was saved; the table's new columns are used */
|
|
91
|
+
export const getSchemaDriftWarning = (diff: SchemaDiff): string => {
|
|
92
|
+
const changes = [
|
|
93
|
+
...(diff.added.length ? [`added ${listColumns(diff.added)}`] : []),
|
|
94
|
+
...(diff.removed.length ? [`removed ${listColumns(diff.removed)}`] : []),
|
|
95
|
+
...(diff.changed.length
|
|
96
|
+
? [
|
|
97
|
+
`changed ${diff.changed
|
|
98
|
+
.map(
|
|
99
|
+
(change) =>
|
|
100
|
+
`${change.after.name} (${getColumnTypeLabel(change.before)} to ${getColumnTypeLabel(change.after)})`,
|
|
101
|
+
)
|
|
102
|
+
.join(', ')}`,
|
|
103
|
+
]
|
|
104
|
+
: []),
|
|
105
|
+
...(diff.reordered ? ['reordered its columns'] : []),
|
|
106
|
+
];
|
|
107
|
+
return `This table changed since the cube was saved: ${changes.join('; ')}`;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** Beside a condition comparing a floating-point column for equality (R133) */
|
|
111
|
+
export const FILTER_FLOAT_COMPARISON_HINT =
|
|
112
|
+
'exact comparison on floating-point columns may not match';
|
|
113
|
+
|
|
114
|
+
/** The Filter editor's note on NULLs (D4): negated conditions keep them */
|
|
115
|
+
export const FILTER_NULL_NOTE =
|
|
116
|
+
'A negated condition (is not, does not contain, is not in list of, Not) also keeps the rows where its column is empty (NULL).';
|
|
117
|
+
|
|
118
|
+
/** Why the node editor closed without applying its edits */
|
|
119
|
+
export enum CUBE_EDITOR_CLOSED_REASON {
|
|
120
|
+
NODE_CHANGED = 'nodeChanged',
|
|
121
|
+
NODE_REMOVED = 'nodeRemoved',
|
|
122
|
+
CUBE_REPLACED = 'cubeReplaced',
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The notice of a node editor that closed by itself, dropping its edits (M1.8b) */
|
|
126
|
+
export const getEditorClosedNotice = (
|
|
127
|
+
nodeId: string,
|
|
128
|
+
reason: CUBE_EDITOR_CLOSED_REASON,
|
|
129
|
+
): string => {
|
|
130
|
+
const cause =
|
|
131
|
+
reason === CUBE_EDITOR_CLOSED_REASON.NODE_CHANGED
|
|
132
|
+
? `${nodeId} changed`
|
|
133
|
+
: reason === CUBE_EDITOR_CLOSED_REASON.NODE_REMOVED
|
|
134
|
+
? `${nodeId} was removed`
|
|
135
|
+
: 'Another cube was opened';
|
|
136
|
+
return `${cause}, so the editor of ${nodeId} closed without applying its changes.`;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** The warning on a source with saved columns that the engine couldn't type again */
|
|
140
|
+
export const getSourceRecheckWarning = (firstLine: string): string =>
|
|
141
|
+
`Could not re-check this table, so it keeps its saved columns: ${firstLine}`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export enum LEGEND_CUBE_TEST_ID {
|
|
18
|
+
EDITOR = 'legend-cube__editor',
|
|
19
|
+
GRAPH_REGION = 'legend-cube__graph-region',
|
|
20
|
+
GRID_REGION = 'legend-cube__grid-region',
|
|
21
|
+
CANVAS = 'legend-cube__canvas',
|
|
22
|
+
CANVAS_NODE = 'legend-cube__canvas-node',
|
|
23
|
+
CANVAS_EDGE_LABEL = 'legend-cube__canvas-edge-label',
|
|
24
|
+
PALETTE = 'legend-cube__palette',
|
|
25
|
+
PALETTE_ITEM = 'legend-cube__palette-item',
|
|
26
|
+
NODE_EDITOR = 'legend-cube__node-editor',
|
|
27
|
+
EDITOR_NOTICE = 'legend-cube__editor-notice',
|
|
28
|
+
FILTER_CONDITION = 'legend-cube__filter-condition',
|
|
29
|
+
RESULT_GRID = 'legend-cube__result-grid',
|
|
30
|
+
GRID_TOOLBAR = 'legend-cube__grid-toolbar',
|
|
31
|
+
EXECUTION_ERROR = 'legend-cube__execution-error',
|
|
32
|
+
SQL_PANEL = 'legend-cube__sql-panel',
|
|
33
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { screen, waitFor } from '@testing-library/react';
|
|
18
|
+
import { LEGEND_CUBE_TEST_ID } from '../__lib__/LegendCubeTesting.js';
|
|
19
|
+
|
|
20
|
+
// The canvas's nodes, as the tests find them: React Flow keys its own wrapper
|
|
21
|
+
// of each node by the node's id
|
|
22
|
+
|
|
23
|
+
/** The canvas node of a query node, or `null` when it isn't drawn */
|
|
24
|
+
export const TEST__queryCanvasNode = (
|
|
25
|
+
nodeId: string,
|
|
26
|
+
container: ParentNode = document,
|
|
27
|
+
): HTMLElement | null =>
|
|
28
|
+
container.querySelector<HTMLElement>(
|
|
29
|
+
`.react-flow__node[data-id="${nodeId}"] [data-testid="${LEGEND_CUBE_TEST_ID.CANVAS_NODE}"]`,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
/** The canvas node of a query node, once React Flow has drawn it */
|
|
33
|
+
export const TEST__findCanvasNode = async (
|
|
34
|
+
nodeId: string,
|
|
35
|
+
container: ParentNode = document,
|
|
36
|
+
): Promise<HTMLElement> => {
|
|
37
|
+
let node: HTMLElement | null = null;
|
|
38
|
+
await waitFor(() => {
|
|
39
|
+
node = TEST__queryCanvasNode(nodeId, container);
|
|
40
|
+
if (!node) {
|
|
41
|
+
throw new Error(`Node "${nodeId}" is not on the canvas`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return node as unknown as HTMLElement;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Every node drawn on the canvas */
|
|
48
|
+
export const TEST__getCanvasNodes = (): HTMLElement[] =>
|
|
49
|
+
screen.queryAllByTestId(LEGEND_CUBE_TEST_ID.CANVAS_NODE);
|
|
50
|
+
|
|
51
|
+
/** The node's tooltip, one line an item: errors, warnings, description, id */
|
|
52
|
+
export const TEST__getCanvasNodeTooltip = (node: HTMLElement): string[] =>
|
|
53
|
+
(node.getAttribute('title') ?? '').split('\n');
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import axios, { type AxiosResponse } from 'axios';
|
|
18
|
+
import {
|
|
19
|
+
ContentType,
|
|
20
|
+
HttpHeader,
|
|
21
|
+
parseLosslessJSON,
|
|
22
|
+
type PlainObject,
|
|
23
|
+
} from '@finos/legend-shared';
|
|
24
|
+
import { ENGINE_TEST_SUPPORT_API_URL } from '@finos/legend-graph/test';
|
|
25
|
+
|
|
26
|
+
// Engine calls for Cube's engine tests (PLAN §3.4), as plain JSON. legend-graph's
|
|
27
|
+
// engine test support has no batch relation-type helper, and its `execute`
|
|
28
|
+
// parses the response, which would bypass Cube's lossless result reader
|
|
29
|
+
|
|
30
|
+
const PURE_API = `${ENGINE_TEST_SUPPORT_API_URL}/pure/v1`;
|
|
31
|
+
|
|
32
|
+
const JSON_HEADERS = {
|
|
33
|
+
[HttpHeader.CONTENT_TYPE]: ContentType.APPLICATION_JSON,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** The commit of the engine the tests run against */
|
|
37
|
+
export const CUBE_ENGINE_TEST__getCommit = async (): Promise<string> => {
|
|
38
|
+
const { data } = await axios.get<unknown, AxiosResponse<PlainObject>>(
|
|
39
|
+
`${ENGINE_TEST_SUPPORT_API_URL}/server/v1/info`,
|
|
40
|
+
);
|
|
41
|
+
const info = data.info as { legendSDLC?: Record<string, string> } | undefined;
|
|
42
|
+
return info?.legendSDLC?.['git.commit.id'] ?? 'unknown';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The protocol JSON the engine parses Pure lambda text into, read losslessly
|
|
47
|
+
* (a JSON parse would round large numbers) and without source information
|
|
48
|
+
*/
|
|
49
|
+
export const CUBE_ENGINE_TEST__grammarToJson_lambda = async (
|
|
50
|
+
code: string,
|
|
51
|
+
): Promise<unknown> =>
|
|
52
|
+
parseLosslessJSON(
|
|
53
|
+
(
|
|
54
|
+
await axios.post<unknown, AxiosResponse<string>>(
|
|
55
|
+
`${PURE_API}/grammar/grammarToJson/lambda`,
|
|
56
|
+
code,
|
|
57
|
+
{
|
|
58
|
+
headers: { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN },
|
|
59
|
+
params: { returnSourceInformation: false },
|
|
60
|
+
responseType: 'text',
|
|
61
|
+
transformResponse: (data: string) => data,
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
).data,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/** The relation types of a batch of lambdas: `{result, errors}`, keyed as the input */
|
|
68
|
+
export const CUBE_ENGINE_TEST__lambdaRelationTypeBatch = async (
|
|
69
|
+
input: object,
|
|
70
|
+
): Promise<PlainObject> =>
|
|
71
|
+
(
|
|
72
|
+
await axios.post<unknown, AxiosResponse<PlainObject>>(
|
|
73
|
+
`${PURE_API}/compilation/lambdaRelationType/batch`,
|
|
74
|
+
input,
|
|
75
|
+
{ headers: JSON_HEADERS },
|
|
76
|
+
)
|
|
77
|
+
).data;
|
|
78
|
+
|
|
79
|
+
/** Compiles a model context; a model that doesn't compile is an HTTP 400 */
|
|
80
|
+
export const CUBE_ENGINE_TEST__compile = async (
|
|
81
|
+
model: object,
|
|
82
|
+
): Promise<PlainObject> =>
|
|
83
|
+
(
|
|
84
|
+
await axios.post<unknown, AxiosResponse<PlainObject>>(
|
|
85
|
+
`${PURE_API}/compilation/compile`,
|
|
86
|
+
model,
|
|
87
|
+
{ headers: JSON_HEADERS },
|
|
88
|
+
)
|
|
89
|
+
).data;
|
|
90
|
+
|
|
91
|
+
/** The Pure text of a lambda, as the engine renders it */
|
|
92
|
+
export const CUBE_ENGINE_TEST__jsonToGrammar_lambda = async (
|
|
93
|
+
lambda: PlainObject,
|
|
94
|
+
renderStyle?: string | undefined,
|
|
95
|
+
): Promise<string> =>
|
|
96
|
+
(
|
|
97
|
+
await axios.post<unknown, AxiosResponse<string>>(
|
|
98
|
+
`${PURE_API}/grammar/jsonToGrammar/lambda`,
|
|
99
|
+
lambda,
|
|
100
|
+
{
|
|
101
|
+
headers: {
|
|
102
|
+
...JSON_HEADERS,
|
|
103
|
+
[HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN,
|
|
104
|
+
},
|
|
105
|
+
params: { renderStyle },
|
|
106
|
+
responseType: 'text',
|
|
107
|
+
transformResponse: (data: string) => data,
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
).data;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Executes a query and gives the response as the client's `returnAsResponse`
|
|
114
|
+
* does, its body unread, so the lossless reader parses the raw text as it
|
|
115
|
+
* does in the browser. A body given as text (with lossless numbers) is sent
|
|
116
|
+
* as it is.
|
|
117
|
+
*/
|
|
118
|
+
export const CUBE_ENGINE_TEST__execute = async (
|
|
119
|
+
input: object | string,
|
|
120
|
+
): Promise<{ ok: boolean; status: number; text: () => Promise<string> }> => {
|
|
121
|
+
const response = await axios.post<unknown, AxiosResponse<string>>(
|
|
122
|
+
`${PURE_API}/execution/execute`,
|
|
123
|
+
input,
|
|
124
|
+
{
|
|
125
|
+
headers: JSON_HEADERS,
|
|
126
|
+
params: { serializationFormat: 'DEFAULT' },
|
|
127
|
+
responseType: 'text',
|
|
128
|
+
transformResponse: (data: string) => data,
|
|
129
|
+
validateStatus: () => true,
|
|
130
|
+
},
|
|
131
|
+
);
|
|
132
|
+
return {
|
|
133
|
+
ok: response.status >= 200 && response.status < 300,
|
|
134
|
+
status: response.status,
|
|
135
|
+
text: async () => response.data,
|
|
136
|
+
};
|
|
137
|
+
};
|