@eventcatalog/sdk 2.16.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -794,8 +794,8 @@ var getFiles = async (pattern, ignore = "") => {
794
794
  );
795
795
  }
796
796
  };
797
- var readMdxFile = async (path7) => {
798
- const { data } = matter.read(path7);
797
+ var readMdxFile = async (path8) => {
798
+ const { data } = matter.read(path8);
799
799
  const { markdown, ...frontmatter } = data;
800
800
  return { ...frontmatter, markdown };
801
801
  };
@@ -889,8 +889,8 @@ var writeResource = async (catalogDir, resource, options = {
889
889
  versionExistingContent: false,
890
890
  format: "mdx"
891
891
  }) => {
892
- const path7 = options.path || `/${resource.id}`;
893
- const fullPath = join2(catalogDir, path7);
892
+ const path8 = options.path || `/${resource.id}`;
893
+ const fullPath = join2(catalogDir, path8);
894
894
  const format = options.format || "mdx";
895
895
  fsSync2.mkdirSync(fullPath, { recursive: true });
896
896
  const lockPath = join2(fullPath, `index.${format}`);
@@ -1024,16 +1024,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
1024
1024
  }
1025
1025
  invalidateFileCache();
1026
1026
  };
1027
- var waitForFileRemoval = async (path7, maxRetries = 50, delay = 10) => {
1027
+ var waitForFileRemoval = async (path8, maxRetries = 50, delay = 10) => {
1028
1028
  for (let i = 0; i < maxRetries; i++) {
1029
1029
  try {
1030
- await fs.access(path7);
1030
+ await fs.access(path8);
1031
1031
  await new Promise((resolve2) => setTimeout(resolve2, delay));
1032
1032
  } catch (error) {
1033
1033
  return;
1034
1034
  }
1035
1035
  }
1036
- throw new Error(`File/directory ${path7} was not removed after ${maxRetries} attempts`);
1036
+ throw new Error(`File/directory ${path8} was not removed after ${maxRetries} attempts`);
1037
1037
  };
1038
1038
  var addFileToResource = async (catalogDir, id, file, version, options) => {
1039
1039
  let pathToResource;
@@ -1086,8 +1086,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
1086
1086
  pathForEvent = join3(pathForEvent, event.id);
1087
1087
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
1088
1088
  };
1089
- var rmEvent = (directory) => async (path7) => {
1090
- await fs2.rm(join3(directory, path7), { recursive: true });
1089
+ var rmEvent = (directory) => async (path8) => {
1090
+ await fs2.rm(join3(directory, path8), { recursive: true });
1091
1091
  invalidateFileCache();
1092
1092
  };
1093
1093
  var rmEventById = (directory) => async (id, version, persistFiles) => {
@@ -1123,8 +1123,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
1123
1123
  pathForCommand = join4(pathForCommand, command.id);
1124
1124
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
1125
1125
  };
1126
- var rmCommand = (directory) => async (path7) => {
1127
- await fs3.rm(join4(directory, path7), { recursive: true });
1126
+ var rmCommand = (directory) => async (path8) => {
1127
+ await fs3.rm(join4(directory, path8), { recursive: true });
1128
1128
  invalidateFileCache();
1129
1129
  };
1130
1130
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
@@ -1158,8 +1158,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
1158
1158
  pathForQuery = join5(pathForQuery, query.id);
1159
1159
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
1160
1160
  };
1161
- var rmQuery = (directory) => async (path7) => {
1162
- await fs4.rm(join5(directory, path7), { recursive: true });
1161
+ var rmQuery = (directory) => async (path8) => {
1162
+ await fs4.rm(join5(directory, path8), { recursive: true });
1163
1163
  invalidateFileCache();
1164
1164
  };
1165
1165
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
@@ -1179,8 +1179,8 @@ var queryHasVersion = (directory) => async (id, version) => {
1179
1179
  import fs5 from "fs/promises";
1180
1180
  import { join as join6, dirname as dirname4, extname, relative as relative2 } from "path";
1181
1181
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
1182
- var getServiceByPath = (directory) => async (path7) => {
1183
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path7);
1182
+ var getServiceByPath = (directory) => async (path8) => {
1183
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path8);
1184
1184
  return service;
1185
1185
  };
1186
1186
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -1215,8 +1215,8 @@ var writeService = (directory) => async (service, options = {
1215
1215
  };
1216
1216
  var writeVersionedService = (directory) => async (service) => {
1217
1217
  const resource = { ...service };
1218
- const path7 = getVersionedDirectory(service.id, service.version);
1219
- return await writeService(directory)(resource, { path: path7 });
1218
+ const path8 = getVersionedDirectory(service.id, service.version);
1219
+ return await writeService(directory)(resource, { path: path8 });
1220
1220
  };
1221
1221
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
1222
1222
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -1224,8 +1224,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
1224
1224
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
1225
1225
  };
1226
1226
  var versionService = (directory) => async (id) => versionResource(directory, id);
1227
- var rmService = (directory) => async (path7) => {
1228
- await fs5.rm(join6(directory, path7), { recursive: true });
1227
+ var rmService = (directory) => async (path8) => {
1228
+ await fs5.rm(join6(directory, path8), { recursive: true });
1229
1229
  invalidateFileCache();
1230
1230
  };
1231
1231
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
@@ -1290,8 +1290,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
1290
1290
  if (!existingResource) {
1291
1291
  throw new Error(`Cannot find service ${id} in the catalog`);
1292
1292
  }
1293
- const path7 = existingResource.split(/[\\/]+services/)[0];
1294
- const pathToResource = join6(path7, "services");
1293
+ const path8 = existingResource.split(/[\\/]+services/)[0];
1294
+ const pathToResource = join6(path8, "services");
1295
1295
  await rmServiceById(directory)(id, version);
1296
1296
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1297
1297
  };
@@ -1299,9 +1299,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
1299
1299
  const file = await findFileById(directory, id, version);
1300
1300
  return !!file;
1301
1301
  };
1302
- var isService = (directory) => async (path7) => {
1303
- const service = await getServiceByPath(directory)(path7);
1304
- const relativePath = relative2(directory, path7);
1302
+ var isService = (directory) => async (path8) => {
1303
+ const service = await getServiceByPath(directory)(path8);
1304
+ const relativePath = relative2(directory, path8);
1305
1305
  const segments = relativePath.split(/[/\\]+/);
1306
1306
  return !!service && segments.includes("services");
1307
1307
  };
@@ -1323,8 +1323,8 @@ var addEntityToService = (directory) => async (id, entity, version) => {
1323
1323
  if (!existingResource) {
1324
1324
  throw new Error(`Cannot find service ${id} in the catalog`);
1325
1325
  }
1326
- const path7 = existingResource.split(/[\\/]+services/)[0];
1327
- const pathToResource = join6(path7, "services");
1326
+ const path8 = existingResource.split(/[\\/]+services/)[0];
1327
+ const pathToResource = join6(path8, "services");
1328
1328
  await rmServiceById(directory)(id, version);
1329
1329
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1330
1330
  };
@@ -1359,8 +1359,8 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
1359
1359
  if (!existingResource) {
1360
1360
  throw new Error(`Cannot find service ${id} in the catalog`);
1361
1361
  }
1362
- const path7 = existingResource.split(/[\\/]+services/)[0];
1363
- const pathToResource = join6(path7, "services");
1362
+ const path8 = existingResource.split(/[\\/]+services/)[0];
1363
+ const pathToResource = join6(path8, "services");
1364
1364
  await rmServiceById(directory)(id, version);
1365
1365
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1366
1366
  };
@@ -1401,8 +1401,8 @@ var writeDomain = (directory) => async (domain, options = {
1401
1401
  return await writeResource(directory, resource, { ...options, type: "domain" });
1402
1402
  };
1403
1403
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
1404
- var rmDomain = (directory) => async (path7) => {
1405
- await fs6.rm(join7(directory, path7), { recursive: true });
1404
+ var rmDomain = (directory) => async (path8) => {
1405
+ await fs6.rm(join7(directory, path8), { recursive: true });
1406
1406
  invalidateFileCache();
1407
1407
  };
1408
1408
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
@@ -1533,8 +1533,8 @@ import { join as join8, extname as extname2 } from "path";
1533
1533
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
1534
1534
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
1535
1535
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
1536
- var rmChannel = (directory) => async (path7) => {
1537
- await fs7.rm(join8(directory, path7), { recursive: true });
1536
+ var rmChannel = (directory) => async (path8) => {
1537
+ await fs7.rm(join8(directory, path8), { recursive: true });
1538
1538
  invalidateFileCache();
1539
1539
  };
1540
1540
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
@@ -1576,8 +1576,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
1576
1576
  if (!existingResource) {
1577
1577
  throw new Error(`Cannot find message ${id} in the catalog`);
1578
1578
  }
1579
- const path7 = existingResource.split(`/[\\/]+${collection}`)[0];
1580
- const pathToResource = join8(path7, collection);
1579
+ const path8 = existingResource.split(`/[\\/]+${collection}`)[0];
1580
+ const pathToResource = join8(path8, collection);
1581
1581
  await rmMessageById(directory)(_message.id, _message.version, true);
1582
1582
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
1583
1583
  };
@@ -1586,8 +1586,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
1586
1586
  import { dirname as dirname5 } from "path";
1587
1587
  import matter4 from "gray-matter";
1588
1588
  import { satisfies as satisfies4, validRange as validRange3 } from "semver";
1589
- var getMessageBySchemaPath = (directory) => async (path7, options) => {
1590
- const pathToMessage = dirname5(path7);
1589
+ var getMessageBySchemaPath = (directory) => async (path8, options) => {
1590
+ const pathToMessage = dirname5(path8);
1591
1591
  try {
1592
1592
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
1593
1593
  if (!files || files.length === 0) {
@@ -1659,18 +1659,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
1659
1659
  }
1660
1660
  return { producers, consumers };
1661
1661
  };
1662
- var getConsumersOfSchema = (directory) => async (path7) => {
1662
+ var getConsumersOfSchema = (directory) => async (path8) => {
1663
1663
  try {
1664
- const message = await getMessageBySchemaPath(directory)(path7);
1664
+ const message = await getMessageBySchemaPath(directory)(path8);
1665
1665
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
1666
1666
  return consumers;
1667
1667
  } catch (error) {
1668
1668
  return [];
1669
1669
  }
1670
1670
  };
1671
- var getProducersOfSchema = (directory) => async (path7) => {
1671
+ var getProducersOfSchema = (directory) => async (path8) => {
1672
1672
  try {
1673
- const message = await getMessageBySchemaPath(directory)(path7);
1673
+ const message = await getMessageBySchemaPath(directory)(path8);
1674
1674
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
1675
1675
  return producers;
1676
1676
  } catch (error) {
@@ -1874,8 +1874,8 @@ var filterCollection = (collection, options) => {
1874
1874
  };
1875
1875
  var getEventCatalogConfigurationFile = (directory) => async () => {
1876
1876
  try {
1877
- const path7 = join13(directory, "eventcatalog.config.js");
1878
- const configModule = await import(path7);
1877
+ const path8 = join13(directory, "eventcatalog.config.js");
1878
+ const configModule = await import(path8);
1879
1879
  return configModule.default;
1880
1880
  } catch (error) {
1881
1881
  console.error("Error getting event catalog configuration file", error);
@@ -1931,10 +1931,321 @@ var dumpCatalog = (directory) => async (options) => {
1931
1931
  };
1932
1932
  };
1933
1933
 
1934
+ // src/snapshots.ts
1935
+ import fs11 from "fs";
1936
+ import path6 from "path";
1937
+ import { execSync } from "child_process";
1938
+ import { compare } from "semver";
1939
+
1940
+ // src/snapshot-diff.ts
1941
+ var stableStringify = (value) => {
1942
+ if (value === null || value === void 0 || typeof value !== "object") {
1943
+ return JSON.stringify(value);
1944
+ }
1945
+ if (Array.isArray(value)) {
1946
+ return "[" + value.map(stableStringify).join(",") + "]";
1947
+ }
1948
+ const sorted = Object.keys(value).sort().map((key) => JSON.stringify(key) + ":" + stableStringify(value[key]));
1949
+ return "{" + sorted.join(",") + "}";
1950
+ };
1951
+ var flattenResources = (snapshot) => {
1952
+ const resources = [];
1953
+ const addResources = (items, type) => {
1954
+ for (const item of items) {
1955
+ resources.push({
1956
+ resourceId: item.id,
1957
+ version: item.version,
1958
+ type,
1959
+ data: item
1960
+ });
1961
+ }
1962
+ };
1963
+ addResources(snapshot.resources.domains, "domain");
1964
+ addResources(snapshot.resources.services, "service");
1965
+ addResources(snapshot.resources.messages.events, "event");
1966
+ addResources(snapshot.resources.messages.commands, "command");
1967
+ addResources(snapshot.resources.messages.queries, "query");
1968
+ addResources(snapshot.resources.channels, "channel");
1969
+ return resources;
1970
+ };
1971
+ var EXCLUDED_FIELDS = /* @__PURE__ */ new Set(["markdown", "_eventcatalog"]);
1972
+ var getComparableFields = (data) => {
1973
+ const result = {};
1974
+ for (const [key, value] of Object.entries(data)) {
1975
+ if (!EXCLUDED_FIELDS.has(key)) {
1976
+ result[key] = value;
1977
+ }
1978
+ }
1979
+ return result;
1980
+ };
1981
+ var findChangedFields = (dataA, dataB) => {
1982
+ const fieldsA = getComparableFields(dataA);
1983
+ const fieldsB = getComparableFields(dataB);
1984
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(fieldsA), ...Object.keys(fieldsB)]);
1985
+ const changed = [];
1986
+ for (const key of allKeys) {
1987
+ if (stableStringify(fieldsA[key] ?? null) !== stableStringify(fieldsB[key] ?? null)) {
1988
+ changed.push(key);
1989
+ }
1990
+ }
1991
+ return changed;
1992
+ };
1993
+ var resourceKey = (r) => `${r.resourceId}@${r.version}`;
1994
+ var idTypeKey = (r) => `${r.resourceId}:${r.type}`;
1995
+ var computeResourceDiff = (snapshotA, snapshotB) => {
1996
+ const resourcesA = flattenResources(snapshotA);
1997
+ const resourcesB = flattenResources(snapshotB);
1998
+ const mapA = /* @__PURE__ */ new Map();
1999
+ const byIdA = /* @__PURE__ */ new Map();
2000
+ for (const r of resourcesA) {
2001
+ mapA.set(resourceKey(r), r);
2002
+ byIdA.set(idTypeKey(r), r);
2003
+ }
2004
+ const mapB = /* @__PURE__ */ new Map();
2005
+ const byIdB = /* @__PURE__ */ new Map();
2006
+ for (const r of resourcesB) {
2007
+ mapB.set(resourceKey(r), r);
2008
+ byIdB.set(idTypeKey(r), r);
2009
+ }
2010
+ const changes = [];
2011
+ const handledIds = /* @__PURE__ */ new Set();
2012
+ for (const resource of resourcesB) {
2013
+ const key = resourceKey(resource);
2014
+ if (!mapA.has(key)) {
2015
+ const idKey = idTypeKey(resource);
2016
+ const oldResource = byIdA.get(idKey);
2017
+ if (oldResource && oldResource.version !== resource.version && !handledIds.has(idKey)) {
2018
+ const changedFields = findChangedFields(oldResource.data, resource.data);
2019
+ changes.push({
2020
+ resourceId: resource.resourceId,
2021
+ version: resource.version,
2022
+ type: resource.type,
2023
+ changeType: "versioned",
2024
+ previousVersion: oldResource.version,
2025
+ newVersion: resource.version,
2026
+ changedFields: changedFields.length > 0 ? changedFields : void 0
2027
+ });
2028
+ handledIds.add(idKey);
2029
+ } else if (!handledIds.has(idKey)) {
2030
+ changes.push({
2031
+ resourceId: resource.resourceId,
2032
+ version: resource.version,
2033
+ type: resource.type,
2034
+ changeType: "added"
2035
+ });
2036
+ }
2037
+ }
2038
+ }
2039
+ for (const resource of resourcesA) {
2040
+ const key = resourceKey(resource);
2041
+ if (!mapB.has(key)) {
2042
+ const idKey = idTypeKey(resource);
2043
+ if (!handledIds.has(idKey)) {
2044
+ changes.push({
2045
+ resourceId: resource.resourceId,
2046
+ version: resource.version,
2047
+ type: resource.type,
2048
+ changeType: "removed"
2049
+ });
2050
+ }
2051
+ }
2052
+ }
2053
+ for (const resourceB of resourcesB) {
2054
+ const key = resourceKey(resourceB);
2055
+ const resourceA = mapA.get(key);
2056
+ if (resourceA) {
2057
+ const changedFields = findChangedFields(resourceA.data, resourceB.data);
2058
+ if (changedFields.length > 0) {
2059
+ changes.push({
2060
+ resourceId: resourceB.resourceId,
2061
+ version: resourceB.version,
2062
+ type: resourceB.type,
2063
+ changeType: "modified",
2064
+ changedFields
2065
+ });
2066
+ }
2067
+ }
2068
+ }
2069
+ return changes;
2070
+ };
2071
+ var getRelationshipKey = (serviceId, resourceId, resourceVersion, direction) => {
2072
+ return `${serviceId}:${direction}:${resourceId}@${resourceVersion || "latest"}`;
2073
+ };
2074
+ var extractRelationships = (snapshot) => {
2075
+ const relationships = /* @__PURE__ */ new Map();
2076
+ for (const service of snapshot.resources.services) {
2077
+ for (const direction of ["sends", "receives"]) {
2078
+ const pointers = service[direction] || [];
2079
+ for (const pointer of pointers) {
2080
+ const key = getRelationshipKey(service.id, pointer.id, pointer.version, direction);
2081
+ relationships.set(key, {
2082
+ serviceId: service.id,
2083
+ serviceVersion: service.version,
2084
+ resourceId: pointer.id,
2085
+ resourceVersion: pointer.version,
2086
+ direction
2087
+ });
2088
+ }
2089
+ }
2090
+ }
2091
+ return relationships;
2092
+ };
2093
+ var computeRelationshipDiff = (snapshotA, snapshotB) => {
2094
+ const relsA = extractRelationships(snapshotA);
2095
+ const relsB = extractRelationships(snapshotB);
2096
+ const changes = [];
2097
+ for (const [key, rel] of relsB) {
2098
+ if (!relsA.has(key)) {
2099
+ changes.push({ ...rel, changeType: "added" });
2100
+ }
2101
+ }
2102
+ for (const [key, rel] of relsA) {
2103
+ if (!relsB.has(key)) {
2104
+ changes.push({ ...rel, changeType: "removed" });
2105
+ }
2106
+ }
2107
+ return changes;
2108
+ };
2109
+
2110
+ // src/snapshots.ts
2111
+ var SNAPSHOT_VERSION = "1.0.0";
2112
+ var getEventCatalogVersion2 = (catalogDir) => {
2113
+ try {
2114
+ const packageJson = fs11.readFileSync(path6.join(catalogDir, "package.json"), "utf8");
2115
+ const packageJsonObject = JSON.parse(packageJson);
2116
+ return packageJsonObject["dependencies"]?.["@eventcatalog/core"] ?? "unknown";
2117
+ } catch {
2118
+ return "unknown";
2119
+ }
2120
+ };
2121
+ var pickCoreFields = (resource) => {
2122
+ const picked = { id: resource.id, version: resource.version, name: resource.name };
2123
+ if (resource.sends) picked.sends = resource.sends;
2124
+ if (resource.receives) picked.receives = resource.receives;
2125
+ if (resource.deprecated) picked.deprecated = resource.deprecated;
2126
+ if (resource.owners) picked.owners = resource.owners;
2127
+ return picked;
2128
+ };
2129
+ var deduplicateByLatestVersion = (resources) => {
2130
+ const seen = /* @__PURE__ */ new Map();
2131
+ for (const r of resources) {
2132
+ const existing = seen.get(r.id);
2133
+ if (!existing || compare(r.version, existing.version) > 0) {
2134
+ seen.set(r.id, r);
2135
+ }
2136
+ }
2137
+ return Array.from(seen.values());
2138
+ };
2139
+ var stripToCore = (resources) => {
2140
+ if (!resources || resources.length === 0) return [];
2141
+ return deduplicateByLatestVersion(resources).map(pickCoreFields);
2142
+ };
2143
+ var detectGitInfo = (catalogDir) => {
2144
+ try {
2145
+ const opts = { cwd: catalogDir, encoding: "utf8", stdio: "pipe" };
2146
+ const branch = execSync("git rev-parse --abbrev-ref HEAD", opts).trim();
2147
+ const commit = execSync("git rev-parse --short HEAD", opts).trim();
2148
+ const status = execSync("git status --porcelain", opts).trim();
2149
+ return { branch, commit, dirty: status.length > 0 };
2150
+ } catch {
2151
+ return void 0;
2152
+ }
2153
+ };
2154
+ var createSnapshot = (directory) => {
2155
+ return async (options) => {
2156
+ const { label, outputDir, git } = options || {};
2157
+ const sdk = src_default(directory);
2158
+ const [domains, services, events, commands, queries, channels] = await Promise.all([
2159
+ sdk.getDomains(),
2160
+ sdk.getServices(),
2161
+ sdk.getEvents(),
2162
+ sdk.getCommands(),
2163
+ sdk.getQueries(),
2164
+ sdk.getChannels()
2165
+ ]);
2166
+ const snapshotDomains = stripToCore(domains);
2167
+ const snapshotServices = stripToCore(services);
2168
+ const snapshotEvents = stripToCore(events);
2169
+ const snapshotCommands = stripToCore(commands);
2170
+ const snapshotQueries = stripToCore(queries);
2171
+ const snapshotChannels = stripToCore(channels);
2172
+ const snapshotLabel = label || (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
2173
+ const gitInfo = git || detectGitInfo(directory);
2174
+ const snapshot = {
2175
+ snapshotVersion: SNAPSHOT_VERSION,
2176
+ catalogVersion: getEventCatalogVersion2(directory),
2177
+ label: snapshotLabel,
2178
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2179
+ ...gitInfo ? { git: gitInfo } : {},
2180
+ resources: {
2181
+ domains: snapshotDomains,
2182
+ services: snapshotServices,
2183
+ messages: {
2184
+ events: snapshotEvents,
2185
+ commands: snapshotCommands,
2186
+ queries: snapshotQueries
2187
+ },
2188
+ channels: snapshotChannels
2189
+ }
2190
+ };
2191
+ const snapshotsDir = outputDir || path6.join(directory, ".snapshots");
2192
+ fs11.mkdirSync(snapshotsDir, { recursive: true });
2193
+ const fileName = `${snapshotLabel}.snapshot.json`;
2194
+ const filePath = path6.join(snapshotsDir, fileName);
2195
+ fs11.writeFileSync(filePath, JSON.stringify(snapshot));
2196
+ return { filePath, snapshot };
2197
+ };
2198
+ };
2199
+ var diffSnapshots = (directory) => async (snapshotAPath, snapshotBPath) => {
2200
+ const snapshotA = JSON.parse(fs11.readFileSync(snapshotAPath, "utf-8"));
2201
+ const snapshotB = JSON.parse(fs11.readFileSync(snapshotBPath, "utf-8"));
2202
+ const resourceChanges = computeResourceDiff(snapshotA, snapshotB);
2203
+ const relationshipChanges = computeRelationshipDiff(snapshotA, snapshotB);
2204
+ const resourceCounts = { added: 0, removed: 0, modified: 0, versioned: 0 };
2205
+ for (const r of resourceChanges) resourceCounts[r.changeType]++;
2206
+ const relCounts = { added: 0, removed: 0 };
2207
+ for (const r of relationshipChanges) relCounts[r.changeType]++;
2208
+ return {
2209
+ snapshotA: { label: snapshotA.label, createdAt: snapshotA.createdAt },
2210
+ snapshotB: { label: snapshotB.label, createdAt: snapshotB.createdAt },
2211
+ summary: {
2212
+ totalChanges: resourceChanges.length + relationshipChanges.length,
2213
+ resourcesAdded: resourceCounts.added,
2214
+ resourcesRemoved: resourceCounts.removed,
2215
+ resourcesModified: resourceCounts.modified,
2216
+ resourcesVersioned: resourceCounts.versioned,
2217
+ relationshipsAdded: relCounts.added,
2218
+ relationshipsRemoved: relCounts.removed
2219
+ },
2220
+ resources: resourceChanges,
2221
+ relationships: relationshipChanges
2222
+ };
2223
+ };
2224
+ var listSnapshots = (directory) => async () => {
2225
+ const snapshotsDir = path6.join(directory, ".snapshots");
2226
+ if (!fs11.existsSync(snapshotsDir)) return [];
2227
+ const files = fs11.readdirSync(snapshotsDir).filter((f) => f.endsWith(".snapshot.json"));
2228
+ const snapshots = [];
2229
+ for (const file of files) {
2230
+ try {
2231
+ const filePath = path6.join(snapshotsDir, file);
2232
+ const content = JSON.parse(fs11.readFileSync(filePath, "utf-8"));
2233
+ snapshots.push({
2234
+ label: content.label,
2235
+ createdAt: content.createdAt,
2236
+ filePath,
2237
+ ...content.git ? { git: content.git } : {}
2238
+ });
2239
+ } catch {
2240
+ }
2241
+ }
2242
+ return snapshots.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
2243
+ };
2244
+
1934
2245
  // src/changelogs.ts
1935
- import path6, { dirname as dirname6 } from "path";
2246
+ import path7, { dirname as dirname6 } from "path";
1936
2247
  import fsSync7 from "fs";
1937
- import fs11 from "fs/promises";
2248
+ import fs12 from "fs/promises";
1938
2249
  import matter8 from "gray-matter";
1939
2250
  var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
1940
2251
  const { version, format = "mdx" } = options;
@@ -1943,7 +2254,7 @@ var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
1943
2254
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
1944
2255
  }
1945
2256
  const resourceDir = dirname6(resourceFile);
1946
- const changelogPath = path6.join(resourceDir, `changelog.${format}`);
2257
+ const changelogPath = path7.join(resourceDir, `changelog.${format}`);
1947
2258
  const { markdown, ...frontmatter } = changelog;
1948
2259
  const fm = { ...frontmatter };
1949
2260
  if (fm.createdAt instanceof Date) {
@@ -1964,8 +2275,8 @@ var appendChangelog = (catalogDir) => async (id, changelog, options = {}) => {
1964
2275
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
1965
2276
  }
1966
2277
  const resourceDir = dirname6(resourceFile);
1967
- const mdxPath = path6.join(resourceDir, "changelog.mdx");
1968
- const mdPath = path6.join(resourceDir, "changelog.md");
2278
+ const mdxPath = path7.join(resourceDir, "changelog.mdx");
2279
+ const mdPath = path7.join(resourceDir, "changelog.md");
1969
2280
  const existingPath = fsSync7.existsSync(mdxPath) ? mdxPath : fsSync7.existsSync(mdPath) ? mdPath : void 0;
1970
2281
  if (!existingPath) {
1971
2282
  return writeChangelog(catalogDir)(id, changelog, options);
@@ -1994,8 +2305,8 @@ var getChangelog = (catalogDir) => async (id, options = {}) => {
1994
2305
  const resourceFile = await findFileById(catalogDir, id, version);
1995
2306
  if (!resourceFile) return void 0;
1996
2307
  const resourceDir = dirname6(resourceFile);
1997
- const mdxPath = path6.join(resourceDir, "changelog.mdx");
1998
- const mdPath = path6.join(resourceDir, "changelog.md");
2308
+ const mdxPath = path7.join(resourceDir, "changelog.mdx");
2309
+ const mdPath = path7.join(resourceDir, "changelog.md");
1999
2310
  const changelogPath = fsSync7.existsSync(mdxPath) ? mdxPath : fsSync7.existsSync(mdPath) ? mdPath : void 0;
2000
2311
  if (!changelogPath) return void 0;
2001
2312
  const { data, content } = matter8.read(changelogPath);
@@ -2008,19 +2319,19 @@ var rmChangelog = (catalogDir) => async (id, options = {}) => {
2008
2319
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
2009
2320
  }
2010
2321
  const resourceDir = dirname6(resourceFile);
2011
- const mdxPath = path6.join(resourceDir, "changelog.mdx");
2012
- const mdPath = path6.join(resourceDir, "changelog.md");
2322
+ const mdxPath = path7.join(resourceDir, "changelog.mdx");
2323
+ const mdPath = path7.join(resourceDir, "changelog.md");
2013
2324
  if (fsSync7.existsSync(mdxPath)) {
2014
- await fs11.rm(mdxPath);
2325
+ await fs12.rm(mdxPath);
2015
2326
  }
2016
2327
  if (fsSync7.existsSync(mdPath)) {
2017
- await fs11.rm(mdPath);
2328
+ await fs12.rm(mdPath);
2018
2329
  }
2019
2330
  invalidateFileCache();
2020
2331
  };
2021
2332
 
2022
2333
  // src/entities.ts
2023
- import fs12 from "fs/promises";
2334
+ import fs13 from "fs/promises";
2024
2335
  import { join as join14 } from "path";
2025
2336
  var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
2026
2337
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
@@ -2029,8 +2340,8 @@ var writeEntity = (directory) => async (entity, options = {
2029
2340
  override: false,
2030
2341
  format: "mdx"
2031
2342
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
2032
- var rmEntity = (directory) => async (path7) => {
2033
- await fs12.rm(join14(directory, path7), { recursive: true });
2343
+ var rmEntity = (directory) => async (path8) => {
2344
+ await fs13.rm(join14(directory, path8), { recursive: true });
2034
2345
  invalidateFileCache();
2035
2346
  };
2036
2347
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
@@ -2043,7 +2354,7 @@ var entityHasVersion = (directory) => async (id, version) => {
2043
2354
  };
2044
2355
 
2045
2356
  // src/containers.ts
2046
- import fs13 from "fs/promises";
2357
+ import fs14 from "fs/promises";
2047
2358
  import { join as join15 } from "path";
2048
2359
  var getContainer = (directory) => async (id, version) => getResource(directory, id, version, { type: "container" });
2049
2360
  var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
@@ -2053,8 +2364,8 @@ var writeContainer = (directory) => async (data, options = {
2053
2364
  format: "mdx"
2054
2365
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
2055
2366
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
2056
- var rmContainer = (directory) => async (path7) => {
2057
- await fs13.rm(join15(directory, path7), { recursive: true });
2367
+ var rmContainer = (directory) => async (path8) => {
2368
+ await fs14.rm(join15(directory, path8), { recursive: true });
2058
2369
  invalidateFileCache();
2059
2370
  };
2060
2371
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
@@ -2087,7 +2398,7 @@ var addFileToDataStore = addFileToContainer;
2087
2398
  var writeDataStoreToService = writeContainerToService;
2088
2399
 
2089
2400
  // src/data-products.ts
2090
- import fs14 from "fs/promises";
2401
+ import fs15 from "fs/promises";
2091
2402
  import { join as join16 } from "path";
2092
2403
  var getDataProduct = (directory) => async (id, version) => getResource(directory, id, version, { type: "data-product" });
2093
2404
  var getDataProducts = (directory) => async (options) => getResources(directory, { type: "data-products", latestOnly: options?.latestOnly });
@@ -2101,8 +2412,8 @@ var writeDataProductToDomain = (directory) => async (dataProduct, domain, option
2101
2412
  pathForDataProduct = join16(pathForDataProduct, dataProduct.id);
2102
2413
  await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
2103
2414
  };
2104
- var rmDataProduct = (directory) => async (path7) => {
2105
- await fs14.rm(join16(directory, path7), { recursive: true });
2415
+ var rmDataProduct = (directory) => async (path8) => {
2416
+ await fs15.rm(join16(directory, path8), { recursive: true });
2106
2417
  invalidateFileCache();
2107
2418
  };
2108
2419
  var rmDataProductById = (directory) => async (id, version, persistFiles) => {
@@ -2116,7 +2427,7 @@ var dataProductHasVersion = (directory) => async (id, version) => {
2116
2427
  var addFileToDataProduct = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
2117
2428
 
2118
2429
  // src/diagrams.ts
2119
- import fs15 from "fs/promises";
2430
+ import fs16 from "fs/promises";
2120
2431
  import { join as join17 } from "path";
2121
2432
  var getDiagram = (directory) => async (id, version) => getResource(directory, id, version, { type: "diagram" });
2122
2433
  var getDiagrams = (directory) => async (options) => getResources(directory, { type: "diagrams", latestOnly: options?.latestOnly });
@@ -2125,8 +2436,8 @@ var writeDiagram = (directory) => async (diagram, options = {
2125
2436
  override: false,
2126
2437
  format: "mdx"
2127
2438
  }) => writeResource(directory, { ...diagram }, { ...options, type: "diagram" });
2128
- var rmDiagram = (directory) => async (path7) => {
2129
- await fs15.rm(join17(directory, path7), { recursive: true });
2439
+ var rmDiagram = (directory) => async (path8) => {
2440
+ await fs16.rm(join17(directory, path8), { recursive: true });
2130
2441
  invalidateFileCache();
2131
2442
  };
2132
2443
  var rmDiagramById = (directory) => async (id, version, persistFiles) => {
@@ -2140,7 +2451,7 @@ var diagramHasVersion = (directory) => async (id, version) => {
2140
2451
  var addFileToDiagram = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version, { type: "diagram" });
2141
2452
 
2142
2453
  // src/index.ts
2143
- var src_default = (path7) => {
2454
+ var src_default = (path8) => {
2144
2455
  return {
2145
2456
  /**
2146
2457
  * Returns an events from EventCatalog
@@ -2148,13 +2459,13 @@ var src_default = (path7) => {
2148
2459
  * @param version - Optional id of the version to get (supports semver)
2149
2460
  * @returns Event|Undefined
2150
2461
  */
2151
- getEvent: getEvent(join18(path7)),
2462
+ getEvent: getEvent(join18(path8)),
2152
2463
  /**
2153
2464
  * Returns all events from EventCatalog
2154
2465
  * @param latestOnly - optional boolean, set to true to get only latest versions
2155
2466
  * @returns Event[]|Undefined
2156
2467
  */
2157
- getEvents: getEvents(join18(path7)),
2468
+ getEvents: getEvents(join18(path8)),
2158
2469
  /**
2159
2470
  * Adds an event to EventCatalog
2160
2471
  *
@@ -2162,7 +2473,7 @@ var src_default = (path7) => {
2162
2473
  * @param options - Optional options to write the event
2163
2474
  *
2164
2475
  */
2165
- writeEvent: writeEvent(join18(path7, "events")),
2476
+ writeEvent: writeEvent(join18(path8, "events")),
2166
2477
  /**
2167
2478
  * Adds an event to a service in EventCatalog
2168
2479
  *
@@ -2171,26 +2482,26 @@ var src_default = (path7) => {
2171
2482
  * @param options - Optional options to write the event
2172
2483
  *
2173
2484
  */
2174
- writeEventToService: writeEventToService(join18(path7)),
2485
+ writeEventToService: writeEventToService(join18(path8)),
2175
2486
  /**
2176
2487
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
2177
2488
  *
2178
2489
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
2179
2490
  *
2180
2491
  */
2181
- rmEvent: rmEvent(join18(path7, "events")),
2492
+ rmEvent: rmEvent(join18(path8, "events")),
2182
2493
  /**
2183
2494
  * Remove an event by an Event id
2184
2495
  *
2185
2496
  * @param id - The id of the event you want to remove
2186
2497
  *
2187
2498
  */
2188
- rmEventById: rmEventById(join18(path7)),
2499
+ rmEventById: rmEventById(join18(path8)),
2189
2500
  /**
2190
2501
  * Moves a given event id to the version directory
2191
2502
  * @param directory
2192
2503
  */
2193
- versionEvent: versionEvent(join18(path7)),
2504
+ versionEvent: versionEvent(join18(path8)),
2194
2505
  /**
2195
2506
  * Adds a file to the given event
2196
2507
  * @param id - The id of the event to add the file to
@@ -2198,7 +2509,7 @@ var src_default = (path7) => {
2198
2509
  * @param version - Optional version of the event to add the file to
2199
2510
  * @returns
2200
2511
  */
2201
- addFileToEvent: addFileToEvent(join18(path7)),
2512
+ addFileToEvent: addFileToEvent(join18(path8)),
2202
2513
  /**
2203
2514
  * Adds a schema to the given event
2204
2515
  * @param id - The id of the event to add the schema to
@@ -2206,14 +2517,14 @@ var src_default = (path7) => {
2206
2517
  * @param version - Optional version of the event to add the schema to
2207
2518
  * @returns
2208
2519
  */
2209
- addSchemaToEvent: addSchemaToEvent(join18(path7)),
2520
+ addSchemaToEvent: addSchemaToEvent(join18(path8)),
2210
2521
  /**
2211
2522
  * Check to see if an event version exists
2212
2523
  * @param id - The id of the event
2213
2524
  * @param version - The version of the event (supports semver)
2214
2525
  * @returns
2215
2526
  */
2216
- eventHasVersion: eventHasVersion(join18(path7)),
2527
+ eventHasVersion: eventHasVersion(join18(path8)),
2217
2528
  /**
2218
2529
  * ================================
2219
2530
  * Commands
@@ -2225,13 +2536,13 @@ var src_default = (path7) => {
2225
2536
  * @param version - Optional id of the version to get (supports semver)
2226
2537
  * @returns Command|Undefined
2227
2538
  */
2228
- getCommand: getCommand(join18(path7)),
2539
+ getCommand: getCommand(join18(path8)),
2229
2540
  /**
2230
2541
  * Returns all commands from EventCatalog
2231
2542
  * @param latestOnly - optional boolean, set to true to get only latest versions
2232
2543
  * @returns Command[]|Undefined
2233
2544
  */
2234
- getCommands: getCommands(join18(path7)),
2545
+ getCommands: getCommands(join18(path8)),
2235
2546
  /**
2236
2547
  * Adds an command to EventCatalog
2237
2548
  *
@@ -2239,7 +2550,7 @@ var src_default = (path7) => {
2239
2550
  * @param options - Optional options to write the command
2240
2551
  *
2241
2552
  */
2242
- writeCommand: writeCommand(join18(path7, "commands")),
2553
+ writeCommand: writeCommand(join18(path8, "commands")),
2243
2554
  /**
2244
2555
  * Adds a command to a service in EventCatalog
2245
2556
  *
@@ -2248,26 +2559,26 @@ var src_default = (path7) => {
2248
2559
  * @param options - Optional options to write the command
2249
2560
  *
2250
2561
  */
2251
- writeCommandToService: writeCommandToService(join18(path7)),
2562
+ writeCommandToService: writeCommandToService(join18(path8)),
2252
2563
  /**
2253
2564
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
2254
2565
  *
2255
2566
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
2256
2567
  *
2257
2568
  */
2258
- rmCommand: rmCommand(join18(path7, "commands")),
2569
+ rmCommand: rmCommand(join18(path8, "commands")),
2259
2570
  /**
2260
2571
  * Remove an command by an Event id
2261
2572
  *
2262
2573
  * @param id - The id of the command you want to remove
2263
2574
  *
2264
2575
  */
2265
- rmCommandById: rmCommandById(join18(path7)),
2576
+ rmCommandById: rmCommandById(join18(path8)),
2266
2577
  /**
2267
2578
  * Moves a given command id to the version directory
2268
2579
  * @param directory
2269
2580
  */
2270
- versionCommand: versionCommand(join18(path7)),
2581
+ versionCommand: versionCommand(join18(path8)),
2271
2582
  /**
2272
2583
  * Adds a file to the given command
2273
2584
  * @param id - The id of the command to add the file to
@@ -2275,7 +2586,7 @@ var src_default = (path7) => {
2275
2586
  * @param version - Optional version of the command to add the file to
2276
2587
  * @returns
2277
2588
  */
2278
- addFileToCommand: addFileToCommand(join18(path7)),
2589
+ addFileToCommand: addFileToCommand(join18(path8)),
2279
2590
  /**
2280
2591
  * Adds a schema to the given command
2281
2592
  * @param id - The id of the command to add the schema to
@@ -2283,14 +2594,14 @@ var src_default = (path7) => {
2283
2594
  * @param version - Optional version of the command to add the schema to
2284
2595
  * @returns
2285
2596
  */
2286
- addSchemaToCommand: addSchemaToCommand(join18(path7)),
2597
+ addSchemaToCommand: addSchemaToCommand(join18(path8)),
2287
2598
  /**
2288
2599
  * Check to see if a command version exists
2289
2600
  * @param id - The id of the command
2290
2601
  * @param version - The version of the command (supports semver)
2291
2602
  * @returns
2292
2603
  */
2293
- commandHasVersion: commandHasVersion(join18(path7)),
2604
+ commandHasVersion: commandHasVersion(join18(path8)),
2294
2605
  /**
2295
2606
  * ================================
2296
2607
  * Queries
@@ -2302,13 +2613,13 @@ var src_default = (path7) => {
2302
2613
  * @param version - Optional id of the version to get (supports semver)
2303
2614
  * @returns Query|Undefined
2304
2615
  */
2305
- getQuery: getQuery(join18(path7)),
2616
+ getQuery: getQuery(join18(path8)),
2306
2617
  /**
2307
2618
  * Returns all queries from EventCatalog
2308
2619
  * @param latestOnly - optional boolean, set to true to get only latest versions
2309
2620
  * @returns Query[]|Undefined
2310
2621
  */
2311
- getQueries: getQueries(join18(path7)),
2622
+ getQueries: getQueries(join18(path8)),
2312
2623
  /**
2313
2624
  * Adds a query to EventCatalog
2314
2625
  *
@@ -2316,7 +2627,7 @@ var src_default = (path7) => {
2316
2627
  * @param options - Optional options to write the event
2317
2628
  *
2318
2629
  */
2319
- writeQuery: writeQuery(join18(path7, "queries")),
2630
+ writeQuery: writeQuery(join18(path8, "queries")),
2320
2631
  /**
2321
2632
  * Adds a query to a service in EventCatalog
2322
2633
  *
@@ -2325,26 +2636,26 @@ var src_default = (path7) => {
2325
2636
  * @param options - Optional options to write the query
2326
2637
  *
2327
2638
  */
2328
- writeQueryToService: writeQueryToService(join18(path7)),
2639
+ writeQueryToService: writeQueryToService(join18(path8)),
2329
2640
  /**
2330
2641
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
2331
2642
  *
2332
2643
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
2333
2644
  *
2334
2645
  */
2335
- rmQuery: rmQuery(join18(path7, "queries")),
2646
+ rmQuery: rmQuery(join18(path8, "queries")),
2336
2647
  /**
2337
2648
  * Remove a query by a Query id
2338
2649
  *
2339
2650
  * @param id - The id of the query you want to remove
2340
2651
  *
2341
2652
  */
2342
- rmQueryById: rmQueryById(join18(path7)),
2653
+ rmQueryById: rmQueryById(join18(path8)),
2343
2654
  /**
2344
2655
  * Moves a given query id to the version directory
2345
2656
  * @param directory
2346
2657
  */
2347
- versionQuery: versionQuery(join18(path7)),
2658
+ versionQuery: versionQuery(join18(path8)),
2348
2659
  /**
2349
2660
  * Adds a file to the given query
2350
2661
  * @param id - The id of the query to add the file to
@@ -2352,7 +2663,7 @@ var src_default = (path7) => {
2352
2663
  * @param version - Optional version of the query to add the file to
2353
2664
  * @returns
2354
2665
  */
2355
- addFileToQuery: addFileToQuery(join18(path7)),
2666
+ addFileToQuery: addFileToQuery(join18(path8)),
2356
2667
  /**
2357
2668
  * Adds a schema to the given query
2358
2669
  * @param id - The id of the query to add the schema to
@@ -2360,14 +2671,14 @@ var src_default = (path7) => {
2360
2671
  * @param version - Optional version of the query to add the schema to
2361
2672
  * @returns
2362
2673
  */
2363
- addSchemaToQuery: addSchemaToQuery(join18(path7)),
2674
+ addSchemaToQuery: addSchemaToQuery(join18(path8)),
2364
2675
  /**
2365
2676
  * Check to see if an query version exists
2366
2677
  * @param id - The id of the query
2367
2678
  * @param version - The version of the query (supports semver)
2368
2679
  * @returns
2369
2680
  */
2370
- queryHasVersion: queryHasVersion(join18(path7)),
2681
+ queryHasVersion: queryHasVersion(join18(path8)),
2371
2682
  /**
2372
2683
  * ================================
2373
2684
  * Channels
@@ -2379,13 +2690,13 @@ var src_default = (path7) => {
2379
2690
  * @param version - Optional id of the version to get (supports semver)
2380
2691
  * @returns Channel|Undefined
2381
2692
  */
2382
- getChannel: getChannel(join18(path7)),
2693
+ getChannel: getChannel(join18(path8)),
2383
2694
  /**
2384
2695
  * Returns all channels from EventCatalog
2385
2696
  * @param latestOnly - optional boolean, set to true to get only latest versions
2386
2697
  * @returns Channel[]|Undefined
2387
2698
  */
2388
- getChannels: getChannels(join18(path7)),
2699
+ getChannels: getChannels(join18(path8)),
2389
2700
  /**
2390
2701
  * Adds an channel to EventCatalog
2391
2702
  *
@@ -2393,33 +2704,33 @@ var src_default = (path7) => {
2393
2704
  * @param options - Optional options to write the channel
2394
2705
  *
2395
2706
  */
2396
- writeChannel: writeChannel(join18(path7, "channels")),
2707
+ writeChannel: writeChannel(join18(path8, "channels")),
2397
2708
  /**
2398
2709
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
2399
2710
  *
2400
2711
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
2401
2712
  *
2402
2713
  */
2403
- rmChannel: rmChannel(join18(path7, "channels")),
2714
+ rmChannel: rmChannel(join18(path8, "channels")),
2404
2715
  /**
2405
2716
  * Remove an channel by an Event id
2406
2717
  *
2407
2718
  * @param id - The id of the channel you want to remove
2408
2719
  *
2409
2720
  */
2410
- rmChannelById: rmChannelById(join18(path7)),
2721
+ rmChannelById: rmChannelById(join18(path8)),
2411
2722
  /**
2412
2723
  * Moves a given channel id to the version directory
2413
2724
  * @param directory
2414
2725
  */
2415
- versionChannel: versionChannel(join18(path7)),
2726
+ versionChannel: versionChannel(join18(path8)),
2416
2727
  /**
2417
2728
  * Check to see if a channel version exists
2418
2729
  * @param id - The id of the channel
2419
2730
  * @param version - The version of the channel (supports semver)
2420
2731
  * @returns
2421
2732
  */
2422
- channelHasVersion: channelHasVersion(join18(path7)),
2733
+ channelHasVersion: channelHasVersion(join18(path8)),
2423
2734
  /**
2424
2735
  * Add a channel to an event
2425
2736
  *
@@ -2436,7 +2747,7 @@ var src_default = (path7) => {
2436
2747
  *
2437
2748
  * ```
2438
2749
  */
2439
- addEventToChannel: addMessageToChannel(join18(path7), "events"),
2750
+ addEventToChannel: addMessageToChannel(join18(path8), "events"),
2440
2751
  /**
2441
2752
  * Add a channel to an command
2442
2753
  *
@@ -2453,7 +2764,7 @@ var src_default = (path7) => {
2453
2764
  *
2454
2765
  * ```
2455
2766
  */
2456
- addCommandToChannel: addMessageToChannel(join18(path7), "commands"),
2767
+ addCommandToChannel: addMessageToChannel(join18(path8), "commands"),
2457
2768
  /**
2458
2769
  * Add a channel to an query
2459
2770
  *
@@ -2470,7 +2781,7 @@ var src_default = (path7) => {
2470
2781
  *
2471
2782
  * ```
2472
2783
  */
2473
- addQueryToChannel: addMessageToChannel(join18(path7), "queries"),
2784
+ addQueryToChannel: addMessageToChannel(join18(path8), "queries"),
2474
2785
  /**
2475
2786
  * ================================
2476
2787
  * SERVICES
@@ -2483,14 +2794,14 @@ var src_default = (path7) => {
2483
2794
  * @param options - Optional options to write the event
2484
2795
  *
2485
2796
  */
2486
- writeService: writeService(join18(path7, "services")),
2797
+ writeService: writeService(join18(path8, "services")),
2487
2798
  /**
2488
2799
  * Adds a versioned service to EventCatalog
2489
2800
  *
2490
2801
  * @param service - The service to write
2491
2802
  *
2492
2803
  */
2493
- writeVersionedService: writeVersionedService(join18(path7, "services")),
2804
+ writeVersionedService: writeVersionedService(join18(path8, "services")),
2494
2805
  /**
2495
2806
  * Adds a service to a domain in EventCatalog
2496
2807
  *
@@ -2499,45 +2810,45 @@ var src_default = (path7) => {
2499
2810
  * @param options - Optional options to write the event
2500
2811
  *
2501
2812
  */
2502
- writeServiceToDomain: writeServiceToDomain(join18(path7, "domains")),
2813
+ writeServiceToDomain: writeServiceToDomain(join18(path8, "domains")),
2503
2814
  /**
2504
2815
  * Returns a service from EventCatalog
2505
2816
  * @param id - The id of the service to retrieve
2506
2817
  * @param version - Optional id of the version to get (supports semver)
2507
2818
  * @returns Service|Undefined
2508
2819
  */
2509
- getService: getService(join18(path7)),
2820
+ getService: getService(join18(path8)),
2510
2821
  /**
2511
2822
  * Returns a service from EventCatalog by it's path.
2512
2823
  * @param path - The path to the service to retrieve
2513
2824
  * @returns Service|Undefined
2514
2825
  */
2515
- getServiceByPath: getServiceByPath(join18(path7)),
2826
+ getServiceByPath: getServiceByPath(join18(path8)),
2516
2827
  /**
2517
2828
  * Returns all services from EventCatalog
2518
2829
  * @param latestOnly - optional boolean, set to true to get only latest versions
2519
2830
  * @returns Service[]|Undefined
2520
2831
  */
2521
- getServices: getServices(join18(path7)),
2832
+ getServices: getServices(join18(path8)),
2522
2833
  /**
2523
2834
  * Moves a given service id to the version directory
2524
2835
  * @param directory
2525
2836
  */
2526
- versionService: versionService(join18(path7)),
2837
+ versionService: versionService(join18(path8)),
2527
2838
  /**
2528
2839
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
2529
2840
  *
2530
2841
  * @param path - The path to your service, e.g. `/InventoryService`
2531
2842
  *
2532
2843
  */
2533
- rmService: rmService(join18(path7, "services")),
2844
+ rmService: rmService(join18(path8, "services")),
2534
2845
  /**
2535
2846
  * Remove an service by an service id
2536
2847
  *
2537
2848
  * @param id - The id of the service you want to remove
2538
2849
  *
2539
2850
  */
2540
- rmServiceById: rmServiceById(join18(path7)),
2851
+ rmServiceById: rmServiceById(join18(path8)),
2541
2852
  /**
2542
2853
  * Adds a file to the given service
2543
2854
  * @param id - The id of the service to add the file to
@@ -2545,21 +2856,21 @@ var src_default = (path7) => {
2545
2856
  * @param version - Optional version of the service to add the file to
2546
2857
  * @returns
2547
2858
  */
2548
- addFileToService: addFileToService(join18(path7)),
2859
+ addFileToService: addFileToService(join18(path8)),
2549
2860
  /**
2550
2861
  * Returns the specifications for a given service
2551
2862
  * @param id - The id of the service to retrieve the specifications for
2552
2863
  * @param version - Optional version of the service
2553
2864
  * @returns
2554
2865
  */
2555
- getSpecificationFilesForService: getSpecificationFilesForService(join18(path7)),
2866
+ getSpecificationFilesForService: getSpecificationFilesForService(join18(path8)),
2556
2867
  /**
2557
2868
  * Check to see if a service version exists
2558
2869
  * @param id - The id of the service
2559
2870
  * @param version - The version of the service (supports semver)
2560
2871
  * @returns
2561
2872
  */
2562
- serviceHasVersion: serviceHasVersion(join18(path7)),
2873
+ serviceHasVersion: serviceHasVersion(join18(path8)),
2563
2874
  /**
2564
2875
  * Add an event to a service by it's id.
2565
2876
  *
@@ -2579,7 +2890,7 @@ var src_default = (path7) => {
2579
2890
  *
2580
2891
  * ```
2581
2892
  */
2582
- addEventToService: addMessageToService(join18(path7)),
2893
+ addEventToService: addMessageToService(join18(path8)),
2583
2894
  /**
2584
2895
  * Add a data store to a service by it's id.
2585
2896
  *
@@ -2596,7 +2907,7 @@ var src_default = (path7) => {
2596
2907
  *
2597
2908
  * ```
2598
2909
  */
2599
- addDataStoreToService: addDataStoreToService(join18(path7)),
2910
+ addDataStoreToService: addDataStoreToService(join18(path8)),
2600
2911
  /**
2601
2912
  * Add a command to a service by it's id.
2602
2913
  *
@@ -2616,7 +2927,7 @@ var src_default = (path7) => {
2616
2927
  *
2617
2928
  * ```
2618
2929
  */
2619
- addCommandToService: addMessageToService(join18(path7)),
2930
+ addCommandToService: addMessageToService(join18(path8)),
2620
2931
  /**
2621
2932
  * Add a query to a service by it's id.
2622
2933
  *
@@ -2636,7 +2947,7 @@ var src_default = (path7) => {
2636
2947
  *
2637
2948
  * ```
2638
2949
  */
2639
- addQueryToService: addMessageToService(join18(path7)),
2950
+ addQueryToService: addMessageToService(join18(path8)),
2640
2951
  /**
2641
2952
  * Add an entity to a service by its id.
2642
2953
  *
@@ -2654,7 +2965,7 @@ var src_default = (path7) => {
2654
2965
  *
2655
2966
  * ```
2656
2967
  */
2657
- addEntityToService: addEntityToService(join18(path7)),
2968
+ addEntityToService: addEntityToService(join18(path8)),
2658
2969
  /**
2659
2970
  * Check to see if a service exists by it's path.
2660
2971
  *
@@ -2671,13 +2982,13 @@ var src_default = (path7) => {
2671
2982
  * @param path - The path to the service to check
2672
2983
  * @returns boolean
2673
2984
  */
2674
- isService: isService(join18(path7)),
2985
+ isService: isService(join18(path8)),
2675
2986
  /**
2676
2987
  * Converts a file to a service.
2677
2988
  * @param file - The file to convert to a service.
2678
2989
  * @returns The service.
2679
2990
  */
2680
- toService: toService(join18(path7)),
2991
+ toService: toService(join18(path8)),
2681
2992
  /**
2682
2993
  * ================================
2683
2994
  * Domains
@@ -2690,39 +3001,39 @@ var src_default = (path7) => {
2690
3001
  * @param options - Optional options to write the event
2691
3002
  *
2692
3003
  */
2693
- writeDomain: writeDomain(join18(path7, "domains")),
3004
+ writeDomain: writeDomain(join18(path8, "domains")),
2694
3005
  /**
2695
3006
  * Returns a domain from EventCatalog
2696
3007
  * @param id - The id of the domain to retrieve
2697
3008
  * @param version - Optional id of the version to get (supports semver)
2698
3009
  * @returns Domain|Undefined
2699
3010
  */
2700
- getDomain: getDomain(join18(path7, "domains")),
3011
+ getDomain: getDomain(join18(path8, "domains")),
2701
3012
  /**
2702
3013
  * Returns all domains from EventCatalog
2703
3014
  * @param latestOnly - optional boolean, set to true to get only latest versions
2704
3015
  * @returns Domain[]|Undefined
2705
3016
  */
2706
- getDomains: getDomains(join18(path7)),
3017
+ getDomains: getDomains(join18(path8)),
2707
3018
  /**
2708
3019
  * Moves a given domain id to the version directory
2709
3020
  * @param directory
2710
3021
  */
2711
- versionDomain: versionDomain(join18(path7, "domains")),
3022
+ versionDomain: versionDomain(join18(path8, "domains")),
2712
3023
  /**
2713
3024
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
2714
3025
  *
2715
3026
  * @param path - The path to your domain, e.g. `/Payment`
2716
3027
  *
2717
3028
  */
2718
- rmDomain: rmDomain(join18(path7, "domains")),
3029
+ rmDomain: rmDomain(join18(path8, "domains")),
2719
3030
  /**
2720
3031
  * Remove an service by an domain id
2721
3032
  *
2722
3033
  * @param id - The id of the domain you want to remove
2723
3034
  *
2724
3035
  */
2725
- rmDomainById: rmDomainById(join18(path7, "domains")),
3036
+ rmDomainById: rmDomainById(join18(path8, "domains")),
2726
3037
  /**
2727
3038
  * Adds a file to the given domain
2728
3039
  * @param id - The id of the domain to add the file to
@@ -2730,28 +3041,28 @@ var src_default = (path7) => {
2730
3041
  * @param version - Optional version of the domain to add the file to
2731
3042
  * @returns
2732
3043
  */
2733
- addFileToDomain: addFileToDomain(join18(path7, "domains")),
3044
+ addFileToDomain: addFileToDomain(join18(path8, "domains")),
2734
3045
  /**
2735
3046
  * Adds an ubiquitous language dictionary to a domain
2736
3047
  * @param id - The id of the domain to add the ubiquitous language to
2737
3048
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
2738
3049
  * @param version - Optional version of the domain to add the ubiquitous language to
2739
3050
  */
2740
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join18(path7, "domains")),
3051
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join18(path8, "domains")),
2741
3052
  /**
2742
3053
  * Get the ubiquitous language dictionary from a domain
2743
3054
  * @param id - The id of the domain to get the ubiquitous language from
2744
3055
  * @param version - Optional version of the domain to get the ubiquitous language from
2745
3056
  * @returns
2746
3057
  */
2747
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join18(path7, "domains")),
3058
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join18(path8, "domains")),
2748
3059
  /**
2749
3060
  * Check to see if a domain version exists
2750
3061
  * @param id - The id of the domain
2751
3062
  * @param version - The version of the domain (supports semver)
2752
3063
  * @returns
2753
3064
  */
2754
- domainHasVersion: domainHasVersion(join18(path7)),
3065
+ domainHasVersion: domainHasVersion(join18(path8)),
2755
3066
  /**
2756
3067
  * Adds a given service to a domain
2757
3068
  * @param id - The id of the domain
@@ -2759,7 +3070,7 @@ var src_default = (path7) => {
2759
3070
  * @param version - (Optional) The version of the domain to add the service to
2760
3071
  * @returns
2761
3072
  */
2762
- addServiceToDomain: addServiceToDomain(join18(path7, "domains")),
3073
+ addServiceToDomain: addServiceToDomain(join18(path8, "domains")),
2763
3074
  /**
2764
3075
  * Adds a given subdomain to a domain
2765
3076
  * @param id - The id of the domain
@@ -2767,7 +3078,7 @@ var src_default = (path7) => {
2767
3078
  * @param version - (Optional) The version of the domain to add the subdomain to
2768
3079
  * @returns
2769
3080
  */
2770
- addSubDomainToDomain: addSubDomainToDomain(join18(path7, "domains")),
3081
+ addSubDomainToDomain: addSubDomainToDomain(join18(path8, "domains")),
2771
3082
  /**
2772
3083
  * Adds an entity to a domain
2773
3084
  * @param id - The id of the domain
@@ -2775,7 +3086,7 @@ var src_default = (path7) => {
2775
3086
  * @param version - (Optional) The version of the domain to add the entity to
2776
3087
  * @returns
2777
3088
  */
2778
- addEntityToDomain: addEntityToDomain(join18(path7, "domains")),
3089
+ addEntityToDomain: addEntityToDomain(join18(path8, "domains")),
2779
3090
  /**
2780
3091
  * Add an event to a domain by its id.
2781
3092
  *
@@ -2793,7 +3104,7 @@ var src_default = (path7) => {
2793
3104
  *
2794
3105
  * ```
2795
3106
  */
2796
- addEventToDomain: addMessageToDomain(join18(path7, "domains")),
3107
+ addEventToDomain: addMessageToDomain(join18(path8, "domains")),
2797
3108
  /**
2798
3109
  * Add a command to a domain by its id.
2799
3110
  *
@@ -2811,7 +3122,7 @@ var src_default = (path7) => {
2811
3122
  *
2812
3123
  * ```
2813
3124
  */
2814
- addCommandToDomain: addMessageToDomain(join18(path7, "domains")),
3125
+ addCommandToDomain: addMessageToDomain(join18(path8, "domains")),
2815
3126
  /**
2816
3127
  * Add a query to a domain by its id.
2817
3128
  *
@@ -2829,7 +3140,7 @@ var src_default = (path7) => {
2829
3140
  *
2830
3141
  * ```
2831
3142
  */
2832
- addQueryToDomain: addMessageToDomain(join18(path7, "domains")),
3143
+ addQueryToDomain: addMessageToDomain(join18(path8, "domains")),
2833
3144
  /**
2834
3145
  * ================================
2835
3146
  * Teams
@@ -2842,25 +3153,25 @@ var src_default = (path7) => {
2842
3153
  * @param options - Optional options to write the team
2843
3154
  *
2844
3155
  */
2845
- writeTeam: writeTeam(join18(path7, "teams")),
3156
+ writeTeam: writeTeam(join18(path8, "teams")),
2846
3157
  /**
2847
3158
  * Returns a team from EventCatalog
2848
3159
  * @param id - The id of the team to retrieve
2849
3160
  * @returns Team|Undefined
2850
3161
  */
2851
- getTeam: getTeam(join18(path7, "teams")),
3162
+ getTeam: getTeam(join18(path8, "teams")),
2852
3163
  /**
2853
3164
  * Returns all teams from EventCatalog
2854
3165
  * @returns Team[]|Undefined
2855
3166
  */
2856
- getTeams: getTeams(join18(path7, "teams")),
3167
+ getTeams: getTeams(join18(path8, "teams")),
2857
3168
  /**
2858
3169
  * Remove a team by the team id
2859
3170
  *
2860
3171
  * @param id - The id of the team you want to remove
2861
3172
  *
2862
3173
  */
2863
- rmTeamById: rmTeamById(join18(path7, "teams")),
3174
+ rmTeamById: rmTeamById(join18(path8, "teams")),
2864
3175
  /**
2865
3176
  * ================================
2866
3177
  * Users
@@ -2873,25 +3184,25 @@ var src_default = (path7) => {
2873
3184
  * @param options - Optional options to write the user
2874
3185
  *
2875
3186
  */
2876
- writeUser: writeUser(join18(path7, "users")),
3187
+ writeUser: writeUser(join18(path8, "users")),
2877
3188
  /**
2878
3189
  * Returns a user from EventCatalog
2879
3190
  * @param id - The id of the user to retrieve
2880
3191
  * @returns User|Undefined
2881
3192
  */
2882
- getUser: getUser(join18(path7, "users")),
3193
+ getUser: getUser(join18(path8, "users")),
2883
3194
  /**
2884
3195
  * Returns all user from EventCatalog
2885
3196
  * @returns User[]|Undefined
2886
3197
  */
2887
- getUsers: getUsers(join18(path7)),
3198
+ getUsers: getUsers(join18(path8)),
2888
3199
  /**
2889
3200
  * Remove a user by the user id
2890
3201
  *
2891
3202
  * @param id - The id of the user you want to remove
2892
3203
  *
2893
3204
  */
2894
- rmUserById: rmUserById(join18(path7, "users")),
3205
+ rmUserById: rmUserById(join18(path8, "users")),
2895
3206
  /**
2896
3207
  * ================================
2897
3208
  * Custom Docs
@@ -2902,32 +3213,32 @@ var src_default = (path7) => {
2902
3213
  * @param path - The path to the custom doc to retrieve
2903
3214
  * @returns CustomDoc|Undefined
2904
3215
  */
2905
- getCustomDoc: getCustomDoc(join18(path7, "docs")),
3216
+ getCustomDoc: getCustomDoc(join18(path8, "docs")),
2906
3217
  /**
2907
3218
  * Returns all custom docs from EventCatalog
2908
3219
  * @param options - Optional options to get custom docs from a specific path
2909
3220
  * @returns CustomDoc[]|Undefined
2910
3221
  */
2911
- getCustomDocs: getCustomDocs(join18(path7, "docs")),
3222
+ getCustomDocs: getCustomDocs(join18(path8, "docs")),
2912
3223
  /**
2913
3224
  * Writes a custom doc to EventCatalog
2914
3225
  * @param customDoc - The custom doc to write
2915
3226
  * @param options - Optional options to write the custom doc
2916
3227
  *
2917
3228
  */
2918
- writeCustomDoc: writeCustomDoc(join18(path7, "docs")),
3229
+ writeCustomDoc: writeCustomDoc(join18(path8, "docs")),
2919
3230
  /**
2920
3231
  * Removes a custom doc from EventCatalog
2921
3232
  * @param path - The path to the custom doc to remove
2922
3233
  *
2923
3234
  */
2924
- rmCustomDoc: rmCustomDoc(join18(path7, "docs")),
3235
+ rmCustomDoc: rmCustomDoc(join18(path8, "docs")),
2925
3236
  /**
2926
3237
  * Dumps the catalog to a JSON file.
2927
3238
  * @param directory - The directory to dump the catalog to
2928
3239
  * @returns A JSON file with the catalog
2929
3240
  */
2930
- dumpCatalog: dumpCatalog(join18(path7)),
3241
+ dumpCatalog: dumpCatalog(join18(path8)),
2931
3242
  /**
2932
3243
  * Returns the event catalog configuration file.
2933
3244
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2935,7 +3246,7 @@ var src_default = (path7) => {
2935
3246
  * @param directory - The directory of the catalog.
2936
3247
  * @returns A JSON object with the configuration for the event catalog.
2937
3248
  */
2938
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join18(path7)),
3249
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join18(path8)),
2939
3250
  /**
2940
3251
  * ================================
2941
3252
  * Changelogs
@@ -2949,7 +3260,7 @@ var src_default = (path7) => {
2949
3260
  * @param options - Optional options (version, format)
2950
3261
  *
2951
3262
  */
2952
- writeChangelog: writeChangelog(join18(path7)),
3263
+ writeChangelog: writeChangelog(join18(path8)),
2953
3264
  /**
2954
3265
  * Appends a changelog entry to an existing changelog for a resource.
2955
3266
  * If no changelog exists, one is created.
@@ -2959,7 +3270,7 @@ var src_default = (path7) => {
2959
3270
  * @param options - Optional options (version, format)
2960
3271
  *
2961
3272
  */
2962
- appendChangelog: appendChangelog(join18(path7)),
3273
+ appendChangelog: appendChangelog(join18(path8)),
2963
3274
  /**
2964
3275
  * Returns the changelog for a resource in EventCatalog
2965
3276
  *
@@ -2967,7 +3278,7 @@ var src_default = (path7) => {
2967
3278
  * @param options - Optional options (version)
2968
3279
  * @returns Changelog|Undefined
2969
3280
  */
2970
- getChangelog: getChangelog(join18(path7)),
3281
+ getChangelog: getChangelog(join18(path8)),
2971
3282
  /**
2972
3283
  * Removes the changelog for a resource in EventCatalog
2973
3284
  *
@@ -2975,7 +3286,7 @@ var src_default = (path7) => {
2975
3286
  * @param options - Optional options (version)
2976
3287
  *
2977
3288
  */
2978
- rmChangelog: rmChangelog(join18(path7)),
3289
+ rmChangelog: rmChangelog(join18(path8)),
2979
3290
  /**
2980
3291
  * ================================
2981
3292
  * Resources Utils
@@ -3000,33 +3311,33 @@ var src_default = (path7) => {
3000
3311
  * @param path - The path to the message to retrieve
3001
3312
  * @returns Message|Undefined
3002
3313
  */
3003
- getMessageBySchemaPath: getMessageBySchemaPath(join18(path7)),
3314
+ getMessageBySchemaPath: getMessageBySchemaPath(join18(path8)),
3004
3315
  /**
3005
3316
  * Returns the producers and consumers (services) for a given message
3006
3317
  * @param id - The id of the message to get the producers and consumers for
3007
3318
  * @param version - Optional version of the message
3008
3319
  * @returns { producers: Service[], consumers: Service[] }
3009
3320
  */
3010
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join18(path7)),
3321
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join18(path8)),
3011
3322
  /**
3012
3323
  * Returns the consumers of a given schema path
3013
3324
  * @param path - The path to the schema to get the consumers for
3014
3325
  * @returns Service[]
3015
3326
  */
3016
- getConsumersOfSchema: getConsumersOfSchema(join18(path7)),
3327
+ getConsumersOfSchema: getConsumersOfSchema(join18(path8)),
3017
3328
  /**
3018
3329
  * Returns the producers of a given schema path
3019
3330
  * @param path - The path to the schema to get the producers for
3020
3331
  * @returns Service[]
3021
3332
  */
3022
- getProducersOfSchema: getProducersOfSchema(join18(path7)),
3333
+ getProducersOfSchema: getProducersOfSchema(join18(path8)),
3023
3334
  /**
3024
3335
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
3025
3336
  * @param id - The id of the resource to get the owners for
3026
3337
  * @param version - Optional version of the resource
3027
3338
  * @returns { owners: User[] }
3028
3339
  */
3029
- getOwnersForResource: getOwnersForResource(join18(path7)),
3340
+ getOwnersForResource: getOwnersForResource(join18(path8)),
3030
3341
  /**
3031
3342
  * ================================
3032
3343
  * Entities
@@ -3038,13 +3349,13 @@ var src_default = (path7) => {
3038
3349
  * @param version - Optional id of the version to get (supports semver)
3039
3350
  * @returns Entity|Undefined
3040
3351
  */
3041
- getEntity: getEntity(join18(path7)),
3352
+ getEntity: getEntity(join18(path8)),
3042
3353
  /**
3043
3354
  * Returns all entities from EventCatalog
3044
3355
  * @param latestOnly - optional boolean, set to true to get only latest versions
3045
3356
  * @returns Entity[]|Undefined
3046
3357
  */
3047
- getEntities: getEntities(join18(path7)),
3358
+ getEntities: getEntities(join18(path8)),
3048
3359
  /**
3049
3360
  * Adds an entity to EventCatalog
3050
3361
  *
@@ -3052,33 +3363,33 @@ var src_default = (path7) => {
3052
3363
  * @param options - Optional options to write the entity
3053
3364
  *
3054
3365
  */
3055
- writeEntity: writeEntity(join18(path7, "entities")),
3366
+ writeEntity: writeEntity(join18(path8, "entities")),
3056
3367
  /**
3057
3368
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
3058
3369
  *
3059
3370
  * @param path - The path to your entity, e.g. `/User`
3060
3371
  *
3061
3372
  */
3062
- rmEntity: rmEntity(join18(path7, "entities")),
3373
+ rmEntity: rmEntity(join18(path8, "entities")),
3063
3374
  /**
3064
3375
  * Remove an entity by an entity id
3065
3376
  *
3066
3377
  * @param id - The id of the entity you want to remove
3067
3378
  *
3068
3379
  */
3069
- rmEntityById: rmEntityById(join18(path7)),
3380
+ rmEntityById: rmEntityById(join18(path8)),
3070
3381
  /**
3071
3382
  * Moves a given entity id to the version directory
3072
3383
  * @param id - The id of the entity to version
3073
3384
  */
3074
- versionEntity: versionEntity(join18(path7)),
3385
+ versionEntity: versionEntity(join18(path8)),
3075
3386
  /**
3076
3387
  * Check to see if an entity version exists
3077
3388
  * @param id - The id of the entity
3078
3389
  * @param version - The version of the entity (supports semver)
3079
3390
  * @returns
3080
3391
  */
3081
- entityHasVersion: entityHasVersion(join18(path7)),
3392
+ entityHasVersion: entityHasVersion(join18(path8)),
3082
3393
  /**
3083
3394
  * ================================
3084
3395
  * Data Stores
@@ -3090,42 +3401,42 @@ var src_default = (path7) => {
3090
3401
  * @param options - Optional options to write the data store
3091
3402
  *
3092
3403
  */
3093
- writeDataStore: writeDataStore(join18(path7, "containers")),
3404
+ writeDataStore: writeDataStore(join18(path8, "containers")),
3094
3405
  /**
3095
3406
  * Returns a data store from EventCatalog
3096
3407
  * @param id - The id of the data store to retrieve
3097
3408
  * @param version - Optional id of the version to get (supports semver)
3098
3409
  * @returns Container|Undefined
3099
3410
  */
3100
- getDataStore: getDataStore(join18(path7)),
3411
+ getDataStore: getDataStore(join18(path8)),
3101
3412
  /**
3102
3413
  * Returns all data stores from EventCatalog
3103
3414
  * @param latestOnly - optional boolean, set to true to get only latest versions
3104
3415
  * @returns Container[]|Undefined
3105
3416
  */
3106
- getDataStores: getDataStores(join18(path7)),
3417
+ getDataStores: getDataStores(join18(path8)),
3107
3418
  /**
3108
3419
  * Version a data store by its id
3109
3420
  * @param id - The id of the data store to version
3110
3421
  */
3111
- versionDataStore: versionDataStore(join18(path7, "containers")),
3422
+ versionDataStore: versionDataStore(join18(path8, "containers")),
3112
3423
  /**
3113
3424
  * Remove a data store by its path
3114
3425
  * @param path - The path to the data store to remove
3115
3426
  */
3116
- rmDataStore: rmDataStore(join18(path7, "containers")),
3427
+ rmDataStore: rmDataStore(join18(path8, "containers")),
3117
3428
  /**
3118
3429
  * Remove a data store by its id
3119
3430
  * @param id - The id of the data store to remove
3120
3431
  */
3121
- rmDataStoreById: rmDataStoreById(join18(path7)),
3432
+ rmDataStoreById: rmDataStoreById(join18(path8)),
3122
3433
  /**
3123
3434
  * Check to see if a data store version exists
3124
3435
  * @param id - The id of the data store
3125
3436
  * @param version - The version of the data store (supports semver)
3126
3437
  * @returns
3127
3438
  */
3128
- dataStoreHasVersion: dataStoreHasVersion(join18(path7)),
3439
+ dataStoreHasVersion: dataStoreHasVersion(join18(path8)),
3129
3440
  /**
3130
3441
  * Adds a file to a data store by its id
3131
3442
  * @param id - The id of the data store to add the file to
@@ -3133,14 +3444,14 @@ var src_default = (path7) => {
3133
3444
  * @param version - Optional version of the data store to add the file to
3134
3445
  * @returns
3135
3446
  */
3136
- addFileToDataStore: addFileToDataStore(join18(path7)),
3447
+ addFileToDataStore: addFileToDataStore(join18(path8)),
3137
3448
  /**
3138
3449
  * Writes a data store to a service by its id
3139
3450
  * @param dataStore - The data store to write
3140
3451
  * @param service - The service to write the data store to
3141
3452
  * @returns
3142
3453
  */
3143
- writeDataStoreToService: writeDataStoreToService(join18(path7)),
3454
+ writeDataStoreToService: writeDataStoreToService(join18(path8)),
3144
3455
  /**
3145
3456
  * ================================
3146
3457
  * Data Products
@@ -3152,7 +3463,7 @@ var src_default = (path7) => {
3152
3463
  * @param options - Optional options to write the data product
3153
3464
  *
3154
3465
  */
3155
- writeDataProduct: writeDataProduct(join18(path7, "data-products")),
3466
+ writeDataProduct: writeDataProduct(join18(path8, "data-products")),
3156
3467
  /**
3157
3468
  * Writes a data product to a domain in EventCatalog
3158
3469
  * @param dataProduct - The data product to write
@@ -3160,43 +3471,43 @@ var src_default = (path7) => {
3160
3471
  * @param options - Optional options to write the data product
3161
3472
  *
3162
3473
  */
3163
- writeDataProductToDomain: writeDataProductToDomain(join18(path7, "domains")),
3474
+ writeDataProductToDomain: writeDataProductToDomain(join18(path8, "domains")),
3164
3475
  /**
3165
3476
  * Returns a data product from EventCatalog
3166
3477
  * @param id - The id of the data product to retrieve
3167
3478
  * @param version - Optional id of the version to get (supports semver)
3168
3479
  * @returns DataProduct|Undefined
3169
3480
  */
3170
- getDataProduct: getDataProduct(join18(path7)),
3481
+ getDataProduct: getDataProduct(join18(path8)),
3171
3482
  /**
3172
3483
  * Returns all data products from EventCatalog
3173
3484
  * @param latestOnly - optional boolean, set to true to get only latest versions
3174
3485
  * @returns DataProduct[]|Undefined
3175
3486
  */
3176
- getDataProducts: getDataProducts(join18(path7)),
3487
+ getDataProducts: getDataProducts(join18(path8)),
3177
3488
  /**
3178
3489
  * Version a data product by its id
3179
3490
  * @param id - The id of the data product to version
3180
3491
  */
3181
- versionDataProduct: versionDataProduct(join18(path7)),
3492
+ versionDataProduct: versionDataProduct(join18(path8)),
3182
3493
  /**
3183
3494
  * Remove a data product by its path
3184
3495
  * @param path - The path to the data product to remove
3185
3496
  */
3186
- rmDataProduct: rmDataProduct(join18(path7, "data-products")),
3497
+ rmDataProduct: rmDataProduct(join18(path8, "data-products")),
3187
3498
  /**
3188
3499
  * Remove a data product by its id
3189
3500
  * @param id - The id of the data product to remove
3190
3501
  * @param version - Optional version of the data product to remove
3191
3502
  */
3192
- rmDataProductById: rmDataProductById(join18(path7)),
3503
+ rmDataProductById: rmDataProductById(join18(path8)),
3193
3504
  /**
3194
3505
  * Check to see if a data product version exists
3195
3506
  * @param id - The id of the data product
3196
3507
  * @param version - The version of the data product (supports semver)
3197
3508
  * @returns
3198
3509
  */
3199
- dataProductHasVersion: dataProductHasVersion(join18(path7)),
3510
+ dataProductHasVersion: dataProductHasVersion(join18(path8)),
3200
3511
  /**
3201
3512
  * Adds a file to a data product by its id
3202
3513
  * @param id - The id of the data product to add the file to
@@ -3204,7 +3515,7 @@ var src_default = (path7) => {
3204
3515
  * @param version - Optional version of the data product to add the file to
3205
3516
  * @returns
3206
3517
  */
3207
- addFileToDataProduct: addFileToDataProduct(join18(path7)),
3518
+ addFileToDataProduct: addFileToDataProduct(join18(path8)),
3208
3519
  /**
3209
3520
  * Adds a data product to a domain
3210
3521
  * @param id - The id of the domain
@@ -3212,7 +3523,7 @@ var src_default = (path7) => {
3212
3523
  * @param version - (Optional) The version of the domain to add the data product to
3213
3524
  * @returns
3214
3525
  */
3215
- addDataProductToDomain: addDataProductToDomain(join18(path7, "domains")),
3526
+ addDataProductToDomain: addDataProductToDomain(join18(path8, "domains")),
3216
3527
  /**
3217
3528
  * ================================
3218
3529
  * Diagrams
@@ -3224,13 +3535,13 @@ var src_default = (path7) => {
3224
3535
  * @param version - Optional id of the version to get (supports semver)
3225
3536
  * @returns Diagram|Undefined
3226
3537
  */
3227
- getDiagram: getDiagram(join18(path7)),
3538
+ getDiagram: getDiagram(join18(path8)),
3228
3539
  /**
3229
3540
  * Returns all diagrams from EventCatalog
3230
3541
  * @param latestOnly - optional boolean, set to true to get only latest versions
3231
3542
  * @returns Diagram[]|Undefined
3232
3543
  */
3233
- getDiagrams: getDiagrams(join18(path7)),
3544
+ getDiagrams: getDiagrams(join18(path8)),
3234
3545
  /**
3235
3546
  * Adds a diagram to EventCatalog
3236
3547
  *
@@ -3238,33 +3549,33 @@ var src_default = (path7) => {
3238
3549
  * @param options - Optional options to write the diagram
3239
3550
  *
3240
3551
  */
3241
- writeDiagram: writeDiagram(join18(path7, "diagrams")),
3552
+ writeDiagram: writeDiagram(join18(path8, "diagrams")),
3242
3553
  /**
3243
3554
  * Remove a diagram from EventCatalog (modeled on the standard POSIX rm utility)
3244
3555
  *
3245
3556
  * @param path - The path to your diagram, e.g. `/ArchitectureDiagram`
3246
3557
  *
3247
3558
  */
3248
- rmDiagram: rmDiagram(join18(path7, "diagrams")),
3559
+ rmDiagram: rmDiagram(join18(path8, "diagrams")),
3249
3560
  /**
3250
3561
  * Remove a diagram by a diagram id
3251
3562
  *
3252
3563
  * @param id - The id of the diagram you want to remove
3253
3564
  *
3254
3565
  */
3255
- rmDiagramById: rmDiagramById(join18(path7)),
3566
+ rmDiagramById: rmDiagramById(join18(path8)),
3256
3567
  /**
3257
3568
  * Moves a given diagram id to the version directory
3258
3569
  * @param id - The id of the diagram to version
3259
3570
  */
3260
- versionDiagram: versionDiagram(join18(path7)),
3571
+ versionDiagram: versionDiagram(join18(path8)),
3261
3572
  /**
3262
3573
  * Check to see if a diagram version exists
3263
3574
  * @param id - The id of the diagram
3264
3575
  * @param version - The version of the diagram (supports semver)
3265
3576
  * @returns
3266
3577
  */
3267
- diagramHasVersion: diagramHasVersion(join18(path7)),
3578
+ diagramHasVersion: diagramHasVersion(join18(path8)),
3268
3579
  /**
3269
3580
  * Adds a file to the given diagram
3270
3581
  * @param id - The id of the diagram to add the file to
@@ -3272,7 +3583,7 @@ var src_default = (path7) => {
3272
3583
  * @param version - Optional version of the diagram to add the file to
3273
3584
  * @returns
3274
3585
  */
3275
- addFileToDiagram: addFileToDiagram(join18(path7)),
3586
+ addFileToDiagram: addFileToDiagram(join18(path8)),
3276
3587
  /**
3277
3588
  * ================================
3278
3589
  * DSL
@@ -3291,18 +3602,21 @@ var src_default = (path7) => {
3291
3602
  * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
3292
3603
  * ```
3293
3604
  */
3294
- toDSL: toDSL(join18(path7), {
3295
- getEvent: getEvent(join18(path7)),
3296
- getCommand: getCommand(join18(path7)),
3297
- getQuery: getQuery(join18(path7)),
3298
- getService: getService(join18(path7)),
3299
- getServices: getServices(join18(path7)),
3300
- getDomain: getDomain(join18(path7, "domains")),
3301
- getChannel: getChannel(join18(path7)),
3302
- getChannels: getChannels(join18(path7)),
3303
- getContainer: getDataStore(join18(path7)),
3304
- getTeam: getTeam(join18(path7, "teams")),
3305
- getUser: getUser(join18(path7, "users"))
3605
+ createSnapshot: createSnapshot(join18(path8)),
3606
+ diffSnapshots: diffSnapshots(join18(path8)),
3607
+ listSnapshots: listSnapshots(join18(path8)),
3608
+ toDSL: toDSL(join18(path8), {
3609
+ getEvent: getEvent(join18(path8)),
3610
+ getCommand: getCommand(join18(path8)),
3611
+ getQuery: getQuery(join18(path8)),
3612
+ getService: getService(join18(path8)),
3613
+ getServices: getServices(join18(path8)),
3614
+ getDomain: getDomain(join18(path8, "domains")),
3615
+ getChannel: getChannel(join18(path8)),
3616
+ getChannels: getChannels(join18(path8)),
3617
+ getContainer: getDataStore(join18(path8)),
3618
+ getTeam: getTeam(join18(path8, "teams")),
3619
+ getUser: getUser(join18(path8, "users"))
3306
3620
  })
3307
3621
  };
3308
3622
  };