@finos/legend-application-studio 28.18.113 → 28.18.115
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/ElementIconUtils.d.ts.map +1 -1
- package/lib/components/ElementIconUtils.js +3 -1
- package/lib/components/ElementIconUtils.js.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +5 -0
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.d.ts +26 -0
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js +117 -0
- package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js.map +1 -0
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +2 -0
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +4 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +1 -0
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.js +5 -1
- package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +4 -1
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +56 -0
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +175 -0
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +2 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +19 -0
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -0
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +25 -0
- package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -0
- package/package.json +13 -13
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/editor/editor-group/EditorGroup.tsx +4 -0
- package/src/components/editor/editor-group/dataProduct/DataPoductEditor.tsx +307 -0
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +2 -0
- package/src/stores/editor/EditorGraphState.ts +3 -0
- package/src/stores/editor/EditorStore.ts +1 -0
- package/src/stores/editor/EditorTabManagerState.ts +4 -0
- package/src/stores/editor/NewElementState.ts +4 -0
- package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +260 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +2 -0
- package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +36 -0
- package/tsconfig.json +3 -0
package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts
ADDED
@@ -0,0 +1,260 @@
|
|
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
|
+
DataProduct,
|
19
|
+
LakehouseAccessPoint,
|
20
|
+
type PackageableElement,
|
21
|
+
type AccessPoint,
|
22
|
+
stub_RawLambda,
|
23
|
+
LakehouseTargetEnv,
|
24
|
+
LAMBDA_PIPE,
|
25
|
+
type RawLambda,
|
26
|
+
ParserError,
|
27
|
+
GRAPH_MANAGER_EVENT,
|
28
|
+
isStubbed_RawLambda,
|
29
|
+
} from '@finos/legend-graph';
|
30
|
+
import type { EditorStore } from '../../../EditorStore.js';
|
31
|
+
import { ElementEditorState } from '../ElementEditorState.js';
|
32
|
+
import { action, computed, flow, makeObservable, observable } from 'mobx';
|
33
|
+
import {
|
34
|
+
guaranteeType,
|
35
|
+
addUniqueEntry,
|
36
|
+
type GeneratorFn,
|
37
|
+
assertErrorThrown,
|
38
|
+
LogEvent,
|
39
|
+
deleteEntry,
|
40
|
+
filterByType,
|
41
|
+
} from '@finos/legend-shared';
|
42
|
+
import {
|
43
|
+
dataProduct_addAccessPoint,
|
44
|
+
dataProduct_deleteAccessPoint,
|
45
|
+
} from '../../../../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
|
46
|
+
import { LambdaEditorState } from '@finos/legend-query-builder';
|
47
|
+
|
48
|
+
export class AccessPointState {
|
49
|
+
readonly state: DataProductEditorState;
|
50
|
+
accessPoint: AccessPoint;
|
51
|
+
|
52
|
+
constructor(val: AccessPoint, editorState: DataProductEditorState) {
|
53
|
+
this.accessPoint = val;
|
54
|
+
this.state = editorState;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
export class AccessPointLambdaEditorState extends LambdaEditorState {
|
59
|
+
readonly editorStore: EditorStore;
|
60
|
+
readonly val: LakehouseAccessPointState;
|
61
|
+
|
62
|
+
constructor(val: LakehouseAccessPointState) {
|
63
|
+
super('', LAMBDA_PIPE);
|
64
|
+
this.val = val;
|
65
|
+
this.editorStore = val.state.editorStore;
|
66
|
+
}
|
67
|
+
|
68
|
+
override get lambdaId(): string {
|
69
|
+
return this.val.accessPoint.id;
|
70
|
+
}
|
71
|
+
|
72
|
+
*convertLambdaGrammarStringToObject(): GeneratorFn<void> {
|
73
|
+
const emptyLambda = stub_RawLambda();
|
74
|
+
if (this.lambdaString) {
|
75
|
+
try {
|
76
|
+
const lambda =
|
77
|
+
(yield this.editorStore.graphManagerState.graphManager.pureCodeToLambda(
|
78
|
+
this.fullLambdaString,
|
79
|
+
this.lambdaId,
|
80
|
+
)) as RawLambda;
|
81
|
+
this.setParserError(undefined);
|
82
|
+
this.val.accessPoint.func = lambda;
|
83
|
+
} catch (error) {
|
84
|
+
assertErrorThrown(error);
|
85
|
+
if (error instanceof ParserError) {
|
86
|
+
this.setParserError(error);
|
87
|
+
}
|
88
|
+
this.editorStore.applicationStore.logService.error(
|
89
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
90
|
+
error,
|
91
|
+
);
|
92
|
+
}
|
93
|
+
} else {
|
94
|
+
this.clearErrors();
|
95
|
+
this.val.accessPoint.func = emptyLambda;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
*convertLambdaObjectToGrammarString(options?: {
|
100
|
+
pretty?: boolean | undefined;
|
101
|
+
preserveCompilationError?: boolean | undefined;
|
102
|
+
}): GeneratorFn<void> {
|
103
|
+
if (
|
104
|
+
!isStubbed_RawLambda(this.val.accessPoint.func) &&
|
105
|
+
!this.val.state.isConvertingTransformLambdaObjects
|
106
|
+
) {
|
107
|
+
try {
|
108
|
+
const lambdas = new Map<string, RawLambda>();
|
109
|
+
lambdas.set(this.lambdaId, this.val.accessPoint.func);
|
110
|
+
const isolatedLambdas =
|
111
|
+
(yield this.editorStore.graphManagerState.graphManager.lambdasToPureCode(
|
112
|
+
lambdas,
|
113
|
+
options?.pretty,
|
114
|
+
)) as Map<string, string>;
|
115
|
+
const grammarText = isolatedLambdas.get(this.lambdaId);
|
116
|
+
this.setLambdaString(
|
117
|
+
grammarText !== undefined
|
118
|
+
? this.extractLambdaString(grammarText)
|
119
|
+
: '',
|
120
|
+
);
|
121
|
+
this.clearErrors({
|
122
|
+
preserveCompilationError: options?.preserveCompilationError,
|
123
|
+
});
|
124
|
+
} catch (error) {
|
125
|
+
assertErrorThrown(error);
|
126
|
+
this.editorStore.applicationStore.logService.error(
|
127
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
128
|
+
error,
|
129
|
+
);
|
130
|
+
}
|
131
|
+
} else {
|
132
|
+
this.clearErrors();
|
133
|
+
this.setLambdaString('');
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
export class LakehouseAccessPointState extends AccessPointState {
|
138
|
+
declare accessPoint: LakehouseAccessPoint;
|
139
|
+
lambdaState: AccessPointLambdaEditorState;
|
140
|
+
|
141
|
+
constructor(val: LakehouseAccessPoint, editorState: DataProductEditorState) {
|
142
|
+
super(val, editorState);
|
143
|
+
makeObservable(this, {
|
144
|
+
lambdaState: observable,
|
145
|
+
});
|
146
|
+
this.accessPoint = val;
|
147
|
+
this.lambdaState = new AccessPointLambdaEditorState(this);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
export class DataProductEditorState extends ElementEditorState {
|
152
|
+
accessPointModal = false;
|
153
|
+
accessPointStates: AccessPointState[] = [];
|
154
|
+
isConvertingTransformLambdaObjects = false;
|
155
|
+
|
156
|
+
constructor(editorStore: EditorStore, element: PackageableElement) {
|
157
|
+
super(editorStore, element);
|
158
|
+
|
159
|
+
makeObservable(this, {
|
160
|
+
product: computed,
|
161
|
+
accessPointModal: observable,
|
162
|
+
accessPointStates: observable,
|
163
|
+
deleteAccessPoint: observable,
|
164
|
+
isConvertingTransformLambdaObjects: observable,
|
165
|
+
setAccessPointModal: action,
|
166
|
+
addAccessPoint: action,
|
167
|
+
convertAccessPointsFuncObjects: flow,
|
168
|
+
});
|
169
|
+
this.accessPointStates = this.product.accessPoints.map((e) =>
|
170
|
+
this.buildAccessPointState(e),
|
171
|
+
);
|
172
|
+
}
|
173
|
+
|
174
|
+
*convertAccessPointsFuncObjects(): GeneratorFn<void> {
|
175
|
+
const lambdas = new Map<string, RawLambda>();
|
176
|
+
const index = new Map<string, LakehouseAccessPointState>();
|
177
|
+
const states = this.accessPointStates.filter(
|
178
|
+
filterByType(LakehouseAccessPointState),
|
179
|
+
);
|
180
|
+
states.forEach((pm) => {
|
181
|
+
if (!isStubbed_RawLambda(pm.accessPoint.func)) {
|
182
|
+
lambdas.set(pm.lambdaState.lambdaId, pm.accessPoint.func);
|
183
|
+
index.set(pm.lambdaState.lambdaId, pm);
|
184
|
+
}
|
185
|
+
});
|
186
|
+
if (lambdas.size) {
|
187
|
+
this.isConvertingTransformLambdaObjects = true;
|
188
|
+
try {
|
189
|
+
const isolatedLambdas =
|
190
|
+
(yield this.editorStore.graphManagerState.graphManager.lambdasToPureCode(
|
191
|
+
lambdas,
|
192
|
+
)) as Map<string, string>;
|
193
|
+
isolatedLambdas.forEach((grammarText, key) => {
|
194
|
+
const purePropertyMapping = index.get(key);
|
195
|
+
purePropertyMapping?.lambdaState.setLambdaString(
|
196
|
+
purePropertyMapping.lambdaState.extractLambdaString(grammarText),
|
197
|
+
);
|
198
|
+
});
|
199
|
+
} catch (error) {
|
200
|
+
assertErrorThrown(error);
|
201
|
+
this.editorStore.applicationStore.logService.error(
|
202
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
203
|
+
error,
|
204
|
+
);
|
205
|
+
} finally {
|
206
|
+
this.isConvertingTransformLambdaObjects = false;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
buildAccessPointState(val: AccessPoint): AccessPointState {
|
212
|
+
if (val instanceof LakehouseAccessPoint) {
|
213
|
+
return new LakehouseAccessPointState(val, this);
|
214
|
+
}
|
215
|
+
return new AccessPointState(val, this);
|
216
|
+
}
|
217
|
+
|
218
|
+
setAccessPointModal(val: boolean): void {
|
219
|
+
this.accessPointModal = val;
|
220
|
+
}
|
221
|
+
|
222
|
+
deleteAccessPoint(val: AccessPointState): void {
|
223
|
+
const ap = val.accessPoint;
|
224
|
+
dataProduct_deleteAccessPoint(this.product, ap);
|
225
|
+
deleteEntry(this.accessPointStates, val);
|
226
|
+
}
|
227
|
+
|
228
|
+
addAccessPoint(id: string): void {
|
229
|
+
const accesspoint = new LakehouseAccessPoint(
|
230
|
+
id,
|
231
|
+
LakehouseTargetEnv.Snowflake,
|
232
|
+
stub_RawLambda(),
|
233
|
+
);
|
234
|
+
dataProduct_addAccessPoint(this.product, accesspoint);
|
235
|
+
addUniqueEntry(
|
236
|
+
this.accessPointStates,
|
237
|
+
this.buildAccessPointState(accesspoint),
|
238
|
+
);
|
239
|
+
}
|
240
|
+
|
241
|
+
get product(): DataProduct {
|
242
|
+
return guaranteeType(
|
243
|
+
this.element,
|
244
|
+
DataProduct,
|
245
|
+
'Element inside data product editor state must be a data product',
|
246
|
+
);
|
247
|
+
}
|
248
|
+
|
249
|
+
get accessPoints(): AccessPoint[] {
|
250
|
+
return this.product.accessPoints;
|
251
|
+
}
|
252
|
+
|
253
|
+
override reprocess(
|
254
|
+
newElement: PackageableElement,
|
255
|
+
editorStore: EditorStore,
|
256
|
+
): DataProductEditorState {
|
257
|
+
const editorState = new DataProductEditorState(editorStore, newElement);
|
258
|
+
return editorState;
|
259
|
+
}
|
260
|
+
}
|
@@ -71,6 +71,8 @@ export enum PACKAGEABLE_ELEMENT_TYPE {
|
|
71
71
|
DATA = 'DATA',
|
72
72
|
SNOWFLAKE_APP = 'SNOWFLAKE_APP',
|
73
73
|
HOSTED_SERVICE = 'HOSTED_SERVICE',
|
74
|
+
// New Strategical Data Product
|
75
|
+
_DATA_PRODUCT = 'BETA_DATA_PRODUCT',
|
74
76
|
|
75
77
|
TEMPORARY__LOCAL_CONNECTION = 'LOCAL_CONNECTION',
|
76
78
|
INTERNAL__UnknownElement = 'UNKNOWN',
|
@@ -0,0 +1,36 @@
|
|
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
|
+
type AccessPoint,
|
19
|
+
type DataProduct,
|
20
|
+
observe_AccessPoint,
|
21
|
+
} from '@finos/legend-graph';
|
22
|
+
import { addUniqueEntry, deleteEntry } from '@finos/legend-shared';
|
23
|
+
|
24
|
+
import { action } from 'mobx';
|
25
|
+
|
26
|
+
export const dataProduct_deleteAccessPoint = action(
|
27
|
+
(product: DataProduct, accessPoint: AccessPoint) => {
|
28
|
+
deleteEntry(product.accessPoints, accessPoint);
|
29
|
+
},
|
30
|
+
);
|
31
|
+
|
32
|
+
export const dataProduct_addAccessPoint = action(
|
33
|
+
(product: DataProduct, accessPoint: AccessPoint) => {
|
34
|
+
addUniqueEntry(product.accessPoints, observe_AccessPoint(accessPoint));
|
35
|
+
},
|
36
|
+
);
|
package/tsconfig.json
CHANGED
@@ -125,6 +125,7 @@
|
|
125
125
|
"./src/stores/editor/editor-state/element-editor-state/connection/PostProcessorEditorState.ts",
|
126
126
|
"./src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts",
|
127
127
|
"./src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts",
|
128
|
+
"./src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts",
|
128
129
|
"./src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts",
|
129
130
|
"./src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_BindingEditorState.ts",
|
130
131
|
"./src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.ts",
|
@@ -187,6 +188,7 @@
|
|
187
188
|
"./src/stores/extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.ts",
|
188
189
|
"./src/stores/extensions/DSL_Service_LegendStudioApplicationPlugin_Extension.ts",
|
189
190
|
"./src/stores/extensions/STO_Relational_LegendStudioApplicationPlugin_Extension.ts",
|
191
|
+
"./src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts",
|
190
192
|
"./src/stores/graph-modifier/DSL_Data_GraphModifierHelper.ts",
|
191
193
|
"./src/stores/graph-modifier/DSL_ExternalFormat_GraphModifierHelper.ts",
|
192
194
|
"./src/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.ts",
|
@@ -242,6 +244,7 @@
|
|
242
244
|
"./src/components/editor/editor-group/data-editor/DataElementEditor.tsx",
|
243
245
|
"./src/components/editor/editor-group/data-editor/EmbeddedDataEditor.tsx",
|
244
246
|
"./src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx",
|
247
|
+
"./src/components/editor/editor-group/dataProduct/DataPoductEditor.tsx",
|
245
248
|
"./src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx",
|
246
249
|
"./src/components/editor/editor-group/diff-editor/EntityChangeConflictEditor.tsx",
|
247
250
|
"./src/components/editor/editor-group/diff-editor/EntityDiffView.tsx",
|