@finos/legend-application-studio 28.18.124 → 28.18.126

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 (115) hide show
  1. package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
  2. package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioNavigation.js +5 -0
  4. package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
  5. package/lib/application/LegendIngestionConfiguration.d.ts +40 -0
  6. package/lib/application/LegendIngestionConfiguration.d.ts.map +1 -0
  7. package/lib/application/LegendIngestionConfiguration.js +57 -0
  8. package/lib/application/LegendIngestionConfiguration.js.map +1 -0
  9. package/lib/application/LegendStudioApplicationConfig.d.ts +2 -0
  10. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  11. package/lib/application/LegendStudioApplicationConfig.js +6 -0
  12. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  13. package/lib/components/ElementIconUtils.d.ts.map +1 -1
  14. package/lib/components/ElementIconUtils.js +3 -1
  15. package/lib/components/ElementIconUtils.js.map +1 -1
  16. package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
  17. package/lib/components/LegendStudioWebApplication.js +16 -0
  18. package/lib/components/LegendStudioWebApplication.js.map +1 -1
  19. package/lib/components/editor/Editor.d.ts.map +1 -1
  20. package/lib/components/editor/Editor.js +3 -2
  21. package/lib/components/editor/Editor.js.map +1 -1
  22. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  23. package/lib/components/editor/editor-group/EditorGroup.js +5 -0
  24. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  25. package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.d.ts.map +1 -1
  26. package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js +1 -1
  27. package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js.map +1 -1
  28. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts +19 -0
  29. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts.map +1 -0
  30. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js +85 -0
  31. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js.map +1 -0
  32. package/lib/components/lazy-text-editor/LazyTextEditor.js +1 -1
  33. package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -1
  34. package/lib/index.css +1 -1
  35. package/lib/package.json +3 -1
  36. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  37. package/lib/stores/editor/EditorGraphState.js +4 -1
  38. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  39. package/lib/stores/editor/EditorStore.d.ts +6 -2
  40. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  41. package/lib/stores/editor/EditorStore.js +21 -4
  42. package/lib/stores/editor/EditorStore.js.map +1 -1
  43. package/lib/stores/editor/EditorTabManagerState.d.ts +2 -1
  44. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  45. package/lib/stores/editor/EditorTabManagerState.js +6 -2
  46. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  47. package/lib/stores/editor/GraphEditFormModeState.d.ts +2 -1
  48. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  49. package/lib/stores/editor/GraphEditFormModeState.js +2 -2
  50. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  51. package/lib/stores/editor/GraphEditorMode.d.ts +2 -1
  52. package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
  53. package/lib/stores/editor/GraphEditorMode.js.map +1 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.d.ts +30 -0
  55. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.d.ts.map +1 -0
  56. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.js +50 -0
  57. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.js.map +1 -0
  58. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts +2 -1
  59. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  60. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js +1 -1
  61. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  62. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts +1 -0
  63. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts.map +1 -1
  64. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js +4 -0
  65. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts +40 -0
  67. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts.map +1 -0
  68. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js +119 -0
  69. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js.map +1 -0
  70. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +2 -1
  71. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
  72. package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
  73. package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
  74. package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts +29 -0
  75. package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts.map +1 -0
  76. package/lib/stores/ingestion/IngestDeploymentServerClient.js +49 -0
  77. package/lib/stores/ingestion/IngestDeploymentServerClient.js.map +1 -0
  78. package/lib/stores/ingestion/IngestDiscoveryServerClient.d.ts +26 -0
  79. package/lib/stores/ingestion/IngestDiscoveryServerClient.d.ts.map +1 -0
  80. package/lib/stores/ingestion/IngestDiscoveryServerClient.js +35 -0
  81. package/lib/stores/ingestion/IngestDiscoveryServerClient.js.map +1 -0
  82. package/lib/stores/ingestion/IngestionDeploymentResponse.d.ts +40 -0
  83. package/lib/stores/ingestion/IngestionDeploymentResponse.d.ts.map +1 -0
  84. package/lib/stores/ingestion/IngestionDeploymentResponse.js +55 -0
  85. package/lib/stores/ingestion/IngestionDeploymentResponse.js.map +1 -0
  86. package/lib/stores/ingestion/IngestionManager.d.ts +35 -0
  87. package/lib/stores/ingestion/IngestionManager.d.ts.map +1 -0
  88. package/lib/stores/ingestion/IngestionManager.js +83 -0
  89. package/lib/stores/ingestion/IngestionManager.js.map +1 -0
  90. package/package.json +10 -8
  91. package/src/__lib__/LegendStudioNavigation.ts +14 -0
  92. package/src/application/LegendIngestionConfiguration.ts +94 -0
  93. package/src/application/LegendStudioApplicationConfig.ts +15 -0
  94. package/src/components/ElementIconUtils.tsx +3 -0
  95. package/src/components/LegendStudioWebApplication.tsx +29 -0
  96. package/src/components/editor/Editor.tsx +8 -3
  97. package/src/components/editor/editor-group/EditorGroup.tsx +4 -1
  98. package/src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx +11 -0
  99. package/src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx +214 -0
  100. package/src/components/lazy-text-editor/LazyTextEditor.tsx +1 -1
  101. package/src/stores/editor/EditorGraphState.ts +3 -0
  102. package/src/stores/editor/EditorStore.ts +39 -1
  103. package/src/stores/editor/EditorTabManagerState.ts +6 -0
  104. package/src/stores/editor/GraphEditFormModeState.ts +9 -2
  105. package/src/stores/editor/GraphEditorMode.ts +5 -1
  106. package/src/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.ts +97 -0
  107. package/src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts +6 -1
  108. package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts +5 -0
  109. package/src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts +184 -0
  110. package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
  111. package/src/stores/ingestion/IngestDeploymentServerClient.ts +83 -0
  112. package/src/stores/ingestion/IngestDiscoveryServerClient.ts +52 -0
  113. package/src/stores/ingestion/IngestionDeploymentResponse.ts +73 -0
  114. package/src/stores/ingestion/IngestionManager.ts +163 -0
  115. package/tsconfig.json +8 -0
@@ -0,0 +1,73 @@
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 { SerializationFactory, type PlainObject } from '@finos/legend-shared';
18
+ import { createModelSchema, primitive } from 'serializr';
19
+
20
+ export enum IngestDefinitionValidationResponseStatus {
21
+ NOT_CHECKED = 'NOT_CHECKED',
22
+ SUCCESS = 'SUCCESS',
23
+ FAILURE = 'FAILURE',
24
+ }
25
+
26
+ export class IngestDefinitionValidationOutput {
27
+ status!: IngestDefinitionValidationResponseStatus;
28
+ }
29
+
30
+ export class IngestDefinitionValidationResponse {
31
+ status!: IngestDefinitionValidationResponseStatus;
32
+ content!: PlainObject;
33
+
34
+ static readonly serialization = new SerializationFactory(
35
+ createModelSchema(IngestDefinitionValidationResponse, {
36
+ status: primitive(),
37
+ }),
38
+ );
39
+ }
40
+
41
+ export const createIngestDefinitionValidationResponse = (
42
+ json: PlainObject<IngestDefinitionValidationResponse>,
43
+ ): IngestDefinitionValidationResponse => {
44
+ const ingestDefinitionValidationResponse =
45
+ new IngestDefinitionValidationResponse();
46
+ ingestDefinitionValidationResponse.status =
47
+ json.status as IngestDefinitionValidationResponseStatus;
48
+ ingestDefinitionValidationResponse.content = json;
49
+ return ingestDefinitionValidationResponse;
50
+ };
51
+
52
+ export class IngestDefinitionDeploymentResponse {
53
+ ingestDefinitionUrn!: string;
54
+
55
+ static readonly serialization = new SerializationFactory(
56
+ createModelSchema(IngestDefinitionDeploymentResponse, {
57
+ ingestDefinitionUrn: primitive(),
58
+ }),
59
+ );
60
+ }
61
+
62
+ export class ValidateAndDeploymentResponse {
63
+ validationResponse: IngestDefinitionValidationResponse;
64
+ deploymentResponse: IngestDefinitionDeploymentResponse | undefined;
65
+
66
+ constructor(
67
+ validationResponse: IngestDefinitionValidationResponse,
68
+ deploymentResponse: IngestDefinitionDeploymentResponse | undefined,
69
+ ) {
70
+ this.validationResponse = validationResponse;
71
+ this.deploymentResponse = deploymentResponse;
72
+ }
73
+ }
@@ -0,0 +1,163 @@
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 { AppDirNode } from '@finos/legend-graph';
18
+ import { IngestDeploymentServerClient } from './IngestDeploymentServerClient.js';
19
+ import { IngestDiscoveryServerClient } from './IngestDiscoveryServerClient.js';
20
+ import type { GenericLegendApplicationStore } from '@finos/legend-application';
21
+ import { type ActionState, type PlainObject } from '@finos/legend-shared';
22
+ import {
23
+ type IngestDefinitionValidationResponse,
24
+ IngestDefinitionDeploymentResponse,
25
+ IngestDefinitionValidationResponseStatus,
26
+ ValidateAndDeploymentResponse,
27
+ createIngestDefinitionValidationResponse,
28
+ } from './IngestionDeploymentResponse.js';
29
+ import {
30
+ IngestDeploymentServerConfig,
31
+ type LegendIngestionConfiguration,
32
+ } from '../../application/LegendIngestionConfiguration.js';
33
+
34
+ export class IngestionManager {
35
+ private ingestDiscoveryServerClient: IngestDiscoveryServerClient;
36
+ private ingestDeploymentServerClient: IngestDeploymentServerClient;
37
+ private _currentAppID: number | undefined;
38
+ private _currentLevel: string | undefined;
39
+ private readonly applicationStore: GenericLegendApplicationStore;
40
+
41
+ constructor(
42
+ config: LegendIngestionConfiguration,
43
+ applicationStore: GenericLegendApplicationStore,
44
+ ) {
45
+ this.ingestDiscoveryServerClient = new IngestDiscoveryServerClient(
46
+ config.discoveryUrl,
47
+ );
48
+ this.ingestDiscoveryServerClient.setTracerService(
49
+ applicationStore.tracerService,
50
+ );
51
+ this.ingestDeploymentServerClient = new IngestDeploymentServerClient(
52
+ config.deployment.defaultServer,
53
+ );
54
+ this.ingestDeploymentServerClient.setTracerService(
55
+ applicationStore.tracerService,
56
+ );
57
+ this.applicationStore = applicationStore;
58
+ }
59
+
60
+ isCurrentAppDirNode(appDirNode: AppDirNode): boolean {
61
+ return (
62
+ this._currentAppID === appDirNode.appDirId &&
63
+ this._currentLevel === appDirNode.level
64
+ );
65
+ }
66
+
67
+ setCurrentAppDirNode(appDirNode: AppDirNode): void {
68
+ this._currentAppID = appDirNode.appDirId;
69
+ this._currentLevel = appDirNode.level;
70
+ }
71
+
72
+ async deploy(
73
+ ingestDefinition: string,
74
+ appDirNode: AppDirNode,
75
+ actionState: ActionState | undefined,
76
+ token: string | undefined,
77
+ ): Promise<ValidateAndDeploymentResponse> {
78
+ actionState?.setMessage(
79
+ `Discovering associated ingest environment for DID ${appDirNode.appDirId}...`,
80
+ );
81
+ await this.identifyIngestDeploymentServer(appDirNode, token);
82
+ actionState?.setMessage(
83
+ `Validating ingest with server ${this.ingestDeploymentServerClient.baseUrl ?? ''} for realm ${this.ingestDeploymentServerClient.environmentClassification}...`,
84
+ );
85
+ const validateResonse = await this._validate(
86
+ ingestDefinition,
87
+ undefined,
88
+ token,
89
+ );
90
+ const fullResponse = new ValidateAndDeploymentResponse(
91
+ validateResonse,
92
+ undefined,
93
+ );
94
+ if (
95
+ validateResonse.status !==
96
+ IngestDefinitionValidationResponseStatus.SUCCESS
97
+ ) {
98
+ return fullResponse;
99
+ }
100
+ actionState?.setMessage(
101
+ `Validation Success. Deploying ingest with server ${this.ingestDeploymentServerClient.baseUrl ?? ''} for realm ${this.ingestDeploymentServerClient.environmentClassification}...`,
102
+ );
103
+ const deployResponse = await this._deploy(
104
+ ingestDefinition,
105
+ undefined,
106
+ token,
107
+ );
108
+ fullResponse.deploymentResponse = deployResponse;
109
+ return fullResponse;
110
+ }
111
+
112
+ private async _validate(
113
+ ingestDefinition: string,
114
+ appDirNode: AppDirNode | undefined,
115
+ token: string | undefined,
116
+ ): Promise<IngestDefinitionValidationResponse> {
117
+ if (appDirNode) {
118
+ await this.identifyIngestDeploymentServer(appDirNode, token);
119
+ }
120
+ // validate
121
+ const response = await this.ingestDeploymentServerClient.validate(
122
+ ingestDefinition,
123
+ token,
124
+ );
125
+ return createIngestDefinitionValidationResponse(response);
126
+ }
127
+
128
+ private async _deploy(
129
+ ingestDefinition: string,
130
+ appDirNode: AppDirNode | undefined,
131
+ token: string | undefined,
132
+ ): Promise<IngestDefinitionDeploymentResponse> {
133
+ if (appDirNode) {
134
+ await this.identifyIngestDeploymentServer(appDirNode, token);
135
+ }
136
+ // validate
137
+ const response = (await this.ingestDeploymentServerClient.deploy(
138
+ ingestDefinition,
139
+ token,
140
+ )) as unknown as PlainObject<IngestDefinitionDeploymentResponse>;
141
+ return IngestDefinitionDeploymentResponse.serialization.fromJson(response);
142
+ }
143
+
144
+ private async identifyIngestDeploymentServer(
145
+ appDirNode: AppDirNode,
146
+ token: string | undefined,
147
+ ): Promise<void> {
148
+ // we do not change if current appDirNode is the same as the one we are trying to set
149
+ if (this.isCurrentAppDirNode(appDirNode)) {
150
+ return;
151
+ }
152
+ const serverConfig = IngestDeploymentServerConfig.serialization.fromJson(
153
+ await this.ingestDiscoveryServerClient.findProducerServer(
154
+ appDirNode.appDirId,
155
+ appDirNode.level,
156
+ token,
157
+ ),
158
+ );
159
+
160
+ this.ingestDeploymentServerClient.changeServer(serverConfig);
161
+ this.setCurrentAppDirNode(appDirNode);
162
+ }
163
+ }
package/tsconfig.json CHANGED
@@ -67,6 +67,7 @@
67
67
  "./src/__lib__/LegendStudioTesting.ts",
68
68
  "./src/__lib__/LegendStudioUserDataHelper.ts",
69
69
  "./src/__lib__/STO_Relational_LegendStudioCommand.ts",
70
+ "./src/application/LegendIngestionConfiguration.ts",
70
71
  "./src/application/LegendStudioApplicationConfig.ts",
71
72
  "./src/application/LegendStudioPluginManager.ts",
72
73
  "./src/components/__test-utils__/EmbeddedQueryBuilderTestUtils.ts",
@@ -108,6 +109,7 @@
108
109
  "./src/stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.ts",
109
110
  "./src/stores/editor/editor-state/element-editor-state/ClassEditorState.ts",
110
111
  "./src/stores/editor/editor-state/element-editor-state/ClassState.ts",
112
+ "./src/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.ts",
111
113
  "./src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts",
112
114
  "./src/stores/editor/editor-state/element-editor-state/ElementExternalFormatGenerationState.ts",
113
115
  "./src/stores/editor/editor-state/element-editor-state/ElementFileGenerationState.ts",
@@ -134,6 +136,7 @@
134
136
  "./src/stores/editor/editor-state/element-editor-state/function-activator/PostDeploymentActionEditorState.ts",
135
137
  "./src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts",
136
138
  "./src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts",
139
+ "./src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts",
137
140
  "./src/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.ts",
138
141
  "./src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts",
139
142
  "./src/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.ts",
@@ -202,6 +205,10 @@
202
205
  "./src/stores/graph-modifier/STO_FlatData_GraphModifierHelper.ts",
203
206
  "./src/stores/graph-modifier/STO_Relational_GraphModifierHelper.ts",
204
207
  "./src/stores/graph-modifier/Testable_GraphModifierHelper.ts",
208
+ "./src/stores/ingestion/IngestDeploymentServerClient.ts",
209
+ "./src/stores/ingestion/IngestDiscoveryServerClient.ts",
210
+ "./src/stores/ingestion/IngestionDeploymentResponse.ts",
211
+ "./src/stores/ingestion/IngestionManager.ts",
205
212
  "./src/stores/lazy-text-editor/LazyTextEditorStore.ts",
206
213
  "./src/stores/project-reviewer/ProjectReviewerStore.ts",
207
214
  "./src/stores/project-view/ProjectViewerEditorMode.ts",
@@ -267,6 +274,7 @@
267
274
  "./src/components/editor/editor-group/function-activator/INTERNAL__UnknownFunctionActivatorEdtior.tsx",
268
275
  "./src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx",
269
276
  "./src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx",
277
+ "./src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx",
270
278
  "./src/components/editor/editor-group/mapping-editor/ClassMappingEditor.tsx",
271
279
  "./src/components/editor/editor-group/mapping-editor/EnumerationMappingEditor.tsx",
272
280
  "./src/components/editor/editor-group/mapping-editor/FlatDataPropertyMappingEditor.tsx",