@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
@@ -1,6 +1,6 @@
1
1
  // src/eventcatalog.ts
2
2
  import fs12 from "fs";
3
- import path4, { join as join16 } from "path";
3
+ import path5, { join as join16 } from "path";
4
4
 
5
5
  // src/index.ts
6
6
  import { join as join15 } from "path";
@@ -15,7 +15,7 @@ import fsSync from "fs";
15
15
  import { copy } from "fs-extra";
16
16
  import { join, dirname, normalize, resolve, relative } from "path";
17
17
  import matter from "gray-matter";
18
- import { satisfies, validRange, valid } from "semver";
18
+ import { satisfies, validRange } from "semver";
19
19
  var versionExists = async (catalogDir, id, version) => {
20
20
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
21
21
  const matchedFiles = await searchFilesForId(files, id, version) || [];
@@ -24,26 +24,33 @@ var versionExists = async (catalogDir, id, version) => {
24
24
  var findFileById = async (catalogDir, id, version) => {
25
25
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
26
26
  const matchedFiles = await searchFilesForId(files, id) || [];
27
- const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
27
+ const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
28
28
  if (!version) {
29
29
  return latestVersion;
30
30
  }
31
- const parsedFiles = matchedFiles.map((path5) => {
32
- const { data } = matter.read(path5);
33
- return { ...data, path: path5 };
31
+ const parsedFiles = matchedFiles.map((path6) => {
32
+ const { data } = matter.read(path6);
33
+ return { ...data, path: path6 };
34
34
  });
35
- const semverRange = validRange(version);
36
- if (semverRange && valid(version)) {
37
- const match2 = parsedFiles.filter((c) => satisfies(c.version, semverRange));
38
- return match2.length > 0 ? match2[0].path : void 0;
35
+ if (version === "latest") {
36
+ return latestVersion;
39
37
  }
40
- const sorted = parsedFiles.sort((a, b) => {
41
- return a.version.localeCompare(b.version);
42
- });
43
- const match = sorted.length > 0 ? [sorted[sorted.length - 1]] : [];
44
- if (match.length > 0) {
45
- return match[0].path;
38
+ const exactMatch = parsedFiles.find((c) => c.version === version);
39
+ if (exactMatch) {
40
+ return exactMatch.path;
41
+ }
42
+ const semverRange = validRange(version);
43
+ if (semverRange) {
44
+ const match = parsedFiles.filter((c) => {
45
+ try {
46
+ return satisfies(c.version, semverRange);
47
+ } catch (error) {
48
+ return false;
49
+ }
50
+ });
51
+ return match.length > 0 ? match[0].path : void 0;
46
52
  }
53
+ return void 0;
47
54
  };
48
55
  var getFiles = async (pattern, ignore = "") => {
49
56
  try {
@@ -71,8 +78,8 @@ var getFiles = async (pattern, ignore = "") => {
71
78
  );
72
79
  }
73
80
  };
74
- var readMdxFile = async (path5) => {
75
- const { data } = matter.read(path5);
81
+ var readMdxFile = async (path6) => {
82
+ const { data } = matter.read(path6);
76
83
  const { markdown, ...frontmatter } = data;
77
84
  return { ...frontmatter, markdown };
78
85
  };
@@ -125,6 +132,7 @@ import fsSync2 from "fs";
125
132
  import { satisfies as satisfies2 } from "semver";
126
133
  import { lock, unlock } from "proper-lockfile";
127
134
  import { basename as basename2 } from "path";
135
+ import path from "path";
128
136
  var versionResource = async (catalogDir, id) => {
129
137
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
130
138
  const matchedFiles = await searchFilesForId(files, id);
@@ -164,8 +172,8 @@ var writeResource = async (catalogDir, resource, options = {
164
172
  versionExistingContent: false,
165
173
  format: "mdx"
166
174
  }) => {
167
- const path5 = options.path || `/${resource.id}`;
168
- const fullPath = join2(catalogDir, path5);
175
+ const path6 = options.path || `/${resource.id}`;
176
+ const fullPath = join2(catalogDir, path6);
169
177
  const format = options.format || "mdx";
170
178
  fsSync2.mkdirSync(fullPath, { recursive: true });
171
179
  const lockPath = join2(fullPath, `index.${format}`);
@@ -231,6 +239,11 @@ var getResourcePath = async (catalogDir, id, version) => {
231
239
  directory: dirname2(file.replace(catalogDir, ""))
232
240
  };
233
241
  };
242
+ var getResourceFolderName = async (catalogDir, id, version) => {
243
+ const paths = await getResourcePath(catalogDir, id, version);
244
+ if (!paths) return;
245
+ return paths?.directory.split(path.sep).filter(Boolean).pop();
246
+ };
234
247
  var toResource = async (catalogDir, rawContents) => {
235
248
  const { data, content } = matter2(rawContents);
236
249
  return {
@@ -292,16 +305,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
292
305
  );
293
306
  }
294
307
  };
295
- var waitForFileRemoval = async (path5, maxRetries = 50, delay = 10) => {
308
+ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
296
309
  for (let i = 0; i < maxRetries; i++) {
297
310
  try {
298
- await fs.access(path5);
311
+ await fs.access(path6);
299
312
  await new Promise((resolve2) => setTimeout(resolve2, delay));
300
313
  } catch (error) {
301
314
  return;
302
315
  }
303
316
  }
304
- throw new Error(`File/directory ${path5} was not removed after ${maxRetries} attempts`);
317
+ throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
305
318
  };
306
319
  var addFileToResource = async (catalogDir, id, file, version) => {
307
320
  const pathToResource = await findFileById(catalogDir, id, version);
@@ -348,8 +361,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
348
361
  pathForEvent = join3(pathForEvent, event.id);
349
362
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
350
363
  };
351
- var rmEvent = (directory) => async (path5) => {
352
- await fs2.rm(join3(directory, path5), { recursive: true });
364
+ var rmEvent = (directory) => async (path6) => {
365
+ await fs2.rm(join3(directory, path6), { recursive: true });
353
366
  };
354
367
  var rmEventById = (directory) => async (id, version, persistFiles) => {
355
368
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -384,8 +397,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
384
397
  pathForCommand = join4(pathForCommand, command.id);
385
398
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
386
399
  };
387
- var rmCommand = (directory) => async (path5) => {
388
- await fs3.rm(join4(directory, path5), { recursive: true });
400
+ var rmCommand = (directory) => async (path6) => {
401
+ await fs3.rm(join4(directory, path6), { recursive: true });
389
402
  };
390
403
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
391
404
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -418,8 +431,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
418
431
  pathForQuery = join5(pathForQuery, query.id);
419
432
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
420
433
  };
421
- var rmQuery = (directory) => async (path5) => {
422
- await fs4.rm(join5(directory, path5), { recursive: true });
434
+ var rmQuery = (directory) => async (path6) => {
435
+ await fs4.rm(join5(directory, path6), { recursive: true });
423
436
  };
424
437
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
425
438
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -438,8 +451,8 @@ var queryHasVersion = (directory) => async (id, version) => {
438
451
  import fs5 from "fs/promises";
439
452
  import { join as join6, dirname as dirname4, extname, relative as relative2 } from "path";
440
453
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
441
- var getServiceByPath = (directory) => async (path5) => {
442
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
454
+ var getServiceByPath = (directory) => async (path6) => {
455
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
443
456
  return service;
444
457
  };
445
458
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -463,8 +476,8 @@ var writeService = (directory) => async (service, options = {
463
476
  };
464
477
  var writeVersionedService = (directory) => async (service) => {
465
478
  const resource = { ...service };
466
- const path5 = getVersionedDirectory(service.id, service.version);
467
- return await writeService(directory)(resource, { path: path5 });
479
+ const path6 = getVersionedDirectory(service.id, service.version);
480
+ return await writeService(directory)(resource, { path: path6 });
468
481
  };
469
482
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
470
483
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -472,8 +485,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
472
485
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
473
486
  };
474
487
  var versionService = (directory) => async (id) => versionResource(directory, id);
475
- var rmService = (directory) => async (path5) => {
476
- await fs5.rm(join6(directory, path5), { recursive: true });
488
+ var rmService = (directory) => async (path6) => {
489
+ await fs5.rm(join6(directory, path6), { recursive: true });
477
490
  };
478
491
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
479
492
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -537,8 +550,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
537
550
  if (!existingResource) {
538
551
  throw new Error(`Cannot find service ${id} in the catalog`);
539
552
  }
540
- const path5 = existingResource.split(/[\\/]+services/)[0];
541
- const pathToResource = join6(path5, "services");
553
+ const path6 = existingResource.split(/[\\/]+services/)[0];
554
+ const pathToResource = join6(path6, "services");
542
555
  await rmServiceById(directory)(id, version);
543
556
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
544
557
  };
@@ -546,9 +559,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
546
559
  const file = await findFileById(directory, id, version);
547
560
  return !!file;
548
561
  };
549
- var isService = (directory) => async (path5) => {
550
- const service = await getServiceByPath(directory)(path5);
551
- const relativePath = relative2(directory, path5);
562
+ var isService = (directory) => async (path6) => {
563
+ const service = await getServiceByPath(directory)(path6);
564
+ const relativePath = relative2(directory, path6);
552
565
  const segments = relativePath.split(/[/\\]+/);
553
566
  return !!service && segments.includes("services");
554
567
  };
@@ -570,8 +583,8 @@ var addEntityToService = (directory) => async (id, entity, version) => {
570
583
  if (!existingResource) {
571
584
  throw new Error(`Cannot find service ${id} in the catalog`);
572
585
  }
573
- const path5 = existingResource.split(/[\\/]+services/)[0];
574
- const pathToResource = join6(path5, "services");
586
+ const path6 = existingResource.split(/[\\/]+services/)[0];
587
+ const pathToResource = join6(path6, "services");
575
588
  await rmServiceById(directory)(id, version);
576
589
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
577
590
  };
@@ -606,15 +619,15 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
606
619
  if (!existingResource) {
607
620
  throw new Error(`Cannot find service ${id} in the catalog`);
608
621
  }
609
- const path5 = existingResource.split(/[\\/]+services/)[0];
610
- const pathToResource = join6(path5, "services");
622
+ const path6 = existingResource.split(/[\\/]+services/)[0];
623
+ const pathToResource = join6(path6, "services");
611
624
  await rmServiceById(directory)(id, version);
612
625
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
613
626
  };
614
627
 
615
628
  // src/domains.ts
616
629
  import fs6 from "fs/promises";
617
- import path, { join as join7 } from "path";
630
+ import path2, { join as join7 } from "path";
618
631
  import fsSync3 from "fs";
619
632
  import matter3 from "gray-matter";
620
633
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -639,8 +652,8 @@ var writeDomain = (directory) => async (domain, options = {
639
652
  return await writeResource(directory, resource, { ...options, type: "domain" });
640
653
  };
641
654
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
642
- var rmDomain = (directory) => async (path5) => {
643
- await fs6.rm(join7(directory, path5), { recursive: true });
655
+ var rmDomain = (directory) => async (path6) => {
656
+ await fs6.rm(join7(directory, path6), { recursive: true });
644
657
  };
645
658
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
646
659
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -652,7 +665,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
652
665
  };
653
666
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
654
667
  const pathToDomain = await findFileById(directory, id, version) || "";
655
- const pathToUbiquitousLanguage = path.join(path.dirname(pathToDomain), "ubiquitous-language.mdx");
668
+ const pathToUbiquitousLanguage = path2.join(path2.dirname(pathToDomain), "ubiquitous-language.mdx");
656
669
  const fileExists = fsSync3.existsSync(pathToUbiquitousLanguage);
657
670
  if (!fileExists) {
658
671
  return void 0;
@@ -667,7 +680,7 @@ var domainHasVersion = (directory) => async (id, version) => {
667
680
  var addServiceToDomain = (directory) => async (id, service, version) => {
668
681
  let domain = await getDomain(directory)(id, version);
669
682
  const domainPath = await getResourcePath(directory, id, version);
670
- const extension = path.extname(domainPath?.fullPath || "");
683
+ const extension = path2.extname(domainPath?.fullPath || "");
671
684
  if (domain.services === void 0) {
672
685
  domain.services = [];
673
686
  }
@@ -682,7 +695,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
682
695
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
683
696
  let domain = await getDomain(directory)(id, version);
684
697
  const domainPath = await getResourcePath(directory, id, version);
685
- const extension = path.extname(domainPath?.fullPath || "");
698
+ const extension = path2.extname(domainPath?.fullPath || "");
686
699
  if (domain.domains === void 0) {
687
700
  domain.domains = [];
688
701
  }
@@ -697,7 +710,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
697
710
  var addEntityToDomain = (directory) => async (id, entity, version) => {
698
711
  let domain = await getDomain(directory)(id, version);
699
712
  const domainPath = await getResourcePath(directory, id, version);
700
- const extension = path.extname(domainPath?.fullPath || "");
713
+ const extension = path2.extname(domainPath?.fullPath || "");
701
714
  if (domain.entities === void 0) {
702
715
  domain.entities = [];
703
716
  }
@@ -716,8 +729,8 @@ import { join as join8, extname as extname2 } from "path";
716
729
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
717
730
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
718
731
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
719
- var rmChannel = (directory) => async (path5) => {
720
- await fs7.rm(join8(directory, path5), { recursive: true });
732
+ var rmChannel = (directory) => async (path6) => {
733
+ await fs7.rm(join8(directory, path6), { recursive: true });
721
734
  };
722
735
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
723
736
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -758,8 +771,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
758
771
  if (!existingResource) {
759
772
  throw new Error(`Cannot find message ${id} in the catalog`);
760
773
  }
761
- const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
762
- const pathToResource = join8(path5, collection);
774
+ const path6 = existingResource.split(`/[\\/]+${collection}`)[0];
775
+ const pathToResource = join8(path6, collection);
763
776
  await rmMessageById(directory)(_message.id, _message.version, true);
764
777
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
765
778
  };
@@ -768,8 +781,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
768
781
  import { dirname as dirname5 } from "path";
769
782
  import matter4 from "gray-matter";
770
783
  import { satisfies as satisfies3, validRange as validRange2 } from "semver";
771
- var getMessageBySchemaPath = (directory) => async (path5, options) => {
772
- const pathToMessage = dirname5(path5);
784
+ var getMessageBySchemaPath = (directory) => async (path6, options) => {
785
+ const pathToMessage = dirname5(path6);
773
786
  try {
774
787
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
775
788
  if (!files || files.length === 0) {
@@ -841,18 +854,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
841
854
  }
842
855
  return { producers, consumers };
843
856
  };
844
- var getConsumersOfSchema = (directory) => async (path5) => {
857
+ var getConsumersOfSchema = (directory) => async (path6) => {
845
858
  try {
846
- const message = await getMessageBySchemaPath(directory)(path5);
859
+ const message = await getMessageBySchemaPath(directory)(path6);
847
860
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
848
861
  return consumers;
849
862
  } catch (error) {
850
863
  return [];
851
864
  }
852
865
  };
853
- var getProducersOfSchema = (directory) => async (path5) => {
866
+ var getProducersOfSchema = (directory) => async (path6) => {
854
867
  try {
855
- const message = await getMessageBySchemaPath(directory)(path5);
868
+ const message = await getMessageBySchemaPath(directory)(path6);
856
869
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
857
870
  return producers;
858
871
  } catch (error) {
@@ -861,13 +874,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
861
874
  };
862
875
 
863
876
  // src/custom-docs.ts
864
- import path2, { join as join10 } from "path";
877
+ import path3, { join as join10 } from "path";
865
878
  import fsSync4 from "fs";
866
879
  import fs8 from "fs/promises";
867
880
  import matter5 from "gray-matter";
868
881
  import slugify from "slugify";
869
882
  var getCustomDoc = (directory) => async (filePath) => {
870
- const fullPath = path2.join(directory, filePath);
883
+ const fullPath = path3.join(directory, filePath);
871
884
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
872
885
  const fileExists = fsSync4.existsSync(fullPathWithExtension);
873
886
  if (!fileExists) {
@@ -886,8 +899,8 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
886
899
  const { fileName, ...rest } = customDoc;
887
900
  const name = fileName || slugify(customDoc.title, { lower: true });
888
901
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
889
- const fullPath = path2.join(directory, options.path || "", withExtension);
890
- fsSync4.mkdirSync(path2.dirname(fullPath), { recursive: true });
902
+ const fullPath = path3.join(directory, options.path || "", withExtension);
903
+ fsSync4.mkdirSync(path3.dirname(fullPath), { recursive: true });
891
904
  const document = matter5.stringify(customDoc.markdown.trim(), rest);
892
905
  fsSync4.writeFileSync(fullPath, document);
893
906
  };
@@ -901,7 +914,7 @@ import fs9 from "fs/promises";
901
914
  import fsSync6 from "fs";
902
915
  import { join as join12 } from "path";
903
916
  import matter7 from "gray-matter";
904
- import path3 from "path";
917
+ import path4 from "path";
905
918
 
906
919
  // src/users.ts
907
920
  import fsSync5 from "fs";
@@ -997,11 +1010,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
997
1010
  if (!resource) return [];
998
1011
  if (!resource.owners) return [];
999
1012
  for (const owner of resource.owners) {
1000
- const team = await getTeam(path3.join(catalogDir, "teams"))(owner);
1013
+ const team = await getTeam(path4.join(catalogDir, "teams"))(owner);
1001
1014
  if (team) {
1002
1015
  owners.push(team);
1003
1016
  } else {
1004
- const user = await getUser(path3.join(catalogDir, "users"))(owner);
1017
+ const user = await getUser(path4.join(catalogDir, "users"))(owner);
1005
1018
  if (user) {
1006
1019
  owners.push(user);
1007
1020
  }
@@ -1020,8 +1033,8 @@ var writeEntity = (directory) => async (entity, options = {
1020
1033
  override: false,
1021
1034
  format: "mdx"
1022
1035
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1023
- var rmEntity = (directory) => async (path5) => {
1024
- await fs10.rm(join13(directory, path5), { recursive: true });
1036
+ var rmEntity = (directory) => async (path6) => {
1037
+ await fs10.rm(join13(directory, path6), { recursive: true });
1025
1038
  };
1026
1039
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1027
1040
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1043,8 +1056,8 @@ var writeContainer = (directory) => async (data, options = {
1043
1056
  format: "mdx"
1044
1057
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1045
1058
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
1046
- var rmContainer = (directory) => async (path5) => {
1047
- await fs11.rm(join14(directory, path5), { recursive: true });
1059
+ var rmContainer = (directory) => async (path6) => {
1060
+ await fs11.rm(join14(directory, path6), { recursive: true });
1048
1061
  };
1049
1062
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
1050
1063
  await rmResourceById(directory, id, version, { type: "container", persistFiles });
@@ -1076,7 +1089,7 @@ var addFileToDataStore = addFileToContainer;
1076
1089
  var writeDataStoreToService = writeContainerToService;
1077
1090
 
1078
1091
  // src/index.ts
1079
- var index_default = (path5) => {
1092
+ var index_default = (path6) => {
1080
1093
  return {
1081
1094
  /**
1082
1095
  * Returns an events from EventCatalog
@@ -1084,13 +1097,13 @@ var index_default = (path5) => {
1084
1097
  * @param version - Optional id of the version to get (supports semver)
1085
1098
  * @returns Event|Undefined
1086
1099
  */
1087
- getEvent: getEvent(join15(path5)),
1100
+ getEvent: getEvent(join15(path6)),
1088
1101
  /**
1089
1102
  * Returns all events from EventCatalog
1090
1103
  * @param latestOnly - optional boolean, set to true to get only latest versions
1091
1104
  * @returns Event[]|Undefined
1092
1105
  */
1093
- getEvents: getEvents(join15(path5)),
1106
+ getEvents: getEvents(join15(path6)),
1094
1107
  /**
1095
1108
  * Adds an event to EventCatalog
1096
1109
  *
@@ -1098,7 +1111,7 @@ var index_default = (path5) => {
1098
1111
  * @param options - Optional options to write the event
1099
1112
  *
1100
1113
  */
1101
- writeEvent: writeEvent(join15(path5, "events")),
1114
+ writeEvent: writeEvent(join15(path6, "events")),
1102
1115
  /**
1103
1116
  * Adds an event to a service in EventCatalog
1104
1117
  *
@@ -1107,26 +1120,26 @@ var index_default = (path5) => {
1107
1120
  * @param options - Optional options to write the event
1108
1121
  *
1109
1122
  */
1110
- writeEventToService: writeEventToService(join15(path5)),
1123
+ writeEventToService: writeEventToService(join15(path6)),
1111
1124
  /**
1112
1125
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1113
1126
  *
1114
1127
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1115
1128
  *
1116
1129
  */
1117
- rmEvent: rmEvent(join15(path5, "events")),
1130
+ rmEvent: rmEvent(join15(path6, "events")),
1118
1131
  /**
1119
1132
  * Remove an event by an Event id
1120
1133
  *
1121
1134
  * @param id - The id of the event you want to remove
1122
1135
  *
1123
1136
  */
1124
- rmEventById: rmEventById(join15(path5)),
1137
+ rmEventById: rmEventById(join15(path6)),
1125
1138
  /**
1126
1139
  * Moves a given event id to the version directory
1127
1140
  * @param directory
1128
1141
  */
1129
- versionEvent: versionEvent(join15(path5)),
1142
+ versionEvent: versionEvent(join15(path6)),
1130
1143
  /**
1131
1144
  * Adds a file to the given event
1132
1145
  * @param id - The id of the event to add the file to
@@ -1134,7 +1147,7 @@ var index_default = (path5) => {
1134
1147
  * @param version - Optional version of the event to add the file to
1135
1148
  * @returns
1136
1149
  */
1137
- addFileToEvent: addFileToEvent(join15(path5)),
1150
+ addFileToEvent: addFileToEvent(join15(path6)),
1138
1151
  /**
1139
1152
  * Adds a schema to the given event
1140
1153
  * @param id - The id of the event to add the schema to
@@ -1142,14 +1155,14 @@ var index_default = (path5) => {
1142
1155
  * @param version - Optional version of the event to add the schema to
1143
1156
  * @returns
1144
1157
  */
1145
- addSchemaToEvent: addSchemaToEvent(join15(path5)),
1158
+ addSchemaToEvent: addSchemaToEvent(join15(path6)),
1146
1159
  /**
1147
1160
  * Check to see if an event version exists
1148
1161
  * @param id - The id of the event
1149
1162
  * @param version - The version of the event (supports semver)
1150
1163
  * @returns
1151
1164
  */
1152
- eventHasVersion: eventHasVersion(join15(path5)),
1165
+ eventHasVersion: eventHasVersion(join15(path6)),
1153
1166
  /**
1154
1167
  * ================================
1155
1168
  * Commands
@@ -1161,13 +1174,13 @@ var index_default = (path5) => {
1161
1174
  * @param version - Optional id of the version to get (supports semver)
1162
1175
  * @returns Command|Undefined
1163
1176
  */
1164
- getCommand: getCommand(join15(path5)),
1177
+ getCommand: getCommand(join15(path6)),
1165
1178
  /**
1166
1179
  * Returns all commands from EventCatalog
1167
1180
  * @param latestOnly - optional boolean, set to true to get only latest versions
1168
1181
  * @returns Command[]|Undefined
1169
1182
  */
1170
- getCommands: getCommands(join15(path5)),
1183
+ getCommands: getCommands(join15(path6)),
1171
1184
  /**
1172
1185
  * Adds an command to EventCatalog
1173
1186
  *
@@ -1175,7 +1188,7 @@ var index_default = (path5) => {
1175
1188
  * @param options - Optional options to write the command
1176
1189
  *
1177
1190
  */
1178
- writeCommand: writeCommand(join15(path5, "commands")),
1191
+ writeCommand: writeCommand(join15(path6, "commands")),
1179
1192
  /**
1180
1193
  * Adds a command to a service in EventCatalog
1181
1194
  *
@@ -1184,26 +1197,26 @@ var index_default = (path5) => {
1184
1197
  * @param options - Optional options to write the command
1185
1198
  *
1186
1199
  */
1187
- writeCommandToService: writeCommandToService(join15(path5)),
1200
+ writeCommandToService: writeCommandToService(join15(path6)),
1188
1201
  /**
1189
1202
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1190
1203
  *
1191
1204
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1192
1205
  *
1193
1206
  */
1194
- rmCommand: rmCommand(join15(path5, "commands")),
1207
+ rmCommand: rmCommand(join15(path6, "commands")),
1195
1208
  /**
1196
1209
  * Remove an command by an Event id
1197
1210
  *
1198
1211
  * @param id - The id of the command you want to remove
1199
1212
  *
1200
1213
  */
1201
- rmCommandById: rmCommandById(join15(path5)),
1214
+ rmCommandById: rmCommandById(join15(path6)),
1202
1215
  /**
1203
1216
  * Moves a given command id to the version directory
1204
1217
  * @param directory
1205
1218
  */
1206
- versionCommand: versionCommand(join15(path5)),
1219
+ versionCommand: versionCommand(join15(path6)),
1207
1220
  /**
1208
1221
  * Adds a file to the given command
1209
1222
  * @param id - The id of the command to add the file to
@@ -1211,7 +1224,7 @@ var index_default = (path5) => {
1211
1224
  * @param version - Optional version of the command to add the file to
1212
1225
  * @returns
1213
1226
  */
1214
- addFileToCommand: addFileToCommand(join15(path5)),
1227
+ addFileToCommand: addFileToCommand(join15(path6)),
1215
1228
  /**
1216
1229
  * Adds a schema to the given command
1217
1230
  * @param id - The id of the command to add the schema to
@@ -1219,14 +1232,14 @@ var index_default = (path5) => {
1219
1232
  * @param version - Optional version of the command to add the schema to
1220
1233
  * @returns
1221
1234
  */
1222
- addSchemaToCommand: addSchemaToCommand(join15(path5)),
1235
+ addSchemaToCommand: addSchemaToCommand(join15(path6)),
1223
1236
  /**
1224
1237
  * Check to see if a command version exists
1225
1238
  * @param id - The id of the command
1226
1239
  * @param version - The version of the command (supports semver)
1227
1240
  * @returns
1228
1241
  */
1229
- commandHasVersion: commandHasVersion(join15(path5)),
1242
+ commandHasVersion: commandHasVersion(join15(path6)),
1230
1243
  /**
1231
1244
  * ================================
1232
1245
  * Queries
@@ -1238,13 +1251,13 @@ var index_default = (path5) => {
1238
1251
  * @param version - Optional id of the version to get (supports semver)
1239
1252
  * @returns Query|Undefined
1240
1253
  */
1241
- getQuery: getQuery(join15(path5)),
1254
+ getQuery: getQuery(join15(path6)),
1242
1255
  /**
1243
1256
  * Returns all queries from EventCatalog
1244
1257
  * @param latestOnly - optional boolean, set to true to get only latest versions
1245
1258
  * @returns Query[]|Undefined
1246
1259
  */
1247
- getQueries: getQueries(join15(path5)),
1260
+ getQueries: getQueries(join15(path6)),
1248
1261
  /**
1249
1262
  * Adds a query to EventCatalog
1250
1263
  *
@@ -1252,7 +1265,7 @@ var index_default = (path5) => {
1252
1265
  * @param options - Optional options to write the event
1253
1266
  *
1254
1267
  */
1255
- writeQuery: writeQuery(join15(path5, "queries")),
1268
+ writeQuery: writeQuery(join15(path6, "queries")),
1256
1269
  /**
1257
1270
  * Adds a query to a service in EventCatalog
1258
1271
  *
@@ -1261,26 +1274,26 @@ var index_default = (path5) => {
1261
1274
  * @param options - Optional options to write the query
1262
1275
  *
1263
1276
  */
1264
- writeQueryToService: writeQueryToService(join15(path5)),
1277
+ writeQueryToService: writeQueryToService(join15(path6)),
1265
1278
  /**
1266
1279
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1267
1280
  *
1268
1281
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1269
1282
  *
1270
1283
  */
1271
- rmQuery: rmQuery(join15(path5, "queries")),
1284
+ rmQuery: rmQuery(join15(path6, "queries")),
1272
1285
  /**
1273
1286
  * Remove a query by a Query id
1274
1287
  *
1275
1288
  * @param id - The id of the query you want to remove
1276
1289
  *
1277
1290
  */
1278
- rmQueryById: rmQueryById(join15(path5)),
1291
+ rmQueryById: rmQueryById(join15(path6)),
1279
1292
  /**
1280
1293
  * Moves a given query id to the version directory
1281
1294
  * @param directory
1282
1295
  */
1283
- versionQuery: versionQuery(join15(path5)),
1296
+ versionQuery: versionQuery(join15(path6)),
1284
1297
  /**
1285
1298
  * Adds a file to the given query
1286
1299
  * @param id - The id of the query to add the file to
@@ -1288,7 +1301,7 @@ var index_default = (path5) => {
1288
1301
  * @param version - Optional version of the query to add the file to
1289
1302
  * @returns
1290
1303
  */
1291
- addFileToQuery: addFileToQuery(join15(path5)),
1304
+ addFileToQuery: addFileToQuery(join15(path6)),
1292
1305
  /**
1293
1306
  * Adds a schema to the given query
1294
1307
  * @param id - The id of the query to add the schema to
@@ -1296,14 +1309,14 @@ var index_default = (path5) => {
1296
1309
  * @param version - Optional version of the query to add the schema to
1297
1310
  * @returns
1298
1311
  */
1299
- addSchemaToQuery: addSchemaToQuery(join15(path5)),
1312
+ addSchemaToQuery: addSchemaToQuery(join15(path6)),
1300
1313
  /**
1301
1314
  * Check to see if an query version exists
1302
1315
  * @param id - The id of the query
1303
1316
  * @param version - The version of the query (supports semver)
1304
1317
  * @returns
1305
1318
  */
1306
- queryHasVersion: queryHasVersion(join15(path5)),
1319
+ queryHasVersion: queryHasVersion(join15(path6)),
1307
1320
  /**
1308
1321
  * ================================
1309
1322
  * Channels
@@ -1315,13 +1328,13 @@ var index_default = (path5) => {
1315
1328
  * @param version - Optional id of the version to get (supports semver)
1316
1329
  * @returns Channel|Undefined
1317
1330
  */
1318
- getChannel: getChannel(join15(path5)),
1331
+ getChannel: getChannel(join15(path6)),
1319
1332
  /**
1320
1333
  * Returns all channels from EventCatalog
1321
1334
  * @param latestOnly - optional boolean, set to true to get only latest versions
1322
1335
  * @returns Channel[]|Undefined
1323
1336
  */
1324
- getChannels: getChannels(join15(path5)),
1337
+ getChannels: getChannels(join15(path6)),
1325
1338
  /**
1326
1339
  * Adds an channel to EventCatalog
1327
1340
  *
@@ -1329,33 +1342,33 @@ var index_default = (path5) => {
1329
1342
  * @param options - Optional options to write the channel
1330
1343
  *
1331
1344
  */
1332
- writeChannel: writeChannel(join15(path5, "channels")),
1345
+ writeChannel: writeChannel(join15(path6, "channels")),
1333
1346
  /**
1334
1347
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1335
1348
  *
1336
1349
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1337
1350
  *
1338
1351
  */
1339
- rmChannel: rmChannel(join15(path5, "channels")),
1352
+ rmChannel: rmChannel(join15(path6, "channels")),
1340
1353
  /**
1341
1354
  * Remove an channel by an Event id
1342
1355
  *
1343
1356
  * @param id - The id of the channel you want to remove
1344
1357
  *
1345
1358
  */
1346
- rmChannelById: rmChannelById(join15(path5)),
1359
+ rmChannelById: rmChannelById(join15(path6)),
1347
1360
  /**
1348
1361
  * Moves a given channel id to the version directory
1349
1362
  * @param directory
1350
1363
  */
1351
- versionChannel: versionChannel(join15(path5)),
1364
+ versionChannel: versionChannel(join15(path6)),
1352
1365
  /**
1353
1366
  * Check to see if a channel version exists
1354
1367
  * @param id - The id of the channel
1355
1368
  * @param version - The version of the channel (supports semver)
1356
1369
  * @returns
1357
1370
  */
1358
- channelHasVersion: channelHasVersion(join15(path5)),
1371
+ channelHasVersion: channelHasVersion(join15(path6)),
1359
1372
  /**
1360
1373
  * Add a channel to an event
1361
1374
  *
@@ -1372,7 +1385,7 @@ var index_default = (path5) => {
1372
1385
  *
1373
1386
  * ```
1374
1387
  */
1375
- addEventToChannel: addMessageToChannel(join15(path5), "events"),
1388
+ addEventToChannel: addMessageToChannel(join15(path6), "events"),
1376
1389
  /**
1377
1390
  * Add a channel to an command
1378
1391
  *
@@ -1389,7 +1402,7 @@ var index_default = (path5) => {
1389
1402
  *
1390
1403
  * ```
1391
1404
  */
1392
- addCommandToChannel: addMessageToChannel(join15(path5), "commands"),
1405
+ addCommandToChannel: addMessageToChannel(join15(path6), "commands"),
1393
1406
  /**
1394
1407
  * Add a channel to an query
1395
1408
  *
@@ -1406,7 +1419,7 @@ var index_default = (path5) => {
1406
1419
  *
1407
1420
  * ```
1408
1421
  */
1409
- addQueryToChannel: addMessageToChannel(join15(path5), "queries"),
1422
+ addQueryToChannel: addMessageToChannel(join15(path6), "queries"),
1410
1423
  /**
1411
1424
  * ================================
1412
1425
  * SERVICES
@@ -1419,14 +1432,14 @@ var index_default = (path5) => {
1419
1432
  * @param options - Optional options to write the event
1420
1433
  *
1421
1434
  */
1422
- writeService: writeService(join15(path5, "services")),
1435
+ writeService: writeService(join15(path6, "services")),
1423
1436
  /**
1424
1437
  * Adds a versioned service to EventCatalog
1425
1438
  *
1426
1439
  * @param service - The service to write
1427
1440
  *
1428
1441
  */
1429
- writeVersionedService: writeVersionedService(join15(path5, "services")),
1442
+ writeVersionedService: writeVersionedService(join15(path6, "services")),
1430
1443
  /**
1431
1444
  * Adds a service to a domain in EventCatalog
1432
1445
  *
@@ -1435,45 +1448,45 @@ var index_default = (path5) => {
1435
1448
  * @param options - Optional options to write the event
1436
1449
  *
1437
1450
  */
1438
- writeServiceToDomain: writeServiceToDomain(join15(path5, "domains")),
1451
+ writeServiceToDomain: writeServiceToDomain(join15(path6, "domains")),
1439
1452
  /**
1440
1453
  * Returns a service from EventCatalog
1441
1454
  * @param id - The id of the service to retrieve
1442
1455
  * @param version - Optional id of the version to get (supports semver)
1443
1456
  * @returns Service|Undefined
1444
1457
  */
1445
- getService: getService(join15(path5)),
1458
+ getService: getService(join15(path6)),
1446
1459
  /**
1447
1460
  * Returns a service from EventCatalog by it's path.
1448
1461
  * @param path - The path to the service to retrieve
1449
1462
  * @returns Service|Undefined
1450
1463
  */
1451
- getServiceByPath: getServiceByPath(join15(path5)),
1464
+ getServiceByPath: getServiceByPath(join15(path6)),
1452
1465
  /**
1453
1466
  * Returns all services from EventCatalog
1454
1467
  * @param latestOnly - optional boolean, set to true to get only latest versions
1455
1468
  * @returns Service[]|Undefined
1456
1469
  */
1457
- getServices: getServices(join15(path5)),
1470
+ getServices: getServices(join15(path6)),
1458
1471
  /**
1459
1472
  * Moves a given service id to the version directory
1460
1473
  * @param directory
1461
1474
  */
1462
- versionService: versionService(join15(path5)),
1475
+ versionService: versionService(join15(path6)),
1463
1476
  /**
1464
1477
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1465
1478
  *
1466
1479
  * @param path - The path to your service, e.g. `/InventoryService`
1467
1480
  *
1468
1481
  */
1469
- rmService: rmService(join15(path5, "services")),
1482
+ rmService: rmService(join15(path6, "services")),
1470
1483
  /**
1471
1484
  * Remove an service by an service id
1472
1485
  *
1473
1486
  * @param id - The id of the service you want to remove
1474
1487
  *
1475
1488
  */
1476
- rmServiceById: rmServiceById(join15(path5)),
1489
+ rmServiceById: rmServiceById(join15(path6)),
1477
1490
  /**
1478
1491
  * Adds a file to the given service
1479
1492
  * @param id - The id of the service to add the file to
@@ -1481,21 +1494,21 @@ var index_default = (path5) => {
1481
1494
  * @param version - Optional version of the service to add the file to
1482
1495
  * @returns
1483
1496
  */
1484
- addFileToService: addFileToService(join15(path5)),
1497
+ addFileToService: addFileToService(join15(path6)),
1485
1498
  /**
1486
1499
  * Returns the specifications for a given service
1487
1500
  * @param id - The id of the service to retrieve the specifications for
1488
1501
  * @param version - Optional version of the service
1489
1502
  * @returns
1490
1503
  */
1491
- getSpecificationFilesForService: getSpecificationFilesForService(join15(path5)),
1504
+ getSpecificationFilesForService: getSpecificationFilesForService(join15(path6)),
1492
1505
  /**
1493
1506
  * Check to see if a service version exists
1494
1507
  * @param id - The id of the service
1495
1508
  * @param version - The version of the service (supports semver)
1496
1509
  * @returns
1497
1510
  */
1498
- serviceHasVersion: serviceHasVersion(join15(path5)),
1511
+ serviceHasVersion: serviceHasVersion(join15(path6)),
1499
1512
  /**
1500
1513
  * Add an event to a service by it's id.
1501
1514
  *
@@ -1515,7 +1528,7 @@ var index_default = (path5) => {
1515
1528
  *
1516
1529
  * ```
1517
1530
  */
1518
- addEventToService: addMessageToService(join15(path5)),
1531
+ addEventToService: addMessageToService(join15(path6)),
1519
1532
  /**
1520
1533
  * Add a data store to a service by it's id.
1521
1534
  *
@@ -1532,7 +1545,7 @@ var index_default = (path5) => {
1532
1545
  *
1533
1546
  * ```
1534
1547
  */
1535
- addDataStoreToService: addDataStoreToService(join15(path5)),
1548
+ addDataStoreToService: addDataStoreToService(join15(path6)),
1536
1549
  /**
1537
1550
  * Add a command to a service by it's id.
1538
1551
  *
@@ -1552,7 +1565,7 @@ var index_default = (path5) => {
1552
1565
  *
1553
1566
  * ```
1554
1567
  */
1555
- addCommandToService: addMessageToService(join15(path5)),
1568
+ addCommandToService: addMessageToService(join15(path6)),
1556
1569
  /**
1557
1570
  * Add a query to a service by it's id.
1558
1571
  *
@@ -1572,7 +1585,7 @@ var index_default = (path5) => {
1572
1585
  *
1573
1586
  * ```
1574
1587
  */
1575
- addQueryToService: addMessageToService(join15(path5)),
1588
+ addQueryToService: addMessageToService(join15(path6)),
1576
1589
  /**
1577
1590
  * Add an entity to a service by its id.
1578
1591
  *
@@ -1590,7 +1603,7 @@ var index_default = (path5) => {
1590
1603
  *
1591
1604
  * ```
1592
1605
  */
1593
- addEntityToService: addEntityToService(join15(path5)),
1606
+ addEntityToService: addEntityToService(join15(path6)),
1594
1607
  /**
1595
1608
  * Check to see if a service exists by it's path.
1596
1609
  *
@@ -1607,13 +1620,13 @@ var index_default = (path5) => {
1607
1620
  * @param path - The path to the service to check
1608
1621
  * @returns boolean
1609
1622
  */
1610
- isService: isService(join15(path5)),
1623
+ isService: isService(join15(path6)),
1611
1624
  /**
1612
1625
  * Converts a file to a service.
1613
1626
  * @param file - The file to convert to a service.
1614
1627
  * @returns The service.
1615
1628
  */
1616
- toService: toService(join15(path5)),
1629
+ toService: toService(join15(path6)),
1617
1630
  /**
1618
1631
  * ================================
1619
1632
  * Domains
@@ -1626,39 +1639,39 @@ var index_default = (path5) => {
1626
1639
  * @param options - Optional options to write the event
1627
1640
  *
1628
1641
  */
1629
- writeDomain: writeDomain(join15(path5, "domains")),
1642
+ writeDomain: writeDomain(join15(path6, "domains")),
1630
1643
  /**
1631
1644
  * Returns a domain from EventCatalog
1632
1645
  * @param id - The id of the domain to retrieve
1633
1646
  * @param version - Optional id of the version to get (supports semver)
1634
1647
  * @returns Domain|Undefined
1635
1648
  */
1636
- getDomain: getDomain(join15(path5, "domains")),
1649
+ getDomain: getDomain(join15(path6, "domains")),
1637
1650
  /**
1638
1651
  * Returns all domains from EventCatalog
1639
1652
  * @param latestOnly - optional boolean, set to true to get only latest versions
1640
1653
  * @returns Domain[]|Undefined
1641
1654
  */
1642
- getDomains: getDomains(join15(path5)),
1655
+ getDomains: getDomains(join15(path6)),
1643
1656
  /**
1644
1657
  * Moves a given domain id to the version directory
1645
1658
  * @param directory
1646
1659
  */
1647
- versionDomain: versionDomain(join15(path5, "domains")),
1660
+ versionDomain: versionDomain(join15(path6, "domains")),
1648
1661
  /**
1649
1662
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1650
1663
  *
1651
1664
  * @param path - The path to your domain, e.g. `/Payment`
1652
1665
  *
1653
1666
  */
1654
- rmDomain: rmDomain(join15(path5, "domains")),
1667
+ rmDomain: rmDomain(join15(path6, "domains")),
1655
1668
  /**
1656
1669
  * Remove an service by an domain id
1657
1670
  *
1658
1671
  * @param id - The id of the domain you want to remove
1659
1672
  *
1660
1673
  */
1661
- rmDomainById: rmDomainById(join15(path5, "domains")),
1674
+ rmDomainById: rmDomainById(join15(path6, "domains")),
1662
1675
  /**
1663
1676
  * Adds a file to the given domain
1664
1677
  * @param id - The id of the domain to add the file to
@@ -1666,28 +1679,28 @@ var index_default = (path5) => {
1666
1679
  * @param version - Optional version of the domain to add the file to
1667
1680
  * @returns
1668
1681
  */
1669
- addFileToDomain: addFileToDomain(join15(path5, "domains")),
1682
+ addFileToDomain: addFileToDomain(join15(path6, "domains")),
1670
1683
  /**
1671
1684
  * Adds an ubiquitous language dictionary to a domain
1672
1685
  * @param id - The id of the domain to add the ubiquitous language to
1673
1686
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1674
1687
  * @param version - Optional version of the domain to add the ubiquitous language to
1675
1688
  */
1676
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(path5, "domains")),
1689
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(path6, "domains")),
1677
1690
  /**
1678
1691
  * Get the ubiquitous language dictionary from a domain
1679
1692
  * @param id - The id of the domain to get the ubiquitous language from
1680
1693
  * @param version - Optional version of the domain to get the ubiquitous language from
1681
1694
  * @returns
1682
1695
  */
1683
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(path5, "domains")),
1696
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(path6, "domains")),
1684
1697
  /**
1685
1698
  * Check to see if a domain version exists
1686
1699
  * @param id - The id of the domain
1687
1700
  * @param version - The version of the domain (supports semver)
1688
1701
  * @returns
1689
1702
  */
1690
- domainHasVersion: domainHasVersion(join15(path5)),
1703
+ domainHasVersion: domainHasVersion(join15(path6)),
1691
1704
  /**
1692
1705
  * Adds a given service to a domain
1693
1706
  * @param id - The id of the domain
@@ -1695,7 +1708,7 @@ var index_default = (path5) => {
1695
1708
  * @param version - (Optional) The version of the domain to add the service to
1696
1709
  * @returns
1697
1710
  */
1698
- addServiceToDomain: addServiceToDomain(join15(path5, "domains")),
1711
+ addServiceToDomain: addServiceToDomain(join15(path6, "domains")),
1699
1712
  /**
1700
1713
  * Adds a given subdomain to a domain
1701
1714
  * @param id - The id of the domain
@@ -1703,7 +1716,7 @@ var index_default = (path5) => {
1703
1716
  * @param version - (Optional) The version of the domain to add the subdomain to
1704
1717
  * @returns
1705
1718
  */
1706
- addSubDomainToDomain: addSubDomainToDomain(join15(path5, "domains")),
1719
+ addSubDomainToDomain: addSubDomainToDomain(join15(path6, "domains")),
1707
1720
  /**
1708
1721
  * Adds an entity to a domain
1709
1722
  * @param id - The id of the domain
@@ -1711,7 +1724,7 @@ var index_default = (path5) => {
1711
1724
  * @param version - (Optional) The version of the domain to add the entity to
1712
1725
  * @returns
1713
1726
  */
1714
- addEntityToDomain: addEntityToDomain(join15(path5, "domains")),
1727
+ addEntityToDomain: addEntityToDomain(join15(path6, "domains")),
1715
1728
  /**
1716
1729
  * ================================
1717
1730
  * Teams
@@ -1724,25 +1737,25 @@ var index_default = (path5) => {
1724
1737
  * @param options - Optional options to write the team
1725
1738
  *
1726
1739
  */
1727
- writeTeam: writeTeam(join15(path5, "teams")),
1740
+ writeTeam: writeTeam(join15(path6, "teams")),
1728
1741
  /**
1729
1742
  * Returns a team from EventCatalog
1730
1743
  * @param id - The id of the team to retrieve
1731
1744
  * @returns Team|Undefined
1732
1745
  */
1733
- getTeam: getTeam(join15(path5, "teams")),
1746
+ getTeam: getTeam(join15(path6, "teams")),
1734
1747
  /**
1735
1748
  * Returns all teams from EventCatalog
1736
1749
  * @returns Team[]|Undefined
1737
1750
  */
1738
- getTeams: getTeams(join15(path5, "teams")),
1751
+ getTeams: getTeams(join15(path6, "teams")),
1739
1752
  /**
1740
1753
  * Remove a team by the team id
1741
1754
  *
1742
1755
  * @param id - The id of the team you want to remove
1743
1756
  *
1744
1757
  */
1745
- rmTeamById: rmTeamById(join15(path5, "teams")),
1758
+ rmTeamById: rmTeamById(join15(path6, "teams")),
1746
1759
  /**
1747
1760
  * ================================
1748
1761
  * Users
@@ -1755,25 +1768,25 @@ var index_default = (path5) => {
1755
1768
  * @param options - Optional options to write the user
1756
1769
  *
1757
1770
  */
1758
- writeUser: writeUser(join15(path5, "users")),
1771
+ writeUser: writeUser(join15(path6, "users")),
1759
1772
  /**
1760
1773
  * Returns a user from EventCatalog
1761
1774
  * @param id - The id of the user to retrieve
1762
1775
  * @returns User|Undefined
1763
1776
  */
1764
- getUser: getUser(join15(path5, "users")),
1777
+ getUser: getUser(join15(path6, "users")),
1765
1778
  /**
1766
1779
  * Returns all user from EventCatalog
1767
1780
  * @returns User[]|Undefined
1768
1781
  */
1769
- getUsers: getUsers(join15(path5)),
1782
+ getUsers: getUsers(join15(path6)),
1770
1783
  /**
1771
1784
  * Remove a user by the user id
1772
1785
  *
1773
1786
  * @param id - The id of the user you want to remove
1774
1787
  *
1775
1788
  */
1776
- rmUserById: rmUserById(join15(path5, "users")),
1789
+ rmUserById: rmUserById(join15(path6, "users")),
1777
1790
  /**
1778
1791
  * ================================
1779
1792
  * Custom Docs
@@ -1784,32 +1797,32 @@ var index_default = (path5) => {
1784
1797
  * @param path - The path to the custom doc to retrieve
1785
1798
  * @returns CustomDoc|Undefined
1786
1799
  */
1787
- getCustomDoc: getCustomDoc(join15(path5, "docs")),
1800
+ getCustomDoc: getCustomDoc(join15(path6, "docs")),
1788
1801
  /**
1789
1802
  * Returns all custom docs from EventCatalog
1790
1803
  * @param options - Optional options to get custom docs from a specific path
1791
1804
  * @returns CustomDoc[]|Undefined
1792
1805
  */
1793
- getCustomDocs: getCustomDocs(join15(path5, "docs")),
1806
+ getCustomDocs: getCustomDocs(join15(path6, "docs")),
1794
1807
  /**
1795
1808
  * Writes a custom doc to EventCatalog
1796
1809
  * @param customDoc - The custom doc to write
1797
1810
  * @param options - Optional options to write the custom doc
1798
1811
  *
1799
1812
  */
1800
- writeCustomDoc: writeCustomDoc(join15(path5, "docs")),
1813
+ writeCustomDoc: writeCustomDoc(join15(path6, "docs")),
1801
1814
  /**
1802
1815
  * Removes a custom doc from EventCatalog
1803
1816
  * @param path - The path to the custom doc to remove
1804
1817
  *
1805
1818
  */
1806
- rmCustomDoc: rmCustomDoc(join15(path5, "docs")),
1819
+ rmCustomDoc: rmCustomDoc(join15(path6, "docs")),
1807
1820
  /**
1808
1821
  * Dumps the catalog to a JSON file.
1809
1822
  * @param directory - The directory to dump the catalog to
1810
1823
  * @returns A JSON file with the catalog
1811
1824
  */
1812
- dumpCatalog: dumpCatalog(join15(path5)),
1825
+ dumpCatalog: dumpCatalog(join15(path6)),
1813
1826
  /**
1814
1827
  * Returns the event catalog configuration file.
1815
1828
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1817,7 +1830,7 @@ var index_default = (path5) => {
1817
1830
  * @param directory - The directory of the catalog.
1818
1831
  * @returns A JSON object with the configuration for the event catalog.
1819
1832
  */
1820
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(path5)),
1833
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(path6)),
1821
1834
  /**
1822
1835
  * ================================
1823
1836
  * Resources Utils
@@ -1827,6 +1840,10 @@ var index_default = (path5) => {
1827
1840
  * Returns the path to a given resource by id and version
1828
1841
  */
1829
1842
  getResourcePath,
1843
+ /**
1844
+ * Returns the folder name of a given resource
1845
+ */
1846
+ getResourceFolderName,
1830
1847
  /**
1831
1848
  * ================================
1832
1849
  * General Message Utils
@@ -1838,33 +1855,33 @@ var index_default = (path5) => {
1838
1855
  * @param path - The path to the message to retrieve
1839
1856
  * @returns Message|Undefined
1840
1857
  */
1841
- getMessageBySchemaPath: getMessageBySchemaPath(join15(path5)),
1858
+ getMessageBySchemaPath: getMessageBySchemaPath(join15(path6)),
1842
1859
  /**
1843
1860
  * Returns the producers and consumers (services) for a given message
1844
1861
  * @param id - The id of the message to get the producers and consumers for
1845
1862
  * @param version - Optional version of the message
1846
1863
  * @returns { producers: Service[], consumers: Service[] }
1847
1864
  */
1848
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(path5)),
1865
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(path6)),
1849
1866
  /**
1850
1867
  * Returns the consumers of a given schema path
1851
1868
  * @param path - The path to the schema to get the consumers for
1852
1869
  * @returns Service[]
1853
1870
  */
1854
- getConsumersOfSchema: getConsumersOfSchema(join15(path5)),
1871
+ getConsumersOfSchema: getConsumersOfSchema(join15(path6)),
1855
1872
  /**
1856
1873
  * Returns the producers of a given schema path
1857
1874
  * @param path - The path to the schema to get the producers for
1858
1875
  * @returns Service[]
1859
1876
  */
1860
- getProducersOfSchema: getProducersOfSchema(join15(path5)),
1877
+ getProducersOfSchema: getProducersOfSchema(join15(path6)),
1861
1878
  /**
1862
1879
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1863
1880
  * @param id - The id of the resource to get the owners for
1864
1881
  * @param version - Optional version of the resource
1865
1882
  * @returns { owners: User[] }
1866
1883
  */
1867
- getOwnersForResource: getOwnersForResource(join15(path5)),
1884
+ getOwnersForResource: getOwnersForResource(join15(path6)),
1868
1885
  /**
1869
1886
  * ================================
1870
1887
  * Entities
@@ -1876,13 +1893,13 @@ var index_default = (path5) => {
1876
1893
  * @param version - Optional id of the version to get (supports semver)
1877
1894
  * @returns Entity|Undefined
1878
1895
  */
1879
- getEntity: getEntity(join15(path5)),
1896
+ getEntity: getEntity(join15(path6)),
1880
1897
  /**
1881
1898
  * Returns all entities from EventCatalog
1882
1899
  * @param latestOnly - optional boolean, set to true to get only latest versions
1883
1900
  * @returns Entity[]|Undefined
1884
1901
  */
1885
- getEntities: getEntities(join15(path5)),
1902
+ getEntities: getEntities(join15(path6)),
1886
1903
  /**
1887
1904
  * Adds an entity to EventCatalog
1888
1905
  *
@@ -1890,33 +1907,33 @@ var index_default = (path5) => {
1890
1907
  * @param options - Optional options to write the entity
1891
1908
  *
1892
1909
  */
1893
- writeEntity: writeEntity(join15(path5, "entities")),
1910
+ writeEntity: writeEntity(join15(path6, "entities")),
1894
1911
  /**
1895
1912
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1896
1913
  *
1897
1914
  * @param path - The path to your entity, e.g. `/User`
1898
1915
  *
1899
1916
  */
1900
- rmEntity: rmEntity(join15(path5, "entities")),
1917
+ rmEntity: rmEntity(join15(path6, "entities")),
1901
1918
  /**
1902
1919
  * Remove an entity by an entity id
1903
1920
  *
1904
1921
  * @param id - The id of the entity you want to remove
1905
1922
  *
1906
1923
  */
1907
- rmEntityById: rmEntityById(join15(path5)),
1924
+ rmEntityById: rmEntityById(join15(path6)),
1908
1925
  /**
1909
1926
  * Moves a given entity id to the version directory
1910
1927
  * @param id - The id of the entity to version
1911
1928
  */
1912
- versionEntity: versionEntity(join15(path5)),
1929
+ versionEntity: versionEntity(join15(path6)),
1913
1930
  /**
1914
1931
  * Check to see if an entity version exists
1915
1932
  * @param id - The id of the entity
1916
1933
  * @param version - The version of the entity (supports semver)
1917
1934
  * @returns
1918
1935
  */
1919
- entityHasVersion: entityHasVersion(join15(path5)),
1936
+ entityHasVersion: entityHasVersion(join15(path6)),
1920
1937
  /**
1921
1938
  * ================================
1922
1939
  * Data Stores
@@ -1928,42 +1945,42 @@ var index_default = (path5) => {
1928
1945
  * @param options - Optional options to write the data store
1929
1946
  *
1930
1947
  */
1931
- writeDataStore: writeDataStore(join15(path5, "containers")),
1948
+ writeDataStore: writeDataStore(join15(path6, "containers")),
1932
1949
  /**
1933
1950
  * Returns a data store from EventCatalog
1934
1951
  * @param id - The id of the data store to retrieve
1935
1952
  * @param version - Optional id of the version to get (supports semver)
1936
1953
  * @returns Container|Undefined
1937
1954
  */
1938
- getDataStore: getDataStore(join15(path5)),
1955
+ getDataStore: getDataStore(join15(path6)),
1939
1956
  /**
1940
1957
  * Returns all data stores from EventCatalog
1941
1958
  * @param latestOnly - optional boolean, set to true to get only latest versions
1942
1959
  * @returns Container[]|Undefined
1943
1960
  */
1944
- getDataStores: getDataStores(join15(path5)),
1961
+ getDataStores: getDataStores(join15(path6)),
1945
1962
  /**
1946
1963
  * Version a data store by its id
1947
1964
  * @param id - The id of the data store to version
1948
1965
  */
1949
- versionDataStore: versionDataStore(join15(path5, "containers")),
1966
+ versionDataStore: versionDataStore(join15(path6, "containers")),
1950
1967
  /**
1951
1968
  * Remove a data store by its path
1952
1969
  * @param path - The path to the data store to remove
1953
1970
  */
1954
- rmDataStore: rmDataStore(join15(path5, "containers")),
1971
+ rmDataStore: rmDataStore(join15(path6, "containers")),
1955
1972
  /**
1956
1973
  * Remove a data store by its id
1957
1974
  * @param id - The id of the data store to remove
1958
1975
  */
1959
- rmDataStoreById: rmDataStoreById(join15(path5)),
1976
+ rmDataStoreById: rmDataStoreById(join15(path6)),
1960
1977
  /**
1961
1978
  * Check to see if a data store version exists
1962
1979
  * @param id - The id of the data store
1963
1980
  * @param version - The version of the data store (supports semver)
1964
1981
  * @returns
1965
1982
  */
1966
- dataStoreHasVersion: dataStoreHasVersion(join15(path5)),
1983
+ dataStoreHasVersion: dataStoreHasVersion(join15(path6)),
1967
1984
  /**
1968
1985
  * Adds a file to a data store by its id
1969
1986
  * @param id - The id of the data store to add the file to
@@ -1971,14 +1988,14 @@ var index_default = (path5) => {
1971
1988
  * @param version - Optional version of the data store to add the file to
1972
1989
  * @returns
1973
1990
  */
1974
- addFileToDataStore: addFileToDataStore(join15(path5)),
1991
+ addFileToDataStore: addFileToDataStore(join15(path6)),
1975
1992
  /**
1976
1993
  * Writes a data store to a service by its id
1977
1994
  * @param dataStore - The data store to write
1978
1995
  * @param service - The service to write the data store to
1979
1996
  * @returns
1980
1997
  */
1981
- writeDataStoreToService: writeDataStoreToService(join15(path5))
1998
+ writeDataStoreToService: writeDataStoreToService(join15(path6))
1982
1999
  };
1983
2000
  };
1984
2001
 
@@ -1999,7 +2016,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1999
2016
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
2000
2017
  let schema = "";
2001
2018
  if (resource.schemaPath && resourcePath?.fullPath) {
2002
- const pathToSchema = path4.join(path4.dirname(resourcePath?.fullPath), resource.schemaPath);
2019
+ const pathToSchema = path5.join(path5.dirname(resourcePath?.fullPath), resource.schemaPath);
2003
2020
  if (fs12.existsSync(pathToSchema)) {
2004
2021
  schema = fs12.readFileSync(pathToSchema, "utf8");
2005
2022
  }
@@ -2020,8 +2037,8 @@ var filterCollection = (collection, options) => {
2020
2037
  };
2021
2038
  var getEventCatalogConfigurationFile = (directory) => async () => {
2022
2039
  try {
2023
- const path5 = join16(directory, "eventcatalog.config.js");
2024
- const configModule = await import(path5);
2040
+ const path6 = join16(directory, "eventcatalog.config.js");
2041
+ const configModule = await import(path6);
2025
2042
  return configModule.default;
2026
2043
  } catch (error) {
2027
2044
  console.error("Error getting event catalog configuration file", error);