@eventcatalog/sdk 2.6.4 → 2.6.6

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