@finos/legend-application-studio 26.0.2 → 26.0.4

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 (182) hide show
  1. package/lib/application/LegendStudioApplicationConfig.d.ts +10 -13
  2. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendStudioApplicationConfig.js +11 -10
  4. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  5. package/lib/components/ElementIconUtils.d.ts +1 -1
  6. package/lib/components/ElementIconUtils.d.ts.map +1 -1
  7. package/lib/components/ElementIconUtils.js +11 -5
  8. package/lib/components/ElementIconUtils.js.map +1 -1
  9. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts.map +1 -1
  10. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js +2 -0
  11. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js.map +1 -1
  12. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  13. package/lib/components/editor/editor-group/EditorGroup.js +7 -1
  14. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  15. package/lib/components/editor/editor-group/FunctionEditor.d.ts +0 -16
  16. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  17. package/lib/components/editor/editor-group/FunctionEditor.js +79 -26
  18. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  19. package/lib/components/editor/editor-group/{service-editor/TEMPORARY__SnowflakeServiceDeployer.d.ts → INTERNAL__UnknownFunctionActivatorEdtior.d.ts} +2 -2
  20. package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.d.ts.map +1 -0
  21. package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.js +49 -0
  22. package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.js.map +1 -0
  23. package/lib/components/editor/editor-group/ModelImporter.js +1 -1
  24. package/lib/components/editor/editor-group/ModelImporter.js.map +1 -1
  25. package/lib/components/editor/editor-group/ProtocolValueBuilder.d.ts +22 -0
  26. package/lib/components/editor/editor-group/ProtocolValueBuilder.d.ts.map +1 -0
  27. package/lib/components/editor/editor-group/ProtocolValueBuilder.js +88 -0
  28. package/lib/components/editor/editor-group/ProtocolValueBuilder.js.map +1 -0
  29. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
  30. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +5 -1
  31. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  32. package/lib/components/editor/editor-group/connection-editor/post-processor-editor/MapperPostProcessorEditor.js +1 -1
  33. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.d.ts +1 -1
  34. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
  35. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.js.map +1 -1
  36. package/lib/components/editor/editor-group/mapping-editor/EnumerationMappingEditor.js +1 -1
  37. package/lib/components/editor/editor-group/mapping-editor/FlatDataPropertyMappingEditor.js +3 -3
  38. package/lib/components/editor/editor-group/mapping-editor/FlatDataPropertyMappingEditor.js.map +1 -1
  39. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.d.ts.map +1 -1
  40. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js +3 -3
  41. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  42. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.js +1 -1
  43. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
  44. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js +1 -1
  45. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js.map +1 -1
  46. package/lib/components/editor/{edit-panel/mapping-editor/testable → editor-group/mapping-editor}/MappingTestableEditor.d.ts +1 -1
  47. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -0
  48. package/lib/components/editor/{edit-panel/mapping-editor/testable → editor-group/mapping-editor}/MappingTestableEditor.js +11 -11
  49. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -0
  50. package/lib/components/editor/editor-group/mapping-editor/PurePropertyMappingEditor.js +4 -4
  51. package/lib/components/editor/editor-group/mapping-editor/PurePropertyMappingEditor.js.map +1 -1
  52. package/lib/components/editor/editor-group/mapping-editor/relational/RelationalPropertyMappingEditor.js +4 -4
  53. package/lib/components/editor/editor-group/mapping-editor/relational/RelationalPropertyMappingEditor.js.map +1 -1
  54. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  55. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +0 -7
  56. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  57. package/lib/components/editor/editor-group/service-editor/ServicePostValidationEditor.js +3 -3
  58. package/lib/components/editor/editor-group/service-editor/ServicePostValidationEditor.js.map +1 -1
  59. package/lib/components/editor/editor-group/uml-editor/ClassEditor.js +3 -3
  60. package/lib/components/editor/editor-group/uml-editor/ClassEditor.js.map +1 -1
  61. package/lib/components/editor/editor-group/uml-editor/StereotypeSelector.d.ts.map +1 -1
  62. package/lib/components/editor/editor-group/uml-editor/StereotypeSelector.js +6 -2
  63. package/lib/components/editor/editor-group/uml-editor/StereotypeSelector.js.map +1 -1
  64. package/lib/components/editor/editor-group/uml-editor/TaggedValueEditor.d.ts.map +1 -1
  65. package/lib/components/editor/editor-group/uml-editor/TaggedValueEditor.js +10 -2
  66. package/lib/components/editor/editor-group/uml-editor/TaggedValueEditor.js.map +1 -1
  67. package/lib/components/workspace-setup/WorkspaceSetup.js +1 -1
  68. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  69. package/lib/index.css +2 -2
  70. package/lib/index.css.map +1 -1
  71. package/lib/package.json +2 -2
  72. package/lib/stores/LegendStudioApplicationPlugin.d.ts +1 -1
  73. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  74. package/lib/stores/editor/EditorGraphState.d.ts +3 -1
  75. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  76. package/lib/stores/editor/EditorGraphState.js +14 -0
  77. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  78. package/lib/stores/editor/EditorStore.d.ts +5 -5
  79. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  80. package/lib/stores/editor/EditorStore.js +12 -7
  81. package/lib/stores/editor/EditorStore.js.map +1 -1
  82. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  83. package/lib/stores/editor/EditorTabManagerState.js +5 -1
  84. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  85. package/lib/stores/editor/editor-state/ExternalFormatState.d.ts +3 -3
  86. package/lib/stores/editor/editor-state/ExternalFormatState.d.ts.map +1 -1
  87. package/lib/stores/editor/editor-state/ExternalFormatState.js +14 -14
  88. package/lib/stores/editor/editor-state/ExternalFormatState.js.map +1 -1
  89. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts +2 -2
  90. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts.map +1 -1
  91. package/lib/stores/editor/editor-state/GraphGenerationState.js +1 -1
  92. package/lib/stores/editor/editor-state/GraphGenerationState.js.map +1 -1
  93. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.d.ts +34 -0
  94. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.d.ts.map +1 -0
  95. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.js +118 -0
  96. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.js.map +1 -0
  97. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +10 -8
  98. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  99. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +16 -13
  100. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  101. package/lib/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.d.ts +31 -0
  102. package/lib/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.d.ts.map +1 -0
  103. package/lib/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.js +91 -0
  104. package/lib/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.js.map +1 -0
  105. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.d.ts +69 -0
  106. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.d.ts.map +1 -0
  107. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.js +243 -0
  108. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.js.map +1 -0
  109. package/lib/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts +2 -0
  110. package/lib/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts.map +1 -1
  111. package/lib/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.js +8 -1
  112. package/lib/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.js.map +1 -1
  113. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts +2 -13
  114. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  115. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +1 -39
  116. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  117. package/lib/stores/editor/utils/MockDataUtils.d.ts +0 -1
  118. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  119. package/lib/stores/editor/utils/MockDataUtils.js +7 -20
  120. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  121. package/lib/stores/editor/utils/PackageTreeUtils.js +1 -1
  122. package/lib/stores/editor/utils/PackageTreeUtils.js.map +1 -1
  123. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts +3 -1
  124. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts.map +1 -1
  125. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js +4 -1
  126. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js.map +1 -1
  127. package/lib/stores/graph-modifier/STO_Relational_GraphModifierHelper.d.ts +1 -0
  128. package/lib/stores/graph-modifier/STO_Relational_GraphModifierHelper.d.ts.map +1 -1
  129. package/lib/stores/graph-modifier/STO_Relational_GraphModifierHelper.js +3 -0
  130. package/lib/stores/graph-modifier/STO_Relational_GraphModifierHelper.js.map +1 -1
  131. package/lib/stores/project-view/ProjectViewerStore.js +7 -3
  132. package/lib/stores/project-view/ProjectViewerStore.js.map +1 -1
  133. package/package.json +12 -12
  134. package/src/application/LegendStudioApplicationConfig.ts +14 -20
  135. package/src/components/ElementIconUtils.tsx +14 -2
  136. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +2 -0
  137. package/src/components/editor/editor-group/EditorGroup.tsx +12 -1
  138. package/src/components/editor/editor-group/FunctionEditor.tsx +331 -85
  139. package/src/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.tsx +129 -0
  140. package/src/components/editor/editor-group/ModelImporter.tsx +1 -1
  141. package/src/components/editor/editor-group/ProtocolValueBuilder.tsx +225 -0
  142. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +26 -1
  143. package/src/components/editor/editor-group/connection-editor/post-processor-editor/MapperPostProcessorEditor.tsx +1 -1
  144. package/src/components/editor/editor-group/element-generation-editor/FileGenerationEditor.tsx +7 -28
  145. package/src/components/editor/editor-group/mapping-editor/EnumerationMappingEditor.tsx +1 -1
  146. package/src/components/editor/editor-group/mapping-editor/FlatDataPropertyMappingEditor.tsx +4 -4
  147. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +2 -3
  148. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +1 -1
  149. package/src/components/editor/editor-group/mapping-editor/MappingEditor.tsx +1 -1
  150. package/src/components/editor/{edit-panel/mapping-editor/testable → editor-group/mapping-editor}/MappingTestableEditor.tsx +13 -13
  151. package/src/components/editor/editor-group/mapping-editor/PurePropertyMappingEditor.tsx +5 -5
  152. package/src/components/editor/editor-group/mapping-editor/relational/RelationalPropertyMappingEditor.tsx +5 -5
  153. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +0 -10
  154. package/src/components/editor/editor-group/service-editor/ServicePostValidationEditor.tsx +3 -3
  155. package/src/components/editor/editor-group/uml-editor/ClassEditor.tsx +3 -3
  156. package/src/components/editor/editor-group/uml-editor/StereotypeSelector.tsx +12 -11
  157. package/src/components/editor/editor-group/uml-editor/TaggedValueEditor.tsx +18 -20
  158. package/src/components/workspace-setup/WorkspaceSetup.tsx +1 -1
  159. package/src/stores/LegendStudioApplicationPlugin.ts +14 -5
  160. package/src/stores/editor/EditorGraphState.ts +24 -0
  161. package/src/stores/editor/EditorStore.ts +16 -7
  162. package/src/stores/editor/EditorTabManagerState.ts +7 -0
  163. package/src/stores/editor/editor-state/ExternalFormatState.ts +14 -16
  164. package/src/stores/editor/editor-state/GraphGenerationState.ts +3 -2
  165. package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.ts +178 -0
  166. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +21 -13
  167. package/src/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.ts +136 -0
  168. package/src/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.ts +364 -0
  169. package/src/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.ts +12 -0
  170. package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +0 -53
  171. package/src/stores/editor/utils/MockDataUtils.ts +7 -28
  172. package/src/stores/editor/utils/PackageTreeUtils.ts +1 -1
  173. package/src/stores/graph-modifier/DomainGraphModifierHelper.ts +9 -1
  174. package/src/stores/graph-modifier/STO_Relational_GraphModifierHelper.ts +6 -0
  175. package/src/stores/project-view/ProjectViewerStore.ts +6 -6
  176. package/tsconfig.json +6 -2
  177. package/lib/components/editor/edit-panel/mapping-editor/testable/MappingTestableEditor.d.ts.map +0 -1
  178. package/lib/components/editor/edit-panel/mapping-editor/testable/MappingTestableEditor.js.map +0 -1
  179. package/lib/components/editor/editor-group/service-editor/TEMPORARY__SnowflakeServiceDeployer.d.ts.map +0 -1
  180. package/lib/components/editor/editor-group/service-editor/TEMPORARY__SnowflakeServiceDeployer.js +0 -39
  181. package/lib/components/editor/editor-group/service-editor/TEMPORARY__SnowflakeServiceDeployer.js.map +0 -1
  182. package/src/components/editor/editor-group/service-editor/TEMPORARY__SnowflakeServiceDeployer.tsx +0 -79
@@ -0,0 +1,364 @@
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 { action, makeObservable, observable } from 'mobx';
18
+ import {
19
+ getAllClassProperties,
20
+ type Class,
21
+ type PureModel,
22
+ PrimitiveType,
23
+ PRIMITIVE_TYPE,
24
+ PROPERTY_ACCESSOR,
25
+ type Property,
26
+ classHasCycle,
27
+ } from '@finos/legend-graph';
28
+ import { isString, uuid, type PlainObject } from '@finos/legend-shared';
29
+ import type { TreeData, TreeNodeData } from '@finos/legend-art';
30
+
31
+ export abstract class ProtocolValueFieldNode implements TreeNodeData {
32
+ readonly id: string;
33
+ readonly label: string;
34
+ readonly builderState: ProtocolValueBuilderState;
35
+ readonly property: Property;
36
+ readonly propertyPath: string;
37
+ isOpen = true;
38
+ childrenIds: string[] = [];
39
+ childrenNodes: ProtocolValueFieldNode[] = [];
40
+
41
+ constructor(
42
+ id: string,
43
+ label: string,
44
+ builderState: ProtocolValueBuilderState,
45
+ property: Property,
46
+ propertyPath: string,
47
+ ) {
48
+ makeObservable(this, {
49
+ isOpen: observable,
50
+ setIsOpen: action,
51
+ });
52
+
53
+ this.id = id;
54
+ this.label = label;
55
+ this.builderState = builderState;
56
+ this.property = property;
57
+ this.propertyPath = propertyPath;
58
+ }
59
+
60
+ setIsOpen(val: boolean): void {
61
+ this.isOpen = val;
62
+ }
63
+
64
+ abstract getValue(): unknown;
65
+ }
66
+
67
+ export class StringFieldNode extends ProtocolValueFieldNode {
68
+ value: string;
69
+
70
+ constructor(
71
+ id: string,
72
+ label: string,
73
+ builderState: ProtocolValueBuilderState,
74
+ property: Property,
75
+ propertyPath: string,
76
+ initialValue: string,
77
+ ) {
78
+ super(id, label, builderState, property, propertyPath);
79
+
80
+ makeObservable(this, {
81
+ value: observable,
82
+ setValue: action,
83
+ });
84
+
85
+ this.value = initialValue;
86
+ }
87
+
88
+ setValue(val: string): void {
89
+ this.value = val;
90
+
91
+ this.builderState.onValueChange?.(this.builderState.getValue());
92
+ }
93
+
94
+ getValue(): string {
95
+ return this.value;
96
+ }
97
+ }
98
+
99
+ export class OptionalStringFieldNode extends ProtocolValueFieldNode {
100
+ value: string | undefined;
101
+
102
+ constructor(
103
+ id: string,
104
+ label: string,
105
+ builderState: ProtocolValueBuilderState,
106
+ property: Property,
107
+ propertyPath: string,
108
+ initialValue: string | undefined,
109
+ ) {
110
+ super(id, label, builderState, property, propertyPath);
111
+
112
+ makeObservable(this, {
113
+ value: observable,
114
+ setValue: action,
115
+ });
116
+
117
+ this.value = initialValue;
118
+ }
119
+
120
+ setValue(val: string | undefined): void {
121
+ this.value = val;
122
+
123
+ this.builderState.onValueChange?.(this.builderState.getValue());
124
+ }
125
+
126
+ getValue(): string | undefined {
127
+ return this.value;
128
+ }
129
+ }
130
+
131
+ export class UnsupportedFieldNode extends ProtocolValueFieldNode {
132
+ readonly value: unknown; // we will not support editing unknown value
133
+
134
+ constructor(
135
+ id: string,
136
+ label: string,
137
+ builderState: ProtocolValueBuilderState,
138
+ property: Property,
139
+ propertyPath: string,
140
+ initialValue: unknown,
141
+ ) {
142
+ super(id, label, builderState, property, propertyPath);
143
+
144
+ this.value = initialValue;
145
+ }
146
+
147
+ getValue(): unknown {
148
+ return this.value;
149
+ }
150
+ }
151
+
152
+ export class ProtocolValueBuilderState {
153
+ readonly type: Class;
154
+ readonly isCyclic: boolean;
155
+ readonly graph: PureModel;
156
+ readonly excludedPaths: Map<string, string[]>;
157
+ readonly initialValue: PlainObject;
158
+ readonly onValueChange?: ((value: PlainObject) => void) | undefined;
159
+ readonly decorateValue?: ((value: PlainObject) => PlainObject) | undefined;
160
+
161
+ treeData: TreeData<ProtocolValueFieldNode> | undefined;
162
+
163
+ constructor(
164
+ type: Class,
165
+ options: {
166
+ graph: PureModel;
167
+ initialValue: PlainObject | undefined;
168
+ excludedPaths: string[];
169
+ onValueChange?: ((value: PlainObject) => void) | undefined;
170
+ decorateValue?: ((value: PlainObject) => PlainObject) | undefined;
171
+ },
172
+ ) {
173
+ makeObservable(this, { treeData: observable.ref });
174
+
175
+ this.type = type;
176
+ this.graph = options.graph;
177
+ this.onValueChange = options.onValueChange;
178
+ this.decorateValue = options.decorateValue;
179
+
180
+ this.excludedPaths = new Map<string, string[]>();
181
+ options.excludedPaths.forEach((path) => {
182
+ const idx = path.indexOf(PROPERTY_ACCESSOR);
183
+ if (idx === -1) {
184
+ return;
185
+ }
186
+ const classPath = path.substring(0, idx);
187
+ const propertyName = path.substring(idx + 1);
188
+ if (!this.excludedPaths.has(classPath)) {
189
+ this.excludedPaths.set(classPath, [propertyName]);
190
+ } else {
191
+ this.excludedPaths.get(classPath)?.push(propertyName);
192
+ }
193
+ });
194
+
195
+ this.isCyclic = classHasCycle(type, {
196
+ traverseNonRequiredProperties: true,
197
+ excludedPaths: this.excludedPaths,
198
+ });
199
+ this.initialValue =
200
+ options.initialValue ??
201
+ (this.isCyclic ? {} : this.generateInitialValue(type));
202
+ this.treeData = this.isCyclic ? undefined : this.buildTreeData(type);
203
+ }
204
+
205
+ buildTreeData(type: Class): TreeData<ProtocolValueFieldNode> {
206
+ const rootIds: string[] = [];
207
+ const nodes = new Map<string, ProtocolValueFieldNode>();
208
+
209
+ getAllClassProperties(type).forEach((property) => {
210
+ // filter properties
211
+ const propertyOwnerPath = property._OWNER.path;
212
+ const excludedProperties =
213
+ this.excludedPaths.get(propertyOwnerPath) ?? [];
214
+ if (excludedProperties.includes(property.name)) {
215
+ return;
216
+ }
217
+
218
+ const propertyType = property.genericType.value.rawType;
219
+ const multiplicity = property.multiplicity;
220
+
221
+ const childNodeValue = this.initialValue[property.name];
222
+ const childNodeId = uuid();
223
+ let childNode: ProtocolValueFieldNode;
224
+
225
+ if (!(propertyType instanceof PrimitiveType)) {
226
+ childNode = new UnsupportedFieldNode(
227
+ uuid(),
228
+ '',
229
+ this,
230
+ property,
231
+ property.name,
232
+ childNodeValue,
233
+ );
234
+ } else {
235
+ switch (propertyType.name) {
236
+ case PRIMITIVE_TYPE.STRING: {
237
+ if (multiplicity.lowerBound === 0) {
238
+ childNode = new OptionalStringFieldNode(
239
+ childNodeId,
240
+ '',
241
+ this,
242
+ property,
243
+ property.name,
244
+ childNodeValue === undefined
245
+ ? undefined
246
+ : isString(childNodeValue)
247
+ ? childNodeValue
248
+ : '',
249
+ );
250
+ } else if (multiplicity.upperBound === 1) {
251
+ childNode = new StringFieldNode(
252
+ childNodeId,
253
+ '',
254
+ this,
255
+ property,
256
+ property.name,
257
+ isString(childNodeValue) ? childNodeValue : '',
258
+ );
259
+ } else {
260
+ childNode = new UnsupportedFieldNode(
261
+ childNodeId,
262
+ '',
263
+ this,
264
+ property,
265
+ property.name,
266
+ childNodeValue,
267
+ );
268
+ }
269
+ break;
270
+ }
271
+ default: {
272
+ childNode = new UnsupportedFieldNode(
273
+ childNodeId,
274
+ '',
275
+ this,
276
+ property,
277
+ property.name,
278
+ childNodeValue,
279
+ );
280
+ break;
281
+ }
282
+ }
283
+ }
284
+ nodes.set(childNodeId, childNode);
285
+ });
286
+
287
+ nodes.forEach((node) => {
288
+ rootIds.push(node.id);
289
+ });
290
+
291
+ return { rootIds, nodes };
292
+ }
293
+
294
+ private generateInitialValue(type: Class): PlainObject {
295
+ const value: PlainObject = {};
296
+ const excludedProperties = this.excludedPaths.get(type.path) ?? [];
297
+ getAllClassProperties(type)
298
+ .filter((property) => !excludedProperties.includes(property.name))
299
+ .forEach((property) => {
300
+ // NOTE: for now, we only handle very basic properties: i.e. primitive property (except Date) with multiplicity [0..1] or [1]
301
+ // we have not handled list of primitives, enumeration type, list of enumeration values, complex type
302
+ //
303
+ // Note that subtype is something we need to think very carefully about: displaying subtype in the form is not necessarily hard
304
+ // as we can draw a selector dropdown for the type, but in terms of actually generate the right protocol value, it depends on the
305
+ // use case and that could add complexity, for example, if we use this to generate Pure protocol, we would need the information
306
+ // for _type flag for subtype
307
+ const propertyType = property.genericType.value.rawType;
308
+ const multiplicity = property.multiplicity;
309
+ if (
310
+ !(propertyType instanceof PrimitiveType) ||
311
+ (multiplicity.upperBound && multiplicity.upperBound > 1)
312
+ ) {
313
+ return;
314
+ }
315
+ if (multiplicity.lowerBound === 0) {
316
+ value[property.name] = undefined;
317
+ } else {
318
+ switch (propertyType.name) {
319
+ case PRIMITIVE_TYPE.BOOLEAN: {
320
+ value[property.name] = false;
321
+ break;
322
+ }
323
+ case PRIMITIVE_TYPE.FLOAT:
324
+ case PRIMITIVE_TYPE.DECIMAL: {
325
+ value[property.name] = 0.0;
326
+ break;
327
+ }
328
+ case PRIMITIVE_TYPE.NUMBER:
329
+ case PRIMITIVE_TYPE.INTEGER: {
330
+ value[property.name] = 0;
331
+ break;
332
+ }
333
+ case PRIMITIVE_TYPE.STRING: {
334
+ value[property.name] = '';
335
+ break;
336
+ }
337
+ case PRIMITIVE_TYPE.DATE:
338
+ case PRIMITIVE_TYPE.STRICTDATE:
339
+ case PRIMITIVE_TYPE.DATETIME:
340
+ default:
341
+ return; // unsupported
342
+ }
343
+ }
344
+ });
345
+
346
+ return value;
347
+ }
348
+
349
+ getValue(): PlainObject {
350
+ if (!this.treeData) {
351
+ return {};
352
+ }
353
+
354
+ const value: PlainObject = {};
355
+ this.treeData.rootIds.forEach((rootId) => {
356
+ const node = this.treeData?.nodes.get(rootId);
357
+ if (node) {
358
+ value[node.property.name] = node.getValue();
359
+ }
360
+ });
361
+
362
+ return this.decorateValue ? this.decorateValue(value) : value;
363
+ }
364
+ }
@@ -62,6 +62,7 @@ import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../../
62
62
  import {
63
63
  relationDbConnection_setNewAuthenticationStrategy,
64
64
  relationDbConnection_setDatasourceSpecification,
65
+ relationDbConnection_setLocalMode,
65
66
  } from '../../../../graph-modifier/STO_Relational_GraphModifierHelper.js';
66
67
  import {
67
68
  MapperPostProcessorEditorState,
@@ -117,6 +118,7 @@ export enum CORE_AUTHENTICATION_STRATEGY_TYPE {
117
118
 
118
119
  export class RelationalDatabaseConnectionValueState extends ConnectionValueState {
119
120
  override connection: RelationalDatabaseConnection;
121
+ localMode = false;
120
122
  selectedTab = RELATIONAL_DATABASE_TAB_TYPE.GENERAL;
121
123
  postProcessorState: PostProcessorEditorState | undefined;
122
124
 
@@ -126,10 +128,12 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
126
128
  ) {
127
129
  super(editorStore, connection);
128
130
  makeObservable(this, {
131
+ localMode: observable,
129
132
  selectedTab: observable,
130
133
  postProcessorState: observable,
131
134
  selectedDatasourceSpecificationType: computed,
132
135
  selectedAuthenticationStrategyType: computed,
136
+ setLocalMode: action,
133
137
  setSelectedTab: action,
134
138
  selectPostProcessor: action,
135
139
  });
@@ -176,6 +180,10 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
176
180
  this.selectedTab = val;
177
181
  }
178
182
 
183
+ setLocalMode(val: boolean): void {
184
+ this.localMode = val;
185
+ }
186
+
179
187
  label(): string {
180
188
  return `${this.connection.type} connection`;
181
189
  }
@@ -300,6 +308,10 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
300
308
  dataSpec,
301
309
  observerContext,
302
310
  );
311
+ relationDbConnection_setLocalMode(
312
+ this.connection,
313
+ this.connection.localMode,
314
+ );
303
315
  }
304
316
 
305
317
  get selectedAuthenticationStrategyType(): string | undefined {
@@ -20,7 +20,6 @@ import {
20
20
  type PlainObject,
21
21
  assertErrorThrown,
22
22
  guaranteeType,
23
- ActionState,
24
23
  } from '@finos/legend-shared';
25
24
  import type { EditorStore } from '../../../EditorStore.js';
26
25
  import {
@@ -51,52 +50,6 @@ export enum SERVICE_TAB {
51
50
  TEST = 'TEST',
52
51
  REGISTRATION = 'REGISTRATION',
53
52
  POST_VALIDATION = 'POST_VALIDATION',
54
- TEMPORARY__SNOWFLAKE_SERVICE_DEPLOYMENT = 'SNOWFLAKE_DEPLOYMENT',
55
- }
56
-
57
- class TEMPORARY__SnowflakeServiceRegistrationState {
58
- readonly editorStore: EditorStore;
59
- readonly service: Service;
60
- readonly deploymentState = ActionState.create();
61
-
62
- result?: PlainObject | undefined;
63
-
64
- constructor(editorStore: EditorStore, service: Service) {
65
- makeObservable(this, {
66
- result: observable,
67
- deploy: flow,
68
- });
69
-
70
- this.editorStore = editorStore;
71
- this.service = service;
72
- }
73
-
74
- *deploy(): GeneratorFn<void> {
75
- const deploymentUrl =
76
- this.editorStore.applicationStore.config
77
- .TEMPORARY__snowflakeServiceDeploymentUrl;
78
-
79
- if (!deploymentUrl) {
80
- this.editorStore.applicationStore.notificationService.notifyWarning(
81
- `Can't deploy Snowflake service: deployment URL is not configured`,
82
- );
83
- return;
84
- }
85
-
86
- try {
87
- this.deploymentState.inProgress();
88
- this.result =
89
- (yield this.editorStore.graphManagerState.graphManager.TEMPORARY__deploySnowflakeService(
90
- (this.service.execution as PureExecution).func,
91
- this.editorStore.graphManagerState.graph,
92
- )) as PlainObject;
93
- } catch (error) {
94
- assertErrorThrown(error);
95
- this.editorStore.applicationStore.notificationService.notifyError(error);
96
- } finally {
97
- this.deploymentState.reset();
98
- }
99
- }
100
53
  }
101
54
 
102
55
  export const MINIMUM_SERVICE_OWNERS = 2;
@@ -106,7 +59,6 @@ export class ServiceEditorState extends ElementEditorState {
106
59
  testableState: ServiceTestableState;
107
60
  selectedTab: SERVICE_TAB;
108
61
  postValidationState: ServicePostValidationsState;
109
- TEMPORARY__snowflakeServiceRegistrationState: TEMPORARY__SnowflakeServiceRegistrationState;
110
62
 
111
63
  constructor(editorStore: EditorStore, element: PackageableElement) {
112
64
  super(editorStore, element);
@@ -140,11 +92,6 @@ export class ServiceEditorState extends ElementEditorState {
140
92
  ? SERVICE_TAB.EXECUTION
141
93
  : SERVICE_TAB.GENERAL;
142
94
  this.postValidationState = new ServicePostValidationsState(this);
143
- this.TEMPORARY__snowflakeServiceRegistrationState =
144
- new TEMPORARY__SnowflakeServiceRegistrationState(
145
- this.editorStore,
146
- this.service,
147
- );
148
95
  }
149
96
 
150
97
  setSelectedTab(tab: SERVICE_TAB): void {
@@ -31,6 +31,7 @@ import {
31
31
  getAllClassProperties,
32
32
  DATE_FORMAT,
33
33
  DATE_TIME_FORMAT,
34
+ classHasCycle,
34
35
  } from '@finos/legend-graph';
35
36
  import {
36
37
  CLASS_PROPERTY_TYPE,
@@ -132,38 +133,14 @@ export const createMockClassInstance = (
132
133
  return mockData;
133
134
  };
134
135
 
135
- export const classHasCycle = (
136
- _class: Class,
137
- traverseNonRequiredProperties: boolean,
138
- classesIndex: Set<string>,
139
- ): boolean => {
140
- if (classesIndex.has(_class.path)) {
141
- return true;
142
- }
143
- const properties = traverseNonRequiredProperties
144
- ? getAllClassProperties(_class)
145
- : getAllClassProperties(_class).filter((p) => p.multiplicity.lowerBound);
146
- const complexProperties = properties
147
- .map((property) => property.genericType.value.rawType)
148
- .filter((c) => getClassPropertyType(c) === CLASS_PROPERTY_TYPE.CLASS);
149
- if (complexProperties.length > 0) {
150
- // we only count classes with complex properties in the cycle. Example an address class with all primitive should not tigger a class to be cycled
151
- classesIndex.add(_class.path);
152
- }
153
- // we only check unique complex property classes; 2 same property classes on the same level do not count as a cycle
154
- return Boolean(
155
- Array.from(new Set(complexProperties)).find((c) =>
156
- classHasCycle(c as Class, traverseNonRequiredProperties, classesIndex),
157
- ),
158
- );
159
- };
160
-
161
136
  export const createMockDataForClass = (
162
137
  element: Class,
163
138
  maxDepth = 100,
164
139
  depthForCycle = 3,
165
140
  ): PlainObject => {
166
- const depth = classHasCycle(element, true, new Set<string>())
141
+ const depth = classHasCycle(element, {
142
+ traverseNonRequiredProperties: true,
143
+ })
167
144
  ? Math.max(depthForCycle, 0)
168
145
  : Math.max(maxDepth, 0);
169
146
  return createMockClassInstance(element, true, depth);
@@ -181,7 +158,9 @@ export const createMockDataForClassWithFormat = (
181
158
  maxDepth = 100,
182
159
  depthForCycle = 3,
183
160
  ): string => {
184
- const depth = classHasCycle(element, true, new Set<string>())
161
+ const depth = classHasCycle(element, {
162
+ traverseNonRequiredProperties: true,
163
+ })
185
164
  ? Math.max(depthForCycle, 0)
186
165
  : Math.max(maxDepth, 0);
187
166
  const obj = createMockClassInstance(element, true, depth);
@@ -117,7 +117,7 @@ export const generatePackageableElementTreeNodeDataLabel = (
117
117
  element: PackageableElement,
118
118
  ): string =>
119
119
  element instanceof ConcreteFunctionDefinition
120
- ? generateFunctionPrettyName(element, false)
120
+ ? generateFunctionPrettyName(element)
121
121
  : element.name;
122
122
 
123
123
  export const getPackableElementTreeNodeData = (
@@ -20,6 +20,7 @@ import {
20
20
  deleteEntry,
21
21
  guaranteeType,
22
22
  swapEntry,
23
+ type PlainObject,
23
24
  } from '@finos/legend-shared';
24
25
  import { action } from 'mobx';
25
26
  import {
@@ -65,9 +66,10 @@ import {
65
66
  observe_RawLambda,
66
67
  isStubbed_PackageableElement,
67
68
  getOtherAssociatedProperty,
69
+ type INTERNAL__UnknownFunctionActivator,
68
70
  } from '@finos/legend-graph';
69
71
 
70
- // --------------------------------------------- PackageableElementReference -------------------------------------
72
+ // --------------------------------------------- Packageable Element -------------------------------------
71
73
 
72
74
  export const packageableElementReference_setValue = action(
73
75
  <T extends PackageableElement>(
@@ -375,6 +377,12 @@ export const function_swapParameters = action(
375
377
  },
376
378
  );
377
379
 
380
+ export const INTERNAL__UnknownFunctionActivator_setContent = action(
381
+ (metamodel: INTERNAL__UnknownFunctionActivator, val: PlainObject) => {
382
+ metamodel.content = val;
383
+ },
384
+ );
385
+
378
386
  // --------------------------------------------- Enumeration -------------------------------------
379
387
 
380
388
  export const enum_setName = action((val: Enum, value: string): void => {
@@ -76,6 +76,12 @@ export const dBConnection_setQuoteIdentifiers = action(
76
76
  },
77
77
  );
78
78
 
79
+ export const relationDbConnection_setLocalMode = action(
80
+ (con: RelationalDatabaseConnection, val: boolean | undefined): void => {
81
+ con.localMode = val;
82
+ },
83
+ );
84
+
79
85
  export const relationDbConnection_setDatasourceSpecification = action(
80
86
  (
81
87
  con: RelationalDatabaseConnection,
@@ -435,13 +435,13 @@ export class ProjectViewerStore {
435
435
  graphBuilderReportData,
436
436
  );
437
437
 
438
- // fetch available file generation descriptions
439
- yield flowResult(
438
+ // fetch available editor configurations
439
+ yield Promise.all([
440
440
  this.editorStore.graphState.graphGenerationState.fetchAvailableFileGenerationDescriptions(),
441
- );
442
- yield flowResult(
443
- this.editorStore.graphState.graphGenerationState.externalFormatState.fetchExternalFormatsDescriptions(),
444
- );
441
+ this.editorStore.graphState.graphGenerationState.externalFormatState.fetchExternalFormatDescriptions(),
442
+ this.editorStore.graphState.graphGenerationState.externalFormatState.fetchExternalFormatDescriptions(),
443
+ this.editorStore.graphState.fetchAvailableFunctionActivatorConfigurations(),
444
+ ]);
445
445
 
446
446
  return true;
447
447
  } catch (error) {
package/tsconfig.json CHANGED
@@ -85,7 +85,10 @@
85
85
  "./src/stores/editor/editor-state/element-editor-state/ElementExternalFormatGenerationState.ts",
86
86
  "./src/stores/editor/editor-state/element-editor-state/ElementFileGenerationState.ts",
87
87
  "./src/stores/editor/editor-state/element-editor-state/FileGenerationEditorState.ts",
88
+ "./src/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.ts",
88
89
  "./src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts",
90
+ "./src/stores/editor/editor-state/element-editor-state/INTERNAL__UnknownFunctionActivatorEditorState.ts",
91
+ "./src/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.ts",
89
92
  "./src/stores/editor/editor-state/element-editor-state/RuntimeEditorState.ts",
90
93
  "./src/stores/editor/editor-state/element-editor-state/UMLEditorState.ts",
91
94
  "./src/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.ts",
@@ -173,13 +176,14 @@
173
176
  "./src/components/editor/StatusBar.tsx",
174
177
  "./src/components/editor/__test-utils__/EditorComponentTestUtils.tsx",
175
178
  "./src/components/editor/command-center/ProjectSearchCommand.tsx",
176
- "./src/components/editor/edit-panel/mapping-editor/testable/MappingTestableEditor.tsx",
177
179
  "./src/components/editor/editor-group/EditorGroup.tsx",
178
180
  "./src/components/editor/editor-group/FileGenerationViewer.tsx",
179
181
  "./src/components/editor/editor-group/FunctionEditor.tsx",
180
182
  "./src/components/editor/editor-group/GenerationSpecificationEditor.tsx",
181
183
  "./src/components/editor/editor-group/GrammarTextEditor.tsx",
184
+ "./src/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.tsx",
182
185
  "./src/components/editor/editor-group/ModelImporter.tsx",
186
+ "./src/components/editor/editor-group/ProtocolValueBuilder.tsx",
183
187
  "./src/components/editor/editor-group/RuntimeEditor.tsx",
184
188
  "./src/components/editor/editor-group/UnsupportedElementEditor.tsx",
185
189
  "./src/components/editor/editor-group/connection-editor/ConnectionEditor.tsx",
@@ -214,6 +218,7 @@
214
218
  "./src/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.tsx",
215
219
  "./src/components/editor/editor-group/mapping-editor/MappingExecutionQueryBuilder.tsx",
216
220
  "./src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx",
221
+ "./src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx",
217
222
  "./src/components/editor/editor-group/mapping-editor/MappingTestsExplorer.tsx",
218
223
  "./src/components/editor/editor-group/mapping-editor/NewMappingElementModal.tsx",
219
224
  "./src/components/editor/editor-group/mapping-editor/OperationSetImplementationEditor.tsx",
@@ -231,7 +236,6 @@
231
236
  "./src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx",
232
237
  "./src/components/editor/editor-group/service-editor/ServicePostValidationEditor.tsx",
233
238
  "./src/components/editor/editor-group/service-editor/ServiceRegistrationEditor.tsx",
234
- "./src/components/editor/editor-group/service-editor/TEMPORARY__SnowflakeServiceDeployer.tsx",
235
239
  "./src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx",
236
240
  "./src/components/editor/editor-group/service-editor/testable/ServiceTestableEditor.tsx",
237
241
  "./src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx",
@@ -1 +0,0 @@
1
- {"version":3,"file":"MappingTestableEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/edit-panel/mapping-editor/testable/MappingTestableEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA6DH,OAAO,EAEL,KAAK,oBAAoB,EAU1B,MAAM,yGAAyG,CAAC;AAo6CjH,eAAO,MAAM,qBAAqB,WACxB;IAAE,oBAAoB,EAAE,oBAAoB,CAAA;CAAE;;CA6IvD,CAAC"}