@finos/legend-graph 1.3.0 → 2.0.0
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/GraphManagerState.d.ts +2 -2
- package/lib/GraphManagerState.js +4 -4
- package/lib/GraphManagerState.js.map +1 -1
- package/lib/graph/BasicModel.d.ts.map +1 -1
- package/lib/graph/BasicModel.js +1 -0
- package/lib/graph/BasicModel.js.map +1 -1
- package/lib/graph/DependencyManager.d.ts.map +1 -1
- package/lib/graph/DependencyManager.js +2 -0
- package/lib/graph/DependencyManager.js.map +1 -1
- package/lib/graph/PureModel.d.ts.map +1 -1
- package/lib/graph/PureModel.js +2 -0
- package/lib/graph/PureModel.js.map +1 -1
- package/lib/graphManager/AbstractPureGraphManager.d.ts +6 -6
- package/lib/graphManager/AbstractPureGraphManager.d.ts.map +1 -1
- package/lib/graphManager/GraphBuilderReport.d.ts +10 -0
- package/lib/graphManager/GraphBuilderReport.d.ts.map +1 -1
- package/lib/graphManager/GraphBuilderReport.js +6 -0
- package/lib/graphManager/GraphBuilderReport.js.map +1 -1
- package/lib/graphManager/{GraphManagerLogEvent.d.ts → GraphManagerEvent.d.ts} +12 -19
- package/lib/graphManager/GraphManagerEvent.d.ts.map +1 -0
- package/lib/graphManager/GraphManagerEvent.js +45 -0
- package/lib/graphManager/GraphManagerEvent.js.map +1 -0
- package/lib/graphManager/GraphManagerTelemetry.d.ts +28 -0
- package/lib/graphManager/GraphManagerTelemetry.d.ts.map +1 -0
- package/lib/graphManager/GraphManagerTelemetry.js +22 -0
- package/lib/graphManager/GraphManagerTelemetry.js.map +1 -0
- package/lib/index.d.ts +5 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/models/protocols/pure/v1/V1_PureGraphManager.d.ts +9 -7
- package/lib/models/protocols/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/V1_PureGraphManager.js +193 -195
- package/lib/models/protocols/pure/v1/V1_PureGraphManager.js.map +1 -1
- package/lib/models/protocols/pure/v1/engine/V1_Engine.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/engine/V1_Engine.js +2 -2
- package/lib/models/protocols/pure/v1/engine/V1_Engine.js.map +1 -1
- package/lib/models/protocols/pure/v1/engine/V1_EngineEvent.d.ts +21 -0
- package/lib/models/protocols/pure/v1/engine/V1_EngineEvent.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/engine/V1_EngineEvent.js +22 -0
- package/lib/models/protocols/pure/v1/engine/V1_EngineEvent.js.map +1 -0
- package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.d.ts +0 -5
- package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.js +0 -6
- package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/context/V1_PureModelContext.d.ts +0 -2
- package/lib/models/protocols/pure/v1/model/context/V1_PureModelContext.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/context/V1_PureModelContext.js +0 -2
- package/lib/models/protocols/pure/v1/model/context/V1_PureModelContext.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/valueSpecification/raw/V1_HackedUnit.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/valueSpecification/raw/V1_HackedUnit.js +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelClassMappingSecondPassBuilder.js +2 -2
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelClassMappingSecondPassBuilder.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.js +4 -4
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_SectionBuilderHelper.js +4 -4
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_SectionBuilderHelper.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ServiceBuilderHelper.js +2 -2
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ServiceBuilderHelper.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js +3 -7
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationPathResolver.js +2 -2
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationPathResolver.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +4 -4
- package/src/GraphManagerState.ts +4 -4
- package/src/graph/BasicModel.ts +2 -0
- package/src/graph/DependencyManager.ts +5 -0
- package/src/graph/PureModel.ts +8 -0
- package/src/graphManager/AbstractPureGraphManager.ts +6 -6
- package/src/graphManager/GraphBuilderReport.ts +15 -1
- package/src/graphManager/{GraphManagerLogEvent.ts → GraphManagerEvent.ts} +10 -20
- package/src/graphManager/GraphManagerTelemetry.ts +35 -0
- package/src/index.ts +5 -5
- package/src/models/protocols/pure/v1/V1_PureGraphManager.ts +296 -399
- package/src/models/protocols/pure/v1/engine/V1_Engine.ts +2 -2
- package/src/models/protocols/pure/v1/engine/V1_EngineEvent.ts +21 -0
- package/src/models/protocols/pure/v1/engine/V1_EngineServerClient.ts +0 -6
- package/src/models/protocols/pure/v1/model/context/V1_PureModelContext.ts +1 -5
- package/src/models/protocols/pure/v1/model/valueSpecification/raw/V1_HackedUnit.ts +1 -1
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelClassMappingSecondPassBuilder.ts +2 -2
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.ts +4 -4
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_SectionBuilderHelper.ts +4 -4
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ServiceBuilderHelper.ts +2 -2
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.ts +4 -9
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationPathResolver.ts +2 -2
- package/tsconfig.json +3 -1
- package/lib/graphManager/GraphManagerLogEvent.d.ts.map +0 -1
- package/lib/graphManager/GraphManagerLogEvent.js +0 -53
- package/lib/graphManager/GraphManagerLogEvent.js.map +0 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { flow, flowResult, makeObservable, runInAction } from 'mobx';
|
|
18
|
-
import {
|
|
18
|
+
import { GRAPH_MANAGER_EVENT } from '../../../../graphManager/GraphManagerEvent';
|
|
19
19
|
import {
|
|
20
20
|
CORE_PURE_PATH,
|
|
21
21
|
ELEMENT_PATH_DELIMITER,
|
|
@@ -37,6 +37,8 @@ import {
|
|
|
37
37
|
assertTrue,
|
|
38
38
|
assertErrorThrown,
|
|
39
39
|
promisify,
|
|
40
|
+
type ActionState,
|
|
41
|
+
StopWatch,
|
|
40
42
|
} from '@finos/legend-shared';
|
|
41
43
|
import type { TEMPORARY__AbstractEngineConfig } from '../../../../graphManager/action/TEMPORARY__AbstractEngineConfig';
|
|
42
44
|
import {
|
|
@@ -212,6 +214,7 @@ import type { QuerySearchSpecification } from '../../../../graphManager/action/q
|
|
|
212
214
|
import type { ExternalFormatDescription } from '../../../../graphManager/action/externalFormat/ExternalFormatDescription';
|
|
213
215
|
import type { ConfigurationProperty } from '../../../metamodels/pure/packageableElements/fileGeneration/ConfigurationProperty';
|
|
214
216
|
import { V1_ExternalFormatModelGenerationInput } from './engine/externalFormat/V1_ExternalFormatModelGeneration';
|
|
217
|
+
import { GraphBuilderReport } from '../../../../graphManager/GraphBuilderReport';
|
|
215
218
|
|
|
216
219
|
const V1_FUNCTION_SUFFIX_MULTIPLICITY_INFINITE = 'MANY';
|
|
217
220
|
|
|
@@ -271,7 +274,20 @@ class V1_PureModelContextDataIndex {
|
|
|
271
274
|
>();
|
|
272
275
|
}
|
|
273
276
|
|
|
277
|
+
const mergePureModelContextData = (
|
|
278
|
+
...data: V1_PureModelContextData[]
|
|
279
|
+
): V1_PureModelContextData => {
|
|
280
|
+
const mergedData = new V1_PureModelContextData();
|
|
281
|
+
for (const _data of data) {
|
|
282
|
+
mergedData.elements = mergedData.elements.concat(_data.elements);
|
|
283
|
+
mergedData.serializer = _data.serializer ?? mergedData.serializer;
|
|
284
|
+
mergedData.origin = _data.origin ?? mergedData.origin;
|
|
285
|
+
}
|
|
286
|
+
return mergedData;
|
|
287
|
+
};
|
|
288
|
+
|
|
274
289
|
const indexPureModelContextData = (
|
|
290
|
+
report: GraphBuilderReport,
|
|
275
291
|
data: V1_PureModelContextData,
|
|
276
292
|
extensions: V1_GraphBuilderExtensions,
|
|
277
293
|
): V1_PureModelContextDataIndex => {
|
|
@@ -331,6 +347,42 @@ const indexPureModelContextData = (
|
|
|
331
347
|
(index.otherElementsByBuilder.get(builder) ?? []).concat(elements),
|
|
332
348
|
);
|
|
333
349
|
});
|
|
350
|
+
|
|
351
|
+
// report
|
|
352
|
+
report.elementCount.total = report.elementCount.total + index.elements.length;
|
|
353
|
+
report.elementCount.other =
|
|
354
|
+
(report.elementCount.other ?? 0) +
|
|
355
|
+
otherElementsByClass.size +
|
|
356
|
+
index.fileGenerations.length +
|
|
357
|
+
index.generationSpecifications.length;
|
|
358
|
+
report.elementCount.sectionIndex =
|
|
359
|
+
(report.elementCount.sectionIndex ?? 0) + index.sectionIndices.length;
|
|
360
|
+
|
|
361
|
+
report.elementCount.association =
|
|
362
|
+
(report.elementCount.association ?? 0) + index.associations.length;
|
|
363
|
+
report.elementCount.class =
|
|
364
|
+
(report.elementCount.class ?? 0) + index.classes.length;
|
|
365
|
+
report.elementCount.enumeration =
|
|
366
|
+
(report.elementCount.enumeration ?? 0) + index.enumerations.length;
|
|
367
|
+
report.elementCount.function =
|
|
368
|
+
(report.elementCount.function ?? 0) + index.functions.length;
|
|
369
|
+
report.elementCount.profile =
|
|
370
|
+
(report.elementCount.profile ?? 0) + index.profiles.length;
|
|
371
|
+
report.elementCount.measure =
|
|
372
|
+
(report.elementCount.measure ?? 0) + index.measures.length;
|
|
373
|
+
|
|
374
|
+
report.elementCount.store =
|
|
375
|
+
(report.elementCount.store ?? 0) + index.stores.length;
|
|
376
|
+
report.elementCount.mapping =
|
|
377
|
+
(report.elementCount.mapping ?? 0) + index.mappings.length;
|
|
378
|
+
report.elementCount.connection =
|
|
379
|
+
(report.elementCount.connection ?? 0) + index.connections.length;
|
|
380
|
+
report.elementCount.runtime =
|
|
381
|
+
(report.elementCount.runtime ?? 0) + index.runtimes.length;
|
|
382
|
+
|
|
383
|
+
report.elementCount.service =
|
|
384
|
+
(report.elementCount.service ?? 0) + index.services.length;
|
|
385
|
+
|
|
334
386
|
return index;
|
|
335
387
|
};
|
|
336
388
|
|
|
@@ -358,22 +410,24 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
358
410
|
|
|
359
411
|
makeObservable<
|
|
360
412
|
V1_PureGraphManager,
|
|
413
|
+
| 'buildGraphFromInputs'
|
|
361
414
|
| 'initializeAndIndexElements'
|
|
362
415
|
| 'postProcess'
|
|
363
416
|
| 'buildTypes'
|
|
364
417
|
| 'buildStores'
|
|
365
418
|
| 'buildMappings'
|
|
366
419
|
| 'buildConnectionsAndRuntimes'
|
|
367
|
-
| '
|
|
420
|
+
| 'buildSectionIndices'
|
|
368
421
|
| 'buildOtherElements'
|
|
369
422
|
| 'buildServices'
|
|
370
423
|
| 'buildFileGenerations'
|
|
371
|
-
| '
|
|
424
|
+
| 'buildGenerationSpecifications'
|
|
372
425
|
>(this, {
|
|
373
426
|
initialize: flow,
|
|
374
427
|
buildSystem: flow,
|
|
375
428
|
buildDependencies: flow,
|
|
376
429
|
buildGraph: flow,
|
|
430
|
+
buildGraphFromInputs: flow,
|
|
377
431
|
buildGenerations: flow,
|
|
378
432
|
initializeAndIndexElements: flow,
|
|
379
433
|
postProcess: flow,
|
|
@@ -381,11 +435,11 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
381
435
|
buildStores: flow,
|
|
382
436
|
buildMappings: flow,
|
|
383
437
|
buildConnectionsAndRuntimes: flow,
|
|
384
|
-
|
|
438
|
+
buildSectionIndices: flow,
|
|
385
439
|
buildOtherElements: flow,
|
|
386
440
|
buildServices: flow,
|
|
387
441
|
buildFileGenerations: flow,
|
|
388
|
-
|
|
442
|
+
buildGenerationSpecifications: flow,
|
|
389
443
|
});
|
|
390
444
|
|
|
391
445
|
// setup plugins
|
|
@@ -433,8 +487,11 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
433
487
|
coreModel: CoreModel,
|
|
434
488
|
systemModel: SystemModel,
|
|
435
489
|
options?: GraphBuilderOptions,
|
|
436
|
-
): GeneratorFn<
|
|
437
|
-
const
|
|
490
|
+
): GeneratorFn<GraphBuilderReport> {
|
|
491
|
+
const stopWatch = new StopWatch();
|
|
492
|
+
const report = new GraphBuilderReport();
|
|
493
|
+
const graphBuilderState = systemModel.buildState;
|
|
494
|
+
graphBuilderState.reset();
|
|
438
495
|
|
|
439
496
|
// Create a dummy graph for system processing. This is to ensure system model does not depend on the main graph
|
|
440
497
|
const graph = new PureModel(
|
|
@@ -442,63 +499,56 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
442
499
|
systemModel,
|
|
443
500
|
this.pluginManager.getPureGraphPlugins(),
|
|
444
501
|
);
|
|
502
|
+
|
|
445
503
|
try {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
this.pluginManager
|
|
457
|
-
.getPureProtocolProcessorPlugins()
|
|
458
|
-
.flatMap((plugin) => plugin.V1_getExtraSystemModels?.() ?? [])
|
|
459
|
-
.flatMap(
|
|
460
|
-
(modelContextData) =>
|
|
461
|
-
V1_deserializePureModelContextData(modelContextData).elements,
|
|
462
|
-
),
|
|
463
|
-
)
|
|
464
|
-
.map((element) => this.elementProtocolToEntity(element)),
|
|
465
|
-
systemData,
|
|
466
|
-
this.pluginManager.getPureProtocolProcessorPlugins(),
|
|
504
|
+
// deserialize
|
|
505
|
+
graphBuilderState.setMessage(`Collecting and deserializing elements...`);
|
|
506
|
+
const systemData = mergePureModelContextData(
|
|
507
|
+
V1_deserializePureModelContextData(V1_CORE_SYSTEM_MODELS),
|
|
508
|
+
...this.pluginManager
|
|
509
|
+
.getPureProtocolProcessorPlugins()
|
|
510
|
+
.flatMap((plugin) => plugin.V1_getExtraSystemModels?.() ?? [])
|
|
511
|
+
.map((modelContextData) =>
|
|
512
|
+
V1_deserializePureModelContextData(modelContextData),
|
|
513
|
+
),
|
|
467
514
|
);
|
|
468
|
-
|
|
515
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_ELEMENTS_DESERIALIZED);
|
|
516
|
+
|
|
517
|
+
// prepare build inputs
|
|
518
|
+
const buildInputs = [
|
|
469
519
|
{
|
|
470
520
|
model: systemModel,
|
|
471
|
-
data: indexPureModelContextData(systemData, this.extensions),
|
|
521
|
+
data: indexPureModelContextData(report, systemData, this.extensions),
|
|
472
522
|
},
|
|
473
523
|
];
|
|
524
|
+
|
|
525
|
+
// build
|
|
474
526
|
yield flowResult(
|
|
475
|
-
this.
|
|
527
|
+
this.buildGraphFromInputs(
|
|
528
|
+
graph,
|
|
529
|
+
buildInputs,
|
|
530
|
+
report,
|
|
531
|
+
stopWatch,
|
|
532
|
+
graphBuilderState,
|
|
533
|
+
options,
|
|
534
|
+
),
|
|
476
535
|
);
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
Date.now() - startTime,
|
|
485
|
-
'ms',
|
|
486
|
-
`[class: ${systemModel.ownClasses.length}, profile: ${systemModel.ownProfiles.length}, enumeration: ${systemModel.ownEnumerations.length}]`,
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
systemModel.buildState.pass();
|
|
536
|
+
|
|
537
|
+
graphBuilderState.pass();
|
|
538
|
+
report.timings = {
|
|
539
|
+
...Object.fromEntries(stopWatch.records),
|
|
540
|
+
[GRAPH_MANAGER_EVENT.GRAPH_BUILDER_COMPLETED]: stopWatch.elapsed,
|
|
541
|
+
};
|
|
542
|
+
return report;
|
|
490
543
|
} catch (error) {
|
|
491
544
|
assertErrorThrown(error);
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
'[ERROR]',
|
|
497
|
-
Date.now() - startTime,
|
|
498
|
-
'ms',
|
|
499
|
-
);
|
|
500
|
-
}
|
|
545
|
+
graphBuilderState.fail();
|
|
546
|
+
this.log.error(
|
|
547
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_FAILURE),
|
|
548
|
+
);
|
|
501
549
|
throw new SystemGraphBuilderError(error);
|
|
550
|
+
} finally {
|
|
551
|
+
graphBuilderState.setMessage(undefined);
|
|
502
552
|
}
|
|
503
553
|
}
|
|
504
554
|
|
|
@@ -508,21 +558,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
508
558
|
dependencyManager: DependencyManager,
|
|
509
559
|
dependencyEntitiesMap: Map<string, Entity[]>,
|
|
510
560
|
options?: GraphBuilderOptions,
|
|
511
|
-
): GeneratorFn<
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
),
|
|
518
|
-
Date.now() - startTime,
|
|
519
|
-
'ms',
|
|
520
|
-
`[projects: ${dependencyEntitiesMap.size}, entities: ${
|
|
521
|
-
Array.from(dependencyEntitiesMap.values()).flat().length
|
|
522
|
-
}]`,
|
|
523
|
-
);
|
|
524
|
-
}
|
|
525
|
-
dependencyManager.buildState.reset();
|
|
561
|
+
): GeneratorFn<GraphBuilderReport> {
|
|
562
|
+
const stopWatch = new StopWatch();
|
|
563
|
+
const report = new GraphBuilderReport();
|
|
564
|
+
const graphBuilderState = dependencyManager.buildState;
|
|
565
|
+
graphBuilderState.reset();
|
|
566
|
+
|
|
526
567
|
// Create a dummy graph for system processing. This is to ensure dependency models do not depend on the main graph
|
|
527
568
|
const graph = new PureModel(
|
|
528
569
|
coreModel,
|
|
@@ -530,9 +571,14 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
530
571
|
this.pluginManager.getPureGraphPlugins(),
|
|
531
572
|
);
|
|
532
573
|
graph.setDependencyManager(dependencyManager);
|
|
574
|
+
|
|
533
575
|
try {
|
|
534
576
|
dependencyManager.initialize(dependencyEntitiesMap);
|
|
535
|
-
|
|
577
|
+
|
|
578
|
+
// deserialize
|
|
579
|
+
graphBuilderState.setMessage(
|
|
580
|
+
`Partitioning and deserializing elements...`,
|
|
581
|
+
);
|
|
536
582
|
const dependencyDataMap = new Map<string, V1_PureModelContextData>();
|
|
537
583
|
yield Promise.all(
|
|
538
584
|
Array.from(dependencyEntitiesMap.entries()).map(
|
|
@@ -547,84 +593,48 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
547
593
|
},
|
|
548
594
|
),
|
|
549
595
|
);
|
|
550
|
-
|
|
551
|
-
if (!options?.quiet) {
|
|
552
|
-
this.log.info(
|
|
553
|
-
LogEvent.create(
|
|
554
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_DEPENDENCIES_PREPROCESSED,
|
|
555
|
-
),
|
|
556
|
-
preprocessingFinishedTime - startTime,
|
|
557
|
-
'ms',
|
|
558
|
-
);
|
|
559
|
-
}
|
|
596
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_ELEMENTS_DESERIALIZED);
|
|
560
597
|
|
|
561
|
-
|
|
598
|
+
// prepare build inputs
|
|
599
|
+
const buildInputs: V1_GraphBuilderInput[] = Array.from(
|
|
562
600
|
dependencyDataMap.entries(),
|
|
563
601
|
).map(([dependencyKey, dependencyData]) => ({
|
|
564
|
-
data: indexPureModelContextData(
|
|
602
|
+
data: indexPureModelContextData(
|
|
603
|
+
report,
|
|
604
|
+
dependencyData,
|
|
605
|
+
this.extensions,
|
|
606
|
+
),
|
|
565
607
|
model: graph.dependencyManager.getModel(dependencyKey),
|
|
566
608
|
}));
|
|
609
|
+
|
|
610
|
+
// build
|
|
567
611
|
yield flowResult(
|
|
568
|
-
this.
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
);
|
|
577
|
-
yield flowResult(this.buildServices(graph, graphBuilderInput, options));
|
|
578
|
-
yield flowResult(
|
|
579
|
-
this.buildFileGenerations(graph, graphBuilderInput, options),
|
|
580
|
-
);
|
|
581
|
-
yield flowResult(
|
|
582
|
-
this.buildGenerationSpecificationss(graph, graphBuilderInput, options),
|
|
583
|
-
);
|
|
584
|
-
yield flowResult(
|
|
585
|
-
this.buildOtherElements(graph, graphBuilderInput, options),
|
|
612
|
+
this.buildGraphFromInputs(
|
|
613
|
+
graph,
|
|
614
|
+
buildInputs,
|
|
615
|
+
report,
|
|
616
|
+
stopWatch,
|
|
617
|
+
graphBuilderState,
|
|
618
|
+
options,
|
|
619
|
+
),
|
|
586
620
|
);
|
|
587
621
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
processingFinishedTime - preprocessingFinishedTime,
|
|
596
|
-
'ms',
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
dependencyManager.buildState.pass();
|
|
601
|
-
if (!options?.quiet) {
|
|
602
|
-
this.log.info(
|
|
603
|
-
LogEvent.create(
|
|
604
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_DEPENDENCIES_BUILT,
|
|
605
|
-
),
|
|
606
|
-
'[TOTAL]',
|
|
607
|
-
Date.now() - startTime,
|
|
608
|
-
'ms',
|
|
609
|
-
);
|
|
610
|
-
}
|
|
622
|
+
graphBuilderState.pass();
|
|
623
|
+
report.otherStats.projectCount = dependencyEntitiesMap.size;
|
|
624
|
+
report.timings = {
|
|
625
|
+
...Object.fromEntries(stopWatch.records),
|
|
626
|
+
[GRAPH_MANAGER_EVENT.GRAPH_BUILDER_COMPLETED]: stopWatch.elapsed,
|
|
627
|
+
};
|
|
628
|
+
return report;
|
|
611
629
|
} catch (error) {
|
|
612
630
|
assertErrorThrown(error);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
Date.now() - startTime,
|
|
618
|
-
'ms',
|
|
619
|
-
`[elements: ${
|
|
620
|
-
Array.from(dependencyManager.projectDependencyModelsIndex.values())
|
|
621
|
-
.map((v) => v.allOwnElements)
|
|
622
|
-
.flat().length
|
|
623
|
-
}]`,
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
dependencyManager.buildState.fail();
|
|
631
|
+
this.log.error(
|
|
632
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_FAILURE),
|
|
633
|
+
);
|
|
634
|
+
graphBuilderState.fail();
|
|
627
635
|
throw new DependencyGraphBuilderError(error);
|
|
636
|
+
} finally {
|
|
637
|
+
graphBuilderState.setMessage(undefined);
|
|
628
638
|
}
|
|
629
639
|
}
|
|
630
640
|
|
|
@@ -632,221 +642,55 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
632
642
|
graph: PureModel,
|
|
633
643
|
entities: Entity[],
|
|
634
644
|
options?: GraphBuilderOptions,
|
|
635
|
-
): GeneratorFn<
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
const
|
|
645
|
+
): GeneratorFn<GraphBuilderReport> {
|
|
646
|
+
const stopWatch = new StopWatch();
|
|
647
|
+
const report = new GraphBuilderReport();
|
|
648
|
+
const graphBuilderState = graph.buildState;
|
|
649
|
+
graphBuilderState.reset();
|
|
650
|
+
|
|
639
651
|
try {
|
|
640
|
-
//
|
|
652
|
+
// deserialize
|
|
653
|
+
graphBuilderState.setMessage(`Deserializing elements...`);
|
|
641
654
|
const data = new V1_PureModelContextData();
|
|
642
655
|
yield V1_entitiesToPureModelContextData(
|
|
643
656
|
entities,
|
|
644
657
|
data,
|
|
645
658
|
this.pluginManager.getPureProtocolProcessorPlugins(),
|
|
646
659
|
);
|
|
660
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_ELEMENTS_DESERIALIZED);
|
|
647
661
|
|
|
648
|
-
|
|
662
|
+
// prepare build inputs
|
|
663
|
+
const buildInputs: V1_GraphBuilderInput[] = [
|
|
649
664
|
{
|
|
650
665
|
model: graph,
|
|
651
|
-
data: indexPureModelContextData(data, this.extensions),
|
|
666
|
+
data: indexPureModelContextData(report, data, this.extensions),
|
|
652
667
|
},
|
|
653
668
|
];
|
|
654
|
-
stepFinishedTime = Date.now();
|
|
655
|
-
if (!options?.quiet) {
|
|
656
|
-
this.log.info(
|
|
657
|
-
LogEvent.create(
|
|
658
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_DATA_MODEL_PARSED,
|
|
659
|
-
),
|
|
660
|
-
stepFinishedTime - stepStartTime,
|
|
661
|
-
'ms',
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
stepStartTime = stepFinishedTime;
|
|
665
|
-
|
|
666
|
-
yield flowResult(
|
|
667
|
-
this.initializeAndIndexElements(graph, graphBuilderInput, options),
|
|
668
|
-
);
|
|
669
|
-
stepFinishedTime = Date.now();
|
|
670
|
-
if (!options?.quiet) {
|
|
671
|
-
this.log.info(
|
|
672
|
-
LogEvent.create(
|
|
673
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_ELEMENTS_INITIALIZED_AND_INDEXED,
|
|
674
|
-
),
|
|
675
|
-
stepFinishedTime - stepStartTime,
|
|
676
|
-
'ms',
|
|
677
|
-
`[element: ${data.elements.length}]`,
|
|
678
|
-
);
|
|
679
|
-
}
|
|
680
|
-
stepStartTime = stepFinishedTime;
|
|
681
|
-
|
|
682
|
-
// Section index
|
|
683
|
-
yield flowResult(
|
|
684
|
-
this.buildSectionIndex(graph, graphBuilderInput, options),
|
|
685
|
-
);
|
|
686
|
-
stepFinishedTime = Date.now();
|
|
687
|
-
if (!options?.quiet) {
|
|
688
|
-
this.log.info(
|
|
689
|
-
LogEvent.create(
|
|
690
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_SECTION_INDICES_BUILT,
|
|
691
|
-
),
|
|
692
|
-
stepFinishedTime - stepStartTime,
|
|
693
|
-
'ms',
|
|
694
|
-
`[sectionIndex: ${graph.ownSectionIndices.length}]`,
|
|
695
|
-
);
|
|
696
|
-
}
|
|
697
|
-
stepStartTime = stepFinishedTime;
|
|
698
|
-
// Types
|
|
699
|
-
yield flowResult(this.buildTypes(graph, graphBuilderInput, options));
|
|
700
|
-
stepFinishedTime = Date.now();
|
|
701
|
-
if (!options?.quiet) {
|
|
702
|
-
this.log.info(
|
|
703
|
-
LogEvent.create(
|
|
704
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_DOMAIN_MODELS_BUILT,
|
|
705
|
-
),
|
|
706
|
-
stepFinishedTime - stepStartTime,
|
|
707
|
-
'ms',
|
|
708
|
-
`[class: ${graph.ownClasses.length}, enumeration: ${graph.ownEnumerations.length}, association: ${graph.ownAssociations.length}, profile: ${graph.ownProfiles.length}, functions: ${graph.ownFunctions.length}]`,
|
|
709
|
-
);
|
|
710
|
-
}
|
|
711
|
-
stepStartTime = stepFinishedTime;
|
|
712
|
-
|
|
713
|
-
// Stores
|
|
714
|
-
yield flowResult(this.buildStores(graph, graphBuilderInput, options));
|
|
715
|
-
stepFinishedTime = Date.now();
|
|
716
|
-
// TODO: we might want to detail out the number of stores by type
|
|
717
|
-
if (!options?.quiet) {
|
|
718
|
-
this.log.info(
|
|
719
|
-
LogEvent.create(GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_STORES_BUILT),
|
|
720
|
-
stepFinishedTime - stepStartTime,
|
|
721
|
-
'ms',
|
|
722
|
-
`[store: ${graph.ownStores.length}]`,
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
stepStartTime = stepFinishedTime;
|
|
726
|
-
|
|
727
|
-
// Mappings
|
|
728
|
-
yield flowResult(this.buildMappings(graph, graphBuilderInput, options));
|
|
729
|
-
stepFinishedTime = Date.now();
|
|
730
|
-
if (!options?.quiet) {
|
|
731
|
-
this.log.info(
|
|
732
|
-
LogEvent.create(GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_MAPPINGS_BUILT),
|
|
733
|
-
stepFinishedTime - stepStartTime,
|
|
734
|
-
'ms',
|
|
735
|
-
`[mapping: ${graph.ownMappings.length}]`,
|
|
736
|
-
);
|
|
737
|
-
}
|
|
738
|
-
stepStartTime = stepFinishedTime;
|
|
739
|
-
|
|
740
|
-
// Connections and runtimes
|
|
741
|
-
yield flowResult(
|
|
742
|
-
this.buildConnectionsAndRuntimes(graph, graphBuilderInput, options),
|
|
743
|
-
);
|
|
744
|
-
stepFinishedTime = Date.now();
|
|
745
|
-
if (!options?.quiet) {
|
|
746
|
-
this.log.info(
|
|
747
|
-
LogEvent.create(
|
|
748
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_CONNECTIONS_BUILT,
|
|
749
|
-
),
|
|
750
|
-
stepFinishedTime - stepStartTime,
|
|
751
|
-
'ms',
|
|
752
|
-
`[connection: ${graph.ownConnections.length}]`,
|
|
753
|
-
);
|
|
754
|
-
this.log.info(
|
|
755
|
-
LogEvent.create(GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_RUNTIMES_BUILT),
|
|
756
|
-
stepFinishedTime - stepStartTime,
|
|
757
|
-
'ms',
|
|
758
|
-
`[runtime: ${graph.ownRuntimes.length}]`,
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
stepStartTime = stepFinishedTime;
|
|
762
|
-
|
|
763
|
-
// Services
|
|
764
|
-
yield flowResult(this.buildServices(graph, graphBuilderInput, options));
|
|
765
|
-
stepFinishedTime = Date.now();
|
|
766
|
-
if (!options?.quiet) {
|
|
767
|
-
this.log.info(
|
|
768
|
-
LogEvent.create(GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_SERVICES_BUILT),
|
|
769
|
-
stepFinishedTime - stepStartTime,
|
|
770
|
-
'ms',
|
|
771
|
-
`[service: ${graph.ownServices.length}]`,
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
stepStartTime = stepFinishedTime;
|
|
775
|
-
|
|
776
|
-
// File Generation
|
|
777
|
-
yield flowResult(
|
|
778
|
-
this.buildFileGenerations(graph, graphBuilderInput, options),
|
|
779
|
-
);
|
|
780
|
-
stepFinishedTime = Date.now();
|
|
781
|
-
if (!options?.quiet) {
|
|
782
|
-
this.log.info(
|
|
783
|
-
LogEvent.create(
|
|
784
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_FILE_GENERATIONS_BUILT,
|
|
785
|
-
),
|
|
786
|
-
stepFinishedTime - stepStartTime,
|
|
787
|
-
'ms',
|
|
788
|
-
`[file-generation: ${graph.ownFileGenerations.length}]`,
|
|
789
|
-
);
|
|
790
|
-
}
|
|
791
|
-
stepStartTime = stepFinishedTime;
|
|
792
669
|
|
|
793
|
-
//
|
|
670
|
+
// build
|
|
794
671
|
yield flowResult(
|
|
795
|
-
this.
|
|
672
|
+
this.buildGraphFromInputs(
|
|
673
|
+
graph,
|
|
674
|
+
buildInputs,
|
|
675
|
+
report,
|
|
676
|
+
stopWatch,
|
|
677
|
+
graphBuilderState,
|
|
678
|
+
options,
|
|
679
|
+
),
|
|
796
680
|
);
|
|
797
|
-
stepFinishedTime = Date.now();
|
|
798
|
-
if (!options?.quiet) {
|
|
799
|
-
this.log.info(
|
|
800
|
-
LogEvent.create(
|
|
801
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_GENERATION_TREE_BUILT,
|
|
802
|
-
),
|
|
803
|
-
stepFinishedTime - stepStartTime,
|
|
804
|
-
'ms',
|
|
805
|
-
`[generation-specification: ${graph.ownGenerationSpecifications.length}]`,
|
|
806
|
-
);
|
|
807
|
-
}
|
|
808
|
-
stepStartTime = stepFinishedTime;
|
|
809
681
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
this.log.info(
|
|
817
|
-
LogEvent.create(
|
|
818
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_OTHER_ELEMENTS_BUILT,
|
|
819
|
-
),
|
|
820
|
-
stepFinishedTime - stepStartTime,
|
|
821
|
-
'ms',
|
|
822
|
-
);
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
yield flowResult(
|
|
826
|
-
this.postProcess(graph, graphBuilderInput, {
|
|
827
|
-
TEMPORARY__keepSectionIndex: options?.TEMPORARY__keepSectionIndex,
|
|
828
|
-
}),
|
|
829
|
-
);
|
|
830
|
-
graph.buildState.pass();
|
|
831
|
-
if (!options?.quiet) {
|
|
832
|
-
this.log.info(
|
|
833
|
-
LogEvent.create(GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_COMPLETED),
|
|
834
|
-
'[TOTAL]',
|
|
835
|
-
Date.now() - startTime,
|
|
836
|
-
'ms',
|
|
837
|
-
);
|
|
838
|
-
}
|
|
682
|
+
graphBuilderState.pass();
|
|
683
|
+
report.timings = {
|
|
684
|
+
...Object.fromEntries(stopWatch.records),
|
|
685
|
+
[GRAPH_MANAGER_EVENT.GRAPH_BUILDER_COMPLETED]: stopWatch.elapsed,
|
|
686
|
+
};
|
|
687
|
+
return report;
|
|
839
688
|
} catch (error) {
|
|
840
689
|
assertErrorThrown(error);
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
Date.now() - startTime,
|
|
846
|
-
'ms',
|
|
847
|
-
);
|
|
848
|
-
}
|
|
849
|
-
graph.buildState.fail();
|
|
690
|
+
this.log.error(
|
|
691
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_FAILURE),
|
|
692
|
+
);
|
|
693
|
+
graphBuilderState.fail();
|
|
850
694
|
/**
|
|
851
695
|
* Wrap all error with `GraphBuilderError`, as we throw a lot of assertion error in the graph builder
|
|
852
696
|
* But we might want to rethink this decision in the future and throw appropriate type of error
|
|
@@ -854,6 +698,8 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
854
698
|
throw error instanceof GraphBuilderError
|
|
855
699
|
? error
|
|
856
700
|
: new GraphBuilderError(error);
|
|
701
|
+
} finally {
|
|
702
|
+
graphBuilderState.setMessage(undefined);
|
|
857
703
|
}
|
|
858
704
|
}
|
|
859
705
|
|
|
@@ -861,18 +707,16 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
861
707
|
graph: PureModel,
|
|
862
708
|
generatedEntities: Map<string, Entity[]>,
|
|
863
709
|
options?: GraphBuilderOptions,
|
|
864
|
-
): GeneratorFn<
|
|
865
|
-
const
|
|
710
|
+
): GeneratorFn<GraphBuilderReport> {
|
|
711
|
+
const stopWatch = new StopWatch();
|
|
712
|
+
const report = new GraphBuilderReport();
|
|
866
713
|
const generatedModel = graph.generationModel;
|
|
867
|
-
generatedModel.buildState
|
|
714
|
+
const graphBuilderState = generatedModel.buildState;
|
|
715
|
+
graphBuilderState.reset();
|
|
716
|
+
|
|
868
717
|
try {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
LogEvent.create(
|
|
872
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_BUILDER_DATA_MODEL_PARSED,
|
|
873
|
-
),
|
|
874
|
-
);
|
|
875
|
-
}
|
|
718
|
+
// deserialize
|
|
719
|
+
graphBuilderState.setMessage(`Deserializing elements...`);
|
|
876
720
|
const generatedDataMap = new Map<string, V1_PureModelContextData>();
|
|
877
721
|
yield Promise.all(
|
|
878
722
|
Array.from(generatedEntities.entries()).map(
|
|
@@ -887,57 +731,46 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
887
731
|
},
|
|
888
732
|
),
|
|
889
733
|
);
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
734
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_ELEMENTS_DESERIALIZED);
|
|
735
|
+
|
|
736
|
+
// prepare build inputs
|
|
737
|
+
const buildInputs = Array.from(generatedDataMap.entries()).map(
|
|
738
|
+
([generationParentPath, generatedData]) => ({
|
|
739
|
+
parentElementPath: generationParentPath,
|
|
740
|
+
data: indexPureModelContextData(
|
|
741
|
+
report,
|
|
742
|
+
generatedData,
|
|
743
|
+
this.extensions,
|
|
744
|
+
),
|
|
745
|
+
model: generatedModel,
|
|
746
|
+
}),
|
|
900
747
|
);
|
|
901
748
|
|
|
902
|
-
|
|
903
|
-
yield flowResult(this.buildStores(graph, generationGraphBuilderInput));
|
|
904
|
-
yield flowResult(this.buildMappings(graph, generationGraphBuilderInput));
|
|
749
|
+
// build
|
|
905
750
|
yield flowResult(
|
|
906
|
-
this.
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
);
|
|
915
|
-
yield flowResult(
|
|
916
|
-
this.buildOtherElements(graph, generationGraphBuilderInput),
|
|
751
|
+
this.buildGraphFromInputs(
|
|
752
|
+
graph,
|
|
753
|
+
buildInputs,
|
|
754
|
+
report,
|
|
755
|
+
stopWatch,
|
|
756
|
+
graphBuilderState,
|
|
757
|
+
options,
|
|
758
|
+
),
|
|
917
759
|
);
|
|
918
760
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
Date.now() - stepStartTime,
|
|
927
|
-
`${graph.generationModel.allOwnElements.length} generated elements processed`,
|
|
928
|
-
'ms',
|
|
929
|
-
);
|
|
930
|
-
}
|
|
761
|
+
graphBuilderState.pass();
|
|
762
|
+
report.otherStats.generationCount = generatedDataMap.size;
|
|
763
|
+
report.timings = {
|
|
764
|
+
...Object.fromEntries(stopWatch.records),
|
|
765
|
+
[GRAPH_MANAGER_EVENT.GRAPH_BUILDER_COMPLETED]: stopWatch.elapsed,
|
|
766
|
+
};
|
|
767
|
+
return report;
|
|
931
768
|
} catch (error) {
|
|
932
769
|
assertErrorThrown(error);
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
'ms',
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
generatedModel.buildState.fail();
|
|
770
|
+
this.log.error(
|
|
771
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_FAILURE),
|
|
772
|
+
);
|
|
773
|
+
graphBuilderState.fail();
|
|
941
774
|
/**
|
|
942
775
|
* Wrap all error with `GraphBuilderError`, as we throw a lot of assertion error in the graph builder
|
|
943
776
|
* But we might want to rethink this decision in the future and throw appropriate type of error
|
|
@@ -945,9 +778,77 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
945
778
|
throw error instanceof GraphBuilderError
|
|
946
779
|
? error
|
|
947
780
|
: new GraphBuilderError(error);
|
|
781
|
+
} finally {
|
|
782
|
+
graphBuilderState.setMessage(undefined);
|
|
948
783
|
}
|
|
949
784
|
}
|
|
950
785
|
|
|
786
|
+
private *buildGraphFromInputs(
|
|
787
|
+
graph: PureModel,
|
|
788
|
+
inputs: V1_GraphBuilderInput[],
|
|
789
|
+
report: GraphBuilderReport,
|
|
790
|
+
stopWatch: StopWatch,
|
|
791
|
+
graphBuilderState: ActionState,
|
|
792
|
+
options?: GraphBuilderOptions,
|
|
793
|
+
): GeneratorFn<void> {
|
|
794
|
+
// index
|
|
795
|
+
graphBuilderState.setMessage(
|
|
796
|
+
`Indexing ${report.elementCount.total} elements...`,
|
|
797
|
+
);
|
|
798
|
+
yield flowResult(this.initializeAndIndexElements(graph, inputs, options));
|
|
799
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_ELEMENTS_INDEXED);
|
|
800
|
+
|
|
801
|
+
// build section index
|
|
802
|
+
graphBuilderState.setMessage(`Building section indices...`);
|
|
803
|
+
yield flowResult(this.buildSectionIndices(graph, inputs, options));
|
|
804
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_SECTION_INDICES_BUILT);
|
|
805
|
+
|
|
806
|
+
// build types
|
|
807
|
+
graphBuilderState.setMessage(`Building domain models...`);
|
|
808
|
+
yield flowResult(this.buildTypes(graph, inputs, options));
|
|
809
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_DOMAIN_MODELS_BUILT);
|
|
810
|
+
|
|
811
|
+
// build stores
|
|
812
|
+
graphBuilderState.setMessage(`Building stores...`);
|
|
813
|
+
yield flowResult(this.buildStores(graph, inputs, options));
|
|
814
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_STORES_BUILT);
|
|
815
|
+
|
|
816
|
+
// build mappings
|
|
817
|
+
graphBuilderState.setMessage(`Building mappings...`);
|
|
818
|
+
yield flowResult(this.buildMappings(graph, inputs, options));
|
|
819
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_MAPPINGS_BUILT);
|
|
820
|
+
|
|
821
|
+
// build connections and runtimes
|
|
822
|
+
graphBuilderState.setMessage(`Building connections and runtimes...`);
|
|
823
|
+
yield flowResult(this.buildConnectionsAndRuntimes(graph, inputs, options));
|
|
824
|
+
stopWatch.record(
|
|
825
|
+
GRAPH_MANAGER_EVENT.GRAPH_BUILDER_CONNECTIONS_AND_RUNTIMES_BUILT,
|
|
826
|
+
);
|
|
827
|
+
|
|
828
|
+
// build services
|
|
829
|
+
graphBuilderState.setMessage(`Building services...`);
|
|
830
|
+
yield flowResult(this.buildServices(graph, inputs, options));
|
|
831
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_SERVICES_BUILT);
|
|
832
|
+
|
|
833
|
+
// build other elements
|
|
834
|
+
graphBuilderState.setMessage(`Building other elements...`);
|
|
835
|
+
yield flowResult(this.buildFileGenerations(graph, inputs, options));
|
|
836
|
+
yield flowResult(
|
|
837
|
+
this.buildGenerationSpecifications(graph, inputs, options),
|
|
838
|
+
);
|
|
839
|
+
yield flowResult(this.buildOtherElements(graph, inputs, options));
|
|
840
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_OTHER_ELEMENTS_BUILT);
|
|
841
|
+
|
|
842
|
+
// post-process
|
|
843
|
+
graphBuilderState.setMessage(`Post-processing graph...`);
|
|
844
|
+
yield flowResult(
|
|
845
|
+
this.postProcess(graph, inputs, {
|
|
846
|
+
TEMPORARY__keepSectionIndex: options?.TEMPORARY__keepSectionIndex,
|
|
847
|
+
}),
|
|
848
|
+
);
|
|
849
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_POST_PROCESSED);
|
|
850
|
+
}
|
|
851
|
+
|
|
951
852
|
private getBuilderContext(
|
|
952
853
|
graph: PureModel,
|
|
953
854
|
currentSubGraph: BasicModel,
|
|
@@ -1332,7 +1233,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1332
1233
|
);
|
|
1333
1234
|
}
|
|
1334
1235
|
|
|
1335
|
-
private *
|
|
1236
|
+
private *buildGenerationSpecifications(
|
|
1336
1237
|
graph: PureModel,
|
|
1337
1238
|
inputs: V1_GraphBuilderInput[],
|
|
1338
1239
|
options?: GraphBuilderOptions,
|
|
@@ -1351,7 +1252,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1351
1252
|
);
|
|
1352
1253
|
}
|
|
1353
1254
|
|
|
1354
|
-
private *
|
|
1255
|
+
private *buildSectionIndices(
|
|
1355
1256
|
graph: PureModel,
|
|
1356
1257
|
inputs: V1_GraphBuilderInput[],
|
|
1357
1258
|
options?: GraphBuilderOptions,
|
|
@@ -1479,9 +1380,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1479
1380
|
graphData,
|
|
1480
1381
|
);
|
|
1481
1382
|
this.log.info(
|
|
1482
|
-
LogEvent.create(
|
|
1483
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_MODEL_TO_GRAMMAR_TRANSFORMED,
|
|
1484
|
-
),
|
|
1383
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_MODEL_TO_GRAMMAR_TRANSFORMED),
|
|
1485
1384
|
Date.now() - startTime,
|
|
1486
1385
|
'ms',
|
|
1487
1386
|
);
|
|
@@ -1494,9 +1393,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1494
1393
|
await this.entitiesToPureModelContextData(entities),
|
|
1495
1394
|
);
|
|
1496
1395
|
this.log.info(
|
|
1497
|
-
LogEvent.create(
|
|
1498
|
-
GRAPH_MANAGER_LOG_EVENT.GRAPH_MODEL_TO_GRAMMAR_TRANSFORMED,
|
|
1499
|
-
),
|
|
1396
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_MODEL_TO_GRAMMAR_TRANSFORMED),
|
|
1500
1397
|
Date.now() - startTime,
|
|
1501
1398
|
'ms',
|
|
1502
1399
|
);
|
|
@@ -1816,7 +1713,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1816
1713
|
);
|
|
1817
1714
|
}
|
|
1818
1715
|
|
|
1819
|
-
|
|
1716
|
+
pureProtocolTextToEntities = (protocol: string): Entity[] => {
|
|
1820
1717
|
const graphData = V1_deserializePureModelContextData(JSON.parse(protocol));
|
|
1821
1718
|
return this.pureModelContextDataToEntities(graphData);
|
|
1822
1719
|
};
|
|
@@ -2374,7 +2271,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
2374
2271
|
);
|
|
2375
2272
|
this.log.info(
|
|
2376
2273
|
LogEvent.create(
|
|
2377
|
-
|
|
2274
|
+
GRAPH_MANAGER_EVENT.GRAPH_META_MODEL_TO_PROTOCOL_TRANSFORMED,
|
|
2378
2275
|
),
|
|
2379
2276
|
Date.now() - startTime,
|
|
2380
2277
|
'ms',
|
|
@@ -2394,7 +2291,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
2394
2291
|
...generatedModel.allOwnElements,
|
|
2395
2292
|
].map((element) => this.elementToProtocol(element));
|
|
2396
2293
|
this.log.info(
|
|
2397
|
-
LogEvent.create(
|
|
2294
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_COMPILE_CONTEXT_COLLECTED),
|
|
2398
2295
|
Date.now() - startTime,
|
|
2399
2296
|
'ms',
|
|
2400
2297
|
);
|
|
@@ -2522,7 +2419,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
2522
2419
|
} catch (error) {
|
|
2523
2420
|
assertErrorThrown(error);
|
|
2524
2421
|
this.log.warn(
|
|
2525
|
-
LogEvent.create(
|
|
2422
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_MANAGER_FAILURE),
|
|
2526
2423
|
`Can't extract assertion result`,
|
|
2527
2424
|
);
|
|
2528
2425
|
json = undefined;
|