@eventcatalog/sdk 2.6.3 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/channels.js +4 -4
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +4 -4
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +3 -3
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +3 -3
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/custom-docs.js.map +1 -1
  10. package/dist/custom-docs.mjs.map +1 -1
  11. package/dist/domains.js +3 -3
  12. package/dist/domains.js.map +1 -1
  13. package/dist/domains.mjs +3 -3
  14. package/dist/domains.mjs.map +1 -1
  15. package/dist/eventcatalog.js +210 -149
  16. package/dist/eventcatalog.js.map +1 -1
  17. package/dist/eventcatalog.mjs +209 -148
  18. package/dist/eventcatalog.mjs.map +1 -1
  19. package/dist/events.js +3 -3
  20. package/dist/events.js.map +1 -1
  21. package/dist/events.mjs +3 -3
  22. package/dist/events.mjs.map +1 -1
  23. package/dist/index.d.mts +33 -28
  24. package/dist/index.d.ts +33 -28
  25. package/dist/index.js +210 -149
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +209 -148
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/messages.js +3 -3
  30. package/dist/messages.js.map +1 -1
  31. package/dist/messages.mjs +4 -4
  32. package/dist/messages.mjs.map +1 -1
  33. package/dist/queries.js +3 -3
  34. package/dist/queries.js.map +1 -1
  35. package/dist/queries.mjs +3 -3
  36. package/dist/queries.mjs.map +1 -1
  37. package/dist/services.d.mts +29 -1
  38. package/dist/services.d.ts +29 -1
  39. package/dist/services.js +18 -4
  40. package/dist/services.js.map +1 -1
  41. package/dist/services.mjs +17 -5
  42. package/dist/services.mjs.map +1 -1
  43. package/dist/teams.d.mts +8 -1
  44. package/dist/teams.d.ts +8 -1
  45. package/dist/teams.js +122 -11
  46. package/dist/teams.js.map +1 -1
  47. package/dist/teams.mjs +121 -11
  48. package/dist/teams.mjs.map +1 -1
  49. package/package.json +1 -1
@@ -35,10 +35,10 @@ __export(eventcatalog_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(eventcatalog_exports);
37
37
  var import_fs = __toESM(require("fs"));
38
- var import_node_path13 = __toESM(require("path"));
38
+ var import_node_path14 = __toESM(require("path"));
39
39
 
40
40
  // src/index.ts
41
- var import_node_path12 = require("path");
41
+ var import_node_path13 = require("path");
42
42
 
43
43
  // src/events.ts
44
44
  var import_promises2 = __toESM(require("fs/promises"));
@@ -59,13 +59,13 @@ var versionExists = async (catalogDir, id, version) => {
59
59
  var findFileById = async (catalogDir, id, version) => {
60
60
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
61
61
  const matchedFiles = await searchFilesForId(files, id) || [];
62
- const latestVersion = matchedFiles.find((path4) => !path4.includes("versioned"));
62
+ const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
63
63
  if (!version) {
64
64
  return latestVersion;
65
65
  }
66
- const parsedFiles = matchedFiles.map((path4) => {
67
- const { data } = import_gray_matter.default.read(path4);
68
- return { ...data, path: path4 };
66
+ const parsedFiles = matchedFiles.map((path5) => {
67
+ const { data } = import_gray_matter.default.read(path5);
68
+ return { ...data, path: path5 };
69
69
  });
70
70
  const semverRange = (0, import_semver.validRange)(version);
71
71
  if (semverRange && (0, import_semver.valid)(version)) {
@@ -106,8 +106,8 @@ var getFiles = async (pattern, ignore = "") => {
106
106
  );
107
107
  }
108
108
  };
109
- var readMdxFile = async (path4) => {
110
- const { data } = import_gray_matter.default.read(path4);
109
+ var readMdxFile = async (path5) => {
110
+ const { data } = import_gray_matter.default.read(path5);
111
111
  const { markdown, ...frontmatter } = data;
112
112
  return { ...frontmatter, markdown };
113
113
  };
@@ -190,8 +190,8 @@ var writeResource = async (catalogDir, resource, options = {
190
190
  versionExistingContent: false,
191
191
  format: "mdx"
192
192
  }) => {
193
- const path4 = options.path || `/${resource.id}`;
194
- const fullPath = (0, import_path.join)(catalogDir, path4);
193
+ const path5 = options.path || `/${resource.id}`;
194
+ const fullPath = (0, import_path.join)(catalogDir, path5);
195
195
  const format = options.format || "mdx";
196
196
  import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
197
197
  const lockPath = (0, import_path.join)(fullPath, `index.${format}`);
@@ -226,10 +226,10 @@ var writeResource = async (catalogDir, resource, options = {
226
226
  });
227
227
  }
228
228
  };
229
- var getResource = async (catalogDir, id, version, options) => {
229
+ var getResource = async (catalogDir, id, version, options, filePath) => {
230
230
  const attachSchema = options?.attachSchema || false;
231
- const file = await findFileById(catalogDir, id, version);
232
- if (!file) return;
231
+ const file = filePath || (id ? await findFileById(catalogDir, id, version) : void 0);
232
+ if (!file || !import_node_fs2.default.existsSync(file)) return;
233
233
  const { data, content } = import_gray_matter2.default.read(file);
234
234
  if (attachSchema && data?.schemaPath) {
235
235
  const resourceDirectory = (0, import_path.dirname)(file);
@@ -354,8 +354,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
354
354
  pathForEvent = (0, import_node_path2.join)(pathForEvent, event.id);
355
355
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
356
356
  };
357
- var rmEvent = (directory) => async (path4) => {
358
- await import_promises2.default.rm((0, import_node_path2.join)(directory, path4), { recursive: true });
357
+ var rmEvent = (directory) => async (path5) => {
358
+ await import_promises2.default.rm((0, import_node_path2.join)(directory, path5), { recursive: true });
359
359
  };
360
360
  var rmEventById = (directory) => async (id, version, persistFiles) => {
361
361
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -390,8 +390,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
390
390
  pathForCommand = (0, import_node_path3.join)(pathForCommand, command.id);
391
391
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
392
392
  };
393
- var rmCommand = (directory) => async (path4) => {
394
- await import_promises3.default.rm((0, import_node_path3.join)(directory, path4), { recursive: true });
393
+ var rmCommand = (directory) => async (path5) => {
394
+ await import_promises3.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
395
395
  };
396
396
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
397
397
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -424,8 +424,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
424
424
  pathForQuery = (0, import_node_path4.join)(pathForQuery, query.id);
425
425
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
426
426
  };
427
- var rmQuery = (directory) => async (path4) => {
428
- await import_promises4.default.rm((0, import_node_path4.join)(directory, path4), { recursive: true });
427
+ var rmQuery = (directory) => async (path5) => {
428
+ await import_promises4.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
429
429
  };
430
430
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
431
431
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -444,6 +444,10 @@ var queryHasVersion = (directory) => async (id, version) => {
444
444
  var import_promises5 = __toESM(require("fs/promises"));
445
445
  var import_node_path5 = require("path");
446
446
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
447
+ var getServiceByPath = (directory) => async (path5) => {
448
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
449
+ return service;
450
+ };
447
451
  var getServices = (directory) => async (options) => getResources(directory, {
448
452
  type: "services",
449
453
  ignore: ["**/events/**", "**/commands/**", "**/queries/**", "**/entities/**", "**/subdomains/**/entities/**"],
@@ -465,8 +469,8 @@ var writeService = (directory) => async (service, options = {
465
469
  };
466
470
  var writeVersionedService = (directory) => async (service) => {
467
471
  const resource = { ...service };
468
- const path4 = getVersionedDirectory(service.id, service.version);
469
- return await writeService(directory)(resource, { path: path4 });
472
+ const path5 = getVersionedDirectory(service.id, service.version);
473
+ return await writeService(directory)(resource, { path: path5 });
470
474
  };
471
475
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
472
476
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -474,8 +478,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
474
478
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
475
479
  };
476
480
  var versionService = (directory) => async (id) => versionResource(directory, id);
477
- var rmService = (directory) => async (path4) => {
478
- await import_promises5.default.rm((0, import_node_path5.join)(directory, path4), { recursive: true });
481
+ var rmService = (directory) => async (path5) => {
482
+ await import_promises5.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
479
483
  };
480
484
  var rmServiceById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "service", persistFiles });
481
485
  var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -530,8 +534,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
530
534
  if (!existingResource) {
531
535
  throw new Error(`Cannot find service ${id} in the catalog`);
532
536
  }
533
- const path4 = existingResource.split("/services")[0];
534
- const pathToResource = (0, import_node_path5.join)(path4, "services");
537
+ const path5 = existingResource.split(/[\\/]+services/)[0];
538
+ const pathToResource = (0, import_node_path5.join)(path5, "services");
535
539
  await rmServiceById(directory)(id, version);
536
540
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
537
541
  };
@@ -539,6 +543,12 @@ var serviceHasVersion = (directory) => async (id, version) => {
539
543
  const file = await findFileById(directory, id, version);
540
544
  return !!file;
541
545
  };
546
+ var isService = (directory) => async (path5) => {
547
+ const service = await getServiceByPath(directory)(path5);
548
+ const relativePath = (0, import_node_path5.relative)(directory, path5);
549
+ const segments = relativePath.split(/[/\\]+/);
550
+ return !!service && segments.includes("services");
551
+ };
542
552
 
543
553
  // src/domains.ts
544
554
  var import_promises6 = __toESM(require("fs/promises"));
@@ -567,8 +577,8 @@ var writeDomain = (directory) => async (domain, options = {
567
577
  return await writeResource(directory, resource, { ...options, type: "domain" });
568
578
  };
569
579
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
570
- var rmDomain = (directory) => async (path4) => {
571
- await import_promises6.default.rm((0, import_node_path6.join)(directory, path4), { recursive: true });
580
+ var rmDomain = (directory) => async (path5) => {
581
+ await import_promises6.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
572
582
  };
573
583
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
574
584
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -629,8 +639,8 @@ var import_node_path7 = require("path");
629
639
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
630
640
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
631
641
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
632
- var rmChannel = (directory) => async (path4) => {
633
- await import_promises7.default.rm((0, import_node_path7.join)(directory, path4), { recursive: true });
642
+ var rmChannel = (directory) => async (path5) => {
643
+ await import_promises7.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
634
644
  };
635
645
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
636
646
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -671,8 +681,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
671
681
  if (!existingResource) {
672
682
  throw new Error(`Cannot find message ${id} in the catalog`);
673
683
  }
674
- const path4 = existingResource.split(`/${collection}`)[0];
675
- const pathToResource = (0, import_node_path7.join)(path4, collection);
684
+ const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
685
+ const pathToResource = (0, import_node_path7.join)(path5, collection);
676
686
  await rmMessageById(directory)(_message.id, _message.version, true);
677
687
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
678
688
  };
@@ -681,8 +691,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
681
691
  var import_node_path8 = require("path");
682
692
  var import_gray_matter4 = __toESM(require("gray-matter"));
683
693
  var import_semver3 = require("semver");
684
- var getMessageBySchemaPath = (directory) => async (path4, options) => {
685
- const pathToMessage = (0, import_node_path8.dirname)(path4);
694
+ var getMessageBySchemaPath = (directory) => async (path5, options) => {
695
+ const pathToMessage = (0, import_node_path8.dirname)(path5);
686
696
  try {
687
697
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
688
698
  if (!files || files.length === 0) {
@@ -700,7 +710,7 @@ var getMessageBySchemaPath = (directory) => async (path4, options) => {
700
710
  }
701
711
  return message;
702
712
  } catch (error) {
703
- console.error(`Failed to get message for schema path ${path4}. Error processing directory ${pathToMessage}:`, error);
713
+ console.error(`Failed to get message for schema path ${path5}. Error processing directory ${pathToMessage}:`, error);
704
714
  if (error instanceof Error) {
705
715
  error.message = `Failed to retrieve message from ${pathToMessage}: ${error.message}`;
706
716
  throw error;
@@ -794,10 +804,16 @@ var rmCustomDoc = (directory) => async (filePath) => {
794
804
 
795
805
  // src/teams.ts
796
806
  var import_promises9 = __toESM(require("fs/promises"));
807
+ var import_node_fs6 = __toESM(require("fs"));
808
+ var import_node_path11 = require("path");
809
+ var import_gray_matter7 = __toESM(require("gray-matter"));
810
+ var import_node_path12 = __toESM(require("path"));
811
+
812
+ // src/users.ts
797
813
  var import_node_fs5 = __toESM(require("fs"));
798
814
  var import_node_path10 = require("path");
799
815
  var import_gray_matter6 = __toESM(require("gray-matter"));
800
- var getTeam = (catalogDir) => async (id) => {
816
+ var getUser = (catalogDir) => async (id) => {
801
817
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
802
818
  if (files.length == 0) return void 0;
803
819
  const file = files[0];
@@ -806,11 +822,12 @@ var getTeam = (catalogDir) => async (id) => {
806
822
  ...data,
807
823
  id: data.id,
808
824
  name: data.name,
825
+ avatarUrl: data.avatarUrl,
809
826
  markdown: content.trim()
810
827
  };
811
828
  };
812
- var getTeams = (catalogDir) => async (options) => {
813
- const files = await getFiles(`${catalogDir}/teams/*.{md,mdx}`);
829
+ var getUsers = (catalogDir) => async (options) => {
830
+ const files = await getFiles(`${catalogDir}/users/*.{md,mdx}`);
814
831
  if (files.length === 0) return [];
815
832
  return files.map((file) => {
816
833
  const { data, content } = import_gray_matter6.default.read(file);
@@ -818,31 +835,29 @@ var getTeams = (catalogDir) => async (options) => {
818
835
  ...data,
819
836
  id: data.id,
820
837
  name: data.name,
838
+ avatarUrl: data.avatarUrl,
821
839
  markdown: content.trim()
822
840
  };
823
841
  });
824
842
  };
825
- var writeTeam = (catalogDir) => async (team, options = {}) => {
826
- const resource = { ...team };
827
- const currentTeam = await getTeam(catalogDir)(resource.id);
828
- const exists = currentTeam !== void 0;
843
+ var writeUser = (catalogDir) => async (user, options = {}) => {
844
+ const resource = { ...user };
845
+ const currentUser = await getUser(catalogDir)(resource.id);
846
+ const exists = currentUser !== void 0;
829
847
  if (exists && !options.override) {
830
- throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
848
+ throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
831
849
  }
832
850
  const { markdown, ...frontmatter } = resource;
833
851
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
834
852
  import_node_fs5.default.mkdirSync((0, import_node_path10.join)(catalogDir, ""), { recursive: true });
835
853
  import_node_fs5.default.writeFileSync((0, import_node_path10.join)(catalogDir, "", `${resource.id}.mdx`), document);
836
854
  };
837
- var rmTeamById = (catalogDir) => async (id) => {
838
- await import_promises9.default.rm((0, import_node_path10.join)(catalogDir, `${id}.mdx`), { recursive: true });
855
+ var rmUserById = (catalogDir) => async (id) => {
856
+ import_node_fs5.default.rmSync((0, import_node_path10.join)(catalogDir, `${id}.mdx`), { recursive: true });
839
857
  };
840
858
 
841
- // src/users.ts
842
- var import_node_fs6 = __toESM(require("fs"));
843
- var import_node_path11 = require("path");
844
- var import_gray_matter7 = __toESM(require("gray-matter"));
845
- var getUser = (catalogDir) => async (id) => {
859
+ // src/teams.ts
860
+ var getTeam = (catalogDir) => async (id) => {
846
861
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
847
862
  if (files.length == 0) return void 0;
848
863
  const file = files[0];
@@ -851,12 +866,11 @@ var getUser = (catalogDir) => async (id) => {
851
866
  ...data,
852
867
  id: data.id,
853
868
  name: data.name,
854
- avatarUrl: data.avatarUrl,
855
869
  markdown: content.trim()
856
870
  };
857
871
  };
858
- var getUsers = (catalogDir) => async (options) => {
859
- const files = await getFiles(`${catalogDir}/users/*.{md,mdx}`);
872
+ var getTeams = (catalogDir) => async (options) => {
873
+ const files = await getFiles(`${catalogDir}/*.{md,mdx}`);
860
874
  if (files.length === 0) return [];
861
875
  return files.map((file) => {
862
876
  const { data, content } = import_gray_matter7.default.read(file);
@@ -864,29 +878,46 @@ var getUsers = (catalogDir) => async (options) => {
864
878
  ...data,
865
879
  id: data.id,
866
880
  name: data.name,
867
- avatarUrl: data.avatarUrl,
868
881
  markdown: content.trim()
869
882
  };
870
883
  });
871
884
  };
872
- var writeUser = (catalogDir) => async (user, options = {}) => {
873
- const resource = { ...user };
874
- const currentUser = await getUser(catalogDir)(resource.id);
875
- const exists = currentUser !== void 0;
885
+ var writeTeam = (catalogDir) => async (team, options = {}) => {
886
+ const resource = { ...team };
887
+ const currentTeam = await getTeam(catalogDir)(resource.id);
888
+ const exists = currentTeam !== void 0;
876
889
  if (exists && !options.override) {
877
- throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
890
+ throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
878
891
  }
879
892
  const { markdown, ...frontmatter } = resource;
880
893
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
881
894
  import_node_fs6.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
882
895
  import_node_fs6.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
883
896
  };
884
- var rmUserById = (catalogDir) => async (id) => {
885
- import_node_fs6.default.rmSync((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
897
+ var rmTeamById = (catalogDir) => async (id) => {
898
+ await import_promises9.default.rm((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
899
+ };
900
+ var getOwnersForResource = (catalogDir) => async (id, version) => {
901
+ const resource = await getResource(catalogDir, id, version);
902
+ let owners = [];
903
+ if (!resource) return [];
904
+ if (!resource.owners) return [];
905
+ for (const owner of resource.owners) {
906
+ const team = await getTeam(import_node_path12.default.join(catalogDir, "teams"))(owner);
907
+ if (team) {
908
+ owners.push(team);
909
+ } else {
910
+ const user = await getUser(import_node_path12.default.join(catalogDir, "users"))(owner);
911
+ if (user) {
912
+ owners.push(user);
913
+ }
914
+ }
915
+ }
916
+ return owners;
886
917
  };
887
918
 
888
919
  // src/index.ts
889
- var index_default = (path4) => {
920
+ var index_default = (path5) => {
890
921
  return {
891
922
  /**
892
923
  * Returns an events from EventCatalog
@@ -894,13 +925,13 @@ var index_default = (path4) => {
894
925
  * @param version - Optional id of the version to get (supports semver)
895
926
  * @returns Event|Undefined
896
927
  */
897
- getEvent: getEvent((0, import_node_path12.join)(path4)),
928
+ getEvent: getEvent((0, import_node_path13.join)(path5)),
898
929
  /**
899
930
  * Returns all events from EventCatalog
900
931
  * @param latestOnly - optional boolean, set to true to get only latest versions
901
932
  * @returns Event[]|Undefined
902
933
  */
903
- getEvents: getEvents((0, import_node_path12.join)(path4)),
934
+ getEvents: getEvents((0, import_node_path13.join)(path5)),
904
935
  /**
905
936
  * Adds an event to EventCatalog
906
937
  *
@@ -908,7 +939,7 @@ var index_default = (path4) => {
908
939
  * @param options - Optional options to write the event
909
940
  *
910
941
  */
911
- writeEvent: writeEvent((0, import_node_path12.join)(path4, "events")),
942
+ writeEvent: writeEvent((0, import_node_path13.join)(path5, "events")),
912
943
  /**
913
944
  * Adds an event to a service in EventCatalog
914
945
  *
@@ -917,26 +948,26 @@ var index_default = (path4) => {
917
948
  * @param options - Optional options to write the event
918
949
  *
919
950
  */
920
- writeEventToService: writeEventToService((0, import_node_path12.join)(path4)),
951
+ writeEventToService: writeEventToService((0, import_node_path13.join)(path5)),
921
952
  /**
922
953
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
923
954
  *
924
955
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
925
956
  *
926
957
  */
927
- rmEvent: rmEvent((0, import_node_path12.join)(path4, "events")),
958
+ rmEvent: rmEvent((0, import_node_path13.join)(path5, "events")),
928
959
  /**
929
960
  * Remove an event by an Event id
930
961
  *
931
962
  * @param id - The id of the event you want to remove
932
963
  *
933
964
  */
934
- rmEventById: rmEventById((0, import_node_path12.join)(path4)),
965
+ rmEventById: rmEventById((0, import_node_path13.join)(path5)),
935
966
  /**
936
967
  * Moves a given event id to the version directory
937
968
  * @param directory
938
969
  */
939
- versionEvent: versionEvent((0, import_node_path12.join)(path4)),
970
+ versionEvent: versionEvent((0, import_node_path13.join)(path5)),
940
971
  /**
941
972
  * Adds a file to the given event
942
973
  * @param id - The id of the event to add the file to
@@ -944,7 +975,7 @@ var index_default = (path4) => {
944
975
  * @param version - Optional version of the event to add the file to
945
976
  * @returns
946
977
  */
947
- addFileToEvent: addFileToEvent((0, import_node_path12.join)(path4)),
978
+ addFileToEvent: addFileToEvent((0, import_node_path13.join)(path5)),
948
979
  /**
949
980
  * Adds a schema to the given event
950
981
  * @param id - The id of the event to add the schema to
@@ -952,14 +983,14 @@ var index_default = (path4) => {
952
983
  * @param version - Optional version of the event to add the schema to
953
984
  * @returns
954
985
  */
955
- addSchemaToEvent: addSchemaToEvent((0, import_node_path12.join)(path4)),
986
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path13.join)(path5)),
956
987
  /**
957
988
  * Check to see if an event version exists
958
989
  * @param id - The id of the event
959
990
  * @param version - The version of the event (supports semver)
960
991
  * @returns
961
992
  */
962
- eventHasVersion: eventHasVersion((0, import_node_path12.join)(path4)),
993
+ eventHasVersion: eventHasVersion((0, import_node_path13.join)(path5)),
963
994
  /**
964
995
  * ================================
965
996
  * Commands
@@ -971,13 +1002,13 @@ var index_default = (path4) => {
971
1002
  * @param version - Optional id of the version to get (supports semver)
972
1003
  * @returns Command|Undefined
973
1004
  */
974
- getCommand: getCommand((0, import_node_path12.join)(path4)),
1005
+ getCommand: getCommand((0, import_node_path13.join)(path5)),
975
1006
  /**
976
1007
  * Returns all commands from EventCatalog
977
1008
  * @param latestOnly - optional boolean, set to true to get only latest versions
978
1009
  * @returns Command[]|Undefined
979
1010
  */
980
- getCommands: getCommands((0, import_node_path12.join)(path4)),
1011
+ getCommands: getCommands((0, import_node_path13.join)(path5)),
981
1012
  /**
982
1013
  * Adds an command to EventCatalog
983
1014
  *
@@ -985,7 +1016,7 @@ var index_default = (path4) => {
985
1016
  * @param options - Optional options to write the command
986
1017
  *
987
1018
  */
988
- writeCommand: writeCommand((0, import_node_path12.join)(path4, "commands")),
1019
+ writeCommand: writeCommand((0, import_node_path13.join)(path5, "commands")),
989
1020
  /**
990
1021
  * Adds a command to a service in EventCatalog
991
1022
  *
@@ -994,26 +1025,26 @@ var index_default = (path4) => {
994
1025
  * @param options - Optional options to write the command
995
1026
  *
996
1027
  */
997
- writeCommandToService: writeCommandToService((0, import_node_path12.join)(path4)),
1028
+ writeCommandToService: writeCommandToService((0, import_node_path13.join)(path5)),
998
1029
  /**
999
1030
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1000
1031
  *
1001
1032
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1002
1033
  *
1003
1034
  */
1004
- rmCommand: rmCommand((0, import_node_path12.join)(path4, "commands")),
1035
+ rmCommand: rmCommand((0, import_node_path13.join)(path5, "commands")),
1005
1036
  /**
1006
1037
  * Remove an command by an Event id
1007
1038
  *
1008
1039
  * @param id - The id of the command you want to remove
1009
1040
  *
1010
1041
  */
1011
- rmCommandById: rmCommandById((0, import_node_path12.join)(path4)),
1042
+ rmCommandById: rmCommandById((0, import_node_path13.join)(path5)),
1012
1043
  /**
1013
1044
  * Moves a given command id to the version directory
1014
1045
  * @param directory
1015
1046
  */
1016
- versionCommand: versionCommand((0, import_node_path12.join)(path4)),
1047
+ versionCommand: versionCommand((0, import_node_path13.join)(path5)),
1017
1048
  /**
1018
1049
  * Adds a file to the given command
1019
1050
  * @param id - The id of the command to add the file to
@@ -1021,7 +1052,7 @@ var index_default = (path4) => {
1021
1052
  * @param version - Optional version of the command to add the file to
1022
1053
  * @returns
1023
1054
  */
1024
- addFileToCommand: addFileToCommand((0, import_node_path12.join)(path4)),
1055
+ addFileToCommand: addFileToCommand((0, import_node_path13.join)(path5)),
1025
1056
  /**
1026
1057
  * Adds a schema to the given command
1027
1058
  * @param id - The id of the command to add the schema to
@@ -1029,14 +1060,14 @@ var index_default = (path4) => {
1029
1060
  * @param version - Optional version of the command to add the schema to
1030
1061
  * @returns
1031
1062
  */
1032
- addSchemaToCommand: addSchemaToCommand((0, import_node_path12.join)(path4)),
1063
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path13.join)(path5)),
1033
1064
  /**
1034
1065
  * Check to see if a command version exists
1035
1066
  * @param id - The id of the command
1036
1067
  * @param version - The version of the command (supports semver)
1037
1068
  * @returns
1038
1069
  */
1039
- commandHasVersion: commandHasVersion((0, import_node_path12.join)(path4)),
1070
+ commandHasVersion: commandHasVersion((0, import_node_path13.join)(path5)),
1040
1071
  /**
1041
1072
  * ================================
1042
1073
  * Queries
@@ -1048,13 +1079,13 @@ var index_default = (path4) => {
1048
1079
  * @param version - Optional id of the version to get (supports semver)
1049
1080
  * @returns Query|Undefined
1050
1081
  */
1051
- getQuery: getQuery((0, import_node_path12.join)(path4)),
1082
+ getQuery: getQuery((0, import_node_path13.join)(path5)),
1052
1083
  /**
1053
1084
  * Returns all queries from EventCatalog
1054
1085
  * @param latestOnly - optional boolean, set to true to get only latest versions
1055
1086
  * @returns Query[]|Undefined
1056
1087
  */
1057
- getQueries: getQueries((0, import_node_path12.join)(path4)),
1088
+ getQueries: getQueries((0, import_node_path13.join)(path5)),
1058
1089
  /**
1059
1090
  * Adds a query to EventCatalog
1060
1091
  *
@@ -1062,7 +1093,7 @@ var index_default = (path4) => {
1062
1093
  * @param options - Optional options to write the event
1063
1094
  *
1064
1095
  */
1065
- writeQuery: writeQuery((0, import_node_path12.join)(path4, "queries")),
1096
+ writeQuery: writeQuery((0, import_node_path13.join)(path5, "queries")),
1066
1097
  /**
1067
1098
  * Adds a query to a service in EventCatalog
1068
1099
  *
@@ -1071,26 +1102,26 @@ var index_default = (path4) => {
1071
1102
  * @param options - Optional options to write the query
1072
1103
  *
1073
1104
  */
1074
- writeQueryToService: writeQueryToService((0, import_node_path12.join)(path4)),
1105
+ writeQueryToService: writeQueryToService((0, import_node_path13.join)(path5)),
1075
1106
  /**
1076
1107
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1077
1108
  *
1078
1109
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1079
1110
  *
1080
1111
  */
1081
- rmQuery: rmQuery((0, import_node_path12.join)(path4, "queries")),
1112
+ rmQuery: rmQuery((0, import_node_path13.join)(path5, "queries")),
1082
1113
  /**
1083
1114
  * Remove a query by a Query id
1084
1115
  *
1085
1116
  * @param id - The id of the query you want to remove
1086
1117
  *
1087
1118
  */
1088
- rmQueryById: rmQueryById((0, import_node_path12.join)(path4)),
1119
+ rmQueryById: rmQueryById((0, import_node_path13.join)(path5)),
1089
1120
  /**
1090
1121
  * Moves a given query id to the version directory
1091
1122
  * @param directory
1092
1123
  */
1093
- versionQuery: versionQuery((0, import_node_path12.join)(path4)),
1124
+ versionQuery: versionQuery((0, import_node_path13.join)(path5)),
1094
1125
  /**
1095
1126
  * Adds a file to the given query
1096
1127
  * @param id - The id of the query to add the file to
@@ -1098,7 +1129,7 @@ var index_default = (path4) => {
1098
1129
  * @param version - Optional version of the query to add the file to
1099
1130
  * @returns
1100
1131
  */
1101
- addFileToQuery: addFileToQuery((0, import_node_path12.join)(path4)),
1132
+ addFileToQuery: addFileToQuery((0, import_node_path13.join)(path5)),
1102
1133
  /**
1103
1134
  * Adds a schema to the given query
1104
1135
  * @param id - The id of the query to add the schema to
@@ -1106,14 +1137,14 @@ var index_default = (path4) => {
1106
1137
  * @param version - Optional version of the query to add the schema to
1107
1138
  * @returns
1108
1139
  */
1109
- addSchemaToQuery: addSchemaToQuery((0, import_node_path12.join)(path4)),
1140
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path13.join)(path5)),
1110
1141
  /**
1111
1142
  * Check to see if an query version exists
1112
1143
  * @param id - The id of the query
1113
1144
  * @param version - The version of the query (supports semver)
1114
1145
  * @returns
1115
1146
  */
1116
- queryHasVersion: queryHasVersion((0, import_node_path12.join)(path4)),
1147
+ queryHasVersion: queryHasVersion((0, import_node_path13.join)(path5)),
1117
1148
  /**
1118
1149
  * ================================
1119
1150
  * Channels
@@ -1125,13 +1156,13 @@ var index_default = (path4) => {
1125
1156
  * @param version - Optional id of the version to get (supports semver)
1126
1157
  * @returns Channel|Undefined
1127
1158
  */
1128
- getChannel: getChannel((0, import_node_path12.join)(path4)),
1159
+ getChannel: getChannel((0, import_node_path13.join)(path5)),
1129
1160
  /**
1130
1161
  * Returns all channels from EventCatalog
1131
1162
  * @param latestOnly - optional boolean, set to true to get only latest versions
1132
1163
  * @returns Channel[]|Undefined
1133
1164
  */
1134
- getChannels: getChannels((0, import_node_path12.join)(path4)),
1165
+ getChannels: getChannels((0, import_node_path13.join)(path5)),
1135
1166
  /**
1136
1167
  * Adds an channel to EventCatalog
1137
1168
  *
@@ -1139,33 +1170,33 @@ var index_default = (path4) => {
1139
1170
  * @param options - Optional options to write the channel
1140
1171
  *
1141
1172
  */
1142
- writeChannel: writeChannel((0, import_node_path12.join)(path4, "channels")),
1173
+ writeChannel: writeChannel((0, import_node_path13.join)(path5, "channels")),
1143
1174
  /**
1144
1175
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1145
1176
  *
1146
1177
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1147
1178
  *
1148
1179
  */
1149
- rmChannel: rmChannel((0, import_node_path12.join)(path4, "channels")),
1180
+ rmChannel: rmChannel((0, import_node_path13.join)(path5, "channels")),
1150
1181
  /**
1151
1182
  * Remove an channel by an Event id
1152
1183
  *
1153
1184
  * @param id - The id of the channel you want to remove
1154
1185
  *
1155
1186
  */
1156
- rmChannelById: rmChannelById((0, import_node_path12.join)(path4)),
1187
+ rmChannelById: rmChannelById((0, import_node_path13.join)(path5)),
1157
1188
  /**
1158
1189
  * Moves a given channel id to the version directory
1159
1190
  * @param directory
1160
1191
  */
1161
- versionChannel: versionChannel((0, import_node_path12.join)(path4)),
1192
+ versionChannel: versionChannel((0, import_node_path13.join)(path5)),
1162
1193
  /**
1163
1194
  * Check to see if a channel version exists
1164
1195
  * @param id - The id of the channel
1165
1196
  * @param version - The version of the channel (supports semver)
1166
1197
  * @returns
1167
1198
  */
1168
- channelHasVersion: channelHasVersion((0, import_node_path12.join)(path4)),
1199
+ channelHasVersion: channelHasVersion((0, import_node_path13.join)(path5)),
1169
1200
  /**
1170
1201
  * Add a channel to an event
1171
1202
  *
@@ -1182,7 +1213,7 @@ var index_default = (path4) => {
1182
1213
  *
1183
1214
  * ```
1184
1215
  */
1185
- addEventToChannel: addMessageToChannel((0, import_node_path12.join)(path4), "events"),
1216
+ addEventToChannel: addMessageToChannel((0, import_node_path13.join)(path5), "events"),
1186
1217
  /**
1187
1218
  * Add a channel to an command
1188
1219
  *
@@ -1199,7 +1230,7 @@ var index_default = (path4) => {
1199
1230
  *
1200
1231
  * ```
1201
1232
  */
1202
- addCommandToChannel: addMessageToChannel((0, import_node_path12.join)(path4), "commands"),
1233
+ addCommandToChannel: addMessageToChannel((0, import_node_path13.join)(path5), "commands"),
1203
1234
  /**
1204
1235
  * Add a channel to an query
1205
1236
  *
@@ -1216,7 +1247,7 @@ var index_default = (path4) => {
1216
1247
  *
1217
1248
  * ```
1218
1249
  */
1219
- addQueryToChannel: addMessageToChannel((0, import_node_path12.join)(path4), "queries"),
1250
+ addQueryToChannel: addMessageToChannel((0, import_node_path13.join)(path5), "queries"),
1220
1251
  /**
1221
1252
  * ================================
1222
1253
  * SERVICES
@@ -1229,14 +1260,14 @@ var index_default = (path4) => {
1229
1260
  * @param options - Optional options to write the event
1230
1261
  *
1231
1262
  */
1232
- writeService: writeService((0, import_node_path12.join)(path4, "services")),
1263
+ writeService: writeService((0, import_node_path13.join)(path5, "services")),
1233
1264
  /**
1234
1265
  * Adds a versioned service to EventCatalog
1235
1266
  *
1236
1267
  * @param service - The service to write
1237
1268
  *
1238
1269
  */
1239
- writeVersionedService: writeVersionedService((0, import_node_path12.join)(path4, "services")),
1270
+ writeVersionedService: writeVersionedService((0, import_node_path13.join)(path5, "services")),
1240
1271
  /**
1241
1272
  * Adds a service to a domain in EventCatalog
1242
1273
  *
@@ -1245,39 +1276,45 @@ var index_default = (path4) => {
1245
1276
  * @param options - Optional options to write the event
1246
1277
  *
1247
1278
  */
1248
- writeServiceToDomain: writeServiceToDomain((0, import_node_path12.join)(path4, "domains")),
1279
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path13.join)(path5, "domains")),
1249
1280
  /**
1250
1281
  * Returns a service from EventCatalog
1251
1282
  * @param id - The id of the service to retrieve
1252
1283
  * @param version - Optional id of the version to get (supports semver)
1253
1284
  * @returns Service|Undefined
1254
1285
  */
1255
- getService: getService((0, import_node_path12.join)(path4)),
1286
+ getService: getService((0, import_node_path13.join)(path5)),
1287
+ /**
1288
+ * Returns a service from EventCatalog by it's path.
1289
+ * @param path - The path to the service to retrieve
1290
+ * @returns Service|Undefined
1291
+ */
1292
+ getServiceByPath: getServiceByPath((0, import_node_path13.join)(path5)),
1256
1293
  /**
1257
1294
  * Returns all services from EventCatalog
1258
1295
  * @param latestOnly - optional boolean, set to true to get only latest versions
1259
1296
  * @returns Service[]|Undefined
1260
1297
  */
1261
- getServices: getServices((0, import_node_path12.join)(path4)),
1298
+ getServices: getServices((0, import_node_path13.join)(path5)),
1262
1299
  /**
1263
1300
  * Moves a given service id to the version directory
1264
1301
  * @param directory
1265
1302
  */
1266
- versionService: versionService((0, import_node_path12.join)(path4)),
1303
+ versionService: versionService((0, import_node_path13.join)(path5)),
1267
1304
  /**
1268
1305
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1269
1306
  *
1270
1307
  * @param path - The path to your service, e.g. `/InventoryService`
1271
1308
  *
1272
1309
  */
1273
- rmService: rmService((0, import_node_path12.join)(path4, "services")),
1310
+ rmService: rmService((0, import_node_path13.join)(path5, "services")),
1274
1311
  /**
1275
1312
  * Remove an service by an service id
1276
1313
  *
1277
1314
  * @param id - The id of the service you want to remove
1278
1315
  *
1279
1316
  */
1280
- rmServiceById: rmServiceById((0, import_node_path12.join)(path4)),
1317
+ rmServiceById: rmServiceById((0, import_node_path13.join)(path5)),
1281
1318
  /**
1282
1319
  * Adds a file to the given service
1283
1320
  * @param id - The id of the service to add the file to
@@ -1285,21 +1322,21 @@ var index_default = (path4) => {
1285
1322
  * @param version - Optional version of the service to add the file to
1286
1323
  * @returns
1287
1324
  */
1288
- addFileToService: addFileToService((0, import_node_path12.join)(path4)),
1325
+ addFileToService: addFileToService((0, import_node_path13.join)(path5)),
1289
1326
  /**
1290
1327
  * Returns the specifications for a given service
1291
1328
  * @param id - The id of the service to retrieve the specifications for
1292
1329
  * @param version - Optional version of the service
1293
1330
  * @returns
1294
1331
  */
1295
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path12.join)(path4)),
1332
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path13.join)(path5)),
1296
1333
  /**
1297
1334
  * Check to see if a service version exists
1298
1335
  * @param id - The id of the service
1299
1336
  * @param version - The version of the service (supports semver)
1300
1337
  * @returns
1301
1338
  */
1302
- serviceHasVersion: serviceHasVersion((0, import_node_path12.join)(path4)),
1339
+ serviceHasVersion: serviceHasVersion((0, import_node_path13.join)(path5)),
1303
1340
  /**
1304
1341
  * Add an event to a service by it's id.
1305
1342
  *
@@ -1319,7 +1356,7 @@ var index_default = (path4) => {
1319
1356
  *
1320
1357
  * ```
1321
1358
  */
1322
- addEventToService: addMessageToService((0, import_node_path12.join)(path4)),
1359
+ addEventToService: addMessageToService((0, import_node_path13.join)(path5)),
1323
1360
  /**
1324
1361
  * Add a command to a service by it's id.
1325
1362
  *
@@ -1339,7 +1376,7 @@ var index_default = (path4) => {
1339
1376
  *
1340
1377
  * ```
1341
1378
  */
1342
- addCommandToService: addMessageToService((0, import_node_path12.join)(path4)),
1379
+ addCommandToService: addMessageToService((0, import_node_path13.join)(path5)),
1343
1380
  /**
1344
1381
  * Add a query to a service by it's id.
1345
1382
  *
@@ -1359,7 +1396,24 @@ var index_default = (path4) => {
1359
1396
  *
1360
1397
  * ```
1361
1398
  */
1362
- addQueryToService: addMessageToService((0, import_node_path12.join)(path4)),
1399
+ addQueryToService: addMessageToService((0, import_node_path13.join)(path5)),
1400
+ /**
1401
+ * Check to see if a service exists by it's path.
1402
+ *
1403
+ * @example
1404
+ * ```ts
1405
+ * import utils from '@eventcatalog/utils';
1406
+ *
1407
+ * const { isService } = utils('/path/to/eventcatalog');
1408
+ *
1409
+ * // returns true if the path is a service
1410
+ * await isService('/services/InventoryService/index.mdx');
1411
+ * ```
1412
+ *
1413
+ * @param path - The path to the service to check
1414
+ * @returns boolean
1415
+ */
1416
+ isService: isService((0, import_node_path13.join)(path5)),
1363
1417
  /**
1364
1418
  * ================================
1365
1419
  * Domains
@@ -1372,39 +1426,39 @@ var index_default = (path4) => {
1372
1426
  * @param options - Optional options to write the event
1373
1427
  *
1374
1428
  */
1375
- writeDomain: writeDomain((0, import_node_path12.join)(path4, "domains")),
1429
+ writeDomain: writeDomain((0, import_node_path13.join)(path5, "domains")),
1376
1430
  /**
1377
1431
  * Returns a domain from EventCatalog
1378
1432
  * @param id - The id of the domain to retrieve
1379
1433
  * @param version - Optional id of the version to get (supports semver)
1380
1434
  * @returns Domain|Undefined
1381
1435
  */
1382
- getDomain: getDomain((0, import_node_path12.join)(path4, "domains")),
1436
+ getDomain: getDomain((0, import_node_path13.join)(path5, "domains")),
1383
1437
  /**
1384
1438
  * Returns all domains from EventCatalog
1385
1439
  * @param latestOnly - optional boolean, set to true to get only latest versions
1386
1440
  * @returns Domain[]|Undefined
1387
1441
  */
1388
- getDomains: getDomains((0, import_node_path12.join)(path4)),
1442
+ getDomains: getDomains((0, import_node_path13.join)(path5)),
1389
1443
  /**
1390
1444
  * Moves a given domain id to the version directory
1391
1445
  * @param directory
1392
1446
  */
1393
- versionDomain: versionDomain((0, import_node_path12.join)(path4, "domains")),
1447
+ versionDomain: versionDomain((0, import_node_path13.join)(path5, "domains")),
1394
1448
  /**
1395
1449
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1396
1450
  *
1397
1451
  * @param path - The path to your domain, e.g. `/Payment`
1398
1452
  *
1399
1453
  */
1400
- rmDomain: rmDomain((0, import_node_path12.join)(path4, "domains")),
1454
+ rmDomain: rmDomain((0, import_node_path13.join)(path5, "domains")),
1401
1455
  /**
1402
1456
  * Remove an service by an domain id
1403
1457
  *
1404
1458
  * @param id - The id of the domain you want to remove
1405
1459
  *
1406
1460
  */
1407
- rmDomainById: rmDomainById((0, import_node_path12.join)(path4, "domains")),
1461
+ rmDomainById: rmDomainById((0, import_node_path13.join)(path5, "domains")),
1408
1462
  /**
1409
1463
  * Adds a file to the given domain
1410
1464
  * @param id - The id of the domain to add the file to
@@ -1412,28 +1466,28 @@ var index_default = (path4) => {
1412
1466
  * @param version - Optional version of the domain to add the file to
1413
1467
  * @returns
1414
1468
  */
1415
- addFileToDomain: addFileToDomain((0, import_node_path12.join)(path4, "domains")),
1469
+ addFileToDomain: addFileToDomain((0, import_node_path13.join)(path5, "domains")),
1416
1470
  /**
1417
1471
  * Adds an ubiquitous language dictionary to a domain
1418
1472
  * @param id - The id of the domain to add the ubiquitous language to
1419
1473
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1420
1474
  * @param version - Optional version of the domain to add the ubiquitous language to
1421
1475
  */
1422
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path12.join)(path4, "domains")),
1476
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path13.join)(path5, "domains")),
1423
1477
  /**
1424
1478
  * Get the ubiquitous language dictionary from a domain
1425
1479
  * @param id - The id of the domain to get the ubiquitous language from
1426
1480
  * @param version - Optional version of the domain to get the ubiquitous language from
1427
1481
  * @returns
1428
1482
  */
1429
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path12.join)(path4, "domains")),
1483
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path13.join)(path5, "domains")),
1430
1484
  /**
1431
1485
  * Check to see if a domain version exists
1432
1486
  * @param id - The id of the domain
1433
1487
  * @param version - The version of the domain (supports semver)
1434
1488
  * @returns
1435
1489
  */
1436
- domainHasVersion: domainHasVersion((0, import_node_path12.join)(path4)),
1490
+ domainHasVersion: domainHasVersion((0, import_node_path13.join)(path5)),
1437
1491
  /**
1438
1492
  * Adds a given service to a domain
1439
1493
  * @param id - The id of the domain
@@ -1441,7 +1495,7 @@ var index_default = (path4) => {
1441
1495
  * @param version - (Optional) The version of the domain to add the service to
1442
1496
  * @returns
1443
1497
  */
1444
- addServiceToDomain: addServiceToDomain((0, import_node_path12.join)(path4, "domains")),
1498
+ addServiceToDomain: addServiceToDomain((0, import_node_path13.join)(path5, "domains")),
1445
1499
  /**
1446
1500
  * Adds a given subdomain to a domain
1447
1501
  * @param id - The id of the domain
@@ -1449,7 +1503,7 @@ var index_default = (path4) => {
1449
1503
  * @param version - (Optional) The version of the domain to add the subdomain to
1450
1504
  * @returns
1451
1505
  */
1452
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path12.join)(path4, "domains")),
1506
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path13.join)(path5, "domains")),
1453
1507
  /**
1454
1508
  * ================================
1455
1509
  * Teams
@@ -1462,25 +1516,25 @@ var index_default = (path4) => {
1462
1516
  * @param options - Optional options to write the team
1463
1517
  *
1464
1518
  */
1465
- writeTeam: writeTeam((0, import_node_path12.join)(path4, "teams")),
1519
+ writeTeam: writeTeam((0, import_node_path13.join)(path5, "teams")),
1466
1520
  /**
1467
1521
  * Returns a team from EventCatalog
1468
1522
  * @param id - The id of the team to retrieve
1469
1523
  * @returns Team|Undefined
1470
1524
  */
1471
- getTeam: getTeam((0, import_node_path12.join)(path4, "teams")),
1525
+ getTeam: getTeam((0, import_node_path13.join)(path5, "teams")),
1472
1526
  /**
1473
1527
  * Returns all teams from EventCatalog
1474
1528
  * @returns Team[]|Undefined
1475
1529
  */
1476
- getTeams: getTeams((0, import_node_path12.join)(path4)),
1530
+ getTeams: getTeams((0, import_node_path13.join)(path5, "teams")),
1477
1531
  /**
1478
1532
  * Remove a team by the team id
1479
1533
  *
1480
1534
  * @param id - The id of the team you want to remove
1481
1535
  *
1482
1536
  */
1483
- rmTeamById: rmTeamById((0, import_node_path12.join)(path4, "teams")),
1537
+ rmTeamById: rmTeamById((0, import_node_path13.join)(path5, "teams")),
1484
1538
  /**
1485
1539
  * ================================
1486
1540
  * Users
@@ -1493,25 +1547,25 @@ var index_default = (path4) => {
1493
1547
  * @param options - Optional options to write the user
1494
1548
  *
1495
1549
  */
1496
- writeUser: writeUser((0, import_node_path12.join)(path4, "users")),
1550
+ writeUser: writeUser((0, import_node_path13.join)(path5, "users")),
1497
1551
  /**
1498
1552
  * Returns a user from EventCatalog
1499
1553
  * @param id - The id of the user to retrieve
1500
1554
  * @returns User|Undefined
1501
1555
  */
1502
- getUser: getUser((0, import_node_path12.join)(path4, "users")),
1556
+ getUser: getUser((0, import_node_path13.join)(path5, "users")),
1503
1557
  /**
1504
1558
  * Returns all user from EventCatalog
1505
1559
  * @returns User[]|Undefined
1506
1560
  */
1507
- getUsers: getUsers((0, import_node_path12.join)(path4)),
1561
+ getUsers: getUsers((0, import_node_path13.join)(path5)),
1508
1562
  /**
1509
1563
  * Remove a user by the user id
1510
1564
  *
1511
1565
  * @param id - The id of the user you want to remove
1512
1566
  *
1513
1567
  */
1514
- rmUserById: rmUserById((0, import_node_path12.join)(path4, "users")),
1568
+ rmUserById: rmUserById((0, import_node_path13.join)(path5, "users")),
1515
1569
  /**
1516
1570
  * ================================
1517
1571
  * Custom Docs
@@ -1522,32 +1576,32 @@ var index_default = (path4) => {
1522
1576
  * @param path - The path to the custom doc to retrieve
1523
1577
  * @returns CustomDoc|Undefined
1524
1578
  */
1525
- getCustomDoc: getCustomDoc((0, import_node_path12.join)(path4, "docs")),
1579
+ getCustomDoc: getCustomDoc((0, import_node_path13.join)(path5, "docs")),
1526
1580
  /**
1527
1581
  * Returns all custom docs from EventCatalog
1528
1582
  * @param options - Optional options to get custom docs from a specific path
1529
1583
  * @returns CustomDoc[]|Undefined
1530
1584
  */
1531
- getCustomDocs: getCustomDocs((0, import_node_path12.join)(path4, "docs")),
1585
+ getCustomDocs: getCustomDocs((0, import_node_path13.join)(path5, "docs")),
1532
1586
  /**
1533
1587
  * Writes a custom doc to EventCatalog
1534
1588
  * @param customDoc - The custom doc to write
1535
1589
  * @param options - Optional options to write the custom doc
1536
1590
  *
1537
1591
  */
1538
- writeCustomDoc: writeCustomDoc((0, import_node_path12.join)(path4, "docs")),
1592
+ writeCustomDoc: writeCustomDoc((0, import_node_path13.join)(path5, "docs")),
1539
1593
  /**
1540
1594
  * Removes a custom doc from EventCatalog
1541
1595
  * @param path - The path to the custom doc to remove
1542
1596
  *
1543
1597
  */
1544
- rmCustomDoc: rmCustomDoc((0, import_node_path12.join)(path4, "docs")),
1598
+ rmCustomDoc: rmCustomDoc((0, import_node_path13.join)(path5, "docs")),
1545
1599
  /**
1546
1600
  * Dumps the catalog to a JSON file.
1547
1601
  * @param directory - The directory to dump the catalog to
1548
1602
  * @returns A JSON file with the catalog
1549
1603
  */
1550
- dumpCatalog: dumpCatalog((0, import_node_path12.join)(path4)),
1604
+ dumpCatalog: dumpCatalog((0, import_node_path13.join)(path5)),
1551
1605
  /**
1552
1606
  * Returns the event catalog configuration file.
1553
1607
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1555,7 +1609,7 @@ var index_default = (path4) => {
1555
1609
  * @param directory - The directory of the catalog.
1556
1610
  * @returns A JSON object with the configuration for the event catalog.
1557
1611
  */
1558
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path12.join)(path4)),
1612
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path13.join)(path5)),
1559
1613
  /**
1560
1614
  * ================================
1561
1615
  * Resources Utils
@@ -1576,14 +1630,21 @@ var index_default = (path4) => {
1576
1630
  * @param path - The path to the message to retrieve
1577
1631
  * @returns Message|Undefined
1578
1632
  */
1579
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path12.join)(path4)),
1633
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path13.join)(path5)),
1580
1634
  /**
1581
1635
  * Returns the producers and consumers (services) for a given message
1582
1636
  * @param id - The id of the message to get the producers and consumers for
1583
1637
  * @param version - Optional version of the message
1584
1638
  * @returns { producers: Service[], consumers: Service[] }
1585
1639
  */
1586
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path12.join)(path4))
1640
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path13.join)(path5)),
1641
+ /**
1642
+ * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1643
+ * @param id - The id of the resource to get the owners for
1644
+ * @param version - Optional version of the resource
1645
+ * @returns { owners: User[] }
1646
+ */
1647
+ getOwnersForResource: getOwnersForResource((0, import_node_path13.join)(path5))
1587
1648
  };
1588
1649
  };
1589
1650
 
@@ -1591,7 +1652,7 @@ var index_default = (path4) => {
1591
1652
  var DUMP_VERSION = "0.0.1";
1592
1653
  var getEventCatalogVersion = async (catalogDir) => {
1593
1654
  try {
1594
- const packageJson = import_fs.default.readFileSync((0, import_node_path13.join)(catalogDir, "package.json"), "utf8");
1655
+ const packageJson = import_fs.default.readFileSync((0, import_node_path14.join)(catalogDir, "package.json"), "utf8");
1595
1656
  const packageJsonObject = JSON.parse(packageJson);
1596
1657
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
1597
1658
  } catch (error) {
@@ -1604,7 +1665,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1604
1665
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1605
1666
  let schema = "";
1606
1667
  if (resource.schemaPath && resourcePath?.fullPath) {
1607
- const pathToSchema = import_node_path13.default.join(import_node_path13.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1668
+ const pathToSchema = import_node_path14.default.join(import_node_path14.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1608
1669
  if (import_fs.default.existsSync(pathToSchema)) {
1609
1670
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1610
1671
  }
@@ -1625,8 +1686,8 @@ var filterCollection = (collection, options) => {
1625
1686
  };
1626
1687
  var getEventCatalogConfigurationFile = (directory) => async () => {
1627
1688
  try {
1628
- const path4 = (0, import_node_path13.join)(directory, "eventcatalog.config.js");
1629
- const configModule = await import(path4);
1689
+ const path5 = (0, import_node_path14.join)(directory, "eventcatalog.config.js");
1690
+ const configModule = await import(path5);
1630
1691
  return configModule.default;
1631
1692
  } catch (error) {
1632
1693
  console.error("Error getting event catalog configuration file", error);
@@ -1634,7 +1695,7 @@ var getEventCatalogConfigurationFile = (directory) => async () => {
1634
1695
  }
1635
1696
  };
1636
1697
  var dumpCatalog = (directory) => async (options) => {
1637
- const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers2 } = index_default(directory);
1698
+ const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = index_default(directory);
1638
1699
  const { includeMarkdown = true } = options || {};
1639
1700
  const domains = await getDomains2();
1640
1701
  const services = await getServices2();
@@ -1642,7 +1703,7 @@ var dumpCatalog = (directory) => async (options) => {
1642
1703
  const commands = await getCommands2();
1643
1704
  const queries = await getQueries2();
1644
1705
  const teams = await getTeams2();
1645
- const users = await getUsers2();
1706
+ const users = await getUsers3();
1646
1707
  const channels = await getChannels2();
1647
1708
  const [
1648
1709
  hydratedDomains,