@finos/legend-graph 31.0.4 → 31.1.1
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/graph/DependencyManager.d.ts +4 -0
- package/lib/graph/DependencyManager.d.ts.map +1 -1
- package/lib/graph/DependencyManager.js +8 -2
- package/lib/graph/DependencyManager.js.map +1 -1
- package/lib/graph/helpers/DomainHelper.d.ts +1 -0
- package/lib/graph/helpers/DomainHelper.d.ts.map +1 -1
- package/lib/graph/helpers/DomainHelper.js +15 -0
- package/lib/graph/helpers/DomainHelper.js.map +1 -1
- package/lib/graph-manager/AbstractPureGraphManager.d.ts +1 -0
- package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/AbstractPureGraphManager.js.map +1 -1
- package/lib/graph-manager/GraphManagerState.d.ts +5 -0
- package/lib/graph-manager/GraphManagerState.d.ts.map +1 -1
- package/lib/graph-manager/GraphManagerState.js +22 -17
- package/lib/graph-manager/GraphManagerState.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +10 -0
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.d.ts +2 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.js +16 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts +3 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js +6 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.d.ts +23 -0
- package/lib/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.js +27 -0
- package/lib/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementBuilder.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementBuilder.js +27 -4
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementBuilder.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/graph/DependencyManager.ts +11 -2
- package/src/graph/helpers/DomainHelper.ts +17 -0
- package/src/graph-manager/AbstractPureGraphManager.ts +7 -0
- package/src/graph-manager/GraphManagerState.ts +22 -18
- package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +16 -0
- package/src/graph-manager/protocol/pure/v1/engine/V1_Engine.ts +28 -0
- package/src/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.ts +17 -0
- package/src/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.ts +32 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementBuilder.ts +43 -6
- package/tsconfig.json +1 -0
|
@@ -159,7 +159,11 @@ export class GraphManagerState extends BasicGraphManagerState {
|
|
|
159
159
|
this.pluginManager.getPureGraphPlugins(),
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
/**
|
|
163
|
+
* NOTE: for all elements the ordering of usable elements will be own elements, system elements, dependency elements.
|
|
164
|
+
* Exception is made for types and profiles where we will show primitive and system elements first as those will be
|
|
165
|
+
* leveraged most by users
|
|
166
|
+
*/
|
|
163
167
|
get usableClassPropertyTypes(): Type[] {
|
|
164
168
|
return [
|
|
165
169
|
...this.graph.primitiveTypes.filter(
|
|
@@ -179,147 +183,147 @@ export class GraphManagerState extends BasicGraphManagerState {
|
|
|
179
183
|
...this.graphManager.collectExposedSystemElements(
|
|
180
184
|
this.graph.systemModel.ownProfiles,
|
|
181
185
|
),
|
|
182
|
-
...this.graph.dependencyManager.profiles,
|
|
183
186
|
...this.graph.ownProfiles,
|
|
187
|
+
...this.graph.dependencyManager.profiles,
|
|
184
188
|
];
|
|
185
189
|
}
|
|
186
190
|
get usableEnumerations(): Enumeration[] {
|
|
187
191
|
return [
|
|
192
|
+
...this.graph.ownEnumerations,
|
|
188
193
|
...this.graphManager.collectExposedSystemElements(
|
|
189
194
|
this.graph.systemModel.ownEnumerations,
|
|
190
195
|
),
|
|
191
196
|
...this.graph.dependencyManager.enumerations,
|
|
192
|
-
...this.graph.ownEnumerations,
|
|
193
197
|
];
|
|
194
198
|
}
|
|
195
199
|
get usableMeasures(): Measure[] {
|
|
196
200
|
return [
|
|
201
|
+
...this.graph.ownMeasures,
|
|
197
202
|
...this.graphManager.collectExposedSystemElements(
|
|
198
203
|
this.graph.systemModel.ownMeasures,
|
|
199
204
|
),
|
|
200
205
|
...this.graph.dependencyManager.measures,
|
|
201
|
-
...this.graph.ownMeasures,
|
|
202
206
|
];
|
|
203
207
|
}
|
|
204
208
|
get usableClasses(): Class[] {
|
|
205
209
|
return [
|
|
210
|
+
...this.graph.ownClasses,
|
|
206
211
|
...this.graphManager.collectExposedSystemElements(
|
|
207
212
|
this.graph.systemModel.ownClasses,
|
|
208
213
|
),
|
|
209
214
|
...this.graph.dependencyManager.classes,
|
|
210
|
-
...this.graph.ownClasses,
|
|
211
215
|
];
|
|
212
216
|
}
|
|
213
217
|
get usableAssociationPropertyClasses(): Class[] {
|
|
214
|
-
return [...this.graph.
|
|
218
|
+
return [...this.graph.ownClasses, ...this.graph.dependencyManager.classes];
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
get usableAssociations(): Association[] {
|
|
218
222
|
return [
|
|
223
|
+
...this.graph.ownAssociations,
|
|
219
224
|
...this.graphManager.collectExposedSystemElements(
|
|
220
225
|
this.graph.systemModel.ownAssociations,
|
|
221
226
|
),
|
|
222
227
|
...this.graph.dependencyManager.associations,
|
|
223
|
-
...this.graph.ownAssociations,
|
|
224
228
|
];
|
|
225
229
|
}
|
|
226
230
|
get usableFunctions(): ConcreteFunctionDefinition[] {
|
|
227
231
|
return [
|
|
232
|
+
...this.graph.ownFunctions,
|
|
228
233
|
...this.graphManager.collectExposedSystemElements(
|
|
229
234
|
this.graph.systemModel.ownFunctions,
|
|
230
235
|
),
|
|
231
236
|
...this.graph.dependencyManager.functions,
|
|
232
|
-
...this.graph.ownFunctions,
|
|
233
237
|
];
|
|
234
238
|
}
|
|
235
239
|
get usableStores(): Store[] {
|
|
236
240
|
return [
|
|
241
|
+
...this.graph.ownStores,
|
|
237
242
|
...this.graphManager.collectExposedSystemElements(
|
|
238
243
|
this.graph.systemModel.ownStores,
|
|
239
244
|
),
|
|
240
245
|
...this.graph.dependencyManager.stores,
|
|
241
|
-
...this.graph.ownStores,
|
|
242
246
|
];
|
|
243
247
|
}
|
|
244
248
|
get usableDatabases(): Database[] {
|
|
245
249
|
return [
|
|
250
|
+
...this.graph.ownDatabases,
|
|
246
251
|
...this.graphManager.collectExposedSystemElements(
|
|
247
252
|
this.graph.systemModel.ownDatabases,
|
|
248
253
|
),
|
|
249
254
|
...this.graph.dependencyManager.databases,
|
|
250
|
-
...this.graph.ownDatabases,
|
|
251
255
|
];
|
|
252
256
|
}
|
|
253
257
|
get usableMappings(): Mapping[] {
|
|
254
258
|
return [
|
|
259
|
+
...this.graph.ownMappings,
|
|
255
260
|
...this.graphManager.collectExposedSystemElements(
|
|
256
261
|
this.graph.systemModel.ownMappings,
|
|
257
262
|
),
|
|
258
263
|
...this.graph.dependencyManager.mappings,
|
|
259
|
-
...this.graph.ownMappings,
|
|
260
264
|
];
|
|
261
265
|
}
|
|
262
266
|
get usableServices(): Service[] {
|
|
263
267
|
return [
|
|
268
|
+
...this.graph.ownServices,
|
|
264
269
|
...this.graphManager.collectExposedSystemElements(
|
|
265
270
|
this.graph.systemModel.ownServices,
|
|
266
271
|
),
|
|
267
272
|
...this.graph.dependencyManager.services,
|
|
268
|
-
...this.graph.ownServices,
|
|
269
273
|
];
|
|
270
274
|
}
|
|
271
275
|
get usableRuntimes(): PackageableRuntime[] {
|
|
272
276
|
return [
|
|
277
|
+
...this.graph.ownRuntimes,
|
|
273
278
|
...this.graphManager.collectExposedSystemElements(
|
|
274
279
|
this.graph.systemModel.ownRuntimes,
|
|
275
280
|
),
|
|
276
281
|
...this.graph.dependencyManager.runtimes,
|
|
277
|
-
...this.graph.ownRuntimes,
|
|
278
282
|
];
|
|
279
283
|
}
|
|
280
284
|
get usableConnections(): PackageableConnection[] {
|
|
281
285
|
return [
|
|
286
|
+
...this.graph.ownConnections,
|
|
282
287
|
...this.graphManager.collectExposedSystemElements(
|
|
283
288
|
this.graph.systemModel.ownConnections,
|
|
284
289
|
),
|
|
285
290
|
...this.graph.dependencyManager.connections,
|
|
286
|
-
...this.graph.ownConnections,
|
|
287
291
|
];
|
|
288
292
|
}
|
|
289
293
|
get usableDataElements(): DataElement[] {
|
|
290
294
|
return [
|
|
295
|
+
...this.graph.ownDataElements,
|
|
291
296
|
...this.graphManager.collectExposedSystemElements(
|
|
292
297
|
this.graph.systemModel.ownDataElements,
|
|
293
298
|
),
|
|
294
299
|
...this.graph.dependencyManager.dataElements,
|
|
295
|
-
...this.graph.ownDataElements,
|
|
296
300
|
];
|
|
297
301
|
}
|
|
298
302
|
get usableGenerationSpecifications(): GenerationSpecification[] {
|
|
299
303
|
return [
|
|
304
|
+
...this.graph.ownGenerationSpecifications,
|
|
300
305
|
...this.graphManager.collectExposedSystemElements(
|
|
301
306
|
this.graph.systemModel.ownGenerationSpecifications,
|
|
302
307
|
),
|
|
303
308
|
...this.graph.dependencyManager.generationSpecifications,
|
|
304
|
-
...this.graph.ownGenerationSpecifications,
|
|
305
309
|
];
|
|
306
310
|
}
|
|
307
311
|
get usableFileGenerations(): FileGenerationSpecification[] {
|
|
308
312
|
return [
|
|
313
|
+
...this.graph.ownFileGenerations,
|
|
309
314
|
...this.graphManager.collectExposedSystemElements(
|
|
310
315
|
this.graph.systemModel.ownFileGenerations,
|
|
311
316
|
),
|
|
312
317
|
...this.graph.dependencyManager.fileGenerations,
|
|
313
|
-
...this.graph.ownFileGenerations,
|
|
314
318
|
];
|
|
315
319
|
}
|
|
316
320
|
get usableElements(): PackageableElement[] {
|
|
317
321
|
return [
|
|
322
|
+
...this.graph.ownMeasures,
|
|
318
323
|
...this.graphManager.collectExposedSystemElements(
|
|
319
324
|
this.graph.systemModel.allOwnElements,
|
|
320
325
|
),
|
|
321
326
|
...this.graph.dependencyManager.allOwnElements,
|
|
322
|
-
...this.graph.ownMeasures,
|
|
323
327
|
];
|
|
324
328
|
}
|
|
325
329
|
}
|
|
@@ -291,6 +291,7 @@ import { FunctionActivatorConfiguration } from '../../../action/functionActivato
|
|
|
291
291
|
import { V1_FunctionActivatorInput } from './engine/functionActivator/V1_FunctionActivatorInput.js';
|
|
292
292
|
import { V1_FunctionActivator } from './model/packageableElements/function/V1_FunctionActivator.js';
|
|
293
293
|
import { V1_INTERNAL__UnknownFunctionActivator } from './model/packageableElements/function/V1_INTERNAL__UnknownFunctionActivator.js';
|
|
294
|
+
import { V1_DatabaseToModelGenerationInput } from './engine/relational/V1_DatabaseToModelGenerationInput.js';
|
|
294
295
|
import type { RelationalDatabaseConnection } from '../../../../STO_Relational_Exports.js';
|
|
295
296
|
import { V1_RawSQLExecuteInput } from './engine/execution/V1_RawSQLExecuteInput.js';
|
|
296
297
|
import type { SubtypeInfo } from '../../../action/protocol/ProtocolInfo.js';
|
|
@@ -2996,6 +2997,21 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
2996
2997
|
await this.engine.publishFunctionActivatorToSandbox(input);
|
|
2997
2998
|
}
|
|
2998
2999
|
|
|
3000
|
+
// --------------------------------------------- Relational ---------------------------------------------
|
|
3001
|
+
|
|
3002
|
+
async generateModelsFromDatabaseSpecification(
|
|
3003
|
+
databasePath: string,
|
|
3004
|
+
graph: PureModel,
|
|
3005
|
+
): Promise<Entity[]> {
|
|
3006
|
+
const graphData = this.graphToPureModelContextData(graph);
|
|
3007
|
+
const input = new V1_DatabaseToModelGenerationInput();
|
|
3008
|
+
input.databasePath = databasePath;
|
|
3009
|
+
input.modelData = graphData;
|
|
3010
|
+
const generatedModel =
|
|
3011
|
+
await this.engine.generateModelsFromDatabaseSpecification(input);
|
|
3012
|
+
return this.pureModelContextDataToEntities(generatedModel);
|
|
3013
|
+
}
|
|
3014
|
+
|
|
2999
3015
|
// --------------------------------------------- Service ---------------------------------------------
|
|
3000
3016
|
|
|
3001
3017
|
async registerService(
|
|
@@ -135,6 +135,7 @@ import {
|
|
|
135
135
|
V1_ArtifactGenerationExtensionOutput,
|
|
136
136
|
V1_ArtifactGenerationExtensionInput,
|
|
137
137
|
} from './generation/V1_ArtifactGenerationExtensionApi.js';
|
|
138
|
+
import { V1_DatabaseToModelGenerationInput } from './relational/V1_DatabaseToModelGenerationInput.js';
|
|
138
139
|
|
|
139
140
|
class V1_EngineConfig extends TEMPORARY__AbstractEngineConfig {
|
|
140
141
|
private engine: V1_Engine;
|
|
@@ -1013,4 +1014,31 @@ export class V1_Engine {
|
|
|
1013
1014
|
);
|
|
1014
1015
|
}
|
|
1015
1016
|
}
|
|
1017
|
+
|
|
1018
|
+
// ------------------------------------------- Relational -------------------------------------------
|
|
1019
|
+
|
|
1020
|
+
async generateModelsFromDatabaseSpecification(
|
|
1021
|
+
input: V1_DatabaseToModelGenerationInput,
|
|
1022
|
+
): Promise<V1_PureModelContextData> {
|
|
1023
|
+
try {
|
|
1024
|
+
const json =
|
|
1025
|
+
await this.engineServerClient.generateModelsFromDatabaseSpecification(
|
|
1026
|
+
V1_DatabaseToModelGenerationInput.serialization.toJson(input),
|
|
1027
|
+
);
|
|
1028
|
+
return V1_deserializePureModelContextData(json);
|
|
1029
|
+
} catch (error) {
|
|
1030
|
+
assertErrorThrown(error);
|
|
1031
|
+
if (
|
|
1032
|
+
error instanceof NetworkClientError &&
|
|
1033
|
+
error.response.status === HttpStatus.BAD_REQUEST
|
|
1034
|
+
) {
|
|
1035
|
+
throw V1_buildParserError(
|
|
1036
|
+
V1_ParserError.serialization.fromJson(
|
|
1037
|
+
error.payload as PlainObject<V1_ParserError>,
|
|
1038
|
+
),
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
throw error;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1016
1044
|
}
|
|
@@ -77,11 +77,14 @@ import type {
|
|
|
77
77
|
V1_ArtifactGenerationExtensionInput,
|
|
78
78
|
V1_ArtifactGenerationExtensionOutput,
|
|
79
79
|
} from './generation/V1_ArtifactGenerationExtensionApi.js';
|
|
80
|
+
import type { V1_DatabaseToModelGenerationInput } from './relational/V1_DatabaseToModelGenerationInput.js';
|
|
80
81
|
|
|
81
82
|
enum CORE_ENGINE_ACTIVITY_TRACE {
|
|
82
83
|
GRAMMAR_TO_JSON = 'transform Pure code to protocol',
|
|
83
84
|
JSON_TO_GRAMMAR = 'transform protocol to Pure code',
|
|
84
85
|
|
|
86
|
+
DATABASE_TO_MODELS = 'generate models from database',
|
|
87
|
+
|
|
85
88
|
EXTERNAL_FORMAT_TO_PROTOCOL = 'transform external format code to protocol',
|
|
86
89
|
GENERATE_FILE = 'generate file',
|
|
87
90
|
|
|
@@ -774,6 +777,20 @@ export class V1_EngineServerClient extends AbstractServerClient {
|
|
|
774
777
|
);
|
|
775
778
|
}
|
|
776
779
|
|
|
780
|
+
// ------------------------------------------- Relational ---------------------------------------
|
|
781
|
+
|
|
782
|
+
_relationalElement = (): string => `${this._pure()}/relational`;
|
|
783
|
+
|
|
784
|
+
generateModelsFromDatabaseSpecification(
|
|
785
|
+
input: PlainObject<V1_DatabaseToModelGenerationInput>,
|
|
786
|
+
): Promise<PlainObject<V1_PureModelContextData>> {
|
|
787
|
+
return this.postWithTracing(
|
|
788
|
+
this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.DATABASE_TO_MODELS),
|
|
789
|
+
`${this._relationalElement()}/generateModelsFromDatabaseSpecification`,
|
|
790
|
+
this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.DATABASE_TO_MODELS),
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
|
|
777
794
|
// ------------------------------------------- Service -------------------------------------------
|
|
778
795
|
|
|
779
796
|
_service = (serviceServerUrl?: string): string =>
|
package/src/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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 { primitive, createModelSchema } from 'serializr';
|
|
18
|
+
import { SerializationFactory } from '@finos/legend-shared';
|
|
19
|
+
import type { V1_PureModelContextData } from '../../model/context/V1_PureModelContextData.js';
|
|
20
|
+
import { V1_pureModelContextDataPropSchema } from '../../transformation/pureProtocol/V1_PureProtocolSerialization.js';
|
|
21
|
+
|
|
22
|
+
export class V1_DatabaseToModelGenerationInput {
|
|
23
|
+
databasePath!: string;
|
|
24
|
+
modelData!: V1_PureModelContextData;
|
|
25
|
+
|
|
26
|
+
static readonly serialization = new SerializationFactory(
|
|
27
|
+
createModelSchema(V1_DatabaseToModelGenerationInput, {
|
|
28
|
+
databasePath: primitive(),
|
|
29
|
+
modelData: V1_pureModelContextDataPropSchema,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -17,20 +17,29 @@
|
|
|
17
17
|
import {
|
|
18
18
|
type GenericClazz,
|
|
19
19
|
assertNonEmptyString,
|
|
20
|
-
assertTrue,
|
|
21
20
|
AssertionError,
|
|
21
|
+
guaranteeNonNullable,
|
|
22
22
|
} from '@finos/legend-shared';
|
|
23
|
+
import type { BasicModel } from '../../../../../../../graph/BasicModel.js';
|
|
24
|
+
import { DependencyModel } from '../../../../../../../graph/DependencyManager.js';
|
|
25
|
+
import { LegendSDLC } from '../../../../../../../graph/GraphDataOrigin.js';
|
|
23
26
|
import {
|
|
24
27
|
addElementToPackage,
|
|
28
|
+
getElementOrigin,
|
|
25
29
|
getOrCreateGraphPackage,
|
|
26
30
|
} from '../../../../../../../graph/helpers/DomainHelper.js';
|
|
27
31
|
import type { Package } from '../../../../../../../graph/metamodel/pure/packageableElements/domain/Package.js';
|
|
28
32
|
import type { PackageableElement } from '../../../../../../../graph/metamodel/pure/packageableElements/PackageableElement.js';
|
|
33
|
+
import {
|
|
34
|
+
GenerationModel,
|
|
35
|
+
SystemModel,
|
|
36
|
+
} from '../../../../../../../graph/PureModel.js';
|
|
29
37
|
import type { V1_PackageableElement } from '../../../model/packageableElements/V1_PackageableElement.js';
|
|
30
38
|
import {
|
|
31
39
|
V1_buildFullPath,
|
|
32
40
|
type V1_GraphBuilderContext,
|
|
33
41
|
} from './V1_GraphBuilderContext.js';
|
|
42
|
+
import { GAV_DELIMITER } from '@finos/legend-storage';
|
|
34
43
|
|
|
35
44
|
export type V1_ElementBuilderPass = (
|
|
36
45
|
elementProtocol: V1_PackageableElement,
|
|
@@ -46,6 +55,20 @@ export type V1_ElementThirdPassBuilder = V1_ElementBuilderPass;
|
|
|
46
55
|
export type V1_ElementFourthPassBuilder = V1_ElementBuilderPass;
|
|
47
56
|
export type V1_ElementFifthPassBuilder = V1_ElementBuilderPass;
|
|
48
57
|
|
|
58
|
+
const currentSubGraphOrigin = (graph: BasicModel): string => {
|
|
59
|
+
if (graph instanceof SystemModel) {
|
|
60
|
+
return 'System elements';
|
|
61
|
+
} else if (graph instanceof GenerationModel) {
|
|
62
|
+
return 'Generation elements';
|
|
63
|
+
} else if (
|
|
64
|
+
graph instanceof DependencyModel &&
|
|
65
|
+
graph.origin instanceof LegendSDLC
|
|
66
|
+
) {
|
|
67
|
+
return `Project dependency ${graph.origin.groupId}${GAV_DELIMITER}${graph.origin.artifactId} `;
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
};
|
|
71
|
+
|
|
49
72
|
export const V1_checkDuplicatedElement = (
|
|
50
73
|
path: string,
|
|
51
74
|
context: V1_GraphBuilderContext,
|
|
@@ -53,15 +76,29 @@ export const V1_checkDuplicatedElement = (
|
|
|
53
76
|
): void => {
|
|
54
77
|
if (cache) {
|
|
55
78
|
if (cache.has(path)) {
|
|
56
|
-
|
|
79
|
+
const element = context.graph.getNullableElement(path);
|
|
80
|
+
const _origin = getElementOrigin(
|
|
81
|
+
guaranteeNonNullable(element),
|
|
82
|
+
context.graph,
|
|
83
|
+
);
|
|
84
|
+
throw new AssertionError(
|
|
85
|
+
`${currentSubGraphOrigin(
|
|
86
|
+
context.currentSubGraph,
|
|
87
|
+
)}Element '${path}' already exists${_origin ? ` in ${_origin}` : ''}`,
|
|
88
|
+
);
|
|
57
89
|
} else {
|
|
58
90
|
cache.add(path);
|
|
59
91
|
}
|
|
60
92
|
} else {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
93
|
+
const element = context.graph.getNullableElement(path);
|
|
94
|
+
if (element) {
|
|
95
|
+
const _origin = getElementOrigin(element, context.graph);
|
|
96
|
+
throw new AssertionError(
|
|
97
|
+
`${currentSubGraphOrigin(
|
|
98
|
+
context.currentSubGraph,
|
|
99
|
+
)}Element '${path}' already exists${_origin ? ` in ${_origin}` : ''}`,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
65
102
|
}
|
|
66
103
|
};
|
|
67
104
|
|
package/tsconfig.json
CHANGED
|
@@ -388,6 +388,7 @@
|
|
|
388
388
|
"./src/graph-manager/protocol/pure/v1/engine/import/V1_PureModelContextGenerationInput.ts",
|
|
389
389
|
"./src/graph-manager/protocol/pure/v1/engine/query/V1_Query.ts",
|
|
390
390
|
"./src/graph-manager/protocol/pure/v1/engine/query/V1_QuerySearchSpecification.ts",
|
|
391
|
+
"./src/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.ts",
|
|
391
392
|
"./src/graph-manager/protocol/pure/v1/engine/service/V1_DEPRECATED__ServiceTestResult.ts",
|
|
392
393
|
"./src/graph-manager/protocol/pure/v1/engine/service/V1_ServiceConfiguration.ts",
|
|
393
394
|
"./src/graph-manager/protocol/pure/v1/engine/service/V1_ServiceRegistrationResult.ts",
|