@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
@@ -35,14 +35,14 @@ __export(eventcatalog_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(eventcatalog_exports);
37
37
  var import_fs = __toESM(require("fs"));
38
- var import_node_path17 = __toESM(require("path"));
38
+ var import_node_path18 = __toESM(require("path"));
39
39
 
40
40
  // src/index.ts
41
- var import_node_path16 = require("path");
41
+ var import_node_path17 = require("path");
42
42
 
43
43
  // src/events.ts
44
44
  var import_promises2 = __toESM(require("fs/promises"));
45
- var import_node_path3 = require("path");
45
+ var import_node_path4 = require("path");
46
46
 
47
47
  // src/internal/utils.ts
48
48
  var import_glob = require("glob");
@@ -59,26 +59,33 @@ var versionExists = async (catalogDir, id, version) => {
59
59
  var findFileById = async (catalogDir, id, version) => {
60
60
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
61
61
  const matchedFiles = await searchFilesForId(files, id) || [];
62
- const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
62
+ const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
63
63
  if (!version) {
64
64
  return latestVersion;
65
65
  }
66
- const parsedFiles = matchedFiles.map((path5) => {
67
- const { data } = import_gray_matter.default.read(path5);
68
- return { ...data, path: path5 };
66
+ const parsedFiles = matchedFiles.map((path6) => {
67
+ const { data } = import_gray_matter.default.read(path6);
68
+ return { ...data, path: path6 };
69
69
  });
70
- const semverRange = (0, import_semver.validRange)(version);
71
- if (semverRange && (0, import_semver.valid)(version)) {
72
- const match2 = parsedFiles.filter((c) => (0, import_semver.satisfies)(c.version, semverRange));
73
- return match2.length > 0 ? match2[0].path : void 0;
70
+ if (version === "latest") {
71
+ return latestVersion;
74
72
  }
75
- const sorted = parsedFiles.sort((a, b) => {
76
- return a.version.localeCompare(b.version);
77
- });
78
- const match = sorted.length > 0 ? [sorted[sorted.length - 1]] : [];
79
- if (match.length > 0) {
80
- return match[0].path;
73
+ const exactMatch = parsedFiles.find((c) => c.version === version);
74
+ if (exactMatch) {
75
+ return exactMatch.path;
81
76
  }
77
+ const semverRange = (0, import_semver.validRange)(version);
78
+ if (semverRange) {
79
+ const match = parsedFiles.filter((c) => {
80
+ try {
81
+ return (0, import_semver.satisfies)(c.version, semverRange);
82
+ } catch (error) {
83
+ return false;
84
+ }
85
+ });
86
+ return match.length > 0 ? match[0].path : void 0;
87
+ }
88
+ return void 0;
82
89
  };
83
90
  var getFiles = async (pattern, ignore = "") => {
84
91
  try {
@@ -106,8 +113,8 @@ var getFiles = async (pattern, ignore = "") => {
106
113
  );
107
114
  }
108
115
  };
109
- var readMdxFile = async (path5) => {
110
- const { data } = import_gray_matter.default.read(path5);
116
+ var readMdxFile = async (path6) => {
117
+ const { data } = import_gray_matter.default.read(path6);
111
118
  const { markdown, ...frontmatter } = data;
112
119
  return { ...frontmatter, markdown };
113
120
  };
@@ -160,6 +167,7 @@ var import_node_fs2 = __toESM(require("fs"));
160
167
  var import_semver2 = require("semver");
161
168
  var import_proper_lockfile = require("proper-lockfile");
162
169
  var import_node_path2 = require("path");
170
+ var import_node_path3 = __toESM(require("path"));
163
171
  var versionResource = async (catalogDir, id) => {
164
172
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
165
173
  const matchedFiles = await searchFilesForId(files, id);
@@ -199,8 +207,8 @@ var writeResource = async (catalogDir, resource, options = {
199
207
  versionExistingContent: false,
200
208
  format: "mdx"
201
209
  }) => {
202
- const path5 = options.path || `/${resource.id}`;
203
- const fullPath = (0, import_path.join)(catalogDir, path5);
210
+ const path6 = options.path || `/${resource.id}`;
211
+ const fullPath = (0, import_path.join)(catalogDir, path6);
204
212
  const format = options.format || "mdx";
205
213
  import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
206
214
  const lockPath = (0, import_path.join)(fullPath, `index.${format}`);
@@ -266,6 +274,11 @@ var getResourcePath = async (catalogDir, id, version) => {
266
274
  directory: (0, import_path.dirname)(file.replace(catalogDir, ""))
267
275
  };
268
276
  };
277
+ var getResourceFolderName = async (catalogDir, id, version) => {
278
+ const paths = await getResourcePath(catalogDir, id, version);
279
+ if (!paths) return;
280
+ return paths?.directory.split(import_node_path3.default.sep).filter(Boolean).pop();
281
+ };
269
282
  var toResource = async (catalogDir, rawContents) => {
270
283
  const { data, content } = (0, import_gray_matter2.default)(rawContents);
271
284
  return {
@@ -327,16 +340,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
327
340
  );
328
341
  }
329
342
  };
330
- var waitForFileRemoval = async (path5, maxRetries = 50, delay = 10) => {
343
+ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
331
344
  for (let i = 0; i < maxRetries; i++) {
332
345
  try {
333
- await import_promises.default.access(path5);
346
+ await import_promises.default.access(path6);
334
347
  await new Promise((resolve2) => setTimeout(resolve2, delay));
335
348
  } catch (error) {
336
349
  return;
337
350
  }
338
351
  }
339
- throw new Error(`File/directory ${path5} was not removed after ${maxRetries} attempts`);
352
+ throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
340
353
  };
341
354
  var addFileToResource = async (catalogDir, id, file, version) => {
342
355
  const pathToResource = await findFileById(catalogDir, id, version);
@@ -380,11 +393,11 @@ var writeEventToService = (directory) => async (event, service, options = { path
380
393
  throw new Error("Service not found");
381
394
  }
382
395
  let pathForEvent = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/events` : `${resourcePath.directory}/events`;
383
- pathForEvent = (0, import_node_path3.join)(pathForEvent, event.id);
396
+ pathForEvent = (0, import_node_path4.join)(pathForEvent, event.id);
384
397
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
385
398
  };
386
- var rmEvent = (directory) => async (path5) => {
387
- await import_promises2.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
399
+ var rmEvent = (directory) => async (path6) => {
400
+ await import_promises2.default.rm((0, import_node_path4.join)(directory, path6), { recursive: true });
388
401
  };
389
402
  var rmEventById = (directory) => async (id, version, persistFiles) => {
390
403
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -401,7 +414,7 @@ var eventHasVersion = (directory) => async (id, version) => {
401
414
 
402
415
  // src/commands.ts
403
416
  var import_promises3 = __toESM(require("fs/promises"));
404
- var import_node_path4 = require("path");
417
+ var import_node_path5 = require("path");
405
418
  var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
406
419
  var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
407
420
  var writeCommand = (directory) => async (command, options = {
@@ -416,11 +429,11 @@ var writeCommandToService = (directory) => async (command, service, options = {
416
429
  throw new Error("Service not found");
417
430
  }
418
431
  let pathForCommand = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/commands` : `${resourcePath.directory}/commands`;
419
- pathForCommand = (0, import_node_path4.join)(pathForCommand, command.id);
432
+ pathForCommand = (0, import_node_path5.join)(pathForCommand, command.id);
420
433
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
421
434
  };
422
- var rmCommand = (directory) => async (path5) => {
423
- await import_promises3.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
435
+ var rmCommand = (directory) => async (path6) => {
436
+ await import_promises3.default.rm((0, import_node_path5.join)(directory, path6), { recursive: true });
424
437
  };
425
438
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
426
439
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -435,7 +448,7 @@ var commandHasVersion = (directory) => async (id, version) => {
435
448
 
436
449
  // src/queries.ts
437
450
  var import_promises4 = __toESM(require("fs/promises"));
438
- var import_node_path5 = require("path");
451
+ var import_node_path6 = require("path");
439
452
  var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
440
453
  var writeQuery = (directory) => async (query, options = {
441
454
  path: "",
@@ -450,11 +463,11 @@ var writeQueryToService = (directory) => async (query, service, options = { path
450
463
  throw new Error("Service not found");
451
464
  }
452
465
  let pathForQuery = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/queries` : `${resourcePath.directory}/queries`;
453
- pathForQuery = (0, import_node_path5.join)(pathForQuery, query.id);
466
+ pathForQuery = (0, import_node_path6.join)(pathForQuery, query.id);
454
467
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
455
468
  };
456
- var rmQuery = (directory) => async (path5) => {
457
- await import_promises4.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
469
+ var rmQuery = (directory) => async (path6) => {
470
+ await import_promises4.default.rm((0, import_node_path6.join)(directory, path6), { recursive: true });
458
471
  };
459
472
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
460
473
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -471,10 +484,10 @@ var queryHasVersion = (directory) => async (id, version) => {
471
484
 
472
485
  // src/services.ts
473
486
  var import_promises5 = __toESM(require("fs/promises"));
474
- var import_node_path6 = require("path");
487
+ var import_node_path7 = require("path");
475
488
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
476
- var getServiceByPath = (directory) => async (path5) => {
477
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
489
+ var getServiceByPath = (directory) => async (path6) => {
490
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
478
491
  return service;
479
492
  };
480
493
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -498,17 +511,17 @@ var writeService = (directory) => async (service, options = {
498
511
  };
499
512
  var writeVersionedService = (directory) => async (service) => {
500
513
  const resource = { ...service };
501
- const path5 = getVersionedDirectory(service.id, service.version);
502
- return await writeService(directory)(resource, { path: path5 });
514
+ const path6 = getVersionedDirectory(service.id, service.version);
515
+ return await writeService(directory)(resource, { path: path6 });
503
516
  };
504
517
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
505
518
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
506
- pathForService = (0, import_node_path6.join)(pathForService, service.id);
519
+ pathForService = (0, import_node_path7.join)(pathForService, service.id);
507
520
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
508
521
  };
509
522
  var versionService = (directory) => async (id) => versionResource(directory, id);
510
- var rmService = (directory) => async (path5) => {
511
- await import_promises5.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
523
+ var rmService = (directory) => async (path6) => {
524
+ await import_promises5.default.rm((0, import_node_path7.join)(directory, path6), { recursive: true });
512
525
  };
513
526
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
514
527
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -535,7 +548,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
535
548
  throw new Error(`Specification file name for ${fileName} is undefined`);
536
549
  }
537
550
  const rawFile = await getFileFromResource(directory, id, { fileName }, version);
538
- return { key, content: rawFile, fileName, path: (0, import_node_path6.join)((0, import_node_path6.dirname)(filePathToService), fileName) };
551
+ return { key, content: rawFile, fileName, path: (0, import_node_path7.join)((0, import_node_path7.dirname)(filePathToService), fileName) };
539
552
  });
540
553
  specs = await Promise.all(getSpecs);
541
554
  }
@@ -544,7 +557,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
544
557
  var addMessageToService = (directory) => async (id, direction, event, version) => {
545
558
  let service = await getService(directory)(id, version);
546
559
  const servicePath = await getResourcePath(directory, id, version);
547
- const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
560
+ const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
548
561
  if (direction === "sends") {
549
562
  if (service.sends === void 0) {
550
563
  service.sends = [];
@@ -572,8 +585,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
572
585
  if (!existingResource) {
573
586
  throw new Error(`Cannot find service ${id} in the catalog`);
574
587
  }
575
- const path5 = existingResource.split(/[\\/]+services/)[0];
576
- const pathToResource = (0, import_node_path6.join)(path5, "services");
588
+ const path6 = existingResource.split(/[\\/]+services/)[0];
589
+ const pathToResource = (0, import_node_path7.join)(path6, "services");
577
590
  await rmServiceById(directory)(id, version);
578
591
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
579
592
  };
@@ -581,9 +594,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
581
594
  const file = await findFileById(directory, id, version);
582
595
  return !!file;
583
596
  };
584
- var isService = (directory) => async (path5) => {
585
- const service = await getServiceByPath(directory)(path5);
586
- const relativePath = (0, import_node_path6.relative)(directory, path5);
597
+ var isService = (directory) => async (path6) => {
598
+ const service = await getServiceByPath(directory)(path6);
599
+ const relativePath = (0, import_node_path7.relative)(directory, path6);
587
600
  const segments = relativePath.split(/[/\\]+/);
588
601
  return !!service && segments.includes("services");
589
602
  };
@@ -591,7 +604,7 @@ var toService = (directory) => async (file) => toResource(directory, file);
591
604
  var addEntityToService = (directory) => async (id, entity, version) => {
592
605
  let service = await getService(directory)(id, version);
593
606
  const servicePath = await getResourcePath(directory, id, version);
594
- const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
607
+ const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
595
608
  if (service.entities === void 0) {
596
609
  service.entities = [];
597
610
  }
@@ -605,15 +618,15 @@ var addEntityToService = (directory) => async (id, entity, version) => {
605
618
  if (!existingResource) {
606
619
  throw new Error(`Cannot find service ${id} in the catalog`);
607
620
  }
608
- const path5 = existingResource.split(/[\\/]+services/)[0];
609
- const pathToResource = (0, import_node_path6.join)(path5, "services");
621
+ const path6 = existingResource.split(/[\\/]+services/)[0];
622
+ const pathToResource = (0, import_node_path7.join)(path6, "services");
610
623
  await rmServiceById(directory)(id, version);
611
624
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
612
625
  };
613
626
  var addDataStoreToService = (directory) => async (id, operation, dataStore, version) => {
614
627
  let service = await getService(directory)(id, version);
615
628
  const servicePath = await getResourcePath(directory, id, version);
616
- const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
629
+ const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
617
630
  if (operation === "writesTo") {
618
631
  if (service.writesTo === void 0) {
619
632
  service.writesTo = [];
@@ -641,15 +654,15 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
641
654
  if (!existingResource) {
642
655
  throw new Error(`Cannot find service ${id} in the catalog`);
643
656
  }
644
- const path5 = existingResource.split(/[\\/]+services/)[0];
645
- const pathToResource = (0, import_node_path6.join)(path5, "services");
657
+ const path6 = existingResource.split(/[\\/]+services/)[0];
658
+ const pathToResource = (0, import_node_path7.join)(path6, "services");
646
659
  await rmServiceById(directory)(id, version);
647
660
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
648
661
  };
649
662
 
650
663
  // src/domains.ts
651
664
  var import_promises6 = __toESM(require("fs/promises"));
652
- var import_node_path7 = __toESM(require("path"));
665
+ var import_node_path8 = __toESM(require("path"));
653
666
  var import_node_fs3 = __toESM(require("fs"));
654
667
  var import_gray_matter3 = __toESM(require("gray-matter"));
655
668
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -674,8 +687,8 @@ var writeDomain = (directory) => async (domain, options = {
674
687
  return await writeResource(directory, resource, { ...options, type: "domain" });
675
688
  };
676
689
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
677
- var rmDomain = (directory) => async (path5) => {
678
- await import_promises6.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
690
+ var rmDomain = (directory) => async (path6) => {
691
+ await import_promises6.default.rm((0, import_node_path8.join)(directory, path6), { recursive: true });
679
692
  };
680
693
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
681
694
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -687,7 +700,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
687
700
  };
688
701
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
689
702
  const pathToDomain = await findFileById(directory, id, version) || "";
690
- const pathToUbiquitousLanguage = import_node_path7.default.join(import_node_path7.default.dirname(pathToDomain), "ubiquitous-language.mdx");
703
+ const pathToUbiquitousLanguage = import_node_path8.default.join(import_node_path8.default.dirname(pathToDomain), "ubiquitous-language.mdx");
691
704
  const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
692
705
  if (!fileExists) {
693
706
  return void 0;
@@ -702,7 +715,7 @@ var domainHasVersion = (directory) => async (id, version) => {
702
715
  var addServiceToDomain = (directory) => async (id, service, version) => {
703
716
  let domain = await getDomain(directory)(id, version);
704
717
  const domainPath = await getResourcePath(directory, id, version);
705
- const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
718
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
706
719
  if (domain.services === void 0) {
707
720
  domain.services = [];
708
721
  }
@@ -717,7 +730,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
717
730
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
718
731
  let domain = await getDomain(directory)(id, version);
719
732
  const domainPath = await getResourcePath(directory, id, version);
720
- const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
733
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
721
734
  if (domain.domains === void 0) {
722
735
  domain.domains = [];
723
736
  }
@@ -732,7 +745,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
732
745
  var addEntityToDomain = (directory) => async (id, entity, version) => {
733
746
  let domain = await getDomain(directory)(id, version);
734
747
  const domainPath = await getResourcePath(directory, id, version);
735
- const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
748
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
736
749
  if (domain.entities === void 0) {
737
750
  domain.entities = [];
738
751
  }
@@ -747,12 +760,12 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
747
760
 
748
761
  // src/channels.ts
749
762
  var import_promises7 = __toESM(require("fs/promises"));
750
- var import_node_path8 = require("path");
763
+ var import_node_path9 = require("path");
751
764
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
752
765
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
753
766
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
754
- var rmChannel = (directory) => async (path5) => {
755
- await import_promises7.default.rm((0, import_node_path8.join)(directory, path5), { recursive: true });
767
+ var rmChannel = (directory) => async (path6) => {
768
+ await import_promises7.default.rm((0, import_node_path9.join)(directory, path6), { recursive: true });
756
769
  };
757
770
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
758
771
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -782,7 +795,7 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
782
795
  const { getMessage, rmMessageById, writeMessage } = functions[collection];
783
796
  const message = await getMessage(directory)(_message.id, _message.version);
784
797
  const messagePath = await getResourcePath(directory, _message.id, _message.version);
785
- const extension = (0, import_node_path8.extname)(messagePath?.fullPath || "");
798
+ const extension = (0, import_node_path9.extname)(messagePath?.fullPath || "");
786
799
  if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
787
800
  if (message.channels === void 0) {
788
801
  message.channels = [];
@@ -793,18 +806,18 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
793
806
  if (!existingResource) {
794
807
  throw new Error(`Cannot find message ${id} in the catalog`);
795
808
  }
796
- const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
797
- const pathToResource = (0, import_node_path8.join)(path5, collection);
809
+ const path6 = existingResource.split(`/[\\/]+${collection}`)[0];
810
+ const pathToResource = (0, import_node_path9.join)(path6, collection);
798
811
  await rmMessageById(directory)(_message.id, _message.version, true);
799
812
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
800
813
  };
801
814
 
802
815
  // src/messages.ts
803
- var import_node_path9 = require("path");
816
+ var import_node_path10 = require("path");
804
817
  var import_gray_matter4 = __toESM(require("gray-matter"));
805
818
  var import_semver3 = require("semver");
806
- var getMessageBySchemaPath = (directory) => async (path5, options) => {
807
- const pathToMessage = (0, import_node_path9.dirname)(path5);
819
+ var getMessageBySchemaPath = (directory) => async (path6, options) => {
820
+ const pathToMessage = (0, import_node_path10.dirname)(path6);
808
821
  try {
809
822
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
810
823
  if (!files || files.length === 0) {
@@ -876,18 +889,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
876
889
  }
877
890
  return { producers, consumers };
878
891
  };
879
- var getConsumersOfSchema = (directory) => async (path5) => {
892
+ var getConsumersOfSchema = (directory) => async (path6) => {
880
893
  try {
881
- const message = await getMessageBySchemaPath(directory)(path5);
894
+ const message = await getMessageBySchemaPath(directory)(path6);
882
895
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
883
896
  return consumers;
884
897
  } catch (error) {
885
898
  return [];
886
899
  }
887
900
  };
888
- var getProducersOfSchema = (directory) => async (path5) => {
901
+ var getProducersOfSchema = (directory) => async (path6) => {
889
902
  try {
890
- const message = await getMessageBySchemaPath(directory)(path5);
903
+ const message = await getMessageBySchemaPath(directory)(path6);
891
904
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
892
905
  return producers;
893
906
  } catch (error) {
@@ -896,13 +909,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
896
909
  };
897
910
 
898
911
  // src/custom-docs.ts
899
- var import_node_path10 = __toESM(require("path"));
912
+ var import_node_path11 = __toESM(require("path"));
900
913
  var import_node_fs4 = __toESM(require("fs"));
901
914
  var import_promises8 = __toESM(require("fs/promises"));
902
915
  var import_gray_matter5 = __toESM(require("gray-matter"));
903
916
  var import_slugify = __toESM(require("slugify"));
904
917
  var getCustomDoc = (directory) => async (filePath) => {
905
- const fullPath = import_node_path10.default.join(directory, filePath);
918
+ const fullPath = import_node_path11.default.join(directory, filePath);
906
919
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
907
920
  const fileExists = import_node_fs4.default.existsSync(fullPathWithExtension);
908
921
  if (!fileExists) {
@@ -921,26 +934,26 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
921
934
  const { fileName, ...rest } = customDoc;
922
935
  const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
923
936
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
924
- const fullPath = import_node_path10.default.join(directory, options.path || "", withExtension);
925
- import_node_fs4.default.mkdirSync(import_node_path10.default.dirname(fullPath), { recursive: true });
937
+ const fullPath = import_node_path11.default.join(directory, options.path || "", withExtension);
938
+ import_node_fs4.default.mkdirSync(import_node_path11.default.dirname(fullPath), { recursive: true });
926
939
  const document = import_gray_matter5.default.stringify(customDoc.markdown.trim(), rest);
927
940
  import_node_fs4.default.writeFileSync(fullPath, document);
928
941
  };
929
942
  var rmCustomDoc = (directory) => async (filePath) => {
930
943
  const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
931
- await import_promises8.default.rm((0, import_node_path10.join)(directory, withExtension), { recursive: true });
944
+ await import_promises8.default.rm((0, import_node_path11.join)(directory, withExtension), { recursive: true });
932
945
  };
933
946
 
934
947
  // src/teams.ts
935
948
  var import_promises9 = __toESM(require("fs/promises"));
936
949
  var import_node_fs6 = __toESM(require("fs"));
937
- var import_node_path12 = require("path");
950
+ var import_node_path13 = require("path");
938
951
  var import_gray_matter7 = __toESM(require("gray-matter"));
939
- var import_node_path13 = __toESM(require("path"));
952
+ var import_node_path14 = __toESM(require("path"));
940
953
 
941
954
  // src/users.ts
942
955
  var import_node_fs5 = __toESM(require("fs"));
943
- var import_node_path11 = require("path");
956
+ var import_node_path12 = require("path");
944
957
  var import_gray_matter6 = __toESM(require("gray-matter"));
945
958
  var getUser = (catalogDir) => async (id) => {
946
959
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
@@ -978,11 +991,11 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
978
991
  }
979
992
  const { markdown, ...frontmatter } = resource;
980
993
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
981
- import_node_fs5.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
982
- import_node_fs5.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
994
+ import_node_fs5.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
995
+ import_node_fs5.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
983
996
  };
984
997
  var rmUserById = (catalogDir) => async (id) => {
985
- import_node_fs5.default.rmSync((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
998
+ import_node_fs5.default.rmSync((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
986
999
  };
987
1000
 
988
1001
  // src/teams.ts
@@ -1020,11 +1033,11 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
1020
1033
  }
1021
1034
  const { markdown, ...frontmatter } = resource;
1022
1035
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
1023
- import_node_fs6.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
1024
- import_node_fs6.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
1036
+ import_node_fs6.default.mkdirSync((0, import_node_path13.join)(catalogDir, ""), { recursive: true });
1037
+ import_node_fs6.default.writeFileSync((0, import_node_path13.join)(catalogDir, "", `${resource.id}.mdx`), document);
1025
1038
  };
1026
1039
  var rmTeamById = (catalogDir) => async (id) => {
1027
- await import_promises9.default.rm((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
1040
+ await import_promises9.default.rm((0, import_node_path13.join)(catalogDir, `${id}.mdx`), { recursive: true });
1028
1041
  };
1029
1042
  var getOwnersForResource = (catalogDir) => async (id, version) => {
1030
1043
  const resource = await getResource(catalogDir, id, version);
@@ -1032,11 +1045,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
1032
1045
  if (!resource) return [];
1033
1046
  if (!resource.owners) return [];
1034
1047
  for (const owner of resource.owners) {
1035
- const team = await getTeam(import_node_path13.default.join(catalogDir, "teams"))(owner);
1048
+ const team = await getTeam(import_node_path14.default.join(catalogDir, "teams"))(owner);
1036
1049
  if (team) {
1037
1050
  owners.push(team);
1038
1051
  } else {
1039
- const user = await getUser(import_node_path13.default.join(catalogDir, "users"))(owner);
1052
+ const user = await getUser(import_node_path14.default.join(catalogDir, "users"))(owner);
1040
1053
  if (user) {
1041
1054
  owners.push(user);
1042
1055
  }
@@ -1047,7 +1060,7 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
1047
1060
 
1048
1061
  // src/entities.ts
1049
1062
  var import_promises10 = __toESM(require("fs/promises"));
1050
- var import_node_path14 = require("path");
1063
+ var import_node_path15 = require("path");
1051
1064
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
1052
1065
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
1053
1066
  var writeEntity = (directory) => async (entity, options = {
@@ -1055,8 +1068,8 @@ var writeEntity = (directory) => async (entity, options = {
1055
1068
  override: false,
1056
1069
  format: "mdx"
1057
1070
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1058
- var rmEntity = (directory) => async (path5) => {
1059
- await import_promises10.default.rm((0, import_node_path14.join)(directory, path5), { recursive: true });
1071
+ var rmEntity = (directory) => async (path6) => {
1072
+ await import_promises10.default.rm((0, import_node_path15.join)(directory, path6), { recursive: true });
1060
1073
  };
1061
1074
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1062
1075
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1069,7 +1082,7 @@ var entityHasVersion = (directory) => async (id, version) => {
1069
1082
 
1070
1083
  // src/containers.ts
1071
1084
  var import_promises11 = __toESM(require("fs/promises"));
1072
- var import_node_path15 = require("path");
1085
+ var import_node_path16 = require("path");
1073
1086
  var getContainer = (directory) => async (id, version) => getResource(directory, id, version, { type: "container" });
1074
1087
  var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
1075
1088
  var writeContainer = (directory) => async (data, options = {
@@ -1078,8 +1091,8 @@ var writeContainer = (directory) => async (data, options = {
1078
1091
  format: "mdx"
1079
1092
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1080
1093
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
1081
- var rmContainer = (directory) => async (path5) => {
1082
- await import_promises11.default.rm((0, import_node_path15.join)(directory, path5), { recursive: true });
1094
+ var rmContainer = (directory) => async (path6) => {
1095
+ await import_promises11.default.rm((0, import_node_path16.join)(directory, path6), { recursive: true });
1083
1096
  };
1084
1097
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
1085
1098
  await rmResourceById(directory, id, version, { type: "container", persistFiles });
@@ -1095,7 +1108,7 @@ var writeContainerToService = (directory) => async (container, service, options
1095
1108
  throw new Error("Service not found");
1096
1109
  }
1097
1110
  let pathForContainer = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/containers` : `${resourcePath.directory}/containers`;
1098
- pathForContainer = (0, import_node_path15.join)(pathForContainer, container.id);
1111
+ pathForContainer = (0, import_node_path16.join)(pathForContainer, container.id);
1099
1112
  await writeResource(directory, { ...container }, { ...options, path: pathForContainer, type: "container" });
1100
1113
  };
1101
1114
 
@@ -1111,7 +1124,7 @@ var addFileToDataStore = addFileToContainer;
1111
1124
  var writeDataStoreToService = writeContainerToService;
1112
1125
 
1113
1126
  // src/index.ts
1114
- var index_default = (path5) => {
1127
+ var index_default = (path6) => {
1115
1128
  return {
1116
1129
  /**
1117
1130
  * Returns an events from EventCatalog
@@ -1119,13 +1132,13 @@ var index_default = (path5) => {
1119
1132
  * @param version - Optional id of the version to get (supports semver)
1120
1133
  * @returns Event|Undefined
1121
1134
  */
1122
- getEvent: getEvent((0, import_node_path16.join)(path5)),
1135
+ getEvent: getEvent((0, import_node_path17.join)(path6)),
1123
1136
  /**
1124
1137
  * Returns all events from EventCatalog
1125
1138
  * @param latestOnly - optional boolean, set to true to get only latest versions
1126
1139
  * @returns Event[]|Undefined
1127
1140
  */
1128
- getEvents: getEvents((0, import_node_path16.join)(path5)),
1141
+ getEvents: getEvents((0, import_node_path17.join)(path6)),
1129
1142
  /**
1130
1143
  * Adds an event to EventCatalog
1131
1144
  *
@@ -1133,7 +1146,7 @@ var index_default = (path5) => {
1133
1146
  * @param options - Optional options to write the event
1134
1147
  *
1135
1148
  */
1136
- writeEvent: writeEvent((0, import_node_path16.join)(path5, "events")),
1149
+ writeEvent: writeEvent((0, import_node_path17.join)(path6, "events")),
1137
1150
  /**
1138
1151
  * Adds an event to a service in EventCatalog
1139
1152
  *
@@ -1142,26 +1155,26 @@ var index_default = (path5) => {
1142
1155
  * @param options - Optional options to write the event
1143
1156
  *
1144
1157
  */
1145
- writeEventToService: writeEventToService((0, import_node_path16.join)(path5)),
1158
+ writeEventToService: writeEventToService((0, import_node_path17.join)(path6)),
1146
1159
  /**
1147
1160
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1148
1161
  *
1149
1162
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1150
1163
  *
1151
1164
  */
1152
- rmEvent: rmEvent((0, import_node_path16.join)(path5, "events")),
1165
+ rmEvent: rmEvent((0, import_node_path17.join)(path6, "events")),
1153
1166
  /**
1154
1167
  * Remove an event by an Event id
1155
1168
  *
1156
1169
  * @param id - The id of the event you want to remove
1157
1170
  *
1158
1171
  */
1159
- rmEventById: rmEventById((0, import_node_path16.join)(path5)),
1172
+ rmEventById: rmEventById((0, import_node_path17.join)(path6)),
1160
1173
  /**
1161
1174
  * Moves a given event id to the version directory
1162
1175
  * @param directory
1163
1176
  */
1164
- versionEvent: versionEvent((0, import_node_path16.join)(path5)),
1177
+ versionEvent: versionEvent((0, import_node_path17.join)(path6)),
1165
1178
  /**
1166
1179
  * Adds a file to the given event
1167
1180
  * @param id - The id of the event to add the file to
@@ -1169,7 +1182,7 @@ var index_default = (path5) => {
1169
1182
  * @param version - Optional version of the event to add the file to
1170
1183
  * @returns
1171
1184
  */
1172
- addFileToEvent: addFileToEvent((0, import_node_path16.join)(path5)),
1185
+ addFileToEvent: addFileToEvent((0, import_node_path17.join)(path6)),
1173
1186
  /**
1174
1187
  * Adds a schema to the given event
1175
1188
  * @param id - The id of the event to add the schema to
@@ -1177,14 +1190,14 @@ var index_default = (path5) => {
1177
1190
  * @param version - Optional version of the event to add the schema to
1178
1191
  * @returns
1179
1192
  */
1180
- addSchemaToEvent: addSchemaToEvent((0, import_node_path16.join)(path5)),
1193
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path17.join)(path6)),
1181
1194
  /**
1182
1195
  * Check to see if an event version exists
1183
1196
  * @param id - The id of the event
1184
1197
  * @param version - The version of the event (supports semver)
1185
1198
  * @returns
1186
1199
  */
1187
- eventHasVersion: eventHasVersion((0, import_node_path16.join)(path5)),
1200
+ eventHasVersion: eventHasVersion((0, import_node_path17.join)(path6)),
1188
1201
  /**
1189
1202
  * ================================
1190
1203
  * Commands
@@ -1196,13 +1209,13 @@ var index_default = (path5) => {
1196
1209
  * @param version - Optional id of the version to get (supports semver)
1197
1210
  * @returns Command|Undefined
1198
1211
  */
1199
- getCommand: getCommand((0, import_node_path16.join)(path5)),
1212
+ getCommand: getCommand((0, import_node_path17.join)(path6)),
1200
1213
  /**
1201
1214
  * Returns all commands from EventCatalog
1202
1215
  * @param latestOnly - optional boolean, set to true to get only latest versions
1203
1216
  * @returns Command[]|Undefined
1204
1217
  */
1205
- getCommands: getCommands((0, import_node_path16.join)(path5)),
1218
+ getCommands: getCommands((0, import_node_path17.join)(path6)),
1206
1219
  /**
1207
1220
  * Adds an command to EventCatalog
1208
1221
  *
@@ -1210,7 +1223,7 @@ var index_default = (path5) => {
1210
1223
  * @param options - Optional options to write the command
1211
1224
  *
1212
1225
  */
1213
- writeCommand: writeCommand((0, import_node_path16.join)(path5, "commands")),
1226
+ writeCommand: writeCommand((0, import_node_path17.join)(path6, "commands")),
1214
1227
  /**
1215
1228
  * Adds a command to a service in EventCatalog
1216
1229
  *
@@ -1219,26 +1232,26 @@ var index_default = (path5) => {
1219
1232
  * @param options - Optional options to write the command
1220
1233
  *
1221
1234
  */
1222
- writeCommandToService: writeCommandToService((0, import_node_path16.join)(path5)),
1235
+ writeCommandToService: writeCommandToService((0, import_node_path17.join)(path6)),
1223
1236
  /**
1224
1237
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1225
1238
  *
1226
1239
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1227
1240
  *
1228
1241
  */
1229
- rmCommand: rmCommand((0, import_node_path16.join)(path5, "commands")),
1242
+ rmCommand: rmCommand((0, import_node_path17.join)(path6, "commands")),
1230
1243
  /**
1231
1244
  * Remove an command by an Event id
1232
1245
  *
1233
1246
  * @param id - The id of the command you want to remove
1234
1247
  *
1235
1248
  */
1236
- rmCommandById: rmCommandById((0, import_node_path16.join)(path5)),
1249
+ rmCommandById: rmCommandById((0, import_node_path17.join)(path6)),
1237
1250
  /**
1238
1251
  * Moves a given command id to the version directory
1239
1252
  * @param directory
1240
1253
  */
1241
- versionCommand: versionCommand((0, import_node_path16.join)(path5)),
1254
+ versionCommand: versionCommand((0, import_node_path17.join)(path6)),
1242
1255
  /**
1243
1256
  * Adds a file to the given command
1244
1257
  * @param id - The id of the command to add the file to
@@ -1246,7 +1259,7 @@ var index_default = (path5) => {
1246
1259
  * @param version - Optional version of the command to add the file to
1247
1260
  * @returns
1248
1261
  */
1249
- addFileToCommand: addFileToCommand((0, import_node_path16.join)(path5)),
1262
+ addFileToCommand: addFileToCommand((0, import_node_path17.join)(path6)),
1250
1263
  /**
1251
1264
  * Adds a schema to the given command
1252
1265
  * @param id - The id of the command to add the schema to
@@ -1254,14 +1267,14 @@ var index_default = (path5) => {
1254
1267
  * @param version - Optional version of the command to add the schema to
1255
1268
  * @returns
1256
1269
  */
1257
- addSchemaToCommand: addSchemaToCommand((0, import_node_path16.join)(path5)),
1270
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path17.join)(path6)),
1258
1271
  /**
1259
1272
  * Check to see if a command version exists
1260
1273
  * @param id - The id of the command
1261
1274
  * @param version - The version of the command (supports semver)
1262
1275
  * @returns
1263
1276
  */
1264
- commandHasVersion: commandHasVersion((0, import_node_path16.join)(path5)),
1277
+ commandHasVersion: commandHasVersion((0, import_node_path17.join)(path6)),
1265
1278
  /**
1266
1279
  * ================================
1267
1280
  * Queries
@@ -1273,13 +1286,13 @@ var index_default = (path5) => {
1273
1286
  * @param version - Optional id of the version to get (supports semver)
1274
1287
  * @returns Query|Undefined
1275
1288
  */
1276
- getQuery: getQuery((0, import_node_path16.join)(path5)),
1289
+ getQuery: getQuery((0, import_node_path17.join)(path6)),
1277
1290
  /**
1278
1291
  * Returns all queries from EventCatalog
1279
1292
  * @param latestOnly - optional boolean, set to true to get only latest versions
1280
1293
  * @returns Query[]|Undefined
1281
1294
  */
1282
- getQueries: getQueries((0, import_node_path16.join)(path5)),
1295
+ getQueries: getQueries((0, import_node_path17.join)(path6)),
1283
1296
  /**
1284
1297
  * Adds a query to EventCatalog
1285
1298
  *
@@ -1287,7 +1300,7 @@ var index_default = (path5) => {
1287
1300
  * @param options - Optional options to write the event
1288
1301
  *
1289
1302
  */
1290
- writeQuery: writeQuery((0, import_node_path16.join)(path5, "queries")),
1303
+ writeQuery: writeQuery((0, import_node_path17.join)(path6, "queries")),
1291
1304
  /**
1292
1305
  * Adds a query to a service in EventCatalog
1293
1306
  *
@@ -1296,26 +1309,26 @@ var index_default = (path5) => {
1296
1309
  * @param options - Optional options to write the query
1297
1310
  *
1298
1311
  */
1299
- writeQueryToService: writeQueryToService((0, import_node_path16.join)(path5)),
1312
+ writeQueryToService: writeQueryToService((0, import_node_path17.join)(path6)),
1300
1313
  /**
1301
1314
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1302
1315
  *
1303
1316
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1304
1317
  *
1305
1318
  */
1306
- rmQuery: rmQuery((0, import_node_path16.join)(path5, "queries")),
1319
+ rmQuery: rmQuery((0, import_node_path17.join)(path6, "queries")),
1307
1320
  /**
1308
1321
  * Remove a query by a Query id
1309
1322
  *
1310
1323
  * @param id - The id of the query you want to remove
1311
1324
  *
1312
1325
  */
1313
- rmQueryById: rmQueryById((0, import_node_path16.join)(path5)),
1326
+ rmQueryById: rmQueryById((0, import_node_path17.join)(path6)),
1314
1327
  /**
1315
1328
  * Moves a given query id to the version directory
1316
1329
  * @param directory
1317
1330
  */
1318
- versionQuery: versionQuery((0, import_node_path16.join)(path5)),
1331
+ versionQuery: versionQuery((0, import_node_path17.join)(path6)),
1319
1332
  /**
1320
1333
  * Adds a file to the given query
1321
1334
  * @param id - The id of the query to add the file to
@@ -1323,7 +1336,7 @@ var index_default = (path5) => {
1323
1336
  * @param version - Optional version of the query to add the file to
1324
1337
  * @returns
1325
1338
  */
1326
- addFileToQuery: addFileToQuery((0, import_node_path16.join)(path5)),
1339
+ addFileToQuery: addFileToQuery((0, import_node_path17.join)(path6)),
1327
1340
  /**
1328
1341
  * Adds a schema to the given query
1329
1342
  * @param id - The id of the query to add the schema to
@@ -1331,14 +1344,14 @@ var index_default = (path5) => {
1331
1344
  * @param version - Optional version of the query to add the schema to
1332
1345
  * @returns
1333
1346
  */
1334
- addSchemaToQuery: addSchemaToQuery((0, import_node_path16.join)(path5)),
1347
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path17.join)(path6)),
1335
1348
  /**
1336
1349
  * Check to see if an query version exists
1337
1350
  * @param id - The id of the query
1338
1351
  * @param version - The version of the query (supports semver)
1339
1352
  * @returns
1340
1353
  */
1341
- queryHasVersion: queryHasVersion((0, import_node_path16.join)(path5)),
1354
+ queryHasVersion: queryHasVersion((0, import_node_path17.join)(path6)),
1342
1355
  /**
1343
1356
  * ================================
1344
1357
  * Channels
@@ -1350,13 +1363,13 @@ var index_default = (path5) => {
1350
1363
  * @param version - Optional id of the version to get (supports semver)
1351
1364
  * @returns Channel|Undefined
1352
1365
  */
1353
- getChannel: getChannel((0, import_node_path16.join)(path5)),
1366
+ getChannel: getChannel((0, import_node_path17.join)(path6)),
1354
1367
  /**
1355
1368
  * Returns all channels from EventCatalog
1356
1369
  * @param latestOnly - optional boolean, set to true to get only latest versions
1357
1370
  * @returns Channel[]|Undefined
1358
1371
  */
1359
- getChannels: getChannels((0, import_node_path16.join)(path5)),
1372
+ getChannels: getChannels((0, import_node_path17.join)(path6)),
1360
1373
  /**
1361
1374
  * Adds an channel to EventCatalog
1362
1375
  *
@@ -1364,33 +1377,33 @@ var index_default = (path5) => {
1364
1377
  * @param options - Optional options to write the channel
1365
1378
  *
1366
1379
  */
1367
- writeChannel: writeChannel((0, import_node_path16.join)(path5, "channels")),
1380
+ writeChannel: writeChannel((0, import_node_path17.join)(path6, "channels")),
1368
1381
  /**
1369
1382
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1370
1383
  *
1371
1384
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1372
1385
  *
1373
1386
  */
1374
- rmChannel: rmChannel((0, import_node_path16.join)(path5, "channels")),
1387
+ rmChannel: rmChannel((0, import_node_path17.join)(path6, "channels")),
1375
1388
  /**
1376
1389
  * Remove an channel by an Event id
1377
1390
  *
1378
1391
  * @param id - The id of the channel you want to remove
1379
1392
  *
1380
1393
  */
1381
- rmChannelById: rmChannelById((0, import_node_path16.join)(path5)),
1394
+ rmChannelById: rmChannelById((0, import_node_path17.join)(path6)),
1382
1395
  /**
1383
1396
  * Moves a given channel id to the version directory
1384
1397
  * @param directory
1385
1398
  */
1386
- versionChannel: versionChannel((0, import_node_path16.join)(path5)),
1399
+ versionChannel: versionChannel((0, import_node_path17.join)(path6)),
1387
1400
  /**
1388
1401
  * Check to see if a channel version exists
1389
1402
  * @param id - The id of the channel
1390
1403
  * @param version - The version of the channel (supports semver)
1391
1404
  * @returns
1392
1405
  */
1393
- channelHasVersion: channelHasVersion((0, import_node_path16.join)(path5)),
1406
+ channelHasVersion: channelHasVersion((0, import_node_path17.join)(path6)),
1394
1407
  /**
1395
1408
  * Add a channel to an event
1396
1409
  *
@@ -1407,7 +1420,7 @@ var index_default = (path5) => {
1407
1420
  *
1408
1421
  * ```
1409
1422
  */
1410
- addEventToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "events"),
1423
+ addEventToChannel: addMessageToChannel((0, import_node_path17.join)(path6), "events"),
1411
1424
  /**
1412
1425
  * Add a channel to an command
1413
1426
  *
@@ -1424,7 +1437,7 @@ var index_default = (path5) => {
1424
1437
  *
1425
1438
  * ```
1426
1439
  */
1427
- addCommandToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "commands"),
1440
+ addCommandToChannel: addMessageToChannel((0, import_node_path17.join)(path6), "commands"),
1428
1441
  /**
1429
1442
  * Add a channel to an query
1430
1443
  *
@@ -1441,7 +1454,7 @@ var index_default = (path5) => {
1441
1454
  *
1442
1455
  * ```
1443
1456
  */
1444
- addQueryToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "queries"),
1457
+ addQueryToChannel: addMessageToChannel((0, import_node_path17.join)(path6), "queries"),
1445
1458
  /**
1446
1459
  * ================================
1447
1460
  * SERVICES
@@ -1454,14 +1467,14 @@ var index_default = (path5) => {
1454
1467
  * @param options - Optional options to write the event
1455
1468
  *
1456
1469
  */
1457
- writeService: writeService((0, import_node_path16.join)(path5, "services")),
1470
+ writeService: writeService((0, import_node_path17.join)(path6, "services")),
1458
1471
  /**
1459
1472
  * Adds a versioned service to EventCatalog
1460
1473
  *
1461
1474
  * @param service - The service to write
1462
1475
  *
1463
1476
  */
1464
- writeVersionedService: writeVersionedService((0, import_node_path16.join)(path5, "services")),
1477
+ writeVersionedService: writeVersionedService((0, import_node_path17.join)(path6, "services")),
1465
1478
  /**
1466
1479
  * Adds a service to a domain in EventCatalog
1467
1480
  *
@@ -1470,45 +1483,45 @@ var index_default = (path5) => {
1470
1483
  * @param options - Optional options to write the event
1471
1484
  *
1472
1485
  */
1473
- writeServiceToDomain: writeServiceToDomain((0, import_node_path16.join)(path5, "domains")),
1486
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path17.join)(path6, "domains")),
1474
1487
  /**
1475
1488
  * Returns a service from EventCatalog
1476
1489
  * @param id - The id of the service to retrieve
1477
1490
  * @param version - Optional id of the version to get (supports semver)
1478
1491
  * @returns Service|Undefined
1479
1492
  */
1480
- getService: getService((0, import_node_path16.join)(path5)),
1493
+ getService: getService((0, import_node_path17.join)(path6)),
1481
1494
  /**
1482
1495
  * Returns a service from EventCatalog by it's path.
1483
1496
  * @param path - The path to the service to retrieve
1484
1497
  * @returns Service|Undefined
1485
1498
  */
1486
- getServiceByPath: getServiceByPath((0, import_node_path16.join)(path5)),
1499
+ getServiceByPath: getServiceByPath((0, import_node_path17.join)(path6)),
1487
1500
  /**
1488
1501
  * Returns all services from EventCatalog
1489
1502
  * @param latestOnly - optional boolean, set to true to get only latest versions
1490
1503
  * @returns Service[]|Undefined
1491
1504
  */
1492
- getServices: getServices((0, import_node_path16.join)(path5)),
1505
+ getServices: getServices((0, import_node_path17.join)(path6)),
1493
1506
  /**
1494
1507
  * Moves a given service id to the version directory
1495
1508
  * @param directory
1496
1509
  */
1497
- versionService: versionService((0, import_node_path16.join)(path5)),
1510
+ versionService: versionService((0, import_node_path17.join)(path6)),
1498
1511
  /**
1499
1512
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1500
1513
  *
1501
1514
  * @param path - The path to your service, e.g. `/InventoryService`
1502
1515
  *
1503
1516
  */
1504
- rmService: rmService((0, import_node_path16.join)(path5, "services")),
1517
+ rmService: rmService((0, import_node_path17.join)(path6, "services")),
1505
1518
  /**
1506
1519
  * Remove an service by an service id
1507
1520
  *
1508
1521
  * @param id - The id of the service you want to remove
1509
1522
  *
1510
1523
  */
1511
- rmServiceById: rmServiceById((0, import_node_path16.join)(path5)),
1524
+ rmServiceById: rmServiceById((0, import_node_path17.join)(path6)),
1512
1525
  /**
1513
1526
  * Adds a file to the given service
1514
1527
  * @param id - The id of the service to add the file to
@@ -1516,21 +1529,21 @@ var index_default = (path5) => {
1516
1529
  * @param version - Optional version of the service to add the file to
1517
1530
  * @returns
1518
1531
  */
1519
- addFileToService: addFileToService((0, import_node_path16.join)(path5)),
1532
+ addFileToService: addFileToService((0, import_node_path17.join)(path6)),
1520
1533
  /**
1521
1534
  * Returns the specifications for a given service
1522
1535
  * @param id - The id of the service to retrieve the specifications for
1523
1536
  * @param version - Optional version of the service
1524
1537
  * @returns
1525
1538
  */
1526
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path16.join)(path5)),
1539
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path17.join)(path6)),
1527
1540
  /**
1528
1541
  * Check to see if a service version exists
1529
1542
  * @param id - The id of the service
1530
1543
  * @param version - The version of the service (supports semver)
1531
1544
  * @returns
1532
1545
  */
1533
- serviceHasVersion: serviceHasVersion((0, import_node_path16.join)(path5)),
1546
+ serviceHasVersion: serviceHasVersion((0, import_node_path17.join)(path6)),
1534
1547
  /**
1535
1548
  * Add an event to a service by it's id.
1536
1549
  *
@@ -1550,7 +1563,7 @@ var index_default = (path5) => {
1550
1563
  *
1551
1564
  * ```
1552
1565
  */
1553
- addEventToService: addMessageToService((0, import_node_path16.join)(path5)),
1566
+ addEventToService: addMessageToService((0, import_node_path17.join)(path6)),
1554
1567
  /**
1555
1568
  * Add a data store to a service by it's id.
1556
1569
  *
@@ -1567,7 +1580,7 @@ var index_default = (path5) => {
1567
1580
  *
1568
1581
  * ```
1569
1582
  */
1570
- addDataStoreToService: addDataStoreToService((0, import_node_path16.join)(path5)),
1583
+ addDataStoreToService: addDataStoreToService((0, import_node_path17.join)(path6)),
1571
1584
  /**
1572
1585
  * Add a command to a service by it's id.
1573
1586
  *
@@ -1587,7 +1600,7 @@ var index_default = (path5) => {
1587
1600
  *
1588
1601
  * ```
1589
1602
  */
1590
- addCommandToService: addMessageToService((0, import_node_path16.join)(path5)),
1603
+ addCommandToService: addMessageToService((0, import_node_path17.join)(path6)),
1591
1604
  /**
1592
1605
  * Add a query to a service by it's id.
1593
1606
  *
@@ -1607,7 +1620,7 @@ var index_default = (path5) => {
1607
1620
  *
1608
1621
  * ```
1609
1622
  */
1610
- addQueryToService: addMessageToService((0, import_node_path16.join)(path5)),
1623
+ addQueryToService: addMessageToService((0, import_node_path17.join)(path6)),
1611
1624
  /**
1612
1625
  * Add an entity to a service by its id.
1613
1626
  *
@@ -1625,7 +1638,7 @@ var index_default = (path5) => {
1625
1638
  *
1626
1639
  * ```
1627
1640
  */
1628
- addEntityToService: addEntityToService((0, import_node_path16.join)(path5)),
1641
+ addEntityToService: addEntityToService((0, import_node_path17.join)(path6)),
1629
1642
  /**
1630
1643
  * Check to see if a service exists by it's path.
1631
1644
  *
@@ -1642,13 +1655,13 @@ var index_default = (path5) => {
1642
1655
  * @param path - The path to the service to check
1643
1656
  * @returns boolean
1644
1657
  */
1645
- isService: isService((0, import_node_path16.join)(path5)),
1658
+ isService: isService((0, import_node_path17.join)(path6)),
1646
1659
  /**
1647
1660
  * Converts a file to a service.
1648
1661
  * @param file - The file to convert to a service.
1649
1662
  * @returns The service.
1650
1663
  */
1651
- toService: toService((0, import_node_path16.join)(path5)),
1664
+ toService: toService((0, import_node_path17.join)(path6)),
1652
1665
  /**
1653
1666
  * ================================
1654
1667
  * Domains
@@ -1661,39 +1674,39 @@ var index_default = (path5) => {
1661
1674
  * @param options - Optional options to write the event
1662
1675
  *
1663
1676
  */
1664
- writeDomain: writeDomain((0, import_node_path16.join)(path5, "domains")),
1677
+ writeDomain: writeDomain((0, import_node_path17.join)(path6, "domains")),
1665
1678
  /**
1666
1679
  * Returns a domain from EventCatalog
1667
1680
  * @param id - The id of the domain to retrieve
1668
1681
  * @param version - Optional id of the version to get (supports semver)
1669
1682
  * @returns Domain|Undefined
1670
1683
  */
1671
- getDomain: getDomain((0, import_node_path16.join)(path5, "domains")),
1684
+ getDomain: getDomain((0, import_node_path17.join)(path6, "domains")),
1672
1685
  /**
1673
1686
  * Returns all domains from EventCatalog
1674
1687
  * @param latestOnly - optional boolean, set to true to get only latest versions
1675
1688
  * @returns Domain[]|Undefined
1676
1689
  */
1677
- getDomains: getDomains((0, import_node_path16.join)(path5)),
1690
+ getDomains: getDomains((0, import_node_path17.join)(path6)),
1678
1691
  /**
1679
1692
  * Moves a given domain id to the version directory
1680
1693
  * @param directory
1681
1694
  */
1682
- versionDomain: versionDomain((0, import_node_path16.join)(path5, "domains")),
1695
+ versionDomain: versionDomain((0, import_node_path17.join)(path6, "domains")),
1683
1696
  /**
1684
1697
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1685
1698
  *
1686
1699
  * @param path - The path to your domain, e.g. `/Payment`
1687
1700
  *
1688
1701
  */
1689
- rmDomain: rmDomain((0, import_node_path16.join)(path5, "domains")),
1702
+ rmDomain: rmDomain((0, import_node_path17.join)(path6, "domains")),
1690
1703
  /**
1691
1704
  * Remove an service by an domain id
1692
1705
  *
1693
1706
  * @param id - The id of the domain you want to remove
1694
1707
  *
1695
1708
  */
1696
- rmDomainById: rmDomainById((0, import_node_path16.join)(path5, "domains")),
1709
+ rmDomainById: rmDomainById((0, import_node_path17.join)(path6, "domains")),
1697
1710
  /**
1698
1711
  * Adds a file to the given domain
1699
1712
  * @param id - The id of the domain to add the file to
@@ -1701,28 +1714,28 @@ var index_default = (path5) => {
1701
1714
  * @param version - Optional version of the domain to add the file to
1702
1715
  * @returns
1703
1716
  */
1704
- addFileToDomain: addFileToDomain((0, import_node_path16.join)(path5, "domains")),
1717
+ addFileToDomain: addFileToDomain((0, import_node_path17.join)(path6, "domains")),
1705
1718
  /**
1706
1719
  * Adds an ubiquitous language dictionary to a domain
1707
1720
  * @param id - The id of the domain to add the ubiquitous language to
1708
1721
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1709
1722
  * @param version - Optional version of the domain to add the ubiquitous language to
1710
1723
  */
1711
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path16.join)(path5, "domains")),
1724
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path17.join)(path6, "domains")),
1712
1725
  /**
1713
1726
  * Get the ubiquitous language dictionary from a domain
1714
1727
  * @param id - The id of the domain to get the ubiquitous language from
1715
1728
  * @param version - Optional version of the domain to get the ubiquitous language from
1716
1729
  * @returns
1717
1730
  */
1718
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path16.join)(path5, "domains")),
1731
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path17.join)(path6, "domains")),
1719
1732
  /**
1720
1733
  * Check to see if a domain version exists
1721
1734
  * @param id - The id of the domain
1722
1735
  * @param version - The version of the domain (supports semver)
1723
1736
  * @returns
1724
1737
  */
1725
- domainHasVersion: domainHasVersion((0, import_node_path16.join)(path5)),
1738
+ domainHasVersion: domainHasVersion((0, import_node_path17.join)(path6)),
1726
1739
  /**
1727
1740
  * Adds a given service to a domain
1728
1741
  * @param id - The id of the domain
@@ -1730,7 +1743,7 @@ var index_default = (path5) => {
1730
1743
  * @param version - (Optional) The version of the domain to add the service to
1731
1744
  * @returns
1732
1745
  */
1733
- addServiceToDomain: addServiceToDomain((0, import_node_path16.join)(path5, "domains")),
1746
+ addServiceToDomain: addServiceToDomain((0, import_node_path17.join)(path6, "domains")),
1734
1747
  /**
1735
1748
  * Adds a given subdomain to a domain
1736
1749
  * @param id - The id of the domain
@@ -1738,7 +1751,7 @@ var index_default = (path5) => {
1738
1751
  * @param version - (Optional) The version of the domain to add the subdomain to
1739
1752
  * @returns
1740
1753
  */
1741
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path16.join)(path5, "domains")),
1754
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path17.join)(path6, "domains")),
1742
1755
  /**
1743
1756
  * Adds an entity to a domain
1744
1757
  * @param id - The id of the domain
@@ -1746,7 +1759,7 @@ var index_default = (path5) => {
1746
1759
  * @param version - (Optional) The version of the domain to add the entity to
1747
1760
  * @returns
1748
1761
  */
1749
- addEntityToDomain: addEntityToDomain((0, import_node_path16.join)(path5, "domains")),
1762
+ addEntityToDomain: addEntityToDomain((0, import_node_path17.join)(path6, "domains")),
1750
1763
  /**
1751
1764
  * ================================
1752
1765
  * Teams
@@ -1759,25 +1772,25 @@ var index_default = (path5) => {
1759
1772
  * @param options - Optional options to write the team
1760
1773
  *
1761
1774
  */
1762
- writeTeam: writeTeam((0, import_node_path16.join)(path5, "teams")),
1775
+ writeTeam: writeTeam((0, import_node_path17.join)(path6, "teams")),
1763
1776
  /**
1764
1777
  * Returns a team from EventCatalog
1765
1778
  * @param id - The id of the team to retrieve
1766
1779
  * @returns Team|Undefined
1767
1780
  */
1768
- getTeam: getTeam((0, import_node_path16.join)(path5, "teams")),
1781
+ getTeam: getTeam((0, import_node_path17.join)(path6, "teams")),
1769
1782
  /**
1770
1783
  * Returns all teams from EventCatalog
1771
1784
  * @returns Team[]|Undefined
1772
1785
  */
1773
- getTeams: getTeams((0, import_node_path16.join)(path5, "teams")),
1786
+ getTeams: getTeams((0, import_node_path17.join)(path6, "teams")),
1774
1787
  /**
1775
1788
  * Remove a team by the team id
1776
1789
  *
1777
1790
  * @param id - The id of the team you want to remove
1778
1791
  *
1779
1792
  */
1780
- rmTeamById: rmTeamById((0, import_node_path16.join)(path5, "teams")),
1793
+ rmTeamById: rmTeamById((0, import_node_path17.join)(path6, "teams")),
1781
1794
  /**
1782
1795
  * ================================
1783
1796
  * Users
@@ -1790,25 +1803,25 @@ var index_default = (path5) => {
1790
1803
  * @param options - Optional options to write the user
1791
1804
  *
1792
1805
  */
1793
- writeUser: writeUser((0, import_node_path16.join)(path5, "users")),
1806
+ writeUser: writeUser((0, import_node_path17.join)(path6, "users")),
1794
1807
  /**
1795
1808
  * Returns a user from EventCatalog
1796
1809
  * @param id - The id of the user to retrieve
1797
1810
  * @returns User|Undefined
1798
1811
  */
1799
- getUser: getUser((0, import_node_path16.join)(path5, "users")),
1812
+ getUser: getUser((0, import_node_path17.join)(path6, "users")),
1800
1813
  /**
1801
1814
  * Returns all user from EventCatalog
1802
1815
  * @returns User[]|Undefined
1803
1816
  */
1804
- getUsers: getUsers((0, import_node_path16.join)(path5)),
1817
+ getUsers: getUsers((0, import_node_path17.join)(path6)),
1805
1818
  /**
1806
1819
  * Remove a user by the user id
1807
1820
  *
1808
1821
  * @param id - The id of the user you want to remove
1809
1822
  *
1810
1823
  */
1811
- rmUserById: rmUserById((0, import_node_path16.join)(path5, "users")),
1824
+ rmUserById: rmUserById((0, import_node_path17.join)(path6, "users")),
1812
1825
  /**
1813
1826
  * ================================
1814
1827
  * Custom Docs
@@ -1819,32 +1832,32 @@ var index_default = (path5) => {
1819
1832
  * @param path - The path to the custom doc to retrieve
1820
1833
  * @returns CustomDoc|Undefined
1821
1834
  */
1822
- getCustomDoc: getCustomDoc((0, import_node_path16.join)(path5, "docs")),
1835
+ getCustomDoc: getCustomDoc((0, import_node_path17.join)(path6, "docs")),
1823
1836
  /**
1824
1837
  * Returns all custom docs from EventCatalog
1825
1838
  * @param options - Optional options to get custom docs from a specific path
1826
1839
  * @returns CustomDoc[]|Undefined
1827
1840
  */
1828
- getCustomDocs: getCustomDocs((0, import_node_path16.join)(path5, "docs")),
1841
+ getCustomDocs: getCustomDocs((0, import_node_path17.join)(path6, "docs")),
1829
1842
  /**
1830
1843
  * Writes a custom doc to EventCatalog
1831
1844
  * @param customDoc - The custom doc to write
1832
1845
  * @param options - Optional options to write the custom doc
1833
1846
  *
1834
1847
  */
1835
- writeCustomDoc: writeCustomDoc((0, import_node_path16.join)(path5, "docs")),
1848
+ writeCustomDoc: writeCustomDoc((0, import_node_path17.join)(path6, "docs")),
1836
1849
  /**
1837
1850
  * Removes a custom doc from EventCatalog
1838
1851
  * @param path - The path to the custom doc to remove
1839
1852
  *
1840
1853
  */
1841
- rmCustomDoc: rmCustomDoc((0, import_node_path16.join)(path5, "docs")),
1854
+ rmCustomDoc: rmCustomDoc((0, import_node_path17.join)(path6, "docs")),
1842
1855
  /**
1843
1856
  * Dumps the catalog to a JSON file.
1844
1857
  * @param directory - The directory to dump the catalog to
1845
1858
  * @returns A JSON file with the catalog
1846
1859
  */
1847
- dumpCatalog: dumpCatalog((0, import_node_path16.join)(path5)),
1860
+ dumpCatalog: dumpCatalog((0, import_node_path17.join)(path6)),
1848
1861
  /**
1849
1862
  * Returns the event catalog configuration file.
1850
1863
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1852,7 +1865,7 @@ var index_default = (path5) => {
1852
1865
  * @param directory - The directory of the catalog.
1853
1866
  * @returns A JSON object with the configuration for the event catalog.
1854
1867
  */
1855
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path16.join)(path5)),
1868
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path17.join)(path6)),
1856
1869
  /**
1857
1870
  * ================================
1858
1871
  * Resources Utils
@@ -1862,6 +1875,10 @@ var index_default = (path5) => {
1862
1875
  * Returns the path to a given resource by id and version
1863
1876
  */
1864
1877
  getResourcePath,
1878
+ /**
1879
+ * Returns the folder name of a given resource
1880
+ */
1881
+ getResourceFolderName,
1865
1882
  /**
1866
1883
  * ================================
1867
1884
  * General Message Utils
@@ -1873,33 +1890,33 @@ var index_default = (path5) => {
1873
1890
  * @param path - The path to the message to retrieve
1874
1891
  * @returns Message|Undefined
1875
1892
  */
1876
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path16.join)(path5)),
1893
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path17.join)(path6)),
1877
1894
  /**
1878
1895
  * Returns the producers and consumers (services) for a given message
1879
1896
  * @param id - The id of the message to get the producers and consumers for
1880
1897
  * @param version - Optional version of the message
1881
1898
  * @returns { producers: Service[], consumers: Service[] }
1882
1899
  */
1883
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path16.join)(path5)),
1900
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path17.join)(path6)),
1884
1901
  /**
1885
1902
  * Returns the consumers of a given schema path
1886
1903
  * @param path - The path to the schema to get the consumers for
1887
1904
  * @returns Service[]
1888
1905
  */
1889
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path16.join)(path5)),
1906
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path17.join)(path6)),
1890
1907
  /**
1891
1908
  * Returns the producers of a given schema path
1892
1909
  * @param path - The path to the schema to get the producers for
1893
1910
  * @returns Service[]
1894
1911
  */
1895
- getProducersOfSchema: getProducersOfSchema((0, import_node_path16.join)(path5)),
1912
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path17.join)(path6)),
1896
1913
  /**
1897
1914
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1898
1915
  * @param id - The id of the resource to get the owners for
1899
1916
  * @param version - Optional version of the resource
1900
1917
  * @returns { owners: User[] }
1901
1918
  */
1902
- getOwnersForResource: getOwnersForResource((0, import_node_path16.join)(path5)),
1919
+ getOwnersForResource: getOwnersForResource((0, import_node_path17.join)(path6)),
1903
1920
  /**
1904
1921
  * ================================
1905
1922
  * Entities
@@ -1911,13 +1928,13 @@ var index_default = (path5) => {
1911
1928
  * @param version - Optional id of the version to get (supports semver)
1912
1929
  * @returns Entity|Undefined
1913
1930
  */
1914
- getEntity: getEntity((0, import_node_path16.join)(path5)),
1931
+ getEntity: getEntity((0, import_node_path17.join)(path6)),
1915
1932
  /**
1916
1933
  * Returns all entities from EventCatalog
1917
1934
  * @param latestOnly - optional boolean, set to true to get only latest versions
1918
1935
  * @returns Entity[]|Undefined
1919
1936
  */
1920
- getEntities: getEntities((0, import_node_path16.join)(path5)),
1937
+ getEntities: getEntities((0, import_node_path17.join)(path6)),
1921
1938
  /**
1922
1939
  * Adds an entity to EventCatalog
1923
1940
  *
@@ -1925,33 +1942,33 @@ var index_default = (path5) => {
1925
1942
  * @param options - Optional options to write the entity
1926
1943
  *
1927
1944
  */
1928
- writeEntity: writeEntity((0, import_node_path16.join)(path5, "entities")),
1945
+ writeEntity: writeEntity((0, import_node_path17.join)(path6, "entities")),
1929
1946
  /**
1930
1947
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1931
1948
  *
1932
1949
  * @param path - The path to your entity, e.g. `/User`
1933
1950
  *
1934
1951
  */
1935
- rmEntity: rmEntity((0, import_node_path16.join)(path5, "entities")),
1952
+ rmEntity: rmEntity((0, import_node_path17.join)(path6, "entities")),
1936
1953
  /**
1937
1954
  * Remove an entity by an entity id
1938
1955
  *
1939
1956
  * @param id - The id of the entity you want to remove
1940
1957
  *
1941
1958
  */
1942
- rmEntityById: rmEntityById((0, import_node_path16.join)(path5)),
1959
+ rmEntityById: rmEntityById((0, import_node_path17.join)(path6)),
1943
1960
  /**
1944
1961
  * Moves a given entity id to the version directory
1945
1962
  * @param id - The id of the entity to version
1946
1963
  */
1947
- versionEntity: versionEntity((0, import_node_path16.join)(path5)),
1964
+ versionEntity: versionEntity((0, import_node_path17.join)(path6)),
1948
1965
  /**
1949
1966
  * Check to see if an entity version exists
1950
1967
  * @param id - The id of the entity
1951
1968
  * @param version - The version of the entity (supports semver)
1952
1969
  * @returns
1953
1970
  */
1954
- entityHasVersion: entityHasVersion((0, import_node_path16.join)(path5)),
1971
+ entityHasVersion: entityHasVersion((0, import_node_path17.join)(path6)),
1955
1972
  /**
1956
1973
  * ================================
1957
1974
  * Data Stores
@@ -1963,42 +1980,42 @@ var index_default = (path5) => {
1963
1980
  * @param options - Optional options to write the data store
1964
1981
  *
1965
1982
  */
1966
- writeDataStore: writeDataStore((0, import_node_path16.join)(path5, "containers")),
1983
+ writeDataStore: writeDataStore((0, import_node_path17.join)(path6, "containers")),
1967
1984
  /**
1968
1985
  * Returns a data store from EventCatalog
1969
1986
  * @param id - The id of the data store to retrieve
1970
1987
  * @param version - Optional id of the version to get (supports semver)
1971
1988
  * @returns Container|Undefined
1972
1989
  */
1973
- getDataStore: getDataStore((0, import_node_path16.join)(path5)),
1990
+ getDataStore: getDataStore((0, import_node_path17.join)(path6)),
1974
1991
  /**
1975
1992
  * Returns all data stores from EventCatalog
1976
1993
  * @param latestOnly - optional boolean, set to true to get only latest versions
1977
1994
  * @returns Container[]|Undefined
1978
1995
  */
1979
- getDataStores: getDataStores((0, import_node_path16.join)(path5)),
1996
+ getDataStores: getDataStores((0, import_node_path17.join)(path6)),
1980
1997
  /**
1981
1998
  * Version a data store by its id
1982
1999
  * @param id - The id of the data store to version
1983
2000
  */
1984
- versionDataStore: versionDataStore((0, import_node_path16.join)(path5, "containers")),
2001
+ versionDataStore: versionDataStore((0, import_node_path17.join)(path6, "containers")),
1985
2002
  /**
1986
2003
  * Remove a data store by its path
1987
2004
  * @param path - The path to the data store to remove
1988
2005
  */
1989
- rmDataStore: rmDataStore((0, import_node_path16.join)(path5, "containers")),
2006
+ rmDataStore: rmDataStore((0, import_node_path17.join)(path6, "containers")),
1990
2007
  /**
1991
2008
  * Remove a data store by its id
1992
2009
  * @param id - The id of the data store to remove
1993
2010
  */
1994
- rmDataStoreById: rmDataStoreById((0, import_node_path16.join)(path5)),
2011
+ rmDataStoreById: rmDataStoreById((0, import_node_path17.join)(path6)),
1995
2012
  /**
1996
2013
  * Check to see if a data store version exists
1997
2014
  * @param id - The id of the data store
1998
2015
  * @param version - The version of the data store (supports semver)
1999
2016
  * @returns
2000
2017
  */
2001
- dataStoreHasVersion: dataStoreHasVersion((0, import_node_path16.join)(path5)),
2018
+ dataStoreHasVersion: dataStoreHasVersion((0, import_node_path17.join)(path6)),
2002
2019
  /**
2003
2020
  * Adds a file to a data store by its id
2004
2021
  * @param id - The id of the data store to add the file to
@@ -2006,14 +2023,14 @@ var index_default = (path5) => {
2006
2023
  * @param version - Optional version of the data store to add the file to
2007
2024
  * @returns
2008
2025
  */
2009
- addFileToDataStore: addFileToDataStore((0, import_node_path16.join)(path5)),
2026
+ addFileToDataStore: addFileToDataStore((0, import_node_path17.join)(path6)),
2010
2027
  /**
2011
2028
  * Writes a data store to a service by its id
2012
2029
  * @param dataStore - The data store to write
2013
2030
  * @param service - The service to write the data store to
2014
2031
  * @returns
2015
2032
  */
2016
- writeDataStoreToService: writeDataStoreToService((0, import_node_path16.join)(path5))
2033
+ writeDataStoreToService: writeDataStoreToService((0, import_node_path17.join)(path6))
2017
2034
  };
2018
2035
  };
2019
2036
 
@@ -2021,7 +2038,7 @@ var index_default = (path5) => {
2021
2038
  var DUMP_VERSION = "0.0.1";
2022
2039
  var getEventCatalogVersion = async (catalogDir) => {
2023
2040
  try {
2024
- const packageJson = import_fs.default.readFileSync((0, import_node_path17.join)(catalogDir, "package.json"), "utf8");
2041
+ const packageJson = import_fs.default.readFileSync((0, import_node_path18.join)(catalogDir, "package.json"), "utf8");
2025
2042
  const packageJsonObject = JSON.parse(packageJson);
2026
2043
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
2027
2044
  } catch (error) {
@@ -2034,7 +2051,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
2034
2051
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
2035
2052
  let schema = "";
2036
2053
  if (resource.schemaPath && resourcePath?.fullPath) {
2037
- const pathToSchema = import_node_path17.default.join(import_node_path17.default.dirname(resourcePath?.fullPath), resource.schemaPath);
2054
+ const pathToSchema = import_node_path18.default.join(import_node_path18.default.dirname(resourcePath?.fullPath), resource.schemaPath);
2038
2055
  if (import_fs.default.existsSync(pathToSchema)) {
2039
2056
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
2040
2057
  }
@@ -2055,8 +2072,8 @@ var filterCollection = (collection, options) => {
2055
2072
  };
2056
2073
  var getEventCatalogConfigurationFile = (directory) => async () => {
2057
2074
  try {
2058
- const path5 = (0, import_node_path17.join)(directory, "eventcatalog.config.js");
2059
- const configModule = await import(path5);
2075
+ const path6 = (0, import_node_path18.join)(directory, "eventcatalog.config.js");
2076
+ const configModule = await import(path6);
2060
2077
  return configModule.default;
2061
2078
  } catch (error) {
2062
2079
  console.error("Error getting event catalog configuration file", error);