@finos/legend-graph 32.3.37 → 32.3.39

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