@eventcatalog/sdk 2.8.3 → 2.8.4

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 (59) hide show
  1. package/dist/channels.js +19 -18
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +14 -13
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +14 -13
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +12 -11
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/containers.js +14 -13
  10. package/dist/containers.js.map +1 -1
  11. package/dist/containers.mjs +12 -11
  12. package/dist/containers.mjs.map +1 -1
  13. package/dist/custom-docs.js +8 -7
  14. package/dist/custom-docs.js.map +1 -1
  15. package/dist/custom-docs.mjs +7 -6
  16. package/dist/custom-docs.mjs.map +1 -1
  17. package/dist/data-stores.js +14 -13
  18. package/dist/data-stores.js.map +1 -1
  19. package/dist/data-stores.mjs +12 -11
  20. package/dist/data-stores.mjs.map +1 -1
  21. package/dist/domains.js +19 -18
  22. package/dist/domains.js.map +1 -1
  23. package/dist/domains.mjs +19 -18
  24. package/dist/domains.mjs.map +1 -1
  25. package/dist/entities.js +13 -12
  26. package/dist/entities.js.map +1 -1
  27. package/dist/entities.mjs +12 -11
  28. package/dist/entities.mjs.map +1 -1
  29. package/dist/eventcatalog.js +211 -201
  30. package/dist/eventcatalog.js.map +1 -1
  31. package/dist/eventcatalog.mjs +182 -172
  32. package/dist/eventcatalog.mjs.map +1 -1
  33. package/dist/events.js +14 -13
  34. package/dist/events.js.map +1 -1
  35. package/dist/events.mjs +12 -11
  36. package/dist/events.mjs.map +1 -1
  37. package/dist/index.d.mts +5 -8
  38. package/dist/index.d.ts +5 -8
  39. package/dist/index.js +211 -201
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +182 -172
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/messages.js +13 -12
  44. package/dist/messages.js.map +1 -1
  45. package/dist/messages.mjs +11 -10
  46. package/dist/messages.mjs.map +1 -1
  47. package/dist/queries.js +14 -13
  48. package/dist/queries.js.map +1 -1
  49. package/dist/queries.mjs +12 -11
  50. package/dist/queries.mjs.map +1 -1
  51. package/dist/services.js +31 -30
  52. package/dist/services.js.map +1 -1
  53. package/dist/services.mjs +25 -24
  54. package/dist/services.mjs.map +1 -1
  55. package/dist/teams.js +13 -12
  56. package/dist/teams.js.map +1 -1
  57. package/dist/teams.mjs +8 -7
  58. package/dist/teams.mjs.map +1 -1
  59. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  // src/eventcatalog.ts
2
2
  import fs12 from "fs";
3
- import path4, { join as join16 } from "path";
3
+ import path5, { join as join16 } from "path";
4
4
 
5
5
  // src/index.ts
6
6
  import { join as join15 } from "path";
@@ -24,13 +24,13 @@ var versionExists = async (catalogDir, id, version) => {
24
24
  var findFileById = async (catalogDir, id, version) => {
25
25
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
26
26
  const matchedFiles = await searchFilesForId(files, id) || [];
27
- const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
27
+ const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
28
28
  if (!version) {
29
29
  return latestVersion;
30
30
  }
31
- const parsedFiles = matchedFiles.map((path5) => {
32
- const { data } = matter.read(path5);
33
- return { ...data, path: path5 };
31
+ const parsedFiles = matchedFiles.map((path6) => {
32
+ const { data } = matter.read(path6);
33
+ return { ...data, path: path6 };
34
34
  });
35
35
  const semverRange = validRange(version);
36
36
  if (semverRange && valid(version)) {
@@ -71,8 +71,8 @@ var getFiles = async (pattern, ignore = "") => {
71
71
  );
72
72
  }
73
73
  };
74
- var readMdxFile = async (path5) => {
75
- const { data } = matter.read(path5);
74
+ var readMdxFile = async (path6) => {
75
+ const { data } = matter.read(path6);
76
76
  const { markdown, ...frontmatter } = data;
77
77
  return { ...frontmatter, markdown };
78
78
  };
@@ -125,6 +125,7 @@ import fsSync2 from "fs";
125
125
  import { satisfies as satisfies2 } from "semver";
126
126
  import { lock, unlock } from "proper-lockfile";
127
127
  import { basename as basename2 } from "path";
128
+ import path from "path";
128
129
  var versionResource = async (catalogDir, id) => {
129
130
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
130
131
  const matchedFiles = await searchFilesForId(files, id);
@@ -164,8 +165,8 @@ var writeResource = async (catalogDir, resource, options = {
164
165
  versionExistingContent: false,
165
166
  format: "mdx"
166
167
  }) => {
167
- const path5 = options.path || `/${resource.id}`;
168
- const fullPath = join2(catalogDir, path5);
168
+ const path6 = options.path || `/${resource.id}`;
169
+ const fullPath = join2(catalogDir, path6);
169
170
  const format = options.format || "mdx";
170
171
  fsSync2.mkdirSync(fullPath, { recursive: true });
171
172
  const lockPath = join2(fullPath, `index.${format}`);
@@ -231,6 +232,11 @@ var getResourcePath = async (catalogDir, id, version) => {
231
232
  directory: dirname2(file.replace(catalogDir, ""))
232
233
  };
233
234
  };
235
+ var getResourceFolderName = async (catalogDir, id, version) => {
236
+ const paths = await getResourcePath(catalogDir, id, version);
237
+ if (!paths) return;
238
+ return paths?.directory.split(path.sep).filter(Boolean).pop();
239
+ };
234
240
  var toResource = async (catalogDir, rawContents) => {
235
241
  const { data, content } = matter2(rawContents);
236
242
  return {
@@ -292,16 +298,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
292
298
  );
293
299
  }
294
300
  };
295
- var waitForFileRemoval = async (path5, maxRetries = 50, delay = 10) => {
301
+ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
296
302
  for (let i = 0; i < maxRetries; i++) {
297
303
  try {
298
- await fs.access(path5);
304
+ await fs.access(path6);
299
305
  await new Promise((resolve2) => setTimeout(resolve2, delay));
300
306
  } catch (error) {
301
307
  return;
302
308
  }
303
309
  }
304
- throw new Error(`File/directory ${path5} was not removed after ${maxRetries} attempts`);
310
+ throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
305
311
  };
306
312
  var addFileToResource = async (catalogDir, id, file, version) => {
307
313
  const pathToResource = await findFileById(catalogDir, id, version);
@@ -348,8 +354,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
348
354
  pathForEvent = join3(pathForEvent, event.id);
349
355
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
350
356
  };
351
- var rmEvent = (directory) => async (path5) => {
352
- await fs2.rm(join3(directory, path5), { recursive: true });
357
+ var rmEvent = (directory) => async (path6) => {
358
+ await fs2.rm(join3(directory, path6), { recursive: true });
353
359
  };
354
360
  var rmEventById = (directory) => async (id, version, persistFiles) => {
355
361
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -384,8 +390,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
384
390
  pathForCommand = join4(pathForCommand, command.id);
385
391
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
386
392
  };
387
- var rmCommand = (directory) => async (path5) => {
388
- await fs3.rm(join4(directory, path5), { recursive: true });
393
+ var rmCommand = (directory) => async (path6) => {
394
+ await fs3.rm(join4(directory, path6), { recursive: true });
389
395
  };
390
396
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
391
397
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -418,8 +424,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
418
424
  pathForQuery = join5(pathForQuery, query.id);
419
425
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
420
426
  };
421
- var rmQuery = (directory) => async (path5) => {
422
- await fs4.rm(join5(directory, path5), { recursive: true });
427
+ var rmQuery = (directory) => async (path6) => {
428
+ await fs4.rm(join5(directory, path6), { recursive: true });
423
429
  };
424
430
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
425
431
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -438,8 +444,8 @@ var queryHasVersion = (directory) => async (id, version) => {
438
444
  import fs5 from "fs/promises";
439
445
  import { join as join6, dirname as dirname4, extname, relative as relative2 } from "path";
440
446
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
441
- var getServiceByPath = (directory) => async (path5) => {
442
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
447
+ var getServiceByPath = (directory) => async (path6) => {
448
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
443
449
  return service;
444
450
  };
445
451
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -463,8 +469,8 @@ var writeService = (directory) => async (service, options = {
463
469
  };
464
470
  var writeVersionedService = (directory) => async (service) => {
465
471
  const resource = { ...service };
466
- const path5 = getVersionedDirectory(service.id, service.version);
467
- return await writeService(directory)(resource, { path: path5 });
472
+ const path6 = getVersionedDirectory(service.id, service.version);
473
+ return await writeService(directory)(resource, { path: path6 });
468
474
  };
469
475
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
470
476
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -472,8 +478,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
472
478
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
473
479
  };
474
480
  var versionService = (directory) => async (id) => versionResource(directory, id);
475
- var rmService = (directory) => async (path5) => {
476
- await fs5.rm(join6(directory, path5), { recursive: true });
481
+ var rmService = (directory) => async (path6) => {
482
+ await fs5.rm(join6(directory, path6), { recursive: true });
477
483
  };
478
484
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
479
485
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -537,8 +543,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
537
543
  if (!existingResource) {
538
544
  throw new Error(`Cannot find service ${id} in the catalog`);
539
545
  }
540
- const path5 = existingResource.split(/[\\/]+services/)[0];
541
- const pathToResource = join6(path5, "services");
546
+ const path6 = existingResource.split(/[\\/]+services/)[0];
547
+ const pathToResource = join6(path6, "services");
542
548
  await rmServiceById(directory)(id, version);
543
549
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
544
550
  };
@@ -546,9 +552,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
546
552
  const file = await findFileById(directory, id, version);
547
553
  return !!file;
548
554
  };
549
- var isService = (directory) => async (path5) => {
550
- const service = await getServiceByPath(directory)(path5);
551
- const relativePath = relative2(directory, path5);
555
+ var isService = (directory) => async (path6) => {
556
+ const service = await getServiceByPath(directory)(path6);
557
+ const relativePath = relative2(directory, path6);
552
558
  const segments = relativePath.split(/[/\\]+/);
553
559
  return !!service && segments.includes("services");
554
560
  };
@@ -570,8 +576,8 @@ var addEntityToService = (directory) => async (id, entity, version) => {
570
576
  if (!existingResource) {
571
577
  throw new Error(`Cannot find service ${id} in the catalog`);
572
578
  }
573
- const path5 = existingResource.split(/[\\/]+services/)[0];
574
- const pathToResource = join6(path5, "services");
579
+ const path6 = existingResource.split(/[\\/]+services/)[0];
580
+ const pathToResource = join6(path6, "services");
575
581
  await rmServiceById(directory)(id, version);
576
582
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
577
583
  };
@@ -606,15 +612,15 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
606
612
  if (!existingResource) {
607
613
  throw new Error(`Cannot find service ${id} in the catalog`);
608
614
  }
609
- const path5 = existingResource.split(/[\\/]+services/)[0];
610
- const pathToResource = join6(path5, "services");
615
+ const path6 = existingResource.split(/[\\/]+services/)[0];
616
+ const pathToResource = join6(path6, "services");
611
617
  await rmServiceById(directory)(id, version);
612
618
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
613
619
  };
614
620
 
615
621
  // src/domains.ts
616
622
  import fs6 from "fs/promises";
617
- import path, { join as join7 } from "path";
623
+ import path2, { join as join7 } from "path";
618
624
  import fsSync3 from "fs";
619
625
  import matter3 from "gray-matter";
620
626
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -639,8 +645,8 @@ var writeDomain = (directory) => async (domain, options = {
639
645
  return await writeResource(directory, resource, { ...options, type: "domain" });
640
646
  };
641
647
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
642
- var rmDomain = (directory) => async (path5) => {
643
- await fs6.rm(join7(directory, path5), { recursive: true });
648
+ var rmDomain = (directory) => async (path6) => {
649
+ await fs6.rm(join7(directory, path6), { recursive: true });
644
650
  };
645
651
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
646
652
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -652,7 +658,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
652
658
  };
653
659
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
654
660
  const pathToDomain = await findFileById(directory, id, version) || "";
655
- const pathToUbiquitousLanguage = path.join(path.dirname(pathToDomain), "ubiquitous-language.mdx");
661
+ const pathToUbiquitousLanguage = path2.join(path2.dirname(pathToDomain), "ubiquitous-language.mdx");
656
662
  const fileExists = fsSync3.existsSync(pathToUbiquitousLanguage);
657
663
  if (!fileExists) {
658
664
  return void 0;
@@ -667,7 +673,7 @@ var domainHasVersion = (directory) => async (id, version) => {
667
673
  var addServiceToDomain = (directory) => async (id, service, version) => {
668
674
  let domain = await getDomain(directory)(id, version);
669
675
  const domainPath = await getResourcePath(directory, id, version);
670
- const extension = path.extname(domainPath?.fullPath || "");
676
+ const extension = path2.extname(domainPath?.fullPath || "");
671
677
  if (domain.services === void 0) {
672
678
  domain.services = [];
673
679
  }
@@ -682,7 +688,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
682
688
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
683
689
  let domain = await getDomain(directory)(id, version);
684
690
  const domainPath = await getResourcePath(directory, id, version);
685
- const extension = path.extname(domainPath?.fullPath || "");
691
+ const extension = path2.extname(domainPath?.fullPath || "");
686
692
  if (domain.domains === void 0) {
687
693
  domain.domains = [];
688
694
  }
@@ -697,7 +703,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
697
703
  var addEntityToDomain = (directory) => async (id, entity, version) => {
698
704
  let domain = await getDomain(directory)(id, version);
699
705
  const domainPath = await getResourcePath(directory, id, version);
700
- const extension = path.extname(domainPath?.fullPath || "");
706
+ const extension = path2.extname(domainPath?.fullPath || "");
701
707
  if (domain.entities === void 0) {
702
708
  domain.entities = [];
703
709
  }
@@ -716,8 +722,8 @@ import { join as join8, extname as extname2 } from "path";
716
722
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
717
723
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
718
724
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
719
- var rmChannel = (directory) => async (path5) => {
720
- await fs7.rm(join8(directory, path5), { recursive: true });
725
+ var rmChannel = (directory) => async (path6) => {
726
+ await fs7.rm(join8(directory, path6), { recursive: true });
721
727
  };
722
728
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
723
729
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -758,8 +764,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
758
764
  if (!existingResource) {
759
765
  throw new Error(`Cannot find message ${id} in the catalog`);
760
766
  }
761
- const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
762
- const pathToResource = join8(path5, collection);
767
+ const path6 = existingResource.split(`/[\\/]+${collection}`)[0];
768
+ const pathToResource = join8(path6, collection);
763
769
  await rmMessageById(directory)(_message.id, _message.version, true);
764
770
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
765
771
  };
@@ -768,8 +774,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
768
774
  import { dirname as dirname5 } from "path";
769
775
  import matter4 from "gray-matter";
770
776
  import { satisfies as satisfies3, validRange as validRange2 } from "semver";
771
- var getMessageBySchemaPath = (directory) => async (path5, options) => {
772
- const pathToMessage = dirname5(path5);
777
+ var getMessageBySchemaPath = (directory) => async (path6, options) => {
778
+ const pathToMessage = dirname5(path6);
773
779
  try {
774
780
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
775
781
  if (!files || files.length === 0) {
@@ -841,18 +847,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
841
847
  }
842
848
  return { producers, consumers };
843
849
  };
844
- var getConsumersOfSchema = (directory) => async (path5) => {
850
+ var getConsumersOfSchema = (directory) => async (path6) => {
845
851
  try {
846
- const message = await getMessageBySchemaPath(directory)(path5);
852
+ const message = await getMessageBySchemaPath(directory)(path6);
847
853
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
848
854
  return consumers;
849
855
  } catch (error) {
850
856
  return [];
851
857
  }
852
858
  };
853
- var getProducersOfSchema = (directory) => async (path5) => {
859
+ var getProducersOfSchema = (directory) => async (path6) => {
854
860
  try {
855
- const message = await getMessageBySchemaPath(directory)(path5);
861
+ const message = await getMessageBySchemaPath(directory)(path6);
856
862
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
857
863
  return producers;
858
864
  } catch (error) {
@@ -861,13 +867,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
861
867
  };
862
868
 
863
869
  // src/custom-docs.ts
864
- import path2, { join as join10 } from "path";
870
+ import path3, { join as join10 } from "path";
865
871
  import fsSync4 from "fs";
866
872
  import fs8 from "fs/promises";
867
873
  import matter5 from "gray-matter";
868
874
  import slugify from "slugify";
869
875
  var getCustomDoc = (directory) => async (filePath) => {
870
- const fullPath = path2.join(directory, filePath);
876
+ const fullPath = path3.join(directory, filePath);
871
877
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
872
878
  const fileExists = fsSync4.existsSync(fullPathWithExtension);
873
879
  if (!fileExists) {
@@ -886,8 +892,8 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
886
892
  const { fileName, ...rest } = customDoc;
887
893
  const name = fileName || slugify(customDoc.title, { lower: true });
888
894
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
889
- const fullPath = path2.join(directory, options.path || "", withExtension);
890
- fsSync4.mkdirSync(path2.dirname(fullPath), { recursive: true });
895
+ const fullPath = path3.join(directory, options.path || "", withExtension);
896
+ fsSync4.mkdirSync(path3.dirname(fullPath), { recursive: true });
891
897
  const document = matter5.stringify(customDoc.markdown.trim(), rest);
892
898
  fsSync4.writeFileSync(fullPath, document);
893
899
  };
@@ -901,7 +907,7 @@ import fs9 from "fs/promises";
901
907
  import fsSync6 from "fs";
902
908
  import { join as join12 } from "path";
903
909
  import matter7 from "gray-matter";
904
- import path3 from "path";
910
+ import path4 from "path";
905
911
 
906
912
  // src/users.ts
907
913
  import fsSync5 from "fs";
@@ -997,11 +1003,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
997
1003
  if (!resource) return [];
998
1004
  if (!resource.owners) return [];
999
1005
  for (const owner of resource.owners) {
1000
- const team = await getTeam(path3.join(catalogDir, "teams"))(owner);
1006
+ const team = await getTeam(path4.join(catalogDir, "teams"))(owner);
1001
1007
  if (team) {
1002
1008
  owners.push(team);
1003
1009
  } else {
1004
- const user = await getUser(path3.join(catalogDir, "users"))(owner);
1010
+ const user = await getUser(path4.join(catalogDir, "users"))(owner);
1005
1011
  if (user) {
1006
1012
  owners.push(user);
1007
1013
  }
@@ -1020,8 +1026,8 @@ var writeEntity = (directory) => async (entity, options = {
1020
1026
  override: false,
1021
1027
  format: "mdx"
1022
1028
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1023
- var rmEntity = (directory) => async (path5) => {
1024
- await fs10.rm(join13(directory, path5), { recursive: true });
1029
+ var rmEntity = (directory) => async (path6) => {
1030
+ await fs10.rm(join13(directory, path6), { recursive: true });
1025
1031
  };
1026
1032
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1027
1033
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1043,8 +1049,8 @@ var writeContainer = (directory) => async (data, options = {
1043
1049
  format: "mdx"
1044
1050
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1045
1051
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
1046
- var rmContainer = (directory) => async (path5) => {
1047
- await fs11.rm(join14(directory, path5), { recursive: true });
1052
+ var rmContainer = (directory) => async (path6) => {
1053
+ await fs11.rm(join14(directory, path6), { recursive: true });
1048
1054
  };
1049
1055
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
1050
1056
  await rmResourceById(directory, id, version, { type: "container", persistFiles });
@@ -1076,7 +1082,7 @@ var addFileToDataStore = addFileToContainer;
1076
1082
  var writeDataStoreToService = writeContainerToService;
1077
1083
 
1078
1084
  // src/index.ts
1079
- var index_default = (path5) => {
1085
+ var index_default = (path6) => {
1080
1086
  return {
1081
1087
  /**
1082
1088
  * Returns an events from EventCatalog
@@ -1084,13 +1090,13 @@ var index_default = (path5) => {
1084
1090
  * @param version - Optional id of the version to get (supports semver)
1085
1091
  * @returns Event|Undefined
1086
1092
  */
1087
- getEvent: getEvent(join15(path5)),
1093
+ getEvent: getEvent(join15(path6)),
1088
1094
  /**
1089
1095
  * Returns all events from EventCatalog
1090
1096
  * @param latestOnly - optional boolean, set to true to get only latest versions
1091
1097
  * @returns Event[]|Undefined
1092
1098
  */
1093
- getEvents: getEvents(join15(path5)),
1099
+ getEvents: getEvents(join15(path6)),
1094
1100
  /**
1095
1101
  * Adds an event to EventCatalog
1096
1102
  *
@@ -1098,7 +1104,7 @@ var index_default = (path5) => {
1098
1104
  * @param options - Optional options to write the event
1099
1105
  *
1100
1106
  */
1101
- writeEvent: writeEvent(join15(path5, "events")),
1107
+ writeEvent: writeEvent(join15(path6, "events")),
1102
1108
  /**
1103
1109
  * Adds an event to a service in EventCatalog
1104
1110
  *
@@ -1107,26 +1113,26 @@ var index_default = (path5) => {
1107
1113
  * @param options - Optional options to write the event
1108
1114
  *
1109
1115
  */
1110
- writeEventToService: writeEventToService(join15(path5)),
1116
+ writeEventToService: writeEventToService(join15(path6)),
1111
1117
  /**
1112
1118
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1113
1119
  *
1114
1120
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1115
1121
  *
1116
1122
  */
1117
- rmEvent: rmEvent(join15(path5, "events")),
1123
+ rmEvent: rmEvent(join15(path6, "events")),
1118
1124
  /**
1119
1125
  * Remove an event by an Event id
1120
1126
  *
1121
1127
  * @param id - The id of the event you want to remove
1122
1128
  *
1123
1129
  */
1124
- rmEventById: rmEventById(join15(path5)),
1130
+ rmEventById: rmEventById(join15(path6)),
1125
1131
  /**
1126
1132
  * Moves a given event id to the version directory
1127
1133
  * @param directory
1128
1134
  */
1129
- versionEvent: versionEvent(join15(path5)),
1135
+ versionEvent: versionEvent(join15(path6)),
1130
1136
  /**
1131
1137
  * Adds a file to the given event
1132
1138
  * @param id - The id of the event to add the file to
@@ -1134,7 +1140,7 @@ var index_default = (path5) => {
1134
1140
  * @param version - Optional version of the event to add the file to
1135
1141
  * @returns
1136
1142
  */
1137
- addFileToEvent: addFileToEvent(join15(path5)),
1143
+ addFileToEvent: addFileToEvent(join15(path6)),
1138
1144
  /**
1139
1145
  * Adds a schema to the given event
1140
1146
  * @param id - The id of the event to add the schema to
@@ -1142,14 +1148,14 @@ var index_default = (path5) => {
1142
1148
  * @param version - Optional version of the event to add the schema to
1143
1149
  * @returns
1144
1150
  */
1145
- addSchemaToEvent: addSchemaToEvent(join15(path5)),
1151
+ addSchemaToEvent: addSchemaToEvent(join15(path6)),
1146
1152
  /**
1147
1153
  * Check to see if an event version exists
1148
1154
  * @param id - The id of the event
1149
1155
  * @param version - The version of the event (supports semver)
1150
1156
  * @returns
1151
1157
  */
1152
- eventHasVersion: eventHasVersion(join15(path5)),
1158
+ eventHasVersion: eventHasVersion(join15(path6)),
1153
1159
  /**
1154
1160
  * ================================
1155
1161
  * Commands
@@ -1161,13 +1167,13 @@ var index_default = (path5) => {
1161
1167
  * @param version - Optional id of the version to get (supports semver)
1162
1168
  * @returns Command|Undefined
1163
1169
  */
1164
- getCommand: getCommand(join15(path5)),
1170
+ getCommand: getCommand(join15(path6)),
1165
1171
  /**
1166
1172
  * Returns all commands from EventCatalog
1167
1173
  * @param latestOnly - optional boolean, set to true to get only latest versions
1168
1174
  * @returns Command[]|Undefined
1169
1175
  */
1170
- getCommands: getCommands(join15(path5)),
1176
+ getCommands: getCommands(join15(path6)),
1171
1177
  /**
1172
1178
  * Adds an command to EventCatalog
1173
1179
  *
@@ -1175,7 +1181,7 @@ var index_default = (path5) => {
1175
1181
  * @param options - Optional options to write the command
1176
1182
  *
1177
1183
  */
1178
- writeCommand: writeCommand(join15(path5, "commands")),
1184
+ writeCommand: writeCommand(join15(path6, "commands")),
1179
1185
  /**
1180
1186
  * Adds a command to a service in EventCatalog
1181
1187
  *
@@ -1184,26 +1190,26 @@ var index_default = (path5) => {
1184
1190
  * @param options - Optional options to write the command
1185
1191
  *
1186
1192
  */
1187
- writeCommandToService: writeCommandToService(join15(path5)),
1193
+ writeCommandToService: writeCommandToService(join15(path6)),
1188
1194
  /**
1189
1195
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1190
1196
  *
1191
1197
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1192
1198
  *
1193
1199
  */
1194
- rmCommand: rmCommand(join15(path5, "commands")),
1200
+ rmCommand: rmCommand(join15(path6, "commands")),
1195
1201
  /**
1196
1202
  * Remove an command by an Event id
1197
1203
  *
1198
1204
  * @param id - The id of the command you want to remove
1199
1205
  *
1200
1206
  */
1201
- rmCommandById: rmCommandById(join15(path5)),
1207
+ rmCommandById: rmCommandById(join15(path6)),
1202
1208
  /**
1203
1209
  * Moves a given command id to the version directory
1204
1210
  * @param directory
1205
1211
  */
1206
- versionCommand: versionCommand(join15(path5)),
1212
+ versionCommand: versionCommand(join15(path6)),
1207
1213
  /**
1208
1214
  * Adds a file to the given command
1209
1215
  * @param id - The id of the command to add the file to
@@ -1211,7 +1217,7 @@ var index_default = (path5) => {
1211
1217
  * @param version - Optional version of the command to add the file to
1212
1218
  * @returns
1213
1219
  */
1214
- addFileToCommand: addFileToCommand(join15(path5)),
1220
+ addFileToCommand: addFileToCommand(join15(path6)),
1215
1221
  /**
1216
1222
  * Adds a schema to the given command
1217
1223
  * @param id - The id of the command to add the schema to
@@ -1219,14 +1225,14 @@ var index_default = (path5) => {
1219
1225
  * @param version - Optional version of the command to add the schema to
1220
1226
  * @returns
1221
1227
  */
1222
- addSchemaToCommand: addSchemaToCommand(join15(path5)),
1228
+ addSchemaToCommand: addSchemaToCommand(join15(path6)),
1223
1229
  /**
1224
1230
  * Check to see if a command version exists
1225
1231
  * @param id - The id of the command
1226
1232
  * @param version - The version of the command (supports semver)
1227
1233
  * @returns
1228
1234
  */
1229
- commandHasVersion: commandHasVersion(join15(path5)),
1235
+ commandHasVersion: commandHasVersion(join15(path6)),
1230
1236
  /**
1231
1237
  * ================================
1232
1238
  * Queries
@@ -1238,13 +1244,13 @@ var index_default = (path5) => {
1238
1244
  * @param version - Optional id of the version to get (supports semver)
1239
1245
  * @returns Query|Undefined
1240
1246
  */
1241
- getQuery: getQuery(join15(path5)),
1247
+ getQuery: getQuery(join15(path6)),
1242
1248
  /**
1243
1249
  * Returns all queries from EventCatalog
1244
1250
  * @param latestOnly - optional boolean, set to true to get only latest versions
1245
1251
  * @returns Query[]|Undefined
1246
1252
  */
1247
- getQueries: getQueries(join15(path5)),
1253
+ getQueries: getQueries(join15(path6)),
1248
1254
  /**
1249
1255
  * Adds a query to EventCatalog
1250
1256
  *
@@ -1252,7 +1258,7 @@ var index_default = (path5) => {
1252
1258
  * @param options - Optional options to write the event
1253
1259
  *
1254
1260
  */
1255
- writeQuery: writeQuery(join15(path5, "queries")),
1261
+ writeQuery: writeQuery(join15(path6, "queries")),
1256
1262
  /**
1257
1263
  * Adds a query to a service in EventCatalog
1258
1264
  *
@@ -1261,26 +1267,26 @@ var index_default = (path5) => {
1261
1267
  * @param options - Optional options to write the query
1262
1268
  *
1263
1269
  */
1264
- writeQueryToService: writeQueryToService(join15(path5)),
1270
+ writeQueryToService: writeQueryToService(join15(path6)),
1265
1271
  /**
1266
1272
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1267
1273
  *
1268
1274
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1269
1275
  *
1270
1276
  */
1271
- rmQuery: rmQuery(join15(path5, "queries")),
1277
+ rmQuery: rmQuery(join15(path6, "queries")),
1272
1278
  /**
1273
1279
  * Remove a query by a Query id
1274
1280
  *
1275
1281
  * @param id - The id of the query you want to remove
1276
1282
  *
1277
1283
  */
1278
- rmQueryById: rmQueryById(join15(path5)),
1284
+ rmQueryById: rmQueryById(join15(path6)),
1279
1285
  /**
1280
1286
  * Moves a given query id to the version directory
1281
1287
  * @param directory
1282
1288
  */
1283
- versionQuery: versionQuery(join15(path5)),
1289
+ versionQuery: versionQuery(join15(path6)),
1284
1290
  /**
1285
1291
  * Adds a file to the given query
1286
1292
  * @param id - The id of the query to add the file to
@@ -1288,7 +1294,7 @@ var index_default = (path5) => {
1288
1294
  * @param version - Optional version of the query to add the file to
1289
1295
  * @returns
1290
1296
  */
1291
- addFileToQuery: addFileToQuery(join15(path5)),
1297
+ addFileToQuery: addFileToQuery(join15(path6)),
1292
1298
  /**
1293
1299
  * Adds a schema to the given query
1294
1300
  * @param id - The id of the query to add the schema to
@@ -1296,14 +1302,14 @@ var index_default = (path5) => {
1296
1302
  * @param version - Optional version of the query to add the schema to
1297
1303
  * @returns
1298
1304
  */
1299
- addSchemaToQuery: addSchemaToQuery(join15(path5)),
1305
+ addSchemaToQuery: addSchemaToQuery(join15(path6)),
1300
1306
  /**
1301
1307
  * Check to see if an query version exists
1302
1308
  * @param id - The id of the query
1303
1309
  * @param version - The version of the query (supports semver)
1304
1310
  * @returns
1305
1311
  */
1306
- queryHasVersion: queryHasVersion(join15(path5)),
1312
+ queryHasVersion: queryHasVersion(join15(path6)),
1307
1313
  /**
1308
1314
  * ================================
1309
1315
  * Channels
@@ -1315,13 +1321,13 @@ var index_default = (path5) => {
1315
1321
  * @param version - Optional id of the version to get (supports semver)
1316
1322
  * @returns Channel|Undefined
1317
1323
  */
1318
- getChannel: getChannel(join15(path5)),
1324
+ getChannel: getChannel(join15(path6)),
1319
1325
  /**
1320
1326
  * Returns all channels from EventCatalog
1321
1327
  * @param latestOnly - optional boolean, set to true to get only latest versions
1322
1328
  * @returns Channel[]|Undefined
1323
1329
  */
1324
- getChannels: getChannels(join15(path5)),
1330
+ getChannels: getChannels(join15(path6)),
1325
1331
  /**
1326
1332
  * Adds an channel to EventCatalog
1327
1333
  *
@@ -1329,33 +1335,33 @@ var index_default = (path5) => {
1329
1335
  * @param options - Optional options to write the channel
1330
1336
  *
1331
1337
  */
1332
- writeChannel: writeChannel(join15(path5, "channels")),
1338
+ writeChannel: writeChannel(join15(path6, "channels")),
1333
1339
  /**
1334
1340
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1335
1341
  *
1336
1342
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1337
1343
  *
1338
1344
  */
1339
- rmChannel: rmChannel(join15(path5, "channels")),
1345
+ rmChannel: rmChannel(join15(path6, "channels")),
1340
1346
  /**
1341
1347
  * Remove an channel by an Event id
1342
1348
  *
1343
1349
  * @param id - The id of the channel you want to remove
1344
1350
  *
1345
1351
  */
1346
- rmChannelById: rmChannelById(join15(path5)),
1352
+ rmChannelById: rmChannelById(join15(path6)),
1347
1353
  /**
1348
1354
  * Moves a given channel id to the version directory
1349
1355
  * @param directory
1350
1356
  */
1351
- versionChannel: versionChannel(join15(path5)),
1357
+ versionChannel: versionChannel(join15(path6)),
1352
1358
  /**
1353
1359
  * Check to see if a channel version exists
1354
1360
  * @param id - The id of the channel
1355
1361
  * @param version - The version of the channel (supports semver)
1356
1362
  * @returns
1357
1363
  */
1358
- channelHasVersion: channelHasVersion(join15(path5)),
1364
+ channelHasVersion: channelHasVersion(join15(path6)),
1359
1365
  /**
1360
1366
  * Add a channel to an event
1361
1367
  *
@@ -1372,7 +1378,7 @@ var index_default = (path5) => {
1372
1378
  *
1373
1379
  * ```
1374
1380
  */
1375
- addEventToChannel: addMessageToChannel(join15(path5), "events"),
1381
+ addEventToChannel: addMessageToChannel(join15(path6), "events"),
1376
1382
  /**
1377
1383
  * Add a channel to an command
1378
1384
  *
@@ -1389,7 +1395,7 @@ var index_default = (path5) => {
1389
1395
  *
1390
1396
  * ```
1391
1397
  */
1392
- addCommandToChannel: addMessageToChannel(join15(path5), "commands"),
1398
+ addCommandToChannel: addMessageToChannel(join15(path6), "commands"),
1393
1399
  /**
1394
1400
  * Add a channel to an query
1395
1401
  *
@@ -1406,7 +1412,7 @@ var index_default = (path5) => {
1406
1412
  *
1407
1413
  * ```
1408
1414
  */
1409
- addQueryToChannel: addMessageToChannel(join15(path5), "queries"),
1415
+ addQueryToChannel: addMessageToChannel(join15(path6), "queries"),
1410
1416
  /**
1411
1417
  * ================================
1412
1418
  * SERVICES
@@ -1419,14 +1425,14 @@ var index_default = (path5) => {
1419
1425
  * @param options - Optional options to write the event
1420
1426
  *
1421
1427
  */
1422
- writeService: writeService(join15(path5, "services")),
1428
+ writeService: writeService(join15(path6, "services")),
1423
1429
  /**
1424
1430
  * Adds a versioned service to EventCatalog
1425
1431
  *
1426
1432
  * @param service - The service to write
1427
1433
  *
1428
1434
  */
1429
- writeVersionedService: writeVersionedService(join15(path5, "services")),
1435
+ writeVersionedService: writeVersionedService(join15(path6, "services")),
1430
1436
  /**
1431
1437
  * Adds a service to a domain in EventCatalog
1432
1438
  *
@@ -1435,45 +1441,45 @@ var index_default = (path5) => {
1435
1441
  * @param options - Optional options to write the event
1436
1442
  *
1437
1443
  */
1438
- writeServiceToDomain: writeServiceToDomain(join15(path5, "domains")),
1444
+ writeServiceToDomain: writeServiceToDomain(join15(path6, "domains")),
1439
1445
  /**
1440
1446
  * Returns a service from EventCatalog
1441
1447
  * @param id - The id of the service to retrieve
1442
1448
  * @param version - Optional id of the version to get (supports semver)
1443
1449
  * @returns Service|Undefined
1444
1450
  */
1445
- getService: getService(join15(path5)),
1451
+ getService: getService(join15(path6)),
1446
1452
  /**
1447
1453
  * Returns a service from EventCatalog by it's path.
1448
1454
  * @param path - The path to the service to retrieve
1449
1455
  * @returns Service|Undefined
1450
1456
  */
1451
- getServiceByPath: getServiceByPath(join15(path5)),
1457
+ getServiceByPath: getServiceByPath(join15(path6)),
1452
1458
  /**
1453
1459
  * Returns all services from EventCatalog
1454
1460
  * @param latestOnly - optional boolean, set to true to get only latest versions
1455
1461
  * @returns Service[]|Undefined
1456
1462
  */
1457
- getServices: getServices(join15(path5)),
1463
+ getServices: getServices(join15(path6)),
1458
1464
  /**
1459
1465
  * Moves a given service id to the version directory
1460
1466
  * @param directory
1461
1467
  */
1462
- versionService: versionService(join15(path5)),
1468
+ versionService: versionService(join15(path6)),
1463
1469
  /**
1464
1470
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1465
1471
  *
1466
1472
  * @param path - The path to your service, e.g. `/InventoryService`
1467
1473
  *
1468
1474
  */
1469
- rmService: rmService(join15(path5, "services")),
1475
+ rmService: rmService(join15(path6, "services")),
1470
1476
  /**
1471
1477
  * Remove an service by an service id
1472
1478
  *
1473
1479
  * @param id - The id of the service you want to remove
1474
1480
  *
1475
1481
  */
1476
- rmServiceById: rmServiceById(join15(path5)),
1482
+ rmServiceById: rmServiceById(join15(path6)),
1477
1483
  /**
1478
1484
  * Adds a file to the given service
1479
1485
  * @param id - The id of the service to add the file to
@@ -1481,21 +1487,21 @@ var index_default = (path5) => {
1481
1487
  * @param version - Optional version of the service to add the file to
1482
1488
  * @returns
1483
1489
  */
1484
- addFileToService: addFileToService(join15(path5)),
1490
+ addFileToService: addFileToService(join15(path6)),
1485
1491
  /**
1486
1492
  * Returns the specifications for a given service
1487
1493
  * @param id - The id of the service to retrieve the specifications for
1488
1494
  * @param version - Optional version of the service
1489
1495
  * @returns
1490
1496
  */
1491
- getSpecificationFilesForService: getSpecificationFilesForService(join15(path5)),
1497
+ getSpecificationFilesForService: getSpecificationFilesForService(join15(path6)),
1492
1498
  /**
1493
1499
  * Check to see if a service version exists
1494
1500
  * @param id - The id of the service
1495
1501
  * @param version - The version of the service (supports semver)
1496
1502
  * @returns
1497
1503
  */
1498
- serviceHasVersion: serviceHasVersion(join15(path5)),
1504
+ serviceHasVersion: serviceHasVersion(join15(path6)),
1499
1505
  /**
1500
1506
  * Add an event to a service by it's id.
1501
1507
  *
@@ -1515,7 +1521,7 @@ var index_default = (path5) => {
1515
1521
  *
1516
1522
  * ```
1517
1523
  */
1518
- addEventToService: addMessageToService(join15(path5)),
1524
+ addEventToService: addMessageToService(join15(path6)),
1519
1525
  /**
1520
1526
  * Add a data store to a service by it's id.
1521
1527
  *
@@ -1532,7 +1538,7 @@ var index_default = (path5) => {
1532
1538
  *
1533
1539
  * ```
1534
1540
  */
1535
- addDataStoreToService: addDataStoreToService(join15(path5)),
1541
+ addDataStoreToService: addDataStoreToService(join15(path6)),
1536
1542
  /**
1537
1543
  * Add a command to a service by it's id.
1538
1544
  *
@@ -1552,7 +1558,7 @@ var index_default = (path5) => {
1552
1558
  *
1553
1559
  * ```
1554
1560
  */
1555
- addCommandToService: addMessageToService(join15(path5)),
1561
+ addCommandToService: addMessageToService(join15(path6)),
1556
1562
  /**
1557
1563
  * Add a query to a service by it's id.
1558
1564
  *
@@ -1572,7 +1578,7 @@ var index_default = (path5) => {
1572
1578
  *
1573
1579
  * ```
1574
1580
  */
1575
- addQueryToService: addMessageToService(join15(path5)),
1581
+ addQueryToService: addMessageToService(join15(path6)),
1576
1582
  /**
1577
1583
  * Add an entity to a service by its id.
1578
1584
  *
@@ -1590,7 +1596,7 @@ var index_default = (path5) => {
1590
1596
  *
1591
1597
  * ```
1592
1598
  */
1593
- addEntityToService: addEntityToService(join15(path5)),
1599
+ addEntityToService: addEntityToService(join15(path6)),
1594
1600
  /**
1595
1601
  * Check to see if a service exists by it's path.
1596
1602
  *
@@ -1607,13 +1613,13 @@ var index_default = (path5) => {
1607
1613
  * @param path - The path to the service to check
1608
1614
  * @returns boolean
1609
1615
  */
1610
- isService: isService(join15(path5)),
1616
+ isService: isService(join15(path6)),
1611
1617
  /**
1612
1618
  * Converts a file to a service.
1613
1619
  * @param file - The file to convert to a service.
1614
1620
  * @returns The service.
1615
1621
  */
1616
- toService: toService(join15(path5)),
1622
+ toService: toService(join15(path6)),
1617
1623
  /**
1618
1624
  * ================================
1619
1625
  * Domains
@@ -1626,39 +1632,39 @@ var index_default = (path5) => {
1626
1632
  * @param options - Optional options to write the event
1627
1633
  *
1628
1634
  */
1629
- writeDomain: writeDomain(join15(path5, "domains")),
1635
+ writeDomain: writeDomain(join15(path6, "domains")),
1630
1636
  /**
1631
1637
  * Returns a domain from EventCatalog
1632
1638
  * @param id - The id of the domain to retrieve
1633
1639
  * @param version - Optional id of the version to get (supports semver)
1634
1640
  * @returns Domain|Undefined
1635
1641
  */
1636
- getDomain: getDomain(join15(path5, "domains")),
1642
+ getDomain: getDomain(join15(path6, "domains")),
1637
1643
  /**
1638
1644
  * Returns all domains from EventCatalog
1639
1645
  * @param latestOnly - optional boolean, set to true to get only latest versions
1640
1646
  * @returns Domain[]|Undefined
1641
1647
  */
1642
- getDomains: getDomains(join15(path5)),
1648
+ getDomains: getDomains(join15(path6)),
1643
1649
  /**
1644
1650
  * Moves a given domain id to the version directory
1645
1651
  * @param directory
1646
1652
  */
1647
- versionDomain: versionDomain(join15(path5, "domains")),
1653
+ versionDomain: versionDomain(join15(path6, "domains")),
1648
1654
  /**
1649
1655
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1650
1656
  *
1651
1657
  * @param path - The path to your domain, e.g. `/Payment`
1652
1658
  *
1653
1659
  */
1654
- rmDomain: rmDomain(join15(path5, "domains")),
1660
+ rmDomain: rmDomain(join15(path6, "domains")),
1655
1661
  /**
1656
1662
  * Remove an service by an domain id
1657
1663
  *
1658
1664
  * @param id - The id of the domain you want to remove
1659
1665
  *
1660
1666
  */
1661
- rmDomainById: rmDomainById(join15(path5, "domains")),
1667
+ rmDomainById: rmDomainById(join15(path6, "domains")),
1662
1668
  /**
1663
1669
  * Adds a file to the given domain
1664
1670
  * @param id - The id of the domain to add the file to
@@ -1666,28 +1672,28 @@ var index_default = (path5) => {
1666
1672
  * @param version - Optional version of the domain to add the file to
1667
1673
  * @returns
1668
1674
  */
1669
- addFileToDomain: addFileToDomain(join15(path5, "domains")),
1675
+ addFileToDomain: addFileToDomain(join15(path6, "domains")),
1670
1676
  /**
1671
1677
  * Adds an ubiquitous language dictionary to a domain
1672
1678
  * @param id - The id of the domain to add the ubiquitous language to
1673
1679
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1674
1680
  * @param version - Optional version of the domain to add the ubiquitous language to
1675
1681
  */
1676
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(path5, "domains")),
1682
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(path6, "domains")),
1677
1683
  /**
1678
1684
  * Get the ubiquitous language dictionary from a domain
1679
1685
  * @param id - The id of the domain to get the ubiquitous language from
1680
1686
  * @param version - Optional version of the domain to get the ubiquitous language from
1681
1687
  * @returns
1682
1688
  */
1683
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(path5, "domains")),
1689
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(path6, "domains")),
1684
1690
  /**
1685
1691
  * Check to see if a domain version exists
1686
1692
  * @param id - The id of the domain
1687
1693
  * @param version - The version of the domain (supports semver)
1688
1694
  * @returns
1689
1695
  */
1690
- domainHasVersion: domainHasVersion(join15(path5)),
1696
+ domainHasVersion: domainHasVersion(join15(path6)),
1691
1697
  /**
1692
1698
  * Adds a given service to a domain
1693
1699
  * @param id - The id of the domain
@@ -1695,7 +1701,7 @@ var index_default = (path5) => {
1695
1701
  * @param version - (Optional) The version of the domain to add the service to
1696
1702
  * @returns
1697
1703
  */
1698
- addServiceToDomain: addServiceToDomain(join15(path5, "domains")),
1704
+ addServiceToDomain: addServiceToDomain(join15(path6, "domains")),
1699
1705
  /**
1700
1706
  * Adds a given subdomain to a domain
1701
1707
  * @param id - The id of the domain
@@ -1703,7 +1709,7 @@ var index_default = (path5) => {
1703
1709
  * @param version - (Optional) The version of the domain to add the subdomain to
1704
1710
  * @returns
1705
1711
  */
1706
- addSubDomainToDomain: addSubDomainToDomain(join15(path5, "domains")),
1712
+ addSubDomainToDomain: addSubDomainToDomain(join15(path6, "domains")),
1707
1713
  /**
1708
1714
  * Adds an entity to a domain
1709
1715
  * @param id - The id of the domain
@@ -1711,7 +1717,7 @@ var index_default = (path5) => {
1711
1717
  * @param version - (Optional) The version of the domain to add the entity to
1712
1718
  * @returns
1713
1719
  */
1714
- addEntityToDomain: addEntityToDomain(join15(path5, "domains")),
1720
+ addEntityToDomain: addEntityToDomain(join15(path6, "domains")),
1715
1721
  /**
1716
1722
  * ================================
1717
1723
  * Teams
@@ -1724,25 +1730,25 @@ var index_default = (path5) => {
1724
1730
  * @param options - Optional options to write the team
1725
1731
  *
1726
1732
  */
1727
- writeTeam: writeTeam(join15(path5, "teams")),
1733
+ writeTeam: writeTeam(join15(path6, "teams")),
1728
1734
  /**
1729
1735
  * Returns a team from EventCatalog
1730
1736
  * @param id - The id of the team to retrieve
1731
1737
  * @returns Team|Undefined
1732
1738
  */
1733
- getTeam: getTeam(join15(path5, "teams")),
1739
+ getTeam: getTeam(join15(path6, "teams")),
1734
1740
  /**
1735
1741
  * Returns all teams from EventCatalog
1736
1742
  * @returns Team[]|Undefined
1737
1743
  */
1738
- getTeams: getTeams(join15(path5, "teams")),
1744
+ getTeams: getTeams(join15(path6, "teams")),
1739
1745
  /**
1740
1746
  * Remove a team by the team id
1741
1747
  *
1742
1748
  * @param id - The id of the team you want to remove
1743
1749
  *
1744
1750
  */
1745
- rmTeamById: rmTeamById(join15(path5, "teams")),
1751
+ rmTeamById: rmTeamById(join15(path6, "teams")),
1746
1752
  /**
1747
1753
  * ================================
1748
1754
  * Users
@@ -1755,25 +1761,25 @@ var index_default = (path5) => {
1755
1761
  * @param options - Optional options to write the user
1756
1762
  *
1757
1763
  */
1758
- writeUser: writeUser(join15(path5, "users")),
1764
+ writeUser: writeUser(join15(path6, "users")),
1759
1765
  /**
1760
1766
  * Returns a user from EventCatalog
1761
1767
  * @param id - The id of the user to retrieve
1762
1768
  * @returns User|Undefined
1763
1769
  */
1764
- getUser: getUser(join15(path5, "users")),
1770
+ getUser: getUser(join15(path6, "users")),
1765
1771
  /**
1766
1772
  * Returns all user from EventCatalog
1767
1773
  * @returns User[]|Undefined
1768
1774
  */
1769
- getUsers: getUsers(join15(path5)),
1775
+ getUsers: getUsers(join15(path6)),
1770
1776
  /**
1771
1777
  * Remove a user by the user id
1772
1778
  *
1773
1779
  * @param id - The id of the user you want to remove
1774
1780
  *
1775
1781
  */
1776
- rmUserById: rmUserById(join15(path5, "users")),
1782
+ rmUserById: rmUserById(join15(path6, "users")),
1777
1783
  /**
1778
1784
  * ================================
1779
1785
  * Custom Docs
@@ -1784,32 +1790,32 @@ var index_default = (path5) => {
1784
1790
  * @param path - The path to the custom doc to retrieve
1785
1791
  * @returns CustomDoc|Undefined
1786
1792
  */
1787
- getCustomDoc: getCustomDoc(join15(path5, "docs")),
1793
+ getCustomDoc: getCustomDoc(join15(path6, "docs")),
1788
1794
  /**
1789
1795
  * Returns all custom docs from EventCatalog
1790
1796
  * @param options - Optional options to get custom docs from a specific path
1791
1797
  * @returns CustomDoc[]|Undefined
1792
1798
  */
1793
- getCustomDocs: getCustomDocs(join15(path5, "docs")),
1799
+ getCustomDocs: getCustomDocs(join15(path6, "docs")),
1794
1800
  /**
1795
1801
  * Writes a custom doc to EventCatalog
1796
1802
  * @param customDoc - The custom doc to write
1797
1803
  * @param options - Optional options to write the custom doc
1798
1804
  *
1799
1805
  */
1800
- writeCustomDoc: writeCustomDoc(join15(path5, "docs")),
1806
+ writeCustomDoc: writeCustomDoc(join15(path6, "docs")),
1801
1807
  /**
1802
1808
  * Removes a custom doc from EventCatalog
1803
1809
  * @param path - The path to the custom doc to remove
1804
1810
  *
1805
1811
  */
1806
- rmCustomDoc: rmCustomDoc(join15(path5, "docs")),
1812
+ rmCustomDoc: rmCustomDoc(join15(path6, "docs")),
1807
1813
  /**
1808
1814
  * Dumps the catalog to a JSON file.
1809
1815
  * @param directory - The directory to dump the catalog to
1810
1816
  * @returns A JSON file with the catalog
1811
1817
  */
1812
- dumpCatalog: dumpCatalog(join15(path5)),
1818
+ dumpCatalog: dumpCatalog(join15(path6)),
1813
1819
  /**
1814
1820
  * Returns the event catalog configuration file.
1815
1821
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1817,7 +1823,7 @@ var index_default = (path5) => {
1817
1823
  * @param directory - The directory of the catalog.
1818
1824
  * @returns A JSON object with the configuration for the event catalog.
1819
1825
  */
1820
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(path5)),
1826
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(path6)),
1821
1827
  /**
1822
1828
  * ================================
1823
1829
  * Resources Utils
@@ -1827,6 +1833,10 @@ var index_default = (path5) => {
1827
1833
  * Returns the path to a given resource by id and version
1828
1834
  */
1829
1835
  getResourcePath,
1836
+ /**
1837
+ * Returns the folder name of a given resource
1838
+ */
1839
+ getResourceFolderName,
1830
1840
  /**
1831
1841
  * ================================
1832
1842
  * General Message Utils
@@ -1838,33 +1848,33 @@ var index_default = (path5) => {
1838
1848
  * @param path - The path to the message to retrieve
1839
1849
  * @returns Message|Undefined
1840
1850
  */
1841
- getMessageBySchemaPath: getMessageBySchemaPath(join15(path5)),
1851
+ getMessageBySchemaPath: getMessageBySchemaPath(join15(path6)),
1842
1852
  /**
1843
1853
  * Returns the producers and consumers (services) for a given message
1844
1854
  * @param id - The id of the message to get the producers and consumers for
1845
1855
  * @param version - Optional version of the message
1846
1856
  * @returns { producers: Service[], consumers: Service[] }
1847
1857
  */
1848
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(path5)),
1858
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(path6)),
1849
1859
  /**
1850
1860
  * Returns the consumers of a given schema path
1851
1861
  * @param path - The path to the schema to get the consumers for
1852
1862
  * @returns Service[]
1853
1863
  */
1854
- getConsumersOfSchema: getConsumersOfSchema(join15(path5)),
1864
+ getConsumersOfSchema: getConsumersOfSchema(join15(path6)),
1855
1865
  /**
1856
1866
  * Returns the producers of a given schema path
1857
1867
  * @param path - The path to the schema to get the producers for
1858
1868
  * @returns Service[]
1859
1869
  */
1860
- getProducersOfSchema: getProducersOfSchema(join15(path5)),
1870
+ getProducersOfSchema: getProducersOfSchema(join15(path6)),
1861
1871
  /**
1862
1872
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1863
1873
  * @param id - The id of the resource to get the owners for
1864
1874
  * @param version - Optional version of the resource
1865
1875
  * @returns { owners: User[] }
1866
1876
  */
1867
- getOwnersForResource: getOwnersForResource(join15(path5)),
1877
+ getOwnersForResource: getOwnersForResource(join15(path6)),
1868
1878
  /**
1869
1879
  * ================================
1870
1880
  * Entities
@@ -1876,13 +1886,13 @@ var index_default = (path5) => {
1876
1886
  * @param version - Optional id of the version to get (supports semver)
1877
1887
  * @returns Entity|Undefined
1878
1888
  */
1879
- getEntity: getEntity(join15(path5)),
1889
+ getEntity: getEntity(join15(path6)),
1880
1890
  /**
1881
1891
  * Returns all entities from EventCatalog
1882
1892
  * @param latestOnly - optional boolean, set to true to get only latest versions
1883
1893
  * @returns Entity[]|Undefined
1884
1894
  */
1885
- getEntities: getEntities(join15(path5)),
1895
+ getEntities: getEntities(join15(path6)),
1886
1896
  /**
1887
1897
  * Adds an entity to EventCatalog
1888
1898
  *
@@ -1890,33 +1900,33 @@ var index_default = (path5) => {
1890
1900
  * @param options - Optional options to write the entity
1891
1901
  *
1892
1902
  */
1893
- writeEntity: writeEntity(join15(path5, "entities")),
1903
+ writeEntity: writeEntity(join15(path6, "entities")),
1894
1904
  /**
1895
1905
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1896
1906
  *
1897
1907
  * @param path - The path to your entity, e.g. `/User`
1898
1908
  *
1899
1909
  */
1900
- rmEntity: rmEntity(join15(path5, "entities")),
1910
+ rmEntity: rmEntity(join15(path6, "entities")),
1901
1911
  /**
1902
1912
  * Remove an entity by an entity id
1903
1913
  *
1904
1914
  * @param id - The id of the entity you want to remove
1905
1915
  *
1906
1916
  */
1907
- rmEntityById: rmEntityById(join15(path5)),
1917
+ rmEntityById: rmEntityById(join15(path6)),
1908
1918
  /**
1909
1919
  * Moves a given entity id to the version directory
1910
1920
  * @param id - The id of the entity to version
1911
1921
  */
1912
- versionEntity: versionEntity(join15(path5)),
1922
+ versionEntity: versionEntity(join15(path6)),
1913
1923
  /**
1914
1924
  * Check to see if an entity version exists
1915
1925
  * @param id - The id of the entity
1916
1926
  * @param version - The version of the entity (supports semver)
1917
1927
  * @returns
1918
1928
  */
1919
- entityHasVersion: entityHasVersion(join15(path5)),
1929
+ entityHasVersion: entityHasVersion(join15(path6)),
1920
1930
  /**
1921
1931
  * ================================
1922
1932
  * Data Stores
@@ -1928,42 +1938,42 @@ var index_default = (path5) => {
1928
1938
  * @param options - Optional options to write the data store
1929
1939
  *
1930
1940
  */
1931
- writeDataStore: writeDataStore(join15(path5, "containers")),
1941
+ writeDataStore: writeDataStore(join15(path6, "containers")),
1932
1942
  /**
1933
1943
  * Returns a data store from EventCatalog
1934
1944
  * @param id - The id of the data store to retrieve
1935
1945
  * @param version - Optional id of the version to get (supports semver)
1936
1946
  * @returns Container|Undefined
1937
1947
  */
1938
- getDataStore: getDataStore(join15(path5)),
1948
+ getDataStore: getDataStore(join15(path6)),
1939
1949
  /**
1940
1950
  * Returns all data stores from EventCatalog
1941
1951
  * @param latestOnly - optional boolean, set to true to get only latest versions
1942
1952
  * @returns Container[]|Undefined
1943
1953
  */
1944
- getDataStores: getDataStores(join15(path5)),
1954
+ getDataStores: getDataStores(join15(path6)),
1945
1955
  /**
1946
1956
  * Version a data store by its id
1947
1957
  * @param id - The id of the data store to version
1948
1958
  */
1949
- versionDataStore: versionDataStore(join15(path5, "containers")),
1959
+ versionDataStore: versionDataStore(join15(path6, "containers")),
1950
1960
  /**
1951
1961
  * Remove a data store by its path
1952
1962
  * @param path - The path to the data store to remove
1953
1963
  */
1954
- rmDataStore: rmDataStore(join15(path5, "containers")),
1964
+ rmDataStore: rmDataStore(join15(path6, "containers")),
1955
1965
  /**
1956
1966
  * Remove a data store by its id
1957
1967
  * @param id - The id of the data store to remove
1958
1968
  */
1959
- rmDataStoreById: rmDataStoreById(join15(path5)),
1969
+ rmDataStoreById: rmDataStoreById(join15(path6)),
1960
1970
  /**
1961
1971
  * Check to see if a data store version exists
1962
1972
  * @param id - The id of the data store
1963
1973
  * @param version - The version of the data store (supports semver)
1964
1974
  * @returns
1965
1975
  */
1966
- dataStoreHasVersion: dataStoreHasVersion(join15(path5)),
1976
+ dataStoreHasVersion: dataStoreHasVersion(join15(path6)),
1967
1977
  /**
1968
1978
  * Adds a file to a data store by its id
1969
1979
  * @param id - The id of the data store to add the file to
@@ -1971,14 +1981,14 @@ var index_default = (path5) => {
1971
1981
  * @param version - Optional version of the data store to add the file to
1972
1982
  * @returns
1973
1983
  */
1974
- addFileToDataStore: addFileToDataStore(join15(path5)),
1984
+ addFileToDataStore: addFileToDataStore(join15(path6)),
1975
1985
  /**
1976
1986
  * Writes a data store to a service by its id
1977
1987
  * @param dataStore - The data store to write
1978
1988
  * @param service - The service to write the data store to
1979
1989
  * @returns
1980
1990
  */
1981
- writeDataStoreToService: writeDataStoreToService(join15(path5))
1991
+ writeDataStoreToService: writeDataStoreToService(join15(path6))
1982
1992
  };
1983
1993
  };
1984
1994
 
@@ -1999,7 +2009,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1999
2009
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
2000
2010
  let schema = "";
2001
2011
  if (resource.schemaPath && resourcePath?.fullPath) {
2002
- const pathToSchema = path4.join(path4.dirname(resourcePath?.fullPath), resource.schemaPath);
2012
+ const pathToSchema = path5.join(path5.dirname(resourcePath?.fullPath), resource.schemaPath);
2003
2013
  if (fs12.existsSync(pathToSchema)) {
2004
2014
  schema = fs12.readFileSync(pathToSchema, "utf8");
2005
2015
  }
@@ -2020,8 +2030,8 @@ var filterCollection = (collection, options) => {
2020
2030
  };
2021
2031
  var getEventCatalogConfigurationFile = (directory) => async () => {
2022
2032
  try {
2023
- const path5 = join16(directory, "eventcatalog.config.js");
2024
- const configModule = await import(path5);
2033
+ const path6 = join16(directory, "eventcatalog.config.js");
2034
+ const configModule = await import(path6);
2025
2035
  return configModule.default;
2026
2036
  } catch (error) {
2027
2037
  console.error("Error getting event catalog configuration file", error);