@eventcatalog/sdk 2.16.0 → 2.17.1

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.
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ __export(src_exports, {
33
33
  default: () => src_default
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
- var import_node_path21 = require("path");
36
+ var import_node_path22 = require("path");
37
37
 
38
38
  // src/dsl/utils.ts
39
39
  var import_glob = require("glob");
@@ -828,8 +828,8 @@ var getFiles = async (pattern, ignore = "") => {
828
828
  );
829
829
  }
830
830
  };
831
- var readMdxFile = async (path7) => {
832
- const { data } = import_gray_matter.default.read(path7);
831
+ var readMdxFile = async (path8) => {
832
+ const { data } = import_gray_matter.default.read(path8);
833
833
  const { markdown, ...frontmatter } = data;
834
834
  return { ...frontmatter, markdown };
835
835
  };
@@ -923,8 +923,8 @@ var writeResource = async (catalogDir, resource, options = {
923
923
  versionExistingContent: false,
924
924
  format: "mdx"
925
925
  }) => {
926
- const path7 = options.path || `/${resource.id}`;
927
- const fullPath = (0, import_path.join)(catalogDir, path7);
926
+ const path8 = options.path || `/${resource.id}`;
927
+ const fullPath = (0, import_path.join)(catalogDir, path8);
928
928
  const format = options.format || "mdx";
929
929
  import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
930
930
  const lockPath = (0, import_path.join)(fullPath, `index.${format}`);
@@ -1058,16 +1058,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
1058
1058
  }
1059
1059
  invalidateFileCache();
1060
1060
  };
1061
- var waitForFileRemoval = async (path7, maxRetries = 50, delay = 10) => {
1061
+ var waitForFileRemoval = async (path8, maxRetries = 50, delay = 10) => {
1062
1062
  for (let i = 0; i < maxRetries; i++) {
1063
1063
  try {
1064
- await import_promises.default.access(path7);
1064
+ await import_promises.default.access(path8);
1065
1065
  await new Promise((resolve2) => setTimeout(resolve2, delay));
1066
1066
  } catch (error) {
1067
1067
  return;
1068
1068
  }
1069
1069
  }
1070
- throw new Error(`File/directory ${path7} was not removed after ${maxRetries} attempts`);
1070
+ throw new Error(`File/directory ${path8} was not removed after ${maxRetries} attempts`);
1071
1071
  };
1072
1072
  var addFileToResource = async (catalogDir, id, file, version, options) => {
1073
1073
  let pathToResource;
@@ -1120,8 +1120,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
1120
1120
  pathForEvent = (0, import_node_path4.join)(pathForEvent, event.id);
1121
1121
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
1122
1122
  };
1123
- var rmEvent = (directory) => async (path7) => {
1124
- await import_promises2.default.rm((0, import_node_path4.join)(directory, path7), { recursive: true });
1123
+ var rmEvent = (directory) => async (path8) => {
1124
+ await import_promises2.default.rm((0, import_node_path4.join)(directory, path8), { recursive: true });
1125
1125
  invalidateFileCache();
1126
1126
  };
1127
1127
  var rmEventById = (directory) => async (id, version, persistFiles) => {
@@ -1157,8 +1157,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
1157
1157
  pathForCommand = (0, import_node_path5.join)(pathForCommand, command.id);
1158
1158
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
1159
1159
  };
1160
- var rmCommand = (directory) => async (path7) => {
1161
- await import_promises3.default.rm((0, import_node_path5.join)(directory, path7), { recursive: true });
1160
+ var rmCommand = (directory) => async (path8) => {
1161
+ await import_promises3.default.rm((0, import_node_path5.join)(directory, path8), { recursive: true });
1162
1162
  invalidateFileCache();
1163
1163
  };
1164
1164
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
@@ -1192,8 +1192,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
1192
1192
  pathForQuery = (0, import_node_path6.join)(pathForQuery, query.id);
1193
1193
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
1194
1194
  };
1195
- var rmQuery = (directory) => async (path7) => {
1196
- await import_promises4.default.rm((0, import_node_path6.join)(directory, path7), { recursive: true });
1195
+ var rmQuery = (directory) => async (path8) => {
1196
+ await import_promises4.default.rm((0, import_node_path6.join)(directory, path8), { recursive: true });
1197
1197
  invalidateFileCache();
1198
1198
  };
1199
1199
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
@@ -1213,8 +1213,8 @@ var queryHasVersion = (directory) => async (id, version) => {
1213
1213
  var import_promises5 = __toESM(require("fs/promises"));
1214
1214
  var import_node_path7 = require("path");
1215
1215
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
1216
- var getServiceByPath = (directory) => async (path7) => {
1217
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path7);
1216
+ var getServiceByPath = (directory) => async (path8) => {
1217
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path8);
1218
1218
  return service;
1219
1219
  };
1220
1220
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -1249,8 +1249,8 @@ var writeService = (directory) => async (service, options = {
1249
1249
  };
1250
1250
  var writeVersionedService = (directory) => async (service) => {
1251
1251
  const resource = { ...service };
1252
- const path7 = getVersionedDirectory(service.id, service.version);
1253
- return await writeService(directory)(resource, { path: path7 });
1252
+ const path8 = getVersionedDirectory(service.id, service.version);
1253
+ return await writeService(directory)(resource, { path: path8 });
1254
1254
  };
1255
1255
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
1256
1256
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -1258,8 +1258,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
1258
1258
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
1259
1259
  };
1260
1260
  var versionService = (directory) => async (id) => versionResource(directory, id);
1261
- var rmService = (directory) => async (path7) => {
1262
- await import_promises5.default.rm((0, import_node_path7.join)(directory, path7), { recursive: true });
1261
+ var rmService = (directory) => async (path8) => {
1262
+ await import_promises5.default.rm((0, import_node_path7.join)(directory, path8), { recursive: true });
1263
1263
  invalidateFileCache();
1264
1264
  };
1265
1265
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
@@ -1324,8 +1324,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
1324
1324
  if (!existingResource) {
1325
1325
  throw new Error(`Cannot find service ${id} in the catalog`);
1326
1326
  }
1327
- const path7 = existingResource.split(/[\\/]+services/)[0];
1328
- const pathToResource = (0, import_node_path7.join)(path7, "services");
1327
+ const path8 = existingResource.split(/[\\/]+services/)[0];
1328
+ const pathToResource = (0, import_node_path7.join)(path8, "services");
1329
1329
  await rmServiceById(directory)(id, version);
1330
1330
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1331
1331
  };
@@ -1333,9 +1333,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
1333
1333
  const file = await findFileById(directory, id, version);
1334
1334
  return !!file;
1335
1335
  };
1336
- var isService = (directory) => async (path7) => {
1337
- const service = await getServiceByPath(directory)(path7);
1338
- const relativePath = (0, import_node_path7.relative)(directory, path7);
1336
+ var isService = (directory) => async (path8) => {
1337
+ const service = await getServiceByPath(directory)(path8);
1338
+ const relativePath = (0, import_node_path7.relative)(directory, path8);
1339
1339
  const segments = relativePath.split(/[/\\]+/);
1340
1340
  return !!service && segments.includes("services");
1341
1341
  };
@@ -1357,8 +1357,8 @@ var addEntityToService = (directory) => async (id, entity, version) => {
1357
1357
  if (!existingResource) {
1358
1358
  throw new Error(`Cannot find service ${id} in the catalog`);
1359
1359
  }
1360
- const path7 = existingResource.split(/[\\/]+services/)[0];
1361
- const pathToResource = (0, import_node_path7.join)(path7, "services");
1360
+ const path8 = existingResource.split(/[\\/]+services/)[0];
1361
+ const pathToResource = (0, import_node_path7.join)(path8, "services");
1362
1362
  await rmServiceById(directory)(id, version);
1363
1363
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1364
1364
  };
@@ -1393,8 +1393,8 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
1393
1393
  if (!existingResource) {
1394
1394
  throw new Error(`Cannot find service ${id} in the catalog`);
1395
1395
  }
1396
- const path7 = existingResource.split(/[\\/]+services/)[0];
1397
- const pathToResource = (0, import_node_path7.join)(path7, "services");
1396
+ const path8 = existingResource.split(/[\\/]+services/)[0];
1397
+ const pathToResource = (0, import_node_path7.join)(path8, "services");
1398
1398
  await rmServiceById(directory)(id, version);
1399
1399
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1400
1400
  };
@@ -1435,8 +1435,8 @@ var writeDomain = (directory) => async (domain, options = {
1435
1435
  return await writeResource(directory, resource, { ...options, type: "domain" });
1436
1436
  };
1437
1437
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
1438
- var rmDomain = (directory) => async (path7) => {
1439
- await import_promises6.default.rm((0, import_node_path8.join)(directory, path7), { recursive: true });
1438
+ var rmDomain = (directory) => async (path8) => {
1439
+ await import_promises6.default.rm((0, import_node_path8.join)(directory, path8), { recursive: true });
1440
1440
  invalidateFileCache();
1441
1441
  };
1442
1442
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
@@ -1567,8 +1567,8 @@ var import_node_path9 = require("path");
1567
1567
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
1568
1568
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
1569
1569
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
1570
- var rmChannel = (directory) => async (path7) => {
1571
- await import_promises7.default.rm((0, import_node_path9.join)(directory, path7), { recursive: true });
1570
+ var rmChannel = (directory) => async (path8) => {
1571
+ await import_promises7.default.rm((0, import_node_path9.join)(directory, path8), { recursive: true });
1572
1572
  invalidateFileCache();
1573
1573
  };
1574
1574
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
@@ -1610,18 +1610,19 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
1610
1610
  if (!existingResource) {
1611
1611
  throw new Error(`Cannot find message ${id} in the catalog`);
1612
1612
  }
1613
- const path7 = existingResource.split(`/[\\/]+${collection}`)[0];
1614
- const pathToResource = (0, import_node_path9.join)(path7, collection);
1613
+ const path8 = existingResource.split(`/[\\/]+${collection}`)[0];
1614
+ const pathToResource = (0, import_node_path9.join)(path8, collection);
1615
1615
  await rmMessageById(directory)(_message.id, _message.version, true);
1616
1616
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
1617
1617
  };
1618
1618
 
1619
1619
  // src/messages.ts
1620
1620
  var import_node_path10 = require("path");
1621
+ var import_node_fs4 = __toESM(require("fs"));
1621
1622
  var import_gray_matter4 = __toESM(require("gray-matter"));
1622
1623
  var import_semver5 = require("semver");
1623
- var getMessageBySchemaPath = (directory) => async (path7, options) => {
1624
- const pathToMessage = (0, import_node_path10.dirname)(path7);
1624
+ var getMessageBySchemaPath = (directory) => async (path8, options) => {
1625
+ const pathToMessage = (0, import_node_path10.dirname)(path8);
1625
1626
  try {
1626
1627
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
1627
1628
  if (!files || files.length === 0) {
@@ -1693,35 +1694,49 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
1693
1694
  }
1694
1695
  return { producers, consumers };
1695
1696
  };
1696
- var getConsumersOfSchema = (directory) => async (path7) => {
1697
+ var getConsumersOfSchema = (directory) => async (path8) => {
1697
1698
  try {
1698
- const message = await getMessageBySchemaPath(directory)(path7);
1699
+ const message = await getMessageBySchemaPath(directory)(path8);
1699
1700
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
1700
1701
  return consumers;
1701
1702
  } catch (error) {
1702
1703
  return [];
1703
1704
  }
1704
1705
  };
1705
- var getProducersOfSchema = (directory) => async (path7) => {
1706
+ var getProducersOfSchema = (directory) => async (path8) => {
1706
1707
  try {
1707
- const message = await getMessageBySchemaPath(directory)(path7);
1708
+ const message = await getMessageBySchemaPath(directory)(path8);
1708
1709
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
1709
1710
  return producers;
1710
1711
  } catch (error) {
1711
1712
  return [];
1712
1713
  }
1713
1714
  };
1715
+ var getSchemaForMessage = (directory) => async (id, version) => {
1716
+ const file = await findFileById(directory, id, version);
1717
+ if (!file || !import_node_fs4.default.existsSync(file)) return void 0;
1718
+ const { data } = import_gray_matter4.default.read(file);
1719
+ if (!data.schemaPath) return void 0;
1720
+ const resourceDirectory = (0, import_node_path10.dirname)(file);
1721
+ const pathToSchema = (0, import_node_path10.join)(resourceDirectory, data.schemaPath);
1722
+ if (!import_node_fs4.default.existsSync(pathToSchema)) return void 0;
1723
+ const schema = import_node_fs4.default.readFileSync(pathToSchema, "utf8");
1724
+ return {
1725
+ schema,
1726
+ fileName: data.schemaPath
1727
+ };
1728
+ };
1714
1729
 
1715
1730
  // src/custom-docs.ts
1716
1731
  var import_node_path11 = __toESM(require("path"));
1717
- var import_node_fs4 = __toESM(require("fs"));
1732
+ var import_node_fs5 = __toESM(require("fs"));
1718
1733
  var import_promises8 = __toESM(require("fs/promises"));
1719
1734
  var import_gray_matter5 = __toESM(require("gray-matter"));
1720
1735
  var import_slugify = __toESM(require("slugify"));
1721
1736
  var getCustomDoc = (directory) => async (filePath) => {
1722
1737
  const fullPath = import_node_path11.default.join(directory, filePath);
1723
1738
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
1724
- const fileExists = import_node_fs4.default.existsSync(fullPathWithExtension);
1739
+ const fileExists = import_node_fs5.default.existsSync(fullPathWithExtension);
1725
1740
  if (!fileExists) {
1726
1741
  return void 0;
1727
1742
  }
@@ -1739,9 +1754,9 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
1739
1754
  const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
1740
1755
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
1741
1756
  const fullPath = import_node_path11.default.join(directory, options.path || "", withExtension);
1742
- import_node_fs4.default.mkdirSync(import_node_path11.default.dirname(fullPath), { recursive: true });
1757
+ import_node_fs5.default.mkdirSync(import_node_path11.default.dirname(fullPath), { recursive: true });
1743
1758
  const document = import_gray_matter5.default.stringify(customDoc.markdown.trim(), rest);
1744
- import_node_fs4.default.writeFileSync(fullPath, document);
1759
+ import_node_fs5.default.writeFileSync(fullPath, document);
1745
1760
  invalidateFileCache();
1746
1761
  };
1747
1762
  var rmCustomDoc = (directory) => async (filePath) => {
@@ -1752,13 +1767,13 @@ var rmCustomDoc = (directory) => async (filePath) => {
1752
1767
 
1753
1768
  // src/teams.ts
1754
1769
  var import_promises9 = __toESM(require("fs/promises"));
1755
- var import_node_fs6 = __toESM(require("fs"));
1770
+ var import_node_fs7 = __toESM(require("fs"));
1756
1771
  var import_node_path13 = require("path");
1757
1772
  var import_gray_matter7 = __toESM(require("gray-matter"));
1758
1773
  var import_node_path14 = __toESM(require("path"));
1759
1774
 
1760
1775
  // src/users.ts
1761
- var import_node_fs5 = __toESM(require("fs"));
1776
+ var import_node_fs6 = __toESM(require("fs"));
1762
1777
  var import_node_path12 = require("path");
1763
1778
  var import_gray_matter6 = __toESM(require("gray-matter"));
1764
1779
  var getUser = (catalogDir) => async (id) => {
@@ -1797,12 +1812,12 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
1797
1812
  }
1798
1813
  const { markdown, ...frontmatter } = resource;
1799
1814
  const document = import_gray_matter6.default.stringify(markdown, frontmatter);
1800
- import_node_fs5.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
1801
- import_node_fs5.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
1815
+ import_node_fs6.default.mkdirSync((0, import_node_path12.join)(catalogDir, ""), { recursive: true });
1816
+ import_node_fs6.default.writeFileSync((0, import_node_path12.join)(catalogDir, "", `${resource.id}.mdx`), document);
1802
1817
  invalidateFileCache();
1803
1818
  };
1804
1819
  var rmUserById = (catalogDir) => async (id) => {
1805
- import_node_fs5.default.rmSync((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
1820
+ import_node_fs6.default.rmSync((0, import_node_path12.join)(catalogDir, `${id}.mdx`), { recursive: true });
1806
1821
  invalidateFileCache();
1807
1822
  };
1808
1823
 
@@ -1841,8 +1856,8 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
1841
1856
  }
1842
1857
  const { markdown, ...frontmatter } = resource;
1843
1858
  const document = import_gray_matter7.default.stringify(markdown, frontmatter);
1844
- import_node_fs6.default.mkdirSync((0, import_node_path13.join)(catalogDir, ""), { recursive: true });
1845
- import_node_fs6.default.writeFileSync((0, import_node_path13.join)(catalogDir, "", `${resource.id}.mdx`), document);
1859
+ import_node_fs7.default.mkdirSync((0, import_node_path13.join)(catalogDir, ""), { recursive: true });
1860
+ import_node_fs7.default.writeFileSync((0, import_node_path13.join)(catalogDir, "", `${resource.id}.mdx`), document);
1846
1861
  invalidateFileCache();
1847
1862
  };
1848
1863
  var rmTeamById = (catalogDir) => async (id) => {
@@ -1908,8 +1923,8 @@ var filterCollection = (collection, options) => {
1908
1923
  };
1909
1924
  var getEventCatalogConfigurationFile = (directory) => async () => {
1910
1925
  try {
1911
- const path7 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
1912
- const configModule = await import(path7);
1926
+ const path8 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
1927
+ const configModule = await import(path8);
1913
1928
  return configModule.default;
1914
1929
  } catch (error) {
1915
1930
  console.error("Error getting event catalog configuration file", error);
@@ -1965,9 +1980,320 @@ var dumpCatalog = (directory) => async (options) => {
1965
1980
  };
1966
1981
  };
1967
1982
 
1968
- // src/changelogs.ts
1983
+ // src/snapshots.ts
1984
+ var import_node_fs8 = __toESM(require("fs"));
1969
1985
  var import_node_path16 = __toESM(require("path"));
1970
- var import_node_fs7 = __toESM(require("fs"));
1986
+ var import_node_child_process = require("child_process");
1987
+ var import_semver6 = require("semver");
1988
+
1989
+ // src/snapshot-diff.ts
1990
+ var stableStringify = (value) => {
1991
+ if (value === null || value === void 0 || typeof value !== "object") {
1992
+ return JSON.stringify(value);
1993
+ }
1994
+ if (Array.isArray(value)) {
1995
+ return "[" + value.map(stableStringify).join(",") + "]";
1996
+ }
1997
+ const sorted = Object.keys(value).sort().map((key) => JSON.stringify(key) + ":" + stableStringify(value[key]));
1998
+ return "{" + sorted.join(",") + "}";
1999
+ };
2000
+ var flattenResources = (snapshot) => {
2001
+ const resources = [];
2002
+ const addResources = (items, type) => {
2003
+ for (const item of items) {
2004
+ resources.push({
2005
+ resourceId: item.id,
2006
+ version: item.version,
2007
+ type,
2008
+ data: item
2009
+ });
2010
+ }
2011
+ };
2012
+ addResources(snapshot.resources.domains, "domain");
2013
+ addResources(snapshot.resources.services, "service");
2014
+ addResources(snapshot.resources.messages.events, "event");
2015
+ addResources(snapshot.resources.messages.commands, "command");
2016
+ addResources(snapshot.resources.messages.queries, "query");
2017
+ addResources(snapshot.resources.channels, "channel");
2018
+ return resources;
2019
+ };
2020
+ var EXCLUDED_FIELDS = /* @__PURE__ */ new Set(["markdown", "_eventcatalog"]);
2021
+ var getComparableFields = (data) => {
2022
+ const result = {};
2023
+ for (const [key, value] of Object.entries(data)) {
2024
+ if (!EXCLUDED_FIELDS.has(key)) {
2025
+ result[key] = value;
2026
+ }
2027
+ }
2028
+ return result;
2029
+ };
2030
+ var findChangedFields = (dataA, dataB) => {
2031
+ const fieldsA = getComparableFields(dataA);
2032
+ const fieldsB = getComparableFields(dataB);
2033
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(fieldsA), ...Object.keys(fieldsB)]);
2034
+ const changed = [];
2035
+ for (const key of allKeys) {
2036
+ if (stableStringify(fieldsA[key] ?? null) !== stableStringify(fieldsB[key] ?? null)) {
2037
+ changed.push(key);
2038
+ }
2039
+ }
2040
+ return changed;
2041
+ };
2042
+ var resourceKey = (r) => `${r.resourceId}@${r.version}`;
2043
+ var idTypeKey = (r) => `${r.resourceId}:${r.type}`;
2044
+ var computeResourceDiff = (snapshotA, snapshotB) => {
2045
+ const resourcesA = flattenResources(snapshotA);
2046
+ const resourcesB = flattenResources(snapshotB);
2047
+ const mapA = /* @__PURE__ */ new Map();
2048
+ const byIdA = /* @__PURE__ */ new Map();
2049
+ for (const r of resourcesA) {
2050
+ mapA.set(resourceKey(r), r);
2051
+ byIdA.set(idTypeKey(r), r);
2052
+ }
2053
+ const mapB = /* @__PURE__ */ new Map();
2054
+ const byIdB = /* @__PURE__ */ new Map();
2055
+ for (const r of resourcesB) {
2056
+ mapB.set(resourceKey(r), r);
2057
+ byIdB.set(idTypeKey(r), r);
2058
+ }
2059
+ const changes = [];
2060
+ const handledIds = /* @__PURE__ */ new Set();
2061
+ for (const resource of resourcesB) {
2062
+ const key = resourceKey(resource);
2063
+ if (!mapA.has(key)) {
2064
+ const idKey = idTypeKey(resource);
2065
+ const oldResource = byIdA.get(idKey);
2066
+ if (oldResource && oldResource.version !== resource.version && !handledIds.has(idKey)) {
2067
+ const changedFields = findChangedFields(oldResource.data, resource.data);
2068
+ changes.push({
2069
+ resourceId: resource.resourceId,
2070
+ version: resource.version,
2071
+ type: resource.type,
2072
+ changeType: "versioned",
2073
+ previousVersion: oldResource.version,
2074
+ newVersion: resource.version,
2075
+ changedFields: changedFields.length > 0 ? changedFields : void 0
2076
+ });
2077
+ handledIds.add(idKey);
2078
+ } else if (!handledIds.has(idKey)) {
2079
+ changes.push({
2080
+ resourceId: resource.resourceId,
2081
+ version: resource.version,
2082
+ type: resource.type,
2083
+ changeType: "added"
2084
+ });
2085
+ }
2086
+ }
2087
+ }
2088
+ for (const resource of resourcesA) {
2089
+ const key = resourceKey(resource);
2090
+ if (!mapB.has(key)) {
2091
+ const idKey = idTypeKey(resource);
2092
+ if (!handledIds.has(idKey)) {
2093
+ changes.push({
2094
+ resourceId: resource.resourceId,
2095
+ version: resource.version,
2096
+ type: resource.type,
2097
+ changeType: "removed"
2098
+ });
2099
+ }
2100
+ }
2101
+ }
2102
+ for (const resourceB of resourcesB) {
2103
+ const key = resourceKey(resourceB);
2104
+ const resourceA = mapA.get(key);
2105
+ if (resourceA) {
2106
+ const changedFields = findChangedFields(resourceA.data, resourceB.data);
2107
+ if (changedFields.length > 0) {
2108
+ changes.push({
2109
+ resourceId: resourceB.resourceId,
2110
+ version: resourceB.version,
2111
+ type: resourceB.type,
2112
+ changeType: "modified",
2113
+ changedFields
2114
+ });
2115
+ }
2116
+ }
2117
+ }
2118
+ return changes;
2119
+ };
2120
+ var getRelationshipKey = (serviceId, resourceId, resourceVersion, direction) => {
2121
+ return `${serviceId}:${direction}:${resourceId}@${resourceVersion || "latest"}`;
2122
+ };
2123
+ var extractRelationships = (snapshot) => {
2124
+ const relationships = /* @__PURE__ */ new Map();
2125
+ for (const service of snapshot.resources.services) {
2126
+ for (const direction of ["sends", "receives"]) {
2127
+ const pointers = service[direction] || [];
2128
+ for (const pointer of pointers) {
2129
+ const key = getRelationshipKey(service.id, pointer.id, pointer.version, direction);
2130
+ relationships.set(key, {
2131
+ serviceId: service.id,
2132
+ serviceVersion: service.version,
2133
+ resourceId: pointer.id,
2134
+ resourceVersion: pointer.version,
2135
+ direction
2136
+ });
2137
+ }
2138
+ }
2139
+ }
2140
+ return relationships;
2141
+ };
2142
+ var computeRelationshipDiff = (snapshotA, snapshotB) => {
2143
+ const relsA = extractRelationships(snapshotA);
2144
+ const relsB = extractRelationships(snapshotB);
2145
+ const changes = [];
2146
+ for (const [key, rel] of relsB) {
2147
+ if (!relsA.has(key)) {
2148
+ changes.push({ ...rel, changeType: "added" });
2149
+ }
2150
+ }
2151
+ for (const [key, rel] of relsA) {
2152
+ if (!relsB.has(key)) {
2153
+ changes.push({ ...rel, changeType: "removed" });
2154
+ }
2155
+ }
2156
+ return changes;
2157
+ };
2158
+
2159
+ // src/snapshots.ts
2160
+ var SNAPSHOT_VERSION = "1.0.0";
2161
+ var getEventCatalogVersion2 = (catalogDir) => {
2162
+ try {
2163
+ const packageJson = import_node_fs8.default.readFileSync(import_node_path16.default.join(catalogDir, "package.json"), "utf8");
2164
+ const packageJsonObject = JSON.parse(packageJson);
2165
+ return packageJsonObject["dependencies"]?.["@eventcatalog/core"] ?? "unknown";
2166
+ } catch {
2167
+ return "unknown";
2168
+ }
2169
+ };
2170
+ var pickCoreFields = (resource) => {
2171
+ const picked = { id: resource.id, version: resource.version, name: resource.name };
2172
+ if (resource.sends) picked.sends = resource.sends;
2173
+ if (resource.receives) picked.receives = resource.receives;
2174
+ if (resource.deprecated) picked.deprecated = resource.deprecated;
2175
+ if (resource.owners) picked.owners = resource.owners;
2176
+ return picked;
2177
+ };
2178
+ var deduplicateByLatestVersion = (resources) => {
2179
+ const seen = /* @__PURE__ */ new Map();
2180
+ for (const r of resources) {
2181
+ const existing = seen.get(r.id);
2182
+ if (!existing || (0, import_semver6.compare)(r.version, existing.version) > 0) {
2183
+ seen.set(r.id, r);
2184
+ }
2185
+ }
2186
+ return Array.from(seen.values());
2187
+ };
2188
+ var stripToCore = (resources) => {
2189
+ if (!resources || resources.length === 0) return [];
2190
+ return deduplicateByLatestVersion(resources).map(pickCoreFields);
2191
+ };
2192
+ var detectGitInfo = (catalogDir) => {
2193
+ try {
2194
+ const opts = { cwd: catalogDir, encoding: "utf8", stdio: "pipe" };
2195
+ const branch = (0, import_node_child_process.execSync)("git rev-parse --abbrev-ref HEAD", opts).trim();
2196
+ const commit = (0, import_node_child_process.execSync)("git rev-parse --short HEAD", opts).trim();
2197
+ const status = (0, import_node_child_process.execSync)("git status --porcelain", opts).trim();
2198
+ return { branch, commit, dirty: status.length > 0 };
2199
+ } catch {
2200
+ return void 0;
2201
+ }
2202
+ };
2203
+ var createSnapshot = (directory) => {
2204
+ return async (options) => {
2205
+ const { label, outputDir, git } = options || {};
2206
+ const sdk = src_default(directory);
2207
+ const [domains, services, events, commands, queries, channels] = await Promise.all([
2208
+ sdk.getDomains(),
2209
+ sdk.getServices(),
2210
+ sdk.getEvents(),
2211
+ sdk.getCommands(),
2212
+ sdk.getQueries(),
2213
+ sdk.getChannels()
2214
+ ]);
2215
+ const snapshotDomains = stripToCore(domains);
2216
+ const snapshotServices = stripToCore(services);
2217
+ const snapshotEvents = stripToCore(events);
2218
+ const snapshotCommands = stripToCore(commands);
2219
+ const snapshotQueries = stripToCore(queries);
2220
+ const snapshotChannels = stripToCore(channels);
2221
+ const snapshotLabel = label || (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
2222
+ const gitInfo = git || detectGitInfo(directory);
2223
+ const snapshot = {
2224
+ snapshotVersion: SNAPSHOT_VERSION,
2225
+ catalogVersion: getEventCatalogVersion2(directory),
2226
+ label: snapshotLabel,
2227
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2228
+ ...gitInfo ? { git: gitInfo } : {},
2229
+ resources: {
2230
+ domains: snapshotDomains,
2231
+ services: snapshotServices,
2232
+ messages: {
2233
+ events: snapshotEvents,
2234
+ commands: snapshotCommands,
2235
+ queries: snapshotQueries
2236
+ },
2237
+ channels: snapshotChannels
2238
+ }
2239
+ };
2240
+ const snapshotsDir = outputDir || import_node_path16.default.join(directory, ".snapshots");
2241
+ import_node_fs8.default.mkdirSync(snapshotsDir, { recursive: true });
2242
+ const fileName = `${snapshotLabel}.snapshot.json`;
2243
+ const filePath = import_node_path16.default.join(snapshotsDir, fileName);
2244
+ import_node_fs8.default.writeFileSync(filePath, JSON.stringify(snapshot));
2245
+ return { filePath, snapshot };
2246
+ };
2247
+ };
2248
+ var diffSnapshots = (directory) => async (snapshotAPath, snapshotBPath) => {
2249
+ const snapshotA = JSON.parse(import_node_fs8.default.readFileSync(snapshotAPath, "utf-8"));
2250
+ const snapshotB = JSON.parse(import_node_fs8.default.readFileSync(snapshotBPath, "utf-8"));
2251
+ const resourceChanges = computeResourceDiff(snapshotA, snapshotB);
2252
+ const relationshipChanges = computeRelationshipDiff(snapshotA, snapshotB);
2253
+ const resourceCounts = { added: 0, removed: 0, modified: 0, versioned: 0 };
2254
+ for (const r of resourceChanges) resourceCounts[r.changeType]++;
2255
+ const relCounts = { added: 0, removed: 0 };
2256
+ for (const r of relationshipChanges) relCounts[r.changeType]++;
2257
+ return {
2258
+ snapshotA: { label: snapshotA.label, createdAt: snapshotA.createdAt },
2259
+ snapshotB: { label: snapshotB.label, createdAt: snapshotB.createdAt },
2260
+ summary: {
2261
+ totalChanges: resourceChanges.length + relationshipChanges.length,
2262
+ resourcesAdded: resourceCounts.added,
2263
+ resourcesRemoved: resourceCounts.removed,
2264
+ resourcesModified: resourceCounts.modified,
2265
+ resourcesVersioned: resourceCounts.versioned,
2266
+ relationshipsAdded: relCounts.added,
2267
+ relationshipsRemoved: relCounts.removed
2268
+ },
2269
+ resources: resourceChanges,
2270
+ relationships: relationshipChanges
2271
+ };
2272
+ };
2273
+ var listSnapshots = (directory) => async () => {
2274
+ const snapshotsDir = import_node_path16.default.join(directory, ".snapshots");
2275
+ if (!import_node_fs8.default.existsSync(snapshotsDir)) return [];
2276
+ const files = import_node_fs8.default.readdirSync(snapshotsDir).filter((f) => f.endsWith(".snapshot.json"));
2277
+ const snapshots = [];
2278
+ for (const file of files) {
2279
+ try {
2280
+ const filePath = import_node_path16.default.join(snapshotsDir, file);
2281
+ const content = JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf-8"));
2282
+ snapshots.push({
2283
+ label: content.label,
2284
+ createdAt: content.createdAt,
2285
+ filePath,
2286
+ ...content.git ? { git: content.git } : {}
2287
+ });
2288
+ } catch {
2289
+ }
2290
+ }
2291
+ return snapshots.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
2292
+ };
2293
+
2294
+ // src/changelogs.ts
2295
+ var import_node_path17 = __toESM(require("path"));
2296
+ var import_node_fs9 = __toESM(require("fs"));
1971
2297
  var import_promises10 = __toESM(require("fs/promises"));
1972
2298
  var import_gray_matter8 = __toESM(require("gray-matter"));
1973
2299
  var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
@@ -1976,8 +2302,8 @@ var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
1976
2302
  if (!resourceFile) {
1977
2303
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
1978
2304
  }
1979
- const resourceDir = (0, import_node_path16.dirname)(resourceFile);
1980
- const changelogPath = import_node_path16.default.join(resourceDir, `changelog.${format}`);
2305
+ const resourceDir = (0, import_node_path17.dirname)(resourceFile);
2306
+ const changelogPath = import_node_path17.default.join(resourceDir, `changelog.${format}`);
1981
2307
  const { markdown, ...frontmatter } = changelog;
1982
2308
  const fm = { ...frontmatter };
1983
2309
  if (fm.createdAt instanceof Date) {
@@ -1986,9 +2312,9 @@ var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
1986
2312
  if (!fm.badges || fm.badges.length === 0) {
1987
2313
  delete fm.badges;
1988
2314
  }
1989
- import_node_fs7.default.mkdirSync(resourceDir, { recursive: true });
2315
+ import_node_fs9.default.mkdirSync(resourceDir, { recursive: true });
1990
2316
  const document = import_gray_matter8.default.stringify(markdown.trim(), fm);
1991
- import_node_fs7.default.writeFileSync(changelogPath, document);
2317
+ import_node_fs9.default.writeFileSync(changelogPath, document);
1992
2318
  invalidateFileCache();
1993
2319
  };
1994
2320
  var appendChangelog = (catalogDir) => async (id, changelog, options = {}) => {
@@ -1997,10 +2323,10 @@ var appendChangelog = (catalogDir) => async (id, changelog, options = {}) => {
1997
2323
  if (!resourceFile) {
1998
2324
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
1999
2325
  }
2000
- const resourceDir = (0, import_node_path16.dirname)(resourceFile);
2001
- const mdxPath = import_node_path16.default.join(resourceDir, "changelog.mdx");
2002
- const mdPath = import_node_path16.default.join(resourceDir, "changelog.md");
2003
- const existingPath = import_node_fs7.default.existsSync(mdxPath) ? mdxPath : import_node_fs7.default.existsSync(mdPath) ? mdPath : void 0;
2326
+ const resourceDir = (0, import_node_path17.dirname)(resourceFile);
2327
+ const mdxPath = import_node_path17.default.join(resourceDir, "changelog.mdx");
2328
+ const mdPath = import_node_path17.default.join(resourceDir, "changelog.md");
2329
+ const existingPath = import_node_fs9.default.existsSync(mdxPath) ? mdxPath : import_node_fs9.default.existsSync(mdPath) ? mdPath : void 0;
2004
2330
  if (!existingPath) {
2005
2331
  return writeChangelog(catalogDir)(id, changelog, options);
2006
2332
  }
@@ -2020,17 +2346,17 @@ ${existingContent}`;
2020
2346
  delete fm.badges;
2021
2347
  }
2022
2348
  const document = import_gray_matter8.default.stringify(combined, fm);
2023
- import_node_fs7.default.writeFileSync(existingPath, document);
2349
+ import_node_fs9.default.writeFileSync(existingPath, document);
2024
2350
  invalidateFileCache();
2025
2351
  };
2026
2352
  var getChangelog = (catalogDir) => async (id, options = {}) => {
2027
2353
  const { version } = options;
2028
2354
  const resourceFile = await findFileById(catalogDir, id, version);
2029
2355
  if (!resourceFile) return void 0;
2030
- const resourceDir = (0, import_node_path16.dirname)(resourceFile);
2031
- const mdxPath = import_node_path16.default.join(resourceDir, "changelog.mdx");
2032
- const mdPath = import_node_path16.default.join(resourceDir, "changelog.md");
2033
- const changelogPath = import_node_fs7.default.existsSync(mdxPath) ? mdxPath : import_node_fs7.default.existsSync(mdPath) ? mdPath : void 0;
2356
+ const resourceDir = (0, import_node_path17.dirname)(resourceFile);
2357
+ const mdxPath = import_node_path17.default.join(resourceDir, "changelog.mdx");
2358
+ const mdPath = import_node_path17.default.join(resourceDir, "changelog.md");
2359
+ const changelogPath = import_node_fs9.default.existsSync(mdxPath) ? mdxPath : import_node_fs9.default.existsSync(mdPath) ? mdPath : void 0;
2034
2360
  if (!changelogPath) return void 0;
2035
2361
  const { data, content } = import_gray_matter8.default.read(changelogPath);
2036
2362
  return { ...data, markdown: content.trim() };
@@ -2041,13 +2367,13 @@ var rmChangelog = (catalogDir) => async (id, options = {}) => {
2041
2367
  if (!resourceFile) {
2042
2368
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
2043
2369
  }
2044
- const resourceDir = (0, import_node_path16.dirname)(resourceFile);
2045
- const mdxPath = import_node_path16.default.join(resourceDir, "changelog.mdx");
2046
- const mdPath = import_node_path16.default.join(resourceDir, "changelog.md");
2047
- if (import_node_fs7.default.existsSync(mdxPath)) {
2370
+ const resourceDir = (0, import_node_path17.dirname)(resourceFile);
2371
+ const mdxPath = import_node_path17.default.join(resourceDir, "changelog.mdx");
2372
+ const mdPath = import_node_path17.default.join(resourceDir, "changelog.md");
2373
+ if (import_node_fs9.default.existsSync(mdxPath)) {
2048
2374
  await import_promises10.default.rm(mdxPath);
2049
2375
  }
2050
- if (import_node_fs7.default.existsSync(mdPath)) {
2376
+ if (import_node_fs9.default.existsSync(mdPath)) {
2051
2377
  await import_promises10.default.rm(mdPath);
2052
2378
  }
2053
2379
  invalidateFileCache();
@@ -2055,7 +2381,7 @@ var rmChangelog = (catalogDir) => async (id, options = {}) => {
2055
2381
 
2056
2382
  // src/entities.ts
2057
2383
  var import_promises11 = __toESM(require("fs/promises"));
2058
- var import_node_path17 = require("path");
2384
+ var import_node_path18 = require("path");
2059
2385
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
2060
2386
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
2061
2387
  var writeEntity = (directory) => async (entity, options = {
@@ -2063,8 +2389,8 @@ var writeEntity = (directory) => async (entity, options = {
2063
2389
  override: false,
2064
2390
  format: "mdx"
2065
2391
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
2066
- var rmEntity = (directory) => async (path7) => {
2067
- await import_promises11.default.rm((0, import_node_path17.join)(directory, path7), { recursive: true });
2392
+ var rmEntity = (directory) => async (path8) => {
2393
+ await import_promises11.default.rm((0, import_node_path18.join)(directory, path8), { recursive: true });
2068
2394
  invalidateFileCache();
2069
2395
  };
2070
2396
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
@@ -2078,7 +2404,7 @@ var entityHasVersion = (directory) => async (id, version) => {
2078
2404
 
2079
2405
  // src/containers.ts
2080
2406
  var import_promises12 = __toESM(require("fs/promises"));
2081
- var import_node_path18 = require("path");
2407
+ var import_node_path19 = require("path");
2082
2408
  var getContainer = (directory) => async (id, version) => getResource(directory, id, version, { type: "container" });
2083
2409
  var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
2084
2410
  var writeContainer = (directory) => async (data, options = {
@@ -2087,8 +2413,8 @@ var writeContainer = (directory) => async (data, options = {
2087
2413
  format: "mdx"
2088
2414
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
2089
2415
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
2090
- var rmContainer = (directory) => async (path7) => {
2091
- await import_promises12.default.rm((0, import_node_path18.join)(directory, path7), { recursive: true });
2416
+ var rmContainer = (directory) => async (path8) => {
2417
+ await import_promises12.default.rm((0, import_node_path19.join)(directory, path8), { recursive: true });
2092
2418
  invalidateFileCache();
2093
2419
  };
2094
2420
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
@@ -2105,7 +2431,7 @@ var writeContainerToService = (directory) => async (container, service, options
2105
2431
  throw new Error("Service not found");
2106
2432
  }
2107
2433
  let pathForContainer = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/containers` : `${resourcePath.directory}/containers`;
2108
- pathForContainer = (0, import_node_path18.join)(pathForContainer, container.id);
2434
+ pathForContainer = (0, import_node_path19.join)(pathForContainer, container.id);
2109
2435
  await writeResource(directory, { ...container }, { ...options, path: pathForContainer, type: "container" });
2110
2436
  };
2111
2437
 
@@ -2122,7 +2448,7 @@ var writeDataStoreToService = writeContainerToService;
2122
2448
 
2123
2449
  // src/data-products.ts
2124
2450
  var import_promises13 = __toESM(require("fs/promises"));
2125
- var import_node_path19 = require("path");
2451
+ var import_node_path20 = require("path");
2126
2452
  var getDataProduct = (directory) => async (id, version) => getResource(directory, id, version, { type: "data-product" });
2127
2453
  var getDataProducts = (directory) => async (options) => getResources(directory, { type: "data-products", latestOnly: options?.latestOnly });
2128
2454
  var writeDataProduct = (directory) => async (dataProduct, options = {
@@ -2132,11 +2458,11 @@ var writeDataProduct = (directory) => async (dataProduct, options = {
2132
2458
  }) => writeResource(directory, { ...dataProduct }, { ...options, type: "data-product" });
2133
2459
  var writeDataProductToDomain = (directory) => async (dataProduct, domain, options = { path: "", format: "mdx", override: false }) => {
2134
2460
  let pathForDataProduct = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/data-products` : `/${domain.id}/data-products`;
2135
- pathForDataProduct = (0, import_node_path19.join)(pathForDataProduct, dataProduct.id);
2461
+ pathForDataProduct = (0, import_node_path20.join)(pathForDataProduct, dataProduct.id);
2136
2462
  await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
2137
2463
  };
2138
- var rmDataProduct = (directory) => async (path7) => {
2139
- await import_promises13.default.rm((0, import_node_path19.join)(directory, path7), { recursive: true });
2464
+ var rmDataProduct = (directory) => async (path8) => {
2465
+ await import_promises13.default.rm((0, import_node_path20.join)(directory, path8), { recursive: true });
2140
2466
  invalidateFileCache();
2141
2467
  };
2142
2468
  var rmDataProductById = (directory) => async (id, version, persistFiles) => {
@@ -2151,7 +2477,7 @@ var addFileToDataProduct = (directory) => async (id, file, version) => addFileTo
2151
2477
 
2152
2478
  // src/diagrams.ts
2153
2479
  var import_promises14 = __toESM(require("fs/promises"));
2154
- var import_node_path20 = require("path");
2480
+ var import_node_path21 = require("path");
2155
2481
  var getDiagram = (directory) => async (id, version) => getResource(directory, id, version, { type: "diagram" });
2156
2482
  var getDiagrams = (directory) => async (options) => getResources(directory, { type: "diagrams", latestOnly: options?.latestOnly });
2157
2483
  var writeDiagram = (directory) => async (diagram, options = {
@@ -2159,8 +2485,8 @@ var writeDiagram = (directory) => async (diagram, options = {
2159
2485
  override: false,
2160
2486
  format: "mdx"
2161
2487
  }) => writeResource(directory, { ...diagram }, { ...options, type: "diagram" });
2162
- var rmDiagram = (directory) => async (path7) => {
2163
- await import_promises14.default.rm((0, import_node_path20.join)(directory, path7), { recursive: true });
2488
+ var rmDiagram = (directory) => async (path8) => {
2489
+ await import_promises14.default.rm((0, import_node_path21.join)(directory, path8), { recursive: true });
2164
2490
  invalidateFileCache();
2165
2491
  };
2166
2492
  var rmDiagramById = (directory) => async (id, version, persistFiles) => {
@@ -2174,7 +2500,7 @@ var diagramHasVersion = (directory) => async (id, version) => {
2174
2500
  var addFileToDiagram = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version, { type: "diagram" });
2175
2501
 
2176
2502
  // src/index.ts
2177
- var src_default = (path7) => {
2503
+ var src_default = (path8) => {
2178
2504
  return {
2179
2505
  /**
2180
2506
  * Returns an events from EventCatalog
@@ -2182,13 +2508,13 @@ var src_default = (path7) => {
2182
2508
  * @param version - Optional id of the version to get (supports semver)
2183
2509
  * @returns Event|Undefined
2184
2510
  */
2185
- getEvent: getEvent((0, import_node_path21.join)(path7)),
2511
+ getEvent: getEvent((0, import_node_path22.join)(path8)),
2186
2512
  /**
2187
2513
  * Returns all events from EventCatalog
2188
2514
  * @param latestOnly - optional boolean, set to true to get only latest versions
2189
2515
  * @returns Event[]|Undefined
2190
2516
  */
2191
- getEvents: getEvents((0, import_node_path21.join)(path7)),
2517
+ getEvents: getEvents((0, import_node_path22.join)(path8)),
2192
2518
  /**
2193
2519
  * Adds an event to EventCatalog
2194
2520
  *
@@ -2196,7 +2522,7 @@ var src_default = (path7) => {
2196
2522
  * @param options - Optional options to write the event
2197
2523
  *
2198
2524
  */
2199
- writeEvent: writeEvent((0, import_node_path21.join)(path7, "events")),
2525
+ writeEvent: writeEvent((0, import_node_path22.join)(path8, "events")),
2200
2526
  /**
2201
2527
  * Adds an event to a service in EventCatalog
2202
2528
  *
@@ -2205,26 +2531,26 @@ var src_default = (path7) => {
2205
2531
  * @param options - Optional options to write the event
2206
2532
  *
2207
2533
  */
2208
- writeEventToService: writeEventToService((0, import_node_path21.join)(path7)),
2534
+ writeEventToService: writeEventToService((0, import_node_path22.join)(path8)),
2209
2535
  /**
2210
2536
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
2211
2537
  *
2212
2538
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
2213
2539
  *
2214
2540
  */
2215
- rmEvent: rmEvent((0, import_node_path21.join)(path7, "events")),
2541
+ rmEvent: rmEvent((0, import_node_path22.join)(path8, "events")),
2216
2542
  /**
2217
2543
  * Remove an event by an Event id
2218
2544
  *
2219
2545
  * @param id - The id of the event you want to remove
2220
2546
  *
2221
2547
  */
2222
- rmEventById: rmEventById((0, import_node_path21.join)(path7)),
2548
+ rmEventById: rmEventById((0, import_node_path22.join)(path8)),
2223
2549
  /**
2224
2550
  * Moves a given event id to the version directory
2225
2551
  * @param directory
2226
2552
  */
2227
- versionEvent: versionEvent((0, import_node_path21.join)(path7)),
2553
+ versionEvent: versionEvent((0, import_node_path22.join)(path8)),
2228
2554
  /**
2229
2555
  * Adds a file to the given event
2230
2556
  * @param id - The id of the event to add the file to
@@ -2232,7 +2558,7 @@ var src_default = (path7) => {
2232
2558
  * @param version - Optional version of the event to add the file to
2233
2559
  * @returns
2234
2560
  */
2235
- addFileToEvent: addFileToEvent((0, import_node_path21.join)(path7)),
2561
+ addFileToEvent: addFileToEvent((0, import_node_path22.join)(path8)),
2236
2562
  /**
2237
2563
  * Adds a schema to the given event
2238
2564
  * @param id - The id of the event to add the schema to
@@ -2240,14 +2566,14 @@ var src_default = (path7) => {
2240
2566
  * @param version - Optional version of the event to add the schema to
2241
2567
  * @returns
2242
2568
  */
2243
- addSchemaToEvent: addSchemaToEvent((0, import_node_path21.join)(path7)),
2569
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path22.join)(path8)),
2244
2570
  /**
2245
2571
  * Check to see if an event version exists
2246
2572
  * @param id - The id of the event
2247
2573
  * @param version - The version of the event (supports semver)
2248
2574
  * @returns
2249
2575
  */
2250
- eventHasVersion: eventHasVersion((0, import_node_path21.join)(path7)),
2576
+ eventHasVersion: eventHasVersion((0, import_node_path22.join)(path8)),
2251
2577
  /**
2252
2578
  * ================================
2253
2579
  * Commands
@@ -2259,13 +2585,13 @@ var src_default = (path7) => {
2259
2585
  * @param version - Optional id of the version to get (supports semver)
2260
2586
  * @returns Command|Undefined
2261
2587
  */
2262
- getCommand: getCommand((0, import_node_path21.join)(path7)),
2588
+ getCommand: getCommand((0, import_node_path22.join)(path8)),
2263
2589
  /**
2264
2590
  * Returns all commands from EventCatalog
2265
2591
  * @param latestOnly - optional boolean, set to true to get only latest versions
2266
2592
  * @returns Command[]|Undefined
2267
2593
  */
2268
- getCommands: getCommands((0, import_node_path21.join)(path7)),
2594
+ getCommands: getCommands((0, import_node_path22.join)(path8)),
2269
2595
  /**
2270
2596
  * Adds an command to EventCatalog
2271
2597
  *
@@ -2273,7 +2599,7 @@ var src_default = (path7) => {
2273
2599
  * @param options - Optional options to write the command
2274
2600
  *
2275
2601
  */
2276
- writeCommand: writeCommand((0, import_node_path21.join)(path7, "commands")),
2602
+ writeCommand: writeCommand((0, import_node_path22.join)(path8, "commands")),
2277
2603
  /**
2278
2604
  * Adds a command to a service in EventCatalog
2279
2605
  *
@@ -2282,26 +2608,26 @@ var src_default = (path7) => {
2282
2608
  * @param options - Optional options to write the command
2283
2609
  *
2284
2610
  */
2285
- writeCommandToService: writeCommandToService((0, import_node_path21.join)(path7)),
2611
+ writeCommandToService: writeCommandToService((0, import_node_path22.join)(path8)),
2286
2612
  /**
2287
2613
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
2288
2614
  *
2289
2615
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
2290
2616
  *
2291
2617
  */
2292
- rmCommand: rmCommand((0, import_node_path21.join)(path7, "commands")),
2618
+ rmCommand: rmCommand((0, import_node_path22.join)(path8, "commands")),
2293
2619
  /**
2294
2620
  * Remove an command by an Event id
2295
2621
  *
2296
2622
  * @param id - The id of the command you want to remove
2297
2623
  *
2298
2624
  */
2299
- rmCommandById: rmCommandById((0, import_node_path21.join)(path7)),
2625
+ rmCommandById: rmCommandById((0, import_node_path22.join)(path8)),
2300
2626
  /**
2301
2627
  * Moves a given command id to the version directory
2302
2628
  * @param directory
2303
2629
  */
2304
- versionCommand: versionCommand((0, import_node_path21.join)(path7)),
2630
+ versionCommand: versionCommand((0, import_node_path22.join)(path8)),
2305
2631
  /**
2306
2632
  * Adds a file to the given command
2307
2633
  * @param id - The id of the command to add the file to
@@ -2309,7 +2635,7 @@ var src_default = (path7) => {
2309
2635
  * @param version - Optional version of the command to add the file to
2310
2636
  * @returns
2311
2637
  */
2312
- addFileToCommand: addFileToCommand((0, import_node_path21.join)(path7)),
2638
+ addFileToCommand: addFileToCommand((0, import_node_path22.join)(path8)),
2313
2639
  /**
2314
2640
  * Adds a schema to the given command
2315
2641
  * @param id - The id of the command to add the schema to
@@ -2317,14 +2643,14 @@ var src_default = (path7) => {
2317
2643
  * @param version - Optional version of the command to add the schema to
2318
2644
  * @returns
2319
2645
  */
2320
- addSchemaToCommand: addSchemaToCommand((0, import_node_path21.join)(path7)),
2646
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path22.join)(path8)),
2321
2647
  /**
2322
2648
  * Check to see if a command version exists
2323
2649
  * @param id - The id of the command
2324
2650
  * @param version - The version of the command (supports semver)
2325
2651
  * @returns
2326
2652
  */
2327
- commandHasVersion: commandHasVersion((0, import_node_path21.join)(path7)),
2653
+ commandHasVersion: commandHasVersion((0, import_node_path22.join)(path8)),
2328
2654
  /**
2329
2655
  * ================================
2330
2656
  * Queries
@@ -2336,13 +2662,13 @@ var src_default = (path7) => {
2336
2662
  * @param version - Optional id of the version to get (supports semver)
2337
2663
  * @returns Query|Undefined
2338
2664
  */
2339
- getQuery: getQuery((0, import_node_path21.join)(path7)),
2665
+ getQuery: getQuery((0, import_node_path22.join)(path8)),
2340
2666
  /**
2341
2667
  * Returns all queries from EventCatalog
2342
2668
  * @param latestOnly - optional boolean, set to true to get only latest versions
2343
2669
  * @returns Query[]|Undefined
2344
2670
  */
2345
- getQueries: getQueries((0, import_node_path21.join)(path7)),
2671
+ getQueries: getQueries((0, import_node_path22.join)(path8)),
2346
2672
  /**
2347
2673
  * Adds a query to EventCatalog
2348
2674
  *
@@ -2350,7 +2676,7 @@ var src_default = (path7) => {
2350
2676
  * @param options - Optional options to write the event
2351
2677
  *
2352
2678
  */
2353
- writeQuery: writeQuery((0, import_node_path21.join)(path7, "queries")),
2679
+ writeQuery: writeQuery((0, import_node_path22.join)(path8, "queries")),
2354
2680
  /**
2355
2681
  * Adds a query to a service in EventCatalog
2356
2682
  *
@@ -2359,26 +2685,26 @@ var src_default = (path7) => {
2359
2685
  * @param options - Optional options to write the query
2360
2686
  *
2361
2687
  */
2362
- writeQueryToService: writeQueryToService((0, import_node_path21.join)(path7)),
2688
+ writeQueryToService: writeQueryToService((0, import_node_path22.join)(path8)),
2363
2689
  /**
2364
2690
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
2365
2691
  *
2366
2692
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
2367
2693
  *
2368
2694
  */
2369
- rmQuery: rmQuery((0, import_node_path21.join)(path7, "queries")),
2695
+ rmQuery: rmQuery((0, import_node_path22.join)(path8, "queries")),
2370
2696
  /**
2371
2697
  * Remove a query by a Query id
2372
2698
  *
2373
2699
  * @param id - The id of the query you want to remove
2374
2700
  *
2375
2701
  */
2376
- rmQueryById: rmQueryById((0, import_node_path21.join)(path7)),
2702
+ rmQueryById: rmQueryById((0, import_node_path22.join)(path8)),
2377
2703
  /**
2378
2704
  * Moves a given query id to the version directory
2379
2705
  * @param directory
2380
2706
  */
2381
- versionQuery: versionQuery((0, import_node_path21.join)(path7)),
2707
+ versionQuery: versionQuery((0, import_node_path22.join)(path8)),
2382
2708
  /**
2383
2709
  * Adds a file to the given query
2384
2710
  * @param id - The id of the query to add the file to
@@ -2386,7 +2712,7 @@ var src_default = (path7) => {
2386
2712
  * @param version - Optional version of the query to add the file to
2387
2713
  * @returns
2388
2714
  */
2389
- addFileToQuery: addFileToQuery((0, import_node_path21.join)(path7)),
2715
+ addFileToQuery: addFileToQuery((0, import_node_path22.join)(path8)),
2390
2716
  /**
2391
2717
  * Adds a schema to the given query
2392
2718
  * @param id - The id of the query to add the schema to
@@ -2394,14 +2720,14 @@ var src_default = (path7) => {
2394
2720
  * @param version - Optional version of the query to add the schema to
2395
2721
  * @returns
2396
2722
  */
2397
- addSchemaToQuery: addSchemaToQuery((0, import_node_path21.join)(path7)),
2723
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path22.join)(path8)),
2398
2724
  /**
2399
2725
  * Check to see if an query version exists
2400
2726
  * @param id - The id of the query
2401
2727
  * @param version - The version of the query (supports semver)
2402
2728
  * @returns
2403
2729
  */
2404
- queryHasVersion: queryHasVersion((0, import_node_path21.join)(path7)),
2730
+ queryHasVersion: queryHasVersion((0, import_node_path22.join)(path8)),
2405
2731
  /**
2406
2732
  * ================================
2407
2733
  * Channels
@@ -2413,13 +2739,13 @@ var src_default = (path7) => {
2413
2739
  * @param version - Optional id of the version to get (supports semver)
2414
2740
  * @returns Channel|Undefined
2415
2741
  */
2416
- getChannel: getChannel((0, import_node_path21.join)(path7)),
2742
+ getChannel: getChannel((0, import_node_path22.join)(path8)),
2417
2743
  /**
2418
2744
  * Returns all channels from EventCatalog
2419
2745
  * @param latestOnly - optional boolean, set to true to get only latest versions
2420
2746
  * @returns Channel[]|Undefined
2421
2747
  */
2422
- getChannels: getChannels((0, import_node_path21.join)(path7)),
2748
+ getChannels: getChannels((0, import_node_path22.join)(path8)),
2423
2749
  /**
2424
2750
  * Adds an channel to EventCatalog
2425
2751
  *
@@ -2427,33 +2753,33 @@ var src_default = (path7) => {
2427
2753
  * @param options - Optional options to write the channel
2428
2754
  *
2429
2755
  */
2430
- writeChannel: writeChannel((0, import_node_path21.join)(path7, "channels")),
2756
+ writeChannel: writeChannel((0, import_node_path22.join)(path8, "channels")),
2431
2757
  /**
2432
2758
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
2433
2759
  *
2434
2760
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
2435
2761
  *
2436
2762
  */
2437
- rmChannel: rmChannel((0, import_node_path21.join)(path7, "channels")),
2763
+ rmChannel: rmChannel((0, import_node_path22.join)(path8, "channels")),
2438
2764
  /**
2439
2765
  * Remove an channel by an Event id
2440
2766
  *
2441
2767
  * @param id - The id of the channel you want to remove
2442
2768
  *
2443
2769
  */
2444
- rmChannelById: rmChannelById((0, import_node_path21.join)(path7)),
2770
+ rmChannelById: rmChannelById((0, import_node_path22.join)(path8)),
2445
2771
  /**
2446
2772
  * Moves a given channel id to the version directory
2447
2773
  * @param directory
2448
2774
  */
2449
- versionChannel: versionChannel((0, import_node_path21.join)(path7)),
2775
+ versionChannel: versionChannel((0, import_node_path22.join)(path8)),
2450
2776
  /**
2451
2777
  * Check to see if a channel version exists
2452
2778
  * @param id - The id of the channel
2453
2779
  * @param version - The version of the channel (supports semver)
2454
2780
  * @returns
2455
2781
  */
2456
- channelHasVersion: channelHasVersion((0, import_node_path21.join)(path7)),
2782
+ channelHasVersion: channelHasVersion((0, import_node_path22.join)(path8)),
2457
2783
  /**
2458
2784
  * Add a channel to an event
2459
2785
  *
@@ -2470,7 +2796,7 @@ var src_default = (path7) => {
2470
2796
  *
2471
2797
  * ```
2472
2798
  */
2473
- addEventToChannel: addMessageToChannel((0, import_node_path21.join)(path7), "events"),
2799
+ addEventToChannel: addMessageToChannel((0, import_node_path22.join)(path8), "events"),
2474
2800
  /**
2475
2801
  * Add a channel to an command
2476
2802
  *
@@ -2487,7 +2813,7 @@ var src_default = (path7) => {
2487
2813
  *
2488
2814
  * ```
2489
2815
  */
2490
- addCommandToChannel: addMessageToChannel((0, import_node_path21.join)(path7), "commands"),
2816
+ addCommandToChannel: addMessageToChannel((0, import_node_path22.join)(path8), "commands"),
2491
2817
  /**
2492
2818
  * Add a channel to an query
2493
2819
  *
@@ -2504,7 +2830,7 @@ var src_default = (path7) => {
2504
2830
  *
2505
2831
  * ```
2506
2832
  */
2507
- addQueryToChannel: addMessageToChannel((0, import_node_path21.join)(path7), "queries"),
2833
+ addQueryToChannel: addMessageToChannel((0, import_node_path22.join)(path8), "queries"),
2508
2834
  /**
2509
2835
  * ================================
2510
2836
  * SERVICES
@@ -2517,14 +2843,14 @@ var src_default = (path7) => {
2517
2843
  * @param options - Optional options to write the event
2518
2844
  *
2519
2845
  */
2520
- writeService: writeService((0, import_node_path21.join)(path7, "services")),
2846
+ writeService: writeService((0, import_node_path22.join)(path8, "services")),
2521
2847
  /**
2522
2848
  * Adds a versioned service to EventCatalog
2523
2849
  *
2524
2850
  * @param service - The service to write
2525
2851
  *
2526
2852
  */
2527
- writeVersionedService: writeVersionedService((0, import_node_path21.join)(path7, "services")),
2853
+ writeVersionedService: writeVersionedService((0, import_node_path22.join)(path8, "services")),
2528
2854
  /**
2529
2855
  * Adds a service to a domain in EventCatalog
2530
2856
  *
@@ -2533,45 +2859,45 @@ var src_default = (path7) => {
2533
2859
  * @param options - Optional options to write the event
2534
2860
  *
2535
2861
  */
2536
- writeServiceToDomain: writeServiceToDomain((0, import_node_path21.join)(path7, "domains")),
2862
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path22.join)(path8, "domains")),
2537
2863
  /**
2538
2864
  * Returns a service from EventCatalog
2539
2865
  * @param id - The id of the service to retrieve
2540
2866
  * @param version - Optional id of the version to get (supports semver)
2541
2867
  * @returns Service|Undefined
2542
2868
  */
2543
- getService: getService((0, import_node_path21.join)(path7)),
2869
+ getService: getService((0, import_node_path22.join)(path8)),
2544
2870
  /**
2545
2871
  * Returns a service from EventCatalog by it's path.
2546
2872
  * @param path - The path to the service to retrieve
2547
2873
  * @returns Service|Undefined
2548
2874
  */
2549
- getServiceByPath: getServiceByPath((0, import_node_path21.join)(path7)),
2875
+ getServiceByPath: getServiceByPath((0, import_node_path22.join)(path8)),
2550
2876
  /**
2551
2877
  * Returns all services from EventCatalog
2552
2878
  * @param latestOnly - optional boolean, set to true to get only latest versions
2553
2879
  * @returns Service[]|Undefined
2554
2880
  */
2555
- getServices: getServices((0, import_node_path21.join)(path7)),
2881
+ getServices: getServices((0, import_node_path22.join)(path8)),
2556
2882
  /**
2557
2883
  * Moves a given service id to the version directory
2558
2884
  * @param directory
2559
2885
  */
2560
- versionService: versionService((0, import_node_path21.join)(path7)),
2886
+ versionService: versionService((0, import_node_path22.join)(path8)),
2561
2887
  /**
2562
2888
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
2563
2889
  *
2564
2890
  * @param path - The path to your service, e.g. `/InventoryService`
2565
2891
  *
2566
2892
  */
2567
- rmService: rmService((0, import_node_path21.join)(path7, "services")),
2893
+ rmService: rmService((0, import_node_path22.join)(path8, "services")),
2568
2894
  /**
2569
2895
  * Remove an service by an service id
2570
2896
  *
2571
2897
  * @param id - The id of the service you want to remove
2572
2898
  *
2573
2899
  */
2574
- rmServiceById: rmServiceById((0, import_node_path21.join)(path7)),
2900
+ rmServiceById: rmServiceById((0, import_node_path22.join)(path8)),
2575
2901
  /**
2576
2902
  * Adds a file to the given service
2577
2903
  * @param id - The id of the service to add the file to
@@ -2579,21 +2905,21 @@ var src_default = (path7) => {
2579
2905
  * @param version - Optional version of the service to add the file to
2580
2906
  * @returns
2581
2907
  */
2582
- addFileToService: addFileToService((0, import_node_path21.join)(path7)),
2908
+ addFileToService: addFileToService((0, import_node_path22.join)(path8)),
2583
2909
  /**
2584
2910
  * Returns the specifications for a given service
2585
2911
  * @param id - The id of the service to retrieve the specifications for
2586
2912
  * @param version - Optional version of the service
2587
2913
  * @returns
2588
2914
  */
2589
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path21.join)(path7)),
2915
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path22.join)(path8)),
2590
2916
  /**
2591
2917
  * Check to see if a service version exists
2592
2918
  * @param id - The id of the service
2593
2919
  * @param version - The version of the service (supports semver)
2594
2920
  * @returns
2595
2921
  */
2596
- serviceHasVersion: serviceHasVersion((0, import_node_path21.join)(path7)),
2922
+ serviceHasVersion: serviceHasVersion((0, import_node_path22.join)(path8)),
2597
2923
  /**
2598
2924
  * Add an event to a service by it's id.
2599
2925
  *
@@ -2613,7 +2939,7 @@ var src_default = (path7) => {
2613
2939
  *
2614
2940
  * ```
2615
2941
  */
2616
- addEventToService: addMessageToService((0, import_node_path21.join)(path7)),
2942
+ addEventToService: addMessageToService((0, import_node_path22.join)(path8)),
2617
2943
  /**
2618
2944
  * Add a data store to a service by it's id.
2619
2945
  *
@@ -2630,7 +2956,7 @@ var src_default = (path7) => {
2630
2956
  *
2631
2957
  * ```
2632
2958
  */
2633
- addDataStoreToService: addDataStoreToService((0, import_node_path21.join)(path7)),
2959
+ addDataStoreToService: addDataStoreToService((0, import_node_path22.join)(path8)),
2634
2960
  /**
2635
2961
  * Add a command to a service by it's id.
2636
2962
  *
@@ -2650,7 +2976,7 @@ var src_default = (path7) => {
2650
2976
  *
2651
2977
  * ```
2652
2978
  */
2653
- addCommandToService: addMessageToService((0, import_node_path21.join)(path7)),
2979
+ addCommandToService: addMessageToService((0, import_node_path22.join)(path8)),
2654
2980
  /**
2655
2981
  * Add a query to a service by it's id.
2656
2982
  *
@@ -2670,7 +2996,7 @@ var src_default = (path7) => {
2670
2996
  *
2671
2997
  * ```
2672
2998
  */
2673
- addQueryToService: addMessageToService((0, import_node_path21.join)(path7)),
2999
+ addQueryToService: addMessageToService((0, import_node_path22.join)(path8)),
2674
3000
  /**
2675
3001
  * Add an entity to a service by its id.
2676
3002
  *
@@ -2688,7 +3014,7 @@ var src_default = (path7) => {
2688
3014
  *
2689
3015
  * ```
2690
3016
  */
2691
- addEntityToService: addEntityToService((0, import_node_path21.join)(path7)),
3017
+ addEntityToService: addEntityToService((0, import_node_path22.join)(path8)),
2692
3018
  /**
2693
3019
  * Check to see if a service exists by it's path.
2694
3020
  *
@@ -2705,13 +3031,13 @@ var src_default = (path7) => {
2705
3031
  * @param path - The path to the service to check
2706
3032
  * @returns boolean
2707
3033
  */
2708
- isService: isService((0, import_node_path21.join)(path7)),
3034
+ isService: isService((0, import_node_path22.join)(path8)),
2709
3035
  /**
2710
3036
  * Converts a file to a service.
2711
3037
  * @param file - The file to convert to a service.
2712
3038
  * @returns The service.
2713
3039
  */
2714
- toService: toService((0, import_node_path21.join)(path7)),
3040
+ toService: toService((0, import_node_path22.join)(path8)),
2715
3041
  /**
2716
3042
  * ================================
2717
3043
  * Domains
@@ -2724,39 +3050,39 @@ var src_default = (path7) => {
2724
3050
  * @param options - Optional options to write the event
2725
3051
  *
2726
3052
  */
2727
- writeDomain: writeDomain((0, import_node_path21.join)(path7, "domains")),
3053
+ writeDomain: writeDomain((0, import_node_path22.join)(path8, "domains")),
2728
3054
  /**
2729
3055
  * Returns a domain from EventCatalog
2730
3056
  * @param id - The id of the domain to retrieve
2731
3057
  * @param version - Optional id of the version to get (supports semver)
2732
3058
  * @returns Domain|Undefined
2733
3059
  */
2734
- getDomain: getDomain((0, import_node_path21.join)(path7, "domains")),
3060
+ getDomain: getDomain((0, import_node_path22.join)(path8, "domains")),
2735
3061
  /**
2736
3062
  * Returns all domains from EventCatalog
2737
3063
  * @param latestOnly - optional boolean, set to true to get only latest versions
2738
3064
  * @returns Domain[]|Undefined
2739
3065
  */
2740
- getDomains: getDomains((0, import_node_path21.join)(path7)),
3066
+ getDomains: getDomains((0, import_node_path22.join)(path8)),
2741
3067
  /**
2742
3068
  * Moves a given domain id to the version directory
2743
3069
  * @param directory
2744
3070
  */
2745
- versionDomain: versionDomain((0, import_node_path21.join)(path7, "domains")),
3071
+ versionDomain: versionDomain((0, import_node_path22.join)(path8, "domains")),
2746
3072
  /**
2747
3073
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
2748
3074
  *
2749
3075
  * @param path - The path to your domain, e.g. `/Payment`
2750
3076
  *
2751
3077
  */
2752
- rmDomain: rmDomain((0, import_node_path21.join)(path7, "domains")),
3078
+ rmDomain: rmDomain((0, import_node_path22.join)(path8, "domains")),
2753
3079
  /**
2754
3080
  * Remove an service by an domain id
2755
3081
  *
2756
3082
  * @param id - The id of the domain you want to remove
2757
3083
  *
2758
3084
  */
2759
- rmDomainById: rmDomainById((0, import_node_path21.join)(path7, "domains")),
3085
+ rmDomainById: rmDomainById((0, import_node_path22.join)(path8, "domains")),
2760
3086
  /**
2761
3087
  * Adds a file to the given domain
2762
3088
  * @param id - The id of the domain to add the file to
@@ -2764,28 +3090,28 @@ var src_default = (path7) => {
2764
3090
  * @param version - Optional version of the domain to add the file to
2765
3091
  * @returns
2766
3092
  */
2767
- addFileToDomain: addFileToDomain((0, import_node_path21.join)(path7, "domains")),
3093
+ addFileToDomain: addFileToDomain((0, import_node_path22.join)(path8, "domains")),
2768
3094
  /**
2769
3095
  * Adds an ubiquitous language dictionary to a domain
2770
3096
  * @param id - The id of the domain to add the ubiquitous language to
2771
3097
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
2772
3098
  * @param version - Optional version of the domain to add the ubiquitous language to
2773
3099
  */
2774
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path21.join)(path7, "domains")),
3100
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path22.join)(path8, "domains")),
2775
3101
  /**
2776
3102
  * Get the ubiquitous language dictionary from a domain
2777
3103
  * @param id - The id of the domain to get the ubiquitous language from
2778
3104
  * @param version - Optional version of the domain to get the ubiquitous language from
2779
3105
  * @returns
2780
3106
  */
2781
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path21.join)(path7, "domains")),
3107
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path22.join)(path8, "domains")),
2782
3108
  /**
2783
3109
  * Check to see if a domain version exists
2784
3110
  * @param id - The id of the domain
2785
3111
  * @param version - The version of the domain (supports semver)
2786
3112
  * @returns
2787
3113
  */
2788
- domainHasVersion: domainHasVersion((0, import_node_path21.join)(path7)),
3114
+ domainHasVersion: domainHasVersion((0, import_node_path22.join)(path8)),
2789
3115
  /**
2790
3116
  * Adds a given service to a domain
2791
3117
  * @param id - The id of the domain
@@ -2793,7 +3119,7 @@ var src_default = (path7) => {
2793
3119
  * @param version - (Optional) The version of the domain to add the service to
2794
3120
  * @returns
2795
3121
  */
2796
- addServiceToDomain: addServiceToDomain((0, import_node_path21.join)(path7, "domains")),
3122
+ addServiceToDomain: addServiceToDomain((0, import_node_path22.join)(path8, "domains")),
2797
3123
  /**
2798
3124
  * Adds a given subdomain to a domain
2799
3125
  * @param id - The id of the domain
@@ -2801,7 +3127,7 @@ var src_default = (path7) => {
2801
3127
  * @param version - (Optional) The version of the domain to add the subdomain to
2802
3128
  * @returns
2803
3129
  */
2804
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path21.join)(path7, "domains")),
3130
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path22.join)(path8, "domains")),
2805
3131
  /**
2806
3132
  * Adds an entity to a domain
2807
3133
  * @param id - The id of the domain
@@ -2809,7 +3135,7 @@ var src_default = (path7) => {
2809
3135
  * @param version - (Optional) The version of the domain to add the entity to
2810
3136
  * @returns
2811
3137
  */
2812
- addEntityToDomain: addEntityToDomain((0, import_node_path21.join)(path7, "domains")),
3138
+ addEntityToDomain: addEntityToDomain((0, import_node_path22.join)(path8, "domains")),
2813
3139
  /**
2814
3140
  * Add an event to a domain by its id.
2815
3141
  *
@@ -2827,7 +3153,7 @@ var src_default = (path7) => {
2827
3153
  *
2828
3154
  * ```
2829
3155
  */
2830
- addEventToDomain: addMessageToDomain((0, import_node_path21.join)(path7, "domains")),
3156
+ addEventToDomain: addMessageToDomain((0, import_node_path22.join)(path8, "domains")),
2831
3157
  /**
2832
3158
  * Add a command to a domain by its id.
2833
3159
  *
@@ -2845,7 +3171,7 @@ var src_default = (path7) => {
2845
3171
  *
2846
3172
  * ```
2847
3173
  */
2848
- addCommandToDomain: addMessageToDomain((0, import_node_path21.join)(path7, "domains")),
3174
+ addCommandToDomain: addMessageToDomain((0, import_node_path22.join)(path8, "domains")),
2849
3175
  /**
2850
3176
  * Add a query to a domain by its id.
2851
3177
  *
@@ -2863,7 +3189,7 @@ var src_default = (path7) => {
2863
3189
  *
2864
3190
  * ```
2865
3191
  */
2866
- addQueryToDomain: addMessageToDomain((0, import_node_path21.join)(path7, "domains")),
3192
+ addQueryToDomain: addMessageToDomain((0, import_node_path22.join)(path8, "domains")),
2867
3193
  /**
2868
3194
  * ================================
2869
3195
  * Teams
@@ -2876,25 +3202,25 @@ var src_default = (path7) => {
2876
3202
  * @param options - Optional options to write the team
2877
3203
  *
2878
3204
  */
2879
- writeTeam: writeTeam((0, import_node_path21.join)(path7, "teams")),
3205
+ writeTeam: writeTeam((0, import_node_path22.join)(path8, "teams")),
2880
3206
  /**
2881
3207
  * Returns a team from EventCatalog
2882
3208
  * @param id - The id of the team to retrieve
2883
3209
  * @returns Team|Undefined
2884
3210
  */
2885
- getTeam: getTeam((0, import_node_path21.join)(path7, "teams")),
3211
+ getTeam: getTeam((0, import_node_path22.join)(path8, "teams")),
2886
3212
  /**
2887
3213
  * Returns all teams from EventCatalog
2888
3214
  * @returns Team[]|Undefined
2889
3215
  */
2890
- getTeams: getTeams((0, import_node_path21.join)(path7, "teams")),
3216
+ getTeams: getTeams((0, import_node_path22.join)(path8, "teams")),
2891
3217
  /**
2892
3218
  * Remove a team by the team id
2893
3219
  *
2894
3220
  * @param id - The id of the team you want to remove
2895
3221
  *
2896
3222
  */
2897
- rmTeamById: rmTeamById((0, import_node_path21.join)(path7, "teams")),
3223
+ rmTeamById: rmTeamById((0, import_node_path22.join)(path8, "teams")),
2898
3224
  /**
2899
3225
  * ================================
2900
3226
  * Users
@@ -2907,25 +3233,25 @@ var src_default = (path7) => {
2907
3233
  * @param options - Optional options to write the user
2908
3234
  *
2909
3235
  */
2910
- writeUser: writeUser((0, import_node_path21.join)(path7, "users")),
3236
+ writeUser: writeUser((0, import_node_path22.join)(path8, "users")),
2911
3237
  /**
2912
3238
  * Returns a user from EventCatalog
2913
3239
  * @param id - The id of the user to retrieve
2914
3240
  * @returns User|Undefined
2915
3241
  */
2916
- getUser: getUser((0, import_node_path21.join)(path7, "users")),
3242
+ getUser: getUser((0, import_node_path22.join)(path8, "users")),
2917
3243
  /**
2918
3244
  * Returns all user from EventCatalog
2919
3245
  * @returns User[]|Undefined
2920
3246
  */
2921
- getUsers: getUsers((0, import_node_path21.join)(path7)),
3247
+ getUsers: getUsers((0, import_node_path22.join)(path8)),
2922
3248
  /**
2923
3249
  * Remove a user by the user id
2924
3250
  *
2925
3251
  * @param id - The id of the user you want to remove
2926
3252
  *
2927
3253
  */
2928
- rmUserById: rmUserById((0, import_node_path21.join)(path7, "users")),
3254
+ rmUserById: rmUserById((0, import_node_path22.join)(path8, "users")),
2929
3255
  /**
2930
3256
  * ================================
2931
3257
  * Custom Docs
@@ -2936,32 +3262,32 @@ var src_default = (path7) => {
2936
3262
  * @param path - The path to the custom doc to retrieve
2937
3263
  * @returns CustomDoc|Undefined
2938
3264
  */
2939
- getCustomDoc: getCustomDoc((0, import_node_path21.join)(path7, "docs")),
3265
+ getCustomDoc: getCustomDoc((0, import_node_path22.join)(path8, "docs")),
2940
3266
  /**
2941
3267
  * Returns all custom docs from EventCatalog
2942
3268
  * @param options - Optional options to get custom docs from a specific path
2943
3269
  * @returns CustomDoc[]|Undefined
2944
3270
  */
2945
- getCustomDocs: getCustomDocs((0, import_node_path21.join)(path7, "docs")),
3271
+ getCustomDocs: getCustomDocs((0, import_node_path22.join)(path8, "docs")),
2946
3272
  /**
2947
3273
  * Writes a custom doc to EventCatalog
2948
3274
  * @param customDoc - The custom doc to write
2949
3275
  * @param options - Optional options to write the custom doc
2950
3276
  *
2951
3277
  */
2952
- writeCustomDoc: writeCustomDoc((0, import_node_path21.join)(path7, "docs")),
3278
+ writeCustomDoc: writeCustomDoc((0, import_node_path22.join)(path8, "docs")),
2953
3279
  /**
2954
3280
  * Removes a custom doc from EventCatalog
2955
3281
  * @param path - The path to the custom doc to remove
2956
3282
  *
2957
3283
  */
2958
- rmCustomDoc: rmCustomDoc((0, import_node_path21.join)(path7, "docs")),
3284
+ rmCustomDoc: rmCustomDoc((0, import_node_path22.join)(path8, "docs")),
2959
3285
  /**
2960
3286
  * Dumps the catalog to a JSON file.
2961
3287
  * @param directory - The directory to dump the catalog to
2962
3288
  * @returns A JSON file with the catalog
2963
3289
  */
2964
- dumpCatalog: dumpCatalog((0, import_node_path21.join)(path7)),
3290
+ dumpCatalog: dumpCatalog((0, import_node_path22.join)(path8)),
2965
3291
  /**
2966
3292
  * Returns the event catalog configuration file.
2967
3293
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2969,7 +3295,7 @@ var src_default = (path7) => {
2969
3295
  * @param directory - The directory of the catalog.
2970
3296
  * @returns A JSON object with the configuration for the event catalog.
2971
3297
  */
2972
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path21.join)(path7)),
3298
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path22.join)(path8)),
2973
3299
  /**
2974
3300
  * ================================
2975
3301
  * Changelogs
@@ -2983,7 +3309,7 @@ var src_default = (path7) => {
2983
3309
  * @param options - Optional options (version, format)
2984
3310
  *
2985
3311
  */
2986
- writeChangelog: writeChangelog((0, import_node_path21.join)(path7)),
3312
+ writeChangelog: writeChangelog((0, import_node_path22.join)(path8)),
2987
3313
  /**
2988
3314
  * Appends a changelog entry to an existing changelog for a resource.
2989
3315
  * If no changelog exists, one is created.
@@ -2993,7 +3319,7 @@ var src_default = (path7) => {
2993
3319
  * @param options - Optional options (version, format)
2994
3320
  *
2995
3321
  */
2996
- appendChangelog: appendChangelog((0, import_node_path21.join)(path7)),
3322
+ appendChangelog: appendChangelog((0, import_node_path22.join)(path8)),
2997
3323
  /**
2998
3324
  * Returns the changelog for a resource in EventCatalog
2999
3325
  *
@@ -3001,7 +3327,7 @@ var src_default = (path7) => {
3001
3327
  * @param options - Optional options (version)
3002
3328
  * @returns Changelog|Undefined
3003
3329
  */
3004
- getChangelog: getChangelog((0, import_node_path21.join)(path7)),
3330
+ getChangelog: getChangelog((0, import_node_path22.join)(path8)),
3005
3331
  /**
3006
3332
  * Removes the changelog for a resource in EventCatalog
3007
3333
  *
@@ -3009,7 +3335,7 @@ var src_default = (path7) => {
3009
3335
  * @param options - Optional options (version)
3010
3336
  *
3011
3337
  */
3012
- rmChangelog: rmChangelog((0, import_node_path21.join)(path7)),
3338
+ rmChangelog: rmChangelog((0, import_node_path22.join)(path8)),
3013
3339
  /**
3014
3340
  * ================================
3015
3341
  * Resources Utils
@@ -3034,33 +3360,41 @@ var src_default = (path7) => {
3034
3360
  * @param path - The path to the message to retrieve
3035
3361
  * @returns Message|Undefined
3036
3362
  */
3037
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path21.join)(path7)),
3363
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path22.join)(path8)),
3038
3364
  /**
3039
3365
  * Returns the producers and consumers (services) for a given message
3040
3366
  * @param id - The id of the message to get the producers and consumers for
3041
3367
  * @param version - Optional version of the message
3042
3368
  * @returns { producers: Service[], consumers: Service[] }
3043
3369
  */
3044
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path21.join)(path7)),
3370
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path22.join)(path8)),
3045
3371
  /**
3046
3372
  * Returns the consumers of a given schema path
3047
3373
  * @param path - The path to the schema to get the consumers for
3048
3374
  * @returns Service[]
3049
3375
  */
3050
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path21.join)(path7)),
3376
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path22.join)(path8)),
3051
3377
  /**
3052
3378
  * Returns the producers of a given schema path
3053
3379
  * @param path - The path to the schema to get the producers for
3054
3380
  * @returns Service[]
3055
3381
  */
3056
- getProducersOfSchema: getProducersOfSchema((0, import_node_path21.join)(path7)),
3382
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path22.join)(path8)),
3383
+ /**
3384
+ * Returns the schema for a given message (event, command or query) by its id and version.
3385
+ * If no version is given, the latest version is used.
3386
+ * @param id - The id of the message to get the schema for
3387
+ * @param version - Optional version of the message
3388
+ * @returns { schema: string, fileName: string } | undefined
3389
+ */
3390
+ getSchemaForMessage: getSchemaForMessage((0, import_node_path22.join)(path8)),
3057
3391
  /**
3058
3392
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
3059
3393
  * @param id - The id of the resource to get the owners for
3060
3394
  * @param version - Optional version of the resource
3061
3395
  * @returns { owners: User[] }
3062
3396
  */
3063
- getOwnersForResource: getOwnersForResource((0, import_node_path21.join)(path7)),
3397
+ getOwnersForResource: getOwnersForResource((0, import_node_path22.join)(path8)),
3064
3398
  /**
3065
3399
  * ================================
3066
3400
  * Entities
@@ -3072,13 +3406,13 @@ var src_default = (path7) => {
3072
3406
  * @param version - Optional id of the version to get (supports semver)
3073
3407
  * @returns Entity|Undefined
3074
3408
  */
3075
- getEntity: getEntity((0, import_node_path21.join)(path7)),
3409
+ getEntity: getEntity((0, import_node_path22.join)(path8)),
3076
3410
  /**
3077
3411
  * Returns all entities from EventCatalog
3078
3412
  * @param latestOnly - optional boolean, set to true to get only latest versions
3079
3413
  * @returns Entity[]|Undefined
3080
3414
  */
3081
- getEntities: getEntities((0, import_node_path21.join)(path7)),
3415
+ getEntities: getEntities((0, import_node_path22.join)(path8)),
3082
3416
  /**
3083
3417
  * Adds an entity to EventCatalog
3084
3418
  *
@@ -3086,33 +3420,33 @@ var src_default = (path7) => {
3086
3420
  * @param options - Optional options to write the entity
3087
3421
  *
3088
3422
  */
3089
- writeEntity: writeEntity((0, import_node_path21.join)(path7, "entities")),
3423
+ writeEntity: writeEntity((0, import_node_path22.join)(path8, "entities")),
3090
3424
  /**
3091
3425
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
3092
3426
  *
3093
3427
  * @param path - The path to your entity, e.g. `/User`
3094
3428
  *
3095
3429
  */
3096
- rmEntity: rmEntity((0, import_node_path21.join)(path7, "entities")),
3430
+ rmEntity: rmEntity((0, import_node_path22.join)(path8, "entities")),
3097
3431
  /**
3098
3432
  * Remove an entity by an entity id
3099
3433
  *
3100
3434
  * @param id - The id of the entity you want to remove
3101
3435
  *
3102
3436
  */
3103
- rmEntityById: rmEntityById((0, import_node_path21.join)(path7)),
3437
+ rmEntityById: rmEntityById((0, import_node_path22.join)(path8)),
3104
3438
  /**
3105
3439
  * Moves a given entity id to the version directory
3106
3440
  * @param id - The id of the entity to version
3107
3441
  */
3108
- versionEntity: versionEntity((0, import_node_path21.join)(path7)),
3442
+ versionEntity: versionEntity((0, import_node_path22.join)(path8)),
3109
3443
  /**
3110
3444
  * Check to see if an entity version exists
3111
3445
  * @param id - The id of the entity
3112
3446
  * @param version - The version of the entity (supports semver)
3113
3447
  * @returns
3114
3448
  */
3115
- entityHasVersion: entityHasVersion((0, import_node_path21.join)(path7)),
3449
+ entityHasVersion: entityHasVersion((0, import_node_path22.join)(path8)),
3116
3450
  /**
3117
3451
  * ================================
3118
3452
  * Data Stores
@@ -3124,42 +3458,42 @@ var src_default = (path7) => {
3124
3458
  * @param options - Optional options to write the data store
3125
3459
  *
3126
3460
  */
3127
- writeDataStore: writeDataStore((0, import_node_path21.join)(path7, "containers")),
3461
+ writeDataStore: writeDataStore((0, import_node_path22.join)(path8, "containers")),
3128
3462
  /**
3129
3463
  * Returns a data store from EventCatalog
3130
3464
  * @param id - The id of the data store to retrieve
3131
3465
  * @param version - Optional id of the version to get (supports semver)
3132
3466
  * @returns Container|Undefined
3133
3467
  */
3134
- getDataStore: getDataStore((0, import_node_path21.join)(path7)),
3468
+ getDataStore: getDataStore((0, import_node_path22.join)(path8)),
3135
3469
  /**
3136
3470
  * Returns all data stores from EventCatalog
3137
3471
  * @param latestOnly - optional boolean, set to true to get only latest versions
3138
3472
  * @returns Container[]|Undefined
3139
3473
  */
3140
- getDataStores: getDataStores((0, import_node_path21.join)(path7)),
3474
+ getDataStores: getDataStores((0, import_node_path22.join)(path8)),
3141
3475
  /**
3142
3476
  * Version a data store by its id
3143
3477
  * @param id - The id of the data store to version
3144
3478
  */
3145
- versionDataStore: versionDataStore((0, import_node_path21.join)(path7, "containers")),
3479
+ versionDataStore: versionDataStore((0, import_node_path22.join)(path8, "containers")),
3146
3480
  /**
3147
3481
  * Remove a data store by its path
3148
3482
  * @param path - The path to the data store to remove
3149
3483
  */
3150
- rmDataStore: rmDataStore((0, import_node_path21.join)(path7, "containers")),
3484
+ rmDataStore: rmDataStore((0, import_node_path22.join)(path8, "containers")),
3151
3485
  /**
3152
3486
  * Remove a data store by its id
3153
3487
  * @param id - The id of the data store to remove
3154
3488
  */
3155
- rmDataStoreById: rmDataStoreById((0, import_node_path21.join)(path7)),
3489
+ rmDataStoreById: rmDataStoreById((0, import_node_path22.join)(path8)),
3156
3490
  /**
3157
3491
  * Check to see if a data store version exists
3158
3492
  * @param id - The id of the data store
3159
3493
  * @param version - The version of the data store (supports semver)
3160
3494
  * @returns
3161
3495
  */
3162
- dataStoreHasVersion: dataStoreHasVersion((0, import_node_path21.join)(path7)),
3496
+ dataStoreHasVersion: dataStoreHasVersion((0, import_node_path22.join)(path8)),
3163
3497
  /**
3164
3498
  * Adds a file to a data store by its id
3165
3499
  * @param id - The id of the data store to add the file to
@@ -3167,14 +3501,14 @@ var src_default = (path7) => {
3167
3501
  * @param version - Optional version of the data store to add the file to
3168
3502
  * @returns
3169
3503
  */
3170
- addFileToDataStore: addFileToDataStore((0, import_node_path21.join)(path7)),
3504
+ addFileToDataStore: addFileToDataStore((0, import_node_path22.join)(path8)),
3171
3505
  /**
3172
3506
  * Writes a data store to a service by its id
3173
3507
  * @param dataStore - The data store to write
3174
3508
  * @param service - The service to write the data store to
3175
3509
  * @returns
3176
3510
  */
3177
- writeDataStoreToService: writeDataStoreToService((0, import_node_path21.join)(path7)),
3511
+ writeDataStoreToService: writeDataStoreToService((0, import_node_path22.join)(path8)),
3178
3512
  /**
3179
3513
  * ================================
3180
3514
  * Data Products
@@ -3186,7 +3520,7 @@ var src_default = (path7) => {
3186
3520
  * @param options - Optional options to write the data product
3187
3521
  *
3188
3522
  */
3189
- writeDataProduct: writeDataProduct((0, import_node_path21.join)(path7, "data-products")),
3523
+ writeDataProduct: writeDataProduct((0, import_node_path22.join)(path8, "data-products")),
3190
3524
  /**
3191
3525
  * Writes a data product to a domain in EventCatalog
3192
3526
  * @param dataProduct - The data product to write
@@ -3194,43 +3528,43 @@ var src_default = (path7) => {
3194
3528
  * @param options - Optional options to write the data product
3195
3529
  *
3196
3530
  */
3197
- writeDataProductToDomain: writeDataProductToDomain((0, import_node_path21.join)(path7, "domains")),
3531
+ writeDataProductToDomain: writeDataProductToDomain((0, import_node_path22.join)(path8, "domains")),
3198
3532
  /**
3199
3533
  * Returns a data product from EventCatalog
3200
3534
  * @param id - The id of the data product to retrieve
3201
3535
  * @param version - Optional id of the version to get (supports semver)
3202
3536
  * @returns DataProduct|Undefined
3203
3537
  */
3204
- getDataProduct: getDataProduct((0, import_node_path21.join)(path7)),
3538
+ getDataProduct: getDataProduct((0, import_node_path22.join)(path8)),
3205
3539
  /**
3206
3540
  * Returns all data products from EventCatalog
3207
3541
  * @param latestOnly - optional boolean, set to true to get only latest versions
3208
3542
  * @returns DataProduct[]|Undefined
3209
3543
  */
3210
- getDataProducts: getDataProducts((0, import_node_path21.join)(path7)),
3544
+ getDataProducts: getDataProducts((0, import_node_path22.join)(path8)),
3211
3545
  /**
3212
3546
  * Version a data product by its id
3213
3547
  * @param id - The id of the data product to version
3214
3548
  */
3215
- versionDataProduct: versionDataProduct((0, import_node_path21.join)(path7)),
3549
+ versionDataProduct: versionDataProduct((0, import_node_path22.join)(path8)),
3216
3550
  /**
3217
3551
  * Remove a data product by its path
3218
3552
  * @param path - The path to the data product to remove
3219
3553
  */
3220
- rmDataProduct: rmDataProduct((0, import_node_path21.join)(path7, "data-products")),
3554
+ rmDataProduct: rmDataProduct((0, import_node_path22.join)(path8, "data-products")),
3221
3555
  /**
3222
3556
  * Remove a data product by its id
3223
3557
  * @param id - The id of the data product to remove
3224
3558
  * @param version - Optional version of the data product to remove
3225
3559
  */
3226
- rmDataProductById: rmDataProductById((0, import_node_path21.join)(path7)),
3560
+ rmDataProductById: rmDataProductById((0, import_node_path22.join)(path8)),
3227
3561
  /**
3228
3562
  * Check to see if a data product version exists
3229
3563
  * @param id - The id of the data product
3230
3564
  * @param version - The version of the data product (supports semver)
3231
3565
  * @returns
3232
3566
  */
3233
- dataProductHasVersion: dataProductHasVersion((0, import_node_path21.join)(path7)),
3567
+ dataProductHasVersion: dataProductHasVersion((0, import_node_path22.join)(path8)),
3234
3568
  /**
3235
3569
  * Adds a file to a data product by its id
3236
3570
  * @param id - The id of the data product to add the file to
@@ -3238,7 +3572,7 @@ var src_default = (path7) => {
3238
3572
  * @param version - Optional version of the data product to add the file to
3239
3573
  * @returns
3240
3574
  */
3241
- addFileToDataProduct: addFileToDataProduct((0, import_node_path21.join)(path7)),
3575
+ addFileToDataProduct: addFileToDataProduct((0, import_node_path22.join)(path8)),
3242
3576
  /**
3243
3577
  * Adds a data product to a domain
3244
3578
  * @param id - The id of the domain
@@ -3246,7 +3580,7 @@ var src_default = (path7) => {
3246
3580
  * @param version - (Optional) The version of the domain to add the data product to
3247
3581
  * @returns
3248
3582
  */
3249
- addDataProductToDomain: addDataProductToDomain((0, import_node_path21.join)(path7, "domains")),
3583
+ addDataProductToDomain: addDataProductToDomain((0, import_node_path22.join)(path8, "domains")),
3250
3584
  /**
3251
3585
  * ================================
3252
3586
  * Diagrams
@@ -3258,13 +3592,13 @@ var src_default = (path7) => {
3258
3592
  * @param version - Optional id of the version to get (supports semver)
3259
3593
  * @returns Diagram|Undefined
3260
3594
  */
3261
- getDiagram: getDiagram((0, import_node_path21.join)(path7)),
3595
+ getDiagram: getDiagram((0, import_node_path22.join)(path8)),
3262
3596
  /**
3263
3597
  * Returns all diagrams from EventCatalog
3264
3598
  * @param latestOnly - optional boolean, set to true to get only latest versions
3265
3599
  * @returns Diagram[]|Undefined
3266
3600
  */
3267
- getDiagrams: getDiagrams((0, import_node_path21.join)(path7)),
3601
+ getDiagrams: getDiagrams((0, import_node_path22.join)(path8)),
3268
3602
  /**
3269
3603
  * Adds a diagram to EventCatalog
3270
3604
  *
@@ -3272,33 +3606,33 @@ var src_default = (path7) => {
3272
3606
  * @param options - Optional options to write the diagram
3273
3607
  *
3274
3608
  */
3275
- writeDiagram: writeDiagram((0, import_node_path21.join)(path7, "diagrams")),
3609
+ writeDiagram: writeDiagram((0, import_node_path22.join)(path8, "diagrams")),
3276
3610
  /**
3277
3611
  * Remove a diagram from EventCatalog (modeled on the standard POSIX rm utility)
3278
3612
  *
3279
3613
  * @param path - The path to your diagram, e.g. `/ArchitectureDiagram`
3280
3614
  *
3281
3615
  */
3282
- rmDiagram: rmDiagram((0, import_node_path21.join)(path7, "diagrams")),
3616
+ rmDiagram: rmDiagram((0, import_node_path22.join)(path8, "diagrams")),
3283
3617
  /**
3284
3618
  * Remove a diagram by a diagram id
3285
3619
  *
3286
3620
  * @param id - The id of the diagram you want to remove
3287
3621
  *
3288
3622
  */
3289
- rmDiagramById: rmDiagramById((0, import_node_path21.join)(path7)),
3623
+ rmDiagramById: rmDiagramById((0, import_node_path22.join)(path8)),
3290
3624
  /**
3291
3625
  * Moves a given diagram id to the version directory
3292
3626
  * @param id - The id of the diagram to version
3293
3627
  */
3294
- versionDiagram: versionDiagram((0, import_node_path21.join)(path7)),
3628
+ versionDiagram: versionDiagram((0, import_node_path22.join)(path8)),
3295
3629
  /**
3296
3630
  * Check to see if a diagram version exists
3297
3631
  * @param id - The id of the diagram
3298
3632
  * @param version - The version of the diagram (supports semver)
3299
3633
  * @returns
3300
3634
  */
3301
- diagramHasVersion: diagramHasVersion((0, import_node_path21.join)(path7)),
3635
+ diagramHasVersion: diagramHasVersion((0, import_node_path22.join)(path8)),
3302
3636
  /**
3303
3637
  * Adds a file to the given diagram
3304
3638
  * @param id - The id of the diagram to add the file to
@@ -3306,7 +3640,7 @@ var src_default = (path7) => {
3306
3640
  * @param version - Optional version of the diagram to add the file to
3307
3641
  * @returns
3308
3642
  */
3309
- addFileToDiagram: addFileToDiagram((0, import_node_path21.join)(path7)),
3643
+ addFileToDiagram: addFileToDiagram((0, import_node_path22.join)(path8)),
3310
3644
  /**
3311
3645
  * ================================
3312
3646
  * DSL
@@ -3325,18 +3659,21 @@ var src_default = (path7) => {
3325
3659
  * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
3326
3660
  * ```
3327
3661
  */
3328
- toDSL: toDSL((0, import_node_path21.join)(path7), {
3329
- getEvent: getEvent((0, import_node_path21.join)(path7)),
3330
- getCommand: getCommand((0, import_node_path21.join)(path7)),
3331
- getQuery: getQuery((0, import_node_path21.join)(path7)),
3332
- getService: getService((0, import_node_path21.join)(path7)),
3333
- getServices: getServices((0, import_node_path21.join)(path7)),
3334
- getDomain: getDomain((0, import_node_path21.join)(path7, "domains")),
3335
- getChannel: getChannel((0, import_node_path21.join)(path7)),
3336
- getChannels: getChannels((0, import_node_path21.join)(path7)),
3337
- getContainer: getDataStore((0, import_node_path21.join)(path7)),
3338
- getTeam: getTeam((0, import_node_path21.join)(path7, "teams")),
3339
- getUser: getUser((0, import_node_path21.join)(path7, "users"))
3662
+ createSnapshot: createSnapshot((0, import_node_path22.join)(path8)),
3663
+ diffSnapshots: diffSnapshots((0, import_node_path22.join)(path8)),
3664
+ listSnapshots: listSnapshots((0, import_node_path22.join)(path8)),
3665
+ toDSL: toDSL((0, import_node_path22.join)(path8), {
3666
+ getEvent: getEvent((0, import_node_path22.join)(path8)),
3667
+ getCommand: getCommand((0, import_node_path22.join)(path8)),
3668
+ getQuery: getQuery((0, import_node_path22.join)(path8)),
3669
+ getService: getService((0, import_node_path22.join)(path8)),
3670
+ getServices: getServices((0, import_node_path22.join)(path8)),
3671
+ getDomain: getDomain((0, import_node_path22.join)(path8, "domains")),
3672
+ getChannel: getChannel((0, import_node_path22.join)(path8)),
3673
+ getChannels: getChannels((0, import_node_path22.join)(path8)),
3674
+ getContainer: getDataStore((0, import_node_path22.join)(path8)),
3675
+ getTeam: getTeam((0, import_node_path22.join)(path8, "teams")),
3676
+ getUser: getUser((0, import_node_path22.join)(path8, "users"))
3340
3677
  })
3341
3678
  };
3342
3679
  };