@finos/legend-application-studio 28.19.7 → 28.19.9

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.
Files changed (63) hide show
  1. package/lib/components/editor/editor-group/connection-editor/DatabaseEditorHelper.d.ts +1 -0
  2. package/lib/components/editor/editor-group/connection-editor/DatabaseEditorHelper.d.ts.map +1 -1
  3. package/lib/components/editor/editor-group/connection-editor/DatabaseEditorHelper.js +29 -1
  4. package/lib/components/editor/editor-group/connection-editor/DatabaseEditorHelper.js.map +1 -1
  5. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js +2 -2
  6. package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js +1 -1
  7. package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js.map +1 -1
  8. package/lib/components/editor/editor-group/mapping-editor/ClassMappingEditor.d.ts +2 -1
  9. package/lib/components/editor/editor-group/mapping-editor/ClassMappingEditor.d.ts.map +1 -1
  10. package/lib/components/editor/editor-group/mapping-editor/ClassMappingEditor.js +6 -1
  11. package/lib/components/editor/editor-group/mapping-editor/ClassMappingEditor.js.map +1 -1
  12. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.d.ts.map +1 -1
  13. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js +7 -2
  14. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  15. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.d.ts.map +1 -1
  16. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.js +14 -1
  17. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
  18. package/lib/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.d.ts.map +1 -1
  19. package/lib/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.js +6 -1
  20. package/lib/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.js.map +1 -1
  21. package/lib/components/editor/editor-group/mapping-editor/RelationFunctionPropertyMappingEditor.d.ts +25 -0
  22. package/lib/components/editor/editor-group/mapping-editor/RelationFunctionPropertyMappingEditor.d.ts.map +1 -0
  23. package/lib/components/editor/editor-group/mapping-editor/RelationFunctionPropertyMappingEditor.js +64 -0
  24. package/lib/components/editor/editor-group/mapping-editor/RelationFunctionPropertyMappingEditor.js.map +1 -0
  25. package/lib/components/editor/editor-group/mapping-editor/RelationTypeTree.d.ts +38 -0
  26. package/lib/components/editor/editor-group/mapping-editor/RelationTypeTree.d.ts.map +1 -0
  27. package/lib/components/editor/editor-group/mapping-editor/RelationTypeTree.js +140 -0
  28. package/lib/components/editor/editor-group/mapping-editor/RelationTypeTree.js.map +1 -0
  29. package/lib/index.css +1 -1
  30. package/lib/package.json +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
  32. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +19 -7
  33. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  34. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.d.ts.map +1 -1
  35. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.js +37 -3
  36. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.js.map +1 -1
  37. package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.d.ts +47 -0
  38. package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.d.ts.map +1 -0
  39. package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.js +112 -0
  40. package/lib/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.js.map +1 -0
  41. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -1
  42. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +1 -0
  43. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -1
  44. package/lib/stores/graph-modifier/STO_RelationFunction_GraphModifierHelper.d.ts +19 -0
  45. package/lib/stores/graph-modifier/STO_RelationFunction_GraphModifierHelper.d.ts.map +1 -0
  46. package/lib/stores/graph-modifier/STO_RelationFunction_GraphModifierHelper.js +22 -0
  47. package/lib/stores/graph-modifier/STO_RelationFunction_GraphModifierHelper.js.map +1 -0
  48. package/package.json +14 -14
  49. package/src/components/editor/editor-group/connection-editor/DatabaseEditorHelper.tsx +43 -0
  50. package/src/components/editor/editor-group/dataProduct/DataPoductEditor.tsx +2 -2
  51. package/src/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.tsx +1 -1
  52. package/src/components/editor/editor-group/mapping-editor/ClassMappingEditor.tsx +7 -0
  53. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +21 -0
  54. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +17 -0
  55. package/src/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.tsx +22 -0
  56. package/src/components/editor/editor-group/mapping-editor/RelationFunctionPropertyMappingEditor.tsx +127 -0
  57. package/src/components/editor/editor-group/mapping-editor/RelationTypeTree.tsx +257 -0
  58. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +37 -10
  59. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.ts +70 -2
  60. package/src/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.ts +172 -0
  61. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +1 -0
  62. package/src/stores/graph-modifier/STO_RelationFunction_GraphModifierHelper.ts +39 -0
  63. package/tsconfig.json +4 -0
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Copyright (c) 2025-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 { observable, action, computed, makeObservable } from 'mobx';
18
+ import { type GeneratorFn, isNonNullable } from '@finos/legend-shared';
19
+ import {
20
+ type PropertyMapping,
21
+ buildSourceInformationSourceId,
22
+ RelationColumn,
23
+ RelationFunctionPropertyMapping,
24
+ type RelationFunctionInstanceSetImplementation,
25
+ } from '@finos/legend-graph';
26
+ import type { EditorStore } from '../../../EditorStore.js';
27
+ import { MAPPING_ELEMENT_TYPE } from './MappingEditorState.js';
28
+ import { MappingElementDecorator } from './MappingElementDecorator.js';
29
+ import {
30
+ PropertyMappingState,
31
+ InstanceSetImplementationState,
32
+ } from './MappingElementState.js';
33
+ import { isStubbed_RelationColumn } from '../../../../graph-modifier/STO_RelationFunction_GraphModifierHelper.js';
34
+
35
+ export class RelationFunctionPropertyMappingState extends PropertyMappingState {
36
+ editorStore: EditorStore;
37
+ declare instanceSetImplementationState: RelationFunctionInstanceSetImplementationState;
38
+ declare propertyMapping: RelationFunctionPropertyMapping;
39
+
40
+ constructor(
41
+ editorStore: EditorStore,
42
+ instanceSetImplementationState: RelationFunctionInstanceSetImplementationState,
43
+ propertyMapping: RelationFunctionPropertyMapping,
44
+ ) {
45
+ super(instanceSetImplementationState, propertyMapping, '', '');
46
+ this.propertyMapping = propertyMapping;
47
+ this.editorStore = editorStore;
48
+ }
49
+
50
+ // NOTE: `operationId` is properly the more appropriate term to use, but we are just following what we
51
+ // do for other property mapping for consistency
52
+ get lambdaId(): string {
53
+ // NOTE: Added the index here just in case but the order needs to be checked carefully as bugs may result from inaccurate orderings
54
+ return buildSourceInformationSourceId(
55
+ [
56
+ this.propertyMapping._OWNER._PARENT.path,
57
+ MAPPING_ELEMENT_TYPE.CLASS,
58
+ this.propertyMapping._OWNER.id.value,
59
+ this.propertyMapping.property.value.name,
60
+ this.propertyMapping.targetSetImplementation?.value.id.value,
61
+ this.uuid, // in case of duplications
62
+ ].filter(isNonNullable),
63
+ );
64
+ }
65
+
66
+ *convertLambdaGrammarStringToObject(): GeneratorFn<void> {
67
+ if (this.lambdaString !== '') {
68
+ this.propertyMapping.column = new RelationColumn(
69
+ this.lambdaString,
70
+ this.propertyMapping.property.value.genericType.value.rawType,
71
+ );
72
+ } else {
73
+ this.clearErrors();
74
+ this.propertyMapping.column = {} as RelationColumn;
75
+ }
76
+ }
77
+
78
+ *convertLambdaObjectToGrammarString(options?: {
79
+ pretty?: boolean | undefined;
80
+ preserveCompilationError?: boolean | undefined;
81
+ }): GeneratorFn<void> {
82
+ if (!isStubbed_RelationColumn(this.propertyMapping.column)) {
83
+ this.setLambdaString(this.propertyMapping.column.name);
84
+ } else {
85
+ this.clearErrors();
86
+ this.setLambdaString('');
87
+ }
88
+ }
89
+ }
90
+
91
+ export class RelationFunctionInstanceSetImplementationState extends InstanceSetImplementationState {
92
+ declare mappingElement: RelationFunctionInstanceSetImplementation;
93
+ declare propertyMappingStates: RelationFunctionPropertyMappingState[];
94
+ isConvertingTransformLambdaObjects = false;
95
+
96
+ constructor(
97
+ editorStore: EditorStore,
98
+ setImplementation: RelationFunctionInstanceSetImplementation,
99
+ ) {
100
+ super(editorStore, setImplementation);
101
+
102
+ makeObservable(this, {
103
+ isConvertingTransformLambdaObjects: observable,
104
+ hasParserError: computed,
105
+ setPropertyMappingStates: action,
106
+ });
107
+
108
+ this.mappingElement = setImplementation;
109
+ this.propertyMappingStates = this.getPropertyMappingStates(
110
+ setImplementation.propertyMappings,
111
+ );
112
+ }
113
+
114
+ getPropertyMappingStates(
115
+ propertyMappings: PropertyMapping[],
116
+ ): RelationFunctionPropertyMappingState[] {
117
+ return propertyMappings
118
+ .map((pm) => {
119
+ if (pm instanceof RelationFunctionPropertyMapping) {
120
+ return new RelationFunctionPropertyMappingState(
121
+ this.editorStore,
122
+ this,
123
+ pm,
124
+ );
125
+ }
126
+ return undefined;
127
+ })
128
+ .filter(isNonNullable);
129
+ }
130
+
131
+ get hasParserError(): boolean {
132
+ return this.propertyMappingStates.some(
133
+ (propertyMappingState) => propertyMappingState.parserError,
134
+ );
135
+ }
136
+ setPropertyMappingStates(
137
+ propertyMappingState: RelationFunctionPropertyMappingState[],
138
+ ): void {
139
+ this.propertyMappingStates = propertyMappingState;
140
+ }
141
+
142
+ /**
143
+ * When we decorate, we might lose the error (parser/compiler) on each of the property mapping state
144
+ * so here we make sure that we reuse existing state and only add new decorated ones
145
+ */
146
+ decorate(): void {
147
+ this.mappingElement.accept_SetImplementationVisitor(
148
+ new MappingElementDecorator(this.editorStore),
149
+ );
150
+ const newPropertyMappingStates: RelationFunctionPropertyMappingState[] = [];
151
+ const propertyMappingstatesAfterDecoration = this.getPropertyMappingStates(
152
+ this.mappingElement.propertyMappings,
153
+ );
154
+ propertyMappingstatesAfterDecoration.forEach((propertyMappingState) => {
155
+ const existingPropertyMappingState = this.propertyMappingStates.find(
156
+ (p) => p.propertyMapping === propertyMappingState.propertyMapping,
157
+ );
158
+ newPropertyMappingStates.push(
159
+ existingPropertyMappingState ?? propertyMappingState,
160
+ );
161
+ });
162
+ this.setPropertyMappingStates(newPropertyMappingStates);
163
+ }
164
+
165
+ *convertPropertyMappingTransformObjects(): GeneratorFn<void> {
166
+ this.propertyMappingStates.forEach((pm) => {
167
+ if (!isStubbed_RelationColumn(pm.propertyMapping.column)) {
168
+ pm.setLambdaString(pm.propertyMapping.column.name);
169
+ }
170
+ });
171
+ }
172
+ }
@@ -127,6 +127,7 @@ export const isRelationalMappingTestSuite = (
127
127
  .some((e) => isRelationalMappingTest(e));
128
128
  };
129
129
 
130
+ //TODO: relation function support needs to be added
130
131
  export const generateStoreTestDataFromSetImpl = (
131
132
  setImpl: SetImplementation,
132
133
  editorStore: EditorStore,
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2025-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
+ import {
17
+ type ConcreteFunctionDefinition,
18
+ type ObserverContext,
19
+ type RelationColumn,
20
+ type RelationFunctionInstanceSetImplementation,
21
+ observe_ConcreteFunctionDefinition,
22
+ } from '@finos/legend-graph';
23
+ import { action } from 'mobx';
24
+
25
+ export const relationFunction_setRelationFunction = action(
26
+ (
27
+ setImplementation: RelationFunctionInstanceSetImplementation,
28
+ relationFunction: ConcreteFunctionDefinition,
29
+ context: ObserverContext,
30
+ ): void => {
31
+ setImplementation.relationFunction = observe_ConcreteFunctionDefinition(
32
+ relationFunction,
33
+ context,
34
+ );
35
+ },
36
+ );
37
+
38
+ export const isStubbed_RelationColumn = (column: RelationColumn): boolean =>
39
+ !column.name && !column.type;
package/tsconfig.json CHANGED
@@ -147,6 +147,7 @@
147
147
  "./src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts",
148
148
  "./src/stores/editor/editor-state/element-editor-state/mapping/MappingTabManagerState.ts",
149
149
  "./src/stores/editor/editor-state/element-editor-state/mapping/PureInstanceSetImplementationState.ts",
150
+ "./src/stores/editor/editor-state/element-editor-state/mapping/RelationFunctionInstanceSetImplementationState.ts",
150
151
  "./src/stores/editor/editor-state/element-editor-state/mapping/UnsupportedInstanceSetImplementationState.ts",
151
152
  "./src/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.ts",
152
153
  "./src/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.ts",
@@ -206,6 +207,7 @@
206
207
  "./src/stores/graph-modifier/GraphModifierHelper.ts",
207
208
  "./src/stores/graph-modifier/RawValueSpecificationGraphModifierHelper.ts",
208
209
  "./src/stores/graph-modifier/STO_FlatData_GraphModifierHelper.ts",
210
+ "./src/stores/graph-modifier/STO_RelationFunction_GraphModifierHelper.ts",
209
211
  "./src/stores/graph-modifier/STO_Relational_GraphModifierHelper.ts",
210
212
  "./src/stores/graph-modifier/Testable_GraphModifierHelper.ts",
211
213
  "./src/stores/lazy-text-editor/LazyTextEditorStore.ts",
@@ -292,6 +294,8 @@
292
294
  "./src/components/editor/editor-group/mapping-editor/OperationSetImplementationEditor.tsx",
293
295
  "./src/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.tsx",
294
296
  "./src/components/editor/editor-group/mapping-editor/PurePropertyMappingEditor.tsx",
297
+ "./src/components/editor/editor-group/mapping-editor/RelationFunctionPropertyMappingEditor.tsx",
298
+ "./src/components/editor/editor-group/mapping-editor/RelationTypeTree.tsx",
295
299
  "./src/components/editor/editor-group/mapping-editor/TypeTree.tsx",
296
300
  "./src/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.tsx",
297
301
  "./src/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.tsx",