@eventcatalog/sdk 2.7.4 → 2.7.6

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.mjs CHANGED
@@ -473,14 +473,21 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
473
473
  let specs = [];
474
474
  if (service.specifications) {
475
475
  const serviceSpecifications = service.specifications;
476
- const specificationFiles = Object.keys(serviceSpecifications);
477
- const getSpecs = specificationFiles.map(async (specFile) => {
478
- const fileName = serviceSpecifications[specFile];
476
+ let specificationFiles;
477
+ if (Array.isArray(serviceSpecifications)) {
478
+ specificationFiles = serviceSpecifications.map((spec) => ({ key: spec.type, path: spec.path }));
479
+ } else {
480
+ specificationFiles = Object.keys(serviceSpecifications).map((spec) => ({
481
+ key: spec,
482
+ path: serviceSpecifications[spec]
483
+ }));
484
+ }
485
+ const getSpecs = specificationFiles.map(async ({ key, path: fileName }) => {
479
486
  if (!fileName) {
480
- throw new Error(`Specification file name for ${specFile} is undefined`);
487
+ throw new Error(`Specification file name for ${fileName} is undefined`);
481
488
  }
482
489
  const rawFile = await getFileFromResource(directory, id, { fileName }, version);
483
- return { key: specFile, content: rawFile, fileName, path: join6(dirname4(filePathToService), fileName) };
490
+ return { key, content: rawFile, fileName, path: join6(dirname4(filePathToService), fileName) };
484
491
  });
485
492
  specs = await Promise.all(getSpecs);
486
493
  }