@eventcatalog/sdk 2.7.5 → 2.8.0

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 (54) hide show
  1. package/dist/channels.js +18 -9
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +11 -2
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +14 -5
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +11 -2
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/custom-docs.js +6 -5
  10. package/dist/custom-docs.js.map +1 -1
  11. package/dist/custom-docs.mjs +1 -0
  12. package/dist/custom-docs.mjs.map +1 -1
  13. package/dist/domains.js +17 -8
  14. package/dist/domains.js.map +1 -1
  15. package/dist/domains.mjs +11 -2
  16. package/dist/domains.mjs.map +1 -1
  17. package/dist/entities.js +13 -4
  18. package/dist/entities.js.map +1 -1
  19. package/dist/entities.mjs +11 -2
  20. package/dist/entities.mjs.map +1 -1
  21. package/dist/eventcatalog.js +172 -156
  22. package/dist/eventcatalog.js.map +1 -1
  23. package/dist/eventcatalog.mjs +23 -7
  24. package/dist/eventcatalog.mjs.map +1 -1
  25. package/dist/events.js +14 -5
  26. package/dist/events.js.map +1 -1
  27. package/dist/events.mjs +11 -2
  28. package/dist/events.mjs.map +1 -1
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +172 -156
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +23 -7
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/messages.js +4 -3
  36. package/dist/messages.js.map +1 -1
  37. package/dist/messages.mjs +1 -0
  38. package/dist/messages.mjs.map +1 -1
  39. package/dist/queries.js +14 -5
  40. package/dist/queries.js.map +1 -1
  41. package/dist/queries.mjs +11 -2
  42. package/dist/queries.mjs.map +1 -1
  43. package/dist/services.js +31 -15
  44. package/dist/services.js.map +1 -1
  45. package/dist/services.mjs +23 -7
  46. package/dist/services.mjs.map +1 -1
  47. package/dist/teams.js +9 -8
  48. package/dist/teams.js.map +1 -1
  49. package/dist/teams.mjs +1 -0
  50. package/dist/teams.mjs.map +1 -1
  51. package/dist/types.d.d.mts +9 -2
  52. package/dist/types.d.d.ts +9 -2
  53. package/dist/types.d.js.map +1 -1
  54. package/package.json +1 -1
@@ -35,14 +35,14 @@ __export(eventcatalog_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(eventcatalog_exports);
37
37
  var import_fs = __toESM(require("fs"));
38
- var import_node_path15 = __toESM(require("path"));
38
+ var import_node_path16 = __toESM(require("path"));
39
39
 
40
40
  // src/index.ts
41
- var import_node_path14 = require("path");
41
+ var import_node_path15 = require("path");
42
42
 
43
43
  // src/events.ts
44
44
  var import_promises2 = __toESM(require("fs/promises"));
45
- var import_node_path2 = require("path");
45
+ var import_node_path3 = require("path");
46
46
 
47
47
  // src/internal/utils.ts
48
48
  var import_glob = require("glob");
@@ -159,6 +159,7 @@ var import_promises = __toESM(require("fs/promises"));
159
159
  var import_node_fs2 = __toESM(require("fs"));
160
160
  var import_semver2 = require("semver");
161
161
  var import_proper_lockfile = require("proper-lockfile");
162
+ var import_node_path2 = require("path");
162
163
  var versionResource = async (catalogDir, id) => {
163
164
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
164
165
  const matchedFiles = await searchFilesForId(files, id);
@@ -166,16 +167,24 @@ var versionResource = async (catalogDir, id) => {
166
167
  throw new Error(`No resource found with id: ${id}`);
167
168
  }
168
169
  const file = matchedFiles[0];
169
- const sourceDirectory = (0, import_path.dirname)(file);
170
+ const sourceDirectory = (0, import_path.dirname)(file).replace(/\/versioned?\/[^/]+\//, "/");
170
171
  const { data: { version = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
171
172
  const targetDirectory = getVersionedDirectory(sourceDirectory, version);
172
173
  import_node_fs2.default.mkdirSync(targetDirectory, { recursive: true });
174
+ const ignoreListToCopy = ["events", "commands", "queries", "versioned"];
173
175
  await copyDir(catalogDir, sourceDirectory, targetDirectory, (src) => {
174
- return !src.includes("versioned");
176
+ const folderName = (0, import_node_path2.basename)(src);
177
+ if (ignoreListToCopy.includes(folderName)) {
178
+ return false;
179
+ }
180
+ return true;
175
181
  });
176
182
  await import_promises.default.readdir(sourceDirectory).then(async (resourceFiles) => {
177
183
  await Promise.all(
178
184
  resourceFiles.map(async (file2) => {
185
+ if (ignoreListToCopy.includes(file2)) {
186
+ return;
187
+ }
179
188
  if (file2 !== "versioned") {
180
189
  import_node_fs2.default.rmSync((0, import_path.join)(sourceDirectory, file2), { recursive: true });
181
190
  }
@@ -371,11 +380,11 @@ var writeEventToService = (directory) => async (event, service, options = { path
371
380
  throw new Error("Service not found");
372
381
  }
373
382
  let pathForEvent = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/events` : `${resourcePath.directory}/events`;
374
- pathForEvent = (0, import_node_path2.join)(pathForEvent, event.id);
383
+ pathForEvent = (0, import_node_path3.join)(pathForEvent, event.id);
375
384
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
376
385
  };
377
386
  var rmEvent = (directory) => async (path5) => {
378
- await import_promises2.default.rm((0, import_node_path2.join)(directory, path5), { recursive: true });
387
+ await import_promises2.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
379
388
  };
380
389
  var rmEventById = (directory) => async (id, version, persistFiles) => {
381
390
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -392,7 +401,7 @@ var eventHasVersion = (directory) => async (id, version) => {
392
401
 
393
402
  // src/commands.ts
394
403
  var import_promises3 = __toESM(require("fs/promises"));
395
- var import_node_path3 = require("path");
404
+ var import_node_path4 = require("path");
396
405
  var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
397
406
  var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
398
407
  var writeCommand = (directory) => async (command, options = {
@@ -407,11 +416,11 @@ var writeCommandToService = (directory) => async (command, service, options = {
407
416
  throw new Error("Service not found");
408
417
  }
409
418
  let pathForCommand = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/commands` : `${resourcePath.directory}/commands`;
410
- pathForCommand = (0, import_node_path3.join)(pathForCommand, command.id);
419
+ pathForCommand = (0, import_node_path4.join)(pathForCommand, command.id);
411
420
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
412
421
  };
413
422
  var rmCommand = (directory) => async (path5) => {
414
- await import_promises3.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
423
+ await import_promises3.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
415
424
  };
416
425
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
417
426
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -426,7 +435,7 @@ var commandHasVersion = (directory) => async (id, version) => {
426
435
 
427
436
  // src/queries.ts
428
437
  var import_promises4 = __toESM(require("fs/promises"));
429
- var import_node_path4 = require("path");
438
+ var import_node_path5 = require("path");
430
439
  var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
431
440
  var writeQuery = (directory) => async (query, options = {
432
441
  path: "",
@@ -441,11 +450,11 @@ var writeQueryToService = (directory) => async (query, service, options = { path
441
450
  throw new Error("Service not found");
442
451
  }
443
452
  let pathForQuery = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/queries` : `${resourcePath.directory}/queries`;
444
- pathForQuery = (0, import_node_path4.join)(pathForQuery, query.id);
453
+ pathForQuery = (0, import_node_path5.join)(pathForQuery, query.id);
445
454
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
446
455
  };
447
456
  var rmQuery = (directory) => async (path5) => {
448
- await import_promises4.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
457
+ await import_promises4.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
449
458
  };
450
459
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
451
460
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -462,7 +471,7 @@ var queryHasVersion = (directory) => async (id, version) => {
462
471
 
463
472
  // src/services.ts
464
473
  var import_promises5 = __toESM(require("fs/promises"));
465
- var import_node_path5 = require("path");
474
+ var import_node_path6 = require("path");
466
475
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
467
476
  var getServiceByPath = (directory) => async (path5) => {
468
477
  const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
@@ -494,12 +503,12 @@ var writeVersionedService = (directory) => async (service) => {
494
503
  };
495
504
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
496
505
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
497
- pathForService = (0, import_node_path5.join)(pathForService, service.id);
506
+ pathForService = (0, import_node_path6.join)(pathForService, service.id);
498
507
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
499
508
  };
500
509
  var versionService = (directory) => async (id) => versionResource(directory, id);
501
510
  var rmService = (directory) => async (path5) => {
502
- await import_promises5.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
511
+ await import_promises5.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
503
512
  };
504
513
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
505
514
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -512,14 +521,21 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
512
521
  let specs = [];
513
522
  if (service.specifications) {
514
523
  const serviceSpecifications = service.specifications;
515
- const specificationFiles = Object.keys(serviceSpecifications);
516
- const getSpecs = specificationFiles.map(async (specFile) => {
517
- const fileName = serviceSpecifications[specFile];
524
+ let specificationFiles;
525
+ if (Array.isArray(serviceSpecifications)) {
526
+ specificationFiles = serviceSpecifications.map((spec) => ({ key: spec.type, path: spec.path }));
527
+ } else {
528
+ specificationFiles = Object.keys(serviceSpecifications).map((spec) => ({
529
+ key: spec,
530
+ path: serviceSpecifications[spec]
531
+ }));
532
+ }
533
+ const getSpecs = specificationFiles.map(async ({ key, path: fileName }) => {
518
534
  if (!fileName) {
519
- throw new Error(`Specification file name for ${specFile} is undefined`);
535
+ throw new Error(`Specification file name for ${fileName} is undefined`);
520
536
  }
521
537
  const rawFile = await getFileFromResource(directory, id, { fileName }, version);
522
- return { key: specFile, content: rawFile, fileName, path: (0, import_node_path5.join)((0, import_node_path5.dirname)(filePathToService), fileName) };
538
+ return { key, content: rawFile, fileName, path: (0, import_node_path6.join)((0, import_node_path6.dirname)(filePathToService), fileName) };
523
539
  });
524
540
  specs = await Promise.all(getSpecs);
525
541
  }
@@ -528,7 +544,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
528
544
  var addMessageToService = (directory) => async (id, direction, event, version) => {
529
545
  let service = await getService(directory)(id, version);
530
546
  const servicePath = await getResourcePath(directory, id, version);
531
- const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
547
+ const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
532
548
  if (direction === "sends") {
533
549
  if (service.sends === void 0) {
534
550
  service.sends = [];
@@ -557,7 +573,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
557
573
  throw new Error(`Cannot find service ${id} in the catalog`);
558
574
  }
559
575
  const path5 = existingResource.split(/[\\/]+services/)[0];
560
- const pathToResource = (0, import_node_path5.join)(path5, "services");
576
+ const pathToResource = (0, import_node_path6.join)(path5, "services");
561
577
  await rmServiceById(directory)(id, version);
562
578
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
563
579
  };
@@ -567,7 +583,7 @@ var serviceHasVersion = (directory) => async (id, version) => {
567
583
  };
568
584
  var isService = (directory) => async (path5) => {
569
585
  const service = await getServiceByPath(directory)(path5);
570
- const relativePath = (0, import_node_path5.relative)(directory, path5);
586
+ const relativePath = (0, import_node_path6.relative)(directory, path5);
571
587
  const segments = relativePath.split(/[/\\]+/);
572
588
  return !!service && segments.includes("services");
573
589
  };
@@ -575,7 +591,7 @@ var toService = (directory) => async (file) => toResource(directory, file);
575
591
  var addEntityToService = (directory) => async (id, entity, version) => {
576
592
  let service = await getService(directory)(id, version);
577
593
  const servicePath = await getResourcePath(directory, id, version);
578
- const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
594
+ const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
579
595
  if (service.entities === void 0) {
580
596
  service.entities = [];
581
597
  }
@@ -590,14 +606,14 @@ var addEntityToService = (directory) => async (id, entity, version) => {
590
606
  throw new Error(`Cannot find service ${id} in the catalog`);
591
607
  }
592
608
  const path5 = existingResource.split(/[\\/]+services/)[0];
593
- const pathToResource = (0, import_node_path5.join)(path5, "services");
609
+ const pathToResource = (0, import_node_path6.join)(path5, "services");
594
610
  await rmServiceById(directory)(id, version);
595
611
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
596
612
  };
597
613
 
598
614
  // src/domains.ts
599
615
  var import_promises6 = __toESM(require("fs/promises"));
600
- var import_node_path6 = __toESM(require("path"));
616
+ var import_node_path7 = __toESM(require("path"));
601
617
  var import_node_fs3 = __toESM(require("fs"));
602
618
  var import_gray_matter3 = __toESM(require("gray-matter"));
603
619
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -623,7 +639,7 @@ var writeDomain = (directory) => async (domain, options = {
623
639
  };
624
640
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
625
641
  var rmDomain = (directory) => async (path5) => {
626
- await import_promises6.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
642
+ await import_promises6.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
627
643
  };
628
644
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
629
645
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -635,7 +651,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
635
651
  };
636
652
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
637
653
  const pathToDomain = await findFileById(directory, id, version) || "";
638
- const pathToUbiquitousLanguage = import_node_path6.default.join(import_node_path6.default.dirname(pathToDomain), "ubiquitous-language.mdx");
654
+ const pathToUbiquitousLanguage = import_node_path7.default.join(import_node_path7.default.dirname(pathToDomain), "ubiquitous-language.mdx");
639
655
  const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
640
656
  if (!fileExists) {
641
657
  return void 0;
@@ -650,7 +666,7 @@ var domainHasVersion = (directory) => async (id, version) => {
650
666
  var addServiceToDomain = (directory) => async (id, service, version) => {
651
667
  let domain = await getDomain(directory)(id, version);
652
668
  const domainPath = await getResourcePath(directory, id, version);
653
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
669
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
654
670
  if (domain.services === void 0) {
655
671
  domain.services = [];
656
672
  }
@@ -665,7 +681,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
665
681
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
666
682
  let domain = await getDomain(directory)(id, version);
667
683
  const domainPath = await getResourcePath(directory, id, version);
668
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
684
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
669
685
  if (domain.domains === void 0) {
670
686
  domain.domains = [];
671
687
  }
@@ -680,7 +696,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
680
696
  var addEntityToDomain = (directory) => async (id, entity, version) => {
681
697
  let domain = await getDomain(directory)(id, version);
682
698
  const domainPath = await getResourcePath(directory, id, version);
683
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
699
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
684
700
  if (domain.entities === void 0) {
685
701
  domain.entities = [];
686
702
  }
@@ -695,12 +711,12 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
695
711
 
696
712
  // src/channels.ts
697
713
  var import_promises7 = __toESM(require("fs/promises"));
698
- var import_node_path7 = require("path");
714
+ var import_node_path8 = require("path");
699
715
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
700
716
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
701
717
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
702
718
  var rmChannel = (directory) => async (path5) => {
703
- await import_promises7.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
719
+ await import_promises7.default.rm((0, import_node_path8.join)(directory, path5), { recursive: true });
704
720
  };
705
721
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
706
722
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -730,7 +746,7 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
730
746
  const { getMessage, rmMessageById, writeMessage } = functions[collection];
731
747
  const message = await getMessage(directory)(_message.id, _message.version);
732
748
  const messagePath = await getResourcePath(directory, _message.id, _message.version);
733
- const extension = (0, import_node_path7.extname)(messagePath?.fullPath || "");
749
+ const extension = (0, import_node_path8.extname)(messagePath?.fullPath || "");
734
750
  if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
735
751
  if (message.channels === void 0) {
736
752
  message.channels = [];
@@ -742,17 +758,17 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
742
758
  throw new Error(`Cannot find message ${id} in the catalog`);
743
759
  }
744
760
  const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
745
- const pathToResource = (0, import_node_path7.join)(path5, collection);
761
+ const pathToResource = (0, import_node_path8.join)(path5, collection);
746
762
  await rmMessageById(directory)(_message.id, _message.version, true);
747
763
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
748
764
  };
749
765
 
750
766
  // src/messages.ts
751
- var import_node_path8 = require("path");
767
+ var import_node_path9 = require("path");
752
768
  var import_gray_matter4 = __toESM(require("gray-matter"));
753
769
  var import_semver3 = require("semver");
754
770
  var getMessageBySchemaPath = (directory) => async (path5, options) => {
755
- const pathToMessage = (0, import_node_path8.dirname)(path5);
771
+ const pathToMessage = (0, import_node_path9.dirname)(path5);
756
772
  try {
757
773
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
758
774
  if (!files || files.length === 0) {
@@ -844,13 +860,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
844
860
  };
845
861
 
846
862
  // src/custom-docs.ts
847
- var import_node_path9 = __toESM(require("path"));
863
+ var import_node_path10 = __toESM(require("path"));
848
864
  var import_node_fs4 = __toESM(require("fs"));
849
865
  var import_promises8 = __toESM(require("fs/promises"));
850
866
  var import_gray_matter5 = __toESM(require("gray-matter"));
851
867
  var import_slugify = __toESM(require("slugify"));
852
868
  var getCustomDoc = (directory) => async (filePath) => {
853
- const fullPath = import_node_path9.default.join(directory, filePath);
869
+ const fullPath = import_node_path10.default.join(directory, filePath);
854
870
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
855
871
  const fileExists = import_node_fs4.default.existsSync(fullPathWithExtension);
856
872
  if (!fileExists) {
@@ -869,26 +885,26 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
869
885
  const { fileName, ...rest } = customDoc;
870
886
  const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
871
887
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
872
- const fullPath = import_node_path9.default.join(directory, options.path || "", withExtension);
873
- import_node_fs4.default.mkdirSync(import_node_path9.default.dirname(fullPath), { recursive: true });
888
+ const fullPath = import_node_path10.default.join(directory, options.path || "", withExtension);
889
+ import_node_fs4.default.mkdirSync(import_node_path10.default.dirname(fullPath), { recursive: true });
874
890
  const document = import_gray_matter5.default.stringify(customDoc.markdown.trim(), rest);
875
891
  import_node_fs4.default.writeFileSync(fullPath, document);
876
892
  };
877
893
  var rmCustomDoc = (directory) => async (filePath) => {
878
894
  const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
879
- await import_promises8.default.rm((0, import_node_path9.join)(directory, withExtension), { recursive: true });
895
+ await import_promises8.default.rm((0, import_node_path10.join)(directory, withExtension), { recursive: true });
880
896
  };
881
897
 
882
898
  // src/teams.ts
883
899
  var import_promises9 = __toESM(require("fs/promises"));
884
900
  var import_node_fs6 = __toESM(require("fs"));
885
- var import_node_path11 = require("path");
901
+ var import_node_path12 = require("path");
886
902
  var import_gray_matter7 = __toESM(require("gray-matter"));
887
- var import_node_path12 = __toESM(require("path"));
903
+ var import_node_path13 = __toESM(require("path"));
888
904
 
889
905
  // src/users.ts
890
906
  var import_node_fs5 = __toESM(require("fs"));
891
- var import_node_path10 = require("path");
907
+ var import_node_path11 = require("path");
892
908
  var import_gray_matter6 = __toESM(require("gray-matter"));
893
909
  var getUser = (catalogDir) => async (id) => {
894
910
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
@@ -926,11 +942,11 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
926
942
  }
927
943
  const { markdown, ...frontmatter } = resource;
928
944
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
929
- import_node_fs5.default.mkdirSync((0, import_node_path10.join)(catalogDir, ""), { recursive: true });
930
- import_node_fs5.default.writeFileSync((0, import_node_path10.join)(catalogDir, "", `${resource.id}.mdx`), document);
945
+ import_node_fs5.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
946
+ import_node_fs5.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
931
947
  };
932
948
  var rmUserById = (catalogDir) => async (id) => {
933
- import_node_fs5.default.rmSync((0, import_node_path10.join)(catalogDir, `${id}.mdx`), { recursive: true });
949
+ import_node_fs5.default.rmSync((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
934
950
  };
935
951
 
936
952
  // src/teams.ts
@@ -968,11 +984,11 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
968
984
  }
969
985
  const { markdown, ...frontmatter } = resource;
970
986
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
971
- import_node_fs6.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
972
- import_node_fs6.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
987
+ import_node_fs6.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
988
+ import_node_fs6.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
973
989
  };
974
990
  var rmTeamById = (catalogDir) => async (id) => {
975
- await import_promises9.default.rm((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
991
+ await import_promises9.default.rm((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
976
992
  };
977
993
  var getOwnersForResource = (catalogDir) => async (id, version) => {
978
994
  const resource = await getResource(catalogDir, id, version);
@@ -980,11 +996,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
980
996
  if (!resource) return [];
981
997
  if (!resource.owners) return [];
982
998
  for (const owner of resource.owners) {
983
- const team = await getTeam(import_node_path12.default.join(catalogDir, "teams"))(owner);
999
+ const team = await getTeam(import_node_path13.default.join(catalogDir, "teams"))(owner);
984
1000
  if (team) {
985
1001
  owners.push(team);
986
1002
  } else {
987
- const user = await getUser(import_node_path12.default.join(catalogDir, "users"))(owner);
1003
+ const user = await getUser(import_node_path13.default.join(catalogDir, "users"))(owner);
988
1004
  if (user) {
989
1005
  owners.push(user);
990
1006
  }
@@ -995,7 +1011,7 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
995
1011
 
996
1012
  // src/entities.ts
997
1013
  var import_promises10 = __toESM(require("fs/promises"));
998
- var import_node_path13 = require("path");
1014
+ var import_node_path14 = require("path");
999
1015
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
1000
1016
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
1001
1017
  var writeEntity = (directory) => async (entity, options = {
@@ -1004,7 +1020,7 @@ var writeEntity = (directory) => async (entity, options = {
1004
1020
  format: "mdx"
1005
1021
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1006
1022
  var rmEntity = (directory) => async (path5) => {
1007
- await import_promises10.default.rm((0, import_node_path13.join)(directory, path5), { recursive: true });
1023
+ await import_promises10.default.rm((0, import_node_path14.join)(directory, path5), { recursive: true });
1008
1024
  };
1009
1025
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1010
1026
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1024,13 +1040,13 @@ var index_default = (path5) => {
1024
1040
  * @param version - Optional id of the version to get (supports semver)
1025
1041
  * @returns Event|Undefined
1026
1042
  */
1027
- getEvent: getEvent((0, import_node_path14.join)(path5)),
1043
+ getEvent: getEvent((0, import_node_path15.join)(path5)),
1028
1044
  /**
1029
1045
  * Returns all events from EventCatalog
1030
1046
  * @param latestOnly - optional boolean, set to true to get only latest versions
1031
1047
  * @returns Event[]|Undefined
1032
1048
  */
1033
- getEvents: getEvents((0, import_node_path14.join)(path5)),
1049
+ getEvents: getEvents((0, import_node_path15.join)(path5)),
1034
1050
  /**
1035
1051
  * Adds an event to EventCatalog
1036
1052
  *
@@ -1038,7 +1054,7 @@ var index_default = (path5) => {
1038
1054
  * @param options - Optional options to write the event
1039
1055
  *
1040
1056
  */
1041
- writeEvent: writeEvent((0, import_node_path14.join)(path5, "events")),
1057
+ writeEvent: writeEvent((0, import_node_path15.join)(path5, "events")),
1042
1058
  /**
1043
1059
  * Adds an event to a service in EventCatalog
1044
1060
  *
@@ -1047,26 +1063,26 @@ var index_default = (path5) => {
1047
1063
  * @param options - Optional options to write the event
1048
1064
  *
1049
1065
  */
1050
- writeEventToService: writeEventToService((0, import_node_path14.join)(path5)),
1066
+ writeEventToService: writeEventToService((0, import_node_path15.join)(path5)),
1051
1067
  /**
1052
1068
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1053
1069
  *
1054
1070
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1055
1071
  *
1056
1072
  */
1057
- rmEvent: rmEvent((0, import_node_path14.join)(path5, "events")),
1073
+ rmEvent: rmEvent((0, import_node_path15.join)(path5, "events")),
1058
1074
  /**
1059
1075
  * Remove an event by an Event id
1060
1076
  *
1061
1077
  * @param id - The id of the event you want to remove
1062
1078
  *
1063
1079
  */
1064
- rmEventById: rmEventById((0, import_node_path14.join)(path5)),
1080
+ rmEventById: rmEventById((0, import_node_path15.join)(path5)),
1065
1081
  /**
1066
1082
  * Moves a given event id to the version directory
1067
1083
  * @param directory
1068
1084
  */
1069
- versionEvent: versionEvent((0, import_node_path14.join)(path5)),
1085
+ versionEvent: versionEvent((0, import_node_path15.join)(path5)),
1070
1086
  /**
1071
1087
  * Adds a file to the given event
1072
1088
  * @param id - The id of the event to add the file to
@@ -1074,7 +1090,7 @@ var index_default = (path5) => {
1074
1090
  * @param version - Optional version of the event to add the file to
1075
1091
  * @returns
1076
1092
  */
1077
- addFileToEvent: addFileToEvent((0, import_node_path14.join)(path5)),
1093
+ addFileToEvent: addFileToEvent((0, import_node_path15.join)(path5)),
1078
1094
  /**
1079
1095
  * Adds a schema to the given event
1080
1096
  * @param id - The id of the event to add the schema to
@@ -1082,14 +1098,14 @@ var index_default = (path5) => {
1082
1098
  * @param version - Optional version of the event to add the schema to
1083
1099
  * @returns
1084
1100
  */
1085
- addSchemaToEvent: addSchemaToEvent((0, import_node_path14.join)(path5)),
1101
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path15.join)(path5)),
1086
1102
  /**
1087
1103
  * Check to see if an event version exists
1088
1104
  * @param id - The id of the event
1089
1105
  * @param version - The version of the event (supports semver)
1090
1106
  * @returns
1091
1107
  */
1092
- eventHasVersion: eventHasVersion((0, import_node_path14.join)(path5)),
1108
+ eventHasVersion: eventHasVersion((0, import_node_path15.join)(path5)),
1093
1109
  /**
1094
1110
  * ================================
1095
1111
  * Commands
@@ -1101,13 +1117,13 @@ var index_default = (path5) => {
1101
1117
  * @param version - Optional id of the version to get (supports semver)
1102
1118
  * @returns Command|Undefined
1103
1119
  */
1104
- getCommand: getCommand((0, import_node_path14.join)(path5)),
1120
+ getCommand: getCommand((0, import_node_path15.join)(path5)),
1105
1121
  /**
1106
1122
  * Returns all commands from EventCatalog
1107
1123
  * @param latestOnly - optional boolean, set to true to get only latest versions
1108
1124
  * @returns Command[]|Undefined
1109
1125
  */
1110
- getCommands: getCommands((0, import_node_path14.join)(path5)),
1126
+ getCommands: getCommands((0, import_node_path15.join)(path5)),
1111
1127
  /**
1112
1128
  * Adds an command to EventCatalog
1113
1129
  *
@@ -1115,7 +1131,7 @@ var index_default = (path5) => {
1115
1131
  * @param options - Optional options to write the command
1116
1132
  *
1117
1133
  */
1118
- writeCommand: writeCommand((0, import_node_path14.join)(path5, "commands")),
1134
+ writeCommand: writeCommand((0, import_node_path15.join)(path5, "commands")),
1119
1135
  /**
1120
1136
  * Adds a command to a service in EventCatalog
1121
1137
  *
@@ -1124,26 +1140,26 @@ var index_default = (path5) => {
1124
1140
  * @param options - Optional options to write the command
1125
1141
  *
1126
1142
  */
1127
- writeCommandToService: writeCommandToService((0, import_node_path14.join)(path5)),
1143
+ writeCommandToService: writeCommandToService((0, import_node_path15.join)(path5)),
1128
1144
  /**
1129
1145
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1130
1146
  *
1131
1147
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1132
1148
  *
1133
1149
  */
1134
- rmCommand: rmCommand((0, import_node_path14.join)(path5, "commands")),
1150
+ rmCommand: rmCommand((0, import_node_path15.join)(path5, "commands")),
1135
1151
  /**
1136
1152
  * Remove an command by an Event id
1137
1153
  *
1138
1154
  * @param id - The id of the command you want to remove
1139
1155
  *
1140
1156
  */
1141
- rmCommandById: rmCommandById((0, import_node_path14.join)(path5)),
1157
+ rmCommandById: rmCommandById((0, import_node_path15.join)(path5)),
1142
1158
  /**
1143
1159
  * Moves a given command id to the version directory
1144
1160
  * @param directory
1145
1161
  */
1146
- versionCommand: versionCommand((0, import_node_path14.join)(path5)),
1162
+ versionCommand: versionCommand((0, import_node_path15.join)(path5)),
1147
1163
  /**
1148
1164
  * Adds a file to the given command
1149
1165
  * @param id - The id of the command to add the file to
@@ -1151,7 +1167,7 @@ var index_default = (path5) => {
1151
1167
  * @param version - Optional version of the command to add the file to
1152
1168
  * @returns
1153
1169
  */
1154
- addFileToCommand: addFileToCommand((0, import_node_path14.join)(path5)),
1170
+ addFileToCommand: addFileToCommand((0, import_node_path15.join)(path5)),
1155
1171
  /**
1156
1172
  * Adds a schema to the given command
1157
1173
  * @param id - The id of the command to add the schema to
@@ -1159,14 +1175,14 @@ var index_default = (path5) => {
1159
1175
  * @param version - Optional version of the command to add the schema to
1160
1176
  * @returns
1161
1177
  */
1162
- addSchemaToCommand: addSchemaToCommand((0, import_node_path14.join)(path5)),
1178
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path15.join)(path5)),
1163
1179
  /**
1164
1180
  * Check to see if a command version exists
1165
1181
  * @param id - The id of the command
1166
1182
  * @param version - The version of the command (supports semver)
1167
1183
  * @returns
1168
1184
  */
1169
- commandHasVersion: commandHasVersion((0, import_node_path14.join)(path5)),
1185
+ commandHasVersion: commandHasVersion((0, import_node_path15.join)(path5)),
1170
1186
  /**
1171
1187
  * ================================
1172
1188
  * Queries
@@ -1178,13 +1194,13 @@ var index_default = (path5) => {
1178
1194
  * @param version - Optional id of the version to get (supports semver)
1179
1195
  * @returns Query|Undefined
1180
1196
  */
1181
- getQuery: getQuery((0, import_node_path14.join)(path5)),
1197
+ getQuery: getQuery((0, import_node_path15.join)(path5)),
1182
1198
  /**
1183
1199
  * Returns all queries from EventCatalog
1184
1200
  * @param latestOnly - optional boolean, set to true to get only latest versions
1185
1201
  * @returns Query[]|Undefined
1186
1202
  */
1187
- getQueries: getQueries((0, import_node_path14.join)(path5)),
1203
+ getQueries: getQueries((0, import_node_path15.join)(path5)),
1188
1204
  /**
1189
1205
  * Adds a query to EventCatalog
1190
1206
  *
@@ -1192,7 +1208,7 @@ var index_default = (path5) => {
1192
1208
  * @param options - Optional options to write the event
1193
1209
  *
1194
1210
  */
1195
- writeQuery: writeQuery((0, import_node_path14.join)(path5, "queries")),
1211
+ writeQuery: writeQuery((0, import_node_path15.join)(path5, "queries")),
1196
1212
  /**
1197
1213
  * Adds a query to a service in EventCatalog
1198
1214
  *
@@ -1201,26 +1217,26 @@ var index_default = (path5) => {
1201
1217
  * @param options - Optional options to write the query
1202
1218
  *
1203
1219
  */
1204
- writeQueryToService: writeQueryToService((0, import_node_path14.join)(path5)),
1220
+ writeQueryToService: writeQueryToService((0, import_node_path15.join)(path5)),
1205
1221
  /**
1206
1222
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1207
1223
  *
1208
1224
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1209
1225
  *
1210
1226
  */
1211
- rmQuery: rmQuery((0, import_node_path14.join)(path5, "queries")),
1227
+ rmQuery: rmQuery((0, import_node_path15.join)(path5, "queries")),
1212
1228
  /**
1213
1229
  * Remove a query by a Query id
1214
1230
  *
1215
1231
  * @param id - The id of the query you want to remove
1216
1232
  *
1217
1233
  */
1218
- rmQueryById: rmQueryById((0, import_node_path14.join)(path5)),
1234
+ rmQueryById: rmQueryById((0, import_node_path15.join)(path5)),
1219
1235
  /**
1220
1236
  * Moves a given query id to the version directory
1221
1237
  * @param directory
1222
1238
  */
1223
- versionQuery: versionQuery((0, import_node_path14.join)(path5)),
1239
+ versionQuery: versionQuery((0, import_node_path15.join)(path5)),
1224
1240
  /**
1225
1241
  * Adds a file to the given query
1226
1242
  * @param id - The id of the query to add the file to
@@ -1228,7 +1244,7 @@ var index_default = (path5) => {
1228
1244
  * @param version - Optional version of the query to add the file to
1229
1245
  * @returns
1230
1246
  */
1231
- addFileToQuery: addFileToQuery((0, import_node_path14.join)(path5)),
1247
+ addFileToQuery: addFileToQuery((0, import_node_path15.join)(path5)),
1232
1248
  /**
1233
1249
  * Adds a schema to the given query
1234
1250
  * @param id - The id of the query to add the schema to
@@ -1236,14 +1252,14 @@ var index_default = (path5) => {
1236
1252
  * @param version - Optional version of the query to add the schema to
1237
1253
  * @returns
1238
1254
  */
1239
- addSchemaToQuery: addSchemaToQuery((0, import_node_path14.join)(path5)),
1255
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path15.join)(path5)),
1240
1256
  /**
1241
1257
  * Check to see if an query version exists
1242
1258
  * @param id - The id of the query
1243
1259
  * @param version - The version of the query (supports semver)
1244
1260
  * @returns
1245
1261
  */
1246
- queryHasVersion: queryHasVersion((0, import_node_path14.join)(path5)),
1262
+ queryHasVersion: queryHasVersion((0, import_node_path15.join)(path5)),
1247
1263
  /**
1248
1264
  * ================================
1249
1265
  * Channels
@@ -1255,13 +1271,13 @@ var index_default = (path5) => {
1255
1271
  * @param version - Optional id of the version to get (supports semver)
1256
1272
  * @returns Channel|Undefined
1257
1273
  */
1258
- getChannel: getChannel((0, import_node_path14.join)(path5)),
1274
+ getChannel: getChannel((0, import_node_path15.join)(path5)),
1259
1275
  /**
1260
1276
  * Returns all channels from EventCatalog
1261
1277
  * @param latestOnly - optional boolean, set to true to get only latest versions
1262
1278
  * @returns Channel[]|Undefined
1263
1279
  */
1264
- getChannels: getChannels((0, import_node_path14.join)(path5)),
1280
+ getChannels: getChannels((0, import_node_path15.join)(path5)),
1265
1281
  /**
1266
1282
  * Adds an channel to EventCatalog
1267
1283
  *
@@ -1269,33 +1285,33 @@ var index_default = (path5) => {
1269
1285
  * @param options - Optional options to write the channel
1270
1286
  *
1271
1287
  */
1272
- writeChannel: writeChannel((0, import_node_path14.join)(path5, "channels")),
1288
+ writeChannel: writeChannel((0, import_node_path15.join)(path5, "channels")),
1273
1289
  /**
1274
1290
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1275
1291
  *
1276
1292
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1277
1293
  *
1278
1294
  */
1279
- rmChannel: rmChannel((0, import_node_path14.join)(path5, "channels")),
1295
+ rmChannel: rmChannel((0, import_node_path15.join)(path5, "channels")),
1280
1296
  /**
1281
1297
  * Remove an channel by an Event id
1282
1298
  *
1283
1299
  * @param id - The id of the channel you want to remove
1284
1300
  *
1285
1301
  */
1286
- rmChannelById: rmChannelById((0, import_node_path14.join)(path5)),
1302
+ rmChannelById: rmChannelById((0, import_node_path15.join)(path5)),
1287
1303
  /**
1288
1304
  * Moves a given channel id to the version directory
1289
1305
  * @param directory
1290
1306
  */
1291
- versionChannel: versionChannel((0, import_node_path14.join)(path5)),
1307
+ versionChannel: versionChannel((0, import_node_path15.join)(path5)),
1292
1308
  /**
1293
1309
  * Check to see if a channel version exists
1294
1310
  * @param id - The id of the channel
1295
1311
  * @param version - The version of the channel (supports semver)
1296
1312
  * @returns
1297
1313
  */
1298
- channelHasVersion: channelHasVersion((0, import_node_path14.join)(path5)),
1314
+ channelHasVersion: channelHasVersion((0, import_node_path15.join)(path5)),
1299
1315
  /**
1300
1316
  * Add a channel to an event
1301
1317
  *
@@ -1312,7 +1328,7 @@ var index_default = (path5) => {
1312
1328
  *
1313
1329
  * ```
1314
1330
  */
1315
- addEventToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "events"),
1331
+ addEventToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "events"),
1316
1332
  /**
1317
1333
  * Add a channel to an command
1318
1334
  *
@@ -1329,7 +1345,7 @@ var index_default = (path5) => {
1329
1345
  *
1330
1346
  * ```
1331
1347
  */
1332
- addCommandToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "commands"),
1348
+ addCommandToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "commands"),
1333
1349
  /**
1334
1350
  * Add a channel to an query
1335
1351
  *
@@ -1346,7 +1362,7 @@ var index_default = (path5) => {
1346
1362
  *
1347
1363
  * ```
1348
1364
  */
1349
- addQueryToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "queries"),
1365
+ addQueryToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "queries"),
1350
1366
  /**
1351
1367
  * ================================
1352
1368
  * SERVICES
@@ -1359,14 +1375,14 @@ var index_default = (path5) => {
1359
1375
  * @param options - Optional options to write the event
1360
1376
  *
1361
1377
  */
1362
- writeService: writeService((0, import_node_path14.join)(path5, "services")),
1378
+ writeService: writeService((0, import_node_path15.join)(path5, "services")),
1363
1379
  /**
1364
1380
  * Adds a versioned service to EventCatalog
1365
1381
  *
1366
1382
  * @param service - The service to write
1367
1383
  *
1368
1384
  */
1369
- writeVersionedService: writeVersionedService((0, import_node_path14.join)(path5, "services")),
1385
+ writeVersionedService: writeVersionedService((0, import_node_path15.join)(path5, "services")),
1370
1386
  /**
1371
1387
  * Adds a service to a domain in EventCatalog
1372
1388
  *
@@ -1375,45 +1391,45 @@ var index_default = (path5) => {
1375
1391
  * @param options - Optional options to write the event
1376
1392
  *
1377
1393
  */
1378
- writeServiceToDomain: writeServiceToDomain((0, import_node_path14.join)(path5, "domains")),
1394
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1379
1395
  /**
1380
1396
  * Returns a service from EventCatalog
1381
1397
  * @param id - The id of the service to retrieve
1382
1398
  * @param version - Optional id of the version to get (supports semver)
1383
1399
  * @returns Service|Undefined
1384
1400
  */
1385
- getService: getService((0, import_node_path14.join)(path5)),
1401
+ getService: getService((0, import_node_path15.join)(path5)),
1386
1402
  /**
1387
1403
  * Returns a service from EventCatalog by it's path.
1388
1404
  * @param path - The path to the service to retrieve
1389
1405
  * @returns Service|Undefined
1390
1406
  */
1391
- getServiceByPath: getServiceByPath((0, import_node_path14.join)(path5)),
1407
+ getServiceByPath: getServiceByPath((0, import_node_path15.join)(path5)),
1392
1408
  /**
1393
1409
  * Returns all services from EventCatalog
1394
1410
  * @param latestOnly - optional boolean, set to true to get only latest versions
1395
1411
  * @returns Service[]|Undefined
1396
1412
  */
1397
- getServices: getServices((0, import_node_path14.join)(path5)),
1413
+ getServices: getServices((0, import_node_path15.join)(path5)),
1398
1414
  /**
1399
1415
  * Moves a given service id to the version directory
1400
1416
  * @param directory
1401
1417
  */
1402
- versionService: versionService((0, import_node_path14.join)(path5)),
1418
+ versionService: versionService((0, import_node_path15.join)(path5)),
1403
1419
  /**
1404
1420
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1405
1421
  *
1406
1422
  * @param path - The path to your service, e.g. `/InventoryService`
1407
1423
  *
1408
1424
  */
1409
- rmService: rmService((0, import_node_path14.join)(path5, "services")),
1425
+ rmService: rmService((0, import_node_path15.join)(path5, "services")),
1410
1426
  /**
1411
1427
  * Remove an service by an service id
1412
1428
  *
1413
1429
  * @param id - The id of the service you want to remove
1414
1430
  *
1415
1431
  */
1416
- rmServiceById: rmServiceById((0, import_node_path14.join)(path5)),
1432
+ rmServiceById: rmServiceById((0, import_node_path15.join)(path5)),
1417
1433
  /**
1418
1434
  * Adds a file to the given service
1419
1435
  * @param id - The id of the service to add the file to
@@ -1421,21 +1437,21 @@ var index_default = (path5) => {
1421
1437
  * @param version - Optional version of the service to add the file to
1422
1438
  * @returns
1423
1439
  */
1424
- addFileToService: addFileToService((0, import_node_path14.join)(path5)),
1440
+ addFileToService: addFileToService((0, import_node_path15.join)(path5)),
1425
1441
  /**
1426
1442
  * Returns the specifications for a given service
1427
1443
  * @param id - The id of the service to retrieve the specifications for
1428
1444
  * @param version - Optional version of the service
1429
1445
  * @returns
1430
1446
  */
1431
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path14.join)(path5)),
1447
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path15.join)(path5)),
1432
1448
  /**
1433
1449
  * Check to see if a service version exists
1434
1450
  * @param id - The id of the service
1435
1451
  * @param version - The version of the service (supports semver)
1436
1452
  * @returns
1437
1453
  */
1438
- serviceHasVersion: serviceHasVersion((0, import_node_path14.join)(path5)),
1454
+ serviceHasVersion: serviceHasVersion((0, import_node_path15.join)(path5)),
1439
1455
  /**
1440
1456
  * Add an event to a service by it's id.
1441
1457
  *
@@ -1455,7 +1471,7 @@ var index_default = (path5) => {
1455
1471
  *
1456
1472
  * ```
1457
1473
  */
1458
- addEventToService: addMessageToService((0, import_node_path14.join)(path5)),
1474
+ addEventToService: addMessageToService((0, import_node_path15.join)(path5)),
1459
1475
  /**
1460
1476
  * Add a command to a service by it's id.
1461
1477
  *
@@ -1475,7 +1491,7 @@ var index_default = (path5) => {
1475
1491
  *
1476
1492
  * ```
1477
1493
  */
1478
- addCommandToService: addMessageToService((0, import_node_path14.join)(path5)),
1494
+ addCommandToService: addMessageToService((0, import_node_path15.join)(path5)),
1479
1495
  /**
1480
1496
  * Add a query to a service by it's id.
1481
1497
  *
@@ -1495,7 +1511,7 @@ var index_default = (path5) => {
1495
1511
  *
1496
1512
  * ```
1497
1513
  */
1498
- addQueryToService: addMessageToService((0, import_node_path14.join)(path5)),
1514
+ addQueryToService: addMessageToService((0, import_node_path15.join)(path5)),
1499
1515
  /**
1500
1516
  * Add an entity to a service by its id.
1501
1517
  *
@@ -1513,7 +1529,7 @@ var index_default = (path5) => {
1513
1529
  *
1514
1530
  * ```
1515
1531
  */
1516
- addEntityToService: addEntityToService((0, import_node_path14.join)(path5)),
1532
+ addEntityToService: addEntityToService((0, import_node_path15.join)(path5)),
1517
1533
  /**
1518
1534
  * Check to see if a service exists by it's path.
1519
1535
  *
@@ -1530,13 +1546,13 @@ var index_default = (path5) => {
1530
1546
  * @param path - The path to the service to check
1531
1547
  * @returns boolean
1532
1548
  */
1533
- isService: isService((0, import_node_path14.join)(path5)),
1549
+ isService: isService((0, import_node_path15.join)(path5)),
1534
1550
  /**
1535
1551
  * Converts a file to a service.
1536
1552
  * @param file - The file to convert to a service.
1537
1553
  * @returns The service.
1538
1554
  */
1539
- toService: toService((0, import_node_path14.join)(path5)),
1555
+ toService: toService((0, import_node_path15.join)(path5)),
1540
1556
  /**
1541
1557
  * ================================
1542
1558
  * Domains
@@ -1549,39 +1565,39 @@ var index_default = (path5) => {
1549
1565
  * @param options - Optional options to write the event
1550
1566
  *
1551
1567
  */
1552
- writeDomain: writeDomain((0, import_node_path14.join)(path5, "domains")),
1568
+ writeDomain: writeDomain((0, import_node_path15.join)(path5, "domains")),
1553
1569
  /**
1554
1570
  * Returns a domain from EventCatalog
1555
1571
  * @param id - The id of the domain to retrieve
1556
1572
  * @param version - Optional id of the version to get (supports semver)
1557
1573
  * @returns Domain|Undefined
1558
1574
  */
1559
- getDomain: getDomain((0, import_node_path14.join)(path5, "domains")),
1575
+ getDomain: getDomain((0, import_node_path15.join)(path5, "domains")),
1560
1576
  /**
1561
1577
  * Returns all domains from EventCatalog
1562
1578
  * @param latestOnly - optional boolean, set to true to get only latest versions
1563
1579
  * @returns Domain[]|Undefined
1564
1580
  */
1565
- getDomains: getDomains((0, import_node_path14.join)(path5)),
1581
+ getDomains: getDomains((0, import_node_path15.join)(path5)),
1566
1582
  /**
1567
1583
  * Moves a given domain id to the version directory
1568
1584
  * @param directory
1569
1585
  */
1570
- versionDomain: versionDomain((0, import_node_path14.join)(path5, "domains")),
1586
+ versionDomain: versionDomain((0, import_node_path15.join)(path5, "domains")),
1571
1587
  /**
1572
1588
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1573
1589
  *
1574
1590
  * @param path - The path to your domain, e.g. `/Payment`
1575
1591
  *
1576
1592
  */
1577
- rmDomain: rmDomain((0, import_node_path14.join)(path5, "domains")),
1593
+ rmDomain: rmDomain((0, import_node_path15.join)(path5, "domains")),
1578
1594
  /**
1579
1595
  * Remove an service by an domain id
1580
1596
  *
1581
1597
  * @param id - The id of the domain you want to remove
1582
1598
  *
1583
1599
  */
1584
- rmDomainById: rmDomainById((0, import_node_path14.join)(path5, "domains")),
1600
+ rmDomainById: rmDomainById((0, import_node_path15.join)(path5, "domains")),
1585
1601
  /**
1586
1602
  * Adds a file to the given domain
1587
1603
  * @param id - The id of the domain to add the file to
@@ -1589,28 +1605,28 @@ var index_default = (path5) => {
1589
1605
  * @param version - Optional version of the domain to add the file to
1590
1606
  * @returns
1591
1607
  */
1592
- addFileToDomain: addFileToDomain((0, import_node_path14.join)(path5, "domains")),
1608
+ addFileToDomain: addFileToDomain((0, import_node_path15.join)(path5, "domains")),
1593
1609
  /**
1594
1610
  * Adds an ubiquitous language dictionary to a domain
1595
1611
  * @param id - The id of the domain to add the ubiquitous language to
1596
1612
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1597
1613
  * @param version - Optional version of the domain to add the ubiquitous language to
1598
1614
  */
1599
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path14.join)(path5, "domains")),
1615
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path15.join)(path5, "domains")),
1600
1616
  /**
1601
1617
  * Get the ubiquitous language dictionary from a domain
1602
1618
  * @param id - The id of the domain to get the ubiquitous language from
1603
1619
  * @param version - Optional version of the domain to get the ubiquitous language from
1604
1620
  * @returns
1605
1621
  */
1606
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path14.join)(path5, "domains")),
1622
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path15.join)(path5, "domains")),
1607
1623
  /**
1608
1624
  * Check to see if a domain version exists
1609
1625
  * @param id - The id of the domain
1610
1626
  * @param version - The version of the domain (supports semver)
1611
1627
  * @returns
1612
1628
  */
1613
- domainHasVersion: domainHasVersion((0, import_node_path14.join)(path5)),
1629
+ domainHasVersion: domainHasVersion((0, import_node_path15.join)(path5)),
1614
1630
  /**
1615
1631
  * Adds a given service to a domain
1616
1632
  * @param id - The id of the domain
@@ -1618,7 +1634,7 @@ var index_default = (path5) => {
1618
1634
  * @param version - (Optional) The version of the domain to add the service to
1619
1635
  * @returns
1620
1636
  */
1621
- addServiceToDomain: addServiceToDomain((0, import_node_path14.join)(path5, "domains")),
1637
+ addServiceToDomain: addServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1622
1638
  /**
1623
1639
  * Adds a given subdomain to a domain
1624
1640
  * @param id - The id of the domain
@@ -1626,7 +1642,7 @@ var index_default = (path5) => {
1626
1642
  * @param version - (Optional) The version of the domain to add the subdomain to
1627
1643
  * @returns
1628
1644
  */
1629
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path14.join)(path5, "domains")),
1645
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path15.join)(path5, "domains")),
1630
1646
  /**
1631
1647
  * Adds an entity to a domain
1632
1648
  * @param id - The id of the domain
@@ -1634,7 +1650,7 @@ var index_default = (path5) => {
1634
1650
  * @param version - (Optional) The version of the domain to add the entity to
1635
1651
  * @returns
1636
1652
  */
1637
- addEntityToDomain: addEntityToDomain((0, import_node_path14.join)(path5, "domains")),
1653
+ addEntityToDomain: addEntityToDomain((0, import_node_path15.join)(path5, "domains")),
1638
1654
  /**
1639
1655
  * ================================
1640
1656
  * Teams
@@ -1647,25 +1663,25 @@ var index_default = (path5) => {
1647
1663
  * @param options - Optional options to write the team
1648
1664
  *
1649
1665
  */
1650
- writeTeam: writeTeam((0, import_node_path14.join)(path5, "teams")),
1666
+ writeTeam: writeTeam((0, import_node_path15.join)(path5, "teams")),
1651
1667
  /**
1652
1668
  * Returns a team from EventCatalog
1653
1669
  * @param id - The id of the team to retrieve
1654
1670
  * @returns Team|Undefined
1655
1671
  */
1656
- getTeam: getTeam((0, import_node_path14.join)(path5, "teams")),
1672
+ getTeam: getTeam((0, import_node_path15.join)(path5, "teams")),
1657
1673
  /**
1658
1674
  * Returns all teams from EventCatalog
1659
1675
  * @returns Team[]|Undefined
1660
1676
  */
1661
- getTeams: getTeams((0, import_node_path14.join)(path5, "teams")),
1677
+ getTeams: getTeams((0, import_node_path15.join)(path5, "teams")),
1662
1678
  /**
1663
1679
  * Remove a team by the team id
1664
1680
  *
1665
1681
  * @param id - The id of the team you want to remove
1666
1682
  *
1667
1683
  */
1668
- rmTeamById: rmTeamById((0, import_node_path14.join)(path5, "teams")),
1684
+ rmTeamById: rmTeamById((0, import_node_path15.join)(path5, "teams")),
1669
1685
  /**
1670
1686
  * ================================
1671
1687
  * Users
@@ -1678,25 +1694,25 @@ var index_default = (path5) => {
1678
1694
  * @param options - Optional options to write the user
1679
1695
  *
1680
1696
  */
1681
- writeUser: writeUser((0, import_node_path14.join)(path5, "users")),
1697
+ writeUser: writeUser((0, import_node_path15.join)(path5, "users")),
1682
1698
  /**
1683
1699
  * Returns a user from EventCatalog
1684
1700
  * @param id - The id of the user to retrieve
1685
1701
  * @returns User|Undefined
1686
1702
  */
1687
- getUser: getUser((0, import_node_path14.join)(path5, "users")),
1703
+ getUser: getUser((0, import_node_path15.join)(path5, "users")),
1688
1704
  /**
1689
1705
  * Returns all user from EventCatalog
1690
1706
  * @returns User[]|Undefined
1691
1707
  */
1692
- getUsers: getUsers((0, import_node_path14.join)(path5)),
1708
+ getUsers: getUsers((0, import_node_path15.join)(path5)),
1693
1709
  /**
1694
1710
  * Remove a user by the user id
1695
1711
  *
1696
1712
  * @param id - The id of the user you want to remove
1697
1713
  *
1698
1714
  */
1699
- rmUserById: rmUserById((0, import_node_path14.join)(path5, "users")),
1715
+ rmUserById: rmUserById((0, import_node_path15.join)(path5, "users")),
1700
1716
  /**
1701
1717
  * ================================
1702
1718
  * Custom Docs
@@ -1707,32 +1723,32 @@ var index_default = (path5) => {
1707
1723
  * @param path - The path to the custom doc to retrieve
1708
1724
  * @returns CustomDoc|Undefined
1709
1725
  */
1710
- getCustomDoc: getCustomDoc((0, import_node_path14.join)(path5, "docs")),
1726
+ getCustomDoc: getCustomDoc((0, import_node_path15.join)(path5, "docs")),
1711
1727
  /**
1712
1728
  * Returns all custom docs from EventCatalog
1713
1729
  * @param options - Optional options to get custom docs from a specific path
1714
1730
  * @returns CustomDoc[]|Undefined
1715
1731
  */
1716
- getCustomDocs: getCustomDocs((0, import_node_path14.join)(path5, "docs")),
1732
+ getCustomDocs: getCustomDocs((0, import_node_path15.join)(path5, "docs")),
1717
1733
  /**
1718
1734
  * Writes a custom doc to EventCatalog
1719
1735
  * @param customDoc - The custom doc to write
1720
1736
  * @param options - Optional options to write the custom doc
1721
1737
  *
1722
1738
  */
1723
- writeCustomDoc: writeCustomDoc((0, import_node_path14.join)(path5, "docs")),
1739
+ writeCustomDoc: writeCustomDoc((0, import_node_path15.join)(path5, "docs")),
1724
1740
  /**
1725
1741
  * Removes a custom doc from EventCatalog
1726
1742
  * @param path - The path to the custom doc to remove
1727
1743
  *
1728
1744
  */
1729
- rmCustomDoc: rmCustomDoc((0, import_node_path14.join)(path5, "docs")),
1745
+ rmCustomDoc: rmCustomDoc((0, import_node_path15.join)(path5, "docs")),
1730
1746
  /**
1731
1747
  * Dumps the catalog to a JSON file.
1732
1748
  * @param directory - The directory to dump the catalog to
1733
1749
  * @returns A JSON file with the catalog
1734
1750
  */
1735
- dumpCatalog: dumpCatalog((0, import_node_path14.join)(path5)),
1751
+ dumpCatalog: dumpCatalog((0, import_node_path15.join)(path5)),
1736
1752
  /**
1737
1753
  * Returns the event catalog configuration file.
1738
1754
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1740,7 +1756,7 @@ var index_default = (path5) => {
1740
1756
  * @param directory - The directory of the catalog.
1741
1757
  * @returns A JSON object with the configuration for the event catalog.
1742
1758
  */
1743
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path14.join)(path5)),
1759
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path15.join)(path5)),
1744
1760
  /**
1745
1761
  * ================================
1746
1762
  * Resources Utils
@@ -1761,33 +1777,33 @@ var index_default = (path5) => {
1761
1777
  * @param path - The path to the message to retrieve
1762
1778
  * @returns Message|Undefined
1763
1779
  */
1764
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path14.join)(path5)),
1780
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path15.join)(path5)),
1765
1781
  /**
1766
1782
  * Returns the producers and consumers (services) for a given message
1767
1783
  * @param id - The id of the message to get the producers and consumers for
1768
1784
  * @param version - Optional version of the message
1769
1785
  * @returns { producers: Service[], consumers: Service[] }
1770
1786
  */
1771
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path14.join)(path5)),
1787
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path15.join)(path5)),
1772
1788
  /**
1773
1789
  * Returns the consumers of a given schema path
1774
1790
  * @param path - The path to the schema to get the consumers for
1775
1791
  * @returns Service[]
1776
1792
  */
1777
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path14.join)(path5)),
1793
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path15.join)(path5)),
1778
1794
  /**
1779
1795
  * Returns the producers of a given schema path
1780
1796
  * @param path - The path to the schema to get the producers for
1781
1797
  * @returns Service[]
1782
1798
  */
1783
- getProducersOfSchema: getProducersOfSchema((0, import_node_path14.join)(path5)),
1799
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path15.join)(path5)),
1784
1800
  /**
1785
1801
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1786
1802
  * @param id - The id of the resource to get the owners for
1787
1803
  * @param version - Optional version of the resource
1788
1804
  * @returns { owners: User[] }
1789
1805
  */
1790
- getOwnersForResource: getOwnersForResource((0, import_node_path14.join)(path5)),
1806
+ getOwnersForResource: getOwnersForResource((0, import_node_path15.join)(path5)),
1791
1807
  /**
1792
1808
  * ================================
1793
1809
  * Entities
@@ -1799,13 +1815,13 @@ var index_default = (path5) => {
1799
1815
  * @param version - Optional id of the version to get (supports semver)
1800
1816
  * @returns Entity|Undefined
1801
1817
  */
1802
- getEntity: getEntity((0, import_node_path14.join)(path5)),
1818
+ getEntity: getEntity((0, import_node_path15.join)(path5)),
1803
1819
  /**
1804
1820
  * Returns all entities from EventCatalog
1805
1821
  * @param latestOnly - optional boolean, set to true to get only latest versions
1806
1822
  * @returns Entity[]|Undefined
1807
1823
  */
1808
- getEntities: getEntities((0, import_node_path14.join)(path5)),
1824
+ getEntities: getEntities((0, import_node_path15.join)(path5)),
1809
1825
  /**
1810
1826
  * Adds an entity to EventCatalog
1811
1827
  *
@@ -1813,33 +1829,33 @@ var index_default = (path5) => {
1813
1829
  * @param options - Optional options to write the entity
1814
1830
  *
1815
1831
  */
1816
- writeEntity: writeEntity((0, import_node_path14.join)(path5, "entities")),
1832
+ writeEntity: writeEntity((0, import_node_path15.join)(path5, "entities")),
1817
1833
  /**
1818
1834
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1819
1835
  *
1820
1836
  * @param path - The path to your entity, e.g. `/User`
1821
1837
  *
1822
1838
  */
1823
- rmEntity: rmEntity((0, import_node_path14.join)(path5, "entities")),
1839
+ rmEntity: rmEntity((0, import_node_path15.join)(path5, "entities")),
1824
1840
  /**
1825
1841
  * Remove an entity by an entity id
1826
1842
  *
1827
1843
  * @param id - The id of the entity you want to remove
1828
1844
  *
1829
1845
  */
1830
- rmEntityById: rmEntityById((0, import_node_path14.join)(path5)),
1846
+ rmEntityById: rmEntityById((0, import_node_path15.join)(path5)),
1831
1847
  /**
1832
1848
  * Moves a given entity id to the version directory
1833
1849
  * @param id - The id of the entity to version
1834
1850
  */
1835
- versionEntity: versionEntity((0, import_node_path14.join)(path5)),
1851
+ versionEntity: versionEntity((0, import_node_path15.join)(path5)),
1836
1852
  /**
1837
1853
  * Check to see if an entity version exists
1838
1854
  * @param id - The id of the entity
1839
1855
  * @param version - The version of the entity (supports semver)
1840
1856
  * @returns
1841
1857
  */
1842
- entityHasVersion: entityHasVersion((0, import_node_path14.join)(path5))
1858
+ entityHasVersion: entityHasVersion((0, import_node_path15.join)(path5))
1843
1859
  };
1844
1860
  };
1845
1861
 
@@ -1847,7 +1863,7 @@ var index_default = (path5) => {
1847
1863
  var DUMP_VERSION = "0.0.1";
1848
1864
  var getEventCatalogVersion = async (catalogDir) => {
1849
1865
  try {
1850
- const packageJson = import_fs.default.readFileSync((0, import_node_path15.join)(catalogDir, "package.json"), "utf8");
1866
+ const packageJson = import_fs.default.readFileSync((0, import_node_path16.join)(catalogDir, "package.json"), "utf8");
1851
1867
  const packageJsonObject = JSON.parse(packageJson);
1852
1868
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
1853
1869
  } catch (error) {
@@ -1860,7 +1876,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1860
1876
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1861
1877
  let schema = "";
1862
1878
  if (resource.schemaPath && resourcePath?.fullPath) {
1863
- const pathToSchema = import_node_path15.default.join(import_node_path15.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1879
+ const pathToSchema = import_node_path16.default.join(import_node_path16.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1864
1880
  if (import_fs.default.existsSync(pathToSchema)) {
1865
1881
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1866
1882
  }
@@ -1881,7 +1897,7 @@ var filterCollection = (collection, options) => {
1881
1897
  };
1882
1898
  var getEventCatalogConfigurationFile = (directory) => async () => {
1883
1899
  try {
1884
- const path5 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
1900
+ const path5 = (0, import_node_path16.join)(directory, "eventcatalog.config.js");
1885
1901
  const configModule = await import(path5);
1886
1902
  return configModule.default;
1887
1903
  } catch (error) {