@finos/legend-application-studio 28.18.65 → 28.18.67
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/lib/components/editor/Editor.d.ts.map +1 -1
- package/lib/components/editor/Editor.js +4 -1
- package/lib/components/editor/Editor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +5 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +5 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +7 -1
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/components/showcase/ShowcaseViewer.d.ts.map +1 -1
- package/lib/components/showcase/ShowcaseViewer.js +4 -1
- package/lib/components/showcase/ShowcaseViewer.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorStore.d.ts +3 -0
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +5 -0
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/data-cube/DataCubeViewerState.d.ts +20 -0
- package/lib/stores/editor/data-cube/DataCubeViewerState.d.ts.map +1 -0
- package/lib/stores/editor/data-cube/DataCubeViewerState.js +62 -0
- package/lib/stores/editor/data-cube/DataCubeViewerState.js.map +1 -0
- package/package.json +5 -5
- package/src/components/editor/Editor.tsx +10 -0
- package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +18 -0
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +19 -0
- package/src/components/editor/side-bar/Explorer.tsx +19 -1
- package/src/components/showcase/ShowcaseViewer.tsx +10 -0
- package/src/stores/editor/EditorStore.ts +7 -0
- package/src/stores/editor/data-cube/DataCubeViewerState.ts +115 -0
- package/tsconfig.json +1 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
/**
|
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
|
+
import {
|
18
|
+
ConcreteFunctionDefinition,
|
19
|
+
type Mapping,
|
20
|
+
type PackageableElement,
|
21
|
+
PureExecution,
|
22
|
+
PureMultiExecution,
|
23
|
+
PureSingleExecution,
|
24
|
+
RawLambda,
|
25
|
+
RuntimePointer,
|
26
|
+
Service,
|
27
|
+
} from '@finos/legend-graph';
|
28
|
+
import type { EditorStore } from '../EditorStore.js';
|
29
|
+
import { QueryBuilderDataCubeEngine } from '@finos/legend-query-builder';
|
30
|
+
import {
|
31
|
+
assertErrorThrown,
|
32
|
+
guaranteeNonNullable,
|
33
|
+
guaranteeType,
|
34
|
+
UnsupportedOperationError,
|
35
|
+
} from '@finos/legend-shared';
|
36
|
+
|
37
|
+
export const isElementSupportedByDataCube = (
|
38
|
+
element: PackageableElement,
|
39
|
+
): boolean =>
|
40
|
+
element instanceof ConcreteFunctionDefinition || element instanceof Service;
|
41
|
+
|
42
|
+
export const openDataCube = async (
|
43
|
+
element: PackageableElement,
|
44
|
+
editorStore: EditorStore,
|
45
|
+
): Promise<void> => {
|
46
|
+
try {
|
47
|
+
let engine: QueryBuilderDataCubeEngine;
|
48
|
+
if (element instanceof ConcreteFunctionDefinition) {
|
49
|
+
const body = element.expressionSequence;
|
50
|
+
const rawLambda = new RawLambda([], body);
|
51
|
+
engine = new QueryBuilderDataCubeEngine(
|
52
|
+
rawLambda,
|
53
|
+
undefined,
|
54
|
+
undefined,
|
55
|
+
undefined,
|
56
|
+
editorStore.graphManagerState,
|
57
|
+
);
|
58
|
+
} else if (element instanceof Service) {
|
59
|
+
const exec = guaranteeType(
|
60
|
+
element.execution,
|
61
|
+
PureExecution,
|
62
|
+
'Service must have a pure execution',
|
63
|
+
);
|
64
|
+
let mapping: Mapping | undefined;
|
65
|
+
let runtime: RuntimePointer | undefined;
|
66
|
+
if (exec instanceof PureSingleExecution) {
|
67
|
+
mapping = exec.mapping?.value;
|
68
|
+
if (exec.runtime) {
|
69
|
+
runtime = guaranteeType(
|
70
|
+
exec.runtime,
|
71
|
+
RuntimePointer,
|
72
|
+
'Only runtime pointers supported',
|
73
|
+
);
|
74
|
+
}
|
75
|
+
} else if (exec instanceof PureMultiExecution) {
|
76
|
+
const param = guaranteeNonNullable(
|
77
|
+
exec.executionParameters?.[0],
|
78
|
+
'multi execution does not have an execution param',
|
79
|
+
);
|
80
|
+
mapping = param.mapping.value;
|
81
|
+
|
82
|
+
runtime = guaranteeType(
|
83
|
+
param.runtime,
|
84
|
+
RuntimePointer,
|
85
|
+
'Only runtime pointers supported',
|
86
|
+
);
|
87
|
+
}
|
88
|
+
engine = new QueryBuilderDataCubeEngine(
|
89
|
+
exec.func,
|
90
|
+
undefined,
|
91
|
+
mapping?.path,
|
92
|
+
runtime?.packageableRuntime.value.path,
|
93
|
+
editorStore.graphManagerState,
|
94
|
+
);
|
95
|
+
} else {
|
96
|
+
throw new UnsupportedOperationError(
|
97
|
+
'Element not supported to open Data Cube with',
|
98
|
+
);
|
99
|
+
}
|
100
|
+
try {
|
101
|
+
await engine.getRelationalType(engine.selectInitialQuery);
|
102
|
+
} catch (error) {
|
103
|
+
assertErrorThrown(error);
|
104
|
+
throw new UnsupportedOperationError(
|
105
|
+
'Only relation type queries supported in Data Cube',
|
106
|
+
);
|
107
|
+
}
|
108
|
+
editorStore.setDataCubeViewState(engine);
|
109
|
+
} catch (error) {
|
110
|
+
assertErrorThrown(error);
|
111
|
+
editorStore.applicationStore.notificationService.notifyError(
|
112
|
+
`Unable to open cube: ${error.message}`,
|
113
|
+
);
|
114
|
+
}
|
115
|
+
};
|
package/tsconfig.json
CHANGED
@@ -93,6 +93,7 @@
|
|
93
93
|
"./src/stores/editor/QuickInputState.ts",
|
94
94
|
"./src/stores/editor/StandardEditorMode.ts",
|
95
95
|
"./src/stores/editor/__test-utils__/EditorStoreTestUtils.ts",
|
96
|
+
"./src/stores/editor/data-cube/DataCubeViewerState.ts",
|
96
97
|
"./src/stores/editor/editor-state/ArtifactGenerationViewerState.ts",
|
97
98
|
"./src/stores/editor/editor-state/EditorState.ts",
|
98
99
|
"./src/stores/editor/editor-state/ExternalFormatState.ts",
|