@eventcatalog/sdk 2.8.2 → 2.8.4

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 (64) hide show
  1. package/dist/channels.js +19 -18
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +14 -13
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +14 -13
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +12 -11
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/containers.js +14 -13
  10. package/dist/containers.js.map +1 -1
  11. package/dist/containers.mjs +12 -11
  12. package/dist/containers.mjs.map +1 -1
  13. package/dist/custom-docs.js +8 -7
  14. package/dist/custom-docs.js.map +1 -1
  15. package/dist/custom-docs.mjs +7 -6
  16. package/dist/custom-docs.mjs.map +1 -1
  17. package/dist/data-stores.js +14 -13
  18. package/dist/data-stores.js.map +1 -1
  19. package/dist/data-stores.mjs +12 -11
  20. package/dist/data-stores.mjs.map +1 -1
  21. package/dist/domains.js +19 -18
  22. package/dist/domains.js.map +1 -1
  23. package/dist/domains.mjs +19 -18
  24. package/dist/domains.mjs.map +1 -1
  25. package/dist/entities.js +13 -12
  26. package/dist/entities.js.map +1 -1
  27. package/dist/entities.mjs +12 -11
  28. package/dist/entities.mjs.map +1 -1
  29. package/dist/eventcatalog.js +260 -197
  30. package/dist/eventcatalog.js.map +1 -1
  31. package/dist/eventcatalog.mjs +232 -169
  32. package/dist/eventcatalog.mjs.map +1 -1
  33. package/dist/events.js +14 -13
  34. package/dist/events.js.map +1 -1
  35. package/dist/events.mjs +12 -11
  36. package/dist/events.mjs.map +1 -1
  37. package/dist/index.d.mts +26 -12
  38. package/dist/index.d.ts +26 -12
  39. package/dist/index.js +260 -197
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +232 -169
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/messages.js +13 -12
  44. package/dist/messages.js.map +1 -1
  45. package/dist/messages.mjs +11 -10
  46. package/dist/messages.mjs.map +1 -1
  47. package/dist/queries.js +14 -13
  48. package/dist/queries.js.map +1 -1
  49. package/dist/queries.mjs +12 -11
  50. package/dist/queries.mjs.map +1 -1
  51. package/dist/services.d.mts +25 -1
  52. package/dist/services.d.ts +25 -1
  53. package/dist/services.js +66 -27
  54. package/dist/services.js.map +1 -1
  55. package/dist/services.mjs +60 -22
  56. package/dist/services.mjs.map +1 -1
  57. package/dist/teams.js +13 -12
  58. package/dist/teams.js.map +1 -1
  59. package/dist/teams.mjs +8 -7
  60. package/dist/teams.mjs.map +1 -1
  61. package/dist/types.d.d.mts +2 -0
  62. package/dist/types.d.d.ts +2 -0
  63. package/dist/types.d.js.map +1 -1
  64. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -33,11 +33,11 @@ __export(index_exports, {
33
33
  default: () => index_default
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
- var import_node_path17 = require("path");
36
+ var import_node_path18 = require("path");
37
37
 
38
38
  // src/events.ts
39
39
  var import_promises2 = __toESM(require("fs/promises"));
40
- var import_node_path3 = require("path");
40
+ var import_node_path4 = require("path");
41
41
 
42
42
  // src/internal/utils.ts
43
43
  var import_glob = require("glob");
@@ -54,13 +54,13 @@ var versionExists = async (catalogDir, id, version) => {
54
54
  var findFileById = async (catalogDir, id, version) => {
55
55
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
56
56
  const matchedFiles = await searchFilesForId(files, id) || [];
57
- const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
57
+ const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
58
58
  if (!version) {
59
59
  return latestVersion;
60
60
  }
61
- const parsedFiles = matchedFiles.map((path5) => {
62
- const { data } = import_gray_matter.default.read(path5);
63
- return { ...data, path: path5 };
61
+ const parsedFiles = matchedFiles.map((path6) => {
62
+ const { data } = import_gray_matter.default.read(path6);
63
+ return { ...data, path: path6 };
64
64
  });
65
65
  const semverRange = (0, import_semver.validRange)(version);
66
66
  if (semverRange && (0, import_semver.valid)(version)) {
@@ -101,8 +101,8 @@ var getFiles = async (pattern, ignore = "") => {
101
101
  );
102
102
  }
103
103
  };
104
- var readMdxFile = async (path5) => {
105
- const { data } = import_gray_matter.default.read(path5);
104
+ var readMdxFile = async (path6) => {
105
+ const { data } = import_gray_matter.default.read(path6);
106
106
  const { markdown, ...frontmatter } = data;
107
107
  return { ...frontmatter, markdown };
108
108
  };
@@ -155,6 +155,7 @@ var import_node_fs2 = __toESM(require("fs"));
155
155
  var import_semver2 = require("semver");
156
156
  var import_proper_lockfile = require("proper-lockfile");
157
157
  var import_node_path2 = require("path");
158
+ var import_node_path3 = __toESM(require("path"));
158
159
  var versionResource = async (catalogDir, id) => {
159
160
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
160
161
  const matchedFiles = await searchFilesForId(files, id);
@@ -194,8 +195,8 @@ var writeResource = async (catalogDir, resource, options = {
194
195
  versionExistingContent: false,
195
196
  format: "mdx"
196
197
  }) => {
197
- const path5 = options.path || `/${resource.id}`;
198
- const fullPath = (0, import_path.join)(catalogDir, path5);
198
+ const path6 = options.path || `/${resource.id}`;
199
+ const fullPath = (0, import_path.join)(catalogDir, path6);
199
200
  const format = options.format || "mdx";
200
201
  import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
201
202
  const lockPath = (0, import_path.join)(fullPath, `index.${format}`);
@@ -261,6 +262,11 @@ var getResourcePath = async (catalogDir, id, version) => {
261
262
  directory: (0, import_path.dirname)(file.replace(catalogDir, ""))
262
263
  };
263
264
  };
265
+ var getResourceFolderName = async (catalogDir, id, version) => {
266
+ const paths = await getResourcePath(catalogDir, id, version);
267
+ if (!paths) return;
268
+ return paths?.directory.split(import_node_path3.default.sep).filter(Boolean).pop();
269
+ };
264
270
  var toResource = async (catalogDir, rawContents) => {
265
271
  const { data, content } = (0, import_gray_matter2.default)(rawContents);
266
272
  return {
@@ -322,16 +328,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
322
328
  );
323
329
  }
324
330
  };
325
- var waitForFileRemoval = async (path5, maxRetries = 50, delay = 10) => {
331
+ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
326
332
  for (let i = 0; i < maxRetries; i++) {
327
333
  try {
328
- await import_promises.default.access(path5);
334
+ await import_promises.default.access(path6);
329
335
  await new Promise((resolve2) => setTimeout(resolve2, delay));
330
336
  } catch (error) {
331
337
  return;
332
338
  }
333
339
  }
334
- throw new Error(`File/directory ${path5} was not removed after ${maxRetries} attempts`);
340
+ throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
335
341
  };
336
342
  var addFileToResource = async (catalogDir, id, file, version) => {
337
343
  const pathToResource = await findFileById(catalogDir, id, version);
@@ -375,11 +381,11 @@ var writeEventToService = (directory) => async (event, service, options = { path
375
381
  throw new Error("Service not found");
376
382
  }
377
383
  let pathForEvent = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/events` : `${resourcePath.directory}/events`;
378
- pathForEvent = (0, import_node_path3.join)(pathForEvent, event.id);
384
+ pathForEvent = (0, import_node_path4.join)(pathForEvent, event.id);
379
385
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
380
386
  };
381
- var rmEvent = (directory) => async (path5) => {
382
- await import_promises2.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
387
+ var rmEvent = (directory) => async (path6) => {
388
+ await import_promises2.default.rm((0, import_node_path4.join)(directory, path6), { recursive: true });
383
389
  };
384
390
  var rmEventById = (directory) => async (id, version, persistFiles) => {
385
391
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -396,7 +402,7 @@ var eventHasVersion = (directory) => async (id, version) => {
396
402
 
397
403
  // src/commands.ts
398
404
  var import_promises3 = __toESM(require("fs/promises"));
399
- var import_node_path4 = require("path");
405
+ var import_node_path5 = require("path");
400
406
  var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
401
407
  var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
402
408
  var writeCommand = (directory) => async (command, options = {
@@ -411,11 +417,11 @@ var writeCommandToService = (directory) => async (command, service, options = {
411
417
  throw new Error("Service not found");
412
418
  }
413
419
  let pathForCommand = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/commands` : `${resourcePath.directory}/commands`;
414
- pathForCommand = (0, import_node_path4.join)(pathForCommand, command.id);
420
+ pathForCommand = (0, import_node_path5.join)(pathForCommand, command.id);
415
421
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
416
422
  };
417
- var rmCommand = (directory) => async (path5) => {
418
- await import_promises3.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
423
+ var rmCommand = (directory) => async (path6) => {
424
+ await import_promises3.default.rm((0, import_node_path5.join)(directory, path6), { recursive: true });
419
425
  };
420
426
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
421
427
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -430,7 +436,7 @@ var commandHasVersion = (directory) => async (id, version) => {
430
436
 
431
437
  // src/queries.ts
432
438
  var import_promises4 = __toESM(require("fs/promises"));
433
- var import_node_path5 = require("path");
439
+ var import_node_path6 = require("path");
434
440
  var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
435
441
  var writeQuery = (directory) => async (query, options = {
436
442
  path: "",
@@ -445,11 +451,11 @@ var writeQueryToService = (directory) => async (query, service, options = { path
445
451
  throw new Error("Service not found");
446
452
  }
447
453
  let pathForQuery = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/queries` : `${resourcePath.directory}/queries`;
448
- pathForQuery = (0, import_node_path5.join)(pathForQuery, query.id);
454
+ pathForQuery = (0, import_node_path6.join)(pathForQuery, query.id);
449
455
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
450
456
  };
451
- var rmQuery = (directory) => async (path5) => {
452
- await import_promises4.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
457
+ var rmQuery = (directory) => async (path6) => {
458
+ await import_promises4.default.rm((0, import_node_path6.join)(directory, path6), { recursive: true });
453
459
  };
454
460
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
455
461
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -466,10 +472,10 @@ var queryHasVersion = (directory) => async (id, version) => {
466
472
 
467
473
  // src/services.ts
468
474
  var import_promises5 = __toESM(require("fs/promises"));
469
- var import_node_path6 = require("path");
475
+ var import_node_path7 = require("path");
470
476
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
471
- var getServiceByPath = (directory) => async (path5) => {
472
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
477
+ var getServiceByPath = (directory) => async (path6) => {
478
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
473
479
  return service;
474
480
  };
475
481
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -493,17 +499,17 @@ var writeService = (directory) => async (service, options = {
493
499
  };
494
500
  var writeVersionedService = (directory) => async (service) => {
495
501
  const resource = { ...service };
496
- const path5 = getVersionedDirectory(service.id, service.version);
497
- return await writeService(directory)(resource, { path: path5 });
502
+ const path6 = getVersionedDirectory(service.id, service.version);
503
+ return await writeService(directory)(resource, { path: path6 });
498
504
  };
499
505
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
500
506
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
501
- pathForService = (0, import_node_path6.join)(pathForService, service.id);
507
+ pathForService = (0, import_node_path7.join)(pathForService, service.id);
502
508
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
503
509
  };
504
510
  var versionService = (directory) => async (id) => versionResource(directory, id);
505
- var rmService = (directory) => async (path5) => {
506
- await import_promises5.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
511
+ var rmService = (directory) => async (path6) => {
512
+ await import_promises5.default.rm((0, import_node_path7.join)(directory, path6), { recursive: true });
507
513
  };
508
514
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
509
515
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -530,7 +536,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
530
536
  throw new Error(`Specification file name for ${fileName} is undefined`);
531
537
  }
532
538
  const rawFile = await getFileFromResource(directory, id, { fileName }, version);
533
- return { key, content: rawFile, fileName, path: (0, import_node_path6.join)((0, import_node_path6.dirname)(filePathToService), fileName) };
539
+ return { key, content: rawFile, fileName, path: (0, import_node_path7.join)((0, import_node_path7.dirname)(filePathToService), fileName) };
534
540
  });
535
541
  specs = await Promise.all(getSpecs);
536
542
  }
@@ -539,7 +545,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
539
545
  var addMessageToService = (directory) => async (id, direction, event, version) => {
540
546
  let service = await getService(directory)(id, version);
541
547
  const servicePath = await getResourcePath(directory, id, version);
542
- const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
548
+ const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
543
549
  if (direction === "sends") {
544
550
  if (service.sends === void 0) {
545
551
  service.sends = [];
@@ -567,8 +573,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
567
573
  if (!existingResource) {
568
574
  throw new Error(`Cannot find service ${id} in the catalog`);
569
575
  }
570
- const path5 = existingResource.split(/[\\/]+services/)[0];
571
- const pathToResource = (0, import_node_path6.join)(path5, "services");
576
+ const path6 = existingResource.split(/[\\/]+services/)[0];
577
+ const pathToResource = (0, import_node_path7.join)(path6, "services");
572
578
  await rmServiceById(directory)(id, version);
573
579
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
574
580
  };
@@ -576,9 +582,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
576
582
  const file = await findFileById(directory, id, version);
577
583
  return !!file;
578
584
  };
579
- var isService = (directory) => async (path5) => {
580
- const service = await getServiceByPath(directory)(path5);
581
- const relativePath = (0, import_node_path6.relative)(directory, path5);
585
+ var isService = (directory) => async (path6) => {
586
+ const service = await getServiceByPath(directory)(path6);
587
+ const relativePath = (0, import_node_path7.relative)(directory, path6);
582
588
  const segments = relativePath.split(/[/\\]+/);
583
589
  return !!service && segments.includes("services");
584
590
  };
@@ -586,7 +592,7 @@ var toService = (directory) => async (file) => toResource(directory, file);
586
592
  var addEntityToService = (directory) => async (id, entity, version) => {
587
593
  let service = await getService(directory)(id, version);
588
594
  const servicePath = await getResourcePath(directory, id, version);
589
- const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
595
+ const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
590
596
  if (service.entities === void 0) {
591
597
  service.entities = [];
592
598
  }
@@ -600,15 +606,51 @@ var addEntityToService = (directory) => async (id, entity, version) => {
600
606
  if (!existingResource) {
601
607
  throw new Error(`Cannot find service ${id} in the catalog`);
602
608
  }
603
- const path5 = existingResource.split(/[\\/]+services/)[0];
604
- const pathToResource = (0, import_node_path6.join)(path5, "services");
609
+ const path6 = existingResource.split(/[\\/]+services/)[0];
610
+ const pathToResource = (0, import_node_path7.join)(path6, "services");
611
+ await rmServiceById(directory)(id, version);
612
+ await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
613
+ };
614
+ var addDataStoreToService = (directory) => async (id, operation, dataStore, version) => {
615
+ let service = await getService(directory)(id, version);
616
+ const servicePath = await getResourcePath(directory, id, version);
617
+ const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
618
+ if (operation === "writesTo") {
619
+ if (service.writesTo === void 0) {
620
+ service.writesTo = [];
621
+ }
622
+ for (let i = 0; i < service.writesTo.length; i++) {
623
+ if (service.writesTo[i].id === dataStore.id && service.writesTo[i].version === dataStore.version) {
624
+ return;
625
+ }
626
+ }
627
+ service.writesTo.push({ id: dataStore.id, version: dataStore.version });
628
+ } else if (operation === "readsFrom") {
629
+ if (service.readsFrom === void 0) {
630
+ service.readsFrom = [];
631
+ }
632
+ for (let i = 0; i < service.readsFrom.length; i++) {
633
+ if (service.readsFrom[i].id === dataStore.id && service.readsFrom[i].version === dataStore.version) {
634
+ return;
635
+ }
636
+ }
637
+ service.readsFrom.push({ id: dataStore.id, version: dataStore.version });
638
+ } else {
639
+ throw new Error(`Operation ${operation} is invalid, only 'writesTo' and 'readsFrom' are supported`);
640
+ }
641
+ const existingResource = await findFileById(directory, id, version);
642
+ if (!existingResource) {
643
+ throw new Error(`Cannot find service ${id} in the catalog`);
644
+ }
645
+ const path6 = existingResource.split(/[\\/]+services/)[0];
646
+ const pathToResource = (0, import_node_path7.join)(path6, "services");
605
647
  await rmServiceById(directory)(id, version);
606
648
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
607
649
  };
608
650
 
609
651
  // src/domains.ts
610
652
  var import_promises6 = __toESM(require("fs/promises"));
611
- var import_node_path7 = __toESM(require("path"));
653
+ var import_node_path8 = __toESM(require("path"));
612
654
  var import_node_fs3 = __toESM(require("fs"));
613
655
  var import_gray_matter3 = __toESM(require("gray-matter"));
614
656
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -633,8 +675,8 @@ var writeDomain = (directory) => async (domain, options = {
633
675
  return await writeResource(directory, resource, { ...options, type: "domain" });
634
676
  };
635
677
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
636
- var rmDomain = (directory) => async (path5) => {
637
- await import_promises6.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
678
+ var rmDomain = (directory) => async (path6) => {
679
+ await import_promises6.default.rm((0, import_node_path8.join)(directory, path6), { recursive: true });
638
680
  };
639
681
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
640
682
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -646,7 +688,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
646
688
  };
647
689
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
648
690
  const pathToDomain = await findFileById(directory, id, version) || "";
649
- const pathToUbiquitousLanguage = import_node_path7.default.join(import_node_path7.default.dirname(pathToDomain), "ubiquitous-language.mdx");
691
+ const pathToUbiquitousLanguage = import_node_path8.default.join(import_node_path8.default.dirname(pathToDomain), "ubiquitous-language.mdx");
650
692
  const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
651
693
  if (!fileExists) {
652
694
  return void 0;
@@ -661,7 +703,7 @@ var domainHasVersion = (directory) => async (id, version) => {
661
703
  var addServiceToDomain = (directory) => async (id, service, version) => {
662
704
  let domain = await getDomain(directory)(id, version);
663
705
  const domainPath = await getResourcePath(directory, id, version);
664
- const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
706
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
665
707
  if (domain.services === void 0) {
666
708
  domain.services = [];
667
709
  }
@@ -676,7 +718,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
676
718
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
677
719
  let domain = await getDomain(directory)(id, version);
678
720
  const domainPath = await getResourcePath(directory, id, version);
679
- const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
721
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
680
722
  if (domain.domains === void 0) {
681
723
  domain.domains = [];
682
724
  }
@@ -691,7 +733,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
691
733
  var addEntityToDomain = (directory) => async (id, entity, version) => {
692
734
  let domain = await getDomain(directory)(id, version);
693
735
  const domainPath = await getResourcePath(directory, id, version);
694
- const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
736
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
695
737
  if (domain.entities === void 0) {
696
738
  domain.entities = [];
697
739
  }
@@ -706,12 +748,12 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
706
748
 
707
749
  // src/channels.ts
708
750
  var import_promises7 = __toESM(require("fs/promises"));
709
- var import_node_path8 = require("path");
751
+ var import_node_path9 = require("path");
710
752
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
711
753
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
712
754
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
713
- var rmChannel = (directory) => async (path5) => {
714
- await import_promises7.default.rm((0, import_node_path8.join)(directory, path5), { recursive: true });
755
+ var rmChannel = (directory) => async (path6) => {
756
+ await import_promises7.default.rm((0, import_node_path9.join)(directory, path6), { recursive: true });
715
757
  };
716
758
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
717
759
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -741,7 +783,7 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
741
783
  const { getMessage, rmMessageById, writeMessage } = functions[collection];
742
784
  const message = await getMessage(directory)(_message.id, _message.version);
743
785
  const messagePath = await getResourcePath(directory, _message.id, _message.version);
744
- const extension = (0, import_node_path8.extname)(messagePath?.fullPath || "");
786
+ const extension = (0, import_node_path9.extname)(messagePath?.fullPath || "");
745
787
  if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
746
788
  if (message.channels === void 0) {
747
789
  message.channels = [];
@@ -752,18 +794,18 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
752
794
  if (!existingResource) {
753
795
  throw new Error(`Cannot find message ${id} in the catalog`);
754
796
  }
755
- const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
756
- const pathToResource = (0, import_node_path8.join)(path5, collection);
797
+ const path6 = existingResource.split(`/[\\/]+${collection}`)[0];
798
+ const pathToResource = (0, import_node_path9.join)(path6, collection);
757
799
  await rmMessageById(directory)(_message.id, _message.version, true);
758
800
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
759
801
  };
760
802
 
761
803
  // src/messages.ts
762
- var import_node_path9 = require("path");
804
+ var import_node_path10 = require("path");
763
805
  var import_gray_matter4 = __toESM(require("gray-matter"));
764
806
  var import_semver3 = require("semver");
765
- var getMessageBySchemaPath = (directory) => async (path5, options) => {
766
- const pathToMessage = (0, import_node_path9.dirname)(path5);
807
+ var getMessageBySchemaPath = (directory) => async (path6, options) => {
808
+ const pathToMessage = (0, import_node_path10.dirname)(path6);
767
809
  try {
768
810
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
769
811
  if (!files || files.length === 0) {
@@ -835,18 +877,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
835
877
  }
836
878
  return { producers, consumers };
837
879
  };
838
- var getConsumersOfSchema = (directory) => async (path5) => {
880
+ var getConsumersOfSchema = (directory) => async (path6) => {
839
881
  try {
840
- const message = await getMessageBySchemaPath(directory)(path5);
882
+ const message = await getMessageBySchemaPath(directory)(path6);
841
883
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
842
884
  return consumers;
843
885
  } catch (error) {
844
886
  return [];
845
887
  }
846
888
  };
847
- var getProducersOfSchema = (directory) => async (path5) => {
889
+ var getProducersOfSchema = (directory) => async (path6) => {
848
890
  try {
849
- const message = await getMessageBySchemaPath(directory)(path5);
891
+ const message = await getMessageBySchemaPath(directory)(path6);
850
892
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
851
893
  return producers;
852
894
  } catch (error) {
@@ -855,13 +897,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
855
897
  };
856
898
 
857
899
  // src/custom-docs.ts
858
- var import_node_path10 = __toESM(require("path"));
900
+ var import_node_path11 = __toESM(require("path"));
859
901
  var import_node_fs4 = __toESM(require("fs"));
860
902
  var import_promises8 = __toESM(require("fs/promises"));
861
903
  var import_gray_matter5 = __toESM(require("gray-matter"));
862
904
  var import_slugify = __toESM(require("slugify"));
863
905
  var getCustomDoc = (directory) => async (filePath) => {
864
- const fullPath = import_node_path10.default.join(directory, filePath);
906
+ const fullPath = import_node_path11.default.join(directory, filePath);
865
907
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
866
908
  const fileExists = import_node_fs4.default.existsSync(fullPathWithExtension);
867
909
  if (!fileExists) {
@@ -880,26 +922,26 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
880
922
  const { fileName, ...rest } = customDoc;
881
923
  const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
882
924
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
883
- const fullPath = import_node_path10.default.join(directory, options.path || "", withExtension);
884
- import_node_fs4.default.mkdirSync(import_node_path10.default.dirname(fullPath), { recursive: true });
925
+ const fullPath = import_node_path11.default.join(directory, options.path || "", withExtension);
926
+ import_node_fs4.default.mkdirSync(import_node_path11.default.dirname(fullPath), { recursive: true });
885
927
  const document = import_gray_matter5.default.stringify(customDoc.markdown.trim(), rest);
886
928
  import_node_fs4.default.writeFileSync(fullPath, document);
887
929
  };
888
930
  var rmCustomDoc = (directory) => async (filePath) => {
889
931
  const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
890
- await import_promises8.default.rm((0, import_node_path10.join)(directory, withExtension), { recursive: true });
932
+ await import_promises8.default.rm((0, import_node_path11.join)(directory, withExtension), { recursive: true });
891
933
  };
892
934
 
893
935
  // src/teams.ts
894
936
  var import_promises9 = __toESM(require("fs/promises"));
895
937
  var import_node_fs6 = __toESM(require("fs"));
896
- var import_node_path12 = require("path");
938
+ var import_node_path13 = require("path");
897
939
  var import_gray_matter7 = __toESM(require("gray-matter"));
898
- var import_node_path13 = __toESM(require("path"));
940
+ var import_node_path14 = __toESM(require("path"));
899
941
 
900
942
  // src/users.ts
901
943
  var import_node_fs5 = __toESM(require("fs"));
902
- var import_node_path11 = require("path");
944
+ var import_node_path12 = require("path");
903
945
  var import_gray_matter6 = __toESM(require("gray-matter"));
904
946
  var getUser = (catalogDir) => async (id) => {
905
947
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
@@ -937,11 +979,11 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
937
979
  }
938
980
  const { markdown, ...frontmatter } = resource;
939
981
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
940
- import_node_fs5.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
941
- import_node_fs5.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
982
+ import_node_fs5.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
983
+ import_node_fs5.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
942
984
  };
943
985
  var rmUserById = (catalogDir) => async (id) => {
944
- import_node_fs5.default.rmSync((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
986
+ import_node_fs5.default.rmSync((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
945
987
  };
946
988
 
947
989
  // src/teams.ts
@@ -979,11 +1021,11 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
979
1021
  }
980
1022
  const { markdown, ...frontmatter } = resource;
981
1023
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
982
- import_node_fs6.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
983
- import_node_fs6.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
1024
+ import_node_fs6.default.mkdirSync((0, import_node_path13.join)(catalogDir, ""), { recursive: true });
1025
+ import_node_fs6.default.writeFileSync((0, import_node_path13.join)(catalogDir, "", `${resource.id}.mdx`), document);
984
1026
  };
985
1027
  var rmTeamById = (catalogDir) => async (id) => {
986
- await import_promises9.default.rm((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
1028
+ await import_promises9.default.rm((0, import_node_path13.join)(catalogDir, `${id}.mdx`), { recursive: true });
987
1029
  };
988
1030
  var getOwnersForResource = (catalogDir) => async (id, version) => {
989
1031
  const resource = await getResource(catalogDir, id, version);
@@ -991,11 +1033,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
991
1033
  if (!resource) return [];
992
1034
  if (!resource.owners) return [];
993
1035
  for (const owner of resource.owners) {
994
- const team = await getTeam(import_node_path13.default.join(catalogDir, "teams"))(owner);
1036
+ const team = await getTeam(import_node_path14.default.join(catalogDir, "teams"))(owner);
995
1037
  if (team) {
996
1038
  owners.push(team);
997
1039
  } else {
998
- const user = await getUser(import_node_path13.default.join(catalogDir, "users"))(owner);
1040
+ const user = await getUser(import_node_path14.default.join(catalogDir, "users"))(owner);
999
1041
  if (user) {
1000
1042
  owners.push(user);
1001
1043
  }
@@ -1006,11 +1048,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
1006
1048
 
1007
1049
  // src/eventcatalog.ts
1008
1050
  var import_fs = __toESM(require("fs"));
1009
- var import_node_path14 = __toESM(require("path"));
1051
+ var import_node_path15 = __toESM(require("path"));
1010
1052
  var DUMP_VERSION = "0.0.1";
1011
1053
  var getEventCatalogVersion = async (catalogDir) => {
1012
1054
  try {
1013
- const packageJson = import_fs.default.readFileSync((0, import_node_path14.join)(catalogDir, "package.json"), "utf8");
1055
+ const packageJson = import_fs.default.readFileSync((0, import_node_path15.join)(catalogDir, "package.json"), "utf8");
1014
1056
  const packageJsonObject = JSON.parse(packageJson);
1015
1057
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
1016
1058
  } catch (error) {
@@ -1023,7 +1065,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1023
1065
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1024
1066
  let schema = "";
1025
1067
  if (resource.schemaPath && resourcePath?.fullPath) {
1026
- const pathToSchema = import_node_path14.default.join(import_node_path14.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1068
+ const pathToSchema = import_node_path15.default.join(import_node_path15.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1027
1069
  if (import_fs.default.existsSync(pathToSchema)) {
1028
1070
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1029
1071
  }
@@ -1044,8 +1086,8 @@ var filterCollection = (collection, options) => {
1044
1086
  };
1045
1087
  var getEventCatalogConfigurationFile = (directory) => async () => {
1046
1088
  try {
1047
- const path5 = (0, import_node_path14.join)(directory, "eventcatalog.config.js");
1048
- const configModule = await import(path5);
1089
+ const path6 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
1090
+ const configModule = await import(path6);
1049
1091
  return configModule.default;
1050
1092
  } catch (error) {
1051
1093
  console.error("Error getting event catalog configuration file", error);
@@ -1103,7 +1145,7 @@ var dumpCatalog = (directory) => async (options) => {
1103
1145
 
1104
1146
  // src/entities.ts
1105
1147
  var import_promises10 = __toESM(require("fs/promises"));
1106
- var import_node_path15 = require("path");
1148
+ var import_node_path16 = require("path");
1107
1149
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
1108
1150
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
1109
1151
  var writeEntity = (directory) => async (entity, options = {
@@ -1111,8 +1153,8 @@ var writeEntity = (directory) => async (entity, options = {
1111
1153
  override: false,
1112
1154
  format: "mdx"
1113
1155
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1114
- var rmEntity = (directory) => async (path5) => {
1115
- await import_promises10.default.rm((0, import_node_path15.join)(directory, path5), { recursive: true });
1156
+ var rmEntity = (directory) => async (path6) => {
1157
+ await import_promises10.default.rm((0, import_node_path16.join)(directory, path6), { recursive: true });
1116
1158
  };
1117
1159
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1118
1160
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1125,7 +1167,7 @@ var entityHasVersion = (directory) => async (id, version) => {
1125
1167
 
1126
1168
  // src/containers.ts
1127
1169
  var import_promises11 = __toESM(require("fs/promises"));
1128
- var import_node_path16 = require("path");
1170
+ var import_node_path17 = require("path");
1129
1171
  var getContainer = (directory) => async (id, version) => getResource(directory, id, version, { type: "container" });
1130
1172
  var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
1131
1173
  var writeContainer = (directory) => async (data, options = {
@@ -1134,8 +1176,8 @@ var writeContainer = (directory) => async (data, options = {
1134
1176
  format: "mdx"
1135
1177
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1136
1178
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
1137
- var rmContainer = (directory) => async (path5) => {
1138
- await import_promises11.default.rm((0, import_node_path16.join)(directory, path5), { recursive: true });
1179
+ var rmContainer = (directory) => async (path6) => {
1180
+ await import_promises11.default.rm((0, import_node_path17.join)(directory, path6), { recursive: true });
1139
1181
  };
1140
1182
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
1141
1183
  await rmResourceById(directory, id, version, { type: "container", persistFiles });
@@ -1151,7 +1193,7 @@ var writeContainerToService = (directory) => async (container, service, options
1151
1193
  throw new Error("Service not found");
1152
1194
  }
1153
1195
  let pathForContainer = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/containers` : `${resourcePath.directory}/containers`;
1154
- pathForContainer = (0, import_node_path16.join)(pathForContainer, container.id);
1196
+ pathForContainer = (0, import_node_path17.join)(pathForContainer, container.id);
1155
1197
  await writeResource(directory, { ...container }, { ...options, path: pathForContainer, type: "container" });
1156
1198
  };
1157
1199
 
@@ -1167,7 +1209,7 @@ var addFileToDataStore = addFileToContainer;
1167
1209
  var writeDataStoreToService = writeContainerToService;
1168
1210
 
1169
1211
  // src/index.ts
1170
- var index_default = (path5) => {
1212
+ var index_default = (path6) => {
1171
1213
  return {
1172
1214
  /**
1173
1215
  * Returns an events from EventCatalog
@@ -1175,13 +1217,13 @@ var index_default = (path5) => {
1175
1217
  * @param version - Optional id of the version to get (supports semver)
1176
1218
  * @returns Event|Undefined
1177
1219
  */
1178
- getEvent: getEvent((0, import_node_path17.join)(path5)),
1220
+ getEvent: getEvent((0, import_node_path18.join)(path6)),
1179
1221
  /**
1180
1222
  * Returns all events from EventCatalog
1181
1223
  * @param latestOnly - optional boolean, set to true to get only latest versions
1182
1224
  * @returns Event[]|Undefined
1183
1225
  */
1184
- getEvents: getEvents((0, import_node_path17.join)(path5)),
1226
+ getEvents: getEvents((0, import_node_path18.join)(path6)),
1185
1227
  /**
1186
1228
  * Adds an event to EventCatalog
1187
1229
  *
@@ -1189,7 +1231,7 @@ var index_default = (path5) => {
1189
1231
  * @param options - Optional options to write the event
1190
1232
  *
1191
1233
  */
1192
- writeEvent: writeEvent((0, import_node_path17.join)(path5, "events")),
1234
+ writeEvent: writeEvent((0, import_node_path18.join)(path6, "events")),
1193
1235
  /**
1194
1236
  * Adds an event to a service in EventCatalog
1195
1237
  *
@@ -1198,26 +1240,26 @@ var index_default = (path5) => {
1198
1240
  * @param options - Optional options to write the event
1199
1241
  *
1200
1242
  */
1201
- writeEventToService: writeEventToService((0, import_node_path17.join)(path5)),
1243
+ writeEventToService: writeEventToService((0, import_node_path18.join)(path6)),
1202
1244
  /**
1203
1245
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1204
1246
  *
1205
1247
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1206
1248
  *
1207
1249
  */
1208
- rmEvent: rmEvent((0, import_node_path17.join)(path5, "events")),
1250
+ rmEvent: rmEvent((0, import_node_path18.join)(path6, "events")),
1209
1251
  /**
1210
1252
  * Remove an event by an Event id
1211
1253
  *
1212
1254
  * @param id - The id of the event you want to remove
1213
1255
  *
1214
1256
  */
1215
- rmEventById: rmEventById((0, import_node_path17.join)(path5)),
1257
+ rmEventById: rmEventById((0, import_node_path18.join)(path6)),
1216
1258
  /**
1217
1259
  * Moves a given event id to the version directory
1218
1260
  * @param directory
1219
1261
  */
1220
- versionEvent: versionEvent((0, import_node_path17.join)(path5)),
1262
+ versionEvent: versionEvent((0, import_node_path18.join)(path6)),
1221
1263
  /**
1222
1264
  * Adds a file to the given event
1223
1265
  * @param id - The id of the event to add the file to
@@ -1225,7 +1267,7 @@ var index_default = (path5) => {
1225
1267
  * @param version - Optional version of the event to add the file to
1226
1268
  * @returns
1227
1269
  */
1228
- addFileToEvent: addFileToEvent((0, import_node_path17.join)(path5)),
1270
+ addFileToEvent: addFileToEvent((0, import_node_path18.join)(path6)),
1229
1271
  /**
1230
1272
  * Adds a schema to the given event
1231
1273
  * @param id - The id of the event to add the schema to
@@ -1233,14 +1275,14 @@ var index_default = (path5) => {
1233
1275
  * @param version - Optional version of the event to add the schema to
1234
1276
  * @returns
1235
1277
  */
1236
- addSchemaToEvent: addSchemaToEvent((0, import_node_path17.join)(path5)),
1278
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path18.join)(path6)),
1237
1279
  /**
1238
1280
  * Check to see if an event version exists
1239
1281
  * @param id - The id of the event
1240
1282
  * @param version - The version of the event (supports semver)
1241
1283
  * @returns
1242
1284
  */
1243
- eventHasVersion: eventHasVersion((0, import_node_path17.join)(path5)),
1285
+ eventHasVersion: eventHasVersion((0, import_node_path18.join)(path6)),
1244
1286
  /**
1245
1287
  * ================================
1246
1288
  * Commands
@@ -1252,13 +1294,13 @@ var index_default = (path5) => {
1252
1294
  * @param version - Optional id of the version to get (supports semver)
1253
1295
  * @returns Command|Undefined
1254
1296
  */
1255
- getCommand: getCommand((0, import_node_path17.join)(path5)),
1297
+ getCommand: getCommand((0, import_node_path18.join)(path6)),
1256
1298
  /**
1257
1299
  * Returns all commands from EventCatalog
1258
1300
  * @param latestOnly - optional boolean, set to true to get only latest versions
1259
1301
  * @returns Command[]|Undefined
1260
1302
  */
1261
- getCommands: getCommands((0, import_node_path17.join)(path5)),
1303
+ getCommands: getCommands((0, import_node_path18.join)(path6)),
1262
1304
  /**
1263
1305
  * Adds an command to EventCatalog
1264
1306
  *
@@ -1266,7 +1308,7 @@ var index_default = (path5) => {
1266
1308
  * @param options - Optional options to write the command
1267
1309
  *
1268
1310
  */
1269
- writeCommand: writeCommand((0, import_node_path17.join)(path5, "commands")),
1311
+ writeCommand: writeCommand((0, import_node_path18.join)(path6, "commands")),
1270
1312
  /**
1271
1313
  * Adds a command to a service in EventCatalog
1272
1314
  *
@@ -1275,26 +1317,26 @@ var index_default = (path5) => {
1275
1317
  * @param options - Optional options to write the command
1276
1318
  *
1277
1319
  */
1278
- writeCommandToService: writeCommandToService((0, import_node_path17.join)(path5)),
1320
+ writeCommandToService: writeCommandToService((0, import_node_path18.join)(path6)),
1279
1321
  /**
1280
1322
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1281
1323
  *
1282
1324
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1283
1325
  *
1284
1326
  */
1285
- rmCommand: rmCommand((0, import_node_path17.join)(path5, "commands")),
1327
+ rmCommand: rmCommand((0, import_node_path18.join)(path6, "commands")),
1286
1328
  /**
1287
1329
  * Remove an command by an Event id
1288
1330
  *
1289
1331
  * @param id - The id of the command you want to remove
1290
1332
  *
1291
1333
  */
1292
- rmCommandById: rmCommandById((0, import_node_path17.join)(path5)),
1334
+ rmCommandById: rmCommandById((0, import_node_path18.join)(path6)),
1293
1335
  /**
1294
1336
  * Moves a given command id to the version directory
1295
1337
  * @param directory
1296
1338
  */
1297
- versionCommand: versionCommand((0, import_node_path17.join)(path5)),
1339
+ versionCommand: versionCommand((0, import_node_path18.join)(path6)),
1298
1340
  /**
1299
1341
  * Adds a file to the given command
1300
1342
  * @param id - The id of the command to add the file to
@@ -1302,7 +1344,7 @@ var index_default = (path5) => {
1302
1344
  * @param version - Optional version of the command to add the file to
1303
1345
  * @returns
1304
1346
  */
1305
- addFileToCommand: addFileToCommand((0, import_node_path17.join)(path5)),
1347
+ addFileToCommand: addFileToCommand((0, import_node_path18.join)(path6)),
1306
1348
  /**
1307
1349
  * Adds a schema to the given command
1308
1350
  * @param id - The id of the command to add the schema to
@@ -1310,14 +1352,14 @@ var index_default = (path5) => {
1310
1352
  * @param version - Optional version of the command to add the schema to
1311
1353
  * @returns
1312
1354
  */
1313
- addSchemaToCommand: addSchemaToCommand((0, import_node_path17.join)(path5)),
1355
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path18.join)(path6)),
1314
1356
  /**
1315
1357
  * Check to see if a command version exists
1316
1358
  * @param id - The id of the command
1317
1359
  * @param version - The version of the command (supports semver)
1318
1360
  * @returns
1319
1361
  */
1320
- commandHasVersion: commandHasVersion((0, import_node_path17.join)(path5)),
1362
+ commandHasVersion: commandHasVersion((0, import_node_path18.join)(path6)),
1321
1363
  /**
1322
1364
  * ================================
1323
1365
  * Queries
@@ -1329,13 +1371,13 @@ var index_default = (path5) => {
1329
1371
  * @param version - Optional id of the version to get (supports semver)
1330
1372
  * @returns Query|Undefined
1331
1373
  */
1332
- getQuery: getQuery((0, import_node_path17.join)(path5)),
1374
+ getQuery: getQuery((0, import_node_path18.join)(path6)),
1333
1375
  /**
1334
1376
  * Returns all queries from EventCatalog
1335
1377
  * @param latestOnly - optional boolean, set to true to get only latest versions
1336
1378
  * @returns Query[]|Undefined
1337
1379
  */
1338
- getQueries: getQueries((0, import_node_path17.join)(path5)),
1380
+ getQueries: getQueries((0, import_node_path18.join)(path6)),
1339
1381
  /**
1340
1382
  * Adds a query to EventCatalog
1341
1383
  *
@@ -1343,7 +1385,7 @@ var index_default = (path5) => {
1343
1385
  * @param options - Optional options to write the event
1344
1386
  *
1345
1387
  */
1346
- writeQuery: writeQuery((0, import_node_path17.join)(path5, "queries")),
1388
+ writeQuery: writeQuery((0, import_node_path18.join)(path6, "queries")),
1347
1389
  /**
1348
1390
  * Adds a query to a service in EventCatalog
1349
1391
  *
@@ -1352,26 +1394,26 @@ var index_default = (path5) => {
1352
1394
  * @param options - Optional options to write the query
1353
1395
  *
1354
1396
  */
1355
- writeQueryToService: writeQueryToService((0, import_node_path17.join)(path5)),
1397
+ writeQueryToService: writeQueryToService((0, import_node_path18.join)(path6)),
1356
1398
  /**
1357
1399
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1358
1400
  *
1359
1401
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1360
1402
  *
1361
1403
  */
1362
- rmQuery: rmQuery((0, import_node_path17.join)(path5, "queries")),
1404
+ rmQuery: rmQuery((0, import_node_path18.join)(path6, "queries")),
1363
1405
  /**
1364
1406
  * Remove a query by a Query id
1365
1407
  *
1366
1408
  * @param id - The id of the query you want to remove
1367
1409
  *
1368
1410
  */
1369
- rmQueryById: rmQueryById((0, import_node_path17.join)(path5)),
1411
+ rmQueryById: rmQueryById((0, import_node_path18.join)(path6)),
1370
1412
  /**
1371
1413
  * Moves a given query id to the version directory
1372
1414
  * @param directory
1373
1415
  */
1374
- versionQuery: versionQuery((0, import_node_path17.join)(path5)),
1416
+ versionQuery: versionQuery((0, import_node_path18.join)(path6)),
1375
1417
  /**
1376
1418
  * Adds a file to the given query
1377
1419
  * @param id - The id of the query to add the file to
@@ -1379,7 +1421,7 @@ var index_default = (path5) => {
1379
1421
  * @param version - Optional version of the query to add the file to
1380
1422
  * @returns
1381
1423
  */
1382
- addFileToQuery: addFileToQuery((0, import_node_path17.join)(path5)),
1424
+ addFileToQuery: addFileToQuery((0, import_node_path18.join)(path6)),
1383
1425
  /**
1384
1426
  * Adds a schema to the given query
1385
1427
  * @param id - The id of the query to add the schema to
@@ -1387,14 +1429,14 @@ var index_default = (path5) => {
1387
1429
  * @param version - Optional version of the query to add the schema to
1388
1430
  * @returns
1389
1431
  */
1390
- addSchemaToQuery: addSchemaToQuery((0, import_node_path17.join)(path5)),
1432
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path18.join)(path6)),
1391
1433
  /**
1392
1434
  * Check to see if an query version exists
1393
1435
  * @param id - The id of the query
1394
1436
  * @param version - The version of the query (supports semver)
1395
1437
  * @returns
1396
1438
  */
1397
- queryHasVersion: queryHasVersion((0, import_node_path17.join)(path5)),
1439
+ queryHasVersion: queryHasVersion((0, import_node_path18.join)(path6)),
1398
1440
  /**
1399
1441
  * ================================
1400
1442
  * Channels
@@ -1406,13 +1448,13 @@ var index_default = (path5) => {
1406
1448
  * @param version - Optional id of the version to get (supports semver)
1407
1449
  * @returns Channel|Undefined
1408
1450
  */
1409
- getChannel: getChannel((0, import_node_path17.join)(path5)),
1451
+ getChannel: getChannel((0, import_node_path18.join)(path6)),
1410
1452
  /**
1411
1453
  * Returns all channels from EventCatalog
1412
1454
  * @param latestOnly - optional boolean, set to true to get only latest versions
1413
1455
  * @returns Channel[]|Undefined
1414
1456
  */
1415
- getChannels: getChannels((0, import_node_path17.join)(path5)),
1457
+ getChannels: getChannels((0, import_node_path18.join)(path6)),
1416
1458
  /**
1417
1459
  * Adds an channel to EventCatalog
1418
1460
  *
@@ -1420,33 +1462,33 @@ var index_default = (path5) => {
1420
1462
  * @param options - Optional options to write the channel
1421
1463
  *
1422
1464
  */
1423
- writeChannel: writeChannel((0, import_node_path17.join)(path5, "channels")),
1465
+ writeChannel: writeChannel((0, import_node_path18.join)(path6, "channels")),
1424
1466
  /**
1425
1467
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1426
1468
  *
1427
1469
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1428
1470
  *
1429
1471
  */
1430
- rmChannel: rmChannel((0, import_node_path17.join)(path5, "channels")),
1472
+ rmChannel: rmChannel((0, import_node_path18.join)(path6, "channels")),
1431
1473
  /**
1432
1474
  * Remove an channel by an Event id
1433
1475
  *
1434
1476
  * @param id - The id of the channel you want to remove
1435
1477
  *
1436
1478
  */
1437
- rmChannelById: rmChannelById((0, import_node_path17.join)(path5)),
1479
+ rmChannelById: rmChannelById((0, import_node_path18.join)(path6)),
1438
1480
  /**
1439
1481
  * Moves a given channel id to the version directory
1440
1482
  * @param directory
1441
1483
  */
1442
- versionChannel: versionChannel((0, import_node_path17.join)(path5)),
1484
+ versionChannel: versionChannel((0, import_node_path18.join)(path6)),
1443
1485
  /**
1444
1486
  * Check to see if a channel version exists
1445
1487
  * @param id - The id of the channel
1446
1488
  * @param version - The version of the channel (supports semver)
1447
1489
  * @returns
1448
1490
  */
1449
- channelHasVersion: channelHasVersion((0, import_node_path17.join)(path5)),
1491
+ channelHasVersion: channelHasVersion((0, import_node_path18.join)(path6)),
1450
1492
  /**
1451
1493
  * Add a channel to an event
1452
1494
  *
@@ -1463,7 +1505,7 @@ var index_default = (path5) => {
1463
1505
  *
1464
1506
  * ```
1465
1507
  */
1466
- addEventToChannel: addMessageToChannel((0, import_node_path17.join)(path5), "events"),
1508
+ addEventToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "events"),
1467
1509
  /**
1468
1510
  * Add a channel to an command
1469
1511
  *
@@ -1480,7 +1522,7 @@ var index_default = (path5) => {
1480
1522
  *
1481
1523
  * ```
1482
1524
  */
1483
- addCommandToChannel: addMessageToChannel((0, import_node_path17.join)(path5), "commands"),
1525
+ addCommandToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "commands"),
1484
1526
  /**
1485
1527
  * Add a channel to an query
1486
1528
  *
@@ -1497,7 +1539,7 @@ var index_default = (path5) => {
1497
1539
  *
1498
1540
  * ```
1499
1541
  */
1500
- addQueryToChannel: addMessageToChannel((0, import_node_path17.join)(path5), "queries"),
1542
+ addQueryToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "queries"),
1501
1543
  /**
1502
1544
  * ================================
1503
1545
  * SERVICES
@@ -1510,14 +1552,14 @@ var index_default = (path5) => {
1510
1552
  * @param options - Optional options to write the event
1511
1553
  *
1512
1554
  */
1513
- writeService: writeService((0, import_node_path17.join)(path5, "services")),
1555
+ writeService: writeService((0, import_node_path18.join)(path6, "services")),
1514
1556
  /**
1515
1557
  * Adds a versioned service to EventCatalog
1516
1558
  *
1517
1559
  * @param service - The service to write
1518
1560
  *
1519
1561
  */
1520
- writeVersionedService: writeVersionedService((0, import_node_path17.join)(path5, "services")),
1562
+ writeVersionedService: writeVersionedService((0, import_node_path18.join)(path6, "services")),
1521
1563
  /**
1522
1564
  * Adds a service to a domain in EventCatalog
1523
1565
  *
@@ -1526,45 +1568,45 @@ var index_default = (path5) => {
1526
1568
  * @param options - Optional options to write the event
1527
1569
  *
1528
1570
  */
1529
- writeServiceToDomain: writeServiceToDomain((0, import_node_path17.join)(path5, "domains")),
1571
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path18.join)(path6, "domains")),
1530
1572
  /**
1531
1573
  * Returns a service from EventCatalog
1532
1574
  * @param id - The id of the service to retrieve
1533
1575
  * @param version - Optional id of the version to get (supports semver)
1534
1576
  * @returns Service|Undefined
1535
1577
  */
1536
- getService: getService((0, import_node_path17.join)(path5)),
1578
+ getService: getService((0, import_node_path18.join)(path6)),
1537
1579
  /**
1538
1580
  * Returns a service from EventCatalog by it's path.
1539
1581
  * @param path - The path to the service to retrieve
1540
1582
  * @returns Service|Undefined
1541
1583
  */
1542
- getServiceByPath: getServiceByPath((0, import_node_path17.join)(path5)),
1584
+ getServiceByPath: getServiceByPath((0, import_node_path18.join)(path6)),
1543
1585
  /**
1544
1586
  * Returns all services from EventCatalog
1545
1587
  * @param latestOnly - optional boolean, set to true to get only latest versions
1546
1588
  * @returns Service[]|Undefined
1547
1589
  */
1548
- getServices: getServices((0, import_node_path17.join)(path5)),
1590
+ getServices: getServices((0, import_node_path18.join)(path6)),
1549
1591
  /**
1550
1592
  * Moves a given service id to the version directory
1551
1593
  * @param directory
1552
1594
  */
1553
- versionService: versionService((0, import_node_path17.join)(path5)),
1595
+ versionService: versionService((0, import_node_path18.join)(path6)),
1554
1596
  /**
1555
1597
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1556
1598
  *
1557
1599
  * @param path - The path to your service, e.g. `/InventoryService`
1558
1600
  *
1559
1601
  */
1560
- rmService: rmService((0, import_node_path17.join)(path5, "services")),
1602
+ rmService: rmService((0, import_node_path18.join)(path6, "services")),
1561
1603
  /**
1562
1604
  * Remove an service by an service id
1563
1605
  *
1564
1606
  * @param id - The id of the service you want to remove
1565
1607
  *
1566
1608
  */
1567
- rmServiceById: rmServiceById((0, import_node_path17.join)(path5)),
1609
+ rmServiceById: rmServiceById((0, import_node_path18.join)(path6)),
1568
1610
  /**
1569
1611
  * Adds a file to the given service
1570
1612
  * @param id - The id of the service to add the file to
@@ -1572,21 +1614,21 @@ var index_default = (path5) => {
1572
1614
  * @param version - Optional version of the service to add the file to
1573
1615
  * @returns
1574
1616
  */
1575
- addFileToService: addFileToService((0, import_node_path17.join)(path5)),
1617
+ addFileToService: addFileToService((0, import_node_path18.join)(path6)),
1576
1618
  /**
1577
1619
  * Returns the specifications for a given service
1578
1620
  * @param id - The id of the service to retrieve the specifications for
1579
1621
  * @param version - Optional version of the service
1580
1622
  * @returns
1581
1623
  */
1582
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path17.join)(path5)),
1624
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path18.join)(path6)),
1583
1625
  /**
1584
1626
  * Check to see if a service version exists
1585
1627
  * @param id - The id of the service
1586
1628
  * @param version - The version of the service (supports semver)
1587
1629
  * @returns
1588
1630
  */
1589
- serviceHasVersion: serviceHasVersion((0, import_node_path17.join)(path5)),
1631
+ serviceHasVersion: serviceHasVersion((0, import_node_path18.join)(path6)),
1590
1632
  /**
1591
1633
  * Add an event to a service by it's id.
1592
1634
  *
@@ -1606,7 +1648,24 @@ var index_default = (path5) => {
1606
1648
  *
1607
1649
  * ```
1608
1650
  */
1609
- addEventToService: addMessageToService((0, import_node_path17.join)(path5)),
1651
+ addEventToService: addMessageToService((0, import_node_path18.join)(path6)),
1652
+ /**
1653
+ * Add a data store to a service by it's id.
1654
+ *
1655
+ * Optionally specify a version to add the data store to a specific version of the service.
1656
+ *
1657
+ * @example
1658
+ * ```ts
1659
+ * import utils from '@eventcatalog/utils';
1660
+ *
1661
+ * const { addDataStoreToService } = utils('/path/to/eventcatalog');
1662
+ *
1663
+ * // adds a new data store (orders-db) that the InventoryService will write to
1664
+ * await addDataStoreToService('InventoryService', 'writesTo', { id: 'orders-db', version: '2.0.0' });
1665
+ *
1666
+ * ```
1667
+ */
1668
+ addDataStoreToService: addDataStoreToService((0, import_node_path18.join)(path6)),
1610
1669
  /**
1611
1670
  * Add a command to a service by it's id.
1612
1671
  *
@@ -1626,7 +1685,7 @@ var index_default = (path5) => {
1626
1685
  *
1627
1686
  * ```
1628
1687
  */
1629
- addCommandToService: addMessageToService((0, import_node_path17.join)(path5)),
1688
+ addCommandToService: addMessageToService((0, import_node_path18.join)(path6)),
1630
1689
  /**
1631
1690
  * Add a query to a service by it's id.
1632
1691
  *
@@ -1646,7 +1705,7 @@ var index_default = (path5) => {
1646
1705
  *
1647
1706
  * ```
1648
1707
  */
1649
- addQueryToService: addMessageToService((0, import_node_path17.join)(path5)),
1708
+ addQueryToService: addMessageToService((0, import_node_path18.join)(path6)),
1650
1709
  /**
1651
1710
  * Add an entity to a service by its id.
1652
1711
  *
@@ -1664,7 +1723,7 @@ var index_default = (path5) => {
1664
1723
  *
1665
1724
  * ```
1666
1725
  */
1667
- addEntityToService: addEntityToService((0, import_node_path17.join)(path5)),
1726
+ addEntityToService: addEntityToService((0, import_node_path18.join)(path6)),
1668
1727
  /**
1669
1728
  * Check to see if a service exists by it's path.
1670
1729
  *
@@ -1681,13 +1740,13 @@ var index_default = (path5) => {
1681
1740
  * @param path - The path to the service to check
1682
1741
  * @returns boolean
1683
1742
  */
1684
- isService: isService((0, import_node_path17.join)(path5)),
1743
+ isService: isService((0, import_node_path18.join)(path6)),
1685
1744
  /**
1686
1745
  * Converts a file to a service.
1687
1746
  * @param file - The file to convert to a service.
1688
1747
  * @returns The service.
1689
1748
  */
1690
- toService: toService((0, import_node_path17.join)(path5)),
1749
+ toService: toService((0, import_node_path18.join)(path6)),
1691
1750
  /**
1692
1751
  * ================================
1693
1752
  * Domains
@@ -1700,39 +1759,39 @@ var index_default = (path5) => {
1700
1759
  * @param options - Optional options to write the event
1701
1760
  *
1702
1761
  */
1703
- writeDomain: writeDomain((0, import_node_path17.join)(path5, "domains")),
1762
+ writeDomain: writeDomain((0, import_node_path18.join)(path6, "domains")),
1704
1763
  /**
1705
1764
  * Returns a domain from EventCatalog
1706
1765
  * @param id - The id of the domain to retrieve
1707
1766
  * @param version - Optional id of the version to get (supports semver)
1708
1767
  * @returns Domain|Undefined
1709
1768
  */
1710
- getDomain: getDomain((0, import_node_path17.join)(path5, "domains")),
1769
+ getDomain: getDomain((0, import_node_path18.join)(path6, "domains")),
1711
1770
  /**
1712
1771
  * Returns all domains from EventCatalog
1713
1772
  * @param latestOnly - optional boolean, set to true to get only latest versions
1714
1773
  * @returns Domain[]|Undefined
1715
1774
  */
1716
- getDomains: getDomains((0, import_node_path17.join)(path5)),
1775
+ getDomains: getDomains((0, import_node_path18.join)(path6)),
1717
1776
  /**
1718
1777
  * Moves a given domain id to the version directory
1719
1778
  * @param directory
1720
1779
  */
1721
- versionDomain: versionDomain((0, import_node_path17.join)(path5, "domains")),
1780
+ versionDomain: versionDomain((0, import_node_path18.join)(path6, "domains")),
1722
1781
  /**
1723
1782
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1724
1783
  *
1725
1784
  * @param path - The path to your domain, e.g. `/Payment`
1726
1785
  *
1727
1786
  */
1728
- rmDomain: rmDomain((0, import_node_path17.join)(path5, "domains")),
1787
+ rmDomain: rmDomain((0, import_node_path18.join)(path6, "domains")),
1729
1788
  /**
1730
1789
  * Remove an service by an domain id
1731
1790
  *
1732
1791
  * @param id - The id of the domain you want to remove
1733
1792
  *
1734
1793
  */
1735
- rmDomainById: rmDomainById((0, import_node_path17.join)(path5, "domains")),
1794
+ rmDomainById: rmDomainById((0, import_node_path18.join)(path6, "domains")),
1736
1795
  /**
1737
1796
  * Adds a file to the given domain
1738
1797
  * @param id - The id of the domain to add the file to
@@ -1740,28 +1799,28 @@ var index_default = (path5) => {
1740
1799
  * @param version - Optional version of the domain to add the file to
1741
1800
  * @returns
1742
1801
  */
1743
- addFileToDomain: addFileToDomain((0, import_node_path17.join)(path5, "domains")),
1802
+ addFileToDomain: addFileToDomain((0, import_node_path18.join)(path6, "domains")),
1744
1803
  /**
1745
1804
  * Adds an ubiquitous language dictionary to a domain
1746
1805
  * @param id - The id of the domain to add the ubiquitous language to
1747
1806
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1748
1807
  * @param version - Optional version of the domain to add the ubiquitous language to
1749
1808
  */
1750
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path17.join)(path5, "domains")),
1809
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path18.join)(path6, "domains")),
1751
1810
  /**
1752
1811
  * Get the ubiquitous language dictionary from a domain
1753
1812
  * @param id - The id of the domain to get the ubiquitous language from
1754
1813
  * @param version - Optional version of the domain to get the ubiquitous language from
1755
1814
  * @returns
1756
1815
  */
1757
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path17.join)(path5, "domains")),
1816
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path18.join)(path6, "domains")),
1758
1817
  /**
1759
1818
  * Check to see if a domain version exists
1760
1819
  * @param id - The id of the domain
1761
1820
  * @param version - The version of the domain (supports semver)
1762
1821
  * @returns
1763
1822
  */
1764
- domainHasVersion: domainHasVersion((0, import_node_path17.join)(path5)),
1823
+ domainHasVersion: domainHasVersion((0, import_node_path18.join)(path6)),
1765
1824
  /**
1766
1825
  * Adds a given service to a domain
1767
1826
  * @param id - The id of the domain
@@ -1769,7 +1828,7 @@ var index_default = (path5) => {
1769
1828
  * @param version - (Optional) The version of the domain to add the service to
1770
1829
  * @returns
1771
1830
  */
1772
- addServiceToDomain: addServiceToDomain((0, import_node_path17.join)(path5, "domains")),
1831
+ addServiceToDomain: addServiceToDomain((0, import_node_path18.join)(path6, "domains")),
1773
1832
  /**
1774
1833
  * Adds a given subdomain to a domain
1775
1834
  * @param id - The id of the domain
@@ -1777,7 +1836,7 @@ var index_default = (path5) => {
1777
1836
  * @param version - (Optional) The version of the domain to add the subdomain to
1778
1837
  * @returns
1779
1838
  */
1780
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path17.join)(path5, "domains")),
1839
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path18.join)(path6, "domains")),
1781
1840
  /**
1782
1841
  * Adds an entity to a domain
1783
1842
  * @param id - The id of the domain
@@ -1785,7 +1844,7 @@ var index_default = (path5) => {
1785
1844
  * @param version - (Optional) The version of the domain to add the entity to
1786
1845
  * @returns
1787
1846
  */
1788
- addEntityToDomain: addEntityToDomain((0, import_node_path17.join)(path5, "domains")),
1847
+ addEntityToDomain: addEntityToDomain((0, import_node_path18.join)(path6, "domains")),
1789
1848
  /**
1790
1849
  * ================================
1791
1850
  * Teams
@@ -1798,25 +1857,25 @@ var index_default = (path5) => {
1798
1857
  * @param options - Optional options to write the team
1799
1858
  *
1800
1859
  */
1801
- writeTeam: writeTeam((0, import_node_path17.join)(path5, "teams")),
1860
+ writeTeam: writeTeam((0, import_node_path18.join)(path6, "teams")),
1802
1861
  /**
1803
1862
  * Returns a team from EventCatalog
1804
1863
  * @param id - The id of the team to retrieve
1805
1864
  * @returns Team|Undefined
1806
1865
  */
1807
- getTeam: getTeam((0, import_node_path17.join)(path5, "teams")),
1866
+ getTeam: getTeam((0, import_node_path18.join)(path6, "teams")),
1808
1867
  /**
1809
1868
  * Returns all teams from EventCatalog
1810
1869
  * @returns Team[]|Undefined
1811
1870
  */
1812
- getTeams: getTeams((0, import_node_path17.join)(path5, "teams")),
1871
+ getTeams: getTeams((0, import_node_path18.join)(path6, "teams")),
1813
1872
  /**
1814
1873
  * Remove a team by the team id
1815
1874
  *
1816
1875
  * @param id - The id of the team you want to remove
1817
1876
  *
1818
1877
  */
1819
- rmTeamById: rmTeamById((0, import_node_path17.join)(path5, "teams")),
1878
+ rmTeamById: rmTeamById((0, import_node_path18.join)(path6, "teams")),
1820
1879
  /**
1821
1880
  * ================================
1822
1881
  * Users
@@ -1829,25 +1888,25 @@ var index_default = (path5) => {
1829
1888
  * @param options - Optional options to write the user
1830
1889
  *
1831
1890
  */
1832
- writeUser: writeUser((0, import_node_path17.join)(path5, "users")),
1891
+ writeUser: writeUser((0, import_node_path18.join)(path6, "users")),
1833
1892
  /**
1834
1893
  * Returns a user from EventCatalog
1835
1894
  * @param id - The id of the user to retrieve
1836
1895
  * @returns User|Undefined
1837
1896
  */
1838
- getUser: getUser((0, import_node_path17.join)(path5, "users")),
1897
+ getUser: getUser((0, import_node_path18.join)(path6, "users")),
1839
1898
  /**
1840
1899
  * Returns all user from EventCatalog
1841
1900
  * @returns User[]|Undefined
1842
1901
  */
1843
- getUsers: getUsers((0, import_node_path17.join)(path5)),
1902
+ getUsers: getUsers((0, import_node_path18.join)(path6)),
1844
1903
  /**
1845
1904
  * Remove a user by the user id
1846
1905
  *
1847
1906
  * @param id - The id of the user you want to remove
1848
1907
  *
1849
1908
  */
1850
- rmUserById: rmUserById((0, import_node_path17.join)(path5, "users")),
1909
+ rmUserById: rmUserById((0, import_node_path18.join)(path6, "users")),
1851
1910
  /**
1852
1911
  * ================================
1853
1912
  * Custom Docs
@@ -1858,32 +1917,32 @@ var index_default = (path5) => {
1858
1917
  * @param path - The path to the custom doc to retrieve
1859
1918
  * @returns CustomDoc|Undefined
1860
1919
  */
1861
- getCustomDoc: getCustomDoc((0, import_node_path17.join)(path5, "docs")),
1920
+ getCustomDoc: getCustomDoc((0, import_node_path18.join)(path6, "docs")),
1862
1921
  /**
1863
1922
  * Returns all custom docs from EventCatalog
1864
1923
  * @param options - Optional options to get custom docs from a specific path
1865
1924
  * @returns CustomDoc[]|Undefined
1866
1925
  */
1867
- getCustomDocs: getCustomDocs((0, import_node_path17.join)(path5, "docs")),
1926
+ getCustomDocs: getCustomDocs((0, import_node_path18.join)(path6, "docs")),
1868
1927
  /**
1869
1928
  * Writes a custom doc to EventCatalog
1870
1929
  * @param customDoc - The custom doc to write
1871
1930
  * @param options - Optional options to write the custom doc
1872
1931
  *
1873
1932
  */
1874
- writeCustomDoc: writeCustomDoc((0, import_node_path17.join)(path5, "docs")),
1933
+ writeCustomDoc: writeCustomDoc((0, import_node_path18.join)(path6, "docs")),
1875
1934
  /**
1876
1935
  * Removes a custom doc from EventCatalog
1877
1936
  * @param path - The path to the custom doc to remove
1878
1937
  *
1879
1938
  */
1880
- rmCustomDoc: rmCustomDoc((0, import_node_path17.join)(path5, "docs")),
1939
+ rmCustomDoc: rmCustomDoc((0, import_node_path18.join)(path6, "docs")),
1881
1940
  /**
1882
1941
  * Dumps the catalog to a JSON file.
1883
1942
  * @param directory - The directory to dump the catalog to
1884
1943
  * @returns A JSON file with the catalog
1885
1944
  */
1886
- dumpCatalog: dumpCatalog((0, import_node_path17.join)(path5)),
1945
+ dumpCatalog: dumpCatalog((0, import_node_path18.join)(path6)),
1887
1946
  /**
1888
1947
  * Returns the event catalog configuration file.
1889
1948
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1891,7 +1950,7 @@ var index_default = (path5) => {
1891
1950
  * @param directory - The directory of the catalog.
1892
1951
  * @returns A JSON object with the configuration for the event catalog.
1893
1952
  */
1894
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path17.join)(path5)),
1953
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path18.join)(path6)),
1895
1954
  /**
1896
1955
  * ================================
1897
1956
  * Resources Utils
@@ -1901,6 +1960,10 @@ var index_default = (path5) => {
1901
1960
  * Returns the path to a given resource by id and version
1902
1961
  */
1903
1962
  getResourcePath,
1963
+ /**
1964
+ * Returns the folder name of a given resource
1965
+ */
1966
+ getResourceFolderName,
1904
1967
  /**
1905
1968
  * ================================
1906
1969
  * General Message Utils
@@ -1912,33 +1975,33 @@ var index_default = (path5) => {
1912
1975
  * @param path - The path to the message to retrieve
1913
1976
  * @returns Message|Undefined
1914
1977
  */
1915
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path17.join)(path5)),
1978
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path18.join)(path6)),
1916
1979
  /**
1917
1980
  * Returns the producers and consumers (services) for a given message
1918
1981
  * @param id - The id of the message to get the producers and consumers for
1919
1982
  * @param version - Optional version of the message
1920
1983
  * @returns { producers: Service[], consumers: Service[] }
1921
1984
  */
1922
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path17.join)(path5)),
1985
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path18.join)(path6)),
1923
1986
  /**
1924
1987
  * Returns the consumers of a given schema path
1925
1988
  * @param path - The path to the schema to get the consumers for
1926
1989
  * @returns Service[]
1927
1990
  */
1928
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path17.join)(path5)),
1991
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path18.join)(path6)),
1929
1992
  /**
1930
1993
  * Returns the producers of a given schema path
1931
1994
  * @param path - The path to the schema to get the producers for
1932
1995
  * @returns Service[]
1933
1996
  */
1934
- getProducersOfSchema: getProducersOfSchema((0, import_node_path17.join)(path5)),
1997
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path18.join)(path6)),
1935
1998
  /**
1936
1999
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1937
2000
  * @param id - The id of the resource to get the owners for
1938
2001
  * @param version - Optional version of the resource
1939
2002
  * @returns { owners: User[] }
1940
2003
  */
1941
- getOwnersForResource: getOwnersForResource((0, import_node_path17.join)(path5)),
2004
+ getOwnersForResource: getOwnersForResource((0, import_node_path18.join)(path6)),
1942
2005
  /**
1943
2006
  * ================================
1944
2007
  * Entities
@@ -1950,13 +2013,13 @@ var index_default = (path5) => {
1950
2013
  * @param version - Optional id of the version to get (supports semver)
1951
2014
  * @returns Entity|Undefined
1952
2015
  */
1953
- getEntity: getEntity((0, import_node_path17.join)(path5)),
2016
+ getEntity: getEntity((0, import_node_path18.join)(path6)),
1954
2017
  /**
1955
2018
  * Returns all entities from EventCatalog
1956
2019
  * @param latestOnly - optional boolean, set to true to get only latest versions
1957
2020
  * @returns Entity[]|Undefined
1958
2021
  */
1959
- getEntities: getEntities((0, import_node_path17.join)(path5)),
2022
+ getEntities: getEntities((0, import_node_path18.join)(path6)),
1960
2023
  /**
1961
2024
  * Adds an entity to EventCatalog
1962
2025
  *
@@ -1964,33 +2027,33 @@ var index_default = (path5) => {
1964
2027
  * @param options - Optional options to write the entity
1965
2028
  *
1966
2029
  */
1967
- writeEntity: writeEntity((0, import_node_path17.join)(path5, "entities")),
2030
+ writeEntity: writeEntity((0, import_node_path18.join)(path6, "entities")),
1968
2031
  /**
1969
2032
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1970
2033
  *
1971
2034
  * @param path - The path to your entity, e.g. `/User`
1972
2035
  *
1973
2036
  */
1974
- rmEntity: rmEntity((0, import_node_path17.join)(path5, "entities")),
2037
+ rmEntity: rmEntity((0, import_node_path18.join)(path6, "entities")),
1975
2038
  /**
1976
2039
  * Remove an entity by an entity id
1977
2040
  *
1978
2041
  * @param id - The id of the entity you want to remove
1979
2042
  *
1980
2043
  */
1981
- rmEntityById: rmEntityById((0, import_node_path17.join)(path5)),
2044
+ rmEntityById: rmEntityById((0, import_node_path18.join)(path6)),
1982
2045
  /**
1983
2046
  * Moves a given entity id to the version directory
1984
2047
  * @param id - The id of the entity to version
1985
2048
  */
1986
- versionEntity: versionEntity((0, import_node_path17.join)(path5)),
2049
+ versionEntity: versionEntity((0, import_node_path18.join)(path6)),
1987
2050
  /**
1988
2051
  * Check to see if an entity version exists
1989
2052
  * @param id - The id of the entity
1990
2053
  * @param version - The version of the entity (supports semver)
1991
2054
  * @returns
1992
2055
  */
1993
- entityHasVersion: entityHasVersion((0, import_node_path17.join)(path5)),
2056
+ entityHasVersion: entityHasVersion((0, import_node_path18.join)(path6)),
1994
2057
  /**
1995
2058
  * ================================
1996
2059
  * Data Stores
@@ -2002,42 +2065,42 @@ var index_default = (path5) => {
2002
2065
  * @param options - Optional options to write the data store
2003
2066
  *
2004
2067
  */
2005
- writeDataStore: writeDataStore((0, import_node_path17.join)(path5, "containers")),
2068
+ writeDataStore: writeDataStore((0, import_node_path18.join)(path6, "containers")),
2006
2069
  /**
2007
2070
  * Returns a data store from EventCatalog
2008
2071
  * @param id - The id of the data store to retrieve
2009
2072
  * @param version - Optional id of the version to get (supports semver)
2010
2073
  * @returns Container|Undefined
2011
2074
  */
2012
- getDataStore: getDataStore((0, import_node_path17.join)(path5)),
2075
+ getDataStore: getDataStore((0, import_node_path18.join)(path6)),
2013
2076
  /**
2014
2077
  * Returns all data stores from EventCatalog
2015
2078
  * @param latestOnly - optional boolean, set to true to get only latest versions
2016
2079
  * @returns Container[]|Undefined
2017
2080
  */
2018
- getDataStores: getDataStores((0, import_node_path17.join)(path5)),
2081
+ getDataStores: getDataStores((0, import_node_path18.join)(path6)),
2019
2082
  /**
2020
2083
  * Version a data store by its id
2021
2084
  * @param id - The id of the data store to version
2022
2085
  */
2023
- versionDataStore: versionDataStore((0, import_node_path17.join)(path5, "containers")),
2086
+ versionDataStore: versionDataStore((0, import_node_path18.join)(path6, "containers")),
2024
2087
  /**
2025
2088
  * Remove a data store by its path
2026
2089
  * @param path - The path to the data store to remove
2027
2090
  */
2028
- rmDataStore: rmDataStore((0, import_node_path17.join)(path5, "containers")),
2091
+ rmDataStore: rmDataStore((0, import_node_path18.join)(path6, "containers")),
2029
2092
  /**
2030
2093
  * Remove a data store by its id
2031
2094
  * @param id - The id of the data store to remove
2032
2095
  */
2033
- rmDataStoreById: rmDataStoreById((0, import_node_path17.join)(path5)),
2096
+ rmDataStoreById: rmDataStoreById((0, import_node_path18.join)(path6)),
2034
2097
  /**
2035
2098
  * Check to see if a data store version exists
2036
2099
  * @param id - The id of the data store
2037
2100
  * @param version - The version of the data store (supports semver)
2038
2101
  * @returns
2039
2102
  */
2040
- dataStoreHasVersion: dataStoreHasVersion((0, import_node_path17.join)(path5)),
2103
+ dataStoreHasVersion: dataStoreHasVersion((0, import_node_path18.join)(path6)),
2041
2104
  /**
2042
2105
  * Adds a file to a data store by its id
2043
2106
  * @param id - The id of the data store to add the file to
@@ -2045,14 +2108,14 @@ var index_default = (path5) => {
2045
2108
  * @param version - Optional version of the data store to add the file to
2046
2109
  * @returns
2047
2110
  */
2048
- addFileToDataStore: addFileToDataStore((0, import_node_path17.join)(path5)),
2111
+ addFileToDataStore: addFileToDataStore((0, import_node_path18.join)(path6)),
2049
2112
  /**
2050
2113
  * Writes a data store to a service by its id
2051
2114
  * @param dataStore - The data store to write
2052
2115
  * @param service - The service to write the data store to
2053
2116
  * @returns
2054
2117
  */
2055
- writeDataStoreToService: writeDataStoreToService((0, import_node_path17.join)(path5))
2118
+ writeDataStoreToService: writeDataStoreToService((0, import_node_path18.join)(path6))
2056
2119
  };
2057
2120
  };
2058
2121
  //# sourceMappingURL=index.js.map