@uniformdev/transformer 1.1.3 → 1.1.5

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/dist/index.d.ts CHANGED
@@ -221,6 +221,11 @@ declare class CompositionService {
221
221
  composition: Composition;
222
222
  filePath: string;
223
223
  }[]>;
224
+ findCompositionsByTypes(compositionsDir: string, compositionTypes: string[], options?: FindOptions): Promise<{
225
+ composition: Composition;
226
+ filePath: string;
227
+ }[]>;
228
+ private normalizeCompositionTypes;
224
229
  findComponentInstances(composition: Composition, componentType: string, options?: FindOptions): FoundComponentInstance[];
225
230
  private searchSlots;
226
231
  getRootOverrides(composition: Composition): Record<string, ParameterValue>;
@@ -272,6 +277,7 @@ declare class PropertyPropagatorService {
272
277
  private logger;
273
278
  constructor(fileSystem: FileSystemService, componentService: ComponentService, compositionService: CompositionService, logger: Logger);
274
279
  propagate(options: PropagateOptions): Promise<PropagateResult>;
280
+ private parsePipeSeparatedValues;
275
281
  }
276
282
 
277
283
  interface RenameSlotInternalOptions {
@@ -366,6 +372,8 @@ declare class ComponentAdderService {
366
372
  private logger;
367
373
  constructor(fileSystem: FileSystemService, componentService: ComponentService, logger: Logger);
368
374
  private compareIds;
375
+ private parseParentComponentTypes;
376
+ private matchesAnyParentType;
369
377
  private parseParameters;
370
378
  private generateId;
371
379
  private regenerateInstanceIds;
package/dist/index.js CHANGED
@@ -362,13 +362,22 @@ var CompositionService = class {
362
362
  await this.fileSystem.writeFile(filePath, composition);
363
363
  }
364
364
  async findCompositionsByType(compositionsDir, compositionType, options = {}) {
365
+ return this.findCompositionsByTypes(compositionsDir, [compositionType], options);
366
+ }
367
+ async findCompositionsByTypes(compositionsDir, compositionTypes, options = {}) {
365
368
  const { strict = false } = options;
369
+ const normalizedTypes = this.normalizeCompositionTypes(compositionTypes, strict);
370
+ if (normalizedTypes.length === 0) {
371
+ return [];
372
+ }
366
373
  const files = await this.fileSystem.findFiles(compositionsDir, "**/*.{json,yaml,yml}");
367
374
  const results = [];
368
375
  for (const filePath of files) {
369
376
  try {
370
377
  const composition = await this.loadComposition(filePath);
371
- if (composition.composition?.type && this.compareTypes(composition.composition.type, compositionType, strict)) {
378
+ if (composition.composition?.type && normalizedTypes.some(
379
+ (type) => this.compareTypes(composition.composition.type, type, strict)
380
+ )) {
372
381
  results.push({ composition, filePath });
373
382
  }
374
383
  } catch {
@@ -376,6 +385,22 @@ var CompositionService = class {
376
385
  }
377
386
  return results;
378
387
  }
388
+ normalizeCompositionTypes(compositionTypes, strict) {
389
+ const normalized = [];
390
+ for (const type of compositionTypes) {
391
+ const trimmed = type.trim();
392
+ if (!trimmed) {
393
+ continue;
394
+ }
395
+ const exists = normalized.some(
396
+ (existing) => strict ? existing === trimmed : existing.toLowerCase() === trimmed.toLowerCase()
397
+ );
398
+ if (!exists) {
399
+ normalized.push(trimmed);
400
+ }
401
+ }
402
+ return normalized;
403
+ }
379
404
  findComponentInstances(composition, componentType, options = {}) {
380
405
  const { strict = false } = options;
381
406
  const results = [];
@@ -500,26 +525,51 @@ var PropertyPropagatorService = class {
500
525
  deleteSourceParameter
501
526
  } = options;
502
527
  const findOptions = { strict };
528
+ const compositionTypes = this.parsePipeSeparatedValues(compositionType, strict);
503
529
  const fullComponentsDir = this.fileSystem.resolvePath(rootDir, componentsDir);
504
530
  const fullCompositionsDir = this.fileSystem.resolvePath(rootDir, compositionsDir);
505
- this.logger.info(`Loading component: ${compositionType}`);
506
- const { component: sourceComponent, filePath: sourceFilePath } = await this.componentService.loadComponent(fullComponentsDir, compositionType, findOptions);
531
+ const sourceComponents = [];
532
+ for (const sourceType of compositionTypes) {
533
+ this.logger.info(`Loading component: ${sourceType}`);
534
+ const { component: sourceComponent, filePath: sourceFilePath } = await this.componentService.loadComponent(fullComponentsDir, sourceType, findOptions);
535
+ sourceComponents.push({ sourceType, sourceFilePath, sourceComponent });
536
+ }
507
537
  this.logger.info(`Loading component: ${targetComponentType}`);
508
538
  const { component: targetComponent, filePath: targetFilePath } = await this.componentService.loadComponent(fullComponentsDir, targetComponentType, findOptions);
509
- const propertyNames = property.split("|").map((p) => p.trim());
510
- const { parameters: resolvedParams, notFound } = this.componentService.resolveProperties(
511
- sourceComponent,
512
- propertyNames,
513
- findOptions
514
- );
515
- if (notFound.length > 0) {
516
- throw new PropertyNotFoundError(notFound.join(", "), compositionType);
539
+ const propertyNames = property.split("|").map((p) => p.trim()).filter((p) => p.length > 0);
540
+ const resolvedParams = [];
541
+ const resolvedNames = [];
542
+ for (const { sourceType, sourceComponent } of sourceComponents) {
543
+ const { parameters: sourceParams, notFound } = this.componentService.resolveProperties(
544
+ sourceComponent,
545
+ propertyNames,
546
+ findOptions
547
+ );
548
+ if (notFound.length > 0) {
549
+ throw new PropertyNotFoundError(notFound.join(", "), sourceType);
550
+ }
551
+ for (const param of sourceParams) {
552
+ const exists = resolvedParams.some(
553
+ (existing) => strict ? existing.id === param.id : existing.id.toLowerCase() === param.id.toLowerCase()
554
+ );
555
+ if (!exists) {
556
+ resolvedParams.push(param);
557
+ resolvedNames.push(param.id);
558
+ }
559
+ }
560
+ }
561
+ const groupSources = [];
562
+ for (const { sourceType, sourceComponent } of sourceComponents) {
563
+ for (const name of propertyNames) {
564
+ const param = this.componentService.findParameter(sourceComponent, name, findOptions);
565
+ if (param && this.componentService.isGroupParameter(param)) {
566
+ const groupSource = `${sourceType}.${name}`;
567
+ if (!groupSources.includes(groupSource)) {
568
+ groupSources.push(groupSource);
569
+ }
570
+ }
571
+ }
517
572
  }
518
- const resolvedNames = resolvedParams.map((p) => p.id);
519
- const groupSources = propertyNames.filter((name) => {
520
- const param = this.componentService.findParameter(sourceComponent, name, findOptions);
521
- return param && this.componentService.isGroupParameter(param);
522
- });
523
573
  if (groupSources.length > 0) {
524
574
  this.logger.info(
525
575
  `Resolved properties: ${resolvedNames.join(", ")} (from ${groupSources.join(", ")})`
@@ -594,9 +644,9 @@ var PropertyPropagatorService = class {
594
644
  if (componentModified && !whatIf) {
595
645
  await this.componentService.saveComponent(targetFilePath, modifiedComponent);
596
646
  }
597
- const compositions = await this.compositionService.findCompositionsByType(
647
+ const compositions = await this.compositionService.findCompositionsByTypes(
598
648
  fullCompositionsDir,
599
- compositionType,
649
+ compositionTypes,
600
650
  findOptions
601
651
  );
602
652
  let modifiedCompositions = 0;
@@ -643,31 +693,41 @@ var PropertyPropagatorService = class {
643
693
  modifiedCompositions++;
644
694
  }
645
695
  }
646
- let sourceComponentModified = false;
696
+ let modifiedSourceComponents = 0;
647
697
  if (deleteSourceParameter) {
648
- let modifiedSource = { ...sourceComponent };
649
- for (const param of resolvedParams) {
650
- this.logger.action(whatIf, "DELETE", `Parameter "${param.id}" from ${compositionType}`);
651
- modifiedSource = this.componentService.removeParameter(modifiedSource, param.id, findOptions);
652
- sourceComponentModified = true;
653
- }
654
- const beforeGroupCount = modifiedSource.parameters?.filter(
655
- (p) => this.componentService.isGroupParameter(p)
656
- ).length ?? 0;
657
- modifiedSource = this.componentService.removeEmptyGroups(modifiedSource);
658
- const afterGroupCount = modifiedSource.parameters?.filter(
659
- (p) => this.componentService.isGroupParameter(p)
660
- ).length ?? 0;
661
- if (afterGroupCount < beforeGroupCount) {
662
- const removedCount = beforeGroupCount - afterGroupCount;
663
- this.logger.action(
664
- whatIf,
665
- "DELETE",
666
- `${removedCount} empty group(s) from ${compositionType}`
667
- );
668
- }
669
- if (sourceComponentModified && !whatIf) {
670
- await this.componentService.saveComponent(sourceFilePath, modifiedSource);
698
+ for (const { sourceType, sourceFilePath, sourceComponent } of sourceComponents) {
699
+ let modifiedSource = { ...sourceComponent };
700
+ let sourceComponentModified = false;
701
+ for (const param of resolvedParams) {
702
+ const exists = this.componentService.findParameter(modifiedSource, param.id, findOptions);
703
+ if (exists) {
704
+ this.logger.action(whatIf, "DELETE", `Parameter "${param.id}" from ${sourceType}`);
705
+ modifiedSource = this.componentService.removeParameter(modifiedSource, param.id, findOptions);
706
+ sourceComponentModified = true;
707
+ }
708
+ }
709
+ const beforeGroupCount = modifiedSource.parameters?.filter(
710
+ (p) => this.componentService.isGroupParameter(p)
711
+ ).length ?? 0;
712
+ modifiedSource = this.componentService.removeEmptyGroups(modifiedSource);
713
+ const afterGroupCount = modifiedSource.parameters?.filter(
714
+ (p) => this.componentService.isGroupParameter(p)
715
+ ).length ?? 0;
716
+ if (afterGroupCount < beforeGroupCount) {
717
+ const removedCount = beforeGroupCount - afterGroupCount;
718
+ this.logger.action(
719
+ whatIf,
720
+ "DELETE",
721
+ `${removedCount} empty group(s) from ${sourceType}`
722
+ );
723
+ sourceComponentModified = true;
724
+ }
725
+ if (sourceComponentModified) {
726
+ modifiedSourceComponents++;
727
+ }
728
+ if (sourceComponentModified && !whatIf) {
729
+ await this.componentService.saveComponent(sourceFilePath, modifiedSource);
730
+ }
671
731
  }
672
732
  for (const { composition, filePath } of compositions) {
673
733
  const relativePath = filePath.replace(fullCompositionsDir, "").replace(/^[/\\]/, "");
@@ -686,11 +746,24 @@ var PropertyPropagatorService = class {
686
746
  }
687
747
  }
688
748
  return {
689
- modifiedComponents: (componentModified ? 1 : 0) + (sourceComponentModified ? 1 : 0),
749
+ modifiedComponents: (componentModified ? 1 : 0) + modifiedSourceComponents,
690
750
  modifiedCompositions,
691
751
  propagatedInstances
692
752
  };
693
753
  }
754
+ parsePipeSeparatedValues(value, strict) {
755
+ const entries = value.split("|").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
756
+ const normalized = [];
757
+ for (const entry of entries) {
758
+ const exists = normalized.some(
759
+ (existing) => strict ? existing === entry : existing.toLowerCase() === entry.toLowerCase()
760
+ );
761
+ if (!exists) {
762
+ normalized.push(entry);
763
+ }
764
+ }
765
+ return normalized;
766
+ }
694
767
  };
695
768
 
696
769
  // src/core/services/slot-renamer.service.ts
@@ -1114,6 +1187,12 @@ var ComponentAdderService = class {
1114
1187
  }
1115
1188
  return id1.toLowerCase() === id2.toLowerCase();
1116
1189
  }
1190
+ parseParentComponentTypes(parentComponentType) {
1191
+ return parentComponentType.split("|").map((t) => t.trim()).filter((t) => t.length > 0);
1192
+ }
1193
+ matchesAnyParentType(instanceType, parentTypes, strict) {
1194
+ return parentTypes.some((pt) => this.compareIds(instanceType, pt, strict));
1195
+ }
1117
1196
  parseParameters(parameterString) {
1118
1197
  const result = {};
1119
1198
  if (!parameterString) return result;
@@ -1187,18 +1266,9 @@ var ComponentAdderService = class {
1187
1266
  const fullCompositionPatternsDir = this.fileSystem.resolvePath(rootDir, compositionPatternsDir);
1188
1267
  const fullComponentPatternsDir = this.fileSystem.resolvePath(rootDir, componentPatternsDir);
1189
1268
  const findOptions = { strict };
1190
- this.logger.info(`Loading parent component: ${parentComponentType}`);
1191
- const { component: parentComponent, filePath: parentComponentFilePath } = await this.componentService.loadComponent(fullComponentsDir, parentComponentType, findOptions);
1192
- if (!parentComponent.slots) {
1193
- parentComponent.slots = [];
1194
- }
1195
- let slotDef = parentComponent.slots.find(
1196
- (s) => this.compareIds(s.id, slot, strict)
1197
- );
1198
- if (!slotDef) {
1199
- this.logger.info(`Slot "${slot}" not found on component "${parentComponentType}", creating it`);
1200
- slotDef = { id: slot, name: slot, allowedComponents: [] };
1201
- parentComponent.slots.push(slotDef);
1269
+ const parentTypes = this.parseParentComponentTypes(parentComponentType);
1270
+ if (parentTypes.length === 0) {
1271
+ throw new TransformError("parentComponentType cannot be empty");
1202
1272
  }
1203
1273
  this.logger.info(`Validating new component: ${newComponentType}`);
1204
1274
  try {
@@ -1212,35 +1282,50 @@ var ComponentAdderService = class {
1212
1282
  throw error;
1213
1283
  }
1214
1284
  let allowedComponentsUpdated = false;
1215
- const slotIndex = parentComponent.slots?.findIndex(
1216
- (s) => this.compareIds(s.id, slotDef.id, strict)
1217
- );
1218
- if (slotIndex !== void 0 && slotIndex >= 0) {
1219
- const actualSlot = parentComponent.slots[slotIndex];
1220
- if (!actualSlot.allowedComponents) {
1221
- actualSlot.allowedComponents = [];
1285
+ for (const parentType of parentTypes) {
1286
+ this.logger.info(`Loading parent component: ${parentType}`);
1287
+ const { component: parentComponent, filePath: parentComponentFilePath } = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
1288
+ if (!parentComponent.slots) {
1289
+ parentComponent.slots = [];
1222
1290
  }
1223
- const isAlreadyAllowed = actualSlot.allowedComponents.some(
1224
- (c) => this.compareIds(c, newComponentType, strict)
1291
+ let slotDef = parentComponent.slots.find(
1292
+ (s) => this.compareIds(s.id, slot, strict)
1225
1293
  );
1226
- if (!isAlreadyAllowed) {
1227
- this.logger.action(
1228
- whatIf,
1229
- "UPDATE",
1230
- `Adding "${newComponentType}" to allowedComponents for slot "${slot}" on component "${parentComponentType}"`
1294
+ if (!slotDef) {
1295
+ this.logger.info(`Slot "${slot}" not found on component "${parentType}", creating it`);
1296
+ slotDef = { id: slot, name: slot, allowedComponents: [] };
1297
+ parentComponent.slots.push(slotDef);
1298
+ }
1299
+ const slotIndex = parentComponent.slots?.findIndex(
1300
+ (s) => this.compareIds(s.id, slotDef.id, strict)
1301
+ );
1302
+ if (slotIndex !== void 0 && slotIndex >= 0) {
1303
+ const actualSlot = parentComponent.slots[slotIndex];
1304
+ if (!actualSlot.allowedComponents) {
1305
+ actualSlot.allowedComponents = [];
1306
+ }
1307
+ const isAlreadyAllowed = actualSlot.allowedComponents.some(
1308
+ (c) => this.compareIds(c, newComponentType, strict)
1231
1309
  );
1232
- actualSlot.allowedComponents.push(newComponentType);
1233
- if (!whatIf) {
1234
- await this.componentService.saveComponent(parentComponentFilePath, parentComponent);
1310
+ if (!isAlreadyAllowed) {
1311
+ this.logger.action(
1312
+ whatIf,
1313
+ "UPDATE",
1314
+ `Adding "${newComponentType}" to allowedComponents for slot "${slot}" on component "${parentType}"`
1315
+ );
1316
+ actualSlot.allowedComponents.push(newComponentType);
1317
+ if (!whatIf) {
1318
+ await this.componentService.saveComponent(parentComponentFilePath, parentComponent);
1319
+ }
1320
+ allowedComponentsUpdated = true;
1235
1321
  }
1236
- allowedComponentsUpdated = true;
1237
1322
  }
1238
1323
  }
1239
1324
  const parsedParams = this.parseParameters(paramString);
1240
1325
  const newInstance = this.createComponentInstance(newComponentType, parsedParams);
1241
1326
  const compositionsResult = await this.addComponentToDirectory(
1242
1327
  fullCompositionsDir,
1243
- parentComponentType,
1328
+ parentTypes,
1244
1329
  slot,
1245
1330
  newInstance,
1246
1331
  whatIf,
@@ -1249,7 +1334,7 @@ var ComponentAdderService = class {
1249
1334
  );
1250
1335
  const compositionPatternsResult = await this.addComponentToDirectory(
1251
1336
  fullCompositionPatternsDir,
1252
- parentComponentType,
1337
+ parentTypes,
1253
1338
  slot,
1254
1339
  newInstance,
1255
1340
  whatIf,
@@ -1258,7 +1343,7 @@ var ComponentAdderService = class {
1258
1343
  );
1259
1344
  const componentPatternsResult = await this.addComponentToDirectory(
1260
1345
  fullComponentPatternsDir,
1261
- parentComponentType,
1346
+ parentTypes,
1262
1347
  slot,
1263
1348
  newInstance,
1264
1349
  whatIf,
@@ -1267,7 +1352,7 @@ var ComponentAdderService = class {
1267
1352
  );
1268
1353
  this.logger.info("");
1269
1354
  this.logger.info(
1270
- `Summary: ${allowedComponentsUpdated ? "1 component definition updated, " : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1355
+ `Summary: ${allowedComponentsUpdated ? `${parentTypes.length} component definition(s) updated, ` : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1271
1356
  );
1272
1357
  return {
1273
1358
  allowedComponentsUpdated,
@@ -1298,18 +1383,9 @@ var ComponentAdderService = class {
1298
1383
  const fullCompositionPatternsDir = this.fileSystem.resolvePath(rootDir, compositionPatternsDir);
1299
1384
  const fullComponentPatternsDir = this.fileSystem.resolvePath(rootDir, componentPatternsDir);
1300
1385
  const findOptions = { strict };
1301
- this.logger.info(`Loading parent component: ${parentComponentType}`);
1302
- const { component: parentComponent } = await this.componentService.loadComponent(fullComponentsDir, parentComponentType, findOptions);
1303
- if (!parentComponent.slots) {
1304
- parentComponent.slots = [];
1305
- }
1306
- let slotDef = parentComponent.slots.find(
1307
- (s) => this.compareIds(s.id, slot, strict)
1308
- );
1309
- if (!slotDef) {
1310
- this.logger.info(`Slot "${slot}" not found on component "${parentComponentType}", creating it`);
1311
- slotDef = { id: slot, name: slot, allowedComponents: [] };
1312
- parentComponent.slots.push(slotDef);
1386
+ const parentTypes = this.parseParentComponentTypes(parentComponentType);
1387
+ if (parentTypes.length === 0) {
1388
+ throw new TransformError("parentComponentType cannot be empty");
1313
1389
  }
1314
1390
  this.logger.info(`Loading component pattern: ${componentPatternId}`);
1315
1391
  const pattern = await this.loadComponentPattern(
@@ -1323,32 +1399,45 @@ var ComponentAdderService = class {
1323
1399
  `Component pattern "${componentPatternId}" has no valid definition or missing type`
1324
1400
  );
1325
1401
  }
1326
- let allowedComponentsUpdated = false;
1327
1402
  const componentTypeInPattern = patternDefinition.type;
1328
- const slotIndex = parentComponent.slots?.findIndex(
1329
- (s) => this.compareIds(s.id, slotDef.id, strict)
1330
- );
1331
- if (slotIndex !== void 0 && slotIndex >= 0) {
1332
- const actualSlot = parentComponent.slots[slotIndex];
1333
- if (!actualSlot.allowedComponents) {
1334
- actualSlot.allowedComponents = [];
1403
+ let allowedComponentsUpdated = false;
1404
+ for (const parentType of parentTypes) {
1405
+ this.logger.info(`Loading parent component: ${parentType}`);
1406
+ const { component: parentComponent, filePath: parentComponentFilePath } = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
1407
+ if (!parentComponent.slots) {
1408
+ parentComponent.slots = [];
1335
1409
  }
1336
- const isAlreadyAllowed = actualSlot.allowedComponents.some(
1337
- (c) => this.compareIds(c, componentTypeInPattern, strict)
1410
+ let slotDef = parentComponent.slots.find(
1411
+ (s) => this.compareIds(s.id, slot, strict)
1338
1412
  );
1339
- if (!isAlreadyAllowed) {
1340
- this.logger.action(
1341
- whatIf,
1342
- "UPDATE",
1343
- `Adding "${componentTypeInPattern}" to allowedComponents for slot "${slot}" on component "${parentComponentType}"`
1413
+ if (!slotDef) {
1414
+ this.logger.info(`Slot "${slot}" not found on component "${parentType}", creating it`);
1415
+ slotDef = { id: slot, name: slot, allowedComponents: [] };
1416
+ parentComponent.slots.push(slotDef);
1417
+ }
1418
+ const slotIndex = parentComponent.slots?.findIndex(
1419
+ (s) => this.compareIds(s.id, slotDef.id, strict)
1420
+ );
1421
+ if (slotIndex !== void 0 && slotIndex >= 0) {
1422
+ const actualSlot = parentComponent.slots[slotIndex];
1423
+ if (!actualSlot.allowedComponents) {
1424
+ actualSlot.allowedComponents = [];
1425
+ }
1426
+ const isAlreadyAllowed = actualSlot.allowedComponents.some(
1427
+ (c) => this.compareIds(c, componentTypeInPattern, strict)
1344
1428
  );
1345
- actualSlot.allowedComponents.push(componentTypeInPattern);
1346
- if (!whatIf) {
1347
- await this.componentService.loadComponent(fullComponentsDir, parentComponentType, findOptions).then(
1348
- ({ filePath }) => this.componentService.saveComponent(filePath, parentComponent)
1429
+ if (!isAlreadyAllowed) {
1430
+ this.logger.action(
1431
+ whatIf,
1432
+ "UPDATE",
1433
+ `Adding "${componentTypeInPattern}" to allowedComponents for slot "${slot}" on component "${parentType}"`
1349
1434
  );
1435
+ actualSlot.allowedComponents.push(componentTypeInPattern);
1436
+ if (!whatIf) {
1437
+ await this.componentService.saveComponent(parentComponentFilePath, parentComponent);
1438
+ }
1439
+ allowedComponentsUpdated = true;
1350
1440
  }
1351
- allowedComponentsUpdated = true;
1352
1441
  }
1353
1442
  }
1354
1443
  const newInstance = {
@@ -1358,7 +1447,7 @@ var ComponentAdderService = class {
1358
1447
  };
1359
1448
  const compositionsResult = await this.addComponentToDirectory(
1360
1449
  fullCompositionsDir,
1361
- parentComponentType,
1450
+ parentTypes,
1362
1451
  slot,
1363
1452
  newInstance,
1364
1453
  whatIf,
@@ -1367,7 +1456,7 @@ var ComponentAdderService = class {
1367
1456
  );
1368
1457
  const compositionPatternsResult = await this.addComponentToDirectory(
1369
1458
  fullCompositionPatternsDir,
1370
- parentComponentType,
1459
+ parentTypes,
1371
1460
  slot,
1372
1461
  newInstance,
1373
1462
  whatIf,
@@ -1376,7 +1465,7 @@ var ComponentAdderService = class {
1376
1465
  );
1377
1466
  const componentPatternsResult = await this.addComponentToDirectory(
1378
1467
  fullComponentPatternsDir,
1379
- parentComponentType,
1468
+ parentTypes,
1380
1469
  slot,
1381
1470
  newInstance,
1382
1471
  whatIf,
@@ -1385,7 +1474,7 @@ var ComponentAdderService = class {
1385
1474
  );
1386
1475
  this.logger.info("");
1387
1476
  this.logger.info(
1388
- `Summary: ${allowedComponentsUpdated ? "1 component definition updated, " : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1477
+ `Summary: ${allowedComponentsUpdated ? `${parentTypes.length} component definition(s) updated, ` : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1389
1478
  );
1390
1479
  return {
1391
1480
  allowedComponentsUpdated,
@@ -1436,7 +1525,7 @@ var ComponentAdderService = class {
1436
1525
  }
1437
1526
  return raw;
1438
1527
  }
1439
- async addComponentToDirectory(directory, parentComponentType, slot, newInstance, whatIf, strict, dirType) {
1528
+ async addComponentToDirectory(directory, parentTypes, slot, newInstance, whatIf, strict, dirType) {
1440
1529
  const exists = await this.fileSystem.fileExists(directory);
1441
1530
  if (!exists) {
1442
1531
  this.logger.detail(`${dirType} directory does not exist, skipping`);
@@ -1469,7 +1558,7 @@ var ComponentAdderService = class {
1469
1558
  }
1470
1559
  const rootInstance = composition.composition;
1471
1560
  let modified = false;
1472
- if (this.compareIds(rootInstance.type, parentComponentType, strict)) {
1561
+ if (this.matchesAnyParentType(rootInstance.type, parentTypes, strict)) {
1473
1562
  if (!rootInstance.slots) {
1474
1563
  rootInstance.slots = {};
1475
1564
  }
@@ -1481,7 +1570,7 @@ var ComponentAdderService = class {
1481
1570
  if (rootInstance.slots) {
1482
1571
  const nestedModified = this.addComponentToNestedSlots(
1483
1572
  rootInstance.slots,
1484
- parentComponentType,
1573
+ parentTypes,
1485
1574
  slot,
1486
1575
  newInstance,
1487
1576
  strict
@@ -1515,12 +1604,12 @@ var ComponentAdderService = class {
1515
1604
  }
1516
1605
  return filesModified;
1517
1606
  }
1518
- addComponentToNestedSlots(slots, parentComponentType, slot, newInstance, strict) {
1607
+ addComponentToNestedSlots(slots, parentTypes, slot, newInstance, strict) {
1519
1608
  let modified = false;
1520
1609
  for (const slotInstances of Object.values(slots)) {
1521
1610
  if (!Array.isArray(slotInstances)) continue;
1522
1611
  for (const instance of slotInstances) {
1523
- if (this.compareIds(instance.type, parentComponentType, strict)) {
1612
+ if (this.matchesAnyParentType(instance.type, parentTypes, strict)) {
1524
1613
  if (!instance.slots) {
1525
1614
  instance.slots = {};
1526
1615
  }
@@ -1532,7 +1621,7 @@ var ComponentAdderService = class {
1532
1621
  if (instance.slots) {
1533
1622
  const nestedModified = this.addComponentToNestedSlots(
1534
1623
  instance.slots,
1535
- parentComponentType,
1624
+ parentTypes,
1536
1625
  slot,
1537
1626
  newInstance,
1538
1627
  strict