@eventcatalog/sdk 2.7.5 → 2.8.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 (54) hide show
  1. package/dist/channels.js +18 -9
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +11 -2
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +14 -5
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +11 -2
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/custom-docs.js +6 -5
  10. package/dist/custom-docs.js.map +1 -1
  11. package/dist/custom-docs.mjs +1 -0
  12. package/dist/custom-docs.mjs.map +1 -1
  13. package/dist/domains.js +17 -8
  14. package/dist/domains.js.map +1 -1
  15. package/dist/domains.mjs +11 -2
  16. package/dist/domains.mjs.map +1 -1
  17. package/dist/entities.js +13 -4
  18. package/dist/entities.js.map +1 -1
  19. package/dist/entities.mjs +11 -2
  20. package/dist/entities.mjs.map +1 -1
  21. package/dist/eventcatalog.js +172 -156
  22. package/dist/eventcatalog.js.map +1 -1
  23. package/dist/eventcatalog.mjs +23 -7
  24. package/dist/eventcatalog.mjs.map +1 -1
  25. package/dist/events.js +14 -5
  26. package/dist/events.js.map +1 -1
  27. package/dist/events.mjs +11 -2
  28. package/dist/events.mjs.map +1 -1
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +172 -156
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +23 -7
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/messages.js +4 -3
  36. package/dist/messages.js.map +1 -1
  37. package/dist/messages.mjs +1 -0
  38. package/dist/messages.mjs.map +1 -1
  39. package/dist/queries.js +14 -5
  40. package/dist/queries.js.map +1 -1
  41. package/dist/queries.mjs +11 -2
  42. package/dist/queries.mjs.map +1 -1
  43. package/dist/services.js +31 -15
  44. package/dist/services.js.map +1 -1
  45. package/dist/services.mjs +23 -7
  46. package/dist/services.mjs.map +1 -1
  47. package/dist/teams.js +9 -8
  48. package/dist/teams.js.map +1 -1
  49. package/dist/teams.mjs +1 -0
  50. package/dist/teams.mjs.map +1 -1
  51. package/dist/types.d.d.mts +9 -2
  52. package/dist/types.d.d.ts +9 -2
  53. package/dist/types.d.js.map +1 -1
  54. package/package.json +1 -1
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_path15 = require("path");
36
+ var import_node_path16 = require("path");
37
37
 
38
38
  // src/events.ts
39
39
  var import_promises2 = __toESM(require("fs/promises"));
40
- var import_node_path2 = require("path");
40
+ var import_node_path3 = require("path");
41
41
 
42
42
  // src/internal/utils.ts
43
43
  var import_glob = require("glob");
@@ -154,6 +154,7 @@ var import_promises = __toESM(require("fs/promises"));
154
154
  var import_node_fs2 = __toESM(require("fs"));
155
155
  var import_semver2 = require("semver");
156
156
  var import_proper_lockfile = require("proper-lockfile");
157
+ var import_node_path2 = require("path");
157
158
  var versionResource = async (catalogDir, id) => {
158
159
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
159
160
  const matchedFiles = await searchFilesForId(files, id);
@@ -161,16 +162,24 @@ var versionResource = async (catalogDir, id) => {
161
162
  throw new Error(`No resource found with id: ${id}`);
162
163
  }
163
164
  const file = matchedFiles[0];
164
- const sourceDirectory = (0, import_path.dirname)(file);
165
+ const sourceDirectory = (0, import_path.dirname)(file).replace(/\/versioned?\/[^/]+\//, "/");
165
166
  const { data: { version = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
166
167
  const targetDirectory = getVersionedDirectory(sourceDirectory, version);
167
168
  import_node_fs2.default.mkdirSync(targetDirectory, { recursive: true });
169
+ const ignoreListToCopy = ["events", "commands", "queries", "versioned"];
168
170
  await copyDir(catalogDir, sourceDirectory, targetDirectory, (src) => {
169
- return !src.includes("versioned");
171
+ const folderName = (0, import_node_path2.basename)(src);
172
+ if (ignoreListToCopy.includes(folderName)) {
173
+ return false;
174
+ }
175
+ return true;
170
176
  });
171
177
  await import_promises.default.readdir(sourceDirectory).then(async (resourceFiles) => {
172
178
  await Promise.all(
173
179
  resourceFiles.map(async (file2) => {
180
+ if (ignoreListToCopy.includes(file2)) {
181
+ return;
182
+ }
174
183
  if (file2 !== "versioned") {
175
184
  import_node_fs2.default.rmSync((0, import_path.join)(sourceDirectory, file2), { recursive: true });
176
185
  }
@@ -366,11 +375,11 @@ var writeEventToService = (directory) => async (event, service, options = { path
366
375
  throw new Error("Service not found");
367
376
  }
368
377
  let pathForEvent = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/events` : `${resourcePath.directory}/events`;
369
- pathForEvent = (0, import_node_path2.join)(pathForEvent, event.id);
378
+ pathForEvent = (0, import_node_path3.join)(pathForEvent, event.id);
370
379
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
371
380
  };
372
381
  var rmEvent = (directory) => async (path5) => {
373
- await import_promises2.default.rm((0, import_node_path2.join)(directory, path5), { recursive: true });
382
+ await import_promises2.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
374
383
  };
375
384
  var rmEventById = (directory) => async (id, version, persistFiles) => {
376
385
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -387,7 +396,7 @@ var eventHasVersion = (directory) => async (id, version) => {
387
396
 
388
397
  // src/commands.ts
389
398
  var import_promises3 = __toESM(require("fs/promises"));
390
- var import_node_path3 = require("path");
399
+ var import_node_path4 = require("path");
391
400
  var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
392
401
  var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
393
402
  var writeCommand = (directory) => async (command, options = {
@@ -402,11 +411,11 @@ var writeCommandToService = (directory) => async (command, service, options = {
402
411
  throw new Error("Service not found");
403
412
  }
404
413
  let pathForCommand = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/commands` : `${resourcePath.directory}/commands`;
405
- pathForCommand = (0, import_node_path3.join)(pathForCommand, command.id);
414
+ pathForCommand = (0, import_node_path4.join)(pathForCommand, command.id);
406
415
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
407
416
  };
408
417
  var rmCommand = (directory) => async (path5) => {
409
- await import_promises3.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
418
+ await import_promises3.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
410
419
  };
411
420
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
412
421
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -421,7 +430,7 @@ var commandHasVersion = (directory) => async (id, version) => {
421
430
 
422
431
  // src/queries.ts
423
432
  var import_promises4 = __toESM(require("fs/promises"));
424
- var import_node_path4 = require("path");
433
+ var import_node_path5 = require("path");
425
434
  var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
426
435
  var writeQuery = (directory) => async (query, options = {
427
436
  path: "",
@@ -436,11 +445,11 @@ var writeQueryToService = (directory) => async (query, service, options = { path
436
445
  throw new Error("Service not found");
437
446
  }
438
447
  let pathForQuery = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/queries` : `${resourcePath.directory}/queries`;
439
- pathForQuery = (0, import_node_path4.join)(pathForQuery, query.id);
448
+ pathForQuery = (0, import_node_path5.join)(pathForQuery, query.id);
440
449
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
441
450
  };
442
451
  var rmQuery = (directory) => async (path5) => {
443
- await import_promises4.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
452
+ await import_promises4.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
444
453
  };
445
454
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
446
455
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -457,7 +466,7 @@ var queryHasVersion = (directory) => async (id, version) => {
457
466
 
458
467
  // src/services.ts
459
468
  var import_promises5 = __toESM(require("fs/promises"));
460
- var import_node_path5 = require("path");
469
+ var import_node_path6 = require("path");
461
470
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
462
471
  var getServiceByPath = (directory) => async (path5) => {
463
472
  const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
@@ -489,12 +498,12 @@ var writeVersionedService = (directory) => async (service) => {
489
498
  };
490
499
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
491
500
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
492
- pathForService = (0, import_node_path5.join)(pathForService, service.id);
501
+ pathForService = (0, import_node_path6.join)(pathForService, service.id);
493
502
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
494
503
  };
495
504
  var versionService = (directory) => async (id) => versionResource(directory, id);
496
505
  var rmService = (directory) => async (path5) => {
497
- await import_promises5.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
506
+ await import_promises5.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
498
507
  };
499
508
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
500
509
  await rmResourceById(directory, id, version, { type: "service", persistFiles });
@@ -507,14 +516,21 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
507
516
  let specs = [];
508
517
  if (service.specifications) {
509
518
  const serviceSpecifications = service.specifications;
510
- const specificationFiles = Object.keys(serviceSpecifications);
511
- const getSpecs = specificationFiles.map(async (specFile) => {
512
- const fileName = serviceSpecifications[specFile];
519
+ let specificationFiles;
520
+ if (Array.isArray(serviceSpecifications)) {
521
+ specificationFiles = serviceSpecifications.map((spec) => ({ key: spec.type, path: spec.path }));
522
+ } else {
523
+ specificationFiles = Object.keys(serviceSpecifications).map((spec) => ({
524
+ key: spec,
525
+ path: serviceSpecifications[spec]
526
+ }));
527
+ }
528
+ const getSpecs = specificationFiles.map(async ({ key, path: fileName }) => {
513
529
  if (!fileName) {
514
- throw new Error(`Specification file name for ${specFile} is undefined`);
530
+ throw new Error(`Specification file name for ${fileName} is undefined`);
515
531
  }
516
532
  const rawFile = await getFileFromResource(directory, id, { fileName }, version);
517
- return { key: specFile, content: rawFile, fileName, path: (0, import_node_path5.join)((0, import_node_path5.dirname)(filePathToService), fileName) };
533
+ return { key, content: rawFile, fileName, path: (0, import_node_path6.join)((0, import_node_path6.dirname)(filePathToService), fileName) };
518
534
  });
519
535
  specs = await Promise.all(getSpecs);
520
536
  }
@@ -523,7 +539,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
523
539
  var addMessageToService = (directory) => async (id, direction, event, version) => {
524
540
  let service = await getService(directory)(id, version);
525
541
  const servicePath = await getResourcePath(directory, id, version);
526
- const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
542
+ const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
527
543
  if (direction === "sends") {
528
544
  if (service.sends === void 0) {
529
545
  service.sends = [];
@@ -552,7 +568,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
552
568
  throw new Error(`Cannot find service ${id} in the catalog`);
553
569
  }
554
570
  const path5 = existingResource.split(/[\\/]+services/)[0];
555
- const pathToResource = (0, import_node_path5.join)(path5, "services");
571
+ const pathToResource = (0, import_node_path6.join)(path5, "services");
556
572
  await rmServiceById(directory)(id, version);
557
573
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
558
574
  };
@@ -562,7 +578,7 @@ var serviceHasVersion = (directory) => async (id, version) => {
562
578
  };
563
579
  var isService = (directory) => async (path5) => {
564
580
  const service = await getServiceByPath(directory)(path5);
565
- const relativePath = (0, import_node_path5.relative)(directory, path5);
581
+ const relativePath = (0, import_node_path6.relative)(directory, path5);
566
582
  const segments = relativePath.split(/[/\\]+/);
567
583
  return !!service && segments.includes("services");
568
584
  };
@@ -570,7 +586,7 @@ var toService = (directory) => async (file) => toResource(directory, file);
570
586
  var addEntityToService = (directory) => async (id, entity, version) => {
571
587
  let service = await getService(directory)(id, version);
572
588
  const servicePath = await getResourcePath(directory, id, version);
573
- const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
589
+ const extension = (0, import_node_path6.extname)(servicePath?.fullPath || "");
574
590
  if (service.entities === void 0) {
575
591
  service.entities = [];
576
592
  }
@@ -585,14 +601,14 @@ var addEntityToService = (directory) => async (id, entity, version) => {
585
601
  throw new Error(`Cannot find service ${id} in the catalog`);
586
602
  }
587
603
  const path5 = existingResource.split(/[\\/]+services/)[0];
588
- const pathToResource = (0, import_node_path5.join)(path5, "services");
604
+ const pathToResource = (0, import_node_path6.join)(path5, "services");
589
605
  await rmServiceById(directory)(id, version);
590
606
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
591
607
  };
592
608
 
593
609
  // src/domains.ts
594
610
  var import_promises6 = __toESM(require("fs/promises"));
595
- var import_node_path6 = __toESM(require("path"));
611
+ var import_node_path7 = __toESM(require("path"));
596
612
  var import_node_fs3 = __toESM(require("fs"));
597
613
  var import_gray_matter3 = __toESM(require("gray-matter"));
598
614
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
@@ -618,7 +634,7 @@ var writeDomain = (directory) => async (domain, options = {
618
634
  };
619
635
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
620
636
  var rmDomain = (directory) => async (path5) => {
621
- await import_promises6.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
637
+ await import_promises6.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
622
638
  };
623
639
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
624
640
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -630,7 +646,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
630
646
  };
631
647
  var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
632
648
  const pathToDomain = await findFileById(directory, id, version) || "";
633
- const pathToUbiquitousLanguage = import_node_path6.default.join(import_node_path6.default.dirname(pathToDomain), "ubiquitous-language.mdx");
649
+ const pathToUbiquitousLanguage = import_node_path7.default.join(import_node_path7.default.dirname(pathToDomain), "ubiquitous-language.mdx");
634
650
  const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
635
651
  if (!fileExists) {
636
652
  return void 0;
@@ -645,7 +661,7 @@ var domainHasVersion = (directory) => async (id, version) => {
645
661
  var addServiceToDomain = (directory) => async (id, service, version) => {
646
662
  let domain = await getDomain(directory)(id, version);
647
663
  const domainPath = await getResourcePath(directory, id, version);
648
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
664
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
649
665
  if (domain.services === void 0) {
650
666
  domain.services = [];
651
667
  }
@@ -660,7 +676,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
660
676
  var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
661
677
  let domain = await getDomain(directory)(id, version);
662
678
  const domainPath = await getResourcePath(directory, id, version);
663
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
679
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
664
680
  if (domain.domains === void 0) {
665
681
  domain.domains = [];
666
682
  }
@@ -675,7 +691,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
675
691
  var addEntityToDomain = (directory) => async (id, entity, version) => {
676
692
  let domain = await getDomain(directory)(id, version);
677
693
  const domainPath = await getResourcePath(directory, id, version);
678
- const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
694
+ const extension = import_node_path7.default.extname(domainPath?.fullPath || "");
679
695
  if (domain.entities === void 0) {
680
696
  domain.entities = [];
681
697
  }
@@ -690,12 +706,12 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
690
706
 
691
707
  // src/channels.ts
692
708
  var import_promises7 = __toESM(require("fs/promises"));
693
- var import_node_path7 = require("path");
709
+ var import_node_path8 = require("path");
694
710
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
695
711
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
696
712
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
697
713
  var rmChannel = (directory) => async (path5) => {
698
- await import_promises7.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
714
+ await import_promises7.default.rm((0, import_node_path8.join)(directory, path5), { recursive: true });
699
715
  };
700
716
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
701
717
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -725,7 +741,7 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
725
741
  const { getMessage, rmMessageById, writeMessage } = functions[collection];
726
742
  const message = await getMessage(directory)(_message.id, _message.version);
727
743
  const messagePath = await getResourcePath(directory, _message.id, _message.version);
728
- const extension = (0, import_node_path7.extname)(messagePath?.fullPath || "");
744
+ const extension = (0, import_node_path8.extname)(messagePath?.fullPath || "");
729
745
  if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
730
746
  if (message.channels === void 0) {
731
747
  message.channels = [];
@@ -737,17 +753,17 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
737
753
  throw new Error(`Cannot find message ${id} in the catalog`);
738
754
  }
739
755
  const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
740
- const pathToResource = (0, import_node_path7.join)(path5, collection);
756
+ const pathToResource = (0, import_node_path8.join)(path5, collection);
741
757
  await rmMessageById(directory)(_message.id, _message.version, true);
742
758
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
743
759
  };
744
760
 
745
761
  // src/messages.ts
746
- var import_node_path8 = require("path");
762
+ var import_node_path9 = require("path");
747
763
  var import_gray_matter4 = __toESM(require("gray-matter"));
748
764
  var import_semver3 = require("semver");
749
765
  var getMessageBySchemaPath = (directory) => async (path5, options) => {
750
- const pathToMessage = (0, import_node_path8.dirname)(path5);
766
+ const pathToMessage = (0, import_node_path9.dirname)(path5);
751
767
  try {
752
768
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
753
769
  if (!files || files.length === 0) {
@@ -839,13 +855,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
839
855
  };
840
856
 
841
857
  // src/custom-docs.ts
842
- var import_node_path9 = __toESM(require("path"));
858
+ var import_node_path10 = __toESM(require("path"));
843
859
  var import_node_fs4 = __toESM(require("fs"));
844
860
  var import_promises8 = __toESM(require("fs/promises"));
845
861
  var import_gray_matter5 = __toESM(require("gray-matter"));
846
862
  var import_slugify = __toESM(require("slugify"));
847
863
  var getCustomDoc = (directory) => async (filePath) => {
848
- const fullPath = import_node_path9.default.join(directory, filePath);
864
+ const fullPath = import_node_path10.default.join(directory, filePath);
849
865
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
850
866
  const fileExists = import_node_fs4.default.existsSync(fullPathWithExtension);
851
867
  if (!fileExists) {
@@ -864,26 +880,26 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
864
880
  const { fileName, ...rest } = customDoc;
865
881
  const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
866
882
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
867
- const fullPath = import_node_path9.default.join(directory, options.path || "", withExtension);
868
- import_node_fs4.default.mkdirSync(import_node_path9.default.dirname(fullPath), { recursive: true });
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 });
869
885
  const document = import_gray_matter5.default.stringify(customDoc.markdown.trim(), rest);
870
886
  import_node_fs4.default.writeFileSync(fullPath, document);
871
887
  };
872
888
  var rmCustomDoc = (directory) => async (filePath) => {
873
889
  const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
874
- await import_promises8.default.rm((0, import_node_path9.join)(directory, withExtension), { recursive: true });
890
+ await import_promises8.default.rm((0, import_node_path10.join)(directory, withExtension), { recursive: true });
875
891
  };
876
892
 
877
893
  // src/teams.ts
878
894
  var import_promises9 = __toESM(require("fs/promises"));
879
895
  var import_node_fs6 = __toESM(require("fs"));
880
- var import_node_path11 = require("path");
896
+ var import_node_path12 = require("path");
881
897
  var import_gray_matter7 = __toESM(require("gray-matter"));
882
- var import_node_path12 = __toESM(require("path"));
898
+ var import_node_path13 = __toESM(require("path"));
883
899
 
884
900
  // src/users.ts
885
901
  var import_node_fs5 = __toESM(require("fs"));
886
- var import_node_path10 = require("path");
902
+ var import_node_path11 = require("path");
887
903
  var import_gray_matter6 = __toESM(require("gray-matter"));
888
904
  var getUser = (catalogDir) => async (id) => {
889
905
  const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
@@ -921,11 +937,11 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
921
937
  }
922
938
  const { markdown, ...frontmatter } = resource;
923
939
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
924
- import_node_fs5.default.mkdirSync((0, import_node_path10.join)(catalogDir, ""), { recursive: true });
925
- import_node_fs5.default.writeFileSync((0, import_node_path10.join)(catalogDir, "", `${resource.id}.mdx`), document);
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);
926
942
  };
927
943
  var rmUserById = (catalogDir) => async (id) => {
928
- import_node_fs5.default.rmSync((0, import_node_path10.join)(catalogDir, `${id}.mdx`), { recursive: true });
944
+ import_node_fs5.default.rmSync((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
929
945
  };
930
946
 
931
947
  // src/teams.ts
@@ -963,11 +979,11 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
963
979
  }
964
980
  const { markdown, ...frontmatter } = resource;
965
981
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
966
- import_node_fs6.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
967
- import_node_fs6.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
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);
968
984
  };
969
985
  var rmTeamById = (catalogDir) => async (id) => {
970
- await import_promises9.default.rm((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
986
+ await import_promises9.default.rm((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
971
987
  };
972
988
  var getOwnersForResource = (catalogDir) => async (id, version) => {
973
989
  const resource = await getResource(catalogDir, id, version);
@@ -975,11 +991,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
975
991
  if (!resource) return [];
976
992
  if (!resource.owners) return [];
977
993
  for (const owner of resource.owners) {
978
- const team = await getTeam(import_node_path12.default.join(catalogDir, "teams"))(owner);
994
+ const team = await getTeam(import_node_path13.default.join(catalogDir, "teams"))(owner);
979
995
  if (team) {
980
996
  owners.push(team);
981
997
  } else {
982
- const user = await getUser(import_node_path12.default.join(catalogDir, "users"))(owner);
998
+ const user = await getUser(import_node_path13.default.join(catalogDir, "users"))(owner);
983
999
  if (user) {
984
1000
  owners.push(user);
985
1001
  }
@@ -990,11 +1006,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
990
1006
 
991
1007
  // src/eventcatalog.ts
992
1008
  var import_fs = __toESM(require("fs"));
993
- var import_node_path13 = __toESM(require("path"));
1009
+ var import_node_path14 = __toESM(require("path"));
994
1010
  var DUMP_VERSION = "0.0.1";
995
1011
  var getEventCatalogVersion = async (catalogDir) => {
996
1012
  try {
997
- const packageJson = import_fs.default.readFileSync((0, import_node_path13.join)(catalogDir, "package.json"), "utf8");
1013
+ const packageJson = import_fs.default.readFileSync((0, import_node_path14.join)(catalogDir, "package.json"), "utf8");
998
1014
  const packageJsonObject = JSON.parse(packageJson);
999
1015
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
1000
1016
  } catch (error) {
@@ -1007,7 +1023,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1007
1023
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1008
1024
  let schema = "";
1009
1025
  if (resource.schemaPath && resourcePath?.fullPath) {
1010
- const pathToSchema = import_node_path13.default.join(import_node_path13.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1026
+ const pathToSchema = import_node_path14.default.join(import_node_path14.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1011
1027
  if (import_fs.default.existsSync(pathToSchema)) {
1012
1028
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1013
1029
  }
@@ -1028,7 +1044,7 @@ var filterCollection = (collection, options) => {
1028
1044
  };
1029
1045
  var getEventCatalogConfigurationFile = (directory) => async () => {
1030
1046
  try {
1031
- const path5 = (0, import_node_path13.join)(directory, "eventcatalog.config.js");
1047
+ const path5 = (0, import_node_path14.join)(directory, "eventcatalog.config.js");
1032
1048
  const configModule = await import(path5);
1033
1049
  return configModule.default;
1034
1050
  } catch (error) {
@@ -1087,7 +1103,7 @@ var dumpCatalog = (directory) => async (options) => {
1087
1103
 
1088
1104
  // src/entities.ts
1089
1105
  var import_promises10 = __toESM(require("fs/promises"));
1090
- var import_node_path14 = require("path");
1106
+ var import_node_path15 = require("path");
1091
1107
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
1092
1108
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
1093
1109
  var writeEntity = (directory) => async (entity, options = {
@@ -1096,7 +1112,7 @@ var writeEntity = (directory) => async (entity, options = {
1096
1112
  format: "mdx"
1097
1113
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1098
1114
  var rmEntity = (directory) => async (path5) => {
1099
- await import_promises10.default.rm((0, import_node_path14.join)(directory, path5), { recursive: true });
1115
+ await import_promises10.default.rm((0, import_node_path15.join)(directory, path5), { recursive: true });
1100
1116
  };
1101
1117
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
1102
1118
  await rmResourceById(directory, id, version, { type: "entity", persistFiles });
@@ -1116,13 +1132,13 @@ var index_default = (path5) => {
1116
1132
  * @param version - Optional id of the version to get (supports semver)
1117
1133
  * @returns Event|Undefined
1118
1134
  */
1119
- getEvent: getEvent((0, import_node_path15.join)(path5)),
1135
+ getEvent: getEvent((0, import_node_path16.join)(path5)),
1120
1136
  /**
1121
1137
  * Returns all events from EventCatalog
1122
1138
  * @param latestOnly - optional boolean, set to true to get only latest versions
1123
1139
  * @returns Event[]|Undefined
1124
1140
  */
1125
- getEvents: getEvents((0, import_node_path15.join)(path5)),
1141
+ getEvents: getEvents((0, import_node_path16.join)(path5)),
1126
1142
  /**
1127
1143
  * Adds an event to EventCatalog
1128
1144
  *
@@ -1130,7 +1146,7 @@ var index_default = (path5) => {
1130
1146
  * @param options - Optional options to write the event
1131
1147
  *
1132
1148
  */
1133
- writeEvent: writeEvent((0, import_node_path15.join)(path5, "events")),
1149
+ writeEvent: writeEvent((0, import_node_path16.join)(path5, "events")),
1134
1150
  /**
1135
1151
  * Adds an event to a service in EventCatalog
1136
1152
  *
@@ -1139,26 +1155,26 @@ var index_default = (path5) => {
1139
1155
  * @param options - Optional options to write the event
1140
1156
  *
1141
1157
  */
1142
- writeEventToService: writeEventToService((0, import_node_path15.join)(path5)),
1158
+ writeEventToService: writeEventToService((0, import_node_path16.join)(path5)),
1143
1159
  /**
1144
1160
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1145
1161
  *
1146
1162
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1147
1163
  *
1148
1164
  */
1149
- rmEvent: rmEvent((0, import_node_path15.join)(path5, "events")),
1165
+ rmEvent: rmEvent((0, import_node_path16.join)(path5, "events")),
1150
1166
  /**
1151
1167
  * Remove an event by an Event id
1152
1168
  *
1153
1169
  * @param id - The id of the event you want to remove
1154
1170
  *
1155
1171
  */
1156
- rmEventById: rmEventById((0, import_node_path15.join)(path5)),
1172
+ rmEventById: rmEventById((0, import_node_path16.join)(path5)),
1157
1173
  /**
1158
1174
  * Moves a given event id to the version directory
1159
1175
  * @param directory
1160
1176
  */
1161
- versionEvent: versionEvent((0, import_node_path15.join)(path5)),
1177
+ versionEvent: versionEvent((0, import_node_path16.join)(path5)),
1162
1178
  /**
1163
1179
  * Adds a file to the given event
1164
1180
  * @param id - The id of the event to add the file to
@@ -1166,7 +1182,7 @@ var index_default = (path5) => {
1166
1182
  * @param version - Optional version of the event to add the file to
1167
1183
  * @returns
1168
1184
  */
1169
- addFileToEvent: addFileToEvent((0, import_node_path15.join)(path5)),
1185
+ addFileToEvent: addFileToEvent((0, import_node_path16.join)(path5)),
1170
1186
  /**
1171
1187
  * Adds a schema to the given event
1172
1188
  * @param id - The id of the event to add the schema to
@@ -1174,14 +1190,14 @@ var index_default = (path5) => {
1174
1190
  * @param version - Optional version of the event to add the schema to
1175
1191
  * @returns
1176
1192
  */
1177
- addSchemaToEvent: addSchemaToEvent((0, import_node_path15.join)(path5)),
1193
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path16.join)(path5)),
1178
1194
  /**
1179
1195
  * Check to see if an event version exists
1180
1196
  * @param id - The id of the event
1181
1197
  * @param version - The version of the event (supports semver)
1182
1198
  * @returns
1183
1199
  */
1184
- eventHasVersion: eventHasVersion((0, import_node_path15.join)(path5)),
1200
+ eventHasVersion: eventHasVersion((0, import_node_path16.join)(path5)),
1185
1201
  /**
1186
1202
  * ================================
1187
1203
  * Commands
@@ -1193,13 +1209,13 @@ var index_default = (path5) => {
1193
1209
  * @param version - Optional id of the version to get (supports semver)
1194
1210
  * @returns Command|Undefined
1195
1211
  */
1196
- getCommand: getCommand((0, import_node_path15.join)(path5)),
1212
+ getCommand: getCommand((0, import_node_path16.join)(path5)),
1197
1213
  /**
1198
1214
  * Returns all commands from EventCatalog
1199
1215
  * @param latestOnly - optional boolean, set to true to get only latest versions
1200
1216
  * @returns Command[]|Undefined
1201
1217
  */
1202
- getCommands: getCommands((0, import_node_path15.join)(path5)),
1218
+ getCommands: getCommands((0, import_node_path16.join)(path5)),
1203
1219
  /**
1204
1220
  * Adds an command to EventCatalog
1205
1221
  *
@@ -1207,7 +1223,7 @@ var index_default = (path5) => {
1207
1223
  * @param options - Optional options to write the command
1208
1224
  *
1209
1225
  */
1210
- writeCommand: writeCommand((0, import_node_path15.join)(path5, "commands")),
1226
+ writeCommand: writeCommand((0, import_node_path16.join)(path5, "commands")),
1211
1227
  /**
1212
1228
  * Adds a command to a service in EventCatalog
1213
1229
  *
@@ -1216,26 +1232,26 @@ var index_default = (path5) => {
1216
1232
  * @param options - Optional options to write the command
1217
1233
  *
1218
1234
  */
1219
- writeCommandToService: writeCommandToService((0, import_node_path15.join)(path5)),
1235
+ writeCommandToService: writeCommandToService((0, import_node_path16.join)(path5)),
1220
1236
  /**
1221
1237
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1222
1238
  *
1223
1239
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1224
1240
  *
1225
1241
  */
1226
- rmCommand: rmCommand((0, import_node_path15.join)(path5, "commands")),
1242
+ rmCommand: rmCommand((0, import_node_path16.join)(path5, "commands")),
1227
1243
  /**
1228
1244
  * Remove an command by an Event id
1229
1245
  *
1230
1246
  * @param id - The id of the command you want to remove
1231
1247
  *
1232
1248
  */
1233
- rmCommandById: rmCommandById((0, import_node_path15.join)(path5)),
1249
+ rmCommandById: rmCommandById((0, import_node_path16.join)(path5)),
1234
1250
  /**
1235
1251
  * Moves a given command id to the version directory
1236
1252
  * @param directory
1237
1253
  */
1238
- versionCommand: versionCommand((0, import_node_path15.join)(path5)),
1254
+ versionCommand: versionCommand((0, import_node_path16.join)(path5)),
1239
1255
  /**
1240
1256
  * Adds a file to the given command
1241
1257
  * @param id - The id of the command to add the file to
@@ -1243,7 +1259,7 @@ var index_default = (path5) => {
1243
1259
  * @param version - Optional version of the command to add the file to
1244
1260
  * @returns
1245
1261
  */
1246
- addFileToCommand: addFileToCommand((0, import_node_path15.join)(path5)),
1262
+ addFileToCommand: addFileToCommand((0, import_node_path16.join)(path5)),
1247
1263
  /**
1248
1264
  * Adds a schema to the given command
1249
1265
  * @param id - The id of the command to add the schema to
@@ -1251,14 +1267,14 @@ var index_default = (path5) => {
1251
1267
  * @param version - Optional version of the command to add the schema to
1252
1268
  * @returns
1253
1269
  */
1254
- addSchemaToCommand: addSchemaToCommand((0, import_node_path15.join)(path5)),
1270
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path16.join)(path5)),
1255
1271
  /**
1256
1272
  * Check to see if a command version exists
1257
1273
  * @param id - The id of the command
1258
1274
  * @param version - The version of the command (supports semver)
1259
1275
  * @returns
1260
1276
  */
1261
- commandHasVersion: commandHasVersion((0, import_node_path15.join)(path5)),
1277
+ commandHasVersion: commandHasVersion((0, import_node_path16.join)(path5)),
1262
1278
  /**
1263
1279
  * ================================
1264
1280
  * Queries
@@ -1270,13 +1286,13 @@ var index_default = (path5) => {
1270
1286
  * @param version - Optional id of the version to get (supports semver)
1271
1287
  * @returns Query|Undefined
1272
1288
  */
1273
- getQuery: getQuery((0, import_node_path15.join)(path5)),
1289
+ getQuery: getQuery((0, import_node_path16.join)(path5)),
1274
1290
  /**
1275
1291
  * Returns all queries from EventCatalog
1276
1292
  * @param latestOnly - optional boolean, set to true to get only latest versions
1277
1293
  * @returns Query[]|Undefined
1278
1294
  */
1279
- getQueries: getQueries((0, import_node_path15.join)(path5)),
1295
+ getQueries: getQueries((0, import_node_path16.join)(path5)),
1280
1296
  /**
1281
1297
  * Adds a query to EventCatalog
1282
1298
  *
@@ -1284,7 +1300,7 @@ var index_default = (path5) => {
1284
1300
  * @param options - Optional options to write the event
1285
1301
  *
1286
1302
  */
1287
- writeQuery: writeQuery((0, import_node_path15.join)(path5, "queries")),
1303
+ writeQuery: writeQuery((0, import_node_path16.join)(path5, "queries")),
1288
1304
  /**
1289
1305
  * Adds a query to a service in EventCatalog
1290
1306
  *
@@ -1293,26 +1309,26 @@ var index_default = (path5) => {
1293
1309
  * @param options - Optional options to write the query
1294
1310
  *
1295
1311
  */
1296
- writeQueryToService: writeQueryToService((0, import_node_path15.join)(path5)),
1312
+ writeQueryToService: writeQueryToService((0, import_node_path16.join)(path5)),
1297
1313
  /**
1298
1314
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1299
1315
  *
1300
1316
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1301
1317
  *
1302
1318
  */
1303
- rmQuery: rmQuery((0, import_node_path15.join)(path5, "queries")),
1319
+ rmQuery: rmQuery((0, import_node_path16.join)(path5, "queries")),
1304
1320
  /**
1305
1321
  * Remove a query by a Query id
1306
1322
  *
1307
1323
  * @param id - The id of the query you want to remove
1308
1324
  *
1309
1325
  */
1310
- rmQueryById: rmQueryById((0, import_node_path15.join)(path5)),
1326
+ rmQueryById: rmQueryById((0, import_node_path16.join)(path5)),
1311
1327
  /**
1312
1328
  * Moves a given query id to the version directory
1313
1329
  * @param directory
1314
1330
  */
1315
- versionQuery: versionQuery((0, import_node_path15.join)(path5)),
1331
+ versionQuery: versionQuery((0, import_node_path16.join)(path5)),
1316
1332
  /**
1317
1333
  * Adds a file to the given query
1318
1334
  * @param id - The id of the query to add the file to
@@ -1320,7 +1336,7 @@ var index_default = (path5) => {
1320
1336
  * @param version - Optional version of the query to add the file to
1321
1337
  * @returns
1322
1338
  */
1323
- addFileToQuery: addFileToQuery((0, import_node_path15.join)(path5)),
1339
+ addFileToQuery: addFileToQuery((0, import_node_path16.join)(path5)),
1324
1340
  /**
1325
1341
  * Adds a schema to the given query
1326
1342
  * @param id - The id of the query to add the schema to
@@ -1328,14 +1344,14 @@ var index_default = (path5) => {
1328
1344
  * @param version - Optional version of the query to add the schema to
1329
1345
  * @returns
1330
1346
  */
1331
- addSchemaToQuery: addSchemaToQuery((0, import_node_path15.join)(path5)),
1347
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path16.join)(path5)),
1332
1348
  /**
1333
1349
  * Check to see if an query version exists
1334
1350
  * @param id - The id of the query
1335
1351
  * @param version - The version of the query (supports semver)
1336
1352
  * @returns
1337
1353
  */
1338
- queryHasVersion: queryHasVersion((0, import_node_path15.join)(path5)),
1354
+ queryHasVersion: queryHasVersion((0, import_node_path16.join)(path5)),
1339
1355
  /**
1340
1356
  * ================================
1341
1357
  * Channels
@@ -1347,13 +1363,13 @@ var index_default = (path5) => {
1347
1363
  * @param version - Optional id of the version to get (supports semver)
1348
1364
  * @returns Channel|Undefined
1349
1365
  */
1350
- getChannel: getChannel((0, import_node_path15.join)(path5)),
1366
+ getChannel: getChannel((0, import_node_path16.join)(path5)),
1351
1367
  /**
1352
1368
  * Returns all channels from EventCatalog
1353
1369
  * @param latestOnly - optional boolean, set to true to get only latest versions
1354
1370
  * @returns Channel[]|Undefined
1355
1371
  */
1356
- getChannels: getChannels((0, import_node_path15.join)(path5)),
1372
+ getChannels: getChannels((0, import_node_path16.join)(path5)),
1357
1373
  /**
1358
1374
  * Adds an channel to EventCatalog
1359
1375
  *
@@ -1361,33 +1377,33 @@ var index_default = (path5) => {
1361
1377
  * @param options - Optional options to write the channel
1362
1378
  *
1363
1379
  */
1364
- writeChannel: writeChannel((0, import_node_path15.join)(path5, "channels")),
1380
+ writeChannel: writeChannel((0, import_node_path16.join)(path5, "channels")),
1365
1381
  /**
1366
1382
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1367
1383
  *
1368
1384
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1369
1385
  *
1370
1386
  */
1371
- rmChannel: rmChannel((0, import_node_path15.join)(path5, "channels")),
1387
+ rmChannel: rmChannel((0, import_node_path16.join)(path5, "channels")),
1372
1388
  /**
1373
1389
  * Remove an channel by an Event id
1374
1390
  *
1375
1391
  * @param id - The id of the channel you want to remove
1376
1392
  *
1377
1393
  */
1378
- rmChannelById: rmChannelById((0, import_node_path15.join)(path5)),
1394
+ rmChannelById: rmChannelById((0, import_node_path16.join)(path5)),
1379
1395
  /**
1380
1396
  * Moves a given channel id to the version directory
1381
1397
  * @param directory
1382
1398
  */
1383
- versionChannel: versionChannel((0, import_node_path15.join)(path5)),
1399
+ versionChannel: versionChannel((0, import_node_path16.join)(path5)),
1384
1400
  /**
1385
1401
  * Check to see if a channel version exists
1386
1402
  * @param id - The id of the channel
1387
1403
  * @param version - The version of the channel (supports semver)
1388
1404
  * @returns
1389
1405
  */
1390
- channelHasVersion: channelHasVersion((0, import_node_path15.join)(path5)),
1406
+ channelHasVersion: channelHasVersion((0, import_node_path16.join)(path5)),
1391
1407
  /**
1392
1408
  * Add a channel to an event
1393
1409
  *
@@ -1404,7 +1420,7 @@ var index_default = (path5) => {
1404
1420
  *
1405
1421
  * ```
1406
1422
  */
1407
- addEventToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "events"),
1423
+ addEventToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "events"),
1408
1424
  /**
1409
1425
  * Add a channel to an command
1410
1426
  *
@@ -1421,7 +1437,7 @@ var index_default = (path5) => {
1421
1437
  *
1422
1438
  * ```
1423
1439
  */
1424
- addCommandToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "commands"),
1440
+ addCommandToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "commands"),
1425
1441
  /**
1426
1442
  * Add a channel to an query
1427
1443
  *
@@ -1438,7 +1454,7 @@ var index_default = (path5) => {
1438
1454
  *
1439
1455
  * ```
1440
1456
  */
1441
- addQueryToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "queries"),
1457
+ addQueryToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "queries"),
1442
1458
  /**
1443
1459
  * ================================
1444
1460
  * SERVICES
@@ -1451,14 +1467,14 @@ var index_default = (path5) => {
1451
1467
  * @param options - Optional options to write the event
1452
1468
  *
1453
1469
  */
1454
- writeService: writeService((0, import_node_path15.join)(path5, "services")),
1470
+ writeService: writeService((0, import_node_path16.join)(path5, "services")),
1455
1471
  /**
1456
1472
  * Adds a versioned service to EventCatalog
1457
1473
  *
1458
1474
  * @param service - The service to write
1459
1475
  *
1460
1476
  */
1461
- writeVersionedService: writeVersionedService((0, import_node_path15.join)(path5, "services")),
1477
+ writeVersionedService: writeVersionedService((0, import_node_path16.join)(path5, "services")),
1462
1478
  /**
1463
1479
  * Adds a service to a domain in EventCatalog
1464
1480
  *
@@ -1467,45 +1483,45 @@ var index_default = (path5) => {
1467
1483
  * @param options - Optional options to write the event
1468
1484
  *
1469
1485
  */
1470
- writeServiceToDomain: writeServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1486
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path16.join)(path5, "domains")),
1471
1487
  /**
1472
1488
  * Returns a service from EventCatalog
1473
1489
  * @param id - The id of the service to retrieve
1474
1490
  * @param version - Optional id of the version to get (supports semver)
1475
1491
  * @returns Service|Undefined
1476
1492
  */
1477
- getService: getService((0, import_node_path15.join)(path5)),
1493
+ getService: getService((0, import_node_path16.join)(path5)),
1478
1494
  /**
1479
1495
  * Returns a service from EventCatalog by it's path.
1480
1496
  * @param path - The path to the service to retrieve
1481
1497
  * @returns Service|Undefined
1482
1498
  */
1483
- getServiceByPath: getServiceByPath((0, import_node_path15.join)(path5)),
1499
+ getServiceByPath: getServiceByPath((0, import_node_path16.join)(path5)),
1484
1500
  /**
1485
1501
  * Returns all services from EventCatalog
1486
1502
  * @param latestOnly - optional boolean, set to true to get only latest versions
1487
1503
  * @returns Service[]|Undefined
1488
1504
  */
1489
- getServices: getServices((0, import_node_path15.join)(path5)),
1505
+ getServices: getServices((0, import_node_path16.join)(path5)),
1490
1506
  /**
1491
1507
  * Moves a given service id to the version directory
1492
1508
  * @param directory
1493
1509
  */
1494
- versionService: versionService((0, import_node_path15.join)(path5)),
1510
+ versionService: versionService((0, import_node_path16.join)(path5)),
1495
1511
  /**
1496
1512
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1497
1513
  *
1498
1514
  * @param path - The path to your service, e.g. `/InventoryService`
1499
1515
  *
1500
1516
  */
1501
- rmService: rmService((0, import_node_path15.join)(path5, "services")),
1517
+ rmService: rmService((0, import_node_path16.join)(path5, "services")),
1502
1518
  /**
1503
1519
  * Remove an service by an service id
1504
1520
  *
1505
1521
  * @param id - The id of the service you want to remove
1506
1522
  *
1507
1523
  */
1508
- rmServiceById: rmServiceById((0, import_node_path15.join)(path5)),
1524
+ rmServiceById: rmServiceById((0, import_node_path16.join)(path5)),
1509
1525
  /**
1510
1526
  * Adds a file to the given service
1511
1527
  * @param id - The id of the service to add the file to
@@ -1513,21 +1529,21 @@ var index_default = (path5) => {
1513
1529
  * @param version - Optional version of the service to add the file to
1514
1530
  * @returns
1515
1531
  */
1516
- addFileToService: addFileToService((0, import_node_path15.join)(path5)),
1532
+ addFileToService: addFileToService((0, import_node_path16.join)(path5)),
1517
1533
  /**
1518
1534
  * Returns the specifications for a given service
1519
1535
  * @param id - The id of the service to retrieve the specifications for
1520
1536
  * @param version - Optional version of the service
1521
1537
  * @returns
1522
1538
  */
1523
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path15.join)(path5)),
1539
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path16.join)(path5)),
1524
1540
  /**
1525
1541
  * Check to see if a service version exists
1526
1542
  * @param id - The id of the service
1527
1543
  * @param version - The version of the service (supports semver)
1528
1544
  * @returns
1529
1545
  */
1530
- serviceHasVersion: serviceHasVersion((0, import_node_path15.join)(path5)),
1546
+ serviceHasVersion: serviceHasVersion((0, import_node_path16.join)(path5)),
1531
1547
  /**
1532
1548
  * Add an event to a service by it's id.
1533
1549
  *
@@ -1547,7 +1563,7 @@ var index_default = (path5) => {
1547
1563
  *
1548
1564
  * ```
1549
1565
  */
1550
- addEventToService: addMessageToService((0, import_node_path15.join)(path5)),
1566
+ addEventToService: addMessageToService((0, import_node_path16.join)(path5)),
1551
1567
  /**
1552
1568
  * Add a command to a service by it's id.
1553
1569
  *
@@ -1567,7 +1583,7 @@ var index_default = (path5) => {
1567
1583
  *
1568
1584
  * ```
1569
1585
  */
1570
- addCommandToService: addMessageToService((0, import_node_path15.join)(path5)),
1586
+ addCommandToService: addMessageToService((0, import_node_path16.join)(path5)),
1571
1587
  /**
1572
1588
  * Add a query to a service by it's id.
1573
1589
  *
@@ -1587,7 +1603,7 @@ var index_default = (path5) => {
1587
1603
  *
1588
1604
  * ```
1589
1605
  */
1590
- addQueryToService: addMessageToService((0, import_node_path15.join)(path5)),
1606
+ addQueryToService: addMessageToService((0, import_node_path16.join)(path5)),
1591
1607
  /**
1592
1608
  * Add an entity to a service by its id.
1593
1609
  *
@@ -1605,7 +1621,7 @@ var index_default = (path5) => {
1605
1621
  *
1606
1622
  * ```
1607
1623
  */
1608
- addEntityToService: addEntityToService((0, import_node_path15.join)(path5)),
1624
+ addEntityToService: addEntityToService((0, import_node_path16.join)(path5)),
1609
1625
  /**
1610
1626
  * Check to see if a service exists by it's path.
1611
1627
  *
@@ -1622,13 +1638,13 @@ var index_default = (path5) => {
1622
1638
  * @param path - The path to the service to check
1623
1639
  * @returns boolean
1624
1640
  */
1625
- isService: isService((0, import_node_path15.join)(path5)),
1641
+ isService: isService((0, import_node_path16.join)(path5)),
1626
1642
  /**
1627
1643
  * Converts a file to a service.
1628
1644
  * @param file - The file to convert to a service.
1629
1645
  * @returns The service.
1630
1646
  */
1631
- toService: toService((0, import_node_path15.join)(path5)),
1647
+ toService: toService((0, import_node_path16.join)(path5)),
1632
1648
  /**
1633
1649
  * ================================
1634
1650
  * Domains
@@ -1641,39 +1657,39 @@ var index_default = (path5) => {
1641
1657
  * @param options - Optional options to write the event
1642
1658
  *
1643
1659
  */
1644
- writeDomain: writeDomain((0, import_node_path15.join)(path5, "domains")),
1660
+ writeDomain: writeDomain((0, import_node_path16.join)(path5, "domains")),
1645
1661
  /**
1646
1662
  * Returns a domain from EventCatalog
1647
1663
  * @param id - The id of the domain to retrieve
1648
1664
  * @param version - Optional id of the version to get (supports semver)
1649
1665
  * @returns Domain|Undefined
1650
1666
  */
1651
- getDomain: getDomain((0, import_node_path15.join)(path5, "domains")),
1667
+ getDomain: getDomain((0, import_node_path16.join)(path5, "domains")),
1652
1668
  /**
1653
1669
  * Returns all domains from EventCatalog
1654
1670
  * @param latestOnly - optional boolean, set to true to get only latest versions
1655
1671
  * @returns Domain[]|Undefined
1656
1672
  */
1657
- getDomains: getDomains((0, import_node_path15.join)(path5)),
1673
+ getDomains: getDomains((0, import_node_path16.join)(path5)),
1658
1674
  /**
1659
1675
  * Moves a given domain id to the version directory
1660
1676
  * @param directory
1661
1677
  */
1662
- versionDomain: versionDomain((0, import_node_path15.join)(path5, "domains")),
1678
+ versionDomain: versionDomain((0, import_node_path16.join)(path5, "domains")),
1663
1679
  /**
1664
1680
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1665
1681
  *
1666
1682
  * @param path - The path to your domain, e.g. `/Payment`
1667
1683
  *
1668
1684
  */
1669
- rmDomain: rmDomain((0, import_node_path15.join)(path5, "domains")),
1685
+ rmDomain: rmDomain((0, import_node_path16.join)(path5, "domains")),
1670
1686
  /**
1671
1687
  * Remove an service by an domain id
1672
1688
  *
1673
1689
  * @param id - The id of the domain you want to remove
1674
1690
  *
1675
1691
  */
1676
- rmDomainById: rmDomainById((0, import_node_path15.join)(path5, "domains")),
1692
+ rmDomainById: rmDomainById((0, import_node_path16.join)(path5, "domains")),
1677
1693
  /**
1678
1694
  * Adds a file to the given domain
1679
1695
  * @param id - The id of the domain to add the file to
@@ -1681,28 +1697,28 @@ var index_default = (path5) => {
1681
1697
  * @param version - Optional version of the domain to add the file to
1682
1698
  * @returns
1683
1699
  */
1684
- addFileToDomain: addFileToDomain((0, import_node_path15.join)(path5, "domains")),
1700
+ addFileToDomain: addFileToDomain((0, import_node_path16.join)(path5, "domains")),
1685
1701
  /**
1686
1702
  * Adds an ubiquitous language dictionary to a domain
1687
1703
  * @param id - The id of the domain to add the ubiquitous language to
1688
1704
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1689
1705
  * @param version - Optional version of the domain to add the ubiquitous language to
1690
1706
  */
1691
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path15.join)(path5, "domains")),
1707
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path16.join)(path5, "domains")),
1692
1708
  /**
1693
1709
  * Get the ubiquitous language dictionary from a domain
1694
1710
  * @param id - The id of the domain to get the ubiquitous language from
1695
1711
  * @param version - Optional version of the domain to get the ubiquitous language from
1696
1712
  * @returns
1697
1713
  */
1698
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path15.join)(path5, "domains")),
1714
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path16.join)(path5, "domains")),
1699
1715
  /**
1700
1716
  * Check to see if a domain version exists
1701
1717
  * @param id - The id of the domain
1702
1718
  * @param version - The version of the domain (supports semver)
1703
1719
  * @returns
1704
1720
  */
1705
- domainHasVersion: domainHasVersion((0, import_node_path15.join)(path5)),
1721
+ domainHasVersion: domainHasVersion((0, import_node_path16.join)(path5)),
1706
1722
  /**
1707
1723
  * Adds a given service to a domain
1708
1724
  * @param id - The id of the domain
@@ -1710,7 +1726,7 @@ var index_default = (path5) => {
1710
1726
  * @param version - (Optional) The version of the domain to add the service to
1711
1727
  * @returns
1712
1728
  */
1713
- addServiceToDomain: addServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1729
+ addServiceToDomain: addServiceToDomain((0, import_node_path16.join)(path5, "domains")),
1714
1730
  /**
1715
1731
  * Adds a given subdomain to a domain
1716
1732
  * @param id - The id of the domain
@@ -1718,7 +1734,7 @@ var index_default = (path5) => {
1718
1734
  * @param version - (Optional) The version of the domain to add the subdomain to
1719
1735
  * @returns
1720
1736
  */
1721
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path15.join)(path5, "domains")),
1737
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path16.join)(path5, "domains")),
1722
1738
  /**
1723
1739
  * Adds an entity to a domain
1724
1740
  * @param id - The id of the domain
@@ -1726,7 +1742,7 @@ var index_default = (path5) => {
1726
1742
  * @param version - (Optional) The version of the domain to add the entity to
1727
1743
  * @returns
1728
1744
  */
1729
- addEntityToDomain: addEntityToDomain((0, import_node_path15.join)(path5, "domains")),
1745
+ addEntityToDomain: addEntityToDomain((0, import_node_path16.join)(path5, "domains")),
1730
1746
  /**
1731
1747
  * ================================
1732
1748
  * Teams
@@ -1739,25 +1755,25 @@ var index_default = (path5) => {
1739
1755
  * @param options - Optional options to write the team
1740
1756
  *
1741
1757
  */
1742
- writeTeam: writeTeam((0, import_node_path15.join)(path5, "teams")),
1758
+ writeTeam: writeTeam((0, import_node_path16.join)(path5, "teams")),
1743
1759
  /**
1744
1760
  * Returns a team from EventCatalog
1745
1761
  * @param id - The id of the team to retrieve
1746
1762
  * @returns Team|Undefined
1747
1763
  */
1748
- getTeam: getTeam((0, import_node_path15.join)(path5, "teams")),
1764
+ getTeam: getTeam((0, import_node_path16.join)(path5, "teams")),
1749
1765
  /**
1750
1766
  * Returns all teams from EventCatalog
1751
1767
  * @returns Team[]|Undefined
1752
1768
  */
1753
- getTeams: getTeams((0, import_node_path15.join)(path5, "teams")),
1769
+ getTeams: getTeams((0, import_node_path16.join)(path5, "teams")),
1754
1770
  /**
1755
1771
  * Remove a team by the team id
1756
1772
  *
1757
1773
  * @param id - The id of the team you want to remove
1758
1774
  *
1759
1775
  */
1760
- rmTeamById: rmTeamById((0, import_node_path15.join)(path5, "teams")),
1776
+ rmTeamById: rmTeamById((0, import_node_path16.join)(path5, "teams")),
1761
1777
  /**
1762
1778
  * ================================
1763
1779
  * Users
@@ -1770,25 +1786,25 @@ var index_default = (path5) => {
1770
1786
  * @param options - Optional options to write the user
1771
1787
  *
1772
1788
  */
1773
- writeUser: writeUser((0, import_node_path15.join)(path5, "users")),
1789
+ writeUser: writeUser((0, import_node_path16.join)(path5, "users")),
1774
1790
  /**
1775
1791
  * Returns a user from EventCatalog
1776
1792
  * @param id - The id of the user to retrieve
1777
1793
  * @returns User|Undefined
1778
1794
  */
1779
- getUser: getUser((0, import_node_path15.join)(path5, "users")),
1795
+ getUser: getUser((0, import_node_path16.join)(path5, "users")),
1780
1796
  /**
1781
1797
  * Returns all user from EventCatalog
1782
1798
  * @returns User[]|Undefined
1783
1799
  */
1784
- getUsers: getUsers((0, import_node_path15.join)(path5)),
1800
+ getUsers: getUsers((0, import_node_path16.join)(path5)),
1785
1801
  /**
1786
1802
  * Remove a user by the user id
1787
1803
  *
1788
1804
  * @param id - The id of the user you want to remove
1789
1805
  *
1790
1806
  */
1791
- rmUserById: rmUserById((0, import_node_path15.join)(path5, "users")),
1807
+ rmUserById: rmUserById((0, import_node_path16.join)(path5, "users")),
1792
1808
  /**
1793
1809
  * ================================
1794
1810
  * Custom Docs
@@ -1799,32 +1815,32 @@ var index_default = (path5) => {
1799
1815
  * @param path - The path to the custom doc to retrieve
1800
1816
  * @returns CustomDoc|Undefined
1801
1817
  */
1802
- getCustomDoc: getCustomDoc((0, import_node_path15.join)(path5, "docs")),
1818
+ getCustomDoc: getCustomDoc((0, import_node_path16.join)(path5, "docs")),
1803
1819
  /**
1804
1820
  * Returns all custom docs from EventCatalog
1805
1821
  * @param options - Optional options to get custom docs from a specific path
1806
1822
  * @returns CustomDoc[]|Undefined
1807
1823
  */
1808
- getCustomDocs: getCustomDocs((0, import_node_path15.join)(path5, "docs")),
1824
+ getCustomDocs: getCustomDocs((0, import_node_path16.join)(path5, "docs")),
1809
1825
  /**
1810
1826
  * Writes a custom doc to EventCatalog
1811
1827
  * @param customDoc - The custom doc to write
1812
1828
  * @param options - Optional options to write the custom doc
1813
1829
  *
1814
1830
  */
1815
- writeCustomDoc: writeCustomDoc((0, import_node_path15.join)(path5, "docs")),
1831
+ writeCustomDoc: writeCustomDoc((0, import_node_path16.join)(path5, "docs")),
1816
1832
  /**
1817
1833
  * Removes a custom doc from EventCatalog
1818
1834
  * @param path - The path to the custom doc to remove
1819
1835
  *
1820
1836
  */
1821
- rmCustomDoc: rmCustomDoc((0, import_node_path15.join)(path5, "docs")),
1837
+ rmCustomDoc: rmCustomDoc((0, import_node_path16.join)(path5, "docs")),
1822
1838
  /**
1823
1839
  * Dumps the catalog to a JSON file.
1824
1840
  * @param directory - The directory to dump the catalog to
1825
1841
  * @returns A JSON file with the catalog
1826
1842
  */
1827
- dumpCatalog: dumpCatalog((0, import_node_path15.join)(path5)),
1843
+ dumpCatalog: dumpCatalog((0, import_node_path16.join)(path5)),
1828
1844
  /**
1829
1845
  * Returns the event catalog configuration file.
1830
1846
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1832,7 +1848,7 @@ var index_default = (path5) => {
1832
1848
  * @param directory - The directory of the catalog.
1833
1849
  * @returns A JSON object with the configuration for the event catalog.
1834
1850
  */
1835
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path15.join)(path5)),
1851
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path16.join)(path5)),
1836
1852
  /**
1837
1853
  * ================================
1838
1854
  * Resources Utils
@@ -1853,33 +1869,33 @@ var index_default = (path5) => {
1853
1869
  * @param path - The path to the message to retrieve
1854
1870
  * @returns Message|Undefined
1855
1871
  */
1856
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path15.join)(path5)),
1872
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path16.join)(path5)),
1857
1873
  /**
1858
1874
  * Returns the producers and consumers (services) for a given message
1859
1875
  * @param id - The id of the message to get the producers and consumers for
1860
1876
  * @param version - Optional version of the message
1861
1877
  * @returns { producers: Service[], consumers: Service[] }
1862
1878
  */
1863
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path15.join)(path5)),
1879
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path16.join)(path5)),
1864
1880
  /**
1865
1881
  * Returns the consumers of a given schema path
1866
1882
  * @param path - The path to the schema to get the consumers for
1867
1883
  * @returns Service[]
1868
1884
  */
1869
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path15.join)(path5)),
1885
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path16.join)(path5)),
1870
1886
  /**
1871
1887
  * Returns the producers of a given schema path
1872
1888
  * @param path - The path to the schema to get the producers for
1873
1889
  * @returns Service[]
1874
1890
  */
1875
- getProducersOfSchema: getProducersOfSchema((0, import_node_path15.join)(path5)),
1891
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path16.join)(path5)),
1876
1892
  /**
1877
1893
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1878
1894
  * @param id - The id of the resource to get the owners for
1879
1895
  * @param version - Optional version of the resource
1880
1896
  * @returns { owners: User[] }
1881
1897
  */
1882
- getOwnersForResource: getOwnersForResource((0, import_node_path15.join)(path5)),
1898
+ getOwnersForResource: getOwnersForResource((0, import_node_path16.join)(path5)),
1883
1899
  /**
1884
1900
  * ================================
1885
1901
  * Entities
@@ -1891,13 +1907,13 @@ var index_default = (path5) => {
1891
1907
  * @param version - Optional id of the version to get (supports semver)
1892
1908
  * @returns Entity|Undefined
1893
1909
  */
1894
- getEntity: getEntity((0, import_node_path15.join)(path5)),
1910
+ getEntity: getEntity((0, import_node_path16.join)(path5)),
1895
1911
  /**
1896
1912
  * Returns all entities from EventCatalog
1897
1913
  * @param latestOnly - optional boolean, set to true to get only latest versions
1898
1914
  * @returns Entity[]|Undefined
1899
1915
  */
1900
- getEntities: getEntities((0, import_node_path15.join)(path5)),
1916
+ getEntities: getEntities((0, import_node_path16.join)(path5)),
1901
1917
  /**
1902
1918
  * Adds an entity to EventCatalog
1903
1919
  *
@@ -1905,33 +1921,33 @@ var index_default = (path5) => {
1905
1921
  * @param options - Optional options to write the entity
1906
1922
  *
1907
1923
  */
1908
- writeEntity: writeEntity((0, import_node_path15.join)(path5, "entities")),
1924
+ writeEntity: writeEntity((0, import_node_path16.join)(path5, "entities")),
1909
1925
  /**
1910
1926
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1911
1927
  *
1912
1928
  * @param path - The path to your entity, e.g. `/User`
1913
1929
  *
1914
1930
  */
1915
- rmEntity: rmEntity((0, import_node_path15.join)(path5, "entities")),
1931
+ rmEntity: rmEntity((0, import_node_path16.join)(path5, "entities")),
1916
1932
  /**
1917
1933
  * Remove an entity by an entity id
1918
1934
  *
1919
1935
  * @param id - The id of the entity you want to remove
1920
1936
  *
1921
1937
  */
1922
- rmEntityById: rmEntityById((0, import_node_path15.join)(path5)),
1938
+ rmEntityById: rmEntityById((0, import_node_path16.join)(path5)),
1923
1939
  /**
1924
1940
  * Moves a given entity id to the version directory
1925
1941
  * @param id - The id of the entity to version
1926
1942
  */
1927
- versionEntity: versionEntity((0, import_node_path15.join)(path5)),
1943
+ versionEntity: versionEntity((0, import_node_path16.join)(path5)),
1928
1944
  /**
1929
1945
  * Check to see if an entity version exists
1930
1946
  * @param id - The id of the entity
1931
1947
  * @param version - The version of the entity (supports semver)
1932
1948
  * @returns
1933
1949
  */
1934
- entityHasVersion: entityHasVersion((0, import_node_path15.join)(path5))
1950
+ entityHasVersion: entityHasVersion((0, import_node_path16.join)(path5))
1935
1951
  };
1936
1952
  };
1937
1953
  //# sourceMappingURL=index.js.map