@finos/legend-application-studio 28.21.29 → 28.21.30
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-group/dataProduct/DataProductEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +9 -8
- package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js +20 -3
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +40 -8
- package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts +13 -1
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js +50 -0
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.js +5 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.js +4 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.js.map +1 -1
- package/package.json +11 -11
- package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +14 -11
- package/src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx +57 -0
- package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +60 -37
- package/src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts +82 -0
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.ts +7 -2
- package/src/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.ts +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application-studio",
|
|
3
|
-
"version": "28.21.
|
|
3
|
+
"version": "28.21.30",
|
|
4
4
|
"description": "Legend Studio application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@dagrejs/dagre": "1.1.4",
|
|
50
|
-
"@finos/legend-application": "16.0.
|
|
51
|
-
"@finos/legend-art": "7.1.
|
|
52
|
-
"@finos/legend-code-editor": "2.0.
|
|
53
|
-
"@finos/legend-data-cube": "0.3.
|
|
54
|
-
"@finos/legend-extension-dsl-data-product": "0.0.
|
|
55
|
-
"@finos/legend-extension-dsl-diagram": "8.1.
|
|
56
|
-
"@finos/legend-graph": "32.6.
|
|
57
|
-
"@finos/legend-lego": "2.0.
|
|
58
|
-
"@finos/legend-query-builder": "4.
|
|
50
|
+
"@finos/legend-application": "16.0.119",
|
|
51
|
+
"@finos/legend-art": "7.1.159",
|
|
52
|
+
"@finos/legend-code-editor": "2.0.194",
|
|
53
|
+
"@finos/legend-data-cube": "0.3.111",
|
|
54
|
+
"@finos/legend-extension-dsl-data-product": "0.0.104",
|
|
55
|
+
"@finos/legend-extension-dsl-diagram": "8.1.258",
|
|
56
|
+
"@finos/legend-graph": "32.6.25",
|
|
57
|
+
"@finos/legend-lego": "2.0.214",
|
|
58
|
+
"@finos/legend-query-builder": "4.19.0",
|
|
59
59
|
"@finos/legend-server-depot": "6.1.17",
|
|
60
|
-
"@finos/legend-server-lakehouse": "0.3.
|
|
60
|
+
"@finos/legend-server-lakehouse": "0.3.74",
|
|
61
61
|
"@finos/legend-server-sdlc": "5.4.7",
|
|
62
62
|
"@finos/legend-server-showcase": "0.2.68",
|
|
63
63
|
"@finos/legend-shared": "11.0.27",
|
|
@@ -732,17 +732,6 @@ export const LakehouseDataProductAccessPointEditor = observer(
|
|
|
732
732
|
);
|
|
733
733
|
}, [lambdaEditorState, editorStore.applicationStore]);
|
|
734
734
|
|
|
735
|
-
// Load the relation columns for access points that already have sample
|
|
736
|
-
// values so mismatches surface on load. This only runs for rendered access
|
|
737
|
-
// points, keeping the number of concurrent calls bounded to the visible set.
|
|
738
|
-
useEffect(() => {
|
|
739
|
-
if (accessPointState.relationElementState !== undefined) {
|
|
740
|
-
flowResult(lambdaEditorState.updateLambdaRelationColumns()).catch(
|
|
741
|
-
editorStore.applicationStore.alertUnhandledError,
|
|
742
|
-
);
|
|
743
|
-
}
|
|
744
|
-
}, [accessPointState, lambdaEditorState, editorStore.applicationStore]);
|
|
745
|
-
|
|
746
735
|
const handleDescriptionEdit = () => setEditingDescription(true);
|
|
747
736
|
const handleDescriptionBlur = () => {
|
|
748
737
|
setEditingDescription(false);
|
|
@@ -1785,6 +1774,20 @@ const AccessPointGroupEditor = observer(
|
|
|
1785
1774
|
return () => intersectionObserver.disconnect();
|
|
1786
1775
|
}, [accessPointCount, renderedCount]);
|
|
1787
1776
|
|
|
1777
|
+
useEffect(() => {
|
|
1778
|
+
flowResult(
|
|
1779
|
+
productEditorState.batchUpdateLambdaRelationColumns(
|
|
1780
|
+
lakehouseAccessPointStates.slice(0, renderedCount),
|
|
1781
|
+
),
|
|
1782
|
+
).catch(editorStore.applicationStore.alertUnhandledError);
|
|
1783
|
+
}, [
|
|
1784
|
+
renderedCount,
|
|
1785
|
+
accessPointCount,
|
|
1786
|
+
lakehouseAccessPointStates,
|
|
1787
|
+
productEditorState,
|
|
1788
|
+
editorStore.applicationStore.alertUnhandledError,
|
|
1789
|
+
]);
|
|
1790
|
+
|
|
1788
1791
|
const handleDescriptionEdit = () => setEditingDescription(true);
|
|
1789
1792
|
const handleDescriptionBlur = () => {
|
|
1790
1793
|
setEditingDescription(false);
|
|
@@ -31,7 +31,9 @@ import {
|
|
|
31
31
|
ModalHeaderActions,
|
|
32
32
|
CustomSelectorInput,
|
|
33
33
|
FlaskIcon,
|
|
34
|
+
SQLIcon,
|
|
34
35
|
clsx,
|
|
36
|
+
PanelLoadingIndicator,
|
|
35
37
|
} from '@finos/legend-art';
|
|
36
38
|
import {
|
|
37
39
|
INGEST_DEFINITION_TAB,
|
|
@@ -47,6 +49,7 @@ import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../__
|
|
|
47
49
|
import {
|
|
48
50
|
LINEAGE_VIEW_MODE,
|
|
49
51
|
LineageViewerContent,
|
|
52
|
+
IngestionDefinitionArtifactViewer,
|
|
50
53
|
} from '@finos/legend-query-builder';
|
|
51
54
|
import type { MatViewDataSet } from '@finos/legend-graph';
|
|
52
55
|
import { IngestTestableEditor } from './testable/IngestTestableEditor.js';
|
|
@@ -213,6 +216,21 @@ export const IngestDefinitionEditor = observer(() => {
|
|
|
213
216
|
}
|
|
214
217
|
};
|
|
215
218
|
|
|
219
|
+
const viewSQL = () => {
|
|
220
|
+
if (
|
|
221
|
+
ingestDefinitionEditorState.ingest.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS
|
|
222
|
+
?.length
|
|
223
|
+
) {
|
|
224
|
+
flowResult(ingestDefinitionEditorState.generateArtifact()).catch(
|
|
225
|
+
editorStore.applicationStore.alertUnhandledError,
|
|
226
|
+
);
|
|
227
|
+
} else {
|
|
228
|
+
editorStore.applicationStore.notificationService.notifyError(
|
|
229
|
+
'No MatView datasets available for artifact generation',
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
216
234
|
return (
|
|
217
235
|
<div className="ingest-definition-editor">
|
|
218
236
|
<div className="panel">
|
|
@@ -266,9 +284,38 @@ export const IngestDefinitionEditor = observer(() => {
|
|
|
266
284
|
</div>
|
|
267
285
|
</button>
|
|
268
286
|
</div>
|
|
287
|
+
{isValidForLineage && (
|
|
288
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
|
289
|
+
<button
|
|
290
|
+
className="btn__dropdown-combo__label"
|
|
291
|
+
onClick={viewSQL}
|
|
292
|
+
tabIndex={-1}
|
|
293
|
+
disabled={
|
|
294
|
+
ingestDefinitionEditorState
|
|
295
|
+
.artifactGenerationState.isInProgress
|
|
296
|
+
}
|
|
297
|
+
>
|
|
298
|
+
<SQLIcon className="btn__dropdown-combo__label__icon" />
|
|
299
|
+
<div className="btn__dropdown-combo__label__title">
|
|
300
|
+
{ingestDefinitionEditorState
|
|
301
|
+
.artifactGenerationState.isInProgress
|
|
302
|
+
? 'Generating...'
|
|
303
|
+
: 'View SQL'}
|
|
304
|
+
</div>
|
|
305
|
+
</button>
|
|
306
|
+
</div>
|
|
307
|
+
)}
|
|
269
308
|
</div>
|
|
270
309
|
</PanelHeaderActions>
|
|
271
310
|
</PanelHeader>
|
|
311
|
+
<PanelLoadingIndicator
|
|
312
|
+
isLoading={
|
|
313
|
+
ingestDefinitionEditorState.artifactGenerationState
|
|
314
|
+
.isInProgress ||
|
|
315
|
+
ingestDefinitionEditorState.lineageGenerationState
|
|
316
|
+
.isInProgress
|
|
317
|
+
}
|
|
318
|
+
/>
|
|
272
319
|
<PanelContent>
|
|
273
320
|
<CodeEditor
|
|
274
321
|
inputValue={ingestDefinitionEditorState.textContent}
|
|
@@ -279,6 +326,16 @@ export const IngestDefinitionEditor = observer(() => {
|
|
|
279
326
|
<IngestLineageModal
|
|
280
327
|
ingestDefinitionEditorState={ingestDefinitionEditorState}
|
|
281
328
|
/>
|
|
329
|
+
<IngestionDefinitionArtifactViewer
|
|
330
|
+
artifact={ingestDefinitionEditorState.ingestionArtifact}
|
|
331
|
+
onClose={() =>
|
|
332
|
+
ingestDefinitionEditorState.setIngestionArtifact(undefined)
|
|
333
|
+
}
|
|
334
|
+
darkMode={
|
|
335
|
+
!editorStore.applicationStore.layoutService
|
|
336
|
+
.TEMPORARY__isLightColorThemeEnabled
|
|
337
|
+
}
|
|
338
|
+
/>
|
|
282
339
|
</PanelContent>
|
|
283
340
|
)}
|
|
284
341
|
{selectedTab === INGEST_DEFINITION_TAB.TESTING && (
|
package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts
CHANGED
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
import {
|
|
18
18
|
type AppDirNode,
|
|
19
19
|
type ArtifactGenerationExtensionResult,
|
|
20
|
+
type BatchLambdasRelationTypeResult,
|
|
20
21
|
type DataProductElement,
|
|
21
22
|
type IngestDefinition,
|
|
22
23
|
type Mapping,
|
|
23
24
|
type PackageableElement,
|
|
24
25
|
type RawLambda,
|
|
26
|
+
type RelationTypeMetadata,
|
|
25
27
|
type Stereotype,
|
|
26
28
|
type StereotypeReference,
|
|
27
29
|
type V1_AccessPointGroupInfo,
|
|
@@ -59,12 +61,6 @@ import {
|
|
|
59
61
|
RelationElementsData,
|
|
60
62
|
stub_Mapping,
|
|
61
63
|
stub_RawLambda,
|
|
62
|
-
V1_GraphTransformerContextBuilder,
|
|
63
|
-
V1_LambdaReturnTypeInput,
|
|
64
|
-
V1_PureGraphManager,
|
|
65
|
-
V1_relationTypeModelSchema,
|
|
66
|
-
V1_RemoteEngine,
|
|
67
|
-
V1_transformRawLambda,
|
|
68
64
|
} from '@finos/legend-graph';
|
|
69
65
|
import type { EditorStore } from '../../../EditorStore.js';
|
|
70
66
|
import { ElementEditorState } from '../ElementEditorState.js';
|
|
@@ -120,7 +116,6 @@ import type {
|
|
|
120
116
|
AdhocDataProductDeployResponse,
|
|
121
117
|
LakehouseIngestionManager,
|
|
122
118
|
} from '@finos/legend-server-lakehouse';
|
|
123
|
-
import { deserialize } from 'serializr';
|
|
124
119
|
import { Diagram } from '@finos/legend-extension-dsl-diagram';
|
|
125
120
|
import { LegendStudioTelemetryHelper } from '../../../../../__lib__/LegendStudioTelemetryHelper.js';
|
|
126
121
|
import { onGeneratingDiagramFromMapping } from '../mapping/MappingEditorState.js';
|
|
@@ -195,7 +190,6 @@ export class AccessPointLambdaEditorState extends LambdaEditorState {
|
|
|
195
190
|
}
|
|
196
191
|
|
|
197
192
|
*updateLambdaRelationColumns(): GeneratorFn<void> {
|
|
198
|
-
// Prevent concurrent calls
|
|
199
193
|
if (this.isUpdatingRelationColumns) {
|
|
200
194
|
return;
|
|
201
195
|
}
|
|
@@ -207,36 +201,11 @@ export class AccessPointLambdaEditorState extends LambdaEditorState {
|
|
|
207
201
|
|
|
208
202
|
this.setIsUpdatingRelationColumns(true);
|
|
209
203
|
try {
|
|
210
|
-
const
|
|
211
|
-
this.editorStore.graphManagerState.graphManager
|
|
212
|
-
V1_PureGraphManager,
|
|
213
|
-
).getFullGraphModelData(this.editorStore.graphManagerState.graph);
|
|
214
|
-
|
|
215
|
-
const relationTypeInput = new V1_LambdaReturnTypeInput(
|
|
216
|
-
model,
|
|
217
|
-
V1_transformRawLambda(
|
|
204
|
+
const relationType =
|
|
205
|
+
(yield this.editorStore.graphManagerState.graphManager.getLambdaRelationType(
|
|
218
206
|
this.val.accessPoint.func,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
).build(),
|
|
222
|
-
),
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
const relationType = deserialize(
|
|
226
|
-
V1_relationTypeModelSchema,
|
|
227
|
-
(yield guaranteeType(
|
|
228
|
-
guaranteeType(
|
|
229
|
-
this.editorStore.graphManagerState.graphManager,
|
|
230
|
-
V1_PureGraphManager,
|
|
231
|
-
).engine,
|
|
232
|
-
V1_RemoteEngine,
|
|
233
|
-
)
|
|
234
|
-
.getEngineServerClient()
|
|
235
|
-
.lambdaRelationType(
|
|
236
|
-
V1_LambdaReturnTypeInput.serialization.toJson(relationTypeInput),
|
|
237
|
-
)) as object,
|
|
238
|
-
);
|
|
239
|
-
|
|
207
|
+
this.editorStore.graphManagerState.graph,
|
|
208
|
+
)) as RelationTypeMetadata;
|
|
240
209
|
this.setLambdaRelationColumns(
|
|
241
210
|
relationType.columns.map((column) => column.name),
|
|
242
211
|
);
|
|
@@ -1020,6 +989,7 @@ export class DataProductEditorState extends ElementEditorState {
|
|
|
1020
989
|
setDeployResponse: action,
|
|
1021
990
|
addAccessPoint: action,
|
|
1022
991
|
convertAccessPointsFuncObjects: flow,
|
|
992
|
+
batchUpdateLambdaRelationColumns: flow,
|
|
1023
993
|
selectedGroupState: observable,
|
|
1024
994
|
setSelectedGroupState: action,
|
|
1025
995
|
swapAccessPointGroups: action,
|
|
@@ -1135,6 +1105,59 @@ export class DataProductEditorState extends ElementEditorState {
|
|
|
1135
1105
|
}
|
|
1136
1106
|
}
|
|
1137
1107
|
|
|
1108
|
+
*batchUpdateLambdaRelationColumns(
|
|
1109
|
+
accessPointStates: LakehouseAccessPointState[],
|
|
1110
|
+
): GeneratorFn<void> {
|
|
1111
|
+
const entries = accessPointStates
|
|
1112
|
+
.filter(
|
|
1113
|
+
(apState) =>
|
|
1114
|
+
apState.relationElementState !== undefined &&
|
|
1115
|
+
!apState.lambdaState.isUpdatingRelationColumns &&
|
|
1116
|
+
apState.lambdaState.lastComputedLambdaHash !==
|
|
1117
|
+
apState.accessPoint.func.hashCode,
|
|
1118
|
+
)
|
|
1119
|
+
.map((apState) => ({
|
|
1120
|
+
apState,
|
|
1121
|
+
hash: apState.accessPoint.func.hashCode,
|
|
1122
|
+
}));
|
|
1123
|
+
if (entries.length === 0) {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
entries.forEach((entry) =>
|
|
1127
|
+
entry.apState.lambdaState.setIsUpdatingRelationColumns(true),
|
|
1128
|
+
);
|
|
1129
|
+
try {
|
|
1130
|
+
const lambdas = new Map<string, RawLambda>(
|
|
1131
|
+
entries.map((entry) => [
|
|
1132
|
+
entry.apState.uuid,
|
|
1133
|
+
entry.apState.accessPoint.func,
|
|
1134
|
+
]),
|
|
1135
|
+
);
|
|
1136
|
+
const { results } =
|
|
1137
|
+
(yield this.editorStore.graphManagerState.graphManager.getBatchLambdasRelationType(
|
|
1138
|
+
lambdas,
|
|
1139
|
+
this.editorStore.graphManagerState.graph,
|
|
1140
|
+
)) as BatchLambdasRelationTypeResult;
|
|
1141
|
+
entries.forEach((entry) => {
|
|
1142
|
+
const relationType = results.get(entry.apState.uuid);
|
|
1143
|
+
entry.apState.lambdaState.setLambdaRelationColumns(
|
|
1144
|
+
relationType
|
|
1145
|
+
? relationType.columns.map((column) => column.name)
|
|
1146
|
+
: undefined,
|
|
1147
|
+
);
|
|
1148
|
+
});
|
|
1149
|
+
} catch {
|
|
1150
|
+
entries.forEach((entry) =>
|
|
1151
|
+
entry.apState.lambdaState.setLambdaRelationColumns(undefined),
|
|
1152
|
+
);
|
|
1153
|
+
} finally {
|
|
1154
|
+
entries.forEach((entry) => {
|
|
1155
|
+
entry.apState.lambdaState.lastComputedLambdaHash = entry.hash;
|
|
1156
|
+
entry.apState.lambdaState.setIsUpdatingRelationColumns(false);
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1138
1161
|
setSelectedGroupState(val: AccessPointGroupState | undefined): void {
|
|
1139
1162
|
this.selectedGroupState = val;
|
|
1140
1163
|
}
|
package/src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
type MatViewDataSet,
|
|
19
19
|
type PackageableElement,
|
|
20
20
|
type V1_RawLineageModel,
|
|
21
|
+
type ArtifactGenerationExtensionResult,
|
|
22
|
+
type IngestionDefinitionArtifact,
|
|
21
23
|
GRAPH_MANAGER_EVENT,
|
|
22
24
|
IngestDefinition,
|
|
23
25
|
} from '@finos/legend-graph';
|
|
@@ -62,6 +64,8 @@ export enum INGEST_DEFINITION_TAB {
|
|
|
62
64
|
TESTING = 'Testing',
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
export const INGEST_DEFINITION_ARTIFACT_EXTENSION = 'ingestDefinition';
|
|
68
|
+
|
|
65
69
|
const createEditorInitialConfiguration = (): EditorInitialConfiguration => {
|
|
66
70
|
const config = new EditorInitialConfiguration();
|
|
67
71
|
const ingest = new IngestElementEditorInitialConfiguration();
|
|
@@ -85,11 +89,20 @@ export const generateUrlToDeployOnOpen = (
|
|
|
85
89
|
};
|
|
86
90
|
|
|
87
91
|
const PARSER_SECTION = `###Lakehouse`;
|
|
92
|
+
|
|
93
|
+
type CachedIngestArtifact = {
|
|
94
|
+
hashCode: string;
|
|
95
|
+
artifact: IngestionDefinitionArtifact;
|
|
96
|
+
};
|
|
97
|
+
|
|
88
98
|
export class IngestDefinitionEditorState extends ElementEditorState {
|
|
89
99
|
selectedTab = INGEST_DEFINITION_TAB.DEFINITION;
|
|
90
100
|
validateAndDeployResponse: ValidateAndDeploymentResponse | undefined;
|
|
91
101
|
deploymentState = ActionState.create();
|
|
92
102
|
lineageGenerationState = ActionState.create();
|
|
103
|
+
artifactGenerationState = ActionState.create();
|
|
104
|
+
ingestionArtifact: IngestionDefinitionArtifact | undefined;
|
|
105
|
+
cachedArtfact: CachedIngestArtifact | undefined;
|
|
93
106
|
deployOnOpen = false;
|
|
94
107
|
lineageState: LineageState;
|
|
95
108
|
ingestTestableState: IngestTestableState;
|
|
@@ -106,13 +119,18 @@ export class IngestDefinitionEditorState extends ElementEditorState {
|
|
|
106
119
|
deploymentState: observable,
|
|
107
120
|
deployOnOpen: observable,
|
|
108
121
|
setDeployOnOpen: observable,
|
|
122
|
+
cachedArtfact: observable,
|
|
109
123
|
validateAndDeployResponse: observable,
|
|
124
|
+
ingestionArtifact: observable,
|
|
110
125
|
deploymentResponse: computed,
|
|
111
126
|
setSelectedTab: action,
|
|
112
127
|
setValidateAndDeployResponse: action,
|
|
128
|
+
setIngestCachedArtifact: action,
|
|
129
|
+
setIngestionArtifact: action,
|
|
113
130
|
init_with_deploy: flow,
|
|
114
131
|
deploy: flow,
|
|
115
132
|
generateLineage: flow,
|
|
133
|
+
generateArtifact: flow,
|
|
116
134
|
});
|
|
117
135
|
if (
|
|
118
136
|
config?.elementEditorConfiguration instanceof
|
|
@@ -154,6 +172,14 @@ export class IngestDefinitionEditorState extends ElementEditorState {
|
|
|
154
172
|
this.deployOnOpen = value;
|
|
155
173
|
}
|
|
156
174
|
|
|
175
|
+
setIngestionArtifact(val: IngestionDefinitionArtifact | undefined): void {
|
|
176
|
+
this.ingestionArtifact = val;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
setIngestCachedArtifact(val: CachedIngestArtifact | undefined): void {
|
|
180
|
+
this.cachedArtfact = val;
|
|
181
|
+
}
|
|
182
|
+
|
|
157
183
|
*init_with_deploy(auth: AuthContextProps): GeneratorFn<void> {
|
|
158
184
|
this.setDeployOnOpen(false);
|
|
159
185
|
if (!auth.isAuthenticated) {
|
|
@@ -269,6 +295,62 @@ export class IngestDefinitionEditorState extends ElementEditorState {
|
|
|
269
295
|
}
|
|
270
296
|
}
|
|
271
297
|
|
|
298
|
+
*generateArtifact(): GeneratorFn<void> {
|
|
299
|
+
if (this.artifactGenerationState.isInProgress) {
|
|
300
|
+
this.editorStore.applicationStore.notificationService.notifyError(
|
|
301
|
+
'Artifact generation in progress already',
|
|
302
|
+
);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const currentHashCode = this.ingest.hashCode;
|
|
306
|
+
if (this.cachedArtfact?.hashCode === currentHashCode) {
|
|
307
|
+
// reuse cached artifact if the ingest definition has not changed
|
|
308
|
+
this.setIngestionArtifact(this.cachedArtfact.artifact);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
this.artifactGenerationState.inProgress();
|
|
313
|
+
const generatedArtifacts =
|
|
314
|
+
(yield this.editorStore.graphManagerState.graphManager.generateArtifacts(
|
|
315
|
+
this.editorStore.graphManagerState.graph,
|
|
316
|
+
this.editorStore.graphEditorMode.getGraphTextInputOption(),
|
|
317
|
+
[this.ingest.path],
|
|
318
|
+
)) as ArtifactGenerationExtensionResult;
|
|
319
|
+
const ingestArtifact = generatedArtifacts.values.find(
|
|
320
|
+
(artifact) =>
|
|
321
|
+
artifact.extension === INGEST_DEFINITION_ARTIFACT_EXTENSION,
|
|
322
|
+
);
|
|
323
|
+
const artifactContent =
|
|
324
|
+
ingestArtifact?.artifactsByExtensionElements[0]?.files[0]?.content;
|
|
325
|
+
if (!artifactContent) {
|
|
326
|
+
throw new Error(
|
|
327
|
+
`Could not find generated ingest definition artifact for '${this.ingest.path}'`,
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
const artifact =
|
|
331
|
+
this.editorStore.graphManagerState.graphManager.buildIngestDefinitionArtifact(
|
|
332
|
+
JSON.parse(artifactContent) as Record<PropertyKey, unknown>,
|
|
333
|
+
this.editorStore.graphManagerState.graph,
|
|
334
|
+
);
|
|
335
|
+
this.setIngestCachedArtifact({
|
|
336
|
+
hashCode: currentHashCode,
|
|
337
|
+
artifact,
|
|
338
|
+
});
|
|
339
|
+
this.setIngestionArtifact(artifact);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
assertErrorThrown(error);
|
|
342
|
+
this.editorStore.applicationStore.logService.error(
|
|
343
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
|
344
|
+
error,
|
|
345
|
+
);
|
|
346
|
+
this.editorStore.applicationStore.notificationService.notifyError(
|
|
347
|
+
`Failed to generate ingest artifact: ${error.message}`,
|
|
348
|
+
);
|
|
349
|
+
} finally {
|
|
350
|
+
this.artifactGenerationState.complete();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
272
354
|
reprocess(
|
|
273
355
|
newElement: PackageableElement,
|
|
274
356
|
editorStore: EditorStore,
|
package/src/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.ts
CHANGED
|
@@ -671,7 +671,10 @@ export class MappingElementDecorator implements SetImplementationVisitor<void> {
|
|
|
671
671
|
): RelationFunctionPropertyMapping[] => {
|
|
672
672
|
const existingPropertyMappings = (propertyMappings ?? []).filter((pm) => {
|
|
673
673
|
if (pm instanceof RelationFunctionPropertyMapping) {
|
|
674
|
-
return
|
|
674
|
+
return (
|
|
675
|
+
pm.valueFn !== undefined ||
|
|
676
|
+
(pm.column !== undefined && !isStubbed_RelationColumn(pm.column))
|
|
677
|
+
);
|
|
675
678
|
}
|
|
676
679
|
return false;
|
|
677
680
|
});
|
|
@@ -715,7 +718,9 @@ export class MappingElementDecorator implements SetImplementationVisitor<void> {
|
|
|
715
718
|
propertyMappingsBeforeDecoration
|
|
716
719
|
.filter(
|
|
717
720
|
(propertyMapping) =>
|
|
718
|
-
|
|
721
|
+
propertyMapping.valueFn !== undefined ||
|
|
722
|
+
(propertyMapping.column !== undefined &&
|
|
723
|
+
!isStubbed_RelationColumn(propertyMapping.column)),
|
|
719
724
|
)
|
|
720
725
|
.filter(
|
|
721
726
|
(propertyMapping) =>
|
|
@@ -85,7 +85,10 @@ export class RelationFunctionPropertyMappingState extends PropertyMappingState {
|
|
|
85
85
|
pretty?: boolean | undefined;
|
|
86
86
|
preserveCompilationError?: boolean | undefined;
|
|
87
87
|
}): GeneratorFn<void> {
|
|
88
|
-
if (
|
|
88
|
+
if (
|
|
89
|
+
this.propertyMapping.column &&
|
|
90
|
+
!isStubbed_RelationColumn(this.propertyMapping.column)
|
|
91
|
+
) {
|
|
89
92
|
this.setLambdaString(this.propertyMapping.column.name);
|
|
90
93
|
} else {
|
|
91
94
|
this.clearErrors();
|
|
@@ -170,7 +173,10 @@ export class RelationFunctionInstanceSetImplementationState extends InstanceSetI
|
|
|
170
173
|
|
|
171
174
|
*convertPropertyMappingTransformObjects(): GeneratorFn<void> {
|
|
172
175
|
this.propertyMappingStates.forEach((pm) => {
|
|
173
|
-
if (
|
|
176
|
+
if (
|
|
177
|
+
pm.propertyMapping.column &&
|
|
178
|
+
!isStubbed_RelationColumn(pm.propertyMapping.column)
|
|
179
|
+
) {
|
|
174
180
|
pm.setLambdaString(pm.propertyMapping.column.name);
|
|
175
181
|
}
|
|
176
182
|
});
|