@eventcatalog/sdk 2.8.3 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/dist/channels.js +36 -28
  3. package/dist/channels.js.map +1 -1
  4. package/dist/channels.mjs +32 -24
  5. package/dist/channels.mjs.map +1 -1
  6. package/dist/commands.js +31 -23
  7. package/dist/commands.js.map +1 -1
  8. package/dist/commands.mjs +30 -22
  9. package/dist/commands.mjs.map +1 -1
  10. package/dist/containers.js +31 -23
  11. package/dist/containers.js.map +1 -1
  12. package/dist/containers.mjs +30 -22
  13. package/dist/containers.mjs.map +1 -1
  14. package/dist/custom-docs.js +8 -7
  15. package/dist/custom-docs.js.map +1 -1
  16. package/dist/custom-docs.mjs +8 -7
  17. package/dist/custom-docs.mjs.map +1 -1
  18. package/dist/data-stores.js +31 -23
  19. package/dist/data-stores.js.map +1 -1
  20. package/dist/data-stores.mjs +30 -22
  21. package/dist/data-stores.mjs.map +1 -1
  22. package/dist/domains.js +36 -28
  23. package/dist/domains.js.map +1 -1
  24. package/dist/domains.mjs +37 -29
  25. package/dist/domains.mjs.map +1 -1
  26. package/dist/entities.js +30 -22
  27. package/dist/entities.js.map +1 -1
  28. package/dist/entities.mjs +30 -22
  29. package/dist/entities.mjs.map +1 -1
  30. package/dist/eventcatalog.js +228 -211
  31. package/dist/eventcatalog.js.map +1 -1
  32. package/dist/eventcatalog.mjs +200 -183
  33. package/dist/eventcatalog.mjs.map +1 -1
  34. package/dist/events.js +31 -23
  35. package/dist/events.js.map +1 -1
  36. package/dist/events.mjs +30 -22
  37. package/dist/events.mjs.map +1 -1
  38. package/dist/index.d.mts +5 -8
  39. package/dist/index.d.ts +5 -8
  40. package/dist/index.js +228 -211
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.mjs +200 -183
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/messages.js +30 -22
  45. package/dist/messages.js.map +1 -1
  46. package/dist/messages.mjs +29 -21
  47. package/dist/messages.mjs.map +1 -1
  48. package/dist/queries.js +31 -23
  49. package/dist/queries.js.map +1 -1
  50. package/dist/queries.mjs +30 -22
  51. package/dist/queries.mjs.map +1 -1
  52. package/dist/services.js +48 -40
  53. package/dist/services.js.map +1 -1
  54. package/dist/services.mjs +43 -35
  55. package/dist/services.mjs.map +1 -1
  56. package/dist/teams.js +30 -22
  57. package/dist/teams.js.map +1 -1
  58. package/dist/teams.mjs +26 -18
  59. package/dist/teams.mjs.map +1 -1
  60. package/dist/users.js.map +1 -1
  61. package/dist/users.mjs +1 -1
  62. package/dist/users.mjs.map +1 -1
  63. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import fsSync from "fs";
11
11
  import { copy } from "fs-extra";
12
12
  import { join, dirname, normalize, resolve, relative } from "path";
13
13
  import matter from "gray-matter";
14
- import { satisfies, validRange, valid } from "semver";
14
+ import { satisfies, validRange } from "semver";
15
15
  var versionExists = async (catalogDir, id, version) => {
16
16
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
17
17
  const matchedFiles = await searchFilesForId(files, id, version) || [];
@@ -20,26 +20,33 @@ var versionExists = async (catalogDir, id, version) => {
20
20
  var findFileById = async (catalogDir, id, version) => {
21
21
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
22
22
  const matchedFiles = await searchFilesForId(files, id) || [];
23
- const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
23
+ const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
24
24
  if (!version) {
25
25
  return latestVersion;
26
26
  }
27
- const parsedFiles = matchedFiles.map((path5) => {
28
- const { data } = matter.read(path5);
29
- return { ...data, path: path5 };
27
+ const parsedFiles = matchedFiles.map((path6) => {
28
+ const { data } = matter.read(path6);
29
+ return { ...data, path: path6 };
30
30
  });
31
- const semverRange = validRange(version);
32
- if (semverRange && valid(version)) {
33
- const match2 = parsedFiles.filter((c) => satisfies(c.version, semverRange));
34
- return match2.length > 0 ? match2[0].path : void 0;
31
+ if (version === "latest") {
32
+ return latestVersion;
35
33
  }
36
- const sorted = parsedFiles.sort((a, b) => {
37
- return a.version.localeCompare(b.version);
38
- });
39
- const match = sorted.length > 0 ? [sorted[sorted.length - 1]] : [];
40
- if (match.length > 0) {
41
- return match[0].path;
34
+ const exactMatch = parsedFiles.find((c) => c.version === version);
35
+ if (exactMatch) {
36
+ return exactMatch.path;
37
+ }
38
+ const semverRange = validRange(version);
39
+ if (semverRange) {
40
+ const match = parsedFiles.filter((c) => {
41
+ try {
42
+ return satisfies(c.version, semverRange);
43
+ } catch (error) {
44
+ return false;
45
+ }
46
+ });
47
+ return match.length > 0 ? match[0].path : void 0;
42
48
  }
49
+ return void 0;
43
50
  };
44
51
  var getFiles = async (pattern, ignore = "") => {
45
52
  try {
@@ -67,8 +74,8 @@ var getFiles = async (pattern, ignore = "") => {
67
74
  );
68
75
  }
69
76
  };
70
- var readMdxFile = async (path5) => {
71
- const { data } = matter.read(path5);
77
+ var readMdxFile = async (path6) => {
78
+ const { data } = matter.read(path6);
72
79
  const { markdown, ...frontmatter } = data;
73
80
  return { ...frontmatter, markdown };
74
81
  };
@@ -121,6 +128,7 @@ import fsSync2 from "fs";
121
128
  import { satisfies as satisfies2 } from "semver";
122
129
  import { lock, unlock } from "proper-lockfile";
123
130
  import { basename as basename2 } from "path";
131
+ import path from "path";
124
132
  var versionResource = async (catalogDir, id) => {
125
133
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
126
134
  const matchedFiles = await searchFilesForId(files, id);
@@ -160,8 +168,8 @@ var writeResource = async (catalogDir, resource, options = {
160
168
  versionExistingContent: false,
161
169
  format: "mdx"
162
170
  }) => {
163
- const path5 = options.path || `/${resource.id}`;
164
- const fullPath = join2(catalogDir, path5);
171
+ const path6 = options.path || `/${resource.id}`;
172
+ const fullPath = join2(catalogDir, path6);
165
173
  const format = options.format || "mdx";
166
174
  fsSync2.mkdirSync(fullPath, { recursive: true });
167
175
  const lockPath = join2(fullPath, `index.${format}`);
@@ -227,6 +235,11 @@ var getResourcePath = async (catalogDir, id, version) => {
227
235
  directory: dirname2(file.replace(catalogDir, ""))
228
236
  };
229
237
  };
238
+ var getResourceFolderName = async (catalogDir, id, version) => {
239
+ const paths = await getResourcePath(catalogDir, id, version);
240
+ if (!paths) return;
241
+ return paths?.directory.split(path.sep).filter(Boolean).pop();
242
+ };
230
243
  var toResource = async (catalogDir, rawContents) => {
231
244
  const { data, content } = matter2(rawContents);
232
245
  return {
@@ -288,16 +301,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
288
301
  );
289
302
  }
290
303
  };
291
- var waitForFileRemoval = async (path5, maxRetries = 50, delay = 10) => {
304
+ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
292
305
  for (let i = 0; i < maxRetries; i++) {
293
306
  try {
294
- await fs.access(path5);
307
+ await fs.access(path6);
295
308
  await new Promise((resolve2) => setTimeout(resolve2, delay));
296
309
  } catch (error) {
297
310
  return;
298
311
  }
299
312
  }
300
- throw new Error(`File/directory ${path5} was not removed after ${maxRetries} attempts`);
313
+ throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
301
314
  };
302
315
  var addFileToResource = async (catalogDir, id, file, version) => {
303
316
  const pathToResource = await findFileById(catalogDir, id, version);
@@ -344,8 +357,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
344
357
  pathForEvent = join3(pathForEvent, event.id);
345
358
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
346
359
  };
347
- var rmEvent = (directory) => async (path5) => {
348
- await fs2.rm(join3(directory, path5), { recursive: true });
360
+ var rmEvent = (directory) => async (path6) => {
361
+ await fs2.rm(join3(directory, path6), { recursive: true });
349
362
  };
350
363
  var rmEventById = (directory) => async (id, version, persistFiles) => {
351
364
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -380,8 +393,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
380
393
  pathForCommand = join4(pathForCommand, command.id);
381
394
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
382
395
  };
383
- var rmCommand = (directory) => async (path5) => {
384
- await fs3.rm(join4(directory, path5), { recursive: true });
396
+ var rmCommand = (directory) => async (path6) => {
397
+ await fs3.rm(join4(directory, path6), { recursive: true });
385
398
  };
386
399
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
387
400
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -414,8 +427,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
414
427
  pathForQuery = join5(pathForQuery, query.id);
415
428
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
416
429
  };
417
- var rmQuery = (directory) => async (path5) => {
418
- await fs4.rm(join5(directory, path5), { recursive: true });
430
+ var rmQuery = (directory) => async (path6) => {
431
+ await fs4.rm(join5(directory, path6), { recursive: true });
419
432
  };
420
433
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
421
434
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -434,8 +447,8 @@ var queryHasVersion = (directory) => async (id, version) => {
434
447
  import fs5 from "fs/promises";
435
448
  import { join as join6, dirname as dirname4, extname, relative as relative2 } from "path";
436
449
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
437
- var getServiceByPath = (directory) => async (path5) => {
438
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
450
+ var getServiceByPath = (directory) => async (path6) => {
451
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
439
452
  return service;
440
453
  };
441
454
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -459,8 +472,8 @@ var writeService = (directory) => async (service, options = {
459
472
  };
460
473
  var writeVersionedService = (directory) => async (service) => {
461
474
  const resource = { ...service };
462
- const path5 = getVersionedDirectory(service.id, service.version);
463
- return await writeService(directory)(resource, { path: path5 });
475
+ const path6 = getVersionedDirectory(service.id, service.version);
476
+ return await writeService(directory)(resource, { path: path6 });
464
477
  };
465
478
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
466
479
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -468,8 +481,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
468
481
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
469
482
  };
470
483
  var versionService = (directory) => async (id) => versionResource(directory, id);
471
- var rmService = (directory) => async (path5) => {
472
- await fs5.rm(join6(directory, path5), { recursive: true });
484
+ var rmService = (directory) => async (path6) => {
485
+ await fs5.rm(join6(directory, path6), { recursive: true });
473
486
  };
474
487
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
475
488
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -533,8 +546,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
533
546
  if (!existingResource) {
534
547
  throw new Error(`Cannot find service ${id} in the catalog`);
535
548
  }
536
- const path5 = existingResource.split(/[\\/]+services/)[0];
537
- const pathToResource = join6(path5, "services");
549
+ const path6 = existingResource.split(/[\\/]+services/)[0];
550
+ const pathToResource = join6(path6, "services");
538
551
  await rmServiceById(directory)(id, version);
539
552
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
540
553
  };
@@ -542,9 +555,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
542
555
  const file = await findFileById(directory, id, version);
543
556
  return !!file;
544
557
  };
545
- var isService = (directory) => async (path5) => {
546
- const service = await getServiceByPath(directory)(path5);
547
- const relativePath = relative2(directory, path5);
558
+ var isService = (directory) => async (path6) => {
559
+ const service = await getServiceByPath(directory)(path6);
560
+ const relativePath = relative2(directory, path6);
548
561
  const segments = relativePath.split(/[/\\]+/);
549
562
  return !!service && segments.includes("services");
550
563
  };
@@ -566,8 +579,8 @@ var addEntityToService = (directory) => async (id, entity, version) => {
566
579
  if (!existingResource) {
567
580
  throw new Error(`Cannot find service ${id} in the catalog`);
568
581
  }
569
- const path5 = existingResource.split(/[\\/]+services/)[0];
570
- const pathToResource = join6(path5, "services");
582
+ const path6 = existingResource.split(/[\\/]+services/)[0];
583
+ const pathToResource = join6(path6, "services");
571
584
  await rmServiceById(directory)(id, version);
572
585
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
573
586
  };
@@ -602,15 +615,15 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
602
615
  if (!existingResource) {
603
616
  throw new Error(`Cannot find service ${id} in the catalog`);
604
617
  }
605
- const path5 = existingResource.split(/[\\/]+services/)[0];
606
- const pathToResource = join6(path5, "services");
618
+ const path6 = existingResource.split(/[\\/]+services/)[0];
619
+ const pathToResource = join6(path6, "services");
607
620
  await rmServiceById(directory)(id, version);
608
621
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
609
622
  };
610
623
 
611
624
  // src/domains.ts
612
625
  import fs6 from "fs/promises";
613
- import path, { join as join7 } from "path";
626
+ import path2, { join as join7 } from "path";
614
627
  import fsSync3 from "fs";
615
628
  import matter3 from "gray-matter";
616
629
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -635,8 +648,8 @@ var writeDomain = (directory) => async (domain, options = {
635
648
  return await writeResource(directory, resource, { ...options, type: "domain" });
636
649
  };
637
650
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
638
- var rmDomain = (directory) => async (path5) => {
639
- await fs6.rm(join7(directory, path5), { recursive: true });
651
+ var rmDomain = (directory) => async (path6) => {
652
+ await fs6.rm(join7(directory, path6), { recursive: true });
640
653
  };
641
654
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
642
655
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -648,7 +661,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
648
661
  };
649
662
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
650
663
  const pathToDomain = await findFileById(directory, id, version) || "";
651
- const pathToUbiquitousLanguage = path.join(path.dirname(pathToDomain), "ubiquitous-language.mdx");
664
+ const pathToUbiquitousLanguage = path2.join(path2.dirname(pathToDomain), "ubiquitous-language.mdx");
652
665
  const fileExists = fsSync3.existsSync(pathToUbiquitousLanguage);
653
666
  if (!fileExists) {
654
667
  return void 0;
@@ -663,7 +676,7 @@ var domainHasVersion = (directory) => async (id, version) => {
663
676
  var addServiceToDomain = (directory) => async (id, service, version) => {
664
677
  let domain = await getDomain(directory)(id, version);
665
678
  const domainPath = await getResourcePath(directory, id, version);
666
- const extension = path.extname(domainPath?.fullPath || "");
679
+ const extension = path2.extname(domainPath?.fullPath || "");
667
680
  if (domain.services === void 0) {
668
681
  domain.services = [];
669
682
  }
@@ -678,7 +691,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
678
691
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
679
692
  let domain = await getDomain(directory)(id, version);
680
693
  const domainPath = await getResourcePath(directory, id, version);
681
- const extension = path.extname(domainPath?.fullPath || "");
694
+ const extension = path2.extname(domainPath?.fullPath || "");
682
695
  if (domain.domains === void 0) {
683
696
  domain.domains = [];
684
697
  }
@@ -693,7 +706,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
693
706
  var addEntityToDomain = (directory) => async (id, entity, version) => {
694
707
  let domain = await getDomain(directory)(id, version);
695
708
  const domainPath = await getResourcePath(directory, id, version);
696
- const extension = path.extname(domainPath?.fullPath || "");
709
+ const extension = path2.extname(domainPath?.fullPath || "");
697
710
  if (domain.entities === void 0) {
698
711
  domain.entities = [];
699
712
  }
@@ -712,8 +725,8 @@ import { join as join8, extname as extname2 } from "path";
712
725
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
713
726
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
714
727
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
715
- var rmChannel = (directory) => async (path5) => {
716
- await fs7.rm(join8(directory, path5), { recursive: true });
728
+ var rmChannel = (directory) => async (path6) => {
729
+ await fs7.rm(join8(directory, path6), { recursive: true });
717
730
  };
718
731
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
719
732
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -754,8 +767,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
754
767
  if (!existingResource) {
755
768
  throw new Error(`Cannot find message ${id} in the catalog`);
756
769
  }
757
- const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
758
- const pathToResource = join8(path5, collection);
770
+ const path6 = existingResource.split(`/[\\/]+${collection}`)[0];
771
+ const pathToResource = join8(path6, collection);
759
772
  await rmMessageById(directory)(_message.id, _message.version, true);
760
773
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
761
774
  };
@@ -764,8 +777,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
764
777
  import { dirname as dirname5 } from "path";
765
778
  import matter4 from "gray-matter";
766
779
  import { satisfies as satisfies3, validRange as validRange2 } from "semver";
767
- var getMessageBySchemaPath = (directory) => async (path5, options) => {
768
- const pathToMessage = dirname5(path5);
780
+ var getMessageBySchemaPath = (directory) => async (path6, options) => {
781
+ const pathToMessage = dirname5(path6);
769
782
  try {
770
783
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
771
784
  if (!files || files.length === 0) {
@@ -837,18 +850,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
837
850
  }
838
851
  return { producers, consumers };
839
852
  };
840
- var getConsumersOfSchema = (directory) => async (path5) => {
853
+ var getConsumersOfSchema = (directory) => async (path6) => {
841
854
  try {
842
- const message = await getMessageBySchemaPath(directory)(path5);
855
+ const message = await getMessageBySchemaPath(directory)(path6);
843
856
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
844
857
  return consumers;
845
858
  } catch (error) {
846
859
  return [];
847
860
  }
848
861
  };
849
- var getProducersOfSchema = (directory) => async (path5) => {
862
+ var getProducersOfSchema = (directory) => async (path6) => {
850
863
  try {
851
- const message = await getMessageBySchemaPath(directory)(path5);
864
+ const message = await getMessageBySchemaPath(directory)(path6);
852
865
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
853
866
  return producers;
854
867
  } catch (error) {
@@ -857,13 +870,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
857
870
  };
858
871
 
859
872
  // src/custom-docs.ts
860
- import path2, { join as join10 } from "path";
873
+ import path3, { join as join10 } from "path";
861
874
  import fsSync4 from "fs";
862
875
  import fs8 from "fs/promises";
863
876
  import matter5 from "gray-matter";
864
877
  import slugify from "slugify";
865
878
  var getCustomDoc = (directory) => async (filePath) => {
866
- const fullPath = path2.join(directory, filePath);
879
+ const fullPath = path3.join(directory, filePath);
867
880
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
868
881
  const fileExists = fsSync4.existsSync(fullPathWithExtension);
869
882
  if (!fileExists) {
@@ -882,8 +895,8 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
882
895
  const { fileName, ...rest } = customDoc;
883
896
  const name = fileName || slugify(customDoc.title, { lower: true });
884
897
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
885
- const fullPath = path2.join(directory, options.path || "", withExtension);
886
- fsSync4.mkdirSync(path2.dirname(fullPath), { recursive: true });
898
+ const fullPath = path3.join(directory, options.path || "", withExtension);
899
+ fsSync4.mkdirSync(path3.dirname(fullPath), { recursive: true });
887
900
  const document = matter5.stringify(customDoc.markdown.trim(), rest);
888
901
  fsSync4.writeFileSync(fullPath, document);
889
902
  };
@@ -897,7 +910,7 @@ import fs9 from "fs/promises";
897
910
  import fsSync6 from "fs";
898
911
  import { join as join12 } from "path";
899
912
  import matter7 from "gray-matter";
900
- import path3 from "path";
913
+ import path4 from "path";
901
914
 
902
915
  // src/users.ts
903
916
  import fsSync5 from "fs";
@@ -993,11 +1006,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
993
1006
  if (!resource) return [];
994
1007
  if (!resource.owners) return [];
995
1008
  for (const owner of resource.owners) {
996
- const team = await getTeam(path3.join(catalogDir, "teams"))(owner);
1009
+ const team = await getTeam(path4.join(catalogDir, "teams"))(owner);
997
1010
  if (team) {
998
1011
  owners.push(team);
999
1012
  } else {
1000
- const user = await getUser(path3.join(catalogDir, "users"))(owner);
1013
+ const user = await getUser(path4.join(catalogDir, "users"))(owner);
1001
1014
  if (user) {
1002
1015
  owners.push(user);
1003
1016
  }
@@ -1008,7 +1021,7 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
1008
1021
 
1009
1022
  // src/eventcatalog.ts
1010
1023
  import fs10 from "fs";
1011
- import path4, { join as join13 } from "path";
1024
+ import path5, { join as join13 } from "path";
1012
1025
  var DUMP_VERSION = "0.0.1";
1013
1026
  var getEventCatalogVersion = async (catalogDir) => {
1014
1027
  try {
@@ -1025,7 +1038,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1025
1038
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1026
1039
  let schema = "";
1027
1040
  if (resource.schemaPath && resourcePath?.fullPath) {
1028
- const pathToSchema = path4.join(path4.dirname(resourcePath?.fullPath), resource.schemaPath);
1041
+ const pathToSchema = path5.join(path5.dirname(resourcePath?.fullPath), resource.schemaPath);
1029
1042
  if (fs10.existsSync(pathToSchema)) {
1030
1043
  schema = fs10.readFileSync(pathToSchema, "utf8");
1031
1044
  }
@@ -1046,8 +1059,8 @@ var filterCollection = (collection, options) => {
1046
1059
  };
1047
1060
  var getEventCatalogConfigurationFile = (directory) => async () => {
1048
1061
  try {
1049
- const path5 = join13(directory, "eventcatalog.config.js");
1050
- const configModule = await import(path5);
1062
+ const path6 = join13(directory, "eventcatalog.config.js");
1063
+ const configModule = await import(path6);
1051
1064
  return configModule.default;
1052
1065
  } catch (error) {
1053
1066
  console.error("Error getting event catalog configuration file", error);
@@ -1113,8 +1126,8 @@ var writeEntity = (directory) => async (entity, options = {
1113
1126
  override: false,
1114
1127
  format: "mdx"
1115
1128
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1116
- var rmEntity = (directory) => async (path5) => {
1117
- await fs11.rm(join14(directory, path5), { recursive: true });
1129
+ var rmEntity = (directory) => async (path6) => {
1130
+ await fs11.rm(join14(directory, path6), { recursive: true });
1118
1131
  };
1119
1132
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1120
1133
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1136,8 +1149,8 @@ var writeContainer = (directory) => async (data, options = {
1136
1149
  format: "mdx"
1137
1150
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1138
1151
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
1139
- var rmContainer = (directory) => async (path5) => {
1140
- await fs12.rm(join15(directory, path5), { recursive: true });
1152
+ var rmContainer = (directory) => async (path6) => {
1153
+ await fs12.rm(join15(directory, path6), { recursive: true });
1141
1154
  };
1142
1155
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
1143
1156
  await rmResourceById(directory, id, version, { type: "container", persistFiles });
@@ -1169,7 +1182,7 @@ var addFileToDataStore = addFileToContainer;
1169
1182
  var writeDataStoreToService = writeContainerToService;
1170
1183
 
1171
1184
  // src/index.ts
1172
- var index_default = (path5) => {
1185
+ var index_default = (path6) => {
1173
1186
  return {
1174
1187
  /**
1175
1188
  * Returns an events from EventCatalog
@@ -1177,13 +1190,13 @@ var index_default = (path5) => {
1177
1190
  * @param version - Optional id of the version to get (supports semver)
1178
1191
  * @returns Event|Undefined
1179
1192
  */
1180
- getEvent: getEvent(join16(path5)),
1193
+ getEvent: getEvent(join16(path6)),
1181
1194
  /**
1182
1195
  * Returns all events from EventCatalog
1183
1196
  * @param latestOnly - optional boolean, set to true to get only latest versions
1184
1197
  * @returns Event[]|Undefined
1185
1198
  */
1186
- getEvents: getEvents(join16(path5)),
1199
+ getEvents: getEvents(join16(path6)),
1187
1200
  /**
1188
1201
  * Adds an event to EventCatalog
1189
1202
  *
@@ -1191,7 +1204,7 @@ var index_default = (path5) => {
1191
1204
  * @param options - Optional options to write the event
1192
1205
  *
1193
1206
  */
1194
- writeEvent: writeEvent(join16(path5, "events")),
1207
+ writeEvent: writeEvent(join16(path6, "events")),
1195
1208
  /**
1196
1209
  * Adds an event to a service in EventCatalog
1197
1210
  *
@@ -1200,26 +1213,26 @@ var index_default = (path5) => {
1200
1213
  * @param options - Optional options to write the event
1201
1214
  *
1202
1215
  */
1203
- writeEventToService: writeEventToService(join16(path5)),
1216
+ writeEventToService: writeEventToService(join16(path6)),
1204
1217
  /**
1205
1218
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1206
1219
  *
1207
1220
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1208
1221
  *
1209
1222
  */
1210
- rmEvent: rmEvent(join16(path5, "events")),
1223
+ rmEvent: rmEvent(join16(path6, "events")),
1211
1224
  /**
1212
1225
  * Remove an event by an Event id
1213
1226
  *
1214
1227
  * @param id - The id of the event you want to remove
1215
1228
  *
1216
1229
  */
1217
- rmEventById: rmEventById(join16(path5)),
1230
+ rmEventById: rmEventById(join16(path6)),
1218
1231
  /**
1219
1232
  * Moves a given event id to the version directory
1220
1233
  * @param directory
1221
1234
  */
1222
- versionEvent: versionEvent(join16(path5)),
1235
+ versionEvent: versionEvent(join16(path6)),
1223
1236
  /**
1224
1237
  * Adds a file to the given event
1225
1238
  * @param id - The id of the event to add the file to
@@ -1227,7 +1240,7 @@ var index_default = (path5) => {
1227
1240
  * @param version - Optional version of the event to add the file to
1228
1241
  * @returns
1229
1242
  */
1230
- addFileToEvent: addFileToEvent(join16(path5)),
1243
+ addFileToEvent: addFileToEvent(join16(path6)),
1231
1244
  /**
1232
1245
  * Adds a schema to the given event
1233
1246
  * @param id - The id of the event to add the schema to
@@ -1235,14 +1248,14 @@ var index_default = (path5) => {
1235
1248
  * @param version - Optional version of the event to add the schema to
1236
1249
  * @returns
1237
1250
  */
1238
- addSchemaToEvent: addSchemaToEvent(join16(path5)),
1251
+ addSchemaToEvent: addSchemaToEvent(join16(path6)),
1239
1252
  /**
1240
1253
  * Check to see if an event version exists
1241
1254
  * @param id - The id of the event
1242
1255
  * @param version - The version of the event (supports semver)
1243
1256
  * @returns
1244
1257
  */
1245
- eventHasVersion: eventHasVersion(join16(path5)),
1258
+ eventHasVersion: eventHasVersion(join16(path6)),
1246
1259
  /**
1247
1260
  * ================================
1248
1261
  * Commands
@@ -1254,13 +1267,13 @@ var index_default = (path5) => {
1254
1267
  * @param version - Optional id of the version to get (supports semver)
1255
1268
  * @returns Command|Undefined
1256
1269
  */
1257
- getCommand: getCommand(join16(path5)),
1270
+ getCommand: getCommand(join16(path6)),
1258
1271
  /**
1259
1272
  * Returns all commands from EventCatalog
1260
1273
  * @param latestOnly - optional boolean, set to true to get only latest versions
1261
1274
  * @returns Command[]|Undefined
1262
1275
  */
1263
- getCommands: getCommands(join16(path5)),
1276
+ getCommands: getCommands(join16(path6)),
1264
1277
  /**
1265
1278
  * Adds an command to EventCatalog
1266
1279
  *
@@ -1268,7 +1281,7 @@ var index_default = (path5) => {
1268
1281
  * @param options - Optional options to write the command
1269
1282
  *
1270
1283
  */
1271
- writeCommand: writeCommand(join16(path5, "commands")),
1284
+ writeCommand: writeCommand(join16(path6, "commands")),
1272
1285
  /**
1273
1286
  * Adds a command to a service in EventCatalog
1274
1287
  *
@@ -1277,26 +1290,26 @@ var index_default = (path5) => {
1277
1290
  * @param options - Optional options to write the command
1278
1291
  *
1279
1292
  */
1280
- writeCommandToService: writeCommandToService(join16(path5)),
1293
+ writeCommandToService: writeCommandToService(join16(path6)),
1281
1294
  /**
1282
1295
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1283
1296
  *
1284
1297
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1285
1298
  *
1286
1299
  */
1287
- rmCommand: rmCommand(join16(path5, "commands")),
1300
+ rmCommand: rmCommand(join16(path6, "commands")),
1288
1301
  /**
1289
1302
  * Remove an command by an Event id
1290
1303
  *
1291
1304
  * @param id - The id of the command you want to remove
1292
1305
  *
1293
1306
  */
1294
- rmCommandById: rmCommandById(join16(path5)),
1307
+ rmCommandById: rmCommandById(join16(path6)),
1295
1308
  /**
1296
1309
  * Moves a given command id to the version directory
1297
1310
  * @param directory
1298
1311
  */
1299
- versionCommand: versionCommand(join16(path5)),
1312
+ versionCommand: versionCommand(join16(path6)),
1300
1313
  /**
1301
1314
  * Adds a file to the given command
1302
1315
  * @param id - The id of the command to add the file to
@@ -1304,7 +1317,7 @@ var index_default = (path5) => {
1304
1317
  * @param version - Optional version of the command to add the file to
1305
1318
  * @returns
1306
1319
  */
1307
- addFileToCommand: addFileToCommand(join16(path5)),
1320
+ addFileToCommand: addFileToCommand(join16(path6)),
1308
1321
  /**
1309
1322
  * Adds a schema to the given command
1310
1323
  * @param id - The id of the command to add the schema to
@@ -1312,14 +1325,14 @@ var index_default = (path5) => {
1312
1325
  * @param version - Optional version of the command to add the schema to
1313
1326
  * @returns
1314
1327
  */
1315
- addSchemaToCommand: addSchemaToCommand(join16(path5)),
1328
+ addSchemaToCommand: addSchemaToCommand(join16(path6)),
1316
1329
  /**
1317
1330
  * Check to see if a command version exists
1318
1331
  * @param id - The id of the command
1319
1332
  * @param version - The version of the command (supports semver)
1320
1333
  * @returns
1321
1334
  */
1322
- commandHasVersion: commandHasVersion(join16(path5)),
1335
+ commandHasVersion: commandHasVersion(join16(path6)),
1323
1336
  /**
1324
1337
  * ================================
1325
1338
  * Queries
@@ -1331,13 +1344,13 @@ var index_default = (path5) => {
1331
1344
  * @param version - Optional id of the version to get (supports semver)
1332
1345
  * @returns Query|Undefined
1333
1346
  */
1334
- getQuery: getQuery(join16(path5)),
1347
+ getQuery: getQuery(join16(path6)),
1335
1348
  /**
1336
1349
  * Returns all queries from EventCatalog
1337
1350
  * @param latestOnly - optional boolean, set to true to get only latest versions
1338
1351
  * @returns Query[]|Undefined
1339
1352
  */
1340
- getQueries: getQueries(join16(path5)),
1353
+ getQueries: getQueries(join16(path6)),
1341
1354
  /**
1342
1355
  * Adds a query to EventCatalog
1343
1356
  *
@@ -1345,7 +1358,7 @@ var index_default = (path5) => {
1345
1358
  * @param options - Optional options to write the event
1346
1359
  *
1347
1360
  */
1348
- writeQuery: writeQuery(join16(path5, "queries")),
1361
+ writeQuery: writeQuery(join16(path6, "queries")),
1349
1362
  /**
1350
1363
  * Adds a query to a service in EventCatalog
1351
1364
  *
@@ -1354,26 +1367,26 @@ var index_default = (path5) => {
1354
1367
  * @param options - Optional options to write the query
1355
1368
  *
1356
1369
  */
1357
- writeQueryToService: writeQueryToService(join16(path5)),
1370
+ writeQueryToService: writeQueryToService(join16(path6)),
1358
1371
  /**
1359
1372
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1360
1373
  *
1361
1374
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1362
1375
  *
1363
1376
  */
1364
- rmQuery: rmQuery(join16(path5, "queries")),
1377
+ rmQuery: rmQuery(join16(path6, "queries")),
1365
1378
  /**
1366
1379
  * Remove a query by a Query id
1367
1380
  *
1368
1381
  * @param id - The id of the query you want to remove
1369
1382
  *
1370
1383
  */
1371
- rmQueryById: rmQueryById(join16(path5)),
1384
+ rmQueryById: rmQueryById(join16(path6)),
1372
1385
  /**
1373
1386
  * Moves a given query id to the version directory
1374
1387
  * @param directory
1375
1388
  */
1376
- versionQuery: versionQuery(join16(path5)),
1389
+ versionQuery: versionQuery(join16(path6)),
1377
1390
  /**
1378
1391
  * Adds a file to the given query
1379
1392
  * @param id - The id of the query to add the file to
@@ -1381,7 +1394,7 @@ var index_default = (path5) => {
1381
1394
  * @param version - Optional version of the query to add the file to
1382
1395
  * @returns
1383
1396
  */
1384
- addFileToQuery: addFileToQuery(join16(path5)),
1397
+ addFileToQuery: addFileToQuery(join16(path6)),
1385
1398
  /**
1386
1399
  * Adds a schema to the given query
1387
1400
  * @param id - The id of the query to add the schema to
@@ -1389,14 +1402,14 @@ var index_default = (path5) => {
1389
1402
  * @param version - Optional version of the query to add the schema to
1390
1403
  * @returns
1391
1404
  */
1392
- addSchemaToQuery: addSchemaToQuery(join16(path5)),
1405
+ addSchemaToQuery: addSchemaToQuery(join16(path6)),
1393
1406
  /**
1394
1407
  * Check to see if an query version exists
1395
1408
  * @param id - The id of the query
1396
1409
  * @param version - The version of the query (supports semver)
1397
1410
  * @returns
1398
1411
  */
1399
- queryHasVersion: queryHasVersion(join16(path5)),
1412
+ queryHasVersion: queryHasVersion(join16(path6)),
1400
1413
  /**
1401
1414
  * ================================
1402
1415
  * Channels
@@ -1408,13 +1421,13 @@ var index_default = (path5) => {
1408
1421
  * @param version - Optional id of the version to get (supports semver)
1409
1422
  * @returns Channel|Undefined
1410
1423
  */
1411
- getChannel: getChannel(join16(path5)),
1424
+ getChannel: getChannel(join16(path6)),
1412
1425
  /**
1413
1426
  * Returns all channels from EventCatalog
1414
1427
  * @param latestOnly - optional boolean, set to true to get only latest versions
1415
1428
  * @returns Channel[]|Undefined
1416
1429
  */
1417
- getChannels: getChannels(join16(path5)),
1430
+ getChannels: getChannels(join16(path6)),
1418
1431
  /**
1419
1432
  * Adds an channel to EventCatalog
1420
1433
  *
@@ -1422,33 +1435,33 @@ var index_default = (path5) => {
1422
1435
  * @param options - Optional options to write the channel
1423
1436
  *
1424
1437
  */
1425
- writeChannel: writeChannel(join16(path5, "channels")),
1438
+ writeChannel: writeChannel(join16(path6, "channels")),
1426
1439
  /**
1427
1440
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1428
1441
  *
1429
1442
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1430
1443
  *
1431
1444
  */
1432
- rmChannel: rmChannel(join16(path5, "channels")),
1445
+ rmChannel: rmChannel(join16(path6, "channels")),
1433
1446
  /**
1434
1447
  * Remove an channel by an Event id
1435
1448
  *
1436
1449
  * @param id - The id of the channel you want to remove
1437
1450
  *
1438
1451
  */
1439
- rmChannelById: rmChannelById(join16(path5)),
1452
+ rmChannelById: rmChannelById(join16(path6)),
1440
1453
  /**
1441
1454
  * Moves a given channel id to the version directory
1442
1455
  * @param directory
1443
1456
  */
1444
- versionChannel: versionChannel(join16(path5)),
1457
+ versionChannel: versionChannel(join16(path6)),
1445
1458
  /**
1446
1459
  * Check to see if a channel version exists
1447
1460
  * @param id - The id of the channel
1448
1461
  * @param version - The version of the channel (supports semver)
1449
1462
  * @returns
1450
1463
  */
1451
- channelHasVersion: channelHasVersion(join16(path5)),
1464
+ channelHasVersion: channelHasVersion(join16(path6)),
1452
1465
  /**
1453
1466
  * Add a channel to an event
1454
1467
  *
@@ -1465,7 +1478,7 @@ var index_default = (path5) => {
1465
1478
  *
1466
1479
  * ```
1467
1480
  */
1468
- addEventToChannel: addMessageToChannel(join16(path5), "events"),
1481
+ addEventToChannel: addMessageToChannel(join16(path6), "events"),
1469
1482
  /**
1470
1483
  * Add a channel to an command
1471
1484
  *
@@ -1482,7 +1495,7 @@ var index_default = (path5) => {
1482
1495
  *
1483
1496
  * ```
1484
1497
  */
1485
- addCommandToChannel: addMessageToChannel(join16(path5), "commands"),
1498
+ addCommandToChannel: addMessageToChannel(join16(path6), "commands"),
1486
1499
  /**
1487
1500
  * Add a channel to an query
1488
1501
  *
@@ -1499,7 +1512,7 @@ var index_default = (path5) => {
1499
1512
  *
1500
1513
  * ```
1501
1514
  */
1502
- addQueryToChannel: addMessageToChannel(join16(path5), "queries"),
1515
+ addQueryToChannel: addMessageToChannel(join16(path6), "queries"),
1503
1516
  /**
1504
1517
  * ================================
1505
1518
  * SERVICES
@@ -1512,14 +1525,14 @@ var index_default = (path5) => {
1512
1525
  * @param options - Optional options to write the event
1513
1526
  *
1514
1527
  */
1515
- writeService: writeService(join16(path5, "services")),
1528
+ writeService: writeService(join16(path6, "services")),
1516
1529
  /**
1517
1530
  * Adds a versioned service to EventCatalog
1518
1531
  *
1519
1532
  * @param service - The service to write
1520
1533
  *
1521
1534
  */
1522
- writeVersionedService: writeVersionedService(join16(path5, "services")),
1535
+ writeVersionedService: writeVersionedService(join16(path6, "services")),
1523
1536
  /**
1524
1537
  * Adds a service to a domain in EventCatalog
1525
1538
  *
@@ -1528,45 +1541,45 @@ var index_default = (path5) => {
1528
1541
  * @param options - Optional options to write the event
1529
1542
  *
1530
1543
  */
1531
- writeServiceToDomain: writeServiceToDomain(join16(path5, "domains")),
1544
+ writeServiceToDomain: writeServiceToDomain(join16(path6, "domains")),
1532
1545
  /**
1533
1546
  * Returns a service from EventCatalog
1534
1547
  * @param id - The id of the service to retrieve
1535
1548
  * @param version - Optional id of the version to get (supports semver)
1536
1549
  * @returns Service|Undefined
1537
1550
  */
1538
- getService: getService(join16(path5)),
1551
+ getService: getService(join16(path6)),
1539
1552
  /**
1540
1553
  * Returns a service from EventCatalog by it's path.
1541
1554
  * @param path - The path to the service to retrieve
1542
1555
  * @returns Service|Undefined
1543
1556
  */
1544
- getServiceByPath: getServiceByPath(join16(path5)),
1557
+ getServiceByPath: getServiceByPath(join16(path6)),
1545
1558
  /**
1546
1559
  * Returns all services from EventCatalog
1547
1560
  * @param latestOnly - optional boolean, set to true to get only latest versions
1548
1561
  * @returns Service[]|Undefined
1549
1562
  */
1550
- getServices: getServices(join16(path5)),
1563
+ getServices: getServices(join16(path6)),
1551
1564
  /**
1552
1565
  * Moves a given service id to the version directory
1553
1566
  * @param directory
1554
1567
  */
1555
- versionService: versionService(join16(path5)),
1568
+ versionService: versionService(join16(path6)),
1556
1569
  /**
1557
1570
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1558
1571
  *
1559
1572
  * @param path - The path to your service, e.g. `/InventoryService`
1560
1573
  *
1561
1574
  */
1562
- rmService: rmService(join16(path5, "services")),
1575
+ rmService: rmService(join16(path6, "services")),
1563
1576
  /**
1564
1577
  * Remove an service by an service id
1565
1578
  *
1566
1579
  * @param id - The id of the service you want to remove
1567
1580
  *
1568
1581
  */
1569
- rmServiceById: rmServiceById(join16(path5)),
1582
+ rmServiceById: rmServiceById(join16(path6)),
1570
1583
  /**
1571
1584
  * Adds a file to the given service
1572
1585
  * @param id - The id of the service to add the file to
@@ -1574,21 +1587,21 @@ var index_default = (path5) => {
1574
1587
  * @param version - Optional version of the service to add the file to
1575
1588
  * @returns
1576
1589
  */
1577
- addFileToService: addFileToService(join16(path5)),
1590
+ addFileToService: addFileToService(join16(path6)),
1578
1591
  /**
1579
1592
  * Returns the specifications for a given service
1580
1593
  * @param id - The id of the service to retrieve the specifications for
1581
1594
  * @param version - Optional version of the service
1582
1595
  * @returns
1583
1596
  */
1584
- getSpecificationFilesForService: getSpecificationFilesForService(join16(path5)),
1597
+ getSpecificationFilesForService: getSpecificationFilesForService(join16(path6)),
1585
1598
  /**
1586
1599
  * Check to see if a service version exists
1587
1600
  * @param id - The id of the service
1588
1601
  * @param version - The version of the service (supports semver)
1589
1602
  * @returns
1590
1603
  */
1591
- serviceHasVersion: serviceHasVersion(join16(path5)),
1604
+ serviceHasVersion: serviceHasVersion(join16(path6)),
1592
1605
  /**
1593
1606
  * Add an event to a service by it's id.
1594
1607
  *
@@ -1608,7 +1621,7 @@ var index_default = (path5) => {
1608
1621
  *
1609
1622
  * ```
1610
1623
  */
1611
- addEventToService: addMessageToService(join16(path5)),
1624
+ addEventToService: addMessageToService(join16(path6)),
1612
1625
  /**
1613
1626
  * Add a data store to a service by it's id.
1614
1627
  *
@@ -1625,7 +1638,7 @@ var index_default = (path5) => {
1625
1638
  *
1626
1639
  * ```
1627
1640
  */
1628
- addDataStoreToService: addDataStoreToService(join16(path5)),
1641
+ addDataStoreToService: addDataStoreToService(join16(path6)),
1629
1642
  /**
1630
1643
  * Add a command to a service by it's id.
1631
1644
  *
@@ -1645,7 +1658,7 @@ var index_default = (path5) => {
1645
1658
  *
1646
1659
  * ```
1647
1660
  */
1648
- addCommandToService: addMessageToService(join16(path5)),
1661
+ addCommandToService: addMessageToService(join16(path6)),
1649
1662
  /**
1650
1663
  * Add a query to a service by it's id.
1651
1664
  *
@@ -1665,7 +1678,7 @@ var index_default = (path5) => {
1665
1678
  *
1666
1679
  * ```
1667
1680
  */
1668
- addQueryToService: addMessageToService(join16(path5)),
1681
+ addQueryToService: addMessageToService(join16(path6)),
1669
1682
  /**
1670
1683
  * Add an entity to a service by its id.
1671
1684
  *
@@ -1683,7 +1696,7 @@ var index_default = (path5) => {
1683
1696
  *
1684
1697
  * ```
1685
1698
  */
1686
- addEntityToService: addEntityToService(join16(path5)),
1699
+ addEntityToService: addEntityToService(join16(path6)),
1687
1700
  /**
1688
1701
  * Check to see if a service exists by it's path.
1689
1702
  *
@@ -1700,13 +1713,13 @@ var index_default = (path5) => {
1700
1713
  * @param path - The path to the service to check
1701
1714
  * @returns boolean
1702
1715
  */
1703
- isService: isService(join16(path5)),
1716
+ isService: isService(join16(path6)),
1704
1717
  /**
1705
1718
  * Converts a file to a service.
1706
1719
  * @param file - The file to convert to a service.
1707
1720
  * @returns The service.
1708
1721
  */
1709
- toService: toService(join16(path5)),
1722
+ toService: toService(join16(path6)),
1710
1723
  /**
1711
1724
  * ================================
1712
1725
  * Domains
@@ -1719,39 +1732,39 @@ var index_default = (path5) => {
1719
1732
  * @param options - Optional options to write the event
1720
1733
  *
1721
1734
  */
1722
- writeDomain: writeDomain(join16(path5, "domains")),
1735
+ writeDomain: writeDomain(join16(path6, "domains")),
1723
1736
  /**
1724
1737
  * Returns a domain from EventCatalog
1725
1738
  * @param id - The id of the domain to retrieve
1726
1739
  * @param version - Optional id of the version to get (supports semver)
1727
1740
  * @returns Domain|Undefined
1728
1741
  */
1729
- getDomain: getDomain(join16(path5, "domains")),
1742
+ getDomain: getDomain(join16(path6, "domains")),
1730
1743
  /**
1731
1744
  * Returns all domains from EventCatalog
1732
1745
  * @param latestOnly - optional boolean, set to true to get only latest versions
1733
1746
  * @returns Domain[]|Undefined
1734
1747
  */
1735
- getDomains: getDomains(join16(path5)),
1748
+ getDomains: getDomains(join16(path6)),
1736
1749
  /**
1737
1750
  * Moves a given domain id to the version directory
1738
1751
  * @param directory
1739
1752
  */
1740
- versionDomain: versionDomain(join16(path5, "domains")),
1753
+ versionDomain: versionDomain(join16(path6, "domains")),
1741
1754
  /**
1742
1755
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1743
1756
  *
1744
1757
  * @param path - The path to your domain, e.g. `/Payment`
1745
1758
  *
1746
1759
  */
1747
- rmDomain: rmDomain(join16(path5, "domains")),
1760
+ rmDomain: rmDomain(join16(path6, "domains")),
1748
1761
  /**
1749
1762
  * Remove an service by an domain id
1750
1763
  *
1751
1764
  * @param id - The id of the domain you want to remove
1752
1765
  *
1753
1766
  */
1754
- rmDomainById: rmDomainById(join16(path5, "domains")),
1767
+ rmDomainById: rmDomainById(join16(path6, "domains")),
1755
1768
  /**
1756
1769
  * Adds a file to the given domain
1757
1770
  * @param id - The id of the domain to add the file to
@@ -1759,28 +1772,28 @@ var index_default = (path5) => {
1759
1772
  * @param version - Optional version of the domain to add the file to
1760
1773
  * @returns
1761
1774
  */
1762
- addFileToDomain: addFileToDomain(join16(path5, "domains")),
1775
+ addFileToDomain: addFileToDomain(join16(path6, "domains")),
1763
1776
  /**
1764
1777
  * Adds an ubiquitous language dictionary to a domain
1765
1778
  * @param id - The id of the domain to add the ubiquitous language to
1766
1779
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1767
1780
  * @param version - Optional version of the domain to add the ubiquitous language to
1768
1781
  */
1769
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join16(path5, "domains")),
1782
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join16(path6, "domains")),
1770
1783
  /**
1771
1784
  * Get the ubiquitous language dictionary from a domain
1772
1785
  * @param id - The id of the domain to get the ubiquitous language from
1773
1786
  * @param version - Optional version of the domain to get the ubiquitous language from
1774
1787
  * @returns
1775
1788
  */
1776
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join16(path5, "domains")),
1789
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join16(path6, "domains")),
1777
1790
  /**
1778
1791
  * Check to see if a domain version exists
1779
1792
  * @param id - The id of the domain
1780
1793
  * @param version - The version of the domain (supports semver)
1781
1794
  * @returns
1782
1795
  */
1783
- domainHasVersion: domainHasVersion(join16(path5)),
1796
+ domainHasVersion: domainHasVersion(join16(path6)),
1784
1797
  /**
1785
1798
  * Adds a given service to a domain
1786
1799
  * @param id - The id of the domain
@@ -1788,7 +1801,7 @@ var index_default = (path5) => {
1788
1801
  * @param version - (Optional) The version of the domain to add the service to
1789
1802
  * @returns
1790
1803
  */
1791
- addServiceToDomain: addServiceToDomain(join16(path5, "domains")),
1804
+ addServiceToDomain: addServiceToDomain(join16(path6, "domains")),
1792
1805
  /**
1793
1806
  * Adds a given subdomain to a domain
1794
1807
  * @param id - The id of the domain
@@ -1796,7 +1809,7 @@ var index_default = (path5) => {
1796
1809
  * @param version - (Optional) The version of the domain to add the subdomain to
1797
1810
  * @returns
1798
1811
  */
1799
- addSubDomainToDomain: addSubDomainToDomain(join16(path5, "domains")),
1812
+ addSubDomainToDomain: addSubDomainToDomain(join16(path6, "domains")),
1800
1813
  /**
1801
1814
  * Adds an entity to a domain
1802
1815
  * @param id - The id of the domain
@@ -1804,7 +1817,7 @@ var index_default = (path5) => {
1804
1817
  * @param version - (Optional) The version of the domain to add the entity to
1805
1818
  * @returns
1806
1819
  */
1807
- addEntityToDomain: addEntityToDomain(join16(path5, "domains")),
1820
+ addEntityToDomain: addEntityToDomain(join16(path6, "domains")),
1808
1821
  /**
1809
1822
  * ================================
1810
1823
  * Teams
@@ -1817,25 +1830,25 @@ var index_default = (path5) => {
1817
1830
  * @param options - Optional options to write the team
1818
1831
  *
1819
1832
  */
1820
- writeTeam: writeTeam(join16(path5, "teams")),
1833
+ writeTeam: writeTeam(join16(path6, "teams")),
1821
1834
  /**
1822
1835
  * Returns a team from EventCatalog
1823
1836
  * @param id - The id of the team to retrieve
1824
1837
  * @returns Team|Undefined
1825
1838
  */
1826
- getTeam: getTeam(join16(path5, "teams")),
1839
+ getTeam: getTeam(join16(path6, "teams")),
1827
1840
  /**
1828
1841
  * Returns all teams from EventCatalog
1829
1842
  * @returns Team[]|Undefined
1830
1843
  */
1831
- getTeams: getTeams(join16(path5, "teams")),
1844
+ getTeams: getTeams(join16(path6, "teams")),
1832
1845
  /**
1833
1846
  * Remove a team by the team id
1834
1847
  *
1835
1848
  * @param id - The id of the team you want to remove
1836
1849
  *
1837
1850
  */
1838
- rmTeamById: rmTeamById(join16(path5, "teams")),
1851
+ rmTeamById: rmTeamById(join16(path6, "teams")),
1839
1852
  /**
1840
1853
  * ================================
1841
1854
  * Users
@@ -1848,25 +1861,25 @@ var index_default = (path5) => {
1848
1861
  * @param options - Optional options to write the user
1849
1862
  *
1850
1863
  */
1851
- writeUser: writeUser(join16(path5, "users")),
1864
+ writeUser: writeUser(join16(path6, "users")),
1852
1865
  /**
1853
1866
  * Returns a user from EventCatalog
1854
1867
  * @param id - The id of the user to retrieve
1855
1868
  * @returns User|Undefined
1856
1869
  */
1857
- getUser: getUser(join16(path5, "users")),
1870
+ getUser: getUser(join16(path6, "users")),
1858
1871
  /**
1859
1872
  * Returns all user from EventCatalog
1860
1873
  * @returns User[]|Undefined
1861
1874
  */
1862
- getUsers: getUsers(join16(path5)),
1875
+ getUsers: getUsers(join16(path6)),
1863
1876
  /**
1864
1877
  * Remove a user by the user id
1865
1878
  *
1866
1879
  * @param id - The id of the user you want to remove
1867
1880
  *
1868
1881
  */
1869
- rmUserById: rmUserById(join16(path5, "users")),
1882
+ rmUserById: rmUserById(join16(path6, "users")),
1870
1883
  /**
1871
1884
  * ================================
1872
1885
  * Custom Docs
@@ -1877,32 +1890,32 @@ var index_default = (path5) => {
1877
1890
  * @param path - The path to the custom doc to retrieve
1878
1891
  * @returns CustomDoc|Undefined
1879
1892
  */
1880
- getCustomDoc: getCustomDoc(join16(path5, "docs")),
1893
+ getCustomDoc: getCustomDoc(join16(path6, "docs")),
1881
1894
  /**
1882
1895
  * Returns all custom docs from EventCatalog
1883
1896
  * @param options - Optional options to get custom docs from a specific path
1884
1897
  * @returns CustomDoc[]|Undefined
1885
1898
  */
1886
- getCustomDocs: getCustomDocs(join16(path5, "docs")),
1899
+ getCustomDocs: getCustomDocs(join16(path6, "docs")),
1887
1900
  /**
1888
1901
  * Writes a custom doc to EventCatalog
1889
1902
  * @param customDoc - The custom doc to write
1890
1903
  * @param options - Optional options to write the custom doc
1891
1904
  *
1892
1905
  */
1893
- writeCustomDoc: writeCustomDoc(join16(path5, "docs")),
1906
+ writeCustomDoc: writeCustomDoc(join16(path6, "docs")),
1894
1907
  /**
1895
1908
  * Removes a custom doc from EventCatalog
1896
1909
  * @param path - The path to the custom doc to remove
1897
1910
  *
1898
1911
  */
1899
- rmCustomDoc: rmCustomDoc(join16(path5, "docs")),
1912
+ rmCustomDoc: rmCustomDoc(join16(path6, "docs")),
1900
1913
  /**
1901
1914
  * Dumps the catalog to a JSON file.
1902
1915
  * @param directory - The directory to dump the catalog to
1903
1916
  * @returns A JSON file with the catalog
1904
1917
  */
1905
- dumpCatalog: dumpCatalog(join16(path5)),
1918
+ dumpCatalog: dumpCatalog(join16(path6)),
1906
1919
  /**
1907
1920
  * Returns the event catalog configuration file.
1908
1921
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1910,7 +1923,7 @@ var index_default = (path5) => {
1910
1923
  * @param directory - The directory of the catalog.
1911
1924
  * @returns A JSON object with the configuration for the event catalog.
1912
1925
  */
1913
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join16(path5)),
1926
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join16(path6)),
1914
1927
  /**
1915
1928
  * ================================
1916
1929
  * Resources Utils
@@ -1920,6 +1933,10 @@ var index_default = (path5) => {
1920
1933
  * Returns the path to a given resource by id and version
1921
1934
  */
1922
1935
  getResourcePath,
1936
+ /**
1937
+ * Returns the folder name of a given resource
1938
+ */
1939
+ getResourceFolderName,
1923
1940
  /**
1924
1941
  * ================================
1925
1942
  * General Message Utils
@@ -1931,33 +1948,33 @@ var index_default = (path5) => {
1931
1948
  * @param path - The path to the message to retrieve
1932
1949
  * @returns Message|Undefined
1933
1950
  */
1934
- getMessageBySchemaPath: getMessageBySchemaPath(join16(path5)),
1951
+ getMessageBySchemaPath: getMessageBySchemaPath(join16(path6)),
1935
1952
  /**
1936
1953
  * Returns the producers and consumers (services) for a given message
1937
1954
  * @param id - The id of the message to get the producers and consumers for
1938
1955
  * @param version - Optional version of the message
1939
1956
  * @returns { producers: Service[], consumers: Service[] }
1940
1957
  */
1941
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join16(path5)),
1958
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join16(path6)),
1942
1959
  /**
1943
1960
  * Returns the consumers of a given schema path
1944
1961
  * @param path - The path to the schema to get the consumers for
1945
1962
  * @returns Service[]
1946
1963
  */
1947
- getConsumersOfSchema: getConsumersOfSchema(join16(path5)),
1964
+ getConsumersOfSchema: getConsumersOfSchema(join16(path6)),
1948
1965
  /**
1949
1966
  * Returns the producers of a given schema path
1950
1967
  * @param path - The path to the schema to get the producers for
1951
1968
  * @returns Service[]
1952
1969
  */
1953
- getProducersOfSchema: getProducersOfSchema(join16(path5)),
1970
+ getProducersOfSchema: getProducersOfSchema(join16(path6)),
1954
1971
  /**
1955
1972
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1956
1973
  * @param id - The id of the resource to get the owners for
1957
1974
  * @param version - Optional version of the resource
1958
1975
  * @returns { owners: User[] }
1959
1976
  */
1960
- getOwnersForResource: getOwnersForResource(join16(path5)),
1977
+ getOwnersForResource: getOwnersForResource(join16(path6)),
1961
1978
  /**
1962
1979
  * ================================
1963
1980
  * Entities
@@ -1969,13 +1986,13 @@ var index_default = (path5) => {
1969
1986
  * @param version - Optional id of the version to get (supports semver)
1970
1987
  * @returns Entity|Undefined
1971
1988
  */
1972
- getEntity: getEntity(join16(path5)),
1989
+ getEntity: getEntity(join16(path6)),
1973
1990
  /**
1974
1991
  * Returns all entities from EventCatalog
1975
1992
  * @param latestOnly - optional boolean, set to true to get only latest versions
1976
1993
  * @returns Entity[]|Undefined
1977
1994
  */
1978
- getEntities: getEntities(join16(path5)),
1995
+ getEntities: getEntities(join16(path6)),
1979
1996
  /**
1980
1997
  * Adds an entity to EventCatalog
1981
1998
  *
@@ -1983,33 +2000,33 @@ var index_default = (path5) => {
1983
2000
  * @param options - Optional options to write the entity
1984
2001
  *
1985
2002
  */
1986
- writeEntity: writeEntity(join16(path5, "entities")),
2003
+ writeEntity: writeEntity(join16(path6, "entities")),
1987
2004
  /**
1988
2005
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1989
2006
  *
1990
2007
  * @param path - The path to your entity, e.g. `/User`
1991
2008
  *
1992
2009
  */
1993
- rmEntity: rmEntity(join16(path5, "entities")),
2010
+ rmEntity: rmEntity(join16(path6, "entities")),
1994
2011
  /**
1995
2012
  * Remove an entity by an entity id
1996
2013
  *
1997
2014
  * @param id - The id of the entity you want to remove
1998
2015
  *
1999
2016
  */
2000
- rmEntityById: rmEntityById(join16(path5)),
2017
+ rmEntityById: rmEntityById(join16(path6)),
2001
2018
  /**
2002
2019
  * Moves a given entity id to the version directory
2003
2020
  * @param id - The id of the entity to version
2004
2021
  */
2005
- versionEntity: versionEntity(join16(path5)),
2022
+ versionEntity: versionEntity(join16(path6)),
2006
2023
  /**
2007
2024
  * Check to see if an entity version exists
2008
2025
  * @param id - The id of the entity
2009
2026
  * @param version - The version of the entity (supports semver)
2010
2027
  * @returns
2011
2028
  */
2012
- entityHasVersion: entityHasVersion(join16(path5)),
2029
+ entityHasVersion: entityHasVersion(join16(path6)),
2013
2030
  /**
2014
2031
  * ================================
2015
2032
  * Data Stores
@@ -2021,42 +2038,42 @@ var index_default = (path5) => {
2021
2038
  * @param options - Optional options to write the data store
2022
2039
  *
2023
2040
  */
2024
- writeDataStore: writeDataStore(join16(path5, "containers")),
2041
+ writeDataStore: writeDataStore(join16(path6, "containers")),
2025
2042
  /**
2026
2043
  * Returns a data store from EventCatalog
2027
2044
  * @param id - The id of the data store to retrieve
2028
2045
  * @param version - Optional id of the version to get (supports semver)
2029
2046
  * @returns Container|Undefined
2030
2047
  */
2031
- getDataStore: getDataStore(join16(path5)),
2048
+ getDataStore: getDataStore(join16(path6)),
2032
2049
  /**
2033
2050
  * Returns all data stores from EventCatalog
2034
2051
  * @param latestOnly - optional boolean, set to true to get only latest versions
2035
2052
  * @returns Container[]|Undefined
2036
2053
  */
2037
- getDataStores: getDataStores(join16(path5)),
2054
+ getDataStores: getDataStores(join16(path6)),
2038
2055
  /**
2039
2056
  * Version a data store by its id
2040
2057
  * @param id - The id of the data store to version
2041
2058
  */
2042
- versionDataStore: versionDataStore(join16(path5, "containers")),
2059
+ versionDataStore: versionDataStore(join16(path6, "containers")),
2043
2060
  /**
2044
2061
  * Remove a data store by its path
2045
2062
  * @param path - The path to the data store to remove
2046
2063
  */
2047
- rmDataStore: rmDataStore(join16(path5, "containers")),
2064
+ rmDataStore: rmDataStore(join16(path6, "containers")),
2048
2065
  /**
2049
2066
  * Remove a data store by its id
2050
2067
  * @param id - The id of the data store to remove
2051
2068
  */
2052
- rmDataStoreById: rmDataStoreById(join16(path5)),
2069
+ rmDataStoreById: rmDataStoreById(join16(path6)),
2053
2070
  /**
2054
2071
  * Check to see if a data store version exists
2055
2072
  * @param id - The id of the data store
2056
2073
  * @param version - The version of the data store (supports semver)
2057
2074
  * @returns
2058
2075
  */
2059
- dataStoreHasVersion: dataStoreHasVersion(join16(path5)),
2076
+ dataStoreHasVersion: dataStoreHasVersion(join16(path6)),
2060
2077
  /**
2061
2078
  * Adds a file to a data store by its id
2062
2079
  * @param id - The id of the data store to add the file to
@@ -2064,14 +2081,14 @@ var index_default = (path5) => {
2064
2081
  * @param version - Optional version of the data store to add the file to
2065
2082
  * @returns
2066
2083
  */
2067
- addFileToDataStore: addFileToDataStore(join16(path5)),
2084
+ addFileToDataStore: addFileToDataStore(join16(path6)),
2068
2085
  /**
2069
2086
  * Writes a data store to a service by its id
2070
2087
  * @param dataStore - The data store to write
2071
2088
  * @param service - The service to write the data store to
2072
2089
  * @returns
2073
2090
  */
2074
- writeDataStoreToService: writeDataStoreToService(join16(path5))
2091
+ writeDataStoreToService: writeDataStoreToService(join16(path6))
2075
2092
  };
2076
2093
  };
2077
2094
  export {