@finos/legend-application-studio 28.21.28 → 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/__lib__/LegendStudioEvent.d.ts +4 -0
- package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioEvent.js +5 -0
- package/lib/__lib__/LegendStudioEvent.js.map +1 -1
- package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +4 -0
- package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioTelemetryHelper.js +13 -0
- package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
- 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/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +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/lib/stores/extensions/DSL_DataSpace_LegendStudioApplicationPlugin_Extension.d.ts +41 -0
- package/lib/stores/extensions/DSL_DataSpace_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -0
- package/lib/stores/extensions/DSL_DataSpace_LegendStudioApplicationPlugin_Extension.js +17 -0
- package/lib/stores/extensions/DSL_DataSpace_LegendStudioApplicationPlugin_Extension.js.map +1 -0
- package/package.json +11 -11
- package/src/__lib__/LegendStudioEvent.ts +6 -0
- package/src/__lib__/LegendStudioTelemetryHelper.ts +42 -0
- 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/index.ts +3 -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/src/stores/extensions/DSL_DataSpace_LegendStudioApplicationPlugin_Extension.ts +54 -0
- package/tsconfig.json +1 -0
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
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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 type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudioApplicationPlugin.js';
|
|
18
|
+
|
|
19
|
+
// ── Response type ─────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
export type DataSpaceDocResponse = {
|
|
22
|
+
description: string;
|
|
23
|
+
confidence: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// ── Request type ──────────────────────────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
export type DataSpaceDocRequest = {
|
|
29
|
+
/**
|
|
30
|
+
* Raw Pure grammar text containing the data space definitions.
|
|
31
|
+
*/
|
|
32
|
+
definitions: string;
|
|
33
|
+
/**
|
|
34
|
+
* Fully-qualified name of the data space (e.g. dataSpace::MY_SPACE).
|
|
35
|
+
*/
|
|
36
|
+
data_space_name: string;
|
|
37
|
+
/**
|
|
38
|
+
* LLM model override (uses server default if omitted).
|
|
39
|
+
*/
|
|
40
|
+
model?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// ── Plugin extension interface ────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
export interface DSL_DataSpace_LegendStudioApplicationPlugin_Extension
|
|
46
|
+
extends DSL_LegendStudioApplicationPlugin_Extension {
|
|
47
|
+
/**
|
|
48
|
+
* Generate AI-suggested description for a data space.
|
|
49
|
+
*/
|
|
50
|
+
getExtraDataSpaceDocumentationAISuggester?(
|
|
51
|
+
request: DataSpaceDocRequest,
|
|
52
|
+
legendAIUrl: string,
|
|
53
|
+
): Promise<DataSpaceDocResponse>;
|
|
54
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -200,6 +200,7 @@
|
|
|
200
200
|
"./src/stores/editor/utils/TestableUtils.ts",
|
|
201
201
|
"./src/stores/editor/utils/TreeUtils.ts",
|
|
202
202
|
"./src/stores/extensions/DSL_DataProduct_LegendStudioApplicationPlugin_Extension.ts",
|
|
203
|
+
"./src/stores/extensions/DSL_DataSpace_LegendStudioApplicationPlugin_Extension.ts",
|
|
203
204
|
"./src/stores/extensions/DSL_Data_LegendStudioApplicationPlugin_Extension.ts",
|
|
204
205
|
"./src/stores/extensions/DSL_Generation_LegendStudioApplicationPlugin_Extension.ts",
|
|
205
206
|
"./src/stores/extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.ts",
|