@eventcatalog/sdk 2.7.6 → 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 (49) 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 +161 -152
  22. package/dist/eventcatalog.js.map +1 -1
  23. package/dist/eventcatalog.mjs +11 -2
  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.js +161 -152
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +11 -2
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/messages.js +4 -3
  34. package/dist/messages.js.map +1 -1
  35. package/dist/messages.mjs +1 -0
  36. package/dist/messages.mjs.map +1 -1
  37. package/dist/queries.js +14 -5
  38. package/dist/queries.js.map +1 -1
  39. package/dist/queries.mjs +11 -2
  40. package/dist/queries.mjs.map +1 -1
  41. package/dist/services.js +20 -11
  42. package/dist/services.js.map +1 -1
  43. package/dist/services.mjs +11 -2
  44. package/dist/services.mjs.map +1 -1
  45. package/dist/teams.js +9 -8
  46. package/dist/teams.js.map +1 -1
  47. package/dist/teams.mjs +1 -0
  48. package/dist/teams.mjs.map +1 -1
  49. 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 });
@@ -526,7 +535,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
526
535
  throw new Error(`Specification file name for ${fileName} is undefined`);
527
536
  }
528
537
  const rawFile = await getFileFromResource(directory, id, { fileName }, version);
529
- return { key, 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) };
530
539
  });
531
540
  specs = await Promise.all(getSpecs);
532
541
  }
@@ -535,7 +544,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
535
544
  var addMessageToService = (directory) => async (id, direction, event, version) => {
536
545
  let service = await getService(directory)(id, version);
537
546
  const servicePath = await getResourcePath(directory, id, version);
538
- const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
547
+ const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
539
548
  if (direction === "sends") {
540
549
  if (service.sends === void 0) {
541
550
  service.sends = [];
@@ -564,7 +573,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
564
573
  throw new Error(`Cannot find service ${id} in the catalog`);
565
574
  }
566
575
  const path5 = existingResource.split(/[\\/]+services/)[0];
567
- const pathToResource = (0, import_node_path5.join)(path5, "services");
576
+ const pathToResource = (0, import_node_path6.join)(path5, "services");
568
577
  await rmServiceById(directory)(id, version);
569
578
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
570
579
  };
@@ -574,7 +583,7 @@ var serviceHasVersion = (directory) => async (id, version) => {
574
583
  };
575
584
  var isService = (directory) => async (path5) => {
576
585
  const service = await getServiceByPath(directory)(path5);
577
- const relativePath = (0, import_node_path5.relative)(directory, path5);
586
+ const relativePath = (0, import_node_path6.relative)(directory, path5);
578
587
  const segments = relativePath.split(/[/\\]+/);
579
588
  return !!service && segments.includes("services");
580
589
  };
@@ -582,7 +591,7 @@ var toService = (directory) => async (file) => toResource(directory, file);
582
591
  var addEntityToService = (directory) => async (id, entity, version) => {
583
592
  let service = await getService(directory)(id, version);
584
593
  const servicePath = await getResourcePath(directory, id, version);
585
- const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
594
+ const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
586
595
  if (service.entities === void 0) {
587
596
  service.entities = [];
588
597
  }
@@ -597,14 +606,14 @@ var addEntityToService = (directory) => async (id, entity, version) => {
597
606
  throw new Error(`Cannot find service ${id} in the catalog`);
598
607
  }
599
608
  const path5 = existingResource.split(/[\\/]+services/)[0];
600
- const pathToResource = (0, import_node_path5.join)(path5, "services");
609
+ const pathToResource = (0, import_node_path6.join)(path5, "services");
601
610
  await rmServiceById(directory)(id, version);
602
611
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
603
612
  };
604
613
 
605
614
  // src/domains.ts
606
615
  var import_promises6 = __toESM(require("fs/promises"));
607
- var import_node_path6 = __toESM(require("path"));
616
+ var import_node_path7 = __toESM(require("path"));
608
617
  var import_node_fs3 = __toESM(require("fs"));
609
618
  var import_gray_matter3 = __toESM(require("gray-matter"));
610
619
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -630,7 +639,7 @@ var writeDomain = (directory) => async (domain, options = {
630
639
  };
631
640
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
632
641
  var rmDomain = (directory) => async (path5) => {
633
- 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 });
634
643
  };
635
644
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
636
645
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -642,7 +651,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
642
651
  };
643
652
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
644
653
  const pathToDomain = await findFileById(directory, id, version) || "";
645
- 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");
646
655
  const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
647
656
  if (!fileExists) {
648
657
  return void 0;
@@ -657,7 +666,7 @@ var domainHasVersion = (directory) => async (id, version) => {
657
666
  var addServiceToDomain = (directory) => async (id, service, version) => {
658
667
  let domain = await getDomain(directory)(id, version);
659
668
  const domainPath = await getResourcePath(directory, id, version);
660
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
669
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
661
670
  if (domain.services === void 0) {
662
671
  domain.services = [];
663
672
  }
@@ -672,7 +681,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
672
681
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
673
682
  let domain = await getDomain(directory)(id, version);
674
683
  const domainPath = await getResourcePath(directory, id, version);
675
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
684
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
676
685
  if (domain.domains === void 0) {
677
686
  domain.domains = [];
678
687
  }
@@ -687,7 +696,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
687
696
  var addEntityToDomain = (directory) => async (id, entity, version) => {
688
697
  let domain = await getDomain(directory)(id, version);
689
698
  const domainPath = await getResourcePath(directory, id, version);
690
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
699
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
691
700
  if (domain.entities === void 0) {
692
701
  domain.entities = [];
693
702
  }
@@ -702,12 +711,12 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
702
711
 
703
712
  // src/channels.ts
704
713
  var import_promises7 = __toESM(require("fs/promises"));
705
- var import_node_path7 = require("path");
714
+ var import_node_path8 = require("path");
706
715
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
707
716
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
708
717
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
709
718
  var rmChannel = (directory) => async (path5) => {
710
- 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 });
711
720
  };
712
721
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
713
722
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -737,7 +746,7 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
737
746
  const { getMessage, rmMessageById, writeMessage } = functions[collection];
738
747
  const message = await getMessage(directory)(_message.id, _message.version);
739
748
  const messagePath = await getResourcePath(directory, _message.id, _message.version);
740
- const extension = (0, import_node_path7.extname)(messagePath?.fullPath || "");
749
+ const extension = (0, import_node_path8.extname)(messagePath?.fullPath || "");
741
750
  if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
742
751
  if (message.channels === void 0) {
743
752
  message.channels = [];
@@ -749,17 +758,17 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
749
758
  throw new Error(`Cannot find message ${id} in the catalog`);
750
759
  }
751
760
  const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
752
- const pathToResource = (0, import_node_path7.join)(path5, collection);
761
+ const pathToResource = (0, import_node_path8.join)(path5, collection);
753
762
  await rmMessageById(directory)(_message.id, _message.version, true);
754
763
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
755
764
  };
756
765
 
757
766
  // src/messages.ts
758
- var import_node_path8 = require("path");
767
+ var import_node_path9 = require("path");
759
768
  var import_gray_matter4 = __toESM(require("gray-matter"));
760
769
  var import_semver3 = require("semver");
761
770
  var getMessageBySchemaPath = (directory) => async (path5, options) => {
762
- const pathToMessage = (0, import_node_path8.dirname)(path5);
771
+ const pathToMessage = (0, import_node_path9.dirname)(path5);
763
772
  try {
764
773
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
765
774
  if (!files || files.length === 0) {
@@ -851,13 +860,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
851
860
  };
852
861
 
853
862
  // src/custom-docs.ts
854
- var import_node_path9 = __toESM(require("path"));
863
+ var import_node_path10 = __toESM(require("path"));
855
864
  var import_node_fs4 = __toESM(require("fs"));
856
865
  var import_promises8 = __toESM(require("fs/promises"));
857
866
  var import_gray_matter5 = __toESM(require("gray-matter"));
858
867
  var import_slugify = __toESM(require("slugify"));
859
868
  var getCustomDoc = (directory) => async (filePath) => {
860
- const fullPath = import_node_path9.default.join(directory, filePath);
869
+ const fullPath = import_node_path10.default.join(directory, filePath);
861
870
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
862
871
  const fileExists = import_node_fs4.default.existsSync(fullPathWithExtension);
863
872
  if (!fileExists) {
@@ -876,26 +885,26 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
876
885
  const { fileName, ...rest } = customDoc;
877
886
  const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
878
887
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
879
- const fullPath = import_node_path9.default.join(directory, options.path || "", withExtension);
880
- 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 });
881
890
  const document = import_gray_matter5.default.stringify(customDoc.markdown.trim(), rest);
882
891
  import_node_fs4.default.writeFileSync(fullPath, document);
883
892
  };
884
893
  var rmCustomDoc = (directory) => async (filePath) => {
885
894
  const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
886
- 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 });
887
896
  };
888
897
 
889
898
  // src/teams.ts
890
899
  var import_promises9 = __toESM(require("fs/promises"));
891
900
  var import_node_fs6 = __toESM(require("fs"));
892
- var import_node_path11 = require("path");
901
+ var import_node_path12 = require("path");
893
902
  var import_gray_matter7 = __toESM(require("gray-matter"));
894
- var import_node_path12 = __toESM(require("path"));
903
+ var import_node_path13 = __toESM(require("path"));
895
904
 
896
905
  // src/users.ts
897
906
  var import_node_fs5 = __toESM(require("fs"));
898
- var import_node_path10 = require("path");
907
+ var import_node_path11 = require("path");
899
908
  var import_gray_matter6 = __toESM(require("gray-matter"));
900
909
  var getUser = (catalogDir) => async (id) => {
901
910
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
@@ -933,11 +942,11 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
933
942
  }
934
943
  const { markdown, ...frontmatter } = resource;
935
944
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
936
- import_node_fs5.default.mkdirSync((0, import_node_path10.join)(catalogDir, ""), { recursive: true });
937
- 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);
938
947
  };
939
948
  var rmUserById = (catalogDir) => async (id) => {
940
- 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 });
941
950
  };
942
951
 
943
952
  // src/teams.ts
@@ -975,11 +984,11 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
975
984
  }
976
985
  const { markdown, ...frontmatter } = resource;
977
986
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
978
- import_node_fs6.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
979
- 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);
980
989
  };
981
990
  var rmTeamById = (catalogDir) => async (id) => {
982
- 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 });
983
992
  };
984
993
  var getOwnersForResource = (catalogDir) => async (id, version) => {
985
994
  const resource = await getResource(catalogDir, id, version);
@@ -987,11 +996,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
987
996
  if (!resource) return [];
988
997
  if (!resource.owners) return [];
989
998
  for (const owner of resource.owners) {
990
- 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);
991
1000
  if (team) {
992
1001
  owners.push(team);
993
1002
  } else {
994
- 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);
995
1004
  if (user) {
996
1005
  owners.push(user);
997
1006
  }
@@ -1002,7 +1011,7 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
1002
1011
 
1003
1012
  // src/entities.ts
1004
1013
  var import_promises10 = __toESM(require("fs/promises"));
1005
- var import_node_path13 = require("path");
1014
+ var import_node_path14 = require("path");
1006
1015
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
1007
1016
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
1008
1017
  var writeEntity = (directory) => async (entity, options = {
@@ -1011,7 +1020,7 @@ var writeEntity = (directory) => async (entity, options = {
1011
1020
  format: "mdx"
1012
1021
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1013
1022
  var rmEntity = (directory) => async (path5) => {
1014
- 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 });
1015
1024
  };
1016
1025
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1017
1026
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1031,13 +1040,13 @@ var index_default = (path5) => {
1031
1040
  * @param version - Optional id of the version to get (supports semver)
1032
1041
  * @returns Event|Undefined
1033
1042
  */
1034
- getEvent: getEvent((0, import_node_path14.join)(path5)),
1043
+ getEvent: getEvent((0, import_node_path15.join)(path5)),
1035
1044
  /**
1036
1045
  * Returns all events from EventCatalog
1037
1046
  * @param latestOnly - optional boolean, set to true to get only latest versions
1038
1047
  * @returns Event[]|Undefined
1039
1048
  */
1040
- getEvents: getEvents((0, import_node_path14.join)(path5)),
1049
+ getEvents: getEvents((0, import_node_path15.join)(path5)),
1041
1050
  /**
1042
1051
  * Adds an event to EventCatalog
1043
1052
  *
@@ -1045,7 +1054,7 @@ var index_default = (path5) => {
1045
1054
  * @param options - Optional options to write the event
1046
1055
  *
1047
1056
  */
1048
- writeEvent: writeEvent((0, import_node_path14.join)(path5, "events")),
1057
+ writeEvent: writeEvent((0, import_node_path15.join)(path5, "events")),
1049
1058
  /**
1050
1059
  * Adds an event to a service in EventCatalog
1051
1060
  *
@@ -1054,26 +1063,26 @@ var index_default = (path5) => {
1054
1063
  * @param options - Optional options to write the event
1055
1064
  *
1056
1065
  */
1057
- writeEventToService: writeEventToService((0, import_node_path14.join)(path5)),
1066
+ writeEventToService: writeEventToService((0, import_node_path15.join)(path5)),
1058
1067
  /**
1059
1068
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1060
1069
  *
1061
1070
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1062
1071
  *
1063
1072
  */
1064
- rmEvent: rmEvent((0, import_node_path14.join)(path5, "events")),
1073
+ rmEvent: rmEvent((0, import_node_path15.join)(path5, "events")),
1065
1074
  /**
1066
1075
  * Remove an event by an Event id
1067
1076
  *
1068
1077
  * @param id - The id of the event you want to remove
1069
1078
  *
1070
1079
  */
1071
- rmEventById: rmEventById((0, import_node_path14.join)(path5)),
1080
+ rmEventById: rmEventById((0, import_node_path15.join)(path5)),
1072
1081
  /**
1073
1082
  * Moves a given event id to the version directory
1074
1083
  * @param directory
1075
1084
  */
1076
- versionEvent: versionEvent((0, import_node_path14.join)(path5)),
1085
+ versionEvent: versionEvent((0, import_node_path15.join)(path5)),
1077
1086
  /**
1078
1087
  * Adds a file to the given event
1079
1088
  * @param id - The id of the event to add the file to
@@ -1081,7 +1090,7 @@ var index_default = (path5) => {
1081
1090
  * @param version - Optional version of the event to add the file to
1082
1091
  * @returns
1083
1092
  */
1084
- addFileToEvent: addFileToEvent((0, import_node_path14.join)(path5)),
1093
+ addFileToEvent: addFileToEvent((0, import_node_path15.join)(path5)),
1085
1094
  /**
1086
1095
  * Adds a schema to the given event
1087
1096
  * @param id - The id of the event to add the schema to
@@ -1089,14 +1098,14 @@ var index_default = (path5) => {
1089
1098
  * @param version - Optional version of the event to add the schema to
1090
1099
  * @returns
1091
1100
  */
1092
- addSchemaToEvent: addSchemaToEvent((0, import_node_path14.join)(path5)),
1101
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path15.join)(path5)),
1093
1102
  /**
1094
1103
  * Check to see if an event version exists
1095
1104
  * @param id - The id of the event
1096
1105
  * @param version - The version of the event (supports semver)
1097
1106
  * @returns
1098
1107
  */
1099
- eventHasVersion: eventHasVersion((0, import_node_path14.join)(path5)),
1108
+ eventHasVersion: eventHasVersion((0, import_node_path15.join)(path5)),
1100
1109
  /**
1101
1110
  * ================================
1102
1111
  * Commands
@@ -1108,13 +1117,13 @@ var index_default = (path5) => {
1108
1117
  * @param version - Optional id of the version to get (supports semver)
1109
1118
  * @returns Command|Undefined
1110
1119
  */
1111
- getCommand: getCommand((0, import_node_path14.join)(path5)),
1120
+ getCommand: getCommand((0, import_node_path15.join)(path5)),
1112
1121
  /**
1113
1122
  * Returns all commands from EventCatalog
1114
1123
  * @param latestOnly - optional boolean, set to true to get only latest versions
1115
1124
  * @returns Command[]|Undefined
1116
1125
  */
1117
- getCommands: getCommands((0, import_node_path14.join)(path5)),
1126
+ getCommands: getCommands((0, import_node_path15.join)(path5)),
1118
1127
  /**
1119
1128
  * Adds an command to EventCatalog
1120
1129
  *
@@ -1122,7 +1131,7 @@ var index_default = (path5) => {
1122
1131
  * @param options - Optional options to write the command
1123
1132
  *
1124
1133
  */
1125
- writeCommand: writeCommand((0, import_node_path14.join)(path5, "commands")),
1134
+ writeCommand: writeCommand((0, import_node_path15.join)(path5, "commands")),
1126
1135
  /**
1127
1136
  * Adds a command to a service in EventCatalog
1128
1137
  *
@@ -1131,26 +1140,26 @@ var index_default = (path5) => {
1131
1140
  * @param options - Optional options to write the command
1132
1141
  *
1133
1142
  */
1134
- writeCommandToService: writeCommandToService((0, import_node_path14.join)(path5)),
1143
+ writeCommandToService: writeCommandToService((0, import_node_path15.join)(path5)),
1135
1144
  /**
1136
1145
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1137
1146
  *
1138
1147
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1139
1148
  *
1140
1149
  */
1141
- rmCommand: rmCommand((0, import_node_path14.join)(path5, "commands")),
1150
+ rmCommand: rmCommand((0, import_node_path15.join)(path5, "commands")),
1142
1151
  /**
1143
1152
  * Remove an command by an Event id
1144
1153
  *
1145
1154
  * @param id - The id of the command you want to remove
1146
1155
  *
1147
1156
  */
1148
- rmCommandById: rmCommandById((0, import_node_path14.join)(path5)),
1157
+ rmCommandById: rmCommandById((0, import_node_path15.join)(path5)),
1149
1158
  /**
1150
1159
  * Moves a given command id to the version directory
1151
1160
  * @param directory
1152
1161
  */
1153
- versionCommand: versionCommand((0, import_node_path14.join)(path5)),
1162
+ versionCommand: versionCommand((0, import_node_path15.join)(path5)),
1154
1163
  /**
1155
1164
  * Adds a file to the given command
1156
1165
  * @param id - The id of the command to add the file to
@@ -1158,7 +1167,7 @@ var index_default = (path5) => {
1158
1167
  * @param version - Optional version of the command to add the file to
1159
1168
  * @returns
1160
1169
  */
1161
- addFileToCommand: addFileToCommand((0, import_node_path14.join)(path5)),
1170
+ addFileToCommand: addFileToCommand((0, import_node_path15.join)(path5)),
1162
1171
  /**
1163
1172
  * Adds a schema to the given command
1164
1173
  * @param id - The id of the command to add the schema to
@@ -1166,14 +1175,14 @@ var index_default = (path5) => {
1166
1175
  * @param version - Optional version of the command to add the schema to
1167
1176
  * @returns
1168
1177
  */
1169
- addSchemaToCommand: addSchemaToCommand((0, import_node_path14.join)(path5)),
1178
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path15.join)(path5)),
1170
1179
  /**
1171
1180
  * Check to see if a command version exists
1172
1181
  * @param id - The id of the command
1173
1182
  * @param version - The version of the command (supports semver)
1174
1183
  * @returns
1175
1184
  */
1176
- commandHasVersion: commandHasVersion((0, import_node_path14.join)(path5)),
1185
+ commandHasVersion: commandHasVersion((0, import_node_path15.join)(path5)),
1177
1186
  /**
1178
1187
  * ================================
1179
1188
  * Queries
@@ -1185,13 +1194,13 @@ var index_default = (path5) => {
1185
1194
  * @param version - Optional id of the version to get (supports semver)
1186
1195
  * @returns Query|Undefined
1187
1196
  */
1188
- getQuery: getQuery((0, import_node_path14.join)(path5)),
1197
+ getQuery: getQuery((0, import_node_path15.join)(path5)),
1189
1198
  /**
1190
1199
  * Returns all queries from EventCatalog
1191
1200
  * @param latestOnly - optional boolean, set to true to get only latest versions
1192
1201
  * @returns Query[]|Undefined
1193
1202
  */
1194
- getQueries: getQueries((0, import_node_path14.join)(path5)),
1203
+ getQueries: getQueries((0, import_node_path15.join)(path5)),
1195
1204
  /**
1196
1205
  * Adds a query to EventCatalog
1197
1206
  *
@@ -1199,7 +1208,7 @@ var index_default = (path5) => {
1199
1208
  * @param options - Optional options to write the event
1200
1209
  *
1201
1210
  */
1202
- writeQuery: writeQuery((0, import_node_path14.join)(path5, "queries")),
1211
+ writeQuery: writeQuery((0, import_node_path15.join)(path5, "queries")),
1203
1212
  /**
1204
1213
  * Adds a query to a service in EventCatalog
1205
1214
  *
@@ -1208,26 +1217,26 @@ var index_default = (path5) => {
1208
1217
  * @param options - Optional options to write the query
1209
1218
  *
1210
1219
  */
1211
- writeQueryToService: writeQueryToService((0, import_node_path14.join)(path5)),
1220
+ writeQueryToService: writeQueryToService((0, import_node_path15.join)(path5)),
1212
1221
  /**
1213
1222
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1214
1223
  *
1215
1224
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1216
1225
  *
1217
1226
  */
1218
- rmQuery: rmQuery((0, import_node_path14.join)(path5, "queries")),
1227
+ rmQuery: rmQuery((0, import_node_path15.join)(path5, "queries")),
1219
1228
  /**
1220
1229
  * Remove a query by a Query id
1221
1230
  *
1222
1231
  * @param id - The id of the query you want to remove
1223
1232
  *
1224
1233
  */
1225
- rmQueryById: rmQueryById((0, import_node_path14.join)(path5)),
1234
+ rmQueryById: rmQueryById((0, import_node_path15.join)(path5)),
1226
1235
  /**
1227
1236
  * Moves a given query id to the version directory
1228
1237
  * @param directory
1229
1238
  */
1230
- versionQuery: versionQuery((0, import_node_path14.join)(path5)),
1239
+ versionQuery: versionQuery((0, import_node_path15.join)(path5)),
1231
1240
  /**
1232
1241
  * Adds a file to the given query
1233
1242
  * @param id - The id of the query to add the file to
@@ -1235,7 +1244,7 @@ var index_default = (path5) => {
1235
1244
  * @param version - Optional version of the query to add the file to
1236
1245
  * @returns
1237
1246
  */
1238
- addFileToQuery: addFileToQuery((0, import_node_path14.join)(path5)),
1247
+ addFileToQuery: addFileToQuery((0, import_node_path15.join)(path5)),
1239
1248
  /**
1240
1249
  * Adds a schema to the given query
1241
1250
  * @param id - The id of the query to add the schema to
@@ -1243,14 +1252,14 @@ var index_default = (path5) => {
1243
1252
  * @param version - Optional version of the query to add the schema to
1244
1253
  * @returns
1245
1254
  */
1246
- addSchemaToQuery: addSchemaToQuery((0, import_node_path14.join)(path5)),
1255
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path15.join)(path5)),
1247
1256
  /**
1248
1257
  * Check to see if an query version exists
1249
1258
  * @param id - The id of the query
1250
1259
  * @param version - The version of the query (supports semver)
1251
1260
  * @returns
1252
1261
  */
1253
- queryHasVersion: queryHasVersion((0, import_node_path14.join)(path5)),
1262
+ queryHasVersion: queryHasVersion((0, import_node_path15.join)(path5)),
1254
1263
  /**
1255
1264
  * ================================
1256
1265
  * Channels
@@ -1262,13 +1271,13 @@ var index_default = (path5) => {
1262
1271
  * @param version - Optional id of the version to get (supports semver)
1263
1272
  * @returns Channel|Undefined
1264
1273
  */
1265
- getChannel: getChannel((0, import_node_path14.join)(path5)),
1274
+ getChannel: getChannel((0, import_node_path15.join)(path5)),
1266
1275
  /**
1267
1276
  * Returns all channels from EventCatalog
1268
1277
  * @param latestOnly - optional boolean, set to true to get only latest versions
1269
1278
  * @returns Channel[]|Undefined
1270
1279
  */
1271
- getChannels: getChannels((0, import_node_path14.join)(path5)),
1280
+ getChannels: getChannels((0, import_node_path15.join)(path5)),
1272
1281
  /**
1273
1282
  * Adds an channel to EventCatalog
1274
1283
  *
@@ -1276,33 +1285,33 @@ var index_default = (path5) => {
1276
1285
  * @param options - Optional options to write the channel
1277
1286
  *
1278
1287
  */
1279
- writeChannel: writeChannel((0, import_node_path14.join)(path5, "channels")),
1288
+ writeChannel: writeChannel((0, import_node_path15.join)(path5, "channels")),
1280
1289
  /**
1281
1290
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1282
1291
  *
1283
1292
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1284
1293
  *
1285
1294
  */
1286
- rmChannel: rmChannel((0, import_node_path14.join)(path5, "channels")),
1295
+ rmChannel: rmChannel((0, import_node_path15.join)(path5, "channels")),
1287
1296
  /**
1288
1297
  * Remove an channel by an Event id
1289
1298
  *
1290
1299
  * @param id - The id of the channel you want to remove
1291
1300
  *
1292
1301
  */
1293
- rmChannelById: rmChannelById((0, import_node_path14.join)(path5)),
1302
+ rmChannelById: rmChannelById((0, import_node_path15.join)(path5)),
1294
1303
  /**
1295
1304
  * Moves a given channel id to the version directory
1296
1305
  * @param directory
1297
1306
  */
1298
- versionChannel: versionChannel((0, import_node_path14.join)(path5)),
1307
+ versionChannel: versionChannel((0, import_node_path15.join)(path5)),
1299
1308
  /**
1300
1309
  * Check to see if a channel version exists
1301
1310
  * @param id - The id of the channel
1302
1311
  * @param version - The version of the channel (supports semver)
1303
1312
  * @returns
1304
1313
  */
1305
- channelHasVersion: channelHasVersion((0, import_node_path14.join)(path5)),
1314
+ channelHasVersion: channelHasVersion((0, import_node_path15.join)(path5)),
1306
1315
  /**
1307
1316
  * Add a channel to an event
1308
1317
  *
@@ -1319,7 +1328,7 @@ var index_default = (path5) => {
1319
1328
  *
1320
1329
  * ```
1321
1330
  */
1322
- addEventToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "events"),
1331
+ addEventToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "events"),
1323
1332
  /**
1324
1333
  * Add a channel to an command
1325
1334
  *
@@ -1336,7 +1345,7 @@ var index_default = (path5) => {
1336
1345
  *
1337
1346
  * ```
1338
1347
  */
1339
- addCommandToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "commands"),
1348
+ addCommandToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "commands"),
1340
1349
  /**
1341
1350
  * Add a channel to an query
1342
1351
  *
@@ -1353,7 +1362,7 @@ var index_default = (path5) => {
1353
1362
  *
1354
1363
  * ```
1355
1364
  */
1356
- addQueryToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "queries"),
1365
+ addQueryToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "queries"),
1357
1366
  /**
1358
1367
  * ================================
1359
1368
  * SERVICES
@@ -1366,14 +1375,14 @@ var index_default = (path5) => {
1366
1375
  * @param options - Optional options to write the event
1367
1376
  *
1368
1377
  */
1369
- writeService: writeService((0, import_node_path14.join)(path5, "services")),
1378
+ writeService: writeService((0, import_node_path15.join)(path5, "services")),
1370
1379
  /**
1371
1380
  * Adds a versioned service to EventCatalog
1372
1381
  *
1373
1382
  * @param service - The service to write
1374
1383
  *
1375
1384
  */
1376
- writeVersionedService: writeVersionedService((0, import_node_path14.join)(path5, "services")),
1385
+ writeVersionedService: writeVersionedService((0, import_node_path15.join)(path5, "services")),
1377
1386
  /**
1378
1387
  * Adds a service to a domain in EventCatalog
1379
1388
  *
@@ -1382,45 +1391,45 @@ var index_default = (path5) => {
1382
1391
  * @param options - Optional options to write the event
1383
1392
  *
1384
1393
  */
1385
- writeServiceToDomain: writeServiceToDomain((0, import_node_path14.join)(path5, "domains")),
1394
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1386
1395
  /**
1387
1396
  * Returns a service from EventCatalog
1388
1397
  * @param id - The id of the service to retrieve
1389
1398
  * @param version - Optional id of the version to get (supports semver)
1390
1399
  * @returns Service|Undefined
1391
1400
  */
1392
- getService: getService((0, import_node_path14.join)(path5)),
1401
+ getService: getService((0, import_node_path15.join)(path5)),
1393
1402
  /**
1394
1403
  * Returns a service from EventCatalog by it's path.
1395
1404
  * @param path - The path to the service to retrieve
1396
1405
  * @returns Service|Undefined
1397
1406
  */
1398
- getServiceByPath: getServiceByPath((0, import_node_path14.join)(path5)),
1407
+ getServiceByPath: getServiceByPath((0, import_node_path15.join)(path5)),
1399
1408
  /**
1400
1409
  * Returns all services from EventCatalog
1401
1410
  * @param latestOnly - optional boolean, set to true to get only latest versions
1402
1411
  * @returns Service[]|Undefined
1403
1412
  */
1404
- getServices: getServices((0, import_node_path14.join)(path5)),
1413
+ getServices: getServices((0, import_node_path15.join)(path5)),
1405
1414
  /**
1406
1415
  * Moves a given service id to the version directory
1407
1416
  * @param directory
1408
1417
  */
1409
- versionService: versionService((0, import_node_path14.join)(path5)),
1418
+ versionService: versionService((0, import_node_path15.join)(path5)),
1410
1419
  /**
1411
1420
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1412
1421
  *
1413
1422
  * @param path - The path to your service, e.g. `/InventoryService`
1414
1423
  *
1415
1424
  */
1416
- rmService: rmService((0, import_node_path14.join)(path5, "services")),
1425
+ rmService: rmService((0, import_node_path15.join)(path5, "services")),
1417
1426
  /**
1418
1427
  * Remove an service by an service id
1419
1428
  *
1420
1429
  * @param id - The id of the service you want to remove
1421
1430
  *
1422
1431
  */
1423
- rmServiceById: rmServiceById((0, import_node_path14.join)(path5)),
1432
+ rmServiceById: rmServiceById((0, import_node_path15.join)(path5)),
1424
1433
  /**
1425
1434
  * Adds a file to the given service
1426
1435
  * @param id - The id of the service to add the file to
@@ -1428,21 +1437,21 @@ var index_default = (path5) => {
1428
1437
  * @param version - Optional version of the service to add the file to
1429
1438
  * @returns
1430
1439
  */
1431
- addFileToService: addFileToService((0, import_node_path14.join)(path5)),
1440
+ addFileToService: addFileToService((0, import_node_path15.join)(path5)),
1432
1441
  /**
1433
1442
  * Returns the specifications for a given service
1434
1443
  * @param id - The id of the service to retrieve the specifications for
1435
1444
  * @param version - Optional version of the service
1436
1445
  * @returns
1437
1446
  */
1438
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path14.join)(path5)),
1447
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path15.join)(path5)),
1439
1448
  /**
1440
1449
  * Check to see if a service version exists
1441
1450
  * @param id - The id of the service
1442
1451
  * @param version - The version of the service (supports semver)
1443
1452
  * @returns
1444
1453
  */
1445
- serviceHasVersion: serviceHasVersion((0, import_node_path14.join)(path5)),
1454
+ serviceHasVersion: serviceHasVersion((0, import_node_path15.join)(path5)),
1446
1455
  /**
1447
1456
  * Add an event to a service by it's id.
1448
1457
  *
@@ -1462,7 +1471,7 @@ var index_default = (path5) => {
1462
1471
  *
1463
1472
  * ```
1464
1473
  */
1465
- addEventToService: addMessageToService((0, import_node_path14.join)(path5)),
1474
+ addEventToService: addMessageToService((0, import_node_path15.join)(path5)),
1466
1475
  /**
1467
1476
  * Add a command to a service by it's id.
1468
1477
  *
@@ -1482,7 +1491,7 @@ var index_default = (path5) => {
1482
1491
  *
1483
1492
  * ```
1484
1493
  */
1485
- addCommandToService: addMessageToService((0, import_node_path14.join)(path5)),
1494
+ addCommandToService: addMessageToService((0, import_node_path15.join)(path5)),
1486
1495
  /**
1487
1496
  * Add a query to a service by it's id.
1488
1497
  *
@@ -1502,7 +1511,7 @@ var index_default = (path5) => {
1502
1511
  *
1503
1512
  * ```
1504
1513
  */
1505
- addQueryToService: addMessageToService((0, import_node_path14.join)(path5)),
1514
+ addQueryToService: addMessageToService((0, import_node_path15.join)(path5)),
1506
1515
  /**
1507
1516
  * Add an entity to a service by its id.
1508
1517
  *
@@ -1520,7 +1529,7 @@ var index_default = (path5) => {
1520
1529
  *
1521
1530
  * ```
1522
1531
  */
1523
- addEntityToService: addEntityToService((0, import_node_path14.join)(path5)),
1532
+ addEntityToService: addEntityToService((0, import_node_path15.join)(path5)),
1524
1533
  /**
1525
1534
  * Check to see if a service exists by it's path.
1526
1535
  *
@@ -1537,13 +1546,13 @@ var index_default = (path5) => {
1537
1546
  * @param path - The path to the service to check
1538
1547
  * @returns boolean
1539
1548
  */
1540
- isService: isService((0, import_node_path14.join)(path5)),
1549
+ isService: isService((0, import_node_path15.join)(path5)),
1541
1550
  /**
1542
1551
  * Converts a file to a service.
1543
1552
  * @param file - The file to convert to a service.
1544
1553
  * @returns The service.
1545
1554
  */
1546
- toService: toService((0, import_node_path14.join)(path5)),
1555
+ toService: toService((0, import_node_path15.join)(path5)),
1547
1556
  /**
1548
1557
  * ================================
1549
1558
  * Domains
@@ -1556,39 +1565,39 @@ var index_default = (path5) => {
1556
1565
  * @param options - Optional options to write the event
1557
1566
  *
1558
1567
  */
1559
- writeDomain: writeDomain((0, import_node_path14.join)(path5, "domains")),
1568
+ writeDomain: writeDomain((0, import_node_path15.join)(path5, "domains")),
1560
1569
  /**
1561
1570
  * Returns a domain from EventCatalog
1562
1571
  * @param id - The id of the domain to retrieve
1563
1572
  * @param version - Optional id of the version to get (supports semver)
1564
1573
  * @returns Domain|Undefined
1565
1574
  */
1566
- getDomain: getDomain((0, import_node_path14.join)(path5, "domains")),
1575
+ getDomain: getDomain((0, import_node_path15.join)(path5, "domains")),
1567
1576
  /**
1568
1577
  * Returns all domains from EventCatalog
1569
1578
  * @param latestOnly - optional boolean, set to true to get only latest versions
1570
1579
  * @returns Domain[]|Undefined
1571
1580
  */
1572
- getDomains: getDomains((0, import_node_path14.join)(path5)),
1581
+ getDomains: getDomains((0, import_node_path15.join)(path5)),
1573
1582
  /**
1574
1583
  * Moves a given domain id to the version directory
1575
1584
  * @param directory
1576
1585
  */
1577
- versionDomain: versionDomain((0, import_node_path14.join)(path5, "domains")),
1586
+ versionDomain: versionDomain((0, import_node_path15.join)(path5, "domains")),
1578
1587
  /**
1579
1588
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1580
1589
  *
1581
1590
  * @param path - The path to your domain, e.g. `/Payment`
1582
1591
  *
1583
1592
  */
1584
- rmDomain: rmDomain((0, import_node_path14.join)(path5, "domains")),
1593
+ rmDomain: rmDomain((0, import_node_path15.join)(path5, "domains")),
1585
1594
  /**
1586
1595
  * Remove an service by an domain id
1587
1596
  *
1588
1597
  * @param id - The id of the domain you want to remove
1589
1598
  *
1590
1599
  */
1591
- rmDomainById: rmDomainById((0, import_node_path14.join)(path5, "domains")),
1600
+ rmDomainById: rmDomainById((0, import_node_path15.join)(path5, "domains")),
1592
1601
  /**
1593
1602
  * Adds a file to the given domain
1594
1603
  * @param id - The id of the domain to add the file to
@@ -1596,28 +1605,28 @@ var index_default = (path5) => {
1596
1605
  * @param version - Optional version of the domain to add the file to
1597
1606
  * @returns
1598
1607
  */
1599
- addFileToDomain: addFileToDomain((0, import_node_path14.join)(path5, "domains")),
1608
+ addFileToDomain: addFileToDomain((0, import_node_path15.join)(path5, "domains")),
1600
1609
  /**
1601
1610
  * Adds an ubiquitous language dictionary to a domain
1602
1611
  * @param id - The id of the domain to add the ubiquitous language to
1603
1612
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1604
1613
  * @param version - Optional version of the domain to add the ubiquitous language to
1605
1614
  */
1606
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path14.join)(path5, "domains")),
1615
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path15.join)(path5, "domains")),
1607
1616
  /**
1608
1617
  * Get the ubiquitous language dictionary from a domain
1609
1618
  * @param id - The id of the domain to get the ubiquitous language from
1610
1619
  * @param version - Optional version of the domain to get the ubiquitous language from
1611
1620
  * @returns
1612
1621
  */
1613
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path14.join)(path5, "domains")),
1622
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path15.join)(path5, "domains")),
1614
1623
  /**
1615
1624
  * Check to see if a domain version exists
1616
1625
  * @param id - The id of the domain
1617
1626
  * @param version - The version of the domain (supports semver)
1618
1627
  * @returns
1619
1628
  */
1620
- domainHasVersion: domainHasVersion((0, import_node_path14.join)(path5)),
1629
+ domainHasVersion: domainHasVersion((0, import_node_path15.join)(path5)),
1621
1630
  /**
1622
1631
  * Adds a given service to a domain
1623
1632
  * @param id - The id of the domain
@@ -1625,7 +1634,7 @@ var index_default = (path5) => {
1625
1634
  * @param version - (Optional) The version of the domain to add the service to
1626
1635
  * @returns
1627
1636
  */
1628
- addServiceToDomain: addServiceToDomain((0, import_node_path14.join)(path5, "domains")),
1637
+ addServiceToDomain: addServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1629
1638
  /**
1630
1639
  * Adds a given subdomain to a domain
1631
1640
  * @param id - The id of the domain
@@ -1633,7 +1642,7 @@ var index_default = (path5) => {
1633
1642
  * @param version - (Optional) The version of the domain to add the subdomain to
1634
1643
  * @returns
1635
1644
  */
1636
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path14.join)(path5, "domains")),
1645
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path15.join)(path5, "domains")),
1637
1646
  /**
1638
1647
  * Adds an entity to a domain
1639
1648
  * @param id - The id of the domain
@@ -1641,7 +1650,7 @@ var index_default = (path5) => {
1641
1650
  * @param version - (Optional) The version of the domain to add the entity to
1642
1651
  * @returns
1643
1652
  */
1644
- addEntityToDomain: addEntityToDomain((0, import_node_path14.join)(path5, "domains")),
1653
+ addEntityToDomain: addEntityToDomain((0, import_node_path15.join)(path5, "domains")),
1645
1654
  /**
1646
1655
  * ================================
1647
1656
  * Teams
@@ -1654,25 +1663,25 @@ var index_default = (path5) => {
1654
1663
  * @param options - Optional options to write the team
1655
1664
  *
1656
1665
  */
1657
- writeTeam: writeTeam((0, import_node_path14.join)(path5, "teams")),
1666
+ writeTeam: writeTeam((0, import_node_path15.join)(path5, "teams")),
1658
1667
  /**
1659
1668
  * Returns a team from EventCatalog
1660
1669
  * @param id - The id of the team to retrieve
1661
1670
  * @returns Team|Undefined
1662
1671
  */
1663
- getTeam: getTeam((0, import_node_path14.join)(path5, "teams")),
1672
+ getTeam: getTeam((0, import_node_path15.join)(path5, "teams")),
1664
1673
  /**
1665
1674
  * Returns all teams from EventCatalog
1666
1675
  * @returns Team[]|Undefined
1667
1676
  */
1668
- getTeams: getTeams((0, import_node_path14.join)(path5, "teams")),
1677
+ getTeams: getTeams((0, import_node_path15.join)(path5, "teams")),
1669
1678
  /**
1670
1679
  * Remove a team by the team id
1671
1680
  *
1672
1681
  * @param id - The id of the team you want to remove
1673
1682
  *
1674
1683
  */
1675
- rmTeamById: rmTeamById((0, import_node_path14.join)(path5, "teams")),
1684
+ rmTeamById: rmTeamById((0, import_node_path15.join)(path5, "teams")),
1676
1685
  /**
1677
1686
  * ================================
1678
1687
  * Users
@@ -1685,25 +1694,25 @@ var index_default = (path5) => {
1685
1694
  * @param options - Optional options to write the user
1686
1695
  *
1687
1696
  */
1688
- writeUser: writeUser((0, import_node_path14.join)(path5, "users")),
1697
+ writeUser: writeUser((0, import_node_path15.join)(path5, "users")),
1689
1698
  /**
1690
1699
  * Returns a user from EventCatalog
1691
1700
  * @param id - The id of the user to retrieve
1692
1701
  * @returns User|Undefined
1693
1702
  */
1694
- getUser: getUser((0, import_node_path14.join)(path5, "users")),
1703
+ getUser: getUser((0, import_node_path15.join)(path5, "users")),
1695
1704
  /**
1696
1705
  * Returns all user from EventCatalog
1697
1706
  * @returns User[]|Undefined
1698
1707
  */
1699
- getUsers: getUsers((0, import_node_path14.join)(path5)),
1708
+ getUsers: getUsers((0, import_node_path15.join)(path5)),
1700
1709
  /**
1701
1710
  * Remove a user by the user id
1702
1711
  *
1703
1712
  * @param id - The id of the user you want to remove
1704
1713
  *
1705
1714
  */
1706
- rmUserById: rmUserById((0, import_node_path14.join)(path5, "users")),
1715
+ rmUserById: rmUserById((0, import_node_path15.join)(path5, "users")),
1707
1716
  /**
1708
1717
  * ================================
1709
1718
  * Custom Docs
@@ -1714,32 +1723,32 @@ var index_default = (path5) => {
1714
1723
  * @param path - The path to the custom doc to retrieve
1715
1724
  * @returns CustomDoc|Undefined
1716
1725
  */
1717
- getCustomDoc: getCustomDoc((0, import_node_path14.join)(path5, "docs")),
1726
+ getCustomDoc: getCustomDoc((0, import_node_path15.join)(path5, "docs")),
1718
1727
  /**
1719
1728
  * Returns all custom docs from EventCatalog
1720
1729
  * @param options - Optional options to get custom docs from a specific path
1721
1730
  * @returns CustomDoc[]|Undefined
1722
1731
  */
1723
- getCustomDocs: getCustomDocs((0, import_node_path14.join)(path5, "docs")),
1732
+ getCustomDocs: getCustomDocs((0, import_node_path15.join)(path5, "docs")),
1724
1733
  /**
1725
1734
  * Writes a custom doc to EventCatalog
1726
1735
  * @param customDoc - The custom doc to write
1727
1736
  * @param options - Optional options to write the custom doc
1728
1737
  *
1729
1738
  */
1730
- writeCustomDoc: writeCustomDoc((0, import_node_path14.join)(path5, "docs")),
1739
+ writeCustomDoc: writeCustomDoc((0, import_node_path15.join)(path5, "docs")),
1731
1740
  /**
1732
1741
  * Removes a custom doc from EventCatalog
1733
1742
  * @param path - The path to the custom doc to remove
1734
1743
  *
1735
1744
  */
1736
- rmCustomDoc: rmCustomDoc((0, import_node_path14.join)(path5, "docs")),
1745
+ rmCustomDoc: rmCustomDoc((0, import_node_path15.join)(path5, "docs")),
1737
1746
  /**
1738
1747
  * Dumps the catalog to a JSON file.
1739
1748
  * @param directory - The directory to dump the catalog to
1740
1749
  * @returns A JSON file with the catalog
1741
1750
  */
1742
- dumpCatalog: dumpCatalog((0, import_node_path14.join)(path5)),
1751
+ dumpCatalog: dumpCatalog((0, import_node_path15.join)(path5)),
1743
1752
  /**
1744
1753
  * Returns the event catalog configuration file.
1745
1754
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1747,7 +1756,7 @@ var index_default = (path5) => {
1747
1756
  * @param directory - The directory of the catalog.
1748
1757
  * @returns A JSON object with the configuration for the event catalog.
1749
1758
  */
1750
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path14.join)(path5)),
1759
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path15.join)(path5)),
1751
1760
  /**
1752
1761
  * ================================
1753
1762
  * Resources Utils
@@ -1768,33 +1777,33 @@ var index_default = (path5) => {
1768
1777
  * @param path - The path to the message to retrieve
1769
1778
  * @returns Message|Undefined
1770
1779
  */
1771
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path14.join)(path5)),
1780
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path15.join)(path5)),
1772
1781
  /**
1773
1782
  * Returns the producers and consumers (services) for a given message
1774
1783
  * @param id - The id of the message to get the producers and consumers for
1775
1784
  * @param version - Optional version of the message
1776
1785
  * @returns { producers: Service[], consumers: Service[] }
1777
1786
  */
1778
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path14.join)(path5)),
1787
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path15.join)(path5)),
1779
1788
  /**
1780
1789
  * Returns the consumers of a given schema path
1781
1790
  * @param path - The path to the schema to get the consumers for
1782
1791
  * @returns Service[]
1783
1792
  */
1784
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path14.join)(path5)),
1793
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path15.join)(path5)),
1785
1794
  /**
1786
1795
  * Returns the producers of a given schema path
1787
1796
  * @param path - The path to the schema to get the producers for
1788
1797
  * @returns Service[]
1789
1798
  */
1790
- getProducersOfSchema: getProducersOfSchema((0, import_node_path14.join)(path5)),
1799
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path15.join)(path5)),
1791
1800
  /**
1792
1801
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1793
1802
  * @param id - The id of the resource to get the owners for
1794
1803
  * @param version - Optional version of the resource
1795
1804
  * @returns { owners: User[] }
1796
1805
  */
1797
- getOwnersForResource: getOwnersForResource((0, import_node_path14.join)(path5)),
1806
+ getOwnersForResource: getOwnersForResource((0, import_node_path15.join)(path5)),
1798
1807
  /**
1799
1808
  * ================================
1800
1809
  * Entities
@@ -1806,13 +1815,13 @@ var index_default = (path5) => {
1806
1815
  * @param version - Optional id of the version to get (supports semver)
1807
1816
  * @returns Entity|Undefined
1808
1817
  */
1809
- getEntity: getEntity((0, import_node_path14.join)(path5)),
1818
+ getEntity: getEntity((0, import_node_path15.join)(path5)),
1810
1819
  /**
1811
1820
  * Returns all entities from EventCatalog
1812
1821
  * @param latestOnly - optional boolean, set to true to get only latest versions
1813
1822
  * @returns Entity[]|Undefined
1814
1823
  */
1815
- getEntities: getEntities((0, import_node_path14.join)(path5)),
1824
+ getEntities: getEntities((0, import_node_path15.join)(path5)),
1816
1825
  /**
1817
1826
  * Adds an entity to EventCatalog
1818
1827
  *
@@ -1820,33 +1829,33 @@ var index_default = (path5) => {
1820
1829
  * @param options - Optional options to write the entity
1821
1830
  *
1822
1831
  */
1823
- writeEntity: writeEntity((0, import_node_path14.join)(path5, "entities")),
1832
+ writeEntity: writeEntity((0, import_node_path15.join)(path5, "entities")),
1824
1833
  /**
1825
1834
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1826
1835
  *
1827
1836
  * @param path - The path to your entity, e.g. `/User`
1828
1837
  *
1829
1838
  */
1830
- rmEntity: rmEntity((0, import_node_path14.join)(path5, "entities")),
1839
+ rmEntity: rmEntity((0, import_node_path15.join)(path5, "entities")),
1831
1840
  /**
1832
1841
  * Remove an entity by an entity id
1833
1842
  *
1834
1843
  * @param id - The id of the entity you want to remove
1835
1844
  *
1836
1845
  */
1837
- rmEntityById: rmEntityById((0, import_node_path14.join)(path5)),
1846
+ rmEntityById: rmEntityById((0, import_node_path15.join)(path5)),
1838
1847
  /**
1839
1848
  * Moves a given entity id to the version directory
1840
1849
  * @param id - The id of the entity to version
1841
1850
  */
1842
- versionEntity: versionEntity((0, import_node_path14.join)(path5)),
1851
+ versionEntity: versionEntity((0, import_node_path15.join)(path5)),
1843
1852
  /**
1844
1853
  * Check to see if an entity version exists
1845
1854
  * @param id - The id of the entity
1846
1855
  * @param version - The version of the entity (supports semver)
1847
1856
  * @returns
1848
1857
  */
1849
- entityHasVersion: entityHasVersion((0, import_node_path14.join)(path5))
1858
+ entityHasVersion: entityHasVersion((0, import_node_path15.join)(path5))
1850
1859
  };
1851
1860
  };
1852
1861
 
@@ -1854,7 +1863,7 @@ var index_default = (path5) => {
1854
1863
  var DUMP_VERSION = "0.0.1";
1855
1864
  var getEventCatalogVersion = async (catalogDir) => {
1856
1865
  try {
1857
- 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");
1858
1867
  const packageJsonObject = JSON.parse(packageJson);
1859
1868
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
1860
1869
  } catch (error) {
@@ -1867,7 +1876,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1867
1876
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1868
1877
  let schema = "";
1869
1878
  if (resource.schemaPath && resourcePath?.fullPath) {
1870
- 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);
1871
1880
  if (import_fs.default.existsSync(pathToSchema)) {
1872
1881
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1873
1882
  }
@@ -1888,7 +1897,7 @@ var filterCollection = (collection, options) => {
1888
1897
  };
1889
1898
  var getEventCatalogConfigurationFile = (directory) => async () => {
1890
1899
  try {
1891
- const path5 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
1900
+ const path5 = (0, import_node_path16.join)(directory, "eventcatalog.config.js");
1892
1901
  const configModule = await import(path5);
1893
1902
  return configModule.default;
1894
1903
  } catch (error) {