@finos/legend-graph 32.3.35 → 32.3.37
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/helpers/DomainHelper.d.ts +3 -0
- package/lib/graph/helpers/DomainHelper.d.ts.map +1 -1
- package/lib/graph/helpers/DomainHelper.js +3 -0
- package/lib/graph/helpers/DomainHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +11 -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 +76 -43
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.d.ts +15 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js +14 -10
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.d.ts +2 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js +20 -5
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +3 -3
- package/src/graph/helpers/DomainHelper.ts +7 -0
- package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +283 -413
- package/src/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.ts +16 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.ts +21 -23
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.ts +36 -5
- package/src/index.ts +8 -2
|
@@ -378,6 +378,12 @@ import {
|
|
|
378
378
|
} from './engine/dev-metadata/V1_DevMetadataPushRequest.js';
|
|
379
379
|
import type { MetadataRequestOptions } from '../../../action/dev-metadata/MetadataRequestOptions.js';
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Number of elements to process synchronously before yielding to the event loop.
|
|
383
|
+
* This avoids per-element setTimeout overhead while keeping the UI responsive.
|
|
384
|
+
*/
|
|
385
|
+
const GRAPH_BUILDER_BATCH_SIZE = 100;
|
|
386
|
+
|
|
381
387
|
class V1_PureModelContextDataIndex {
|
|
382
388
|
elements: V1_PackageableElement[] = [];
|
|
383
389
|
nativeElements: V1_PackageableElement[] = [];
|
|
@@ -1272,46 +1278,37 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1272
1278
|
graph.allElements.map((el) => el.path),
|
|
1273
1279
|
);
|
|
1274
1280
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1285
|
-
packageCache,
|
|
1286
|
-
elementPathCache,
|
|
1287
|
-
),
|
|
1288
|
-
);
|
|
1289
|
-
}),
|
|
1281
|
+
for (const input of inputs) {
|
|
1282
|
+
const packageCache = new Map<string, Package>();
|
|
1283
|
+
const createFirstPassBuilder = (
|
|
1284
|
+
element: V1_PackageableElement,
|
|
1285
|
+
): V1_ElementFirstPassBuilder =>
|
|
1286
|
+
new V1_ElementFirstPassBuilder(
|
|
1287
|
+
this.getBuilderContext(graph, input.model, element, options),
|
|
1288
|
+
packageCache,
|
|
1289
|
+
elementPathCache,
|
|
1290
1290
|
);
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
),
|
|
1305
|
-
packageCache,
|
|
1306
|
-
elementPathCache,
|
|
1307
|
-
),
|
|
1308
|
-
);
|
|
1309
|
-
},
|
|
1310
|
-
),
|
|
1311
|
-
),
|
|
1291
|
+
|
|
1292
|
+
// index native elements
|
|
1293
|
+
await this.runBatchedLoop(input.data.nativeElements, (element) =>
|
|
1294
|
+
this.visitWithGraphBuilderErrorHandling(
|
|
1295
|
+
element,
|
|
1296
|
+
createFirstPassBuilder(element),
|
|
1297
|
+
),
|
|
1298
|
+
);
|
|
1299
|
+
|
|
1300
|
+
// index other (plugin-contributed) elements
|
|
1301
|
+
const otherElements =
|
|
1302
|
+
this.graphBuilderExtensions.sortedExtraElementBuilders.flatMap(
|
|
1303
|
+
(builder) => input.data.otherElementsByBuilder.get(builder) ?? [],
|
|
1312
1304
|
);
|
|
1313
|
-
|
|
1314
|
-
|
|
1305
|
+
await this.runBatchedLoop(otherElements, (element) =>
|
|
1306
|
+
this.visitWithGraphBuilderErrorHandling(
|
|
1307
|
+
element,
|
|
1308
|
+
createFirstPassBuilder(element),
|
|
1309
|
+
),
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1315
1312
|
}
|
|
1316
1313
|
|
|
1317
1314
|
private async buildTypes(
|
|
@@ -1320,128 +1317,78 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1320
1317
|
options?: GraphBuilderOptions,
|
|
1321
1318
|
): Promise<void> {
|
|
1322
1319
|
// Second pass
|
|
1323
|
-
await
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1330
|
-
),
|
|
1331
|
-
),
|
|
1332
|
-
),
|
|
1333
|
-
),
|
|
1320
|
+
await this.processElementsInBatches(
|
|
1321
|
+
graph,
|
|
1322
|
+
inputs,
|
|
1323
|
+
(data) => data.profiles,
|
|
1324
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1325
|
+
options,
|
|
1334
1326
|
);
|
|
1335
|
-
await
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1342
|
-
),
|
|
1343
|
-
),
|
|
1344
|
-
),
|
|
1345
|
-
),
|
|
1327
|
+
await this.processElementsInBatches(
|
|
1328
|
+
graph,
|
|
1329
|
+
inputs,
|
|
1330
|
+
(data) => data.classes,
|
|
1331
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1332
|
+
options,
|
|
1346
1333
|
);
|
|
1347
|
-
await
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1354
|
-
),
|
|
1355
|
-
),
|
|
1356
|
-
),
|
|
1357
|
-
),
|
|
1334
|
+
await this.processElementsInBatches(
|
|
1335
|
+
graph,
|
|
1336
|
+
inputs,
|
|
1337
|
+
(data) => data.enumerations,
|
|
1338
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1339
|
+
options,
|
|
1358
1340
|
);
|
|
1359
|
-
await
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1366
|
-
),
|
|
1367
|
-
),
|
|
1368
|
-
),
|
|
1369
|
-
),
|
|
1341
|
+
await this.processElementsInBatches(
|
|
1342
|
+
graph,
|
|
1343
|
+
inputs,
|
|
1344
|
+
(data) => data.measures,
|
|
1345
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1346
|
+
options,
|
|
1370
1347
|
);
|
|
1371
|
-
await
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1378
|
-
),
|
|
1379
|
-
),
|
|
1380
|
-
),
|
|
1381
|
-
),
|
|
1348
|
+
await this.processElementsInBatches(
|
|
1349
|
+
graph,
|
|
1350
|
+
inputs,
|
|
1351
|
+
(data) => data.functions,
|
|
1352
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1353
|
+
options,
|
|
1382
1354
|
);
|
|
1383
1355
|
// Third pass
|
|
1384
|
-
await
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1391
|
-
),
|
|
1392
|
-
),
|
|
1393
|
-
),
|
|
1394
|
-
),
|
|
1356
|
+
await this.processElementsInBatches(
|
|
1357
|
+
graph,
|
|
1358
|
+
inputs,
|
|
1359
|
+
(data) => data.classes,
|
|
1360
|
+
(ctx) => new V1_ElementThirdPassBuilder(ctx),
|
|
1361
|
+
options,
|
|
1395
1362
|
);
|
|
1396
|
-
await
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1403
|
-
),
|
|
1404
|
-
),
|
|
1405
|
-
),
|
|
1406
|
-
),
|
|
1363
|
+
await this.processElementsInBatches(
|
|
1364
|
+
graph,
|
|
1365
|
+
inputs,
|
|
1366
|
+
(data) => data.associations,
|
|
1367
|
+
(ctx) => new V1_ElementThirdPassBuilder(ctx),
|
|
1368
|
+
options,
|
|
1407
1369
|
);
|
|
1408
1370
|
// Fourth Pass
|
|
1409
|
-
await
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1416
|
-
),
|
|
1417
|
-
),
|
|
1418
|
-
),
|
|
1419
|
-
),
|
|
1371
|
+
await this.processElementsInBatches(
|
|
1372
|
+
graph,
|
|
1373
|
+
inputs,
|
|
1374
|
+
(data) => data.classes,
|
|
1375
|
+
(ctx) => new V1_ElementFourthPassBuilder(ctx),
|
|
1376
|
+
options,
|
|
1420
1377
|
);
|
|
1421
|
-
await
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1428
|
-
),
|
|
1429
|
-
),
|
|
1430
|
-
),
|
|
1431
|
-
),
|
|
1378
|
+
await this.processElementsInBatches(
|
|
1379
|
+
graph,
|
|
1380
|
+
inputs,
|
|
1381
|
+
(data) => data.associations,
|
|
1382
|
+
(ctx) => new V1_ElementFourthPassBuilder(ctx),
|
|
1383
|
+
options,
|
|
1432
1384
|
);
|
|
1433
1385
|
// Fifth pass
|
|
1434
|
-
await
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1441
|
-
),
|
|
1442
|
-
),
|
|
1443
|
-
),
|
|
1444
|
-
),
|
|
1386
|
+
await this.processElementsInBatches(
|
|
1387
|
+
graph,
|
|
1388
|
+
inputs,
|
|
1389
|
+
(data) => data.classes,
|
|
1390
|
+
(ctx) => new V1_ElementFifthPassBuilder(ctx),
|
|
1391
|
+
options,
|
|
1445
1392
|
);
|
|
1446
1393
|
}
|
|
1447
1394
|
|
|
@@ -1450,17 +1397,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1450
1397
|
inputs: V1_PureGraphBuilderInput[],
|
|
1451
1398
|
options?: GraphBuilderOptions,
|
|
1452
1399
|
): Promise<void> {
|
|
1453
|
-
await
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1460
|
-
),
|
|
1461
|
-
),
|
|
1462
|
-
),
|
|
1463
|
-
),
|
|
1400
|
+
await this.processElementsInBatches(
|
|
1401
|
+
graph,
|
|
1402
|
+
inputs,
|
|
1403
|
+
(data) => data.functionActivators,
|
|
1404
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1405
|
+
options,
|
|
1464
1406
|
);
|
|
1465
1407
|
}
|
|
1466
1408
|
|
|
@@ -1469,53 +1411,33 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1469
1411
|
inputs: V1_PureGraphBuilderInput[],
|
|
1470
1412
|
options?: GraphBuilderOptions,
|
|
1471
1413
|
): Promise<void> {
|
|
1472
|
-
await
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1479
|
-
),
|
|
1480
|
-
),
|
|
1481
|
-
),
|
|
1482
|
-
),
|
|
1414
|
+
await this.processElementsInBatches(
|
|
1415
|
+
graph,
|
|
1416
|
+
inputs,
|
|
1417
|
+
(data) => data.stores,
|
|
1418
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1419
|
+
options,
|
|
1483
1420
|
);
|
|
1484
|
-
await
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1491
|
-
),
|
|
1492
|
-
),
|
|
1493
|
-
),
|
|
1494
|
-
),
|
|
1421
|
+
await this.processElementsInBatches(
|
|
1422
|
+
graph,
|
|
1423
|
+
inputs,
|
|
1424
|
+
(data) => data.stores,
|
|
1425
|
+
(ctx) => new V1_ElementThirdPassBuilder(ctx),
|
|
1426
|
+
options,
|
|
1495
1427
|
);
|
|
1496
|
-
await
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1503
|
-
),
|
|
1504
|
-
),
|
|
1505
|
-
),
|
|
1506
|
-
),
|
|
1428
|
+
await this.processElementsInBatches(
|
|
1429
|
+
graph,
|
|
1430
|
+
inputs,
|
|
1431
|
+
(data) => data.stores,
|
|
1432
|
+
(ctx) => new V1_ElementFourthPassBuilder(ctx),
|
|
1433
|
+
options,
|
|
1507
1434
|
);
|
|
1508
|
-
await
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1515
|
-
),
|
|
1516
|
-
),
|
|
1517
|
-
),
|
|
1518
|
-
),
|
|
1435
|
+
await this.processElementsInBatches(
|
|
1436
|
+
graph,
|
|
1437
|
+
inputs,
|
|
1438
|
+
(data) => data.stores,
|
|
1439
|
+
(ctx) => new V1_ElementFifthPassBuilder(ctx),
|
|
1440
|
+
options,
|
|
1519
1441
|
);
|
|
1520
1442
|
}
|
|
1521
1443
|
|
|
@@ -1524,41 +1446,26 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1524
1446
|
inputs: V1_PureGraphBuilderInput[],
|
|
1525
1447
|
options?: GraphBuilderOptions,
|
|
1526
1448
|
): Promise<void> {
|
|
1527
|
-
await
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1534
|
-
),
|
|
1535
|
-
),
|
|
1536
|
-
),
|
|
1537
|
-
),
|
|
1449
|
+
await this.processElementsInBatches(
|
|
1450
|
+
graph,
|
|
1451
|
+
inputs,
|
|
1452
|
+
(data) => data.mappings,
|
|
1453
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1454
|
+
options,
|
|
1538
1455
|
);
|
|
1539
|
-
await
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1546
|
-
),
|
|
1547
|
-
),
|
|
1548
|
-
),
|
|
1549
|
-
),
|
|
1456
|
+
await this.processElementsInBatches(
|
|
1457
|
+
graph,
|
|
1458
|
+
inputs,
|
|
1459
|
+
(data) => data.mappings,
|
|
1460
|
+
(ctx) => new V1_ElementThirdPassBuilder(ctx),
|
|
1461
|
+
options,
|
|
1550
1462
|
);
|
|
1551
|
-
await
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1558
|
-
),
|
|
1559
|
-
),
|
|
1560
|
-
),
|
|
1561
|
-
),
|
|
1463
|
+
await this.processElementsInBatches(
|
|
1464
|
+
graph,
|
|
1465
|
+
inputs,
|
|
1466
|
+
(data) => data.mappings,
|
|
1467
|
+
(ctx) => new V1_ElementFourthPassBuilder(ctx),
|
|
1468
|
+
options,
|
|
1562
1469
|
);
|
|
1563
1470
|
}
|
|
1564
1471
|
|
|
@@ -1568,29 +1475,19 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1568
1475
|
options?: GraphBuilderOptions,
|
|
1569
1476
|
): Promise<void> {
|
|
1570
1477
|
// NOTE: connections must be built before runtimes
|
|
1571
|
-
await
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1578
|
-
),
|
|
1579
|
-
),
|
|
1580
|
-
),
|
|
1581
|
-
),
|
|
1478
|
+
await this.processElementsInBatches(
|
|
1479
|
+
graph,
|
|
1480
|
+
inputs,
|
|
1481
|
+
(data) => data.connections,
|
|
1482
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1483
|
+
options,
|
|
1582
1484
|
);
|
|
1583
|
-
await
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1590
|
-
),
|
|
1591
|
-
),
|
|
1592
|
-
),
|
|
1593
|
-
),
|
|
1485
|
+
await this.processElementsInBatches(
|
|
1486
|
+
graph,
|
|
1487
|
+
inputs,
|
|
1488
|
+
(data) => data.runtimes,
|
|
1489
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1490
|
+
options,
|
|
1594
1491
|
);
|
|
1595
1492
|
}
|
|
1596
1493
|
|
|
@@ -1599,29 +1496,19 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1599
1496
|
inputs: V1_PureGraphBuilderInput[],
|
|
1600
1497
|
options?: GraphBuilderOptions,
|
|
1601
1498
|
): Promise<void> {
|
|
1602
|
-
await
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1609
|
-
),
|
|
1610
|
-
),
|
|
1611
|
-
),
|
|
1612
|
-
),
|
|
1499
|
+
await this.processElementsInBatches(
|
|
1500
|
+
graph,
|
|
1501
|
+
inputs,
|
|
1502
|
+
(data) => data.services,
|
|
1503
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1504
|
+
options,
|
|
1613
1505
|
);
|
|
1614
|
-
await
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1621
|
-
),
|
|
1622
|
-
),
|
|
1623
|
-
),
|
|
1624
|
-
),
|
|
1506
|
+
await this.processElementsInBatches(
|
|
1507
|
+
graph,
|
|
1508
|
+
inputs,
|
|
1509
|
+
(data) => data.executionEnvironments,
|
|
1510
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1511
|
+
options,
|
|
1625
1512
|
);
|
|
1626
1513
|
}
|
|
1627
1514
|
|
|
@@ -1630,17 +1517,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1630
1517
|
inputs: V1_PureGraphBuilderInput[],
|
|
1631
1518
|
options?: GraphBuilderOptions,
|
|
1632
1519
|
): Promise<void> {
|
|
1633
|
-
await
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1640
|
-
),
|
|
1641
|
-
),
|
|
1642
|
-
),
|
|
1643
|
-
),
|
|
1520
|
+
await this.processElementsInBatches(
|
|
1521
|
+
graph,
|
|
1522
|
+
inputs,
|
|
1523
|
+
(data) => data.dataElements,
|
|
1524
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1525
|
+
options,
|
|
1644
1526
|
);
|
|
1645
1527
|
}
|
|
1646
1528
|
|
|
@@ -1649,17 +1531,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1649
1531
|
inputs: V1_PureGraphBuilderInput[],
|
|
1650
1532
|
options?: GraphBuilderOptions,
|
|
1651
1533
|
): Promise<void> {
|
|
1652
|
-
await
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1659
|
-
),
|
|
1660
|
-
),
|
|
1661
|
-
),
|
|
1662
|
-
),
|
|
1534
|
+
await this.processElementsInBatches(
|
|
1535
|
+
graph,
|
|
1536
|
+
inputs,
|
|
1537
|
+
(data) => data.products,
|
|
1538
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1539
|
+
options,
|
|
1663
1540
|
);
|
|
1664
1541
|
}
|
|
1665
1542
|
|
|
@@ -1668,17 +1545,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1668
1545
|
inputs: V1_PureGraphBuilderInput[],
|
|
1669
1546
|
options?: GraphBuilderOptions,
|
|
1670
1547
|
): Promise<void> {
|
|
1671
|
-
await
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1678
|
-
),
|
|
1679
|
-
),
|
|
1680
|
-
),
|
|
1681
|
-
),
|
|
1548
|
+
await this.processElementsInBatches(
|
|
1549
|
+
graph,
|
|
1550
|
+
inputs,
|
|
1551
|
+
(data) => data.fileGenerations,
|
|
1552
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1553
|
+
options,
|
|
1682
1554
|
);
|
|
1683
1555
|
}
|
|
1684
1556
|
|
|
@@ -1687,17 +1559,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1687
1559
|
inputs: V1_PureGraphBuilderInput[],
|
|
1688
1560
|
options?: GraphBuilderOptions,
|
|
1689
1561
|
): Promise<void> {
|
|
1690
|
-
await
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1697
|
-
),
|
|
1698
|
-
),
|
|
1699
|
-
),
|
|
1700
|
-
),
|
|
1562
|
+
await this.processElementsInBatches(
|
|
1563
|
+
graph,
|
|
1564
|
+
inputs,
|
|
1565
|
+
(data) => data.generationSpecifications,
|
|
1566
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1567
|
+
options,
|
|
1701
1568
|
);
|
|
1702
1569
|
}
|
|
1703
1570
|
|
|
@@ -1706,17 +1573,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1706
1573
|
inputs: V1_PureGraphBuilderInput[],
|
|
1707
1574
|
options?: GraphBuilderOptions,
|
|
1708
1575
|
): Promise<void> {
|
|
1709
|
-
await
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
this.getBuilderContext(graph, input.model, element, options),
|
|
1716
|
-
),
|
|
1717
|
-
),
|
|
1718
|
-
),
|
|
1719
|
-
),
|
|
1576
|
+
await this.processElementsInBatches(
|
|
1577
|
+
graph,
|
|
1578
|
+
inputs,
|
|
1579
|
+
(data) => data.sectionIndices,
|
|
1580
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1581
|
+
options,
|
|
1720
1582
|
);
|
|
1721
1583
|
}
|
|
1722
1584
|
|
|
@@ -1725,82 +1587,90 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1725
1587
|
inputs: V1_PureGraphBuilderInput[],
|
|
1726
1588
|
options?: GraphBuilderOptions,
|
|
1727
1589
|
): Promise<void> {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1590
|
+
for (const builder of this.graphBuilderExtensions
|
|
1591
|
+
.sortedExtraElementBuilders) {
|
|
1592
|
+
const getElements = (
|
|
1593
|
+
data: V1_PureModelContextDataIndex,
|
|
1594
|
+
): V1_PackageableElement[] =>
|
|
1595
|
+
data.otherElementsByBuilder.get(builder) ?? [];
|
|
1596
|
+
await this.processElementsInBatches(
|
|
1597
|
+
graph,
|
|
1598
|
+
inputs,
|
|
1599
|
+
getElements,
|
|
1600
|
+
(ctx) => new V1_ElementSecondPassBuilder(ctx),
|
|
1601
|
+
options,
|
|
1602
|
+
);
|
|
1603
|
+
await this.processElementsInBatches(
|
|
1604
|
+
graph,
|
|
1605
|
+
inputs,
|
|
1606
|
+
getElements,
|
|
1607
|
+
(ctx) => new V1_ElementThirdPassBuilder(ctx),
|
|
1608
|
+
options,
|
|
1609
|
+
);
|
|
1610
|
+
await this.processElementsInBatches(
|
|
1611
|
+
graph,
|
|
1612
|
+
inputs,
|
|
1613
|
+
getElements,
|
|
1614
|
+
(ctx) => new V1_ElementFourthPassBuilder(ctx),
|
|
1615
|
+
options,
|
|
1616
|
+
);
|
|
1617
|
+
await this.processElementsInBatches(
|
|
1618
|
+
graph,
|
|
1619
|
+
inputs,
|
|
1620
|
+
getElements,
|
|
1621
|
+
(ctx) => new V1_ElementFifthPassBuilder(ctx),
|
|
1622
|
+
options,
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* Run a callback for each item in the array, processing items in batches
|
|
1629
|
+
* of {@link GRAPH_BUILDER_BATCH_SIZE} and yielding to the event loop between
|
|
1630
|
+
* batches to keep the UI responsive.
|
|
1631
|
+
*/
|
|
1632
|
+
private async runBatchedLoop<T>(
|
|
1633
|
+
items: T[],
|
|
1634
|
+
process: (item: T) => void,
|
|
1635
|
+
): Promise<void> {
|
|
1636
|
+
for (let i = 0; i < items.length; i += GRAPH_BUILDER_BATCH_SIZE) {
|
|
1637
|
+
if (i > 0) {
|
|
1638
|
+
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
|
1639
|
+
}
|
|
1640
|
+
const end = Math.min(i + GRAPH_BUILDER_BATCH_SIZE, items.length);
|
|
1641
|
+
for (let j = i; j < end; j++) {
|
|
1642
|
+
process(guaranteeNonNullable(items[j]));
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Process elements from inputs in batches, yielding to the event loop
|
|
1649
|
+
* between batches to keep the UI responsive.
|
|
1650
|
+
*/
|
|
1651
|
+
private async processElementsInBatches(
|
|
1652
|
+
graph: PureModel,
|
|
1653
|
+
inputs: V1_PureGraphBuilderInput[],
|
|
1654
|
+
getElements: (
|
|
1655
|
+
data: V1_PureModelContextDataIndex,
|
|
1656
|
+
) => V1_PackageableElement[],
|
|
1657
|
+
createVisitor: (
|
|
1658
|
+
ctx: V1_GraphBuilderContext,
|
|
1659
|
+
) => V1_PackageableElementVisitor<unknown>,
|
|
1660
|
+
options?: GraphBuilderOptions,
|
|
1661
|
+
): Promise<void> {
|
|
1662
|
+
const allItems = inputs.flatMap((input) =>
|
|
1663
|
+
getElements(input.data).map((element) => ({
|
|
1664
|
+
element,
|
|
1665
|
+
model: input.model,
|
|
1666
|
+
})),
|
|
1667
|
+
);
|
|
1668
|
+
await this.runBatchedLoop(allItems, (item) =>
|
|
1669
|
+
this.visitWithGraphBuilderErrorHandling(
|
|
1670
|
+
item.element,
|
|
1671
|
+
createVisitor(
|
|
1672
|
+
this.getBuilderContext(graph, item.model, item.element, options),
|
|
1673
|
+
),
|
|
1804
1674
|
),
|
|
1805
1675
|
);
|
|
1806
1676
|
}
|
|
@@ -1808,9 +1678,9 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1808
1678
|
private visitWithGraphBuilderErrorHandling<T>(
|
|
1809
1679
|
element: V1_PackageableElement,
|
|
1810
1680
|
visitor: V1_PackageableElementVisitor<T>,
|
|
1811
|
-
):
|
|
1681
|
+
): T {
|
|
1812
1682
|
try {
|
|
1813
|
-
return
|
|
1683
|
+
return element.accept_PackageableElementVisitor(visitor);
|
|
1814
1684
|
} catch (err) {
|
|
1815
1685
|
assertErrorThrown(err);
|
|
1816
1686
|
const error =
|