@eventcatalog/sdk 2.26.3 → 2.27.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.js CHANGED
@@ -30,11 +30,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ FederationIndexSchema: () => FederationIndexSchema,
33
34
  FlowBuilder: () => FlowBuilder,
34
- default: () => src_default
35
+ InvalidIndexError: () => InvalidIndexError,
36
+ default: () => src_default,
37
+ hydrate: () => hydrate,
38
+ parseIndex: () => parseIndex,
39
+ resolve: () => resolve2
35
40
  });
36
41
  module.exports = __toCommonJS(src_exports);
37
- var import_node_path27 = require("path");
42
+ var import_node_path29 = require("path");
38
43
 
39
44
  // src/dsl/utils.ts
40
45
  var import_glob = require("glob");
@@ -144,11 +149,11 @@ ${body}
144
149
  // src/dsl/service.ts
145
150
  var import_semver2 = require("semver");
146
151
  async function serviceToDSL(resource, options, getMessageFn) {
147
- const { catalogDir, hydrate = false, _seen = /* @__PURE__ */ new Set() } = options;
152
+ const { catalogDir, hydrate: hydrate2 = false, _seen = /* @__PURE__ */ new Set() } = options;
148
153
  const msgIndex = options._msgIndex || buildMessageTypeIndex(catalogDir);
149
154
  const parts = [];
150
155
  const resolvedVersions = /* @__PURE__ */ new Map();
151
- if (hydrate && getMessageFn) {
156
+ if (hydrate2 && getMessageFn) {
152
157
  const allMessages = [...resource.sends || [], ...resource.receives || []];
153
158
  for (const msg of allMessages) {
154
159
  const key = `${msg.id}@${msg.version || "latest"}`;
@@ -301,10 +306,10 @@ async function hydrateChannelsFromMessages(messages, resolvers, seen, parts) {
301
306
  }
302
307
  }
303
308
  async function buildDomainBody(resource, options, resolvers, keyword) {
304
- const { catalogDir, hydrate = false, _seen = /* @__PURE__ */ new Set() } = options;
309
+ const { catalogDir, hydrate: hydrate2 = false, _seen = /* @__PURE__ */ new Set() } = options;
305
310
  const msgIndex = options._msgIndex || buildMessageTypeIndex(catalogDir);
306
311
  const topLevelParts = [];
307
- if (hydrate && resolvers) {
312
+ if (hydrate2 && resolvers) {
308
313
  if (resource.services && resource.services.length > 0 && resolvers.getService) {
309
314
  for (const svcRef of resource.services) {
310
315
  const svcKey = `service:${svcRef.id}@${svcRef.version || "latest"}`;
@@ -355,7 +360,7 @@ async function buildDomainBody(resource, options, resolvers, keyword) {
355
360
  if (recvStr) lines.push(recvStr);
356
361
  }
357
362
  if (resource.domains && resource.domains.length > 0) {
358
- if (hydrate && resolvers?.getDomain) {
363
+ if (hydrate2 && resolvers?.getDomain) {
359
364
  for (const subRef of resource.domains) {
360
365
  const subKey = `domain:${subRef.id}@${subRef.version || "latest"}`;
361
366
  if (_seen.has(subKey)) continue;
@@ -365,7 +370,7 @@ async function buildDomainBody(resource, options, resolvers, keyword) {
365
370
  await hydrateOwners(subDomain.owners, resolvers, _seen, topLevelParts);
366
371
  const sub = await buildDomainBody(
367
372
  subDomain,
368
- { catalogDir, hydrate, _seen, _msgIndex: msgIndex },
373
+ { catalogDir, hydrate: hydrate2, _seen, _msgIndex: msgIndex },
369
374
  resolvers,
370
375
  "subdomain"
371
376
  );
@@ -389,9 +394,9 @@ ${body}
389
394
  return { topLevelParts, block };
390
395
  }
391
396
  async function domainToDSL(resource, options, resolvers) {
392
- const { catalogDir, hydrate = false, _seen = /* @__PURE__ */ new Set() } = options;
397
+ const { catalogDir, hydrate: hydrate2 = false, _seen = /* @__PURE__ */ new Set() } = options;
393
398
  const msgIndex = options._msgIndex || buildMessageTypeIndex(catalogDir);
394
- const result = await buildDomainBody(resource, { catalogDir, hydrate, _seen, _msgIndex: msgIndex }, resolvers, "domain");
399
+ const result = await buildDomainBody(resource, { catalogDir, hydrate: hydrate2, _seen, _msgIndex: msgIndex }, resolvers, "domain");
395
400
  const parts = [...result.topLevelParts, result.block];
396
401
  return parts.join("\n\n");
397
402
  }
@@ -803,7 +808,7 @@ var findFileById = async (catalogDir, id, version) => {
803
808
  }
804
809
  return void 0;
805
810
  };
806
- var getFiles = async (pattern, ignore = "") => {
811
+ var getFiles = async (pattern, ignore2 = "") => {
807
812
  try {
808
813
  const normalizedInputPattern = (0, import_node_path.normalize)(pattern);
809
814
  const absoluteBaseDir = (0, import_node_path.resolve)(
@@ -811,7 +816,7 @@ var getFiles = async (pattern, ignore = "") => {
811
816
  );
812
817
  let relativePattern = (0, import_node_path.relative)(absoluteBaseDir, normalizedInputPattern);
813
818
  relativePattern = relativePattern.replace(/\\/g, "/");
814
- const ignoreList = Array.isArray(ignore) ? ignore : [ignore];
819
+ const ignoreList = Array.isArray(ignore2) ? ignore2 : [ignore2];
815
820
  const files = (0, import_glob2.globSync)(relativePattern, {
816
821
  cwd: absoluteBaseDir,
817
822
  ignore: ["node_modules/**", ...ignoreList],
@@ -829,8 +834,8 @@ var getFiles = async (pattern, ignore = "") => {
829
834
  );
830
835
  }
831
836
  };
832
- var readMdxFile = async (path9) => {
833
- const { data } = import_gray_matter.default.read(path9);
837
+ var readMdxFile = async (path11) => {
838
+ const { data } = import_gray_matter.default.read(path11);
834
839
  const { markdown, ...frontmatter } = data;
835
840
  return { ...frontmatter, markdown };
836
841
  };
@@ -936,8 +941,8 @@ var writeResource = async (catalogDir, resource, options = {
936
941
  versionExistingContent: false,
937
942
  format: "mdx"
938
943
  }) => {
939
- const path9 = options.path || `/${resource.id}`;
940
- const fullPath = (0, import_path.join)(catalogDir, path9);
944
+ const path11 = options.path || `/${resource.id}`;
945
+ const fullPath = (0, import_path.join)(catalogDir, path11);
941
946
  const format = options.format || "mdx";
942
947
  import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
943
948
  const lockPath = (0, import_path.join)(fullPath, `index.${format}`);
@@ -1019,13 +1024,13 @@ var toResource = async (catalogDir, rawContents) => {
1019
1024
  var getResources = async (catalogDir, {
1020
1025
  type,
1021
1026
  latestOnly = false,
1022
- ignore = [],
1027
+ ignore: ignore2 = [],
1023
1028
  pattern = "",
1024
1029
  attachSchema = false
1025
1030
  }) => {
1026
1031
  const ignoreList = latestOnly ? `**/versioned/**` : "";
1027
1032
  const filePattern = pattern || `${catalogDir}/**/${type}/**/index.{md,mdx}`;
1028
- const files = await getFiles(filePattern, [ignoreList, ...ignore]);
1033
+ const files = await getFiles(filePattern, [ignoreList, ...ignore2]);
1029
1034
  if (files.length === 0) return;
1030
1035
  return files.map((file) => {
1031
1036
  const { data, content } = cachedMatterRead(file);
@@ -1071,16 +1076,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
1071
1076
  }
1072
1077
  invalidateFileCache();
1073
1078
  };
1074
- var waitForFileRemoval = async (path9, maxRetries = 50, delay = 10) => {
1079
+ var waitForFileRemoval = async (path11, maxRetries = 50, delay = 10) => {
1075
1080
  for (let i = 0; i < maxRetries; i++) {
1076
1081
  try {
1077
- await import_promises.default.access(path9);
1078
- await new Promise((resolve2) => setTimeout(resolve2, delay));
1082
+ await import_promises.default.access(path11);
1083
+ await new Promise((resolve3) => setTimeout(resolve3, delay));
1079
1084
  } catch (error) {
1080
1085
  return;
1081
1086
  }
1082
1087
  }
1083
- throw new Error(`File/directory ${path9} was not removed after ${maxRetries} attempts`);
1088
+ throw new Error(`File/directory ${path11} was not removed after ${maxRetries} attempts`);
1084
1089
  };
1085
1090
  var addFileToResource = async (catalogDir, id, file, version, options) => {
1086
1091
  let pathToResource;
@@ -1191,8 +1196,8 @@ var writeEventToAgent = (directory) => async (event, agent, options = { path: ""
1191
1196
  pathForEvent = (0, import_node_path4.join)(pathForEvent, event.id);
1192
1197
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
1193
1198
  };
1194
- var rmEvent = (directory) => async (path9) => {
1195
- await import_promises2.default.rm((0, import_node_path4.join)(directory, path9), { recursive: true });
1199
+ var rmEvent = (directory) => async (path11) => {
1200
+ await import_promises2.default.rm((0, import_node_path4.join)(directory, path11), { recursive: true });
1196
1201
  invalidateFileCache();
1197
1202
  };
1198
1203
  var rmEventById = (directory) => async (id, version, persistFiles) => {
@@ -1240,8 +1245,8 @@ var writeCommandToAgent = (directory) => async (command, agent, options = { path
1240
1245
  pathForCommand = (0, import_node_path5.join)(pathForCommand, command.id);
1241
1246
  await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
1242
1247
  };
1243
- var rmCommand = (directory) => async (path9) => {
1244
- await import_promises3.default.rm((0, import_node_path5.join)(directory, path9), { recursive: true });
1248
+ var rmCommand = (directory) => async (path11) => {
1249
+ await import_promises3.default.rm((0, import_node_path5.join)(directory, path11), { recursive: true });
1245
1250
  invalidateFileCache();
1246
1251
  };
1247
1252
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
@@ -1287,8 +1292,8 @@ var writeQueryToAgent = (directory) => async (query, agent, options = { path: ""
1287
1292
  pathForQuery = (0, import_node_path6.join)(pathForQuery, query.id);
1288
1293
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
1289
1294
  };
1290
- var rmQuery = (directory) => async (path9) => {
1291
- await import_promises4.default.rm((0, import_node_path6.join)(directory, path9), { recursive: true });
1295
+ var rmQuery = (directory) => async (path11) => {
1296
+ await import_promises4.default.rm((0, import_node_path6.join)(directory, path11), { recursive: true });
1292
1297
  invalidateFileCache();
1293
1298
  };
1294
1299
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
@@ -1311,8 +1316,8 @@ var removeExampleFromQuery = (directory) => async (id, fileName, version) => rem
1311
1316
  var import_promises5 = __toESM(require("fs/promises"));
1312
1317
  var import_node_path7 = require("path");
1313
1318
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
1314
- var getServiceByPath = (directory) => async (path9) => {
1315
- const service = await getResource(directory, void 0, void 0, { type: "service" }, path9);
1319
+ var getServiceByPath = (directory) => async (path11) => {
1320
+ const service = await getResource(directory, void 0, void 0, { type: "service" }, path11);
1316
1321
  return service;
1317
1322
  };
1318
1323
  var getServices = (directory) => async (options) => getResources(directory, {
@@ -1347,8 +1352,8 @@ var writeService = (directory) => async (service, options = {
1347
1352
  };
1348
1353
  var writeVersionedService = (directory) => async (service) => {
1349
1354
  const resource = { ...service };
1350
- const path9 = getVersionedDirectory(service.id, service.version);
1351
- return await writeService(directory)(resource, { path: path9 });
1355
+ const path11 = getVersionedDirectory(service.id, service.version);
1356
+ return await writeService(directory)(resource, { path: path11 });
1352
1357
  };
1353
1358
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
1354
1359
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -1364,8 +1369,8 @@ var writeServiceToSystem = (directory) => async (service, system, options = { pa
1364
1369
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
1365
1370
  };
1366
1371
  var versionService = (directory) => async (id) => versionResource(directory, id);
1367
- var rmService = (directory) => async (path9) => {
1368
- await import_promises5.default.rm((0, import_node_path7.join)(directory, path9), { recursive: true });
1372
+ var rmService = (directory) => async (path11) => {
1373
+ await import_promises5.default.rm((0, import_node_path7.join)(directory, path11), { recursive: true });
1369
1374
  invalidateFileCache();
1370
1375
  };
1371
1376
  var rmServiceById = (directory) => async (id, version, persistFiles) => {
@@ -1430,8 +1435,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
1430
1435
  if (!existingResource) {
1431
1436
  throw new Error(`Cannot find service ${id} in the catalog`);
1432
1437
  }
1433
- const path9 = existingResource.split(/[\\/]+services/)[0];
1434
- const pathToResource = (0, import_node_path7.join)(path9, "services");
1438
+ const path11 = existingResource.split(/[\\/]+services/)[0];
1439
+ const pathToResource = (0, import_node_path7.join)(path11, "services");
1435
1440
  await rmServiceById(directory)(id, version, true);
1436
1441
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1437
1442
  };
@@ -1439,9 +1444,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
1439
1444
  const file = await findFileById(directory, id, version);
1440
1445
  return !!file;
1441
1446
  };
1442
- var isService = (directory) => async (path9) => {
1443
- const service = await getServiceByPath(directory)(path9);
1444
- const relativePath = (0, import_node_path7.relative)(directory, path9);
1447
+ var isService = (directory) => async (path11) => {
1448
+ const service = await getServiceByPath(directory)(path11);
1449
+ const relativePath = (0, import_node_path7.relative)(directory, path11);
1445
1450
  const segments = relativePath.split(/[/\\]+/);
1446
1451
  return !!service && segments.includes("services");
1447
1452
  };
@@ -1463,8 +1468,8 @@ var addEntityToService = (directory) => async (id, entity, version) => {
1463
1468
  if (!existingResource) {
1464
1469
  throw new Error(`Cannot find service ${id} in the catalog`);
1465
1470
  }
1466
- const path9 = existingResource.split(/[\\/]+services/)[0];
1467
- const pathToResource = (0, import_node_path7.join)(path9, "services");
1471
+ const path11 = existingResource.split(/[\\/]+services/)[0];
1472
+ const pathToResource = (0, import_node_path7.join)(path11, "services");
1468
1473
  await rmServiceById(directory)(id, version, true);
1469
1474
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1470
1475
  };
@@ -1499,8 +1504,8 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
1499
1504
  if (!existingResource) {
1500
1505
  throw new Error(`Cannot find service ${id} in the catalog`);
1501
1506
  }
1502
- const path9 = existingResource.split(/[\\/]+services/)[0];
1503
- const pathToResource = (0, import_node_path7.join)(path9, "services");
1507
+ const path11 = existingResource.split(/[\\/]+services/)[0];
1508
+ const pathToResource = (0, import_node_path7.join)(path11, "services");
1504
1509
  await rmServiceById(directory)(id, version, true);
1505
1510
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
1506
1511
  };
@@ -1552,8 +1557,8 @@ var persistSystemAtExistingPath = async (directory, system, version) => {
1552
1557
  });
1553
1558
  };
1554
1559
  var getSystem = (directory) => async (id, version) => getResource(directory, id, version, { type: "system" });
1555
- var getSystemByPath = (directory) => async (path9) => {
1556
- const system = await getResource(directory, void 0, void 0, { type: "system" }, path9);
1560
+ var getSystemByPath = (directory) => async (path11) => {
1561
+ const system = await getResource(directory, void 0, void 0, { type: "system" }, path11);
1557
1562
  return system;
1558
1563
  };
1559
1564
  var getSystems = (directory) => async (options) => getResources(directory, {
@@ -1578,8 +1583,8 @@ var writeSystemToDomain = (directory) => async (system, domain, options = { path
1578
1583
  await writeSystem(directory)({ ...system }, { ...options, path: pathForSystem });
1579
1584
  };
1580
1585
  var versionSystem = (directory) => async (id) => versionResource(directory, id);
1581
- var rmSystem = (directory) => async (path9) => {
1582
- await import_promises6.default.rm((0, import_node_path8.join)(directory, path9), { recursive: true });
1586
+ var rmSystem = (directory) => async (path11) => {
1587
+ await import_promises6.default.rm((0, import_node_path8.join)(directory, path11), { recursive: true });
1583
1588
  invalidateFileCache();
1584
1589
  };
1585
1590
  var rmSystemById = (directory) => async (id, version, persistFiles) => {
@@ -1590,9 +1595,9 @@ var systemHasVersion = (directory) => async (id, version) => {
1590
1595
  const file = await findFileById(directory, id, version);
1591
1596
  return !!file;
1592
1597
  };
1593
- var isSystem = (directory) => async (path9) => {
1594
- const system = await getSystemByPath(directory)(path9);
1595
- const relativePath = (0, import_node_path8.relative)(directory, path9);
1598
+ var isSystem = (directory) => async (path11) => {
1599
+ const system = await getSystemByPath(directory)(path11);
1600
+ const relativePath = (0, import_node_path8.relative)(directory, path11);
1596
1601
  const segments = relativePath.split(/[/\\]+/);
1597
1602
  return !!system && segments.includes("systems");
1598
1603
  };
@@ -1632,8 +1637,8 @@ var rewriteAgent = async (directory, id, agent, version) => {
1632
1637
  await writeAgent(directory)(agent, { path: agentPath.directory, format: extension === ".md" ? "md" : "mdx" });
1633
1638
  };
1634
1639
  var getAgent = (directory) => async (id, version) => getResource(directory, id, version, { type: "agent" });
1635
- var getAgentByPath = (directory) => async (path9) => {
1636
- const agent = await getResource(directory, void 0, void 0, { type: "agent" }, path9);
1640
+ var getAgentByPath = (directory) => async (path11) => {
1641
+ const agent = await getResource(directory, void 0, void 0, { type: "agent" }, path11);
1637
1642
  return agent;
1638
1643
  };
1639
1644
  var getAgents = (directory) => async (options) => getResources(directory, {
@@ -1666,8 +1671,8 @@ var writeAgent = (directory) => async (agent, options = {
1666
1671
  return await writeResource(directory, resource, { ...options, type: "agent" });
1667
1672
  };
1668
1673
  var writeVersionedAgent = (directory) => async (agent) => {
1669
- const path9 = getVersionedDirectory(agent.id, agent.version);
1670
- return await writeAgent(directory)({ ...agent }, { path: path9 });
1674
+ const path11 = getVersionedDirectory(agent.id, agent.version);
1675
+ return await writeAgent(directory)({ ...agent }, { path: path11 });
1671
1676
  };
1672
1677
  var writeAgentToDomain = (directory) => async (agent, domain, options = { path: "", format: "mdx", override: false }) => {
1673
1678
  let pathForAgent = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/agents` : `/${domain.id}/agents`;
@@ -1675,8 +1680,8 @@ var writeAgentToDomain = (directory) => async (agent, domain, options = { path:
1675
1680
  await writeResource(directory, { ...agent }, { ...options, path: pathForAgent, type: "agent" });
1676
1681
  };
1677
1682
  var versionAgent = (directory) => async (id) => versionResource(directory, id);
1678
- var rmAgent = (directory) => async (path9) => {
1679
- await import_promises7.default.rm((0, import_node_path9.join)(directory, path9), { recursive: true });
1683
+ var rmAgent = (directory) => async (path11) => {
1684
+ await import_promises7.default.rm((0, import_node_path9.join)(directory, path11), { recursive: true });
1680
1685
  invalidateFileCache();
1681
1686
  };
1682
1687
  var rmAgentById = (directory) => async (id, version, persistFiles) => {
@@ -1748,9 +1753,9 @@ var agentHasVersion = (directory) => async (id, version) => {
1748
1753
  const file = await findFileById(directory, id, version);
1749
1754
  return !!file;
1750
1755
  };
1751
- var isAgent = (directory) => async (path9) => {
1752
- const agent = await getAgentByPath(directory)(path9);
1753
- const relativePath = (0, import_node_path9.relative)(directory, path9);
1756
+ var isAgent = (directory) => async (path11) => {
1757
+ const agent = await getAgentByPath(directory)(path11);
1758
+ const relativePath = (0, import_node_path9.relative)(directory, path11);
1754
1759
  const segments = relativePath.split(/[/\\]+/);
1755
1760
  return !!agent && segments.includes("agents");
1756
1761
  };
@@ -1782,7 +1787,13 @@ var getDomains = (directory) => async (options) => getResources(directory, {
1782
1787
  "**/commands/**",
1783
1788
  "**/queries/**",
1784
1789
  "**/flows/**",
1785
- "**/entities/**"
1790
+ "**/entities/**",
1791
+ "**/systems/**",
1792
+ "**/containers/**",
1793
+ "**/data-products/**",
1794
+ "**/adrs/**",
1795
+ "**/diagrams/**",
1796
+ "**/channels/**"
1786
1797
  ],
1787
1798
  ...options
1788
1799
  });
@@ -1817,8 +1828,8 @@ var writeDomain = (directory) => async (domain, options = {
1817
1828
  return await writeResource(directory, resource, { ...options, type: "domain" });
1818
1829
  };
1819
1830
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
1820
- var rmDomain = (directory) => async (path9) => {
1821
- await import_promises8.default.rm((0, import_node_path10.join)(directory, path9), { recursive: true });
1831
+ var rmDomain = (directory) => async (path11) => {
1832
+ await import_promises8.default.rm((0, import_node_path10.join)(directory, path11), { recursive: true });
1822
1833
  invalidateFileCache();
1823
1834
  };
1824
1835
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
@@ -1979,8 +1990,8 @@ var import_node_path11 = require("path");
1979
1990
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
1980
1991
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
1981
1992
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
1982
- var rmChannel = (directory) => async (path9) => {
1983
- await import_promises9.default.rm((0, import_node_path11.join)(directory, path9), { recursive: true });
1993
+ var rmChannel = (directory) => async (path11) => {
1994
+ await import_promises9.default.rm((0, import_node_path11.join)(directory, path11), { recursive: true });
1984
1995
  invalidateFileCache();
1985
1996
  };
1986
1997
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
@@ -2022,8 +2033,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
2022
2033
  if (!existingResource) {
2023
2034
  throw new Error(`Cannot find message ${id} in the catalog`);
2024
2035
  }
2025
- const path9 = existingResource.split(new RegExp(`[\\\\/]+${collection}`))[0];
2026
- const pathToResource = (0, import_node_path11.join)(path9, collection);
2036
+ const path11 = existingResource.split(new RegExp(`[\\\\/]+${collection}`))[0];
2037
+ const pathToResource = (0, import_node_path11.join)(path11, collection);
2027
2038
  await rmMessageById(directory)(_message.id, _message.version, true);
2028
2039
  await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
2029
2040
  };
@@ -2033,8 +2044,8 @@ var import_node_path12 = require("path");
2033
2044
  var import_node_fs4 = __toESM(require("fs"));
2034
2045
  var import_gray_matter4 = __toESM(require("gray-matter"));
2035
2046
  var import_semver5 = require("semver");
2036
- var getMessageBySchemaPath = (directory) => async (path9, options) => {
2037
- const pathToMessage = (0, import_node_path12.dirname)(path9);
2047
+ var getMessageBySchemaPath = (directory) => async (path11, options) => {
2048
+ const pathToMessage = (0, import_node_path12.dirname)(path11);
2038
2049
  try {
2039
2050
  const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
2040
2051
  if (!files || files.length === 0) {
@@ -2110,18 +2121,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
2110
2121
  }
2111
2122
  return { producers, consumers };
2112
2123
  };
2113
- var getConsumersOfSchema = (directory) => async (path9) => {
2124
+ var getConsumersOfSchema = (directory) => async (path11) => {
2114
2125
  try {
2115
- const message = await getMessageBySchemaPath(directory)(path9);
2126
+ const message = await getMessageBySchemaPath(directory)(path11);
2116
2127
  const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
2117
2128
  return consumers;
2118
2129
  } catch (error) {
2119
2130
  return [];
2120
2131
  }
2121
2132
  };
2122
- var getProducersOfSchema = (directory) => async (path9) => {
2133
+ var getProducersOfSchema = (directory) => async (path11) => {
2123
2134
  try {
2124
- const message = await getMessageBySchemaPath(directory)(path9);
2135
+ const message = await getMessageBySchemaPath(directory)(path11);
2125
2136
  const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
2126
2137
  return producers;
2127
2138
  } catch (error) {
@@ -2370,8 +2381,8 @@ var filterCollection = (collection, options) => {
2370
2381
  };
2371
2382
  var getEventCatalogConfigurationFile = (directory) => async () => {
2372
2383
  try {
2373
- const path9 = (0, import_node_path18.join)(directory, "eventcatalog.config.js");
2374
- const configModule = await import(path9);
2384
+ const path11 = (0, import_node_path18.join)(directory, "eventcatalog.config.js");
2385
+ const configModule = await import(path11);
2375
2386
  return configModule.default;
2376
2387
  } catch (error) {
2377
2388
  console.error("Error getting event catalog configuration file", error);
@@ -2479,8 +2490,8 @@ var writeAdr = (directory) => async (adr, options = {
2479
2490
  override: false,
2480
2491
  format: "mdx"
2481
2492
  }) => writeResource(directory, { ...adr }, { ...options, type: "adr" });
2482
- var rmAdr = (directory) => async (path9) => {
2483
- await import_promises12.default.rm((0, import_node_path19.join)(directory, path9), { recursive: true });
2493
+ var rmAdr = (directory) => async (path11) => {
2494
+ await import_promises12.default.rm((0, import_node_path19.join)(directory, path11), { recursive: true });
2484
2495
  invalidateFileCache();
2485
2496
  };
2486
2497
  var rmAdrById = (directory) => async (id, version, persistFiles) => {
@@ -2508,8 +2519,8 @@ var writeDataProductToDomain = (directory) => async (dataProduct, domain, option
2508
2519
  pathForDataProduct = (0, import_node_path20.join)(pathForDataProduct, dataProduct.id);
2509
2520
  await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
2510
2521
  };
2511
- var rmDataProduct = (directory) => async (path9) => {
2512
- await import_promises13.default.rm((0, import_node_path20.join)(directory, path9), { recursive: true });
2522
+ var rmDataProduct = (directory) => async (path11) => {
2523
+ await import_promises13.default.rm((0, import_node_path20.join)(directory, path11), { recursive: true });
2513
2524
  invalidateFileCache();
2514
2525
  };
2515
2526
  var rmDataProductById = (directory) => async (id, version, persistFiles) => {
@@ -2533,8 +2544,8 @@ var writeContainer = (directory) => async (data, options = {
2533
2544
  format: "mdx"
2534
2545
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
2535
2546
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
2536
- var rmContainer = (directory) => async (path9) => {
2537
- await import_promises14.default.rm((0, import_node_path21.join)(directory, path9), { recursive: true });
2547
+ var rmContainer = (directory) => async (path11) => {
2548
+ await import_promises14.default.rm((0, import_node_path21.join)(directory, path11), { recursive: true });
2538
2549
  invalidateFileCache();
2539
2550
  };
2540
2551
  var rmContainerById = (directory) => async (id, version, persistFiles) => {
@@ -2593,8 +2604,8 @@ var writeEntityToSystem = (directory) => async (entity, system, options = { path
2593
2604
  const pathForEntity = (0, import_node_path22.join)(resourcePath.directory, "entities", entity.id);
2594
2605
  await writeResource(directory, { ...entity }, { ...options, path: pathForEntity, type: "entity" });
2595
2606
  };
2596
- var rmEntity = (directory) => async (path9) => {
2597
- await import_promises15.default.rm((0, import_node_path22.join)(directory, path9), { recursive: true });
2607
+ var rmEntity = (directory) => async (path11) => {
2608
+ await import_promises15.default.rm((0, import_node_path22.join)(directory, path11), { recursive: true });
2598
2609
  invalidateFileCache();
2599
2610
  };
2600
2611
  var rmEntityById = (directory) => async (id, version, persistFiles) => {
@@ -3085,8 +3096,8 @@ var writeFlow = (directory) => async (flow, options = {
3085
3096
  format: "mdx"
3086
3097
  }) => writeResource(directory, { ...flow }, { ...options, type: "flow" });
3087
3098
  var writeVersionedFlow = (directory) => async (flow) => {
3088
- const path9 = getVersionedDirectory(flow.id, flow.version);
3089
- return await writeFlow(directory)({ ...flow }, { path: path9 });
3099
+ const path11 = getVersionedDirectory(flow.id, flow.version);
3100
+ return await writeFlow(directory)({ ...flow }, { path: path11 });
3090
3101
  };
3091
3102
  var writeFlowToDomain = (directory) => async (flow, domain, options = { path: "", format: "mdx", override: false }) => {
3092
3103
  let pathForFlow = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/flows` : `/${domain.id}/flows`;
@@ -3111,8 +3122,8 @@ var writeFlowToAgent = (directory) => async (flow, agent, options = { path: "",
3111
3122
  pathForFlow = (0, import_node_path23.join)(pathForFlow, flow.id);
3112
3123
  await writeResource(directory, { ...flow }, { ...options, path: pathForFlow, type: "flow" });
3113
3124
  };
3114
- var rmFlow = (directory) => async (path9) => {
3115
- await import_promises16.default.rm((0, import_node_path23.join)(directory, path9), { recursive: true });
3125
+ var rmFlow = (directory) => async (path11) => {
3126
+ await import_promises16.default.rm((0, import_node_path23.join)(directory, path11), { recursive: true });
3116
3127
  invalidateFileCache();
3117
3128
  };
3118
3129
  var rmFlowById = (directory) => async (id, version, persistFiles) => {
@@ -3188,8 +3199,8 @@ var indexResources = (resources) => {
3188
3199
  }
3189
3200
  return { byId, byVersion };
3190
3201
  };
3191
- var pathIncludes = (path9, key) => {
3192
- let current = path9;
3202
+ var pathIncludes = (path11, key) => {
3203
+ let current = path11;
3193
3204
  while (current) {
3194
3205
  if (current.key === key) return true;
3195
3206
  current = current.parent;
@@ -3790,10 +3801,329 @@ var listSnapshots = (directory) => async () => {
3790
3801
  return snapshots.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
3791
3802
  };
3792
3803
 
3804
+ // src/build-index.ts
3805
+ var import_node_crypto2 = require("crypto");
3806
+ var import_promises18 = __toESM(require("fs/promises"));
3807
+ var import_node_path26 = __toESM(require("path"));
3808
+ var import_ignore = __toESM(require("ignore"));
3809
+ var import_semver8 = require("semver");
3810
+
3811
+ // src/diagrams.ts
3812
+ var import_promises17 = __toESM(require("fs/promises"));
3813
+ var import_node_path25 = require("path");
3814
+ var getDiagram = (directory) => async (id, version) => getResource(directory, id, version, { type: "diagram" });
3815
+ var getDiagrams = (directory) => async (options) => getResources(directory, { type: "diagrams", latestOnly: options?.latestOnly });
3816
+ var writeDiagram = (directory) => async (diagram, options = {
3817
+ path: "",
3818
+ override: false,
3819
+ format: "mdx"
3820
+ }) => writeResource(directory, { ...diagram }, { ...options, type: "diagram" });
3821
+ var rmDiagram = (directory) => async (path11) => {
3822
+ await import_promises17.default.rm((0, import_node_path25.join)(directory, path11), { recursive: true });
3823
+ invalidateFileCache();
3824
+ };
3825
+ var rmDiagramById = (directory) => async (id, version, persistFiles) => {
3826
+ await rmResourceById(directory, id, version, { type: "diagram", persistFiles });
3827
+ };
3828
+ var versionDiagram = (directory) => async (id) => versionResource(directory, id);
3829
+ var diagramHasVersion = (directory) => async (id, version) => {
3830
+ const file = await findFileById(directory, id, version);
3831
+ return !!file;
3832
+ };
3833
+ var addFileToDiagram = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version, { type: "diagram" });
3834
+
3835
+ // src/build-index.ts
3836
+ var normalizeSpecifications = async (resource, resourcePath, hashContent) => {
3837
+ if (resource.specifications === void 0) return void 0;
3838
+ const specifications = Array.isArray(resource.specifications) ? resource.specifications : [
3839
+ { type: "asyncapi", path: resource.specifications.asyncapiPath },
3840
+ { type: "openapi", path: resource.specifications.openapiPath },
3841
+ { type: "graphql", path: resource.specifications.graphqlPath }
3842
+ ].flatMap(({ type, path: path11 }) => path11 ? [{ type, path: path11 }] : []);
3843
+ return Promise.all(
3844
+ specifications.map(async (specification) => ({
3845
+ ...specification,
3846
+ ...hashContent ? {
3847
+ hash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(await import_promises18.default.readFile(import_node_path26.default.join(import_node_path26.default.dirname(resourcePath), specification.path))).digest("hex")}`
3848
+ } : {}
3849
+ }))
3850
+ );
3851
+ };
3852
+ var getFlowReferences = (steps) => steps.flatMap((step) => [
3853
+ ...step.service ? [{ kind: "service", ...step.service }] : [],
3854
+ ...step.message ? [{ kind: "message", ...step.message }] : [],
3855
+ ...step.agent ? [{ kind: "agent", ...step.agent }] : [],
3856
+ ...step.container ? [{ kind: "container", ...step.container }] : [],
3857
+ ...step.dataProduct ? [{ kind: "data-product", ...step.dataProduct }] : [],
3858
+ ...step.flow ? [{ kind: "flow", ...step.flow }] : []
3859
+ ]);
3860
+ var compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
3861
+ var compareVersions = (left, right) => {
3862
+ if (left === right) return 0;
3863
+ if (left === void 0) return 1;
3864
+ if (right === void 0) return -1;
3865
+ if ((0, import_semver8.valid)(left) && (0, import_semver8.valid)(right)) return (0, import_semver8.rcompare)(left, right);
3866
+ return compareText(right, left);
3867
+ };
3868
+ var compareIndexResources = (left, right) => compareText(left.type, right.type) || compareText(left.id, right.id) || compareVersions(left.version, right.version);
3869
+ var toCatalogPath = (directory, filePath) => import_node_path26.default.relative(directory, filePath).split(import_node_path26.default.sep).join("/");
3870
+ var loadIgnoreRules = async (directory) => {
3871
+ try {
3872
+ return (0, import_ignore.default)().add(await import_promises18.default.readFile(import_node_path26.default.join(directory, ".eventcatalogignore"), "utf8"));
3873
+ } catch (error) {
3874
+ if (error.code === "ENOENT") return void 0;
3875
+ throw error;
3876
+ }
3877
+ };
3878
+ var normalizeAssets = async (directory, hashContent, ignoreRules) => {
3879
+ const collectFiles = async (currentDirectory) => {
3880
+ let entries;
3881
+ try {
3882
+ entries = await import_promises18.default.readdir(currentDirectory, { withFileTypes: true });
3883
+ } catch (error) {
3884
+ if (error.code === "ENOENT") return [];
3885
+ throw error;
3886
+ }
3887
+ const files = await Promise.all(
3888
+ entries.sort((left, right) => compareText(left.name, right.name)).map(async (entry) => {
3889
+ const entryPath = import_node_path26.default.join(currentDirectory, entry.name);
3890
+ const catalogPath = toCatalogPath(directory, entryPath);
3891
+ if (entry.isDirectory()) return ignoreRules?.ignores(`${catalogPath}/`) ? [] : collectFiles(entryPath);
3892
+ return entry.isFile() && !ignoreRules?.ignores(catalogPath) ? [entryPath] : [];
3893
+ })
3894
+ );
3895
+ return files.flat();
3896
+ };
3897
+ const assetPaths = (await Promise.all(["components", "public"].map((assetDirectory) => collectFiles(import_node_path26.default.join(directory, assetDirectory))))).flat().sort(compareText);
3898
+ const assets = await Promise.all(
3899
+ assetPaths.map(async (assetPath) => ({
3900
+ path: toCatalogPath(directory, assetPath),
3901
+ ...hashContent ? {
3902
+ hash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(await import_promises18.default.readFile(assetPath)).digest("hex")}`
3903
+ } : {}
3904
+ }))
3905
+ );
3906
+ return assets.length === 0 ? void 0 : assets;
3907
+ };
3908
+ var normalizeSchemas = async (resource, resourcePath, hashContent) => {
3909
+ const schemas = resource.schemas ?? (resource.schemaPath ? [{ path: resource.schemaPath, default: true }] : void 0);
3910
+ if (schemas === void 0) return void 0;
3911
+ return Promise.all(
3912
+ schemas.map(async ({ file, ...schema }) => {
3913
+ const schemaPath = file ?? schema.path;
3914
+ return {
3915
+ ...schema,
3916
+ ...schemaPath === void 0 ? {} : { path: schemaPath },
3917
+ ...hashContent && schemaPath ? {
3918
+ hash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(await import_promises18.default.readFile(import_node_path26.default.join(import_node_path26.default.dirname(resourcePath), schemaPath))).digest("hex")}`
3919
+ } : {}
3920
+ };
3921
+ })
3922
+ );
3923
+ };
3924
+ var IGNORED_SIDECAR_FILES = /* @__PURE__ */ new Set([".DS_Store", ".gitignore", ".gitkeep", ".npmignore", "Thumbs.db", "desktop.ini"]);
3925
+ var IGNORED_SIDECAR_DIRECTORIES = /* @__PURE__ */ new Set([".git", ".hg", ".svn", "node_modules"]);
3926
+ var normalizeSidecars = async (directory, resourcePath, resourceDirectories, representedPaths, hashContent, ignoreRules) => {
3927
+ if (!/^index\.mdx?$/i.test(import_node_path26.default.basename(resourcePath))) return void 0;
3928
+ const collectFiles = async (currentDirectory) => {
3929
+ let entries;
3930
+ try {
3931
+ entries = await import_promises18.default.readdir(currentDirectory, { withFileTypes: true });
3932
+ } catch (error) {
3933
+ if (error.code === "ENOENT") return [];
3934
+ throw error;
3935
+ }
3936
+ const files = await Promise.all(
3937
+ entries.sort((left, right) => compareText(left.name, right.name)).map(async (entry) => {
3938
+ const entryPath = import_node_path26.default.join(currentDirectory, entry.name);
3939
+ const resolvedEntryPath = import_node_path26.default.resolve(entryPath);
3940
+ const catalogPath = toCatalogPath(directory, entryPath);
3941
+ if (entry.isDirectory()) {
3942
+ if (IGNORED_SIDECAR_DIRECTORIES.has(entry.name) || resourceDirectories.has(resolvedEntryPath)) return [];
3943
+ if (ignoreRules?.ignores(`${catalogPath}/`)) return [];
3944
+ return collectFiles(entryPath);
3945
+ }
3946
+ if (!entry.isFile()) return [];
3947
+ if (IGNORED_SIDECAR_FILES.has(entry.name) || representedPaths.has(resolvedEntryPath)) return [];
3948
+ if (entry.name.endsWith("~") || /^\..*\.sw[op]$/.test(entry.name)) return [];
3949
+ if (ignoreRules?.ignores(catalogPath)) return [];
3950
+ return [entryPath];
3951
+ })
3952
+ );
3953
+ return files.flat();
3954
+ };
3955
+ const sidecarPaths = (await collectFiles(import_node_path26.default.dirname(resourcePath))).sort(compareText);
3956
+ const sidecars = await Promise.all(
3957
+ sidecarPaths.map(async (sidecarPath) => ({
3958
+ path: toCatalogPath(directory, sidecarPath),
3959
+ ...hashContent ? {
3960
+ hash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(await import_promises18.default.readFile(sidecarPath)).digest("hex")}`
3961
+ } : {}
3962
+ }))
3963
+ );
3964
+ return sidecars.length === 0 ? void 0 : sidecars;
3965
+ };
3966
+ var toIndexResource = async (directory, type, resource, hashContent, sourcePath, resourceDirectories, ignoreRules) => {
3967
+ const { id, version, name } = resource;
3968
+ const schemas = await normalizeSchemas(resource, sourcePath, hashContent);
3969
+ const specifications = await normalizeSpecifications(resource, sourcePath, hashContent);
3970
+ const representedPaths = new Set(
3971
+ [
3972
+ sourcePath,
3973
+ ...(schemas ?? []).flatMap((schema) => schema.path ? [import_node_path26.default.join(import_node_path26.default.dirname(sourcePath), schema.path)] : []),
3974
+ ...(specifications ?? []).map((specification) => import_node_path26.default.join(import_node_path26.default.dirname(sourcePath), specification.path))
3975
+ ].map((representedPath) => import_node_path26.default.resolve(representedPath))
3976
+ );
3977
+ const sidecars = await normalizeSidecars(
3978
+ directory,
3979
+ sourcePath,
3980
+ resourceDirectories,
3981
+ representedPaths,
3982
+ hashContent,
3983
+ ignoreRules
3984
+ );
3985
+ return {
3986
+ type,
3987
+ id,
3988
+ ...version === void 0 ? {} : { version },
3989
+ name,
3990
+ contentPath: toCatalogPath(directory, sourcePath),
3991
+ ...hashContent ? {
3992
+ contentHash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(await import_promises18.default.readFile(sourcePath)).digest("hex")}`
3993
+ } : {},
3994
+ ...resource.draft === void 0 ? {} : { draft: resource.draft },
3995
+ ...resource.deprecated === void 0 ? {} : { deprecated: resource.deprecated },
3996
+ ...resource.owners === void 0 ? {} : { owners: resource.owners },
3997
+ ...resource.diagrams === void 0 ? {} : { diagrams: resource.diagrams },
3998
+ ...schemas === void 0 ? {} : { schemas },
3999
+ ...specifications === void 0 ? {} : { specifications },
4000
+ ...sidecars === void 0 ? {} : { sidecars },
4001
+ ...resource.container_type === void 0 ? {} : { container_type: resource.container_type },
4002
+ ...resource.steps === void 0 ? {} : { references: getFlowReferences(resource.steps) },
4003
+ ...resource.sends === void 0 ? {} : { sends: resource.sends },
4004
+ ...resource.receives === void 0 ? {} : { receives: resource.receives },
4005
+ ...resource.channels === void 0 ? {} : { channels: resource.channels },
4006
+ ...resource.address === void 0 ? {} : { address: resource.address },
4007
+ ...resource.protocols === void 0 ? {} : { protocols: resource.protocols },
4008
+ ...resource.deliveryGuarantee === void 0 ? {} : { deliveryGuarantee: resource.deliveryGuarantee },
4009
+ ...resource.routes === void 0 ? {} : { routes: resource.routes },
4010
+ ...resource.parameters === void 0 ? {} : { parameters: resource.parameters },
4011
+ ...resource.services === void 0 ? {} : { services: resource.services },
4012
+ ...resource.agents === void 0 ? {} : { agents: resource.agents },
4013
+ ...resource.domains === void 0 ? {} : { domains: resource.domains },
4014
+ ...resource.systems === void 0 ? {} : { systems: resource.systems },
4015
+ ...resource.entities === void 0 ? {} : { entities: resource.entities },
4016
+ ...resource.dataProducts === void 0 ? {} : { dataProducts: resource.dataProducts },
4017
+ ...resource.flows === void 0 ? {} : { flows: resource.flows },
4018
+ ...resource.writesTo === void 0 ? {} : { writesTo: resource.writesTo },
4019
+ ...resource.readsFrom === void 0 ? {} : { readsFrom: resource.readsFrom },
4020
+ ...resource.containers === void 0 ? {} : { containers: resource.containers },
4021
+ ...resource.relationships === void 0 ? {} : { relationships: resource.relationships },
4022
+ ...resource.actors === void 0 ? {} : { actors: resource.actors },
4023
+ ...resource.inputs === void 0 ? {} : { inputs: resource.inputs },
4024
+ ...resource.outputs === void 0 ? {} : { outputs: resource.outputs },
4025
+ ...resource.status === void 0 ? {} : { status: resource.status },
4026
+ ...resource.appliesTo === void 0 ? {} : { appliesTo: resource.appliesTo },
4027
+ ...resource.supersedes === void 0 ? {} : { supersedes: resource.supersedes },
4028
+ ...resource.supersededBy === void 0 ? {} : { supersededBy: resource.supersededBy },
4029
+ ...resource.amends === void 0 ? {} : { amends: resource.amends },
4030
+ ...resource.amendedBy === void 0 ? {} : { amendedBy: resource.amendedBy },
4031
+ ...resource.related === void 0 ? {} : { related: resource.related },
4032
+ ...resource.members === void 0 ? {} : { members: resource.members }
4033
+ };
4034
+ };
4035
+ var buildIndex = (directory) => async ({ source, commit, hashContent = true }) => {
4036
+ const [
4037
+ domains,
4038
+ channels,
4039
+ events,
4040
+ commands,
4041
+ queries,
4042
+ services,
4043
+ systems,
4044
+ dataProducts,
4045
+ dataStores,
4046
+ entities,
4047
+ flows,
4048
+ adrs,
4049
+ agents,
4050
+ teams,
4051
+ users,
4052
+ diagrams
4053
+ ] = await Promise.all([
4054
+ getDomains(directory)(),
4055
+ getChannels(directory)(),
4056
+ getEvents(directory)(),
4057
+ getCommands(directory)(),
4058
+ getQueries(directory)(),
4059
+ getServices(directory)(),
4060
+ getSystems(directory)(),
4061
+ getDataProducts(directory)(),
4062
+ getDataStores(directory)(),
4063
+ getEntities(directory)(),
4064
+ getFlows(directory)(),
4065
+ getAdrs(directory)(),
4066
+ getAgents(directory)(),
4067
+ getTeams(import_node_path26.default.join(directory, "teams"))(),
4068
+ getUsers(directory)(),
4069
+ getDiagrams(directory)()
4070
+ ]);
4071
+ const indexableResources = [
4072
+ ...(domains ?? []).map((resource) => ({ type: "domain", resource })),
4073
+ ...(channels ?? []).map((resource) => ({ type: "channel", resource })),
4074
+ ...(events ?? []).map((resource) => ({ type: "event", resource })),
4075
+ ...(commands ?? []).map((resource) => ({ type: "command", resource })),
4076
+ ...(queries ?? []).map((resource) => ({ type: "query", resource })),
4077
+ ...(services ?? []).map((resource) => ({ type: "service", resource })),
4078
+ ...(systems ?? []).map((resource) => ({ type: "system", resource })),
4079
+ ...(dataProducts ?? []).map((resource) => ({ type: "data-product", resource })),
4080
+ ...(dataStores ?? []).map((resource) => ({ type: "container", resource })),
4081
+ ...(entities ?? []).map((resource) => ({ type: "entity", resource })),
4082
+ ...(flows ?? []).map((resource) => ({ type: "flow", resource })),
4083
+ ...(adrs ?? []).map((resource) => ({ type: "adr", resource })),
4084
+ ...(agents ?? []).map((resource) => ({ type: "agent", resource })),
4085
+ ...(teams ?? []).map((resource) => ({
4086
+ type: "team",
4087
+ resource,
4088
+ sourcePath: import_node_path26.default.join(directory, "teams", `${resource.id}.mdx`)
4089
+ })),
4090
+ ...(users ?? []).map((resource) => ({
4091
+ type: "user",
4092
+ resource,
4093
+ sourcePath: import_node_path26.default.join(directory, "users", `${resource.id}.mdx`)
4094
+ })),
4095
+ ...(diagrams ?? []).map((resource) => ({ type: "diagram", resource }))
4096
+ ];
4097
+ const locatedResources = await Promise.all(
4098
+ indexableResources.map(async (entry) => {
4099
+ const sourcePath = entry.sourcePath ?? (await getResourcePath(directory, entry.resource.id, entry.resource.version))?.fullPath;
4100
+ if (!sourcePath) throw new Error(`Cannot find ${entry.type} ${entry.resource.id} (${entry.resource.version})`);
4101
+ return { ...entry, sourcePath };
4102
+ })
4103
+ );
4104
+ const resourceDirectories = new Set(
4105
+ locatedResources.filter(({ sourcePath }) => /^index\.mdx?$/i.test(import_node_path26.default.basename(sourcePath))).map(({ sourcePath }) => import_node_path26.default.resolve(import_node_path26.default.dirname(sourcePath)))
4106
+ );
4107
+ const ignoreRules = await loadIgnoreRules(directory);
4108
+ const resources = await Promise.all(
4109
+ locatedResources.map(
4110
+ ({ type, resource, sourcePath }) => toIndexResource(directory, type, resource, hashContent, sourcePath, resourceDirectories, ignoreRules)
4111
+ )
4112
+ );
4113
+ const assets = await normalizeAssets(directory, hashContent, ignoreRules);
4114
+ return {
4115
+ indexVersion: 1,
4116
+ source,
4117
+ commit,
4118
+ resources: resources.sort(compareIndexResources),
4119
+ ...assets === void 0 ? {} : { assets }
4120
+ };
4121
+ };
4122
+
3793
4123
  // src/changelogs.ts
3794
- var import_node_path25 = __toESM(require("path"));
4124
+ var import_node_path27 = __toESM(require("path"));
3795
4125
  var import_node_fs10 = __toESM(require("fs"));
3796
- var import_promises17 = __toESM(require("fs/promises"));
4126
+ var import_promises19 = __toESM(require("fs/promises"));
3797
4127
  var import_gray_matter8 = __toESM(require("gray-matter"));
3798
4128
  var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
3799
4129
  const { version, format = "mdx" } = options;
@@ -3801,8 +4131,8 @@ var writeChangelog = (catalogDir) => async (id, changelog, options = {}) => {
3801
4131
  if (!resourceFile) {
3802
4132
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
3803
4133
  }
3804
- const resourceDir = (0, import_node_path25.dirname)(resourceFile);
3805
- const changelogPath = import_node_path25.default.join(resourceDir, `changelog.${format}`);
4134
+ const resourceDir = (0, import_node_path27.dirname)(resourceFile);
4135
+ const changelogPath = import_node_path27.default.join(resourceDir, `changelog.${format}`);
3806
4136
  const { markdown, ...frontmatter } = changelog;
3807
4137
  const fm = { ...frontmatter };
3808
4138
  if (fm.createdAt instanceof Date) {
@@ -3822,9 +4152,9 @@ var appendChangelog = (catalogDir) => async (id, changelog, options = {}) => {
3822
4152
  if (!resourceFile) {
3823
4153
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
3824
4154
  }
3825
- const resourceDir = (0, import_node_path25.dirname)(resourceFile);
3826
- const mdxPath = import_node_path25.default.join(resourceDir, "changelog.mdx");
3827
- const mdPath = import_node_path25.default.join(resourceDir, "changelog.md");
4155
+ const resourceDir = (0, import_node_path27.dirname)(resourceFile);
4156
+ const mdxPath = import_node_path27.default.join(resourceDir, "changelog.mdx");
4157
+ const mdPath = import_node_path27.default.join(resourceDir, "changelog.md");
3828
4158
  const existingPath = import_node_fs10.default.existsSync(mdxPath) ? mdxPath : import_node_fs10.default.existsSync(mdPath) ? mdPath : void 0;
3829
4159
  if (!existingPath) {
3830
4160
  return writeChangelog(catalogDir)(id, changelog, options);
@@ -3852,9 +4182,9 @@ var getChangelog = (catalogDir) => async (id, options = {}) => {
3852
4182
  const { version } = options;
3853
4183
  const resourceFile = await findFileById(catalogDir, id, version);
3854
4184
  if (!resourceFile) return void 0;
3855
- const resourceDir = (0, import_node_path25.dirname)(resourceFile);
3856
- const mdxPath = import_node_path25.default.join(resourceDir, "changelog.mdx");
3857
- const mdPath = import_node_path25.default.join(resourceDir, "changelog.md");
4185
+ const resourceDir = (0, import_node_path27.dirname)(resourceFile);
4186
+ const mdxPath = import_node_path27.default.join(resourceDir, "changelog.mdx");
4187
+ const mdPath = import_node_path27.default.join(resourceDir, "changelog.md");
3858
4188
  const changelogPath = import_node_fs10.default.existsSync(mdxPath) ? mdxPath : import_node_fs10.default.existsSync(mdPath) ? mdPath : void 0;
3859
4189
  if (!changelogPath) return void 0;
3860
4190
  const { data, content } = import_gray_matter8.default.read(changelogPath);
@@ -3866,44 +4196,586 @@ var rmChangelog = (catalogDir) => async (id, options = {}) => {
3866
4196
  if (!resourceFile) {
3867
4197
  throw new Error(`No resource found with id: ${id}${version ? ` and version: ${version}` : ""}`);
3868
4198
  }
3869
- const resourceDir = (0, import_node_path25.dirname)(resourceFile);
3870
- const mdxPath = import_node_path25.default.join(resourceDir, "changelog.mdx");
3871
- const mdPath = import_node_path25.default.join(resourceDir, "changelog.md");
4199
+ const resourceDir = (0, import_node_path27.dirname)(resourceFile);
4200
+ const mdxPath = import_node_path27.default.join(resourceDir, "changelog.mdx");
4201
+ const mdPath = import_node_path27.default.join(resourceDir, "changelog.md");
3872
4202
  if (import_node_fs10.default.existsSync(mdxPath)) {
3873
- await import_promises17.default.rm(mdxPath);
4203
+ await import_promises19.default.rm(mdxPath);
3874
4204
  }
3875
4205
  if (import_node_fs10.default.existsSync(mdPath)) {
3876
- await import_promises17.default.rm(mdPath);
4206
+ await import_promises19.default.rm(mdPath);
3877
4207
  }
3878
4208
  invalidateFileCache();
3879
4209
  };
3880
4210
 
3881
- // src/diagrams.ts
3882
- var import_promises18 = __toESM(require("fs/promises"));
3883
- var import_node_path26 = require("path");
3884
- var getDiagram = (directory) => async (id, version) => getResource(directory, id, version, { type: "diagram" });
3885
- var getDiagrams = (directory) => async (options) => getResources(directory, { type: "diagrams", latestOnly: options?.latestOnly });
3886
- var writeDiagram = (directory) => async (diagram, options = {
3887
- path: "",
3888
- override: false,
3889
- format: "mdx"
3890
- }) => writeResource(directory, { ...diagram }, { ...options, type: "diagram" });
3891
- var rmDiagram = (directory) => async (path9) => {
3892
- await import_promises18.default.rm((0, import_node_path26.join)(directory, path9), { recursive: true });
3893
- invalidateFileCache();
4211
+ // src/resolve.ts
4212
+ var import_semver9 = require("semver");
4213
+ var compareText2 = (left, right) => left < right ? -1 : left > right ? 1 : 0;
4214
+ var isHigherVersion = (candidate, current) => {
4215
+ if (candidate === current || candidate === void 0) return false;
4216
+ if (current === void 0) return true;
4217
+ if ((0, import_semver9.valid)(candidate) && (0, import_semver9.valid)(current)) return (0, import_semver9.gt)(candidate, current);
4218
+ return compareText2(candidate, current) > 0;
4219
+ };
4220
+ var selectTarget = (candidates, pointerVersion) => {
4221
+ if (!candidates?.length) return void 0;
4222
+ if (pointerVersion === void 0 || pointerVersion === "latest") {
4223
+ return candidates.reduce((latest, candidate) => isHigherVersion(candidate.version, latest.version) ? candidate : latest);
4224
+ }
4225
+ const exactMatch = candidates.find((candidate) => candidate.version === pointerVersion);
4226
+ if (exactMatch) return exactMatch;
4227
+ const range = (0, import_semver9.validRange)(pointerVersion);
4228
+ if (!range) return void 0;
4229
+ return candidates.reduce((latest, candidate) => {
4230
+ if (candidate.version === void 0 || !(0, import_semver9.valid)(candidate.version) || !(0, import_semver9.satisfies)(candidate.version, range)) return latest;
4231
+ if (latest === void 0 || isHigherVersion(candidate.version, latest.version)) return candidate;
4232
+ return latest;
4233
+ }, void 0);
4234
+ };
4235
+ var getPointerFields = (entity) => [
4236
+ { direction: "sends", pointers: entity.sends },
4237
+ { direction: "receives", pointers: entity.receives },
4238
+ { direction: "writesTo", pointers: entity.writesTo },
4239
+ { direction: "readsFrom", pointers: entity.readsFrom },
4240
+ { direction: "contains", via: "services", pointers: entity.services },
4241
+ { direction: "contains", via: "agents", pointers: entity.agents },
4242
+ { direction: "contains", via: "domains", pointers: entity.domains },
4243
+ { direction: "contains", via: "dataProducts", pointers: entity.dataProducts },
4244
+ { direction: "contains", via: "systems", pointers: entity.systems },
4245
+ { direction: "contains", via: "entities", pointers: entity.entities },
4246
+ { direction: "contains", via: "containers", pointers: entity.containers },
4247
+ { direction: "contains", via: "flows", pointers: entity.flows },
4248
+ { direction: "relatesTo", via: "relationships", pointers: entity.relationships },
4249
+ { direction: "receives", via: "inputs", pointers: entity.inputs },
4250
+ { direction: "sends", via: "outputs", pointers: entity.outputs },
4251
+ { direction: "references", via: "steps", pointers: entity.references },
4252
+ { direction: "appliesTo", pointers: entity.appliesTo },
4253
+ { direction: "relatesTo", via: "related", pointers: entity.related },
4254
+ { direction: "relatesTo", via: "supersedes", pointers: entity.supersedes },
4255
+ { direction: "relatesTo", via: "supersededBy", pointers: entity.supersededBy },
4256
+ { direction: "relatesTo", via: "amends", pointers: entity.amends },
4257
+ { direction: "relatesTo", via: "amendedBy", pointers: entity.amendedBy },
4258
+ { direction: "relatesTo", via: "diagrams", pointers: entity.diagrams },
4259
+ { direction: "references", via: "channels", pointers: entity.channels },
4260
+ { direction: "references", via: "routes", pointers: entity.routes },
4261
+ { direction: "sends", via: "sends.to", pointers: entity.sends?.flatMap((pointer) => pointer.to ?? []) },
4262
+ { direction: "receives", via: "receives.from", pointers: entity.receives?.flatMap((pointer) => pointer.from ?? []) },
4263
+ { direction: "sends", via: "receives.triggers", pointers: entity.receives?.flatMap((pointer) => pointer.triggers ?? []) }
4264
+ ];
4265
+ var resolve2 = (indexes) => {
4266
+ const assetCandidatesByPath = /* @__PURE__ */ new Map();
4267
+ for (const { source, commit, assets: assets2 = [] } of indexes) {
4268
+ for (const asset of assets2) {
4269
+ const candidates = assetCandidatesByPath.get(asset.path) ?? [];
4270
+ candidates.push({ ...asset, resolvedFrom: { source, commit } });
4271
+ assetCandidatesByPath.set(asset.path, candidates);
4272
+ }
4273
+ }
4274
+ const assets = [];
4275
+ const warnings = [];
4276
+ for (const [assetPath, candidates] of assetCandidatesByPath) {
4277
+ candidates.sort(
4278
+ (left, right) => compareText2(left.resolvedFrom.source, right.resolvedFrom.source) || compareText2(left.resolvedFrom.commit, right.resolvedFrom.commit)
4279
+ );
4280
+ const [winner] = candidates;
4281
+ const sources = [...new Set(candidates.map((candidate) => candidate.resolvedFrom.source))].sort(compareText2);
4282
+ const hashes = new Set(candidates.map((candidate) => candidate.hash));
4283
+ const hashesCanBeCompared = candidates.every((candidate) => candidate.hash !== void 0);
4284
+ const hasCollision = candidates.length > 1 && (!hashesCanBeCompared || hashes.size > 1);
4285
+ assets.push({
4286
+ ...winner,
4287
+ ...!hasCollision && candidates.length > 1 ? { contributors: sources.filter((source) => source !== winner.resolvedFrom.source) } : {}
4288
+ });
4289
+ if (hasCollision) {
4290
+ warnings.push({
4291
+ kind: "asset-collision",
4292
+ path: assetPath,
4293
+ sources,
4294
+ winner: winner.resolvedFrom.source
4295
+ });
4296
+ }
4297
+ }
4298
+ assets.sort((left, right) => compareText2(left.path, right.path));
4299
+ warnings.sort((left, right) => compareText2(left.path, right.path));
4300
+ const entities = indexes.flatMap(
4301
+ ({ source, commit, resources }) => resources.map((resource) => ({
4302
+ ...resource,
4303
+ resolvedFrom: { source, commit }
4304
+ }))
4305
+ ).sort(
4306
+ (left, right) => compareText2(left.id, right.id) || compareText2(left.version ?? "", right.version ?? "") || compareText2(left.type, right.type) || compareText2(left.resolvedFrom.source, right.resolvedFrom.source)
4307
+ );
4308
+ const entitiesById = /* @__PURE__ */ new Map();
4309
+ for (const entity of entities) {
4310
+ const matches = entitiesById.get(entity.id) ?? [];
4311
+ matches.push(entity);
4312
+ entitiesById.set(entity.id, matches);
4313
+ }
4314
+ const conflictsByKindAndId = /* @__PURE__ */ new Map();
4315
+ const addConflict = (kind, id, sources, detail) => {
4316
+ const key = `${kind}:${id}`;
4317
+ const conflict = conflictsByKindAndId.get(key);
4318
+ if (conflict) {
4319
+ conflict.sources = [.../* @__PURE__ */ new Set([...conflict.sources, ...sources])].sort(compareText2);
4320
+ if (conflict.detail === void 0) conflict.detail = detail;
4321
+ return;
4322
+ }
4323
+ conflictsByKindAndId.set(key, {
4324
+ kind,
4325
+ id,
4326
+ sources: [...new Set(sources)].sort(compareText2),
4327
+ ...detail === void 0 ? {} : { detail }
4328
+ });
4329
+ };
4330
+ for (const [id, matches] of entitiesById) {
4331
+ const sources = [...new Set(matches.map((entity) => entity.resolvedFrom.source))];
4332
+ const types = new Set(matches.map((entity) => entity.type));
4333
+ if (types.size > 1) {
4334
+ addConflict("type-collision", id, sources);
4335
+ } else if (sources.length > 1) {
4336
+ addConflict("duplicate-source", id, sources);
4337
+ }
4338
+ }
4339
+ const externalsByPointer = /* @__PURE__ */ new Map();
4340
+ const edges = [];
4341
+ for (const entity of entities) {
4342
+ for (const field of getPointerFields(entity)) {
4343
+ for (const pointer of field.pointers ?? []) {
4344
+ const candidates = entitiesById.get(pointer.id);
4345
+ const target = selectTarget(candidates, pointer.version);
4346
+ if (!target) {
4347
+ if (candidates) {
4348
+ edges.push({
4349
+ from: entity.id,
4350
+ fromVersion: entity.version ?? null,
4351
+ fromResolvedFrom: entity.resolvedFrom,
4352
+ to: pointer.id,
4353
+ direction: field.direction,
4354
+ ...field.via === void 0 ? {} : { via: field.via },
4355
+ ...pointer.label === void 0 ? {} : { label: pointer.label },
4356
+ pointer: pointer.version ?? null,
4357
+ resolved: null,
4358
+ status: "unresolved"
4359
+ });
4360
+ continue;
4361
+ }
4362
+ const key = `${pointer.id}@${pointer.version ?? ""}`;
4363
+ const external = externalsByPointer.get(key) ?? {
4364
+ id: pointer.id,
4365
+ ...pointer.version === void 0 ? {} : { version: pointer.version },
4366
+ referencedBy: []
4367
+ };
4368
+ if (!external.referencedBy.includes(entity.id)) external.referencedBy.push(entity.id);
4369
+ externalsByPointer.set(key, external);
4370
+ edges.push({
4371
+ from: entity.id,
4372
+ fromVersion: entity.version ?? null,
4373
+ fromResolvedFrom: entity.resolvedFrom,
4374
+ to: pointer.id,
4375
+ direction: field.direction,
4376
+ ...field.via === void 0 ? {} : { via: field.via },
4377
+ ...pointer.label === void 0 ? {} : { label: pointer.label },
4378
+ pointer: pointer.version ?? null,
4379
+ resolved: null,
4380
+ status: "external"
4381
+ });
4382
+ continue;
4383
+ }
4384
+ if (pointer.type !== void 0 && pointer.type !== target.type) {
4385
+ addConflict(
4386
+ "pointer-type-mismatch",
4387
+ pointer.id,
4388
+ [entity.resolvedFrom.source, target.resolvedFrom.source],
4389
+ `Expected ${pointer.type} but found ${target.type}`
4390
+ );
4391
+ }
4392
+ edges.push({
4393
+ from: entity.id,
4394
+ fromVersion: entity.version ?? null,
4395
+ fromResolvedFrom: entity.resolvedFrom,
4396
+ to: target.id,
4397
+ direction: field.direction,
4398
+ ...field.via === void 0 ? {} : { via: field.via },
4399
+ ...pointer.label === void 0 ? {} : { label: pointer.label },
4400
+ pointer: pointer.version ?? null,
4401
+ resolved: target.version ?? null,
4402
+ resolvedFrom: target.resolvedFrom,
4403
+ status: "resolved"
4404
+ });
4405
+ }
4406
+ }
4407
+ }
4408
+ return {
4409
+ entities,
4410
+ assets,
4411
+ edges,
4412
+ conflicts: [...conflictsByKindAndId.values()].sort(
4413
+ (left, right) => compareText2(left.id, right.id) || compareText2(left.kind, right.kind)
4414
+ ),
4415
+ warnings,
4416
+ externals: [...externalsByPointer.values()]
4417
+ };
3894
4418
  };
3895
- var rmDiagramById = (directory) => async (id, version, persistFiles) => {
3896
- await rmResourceById(directory, id, version, { type: "diagram", persistFiles });
4419
+
4420
+ // src/hydrate.ts
4421
+ var import_node_crypto3 = require("crypto");
4422
+ var import_promises20 = __toESM(require("fs/promises"));
4423
+ var import_node_path28 = __toESM(require("path"));
4424
+ var getSourceDirectory = (source) => {
4425
+ const slug = source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "source";
4426
+ const digest = (0, import_node_crypto3.createHash)("sha256").update(source).digest("hex").slice(0, 12);
4427
+ return `${slug}--${digest}`;
4428
+ };
4429
+ var getContentHash = (content) => `sha256:${(0, import_node_crypto3.createHash)("sha256").update(content).digest("hex")}`;
4430
+ var getArtifactOutputPath = (artifact, outDir) => {
4431
+ const allowedDirectory = import_node_path28.default.resolve(artifact.shared ? outDir : import_node_path28.default.join(outDir, getSourceDirectory(artifact.source)));
4432
+ const portableTarget = artifact.target.replaceAll("\\", "/");
4433
+ const normalizedTarget = import_node_path28.default.posix.normalize(portableTarget);
4434
+ const hasUnsafePathSyntax = artifact.target.length === 0 || artifact.target.includes("\0") || artifact.target.includes("\\") || import_node_path28.default.posix.isAbsolute(portableTarget) || /^[a-zA-Z]:\//.test(portableTarget) || normalizedTarget === ".." || normalizedTarget.startsWith("../");
4435
+ const outputPath = import_node_path28.default.resolve(allowedDirectory, artifact.target);
4436
+ const relativeOutputPath = import_node_path28.default.relative(allowedDirectory, outputPath);
4437
+ const escapesAllowedDirectory = relativeOutputPath === "" || relativeOutputPath === ".." || relativeOutputPath.startsWith(`..${import_node_path28.default.sep}`) || import_node_path28.default.isAbsolute(relativeOutputPath);
4438
+ if (hasUnsafePathSyntax || escapesAllowedDirectory) {
4439
+ throw new Error(`Artifact path "${artifact.target}" escapes its allowed output directory`);
4440
+ }
4441
+ return outputPath;
4442
+ };
4443
+ var replaceDirectory = async (stagingDirectory, outDir) => {
4444
+ const backupDirectory = `${outDir}.backup-${(0, import_node_crypto3.randomUUID)()}`;
4445
+ let hasBackup = false;
4446
+ try {
4447
+ await import_promises20.default.rename(outDir, backupDirectory);
4448
+ hasBackup = true;
4449
+ } catch (error) {
4450
+ if (error.code !== "ENOENT") throw error;
4451
+ }
4452
+ try {
4453
+ await import_promises20.default.rename(stagingDirectory, outDir);
4454
+ } catch (error) {
4455
+ if (hasBackup) await import_promises20.default.rename(backupDirectory, outDir);
4456
+ throw error;
4457
+ }
4458
+ if (hasBackup) await import_promises20.default.rm(backupDirectory, { recursive: true, force: true });
3897
4459
  };
3898
- var versionDiagram = (directory) => async (id) => versionResource(directory, id);
3899
- var diagramHasVersion = (directory) => async (id, version) => {
3900
- const file = await findFileById(directory, id, version);
3901
- return !!file;
4460
+ async function hydrate(graph, options) {
4461
+ const result = {
4462
+ fetched: 0,
4463
+ written: 0,
4464
+ referenced: 0
4465
+ };
4466
+ const artifacts = [];
4467
+ for (const entity of graph.entities) {
4468
+ const { source, commit } = entity.resolvedFrom;
4469
+ if (source === options.localSource) continue;
4470
+ if (options.modes?.[source] === "reference") {
4471
+ result.referenced++;
4472
+ continue;
4473
+ }
4474
+ if (!entity.contentPath) continue;
4475
+ artifacts.push({
4476
+ source,
4477
+ commit,
4478
+ path: entity.contentPath,
4479
+ hash: entity.contentHash,
4480
+ target: entity.contentPath
4481
+ });
4482
+ const entityDirectory = import_node_path28.default.posix.dirname(entity.contentPath);
4483
+ for (const schema of entity.schemas ?? []) {
4484
+ if (!schema.path) continue;
4485
+ const artifactPath = import_node_path28.default.posix.join(entityDirectory, schema.path);
4486
+ artifacts.push({ source, commit, path: artifactPath, hash: schema.hash, target: artifactPath });
4487
+ }
4488
+ for (const specification of entity.specifications ?? []) {
4489
+ const artifactPath = import_node_path28.default.posix.join(entityDirectory, specification.path);
4490
+ artifacts.push({ source, commit, path: artifactPath, hash: specification.hash, target: artifactPath });
4491
+ }
4492
+ for (const sidecar of entity.sidecars ?? []) {
4493
+ artifacts.push({ source, commit, path: sidecar.path, hash: sidecar.hash, target: sidecar.path });
4494
+ }
4495
+ }
4496
+ for (const asset of graph.assets) {
4497
+ const { source, commit } = asset.resolvedFrom;
4498
+ if (source === options.localSource || options.modes?.[source] === "reference") continue;
4499
+ artifacts.push({
4500
+ source,
4501
+ commit,
4502
+ path: asset.path,
4503
+ hash: asset.hash,
4504
+ target: asset.path,
4505
+ shared: true
4506
+ });
4507
+ }
4508
+ for (const artifact of artifacts) getArtifactOutputPath(artifact, options.outDir);
4509
+ if (artifacts.length === 0) {
4510
+ await import_promises20.default.rm(options.outDir, { recursive: true, force: true });
4511
+ return result;
4512
+ }
4513
+ const resolvedOutDir = import_node_path28.default.resolve(options.outDir);
4514
+ const outDirParent = import_node_path28.default.dirname(resolvedOutDir);
4515
+ await import_promises20.default.mkdir(outDirParent, { recursive: true });
4516
+ const stagingDirectory = await import_promises20.default.mkdtemp(import_node_path28.default.join(outDirParent, `.${import_node_path28.default.basename(resolvedOutDir)}.staging-`));
4517
+ try {
4518
+ for (const artifact of artifacts) {
4519
+ let content = artifact.hash ? await options.cache?.get(artifact.hash) : void 0;
4520
+ if (content !== void 0 && artifact.hash && getContentHash(content) !== artifact.hash) {
4521
+ content = void 0;
4522
+ }
4523
+ if (content === void 0) {
4524
+ content = await options.fetch({
4525
+ source: artifact.source,
4526
+ commit: artifact.commit,
4527
+ path: artifact.path
4528
+ });
4529
+ result.fetched++;
4530
+ if (artifact.hash) {
4531
+ const actualHash = getContentHash(content);
4532
+ if (actualHash !== artifact.hash) {
4533
+ throw new Error(
4534
+ `Content hash mismatch for "${artifact.source}/${artifact.path}": expected "${artifact.hash}", received "${actualHash}"`
4535
+ );
4536
+ }
4537
+ await options.cache?.set(artifact.hash, content);
4538
+ }
4539
+ }
4540
+ const outputPath = getArtifactOutputPath(artifact, stagingDirectory);
4541
+ await import_promises20.default.mkdir(import_node_path28.default.dirname(outputPath), { recursive: true });
4542
+ await import_promises20.default.writeFile(outputPath, content);
4543
+ result.written++;
4544
+ }
4545
+ await replaceDirectory(stagingDirectory, resolvedOutDir);
4546
+ } catch (error) {
4547
+ await import_promises20.default.rm(stagingDirectory, { recursive: true, force: true });
4548
+ throw error;
4549
+ }
4550
+ return result;
4551
+ }
4552
+
4553
+ // src/parse-index.ts
4554
+ var import_zod = require("zod");
4555
+ var InvalidIndexError = class extends Error {
4556
+ constructor(issues) {
4557
+ super(
4558
+ [
4559
+ "Invalid federation index",
4560
+ ...issues.map(({ path: path11, message }) => `${path11.length ? path11.join(".") : "<root>"}: ${message}`)
4561
+ ].join("\n")
4562
+ );
4563
+ this.name = "InvalidIndexError";
4564
+ this.issues = issues;
4565
+ }
4566
+ };
4567
+ var nonEmptyString = import_zod.z.string().min(1);
4568
+ var contentHash = import_zod.z.string().regex(/^sha256:[a-f0-9]{64}$/, "Expected a full sha256 digest");
4569
+ var ResourcePointerSchema = import_zod.z.object({
4570
+ id: nonEmptyString,
4571
+ version: nonEmptyString.optional(),
4572
+ type: nonEmptyString.optional()
4573
+ }).strict();
4574
+ var ChannelPointerSchema = ResourcePointerSchema.extend({
4575
+ label: import_zod.z.string().optional(),
4576
+ direction: import_zod.z.enum(["inbound", "outbound"]).optional(),
4577
+ parameters: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional()
4578
+ });
4579
+ var ChannelParametersSchema = import_zod.z.record(
4580
+ import_zod.z.string(),
4581
+ import_zod.z.object({
4582
+ enum: import_zod.z.array(import_zod.z.string()).optional(),
4583
+ default: import_zod.z.string().optional(),
4584
+ examples: import_zod.z.array(import_zod.z.string()).optional()
4585
+ }).strict()
4586
+ );
4587
+ var TriggerPointerSchema = import_zod.z.object({
4588
+ id: nonEmptyString,
4589
+ version: nonEmptyString.optional(),
4590
+ condition: import_zod.z.string().optional()
4591
+ }).strict();
4592
+ var SendsPointerSchema = import_zod.z.object({
4593
+ id: nonEmptyString,
4594
+ version: nonEmptyString.optional(),
4595
+ fields: import_zod.z.array(import_zod.z.string()).optional(),
4596
+ to: import_zod.z.array(ChannelPointerSchema).optional(),
4597
+ group: import_zod.z.string().optional()
4598
+ }).strict();
4599
+ var ReceivesPointerSchema = import_zod.z.object({
4600
+ id: nonEmptyString,
4601
+ version: nonEmptyString.optional(),
4602
+ fields: import_zod.z.array(import_zod.z.string()).optional(),
4603
+ from: import_zod.z.array(ChannelPointerSchema).optional(),
4604
+ group: import_zod.z.string().optional(),
4605
+ triggers: import_zod.z.array(TriggerPointerSchema).optional()
4606
+ }).strict();
4607
+ var SystemRelationshipPointerSchema = import_zod.z.object({
4608
+ id: nonEmptyString,
4609
+ version: nonEmptyString.optional(),
4610
+ label: import_zod.z.string().optional()
4611
+ }).strict();
4612
+ var SystemActorRelationshipSchema = import_zod.z.object({
4613
+ id: nonEmptyString,
4614
+ name: import_zod.z.string().optional(),
4615
+ label: import_zod.z.string().optional(),
4616
+ direction: import_zod.z.enum(["inbound", "outbound"]).optional()
4617
+ }).strict();
4618
+ var IndexSchemaPointerSchema = import_zod.z.object({
4619
+ id: import_zod.z.string().optional(),
4620
+ ref: import_zod.z.string().optional(),
4621
+ path: import_zod.z.string().optional(),
4622
+ name: import_zod.z.string().optional(),
4623
+ format: import_zod.z.string().optional(),
4624
+ environments: import_zod.z.array(import_zod.z.string()).optional(),
4625
+ default: import_zod.z.boolean().optional(),
4626
+ hash: contentHash.optional()
4627
+ }).strict();
4628
+ var IndexSpecificationSchema = import_zod.z.object({
4629
+ type: import_zod.z.enum(["openapi", "asyncapi", "graphql"]),
4630
+ path: nonEmptyString,
4631
+ name: import_zod.z.string().optional(),
4632
+ hash: contentHash.optional()
4633
+ }).strict();
4634
+ var IndexSidecarSchema = import_zod.z.object({
4635
+ path: nonEmptyString,
4636
+ hash: contentHash.optional()
4637
+ }).strict();
4638
+ var IndexAssetSchema = import_zod.z.object({
4639
+ path: nonEmptyString,
4640
+ hash: contentHash.optional()
4641
+ }).strict();
4642
+ var IndexReferenceSchema = ResourcePointerSchema.extend({
4643
+ kind: import_zod.z.enum(["agent", "container", "data-product", "flow", "message", "service"])
4644
+ });
4645
+ var AdrPointerSchema = import_zod.z.object({
4646
+ id: nonEmptyString,
4647
+ version: nonEmptyString.optional()
4648
+ }).strict();
4649
+ var AdrResourcePointerSchema = AdrPointerSchema.extend({
4650
+ type: import_zod.z.enum([
4651
+ "agent",
4652
+ "service",
4653
+ "event",
4654
+ "command",
4655
+ "query",
4656
+ "flow",
4657
+ "channel",
4658
+ "domain",
4659
+ "system",
4660
+ "user",
4661
+ "team",
4662
+ "container",
4663
+ "entity",
4664
+ "diagram",
4665
+ "data-product"
4666
+ ])
4667
+ });
4668
+ var DataProductOutputPointerSchema = import_zod.z.object({
4669
+ id: nonEmptyString,
4670
+ version: nonEmptyString.optional(),
4671
+ contract: import_zod.z.object({
4672
+ path: nonEmptyString,
4673
+ name: nonEmptyString,
4674
+ type: import_zod.z.string().optional()
4675
+ }).strict().optional()
4676
+ }).strict();
4677
+ var UserMemberSchema = import_zod.z.object({
4678
+ id: nonEmptyString,
4679
+ name: nonEmptyString,
4680
+ avatarUrl: import_zod.z.string().optional(),
4681
+ role: import_zod.z.string().optional(),
4682
+ hidden: import_zod.z.boolean().optional(),
4683
+ source: import_zod.z.object({
4684
+ provider: nonEmptyString,
4685
+ id: import_zod.z.string().optional(),
4686
+ url: import_zod.z.string().optional()
4687
+ }).strict().optional(),
4688
+ readOnly: import_zod.z.boolean().optional(),
4689
+ email: import_zod.z.string().optional(),
4690
+ slackDirectMessageUrl: import_zod.z.string().optional(),
4691
+ markdown: import_zod.z.string()
4692
+ }).passthrough();
4693
+ var IndexResourceSchema = import_zod.z.object({
4694
+ type: import_zod.z.enum([
4695
+ "adr",
4696
+ "agent",
4697
+ "channel",
4698
+ "command",
4699
+ "container",
4700
+ "data-product",
4701
+ "diagram",
4702
+ "domain",
4703
+ "entity",
4704
+ "event",
4705
+ "flow",
4706
+ "query",
4707
+ "service",
4708
+ "system",
4709
+ "team",
4710
+ "user"
4711
+ ]),
4712
+ id: nonEmptyString,
4713
+ version: nonEmptyString.optional(),
4714
+ name: nonEmptyString,
4715
+ contentPath: nonEmptyString,
4716
+ contentHash: contentHash.optional(),
4717
+ draft: import_zod.z.union([import_zod.z.boolean(), import_zod.z.object({ title: import_zod.z.string().optional(), message: import_zod.z.string().optional() }).strict()]).optional(),
4718
+ deprecated: import_zod.z.union([import_zod.z.boolean(), import_zod.z.object({ date: import_zod.z.string().optional(), message: import_zod.z.string().optional() }).strict()]).optional(),
4719
+ owners: import_zod.z.array(import_zod.z.string()).optional(),
4720
+ diagrams: import_zod.z.array(ResourcePointerSchema).optional(),
4721
+ schemas: import_zod.z.array(IndexSchemaPointerSchema).optional(),
4722
+ specifications: import_zod.z.array(IndexSpecificationSchema).optional(),
4723
+ sidecars: import_zod.z.array(IndexSidecarSchema).optional(),
4724
+ container_type: import_zod.z.enum(["database", "cache", "objectStore", "searchIndex", "dataWarehouse", "dataLake", "externalSaaS", "other"]).optional(),
4725
+ references: import_zod.z.array(IndexReferenceSchema).optional(),
4726
+ sends: import_zod.z.array(SendsPointerSchema).optional(),
4727
+ receives: import_zod.z.array(ReceivesPointerSchema).optional(),
4728
+ channels: import_zod.z.array(ChannelPointerSchema).optional(),
4729
+ address: import_zod.z.string().optional(),
4730
+ protocols: import_zod.z.array(import_zod.z.string()).optional(),
4731
+ deliveryGuarantee: import_zod.z.enum(["at-most-once", "at-least-once", "exactly-once"]).optional(),
4732
+ routes: import_zod.z.array(ChannelPointerSchema).optional(),
4733
+ parameters: ChannelParametersSchema.optional(),
4734
+ services: import_zod.z.array(ResourcePointerSchema).optional(),
4735
+ agents: import_zod.z.array(ResourcePointerSchema).optional(),
4736
+ domains: import_zod.z.array(ResourcePointerSchema).optional(),
4737
+ systems: import_zod.z.array(ResourcePointerSchema).optional(),
4738
+ entities: import_zod.z.array(ResourcePointerSchema).optional(),
4739
+ dataProducts: import_zod.z.array(ResourcePointerSchema).optional(),
4740
+ flows: import_zod.z.array(ResourcePointerSchema).optional(),
4741
+ writesTo: import_zod.z.array(ResourcePointerSchema).optional(),
4742
+ readsFrom: import_zod.z.array(ResourcePointerSchema).optional(),
4743
+ containers: import_zod.z.array(ResourcePointerSchema).optional(),
4744
+ relationships: import_zod.z.array(SystemRelationshipPointerSchema).optional(),
4745
+ actors: import_zod.z.array(SystemActorRelationshipSchema).optional(),
4746
+ inputs: import_zod.z.array(ResourcePointerSchema).optional(),
4747
+ outputs: import_zod.z.array(DataProductOutputPointerSchema).optional(),
4748
+ status: import_zod.z.enum(["proposed", "accepted", "rejected", "deprecated", "superseded"]).optional(),
4749
+ appliesTo: import_zod.z.array(AdrResourcePointerSchema).optional(),
4750
+ supersedes: import_zod.z.array(AdrPointerSchema).optional(),
4751
+ supersededBy: import_zod.z.array(AdrPointerSchema).optional(),
4752
+ amends: import_zod.z.array(AdrPointerSchema).optional(),
4753
+ amendedBy: import_zod.z.array(AdrPointerSchema).optional(),
4754
+ related: import_zod.z.array(AdrPointerSchema).optional(),
4755
+ members: import_zod.z.union([import_zod.z.array(import_zod.z.string()), import_zod.z.array(UserMemberSchema)]).optional()
4756
+ }).strict();
4757
+ var FederationIndexSchema = import_zod.z.object({
4758
+ indexVersion: import_zod.z.literal(1),
4759
+ source: nonEmptyString,
4760
+ commit: nonEmptyString,
4761
+ resources: import_zod.z.array(IndexResourceSchema),
4762
+ assets: import_zod.z.array(IndexAssetSchema).optional()
4763
+ }).strict();
4764
+ var parseIndex = (input) => {
4765
+ const result = FederationIndexSchema.safeParse(input);
4766
+ if (!result.success) {
4767
+ throw new InvalidIndexError(
4768
+ result.error.issues.map((issue) => ({
4769
+ path: issue.path.map((segment) => typeof segment === "symbol" ? segment.toString() : segment),
4770
+ message: issue.message
4771
+ }))
4772
+ );
4773
+ }
4774
+ return result.data;
3902
4775
  };
3903
- var addFileToDiagram = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version, { type: "diagram" });
3904
4776
 
3905
4777
  // src/index.ts
3906
- var src_default = (path9) => {
4778
+ var src_default = (path11) => {
3907
4779
  return {
3908
4780
  /**
3909
4781
  * Returns an events from EventCatalog
@@ -3911,13 +4783,13 @@ var src_default = (path9) => {
3911
4783
  * @param version - Optional id of the version to get (supports semver)
3912
4784
  * @returns Event|Undefined
3913
4785
  */
3914
- getEvent: getEvent((0, import_node_path27.join)(path9)),
4786
+ getEvent: getEvent((0, import_node_path29.join)(path11)),
3915
4787
  /**
3916
4788
  * Returns all events from EventCatalog
3917
4789
  * @param latestOnly - optional boolean, set to true to get only latest versions
3918
4790
  * @returns Event[]|Undefined
3919
4791
  */
3920
- getEvents: getEvents((0, import_node_path27.join)(path9)),
4792
+ getEvents: getEvents((0, import_node_path29.join)(path11)),
3921
4793
  /**
3922
4794
  * Adds an event to EventCatalog
3923
4795
  *
@@ -3925,7 +4797,7 @@ var src_default = (path9) => {
3925
4797
  * @param options - Optional options to write the event
3926
4798
  *
3927
4799
  */
3928
- writeEvent: writeEvent((0, import_node_path27.join)(path9, "events")),
4800
+ writeEvent: writeEvent((0, import_node_path29.join)(path11, "events")),
3929
4801
  /**
3930
4802
  * Adds an event to a service in EventCatalog
3931
4803
  *
@@ -3934,7 +4806,7 @@ var src_default = (path9) => {
3934
4806
  * @param options - Optional options to write the event
3935
4807
  *
3936
4808
  */
3937
- writeEventToService: writeEventToService((0, import_node_path27.join)(path9)),
4809
+ writeEventToService: writeEventToService((0, import_node_path29.join)(path11)),
3938
4810
  /**
3939
4811
  * Adds an event to an agent in EventCatalog
3940
4812
  *
@@ -3943,26 +4815,26 @@ var src_default = (path9) => {
3943
4815
  * @param options - Optional options to write the event
3944
4816
  *
3945
4817
  */
3946
- writeEventToAgent: writeEventToAgent((0, import_node_path27.join)(path9)),
4818
+ writeEventToAgent: writeEventToAgent((0, import_node_path29.join)(path11)),
3947
4819
  /**
3948
4820
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
3949
4821
  *
3950
4822
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
3951
4823
  *
3952
4824
  */
3953
- rmEvent: rmEvent((0, import_node_path27.join)(path9, "events")),
4825
+ rmEvent: rmEvent((0, import_node_path29.join)(path11, "events")),
3954
4826
  /**
3955
4827
  * Remove an event by an Event id
3956
4828
  *
3957
4829
  * @param id - The id of the event you want to remove
3958
4830
  *
3959
4831
  */
3960
- rmEventById: rmEventById((0, import_node_path27.join)(path9)),
4832
+ rmEventById: rmEventById((0, import_node_path29.join)(path11)),
3961
4833
  /**
3962
4834
  * Moves a given event id to the version directory
3963
4835
  * @param directory
3964
4836
  */
3965
- versionEvent: versionEvent((0, import_node_path27.join)(path9)),
4837
+ versionEvent: versionEvent((0, import_node_path29.join)(path11)),
3966
4838
  /**
3967
4839
  * Adds a file to the given event
3968
4840
  * @param id - The id of the event to add the file to
@@ -3970,7 +4842,7 @@ var src_default = (path9) => {
3970
4842
  * @param version - Optional version of the event to add the file to
3971
4843
  * @returns
3972
4844
  */
3973
- addFileToEvent: addFileToEvent((0, import_node_path27.join)(path9)),
4845
+ addFileToEvent: addFileToEvent((0, import_node_path29.join)(path11)),
3974
4846
  /**
3975
4847
  * Adds a schema to the given event
3976
4848
  * @param id - The id of the event to add the schema to
@@ -3978,17 +4850,17 @@ var src_default = (path9) => {
3978
4850
  * @param version - Optional version of the event to add the schema to
3979
4851
  * @returns
3980
4852
  */
3981
- addSchemaToEvent: addSchemaToEvent((0, import_node_path27.join)(path9)),
4853
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path29.join)(path11)),
3982
4854
  /**
3983
4855
  * Check to see if an event version exists
3984
4856
  * @param id - The id of the event
3985
4857
  * @param version - The version of the event (supports semver)
3986
4858
  * @returns
3987
4859
  */
3988
- eventHasVersion: eventHasVersion((0, import_node_path27.join)(path9)),
3989
- addExampleToEvent: addExampleToEvent((0, import_node_path27.join)(path9)),
3990
- getExamplesFromEvent: getExamplesFromEvent((0, import_node_path27.join)(path9)),
3991
- removeExampleFromEvent: removeExampleFromEvent((0, import_node_path27.join)(path9)),
4860
+ eventHasVersion: eventHasVersion((0, import_node_path29.join)(path11)),
4861
+ addExampleToEvent: addExampleToEvent((0, import_node_path29.join)(path11)),
4862
+ getExamplesFromEvent: getExamplesFromEvent((0, import_node_path29.join)(path11)),
4863
+ removeExampleFromEvent: removeExampleFromEvent((0, import_node_path29.join)(path11)),
3992
4864
  /**
3993
4865
  * ================================
3994
4866
  * Commands
@@ -4000,13 +4872,13 @@ var src_default = (path9) => {
4000
4872
  * @param version - Optional id of the version to get (supports semver)
4001
4873
  * @returns Command|Undefined
4002
4874
  */
4003
- getCommand: getCommand((0, import_node_path27.join)(path9)),
4875
+ getCommand: getCommand((0, import_node_path29.join)(path11)),
4004
4876
  /**
4005
4877
  * Returns all commands from EventCatalog
4006
4878
  * @param latestOnly - optional boolean, set to true to get only latest versions
4007
4879
  * @returns Command[]|Undefined
4008
4880
  */
4009
- getCommands: getCommands((0, import_node_path27.join)(path9)),
4881
+ getCommands: getCommands((0, import_node_path29.join)(path11)),
4010
4882
  /**
4011
4883
  * Adds an command to EventCatalog
4012
4884
  *
@@ -4014,7 +4886,7 @@ var src_default = (path9) => {
4014
4886
  * @param options - Optional options to write the command
4015
4887
  *
4016
4888
  */
4017
- writeCommand: writeCommand((0, import_node_path27.join)(path9, "commands")),
4889
+ writeCommand: writeCommand((0, import_node_path29.join)(path11, "commands")),
4018
4890
  /**
4019
4891
  * Adds a command to a service in EventCatalog
4020
4892
  *
@@ -4023,7 +4895,7 @@ var src_default = (path9) => {
4023
4895
  * @param options - Optional options to write the command
4024
4896
  *
4025
4897
  */
4026
- writeCommandToService: writeCommandToService((0, import_node_path27.join)(path9)),
4898
+ writeCommandToService: writeCommandToService((0, import_node_path29.join)(path11)),
4027
4899
  /**
4028
4900
  * Adds a command to an agent in EventCatalog
4029
4901
  *
@@ -4032,26 +4904,26 @@ var src_default = (path9) => {
4032
4904
  * @param options - Optional options to write the command
4033
4905
  *
4034
4906
  */
4035
- writeCommandToAgent: writeCommandToAgent((0, import_node_path27.join)(path9)),
4907
+ writeCommandToAgent: writeCommandToAgent((0, import_node_path29.join)(path11)),
4036
4908
  /**
4037
4909
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
4038
4910
  *
4039
4911
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
4040
4912
  *
4041
4913
  */
4042
- rmCommand: rmCommand((0, import_node_path27.join)(path9, "commands")),
4914
+ rmCommand: rmCommand((0, import_node_path29.join)(path11, "commands")),
4043
4915
  /**
4044
4916
  * Remove an command by an Event id
4045
4917
  *
4046
4918
  * @param id - The id of the command you want to remove
4047
4919
  *
4048
4920
  */
4049
- rmCommandById: rmCommandById((0, import_node_path27.join)(path9)),
4921
+ rmCommandById: rmCommandById((0, import_node_path29.join)(path11)),
4050
4922
  /**
4051
4923
  * Moves a given command id to the version directory
4052
4924
  * @param directory
4053
4925
  */
4054
- versionCommand: versionCommand((0, import_node_path27.join)(path9)),
4926
+ versionCommand: versionCommand((0, import_node_path29.join)(path11)),
4055
4927
  /**
4056
4928
  * Adds a file to the given command
4057
4929
  * @param id - The id of the command to add the file to
@@ -4059,7 +4931,7 @@ var src_default = (path9) => {
4059
4931
  * @param version - Optional version of the command to add the file to
4060
4932
  * @returns
4061
4933
  */
4062
- addFileToCommand: addFileToCommand((0, import_node_path27.join)(path9)),
4934
+ addFileToCommand: addFileToCommand((0, import_node_path29.join)(path11)),
4063
4935
  /**
4064
4936
  * Adds a schema to the given command
4065
4937
  * @param id - The id of the command to add the schema to
@@ -4067,17 +4939,17 @@ var src_default = (path9) => {
4067
4939
  * @param version - Optional version of the command to add the schema to
4068
4940
  * @returns
4069
4941
  */
4070
- addSchemaToCommand: addSchemaToCommand((0, import_node_path27.join)(path9)),
4942
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path29.join)(path11)),
4071
4943
  /**
4072
4944
  * Check to see if a command version exists
4073
4945
  * @param id - The id of the command
4074
4946
  * @param version - The version of the command (supports semver)
4075
4947
  * @returns
4076
4948
  */
4077
- commandHasVersion: commandHasVersion((0, import_node_path27.join)(path9)),
4078
- addExampleToCommand: addExampleToCommand((0, import_node_path27.join)(path9)),
4079
- getExamplesFromCommand: getExamplesFromCommand((0, import_node_path27.join)(path9)),
4080
- removeExampleFromCommand: removeExampleFromCommand((0, import_node_path27.join)(path9)),
4949
+ commandHasVersion: commandHasVersion((0, import_node_path29.join)(path11)),
4950
+ addExampleToCommand: addExampleToCommand((0, import_node_path29.join)(path11)),
4951
+ getExamplesFromCommand: getExamplesFromCommand((0, import_node_path29.join)(path11)),
4952
+ removeExampleFromCommand: removeExampleFromCommand((0, import_node_path29.join)(path11)),
4081
4953
  /**
4082
4954
  * ================================
4083
4955
  * Queries
@@ -4089,13 +4961,13 @@ var src_default = (path9) => {
4089
4961
  * @param version - Optional id of the version to get (supports semver)
4090
4962
  * @returns Query|Undefined
4091
4963
  */
4092
- getQuery: getQuery((0, import_node_path27.join)(path9)),
4964
+ getQuery: getQuery((0, import_node_path29.join)(path11)),
4093
4965
  /**
4094
4966
  * Returns all queries from EventCatalog
4095
4967
  * @param latestOnly - optional boolean, set to true to get only latest versions
4096
4968
  * @returns Query[]|Undefined
4097
4969
  */
4098
- getQueries: getQueries((0, import_node_path27.join)(path9)),
4970
+ getQueries: getQueries((0, import_node_path29.join)(path11)),
4099
4971
  /**
4100
4972
  * Adds a query to EventCatalog
4101
4973
  *
@@ -4103,7 +4975,7 @@ var src_default = (path9) => {
4103
4975
  * @param options - Optional options to write the event
4104
4976
  *
4105
4977
  */
4106
- writeQuery: writeQuery((0, import_node_path27.join)(path9, "queries")),
4978
+ writeQuery: writeQuery((0, import_node_path29.join)(path11, "queries")),
4107
4979
  /**
4108
4980
  * Adds a query to a service in EventCatalog
4109
4981
  *
@@ -4112,7 +4984,7 @@ var src_default = (path9) => {
4112
4984
  * @param options - Optional options to write the query
4113
4985
  *
4114
4986
  */
4115
- writeQueryToService: writeQueryToService((0, import_node_path27.join)(path9)),
4987
+ writeQueryToService: writeQueryToService((0, import_node_path29.join)(path11)),
4116
4988
  /**
4117
4989
  * Adds a query to an agent in EventCatalog
4118
4990
  *
@@ -4121,26 +4993,26 @@ var src_default = (path9) => {
4121
4993
  * @param options - Optional options to write the query
4122
4994
  *
4123
4995
  */
4124
- writeQueryToAgent: writeQueryToAgent((0, import_node_path27.join)(path9)),
4996
+ writeQueryToAgent: writeQueryToAgent((0, import_node_path29.join)(path11)),
4125
4997
  /**
4126
4998
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
4127
4999
  *
4128
5000
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
4129
5001
  *
4130
5002
  */
4131
- rmQuery: rmQuery((0, import_node_path27.join)(path9, "queries")),
5003
+ rmQuery: rmQuery((0, import_node_path29.join)(path11, "queries")),
4132
5004
  /**
4133
5005
  * Remove a query by a Query id
4134
5006
  *
4135
5007
  * @param id - The id of the query you want to remove
4136
5008
  *
4137
5009
  */
4138
- rmQueryById: rmQueryById((0, import_node_path27.join)(path9)),
5010
+ rmQueryById: rmQueryById((0, import_node_path29.join)(path11)),
4139
5011
  /**
4140
5012
  * Moves a given query id to the version directory
4141
5013
  * @param directory
4142
5014
  */
4143
- versionQuery: versionQuery((0, import_node_path27.join)(path9)),
5015
+ versionQuery: versionQuery((0, import_node_path29.join)(path11)),
4144
5016
  /**
4145
5017
  * Adds a file to the given query
4146
5018
  * @param id - The id of the query to add the file to
@@ -4148,7 +5020,7 @@ var src_default = (path9) => {
4148
5020
  * @param version - Optional version of the query to add the file to
4149
5021
  * @returns
4150
5022
  */
4151
- addFileToQuery: addFileToQuery((0, import_node_path27.join)(path9)),
5023
+ addFileToQuery: addFileToQuery((0, import_node_path29.join)(path11)),
4152
5024
  /**
4153
5025
  * Adds a schema to the given query
4154
5026
  * @param id - The id of the query to add the schema to
@@ -4156,17 +5028,17 @@ var src_default = (path9) => {
4156
5028
  * @param version - Optional version of the query to add the schema to
4157
5029
  * @returns
4158
5030
  */
4159
- addSchemaToQuery: addSchemaToQuery((0, import_node_path27.join)(path9)),
5031
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path29.join)(path11)),
4160
5032
  /**
4161
5033
  * Check to see if an query version exists
4162
5034
  * @param id - The id of the query
4163
5035
  * @param version - The version of the query (supports semver)
4164
5036
  * @returns
4165
5037
  */
4166
- queryHasVersion: queryHasVersion((0, import_node_path27.join)(path9)),
4167
- addExampleToQuery: addExampleToQuery((0, import_node_path27.join)(path9)),
4168
- getExamplesFromQuery: getExamplesFromQuery((0, import_node_path27.join)(path9)),
4169
- removeExampleFromQuery: removeExampleFromQuery((0, import_node_path27.join)(path9)),
5038
+ queryHasVersion: queryHasVersion((0, import_node_path29.join)(path11)),
5039
+ addExampleToQuery: addExampleToQuery((0, import_node_path29.join)(path11)),
5040
+ getExamplesFromQuery: getExamplesFromQuery((0, import_node_path29.join)(path11)),
5041
+ removeExampleFromQuery: removeExampleFromQuery((0, import_node_path29.join)(path11)),
4170
5042
  /**
4171
5043
  * ================================
4172
5044
  * Channels
@@ -4178,13 +5050,13 @@ var src_default = (path9) => {
4178
5050
  * @param version - Optional id of the version to get (supports semver)
4179
5051
  * @returns Channel|Undefined
4180
5052
  */
4181
- getChannel: getChannel((0, import_node_path27.join)(path9)),
5053
+ getChannel: getChannel((0, import_node_path29.join)(path11)),
4182
5054
  /**
4183
5055
  * Returns all channels from EventCatalog
4184
5056
  * @param latestOnly - optional boolean, set to true to get only latest versions
4185
5057
  * @returns Channel[]|Undefined
4186
5058
  */
4187
- getChannels: getChannels((0, import_node_path27.join)(path9)),
5059
+ getChannels: getChannels((0, import_node_path29.join)(path11)),
4188
5060
  /**
4189
5061
  * Adds an channel to EventCatalog
4190
5062
  *
@@ -4192,33 +5064,33 @@ var src_default = (path9) => {
4192
5064
  * @param options - Optional options to write the channel
4193
5065
  *
4194
5066
  */
4195
- writeChannel: writeChannel((0, import_node_path27.join)(path9, "channels")),
5067
+ writeChannel: writeChannel((0, import_node_path29.join)(path11, "channels")),
4196
5068
  /**
4197
5069
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
4198
5070
  *
4199
5071
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
4200
5072
  *
4201
5073
  */
4202
- rmChannel: rmChannel((0, import_node_path27.join)(path9, "channels")),
5074
+ rmChannel: rmChannel((0, import_node_path29.join)(path11, "channels")),
4203
5075
  /**
4204
5076
  * Remove an channel by an Event id
4205
5077
  *
4206
5078
  * @param id - The id of the channel you want to remove
4207
5079
  *
4208
5080
  */
4209
- rmChannelById: rmChannelById((0, import_node_path27.join)(path9)),
5081
+ rmChannelById: rmChannelById((0, import_node_path29.join)(path11)),
4210
5082
  /**
4211
5083
  * Moves a given channel id to the version directory
4212
5084
  * @param directory
4213
5085
  */
4214
- versionChannel: versionChannel((0, import_node_path27.join)(path9)),
5086
+ versionChannel: versionChannel((0, import_node_path29.join)(path11)),
4215
5087
  /**
4216
5088
  * Check to see if a channel version exists
4217
5089
  * @param id - The id of the channel
4218
5090
  * @param version - The version of the channel (supports semver)
4219
5091
  * @returns
4220
5092
  */
4221
- channelHasVersion: channelHasVersion((0, import_node_path27.join)(path9)),
5093
+ channelHasVersion: channelHasVersion((0, import_node_path29.join)(path11)),
4222
5094
  /**
4223
5095
  * Add a channel to an event
4224
5096
  *
@@ -4235,7 +5107,7 @@ var src_default = (path9) => {
4235
5107
  *
4236
5108
  * ```
4237
5109
  */
4238
- addEventToChannel: addMessageToChannel((0, import_node_path27.join)(path9), "events"),
5110
+ addEventToChannel: addMessageToChannel((0, import_node_path29.join)(path11), "events"),
4239
5111
  /**
4240
5112
  * Add a channel to an command
4241
5113
  *
@@ -4252,7 +5124,7 @@ var src_default = (path9) => {
4252
5124
  *
4253
5125
  * ```
4254
5126
  */
4255
- addCommandToChannel: addMessageToChannel((0, import_node_path27.join)(path9), "commands"),
5127
+ addCommandToChannel: addMessageToChannel((0, import_node_path29.join)(path11), "commands"),
4256
5128
  /**
4257
5129
  * Add a channel to an query
4258
5130
  *
@@ -4269,7 +5141,7 @@ var src_default = (path9) => {
4269
5141
  *
4270
5142
  * ```
4271
5143
  */
4272
- addQueryToChannel: addMessageToChannel((0, import_node_path27.join)(path9), "queries"),
5144
+ addQueryToChannel: addMessageToChannel((0, import_node_path29.join)(path11), "queries"),
4273
5145
  /**
4274
5146
  * ================================
4275
5147
  * SERVICES
@@ -4282,14 +5154,14 @@ var src_default = (path9) => {
4282
5154
  * @param options - Optional options to write the event
4283
5155
  *
4284
5156
  */
4285
- writeService: writeService((0, import_node_path27.join)(path9, "services")),
5157
+ writeService: writeService((0, import_node_path29.join)(path11, "services")),
4286
5158
  /**
4287
5159
  * Adds a versioned service to EventCatalog
4288
5160
  *
4289
5161
  * @param service - The service to write
4290
5162
  *
4291
5163
  */
4292
- writeVersionedService: writeVersionedService((0, import_node_path27.join)(path9, "services")),
5164
+ writeVersionedService: writeVersionedService((0, import_node_path29.join)(path11, "services")),
4293
5165
  /**
4294
5166
  * Adds a service to a domain in EventCatalog
4295
5167
  *
@@ -4298,7 +5170,7 @@ var src_default = (path9) => {
4298
5170
  * @param options - Optional options to write the event
4299
5171
  *
4300
5172
  */
4301
- writeServiceToDomain: writeServiceToDomain((0, import_node_path27.join)(path9, "domains")),
5173
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path29.join)(path11, "domains")),
4302
5174
  /**
4303
5175
  * Adds a service to a system in EventCatalog
4304
5176
  *
@@ -4307,45 +5179,45 @@ var src_default = (path9) => {
4307
5179
  * @param options - Optional options to write the service
4308
5180
  *
4309
5181
  */
4310
- writeServiceToSystem: writeServiceToSystem((0, import_node_path27.join)(path9)),
5182
+ writeServiceToSystem: writeServiceToSystem((0, import_node_path29.join)(path11)),
4311
5183
  /**
4312
5184
  * Returns a service from EventCatalog
4313
5185
  * @param id - The id of the service to retrieve
4314
5186
  * @param version - Optional id of the version to get (supports semver)
4315
5187
  * @returns Service|Undefined
4316
5188
  */
4317
- getService: getService((0, import_node_path27.join)(path9)),
5189
+ getService: getService((0, import_node_path29.join)(path11)),
4318
5190
  /**
4319
5191
  * Returns a service from EventCatalog by it's path.
4320
5192
  * @param path - The path to the service to retrieve
4321
5193
  * @returns Service|Undefined
4322
5194
  */
4323
- getServiceByPath: getServiceByPath((0, import_node_path27.join)(path9)),
5195
+ getServiceByPath: getServiceByPath((0, import_node_path29.join)(path11)),
4324
5196
  /**
4325
5197
  * Returns all services from EventCatalog
4326
5198
  * @param latestOnly - optional boolean, set to true to get only latest versions
4327
5199
  * @returns Service[]|Undefined
4328
5200
  */
4329
- getServices: getServices((0, import_node_path27.join)(path9)),
5201
+ getServices: getServices((0, import_node_path29.join)(path11)),
4330
5202
  /**
4331
5203
  * Moves a given service id to the version directory
4332
5204
  * @param directory
4333
5205
  */
4334
- versionService: versionService((0, import_node_path27.join)(path9)),
5206
+ versionService: versionService((0, import_node_path29.join)(path11)),
4335
5207
  /**
4336
5208
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
4337
5209
  *
4338
5210
  * @param path - The path to your service, e.g. `/InventoryService`
4339
5211
  *
4340
5212
  */
4341
- rmService: rmService((0, import_node_path27.join)(path9, "services")),
5213
+ rmService: rmService((0, import_node_path29.join)(path11, "services")),
4342
5214
  /**
4343
5215
  * Remove an service by an service id
4344
5216
  *
4345
5217
  * @param id - The id of the service you want to remove
4346
5218
  *
4347
5219
  */
4348
- rmServiceById: rmServiceById((0, import_node_path27.join)(path9)),
5220
+ rmServiceById: rmServiceById((0, import_node_path29.join)(path11)),
4349
5221
  /**
4350
5222
  * Adds a file to the given service
4351
5223
  * @param id - The id of the service to add the file to
@@ -4353,21 +5225,21 @@ var src_default = (path9) => {
4353
5225
  * @param version - Optional version of the service to add the file to
4354
5226
  * @returns
4355
5227
  */
4356
- addFileToService: addFileToService((0, import_node_path27.join)(path9)),
5228
+ addFileToService: addFileToService((0, import_node_path29.join)(path11)),
4357
5229
  /**
4358
5230
  * Returns the specifications for a given service
4359
5231
  * @param id - The id of the service to retrieve the specifications for
4360
5232
  * @param version - Optional version of the service
4361
5233
  * @returns
4362
5234
  */
4363
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path27.join)(path9)),
5235
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path29.join)(path11)),
4364
5236
  /**
4365
5237
  * Check to see if a service version exists
4366
5238
  * @param id - The id of the service
4367
5239
  * @param version - The version of the service (supports semver)
4368
5240
  * @returns
4369
5241
  */
4370
- serviceHasVersion: serviceHasVersion((0, import_node_path27.join)(path9)),
5242
+ serviceHasVersion: serviceHasVersion((0, import_node_path29.join)(path11)),
4371
5243
  /**
4372
5244
  * Add an event to a service by it's id.
4373
5245
  *
@@ -4387,7 +5259,7 @@ var src_default = (path9) => {
4387
5259
  *
4388
5260
  * ```
4389
5261
  */
4390
- addEventToService: addMessageToService((0, import_node_path27.join)(path9)),
5262
+ addEventToService: addMessageToService((0, import_node_path29.join)(path11)),
4391
5263
  /**
4392
5264
  * Add a data store to a service by it's id.
4393
5265
  *
@@ -4404,7 +5276,7 @@ var src_default = (path9) => {
4404
5276
  *
4405
5277
  * ```
4406
5278
  */
4407
- addDataStoreToService: addDataStoreToService((0, import_node_path27.join)(path9)),
5279
+ addDataStoreToService: addDataStoreToService((0, import_node_path29.join)(path11)),
4408
5280
  /**
4409
5281
  * Add a command to a service by it's id.
4410
5282
  *
@@ -4424,7 +5296,7 @@ var src_default = (path9) => {
4424
5296
  *
4425
5297
  * ```
4426
5298
  */
4427
- addCommandToService: addMessageToService((0, import_node_path27.join)(path9)),
5299
+ addCommandToService: addMessageToService((0, import_node_path29.join)(path11)),
4428
5300
  /**
4429
5301
  * Add a query to a service by it's id.
4430
5302
  *
@@ -4444,7 +5316,7 @@ var src_default = (path9) => {
4444
5316
  *
4445
5317
  * ```
4446
5318
  */
4447
- addQueryToService: addMessageToService((0, import_node_path27.join)(path9)),
5319
+ addQueryToService: addMessageToService((0, import_node_path29.join)(path11)),
4448
5320
  /**
4449
5321
  * Add an entity to a service by its id.
4450
5322
  *
@@ -4462,7 +5334,7 @@ var src_default = (path9) => {
4462
5334
  *
4463
5335
  * ```
4464
5336
  */
4465
- addEntityToService: addEntityToService((0, import_node_path27.join)(path9)),
5337
+ addEntityToService: addEntityToService((0, import_node_path29.join)(path11)),
4466
5338
  /**
4467
5339
  * Check to see if a service exists by it's path.
4468
5340
  *
@@ -4479,57 +5351,57 @@ var src_default = (path9) => {
4479
5351
  * @param path - The path to the service to check
4480
5352
  * @returns boolean
4481
5353
  */
4482
- isService: isService((0, import_node_path27.join)(path9)),
5354
+ isService: isService((0, import_node_path29.join)(path11)),
4483
5355
  /**
4484
5356
  * Converts a file to a service.
4485
5357
  * @param file - The file to convert to a service.
4486
5358
  * @returns The service.
4487
5359
  */
4488
- toService: toService((0, import_node_path27.join)(path9)),
5360
+ toService: toService((0, import_node_path29.join)(path11)),
4489
5361
  /**
4490
5362
  * ================================
4491
5363
  * Systems
4492
5364
  * ================================
4493
5365
  */
4494
- writeSystem: writeSystem((0, import_node_path27.join)(path9, "systems")),
4495
- writeSystemToDomain: writeSystemToDomain((0, import_node_path27.join)(path9)),
4496
- getSystem: getSystem((0, import_node_path27.join)(path9)),
4497
- getSystemByPath: getSystemByPath((0, import_node_path27.join)(path9)),
4498
- getSystems: getSystems((0, import_node_path27.join)(path9)),
4499
- versionSystem: versionSystem((0, import_node_path27.join)(path9)),
4500
- rmSystem: rmSystem((0, import_node_path27.join)(path9, "systems")),
4501
- rmSystemById: rmSystemById((0, import_node_path27.join)(path9)),
4502
- addFileToSystem: addFileToSystem((0, import_node_path27.join)(path9)),
4503
- addServiceToSystem: addServiceToSystem((0, import_node_path27.join)(path9)),
4504
- addFlowToSystem: addFlowToSystem((0, import_node_path27.join)(path9)),
4505
- addEntityToSystem: addEntityToSystem((0, import_node_path27.join)(path9)),
4506
- addContainerToSystem: addContainerToSystem((0, import_node_path27.join)(path9)),
4507
- systemHasVersion: systemHasVersion((0, import_node_path27.join)(path9)),
4508
- isSystem: isSystem((0, import_node_path27.join)(path9)),
4509
- toSystem: toSystem((0, import_node_path27.join)(path9)),
5366
+ writeSystem: writeSystem((0, import_node_path29.join)(path11, "systems")),
5367
+ writeSystemToDomain: writeSystemToDomain((0, import_node_path29.join)(path11)),
5368
+ getSystem: getSystem((0, import_node_path29.join)(path11)),
5369
+ getSystemByPath: getSystemByPath((0, import_node_path29.join)(path11)),
5370
+ getSystems: getSystems((0, import_node_path29.join)(path11)),
5371
+ versionSystem: versionSystem((0, import_node_path29.join)(path11)),
5372
+ rmSystem: rmSystem((0, import_node_path29.join)(path11, "systems")),
5373
+ rmSystemById: rmSystemById((0, import_node_path29.join)(path11)),
5374
+ addFileToSystem: addFileToSystem((0, import_node_path29.join)(path11)),
5375
+ addServiceToSystem: addServiceToSystem((0, import_node_path29.join)(path11)),
5376
+ addFlowToSystem: addFlowToSystem((0, import_node_path29.join)(path11)),
5377
+ addEntityToSystem: addEntityToSystem((0, import_node_path29.join)(path11)),
5378
+ addContainerToSystem: addContainerToSystem((0, import_node_path29.join)(path11)),
5379
+ systemHasVersion: systemHasVersion((0, import_node_path29.join)(path11)),
5380
+ isSystem: isSystem((0, import_node_path29.join)(path11)),
5381
+ toSystem: toSystem((0, import_node_path29.join)(path11)),
4510
5382
  /**
4511
5383
  * ================================
4512
5384
  * Agents
4513
5385
  * ================================
4514
5386
  */
4515
- writeAgent: writeAgent((0, import_node_path27.join)(path9, "agents")),
4516
- writeVersionedAgent: writeVersionedAgent((0, import_node_path27.join)(path9, "agents")),
4517
- writeAgentToDomain: writeAgentToDomain((0, import_node_path27.join)(path9, "domains")),
4518
- getAgent: getAgent((0, import_node_path27.join)(path9)),
4519
- getAgentByPath: getAgentByPath((0, import_node_path27.join)(path9)),
4520
- getAgents: getAgents((0, import_node_path27.join)(path9)),
4521
- versionAgent: versionAgent((0, import_node_path27.join)(path9)),
4522
- rmAgent: rmAgent((0, import_node_path27.join)(path9, "agents")),
4523
- rmAgentById: rmAgentById((0, import_node_path27.join)(path9)),
4524
- addFileToAgent: addFileToAgent((0, import_node_path27.join)(path9)),
4525
- addEventToAgent: addMessageToAgent((0, import_node_path27.join)(path9)),
4526
- addCommandToAgent: addMessageToAgent((0, import_node_path27.join)(path9)),
4527
- addQueryToAgent: addMessageToAgent((0, import_node_path27.join)(path9)),
4528
- addDataStoreToAgent: addDataStoreToAgent((0, import_node_path27.join)(path9)),
4529
- addFlowToAgent: addFlowToAgent((0, import_node_path27.join)(path9)),
4530
- agentHasVersion: agentHasVersion((0, import_node_path27.join)(path9)),
4531
- isAgent: isAgent((0, import_node_path27.join)(path9)),
4532
- toAgent: toAgent((0, import_node_path27.join)(path9)),
5387
+ writeAgent: writeAgent((0, import_node_path29.join)(path11, "agents")),
5388
+ writeVersionedAgent: writeVersionedAgent((0, import_node_path29.join)(path11, "agents")),
5389
+ writeAgentToDomain: writeAgentToDomain((0, import_node_path29.join)(path11, "domains")),
5390
+ getAgent: getAgent((0, import_node_path29.join)(path11)),
5391
+ getAgentByPath: getAgentByPath((0, import_node_path29.join)(path11)),
5392
+ getAgents: getAgents((0, import_node_path29.join)(path11)),
5393
+ versionAgent: versionAgent((0, import_node_path29.join)(path11)),
5394
+ rmAgent: rmAgent((0, import_node_path29.join)(path11, "agents")),
5395
+ rmAgentById: rmAgentById((0, import_node_path29.join)(path11)),
5396
+ addFileToAgent: addFileToAgent((0, import_node_path29.join)(path11)),
5397
+ addEventToAgent: addMessageToAgent((0, import_node_path29.join)(path11)),
5398
+ addCommandToAgent: addMessageToAgent((0, import_node_path29.join)(path11)),
5399
+ addQueryToAgent: addMessageToAgent((0, import_node_path29.join)(path11)),
5400
+ addDataStoreToAgent: addDataStoreToAgent((0, import_node_path29.join)(path11)),
5401
+ addFlowToAgent: addFlowToAgent((0, import_node_path29.join)(path11)),
5402
+ agentHasVersion: agentHasVersion((0, import_node_path29.join)(path11)),
5403
+ isAgent: isAgent((0, import_node_path29.join)(path11)),
5404
+ toAgent: toAgent((0, import_node_path29.join)(path11)),
4533
5405
  /**
4534
5406
  * ================================
4535
5407
  * Domains
@@ -4542,39 +5414,39 @@ var src_default = (path9) => {
4542
5414
  * @param options - Optional options to write the event
4543
5415
  *
4544
5416
  */
4545
- writeDomain: writeDomain((0, import_node_path27.join)(path9, "domains")),
5417
+ writeDomain: writeDomain((0, import_node_path29.join)(path11, "domains")),
4546
5418
  /**
4547
5419
  * Returns a domain from EventCatalog
4548
5420
  * @param id - The id of the domain to retrieve
4549
5421
  * @param version - Optional id of the version to get (supports semver)
4550
5422
  * @returns Domain|Undefined
4551
5423
  */
4552
- getDomain: getDomain((0, import_node_path27.join)(path9, "domains")),
5424
+ getDomain: getDomain((0, import_node_path29.join)(path11, "domains")),
4553
5425
  /**
4554
5426
  * Returns all domains from EventCatalog
4555
5427
  * @param latestOnly - optional boolean, set to true to get only latest versions
4556
5428
  * @returns Domain[]|Undefined
4557
5429
  */
4558
- getDomains: getDomains((0, import_node_path27.join)(path9)),
5430
+ getDomains: getDomains((0, import_node_path29.join)(path11)),
4559
5431
  /**
4560
5432
  * Moves a given domain id to the version directory
4561
5433
  * @param directory
4562
5434
  */
4563
- versionDomain: versionDomain((0, import_node_path27.join)(path9, "domains")),
5435
+ versionDomain: versionDomain((0, import_node_path29.join)(path11, "domains")),
4564
5436
  /**
4565
5437
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
4566
5438
  *
4567
5439
  * @param path - The path to your domain, e.g. `/Payment`
4568
5440
  *
4569
5441
  */
4570
- rmDomain: rmDomain((0, import_node_path27.join)(path9, "domains")),
5442
+ rmDomain: rmDomain((0, import_node_path29.join)(path11, "domains")),
4571
5443
  /**
4572
5444
  * Remove an service by an domain id
4573
5445
  *
4574
5446
  * @param id - The id of the domain you want to remove
4575
5447
  *
4576
5448
  */
4577
- rmDomainById: rmDomainById((0, import_node_path27.join)(path9, "domains")),
5449
+ rmDomainById: rmDomainById((0, import_node_path29.join)(path11, "domains")),
4578
5450
  /**
4579
5451
  * Adds a file to the given domain
4580
5452
  * @param id - The id of the domain to add the file to
@@ -4582,28 +5454,28 @@ var src_default = (path9) => {
4582
5454
  * @param version - Optional version of the domain to add the file to
4583
5455
  * @returns
4584
5456
  */
4585
- addFileToDomain: addFileToDomain((0, import_node_path27.join)(path9, "domains")),
5457
+ addFileToDomain: addFileToDomain((0, import_node_path29.join)(path11, "domains")),
4586
5458
  /**
4587
5459
  * Adds an ubiquitous language dictionary to a domain
4588
5460
  * @param id - The id of the domain to add the ubiquitous language to
4589
5461
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
4590
5462
  * @param version - Optional version of the domain to add the ubiquitous language to
4591
5463
  */
4592
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path27.join)(path9, "domains")),
5464
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path29.join)(path11, "domains")),
4593
5465
  /**
4594
5466
  * Get the ubiquitous language dictionary from a domain
4595
5467
  * @param id - The id of the domain to get the ubiquitous language from
4596
5468
  * @param version - Optional version of the domain to get the ubiquitous language from
4597
5469
  * @returns
4598
5470
  */
4599
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path27.join)(path9, "domains")),
5471
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path29.join)(path11, "domains")),
4600
5472
  /**
4601
5473
  * Check to see if a domain version exists
4602
5474
  * @param id - The id of the domain
4603
5475
  * @param version - The version of the domain (supports semver)
4604
5476
  * @returns
4605
5477
  */
4606
- domainHasVersion: domainHasVersion((0, import_node_path27.join)(path9)),
5478
+ domainHasVersion: domainHasVersion((0, import_node_path29.join)(path11)),
4607
5479
  /**
4608
5480
  * Adds a given service to a domain
4609
5481
  * @param id - The id of the domain
@@ -4611,7 +5483,7 @@ var src_default = (path9) => {
4611
5483
  * @param version - (Optional) The version of the domain to add the service to
4612
5484
  * @returns
4613
5485
  */
4614
- addServiceToDomain: addServiceToDomain((0, import_node_path27.join)(path9, "domains")),
5486
+ addServiceToDomain: addServiceToDomain((0, import_node_path29.join)(path11, "domains")),
4615
5487
  /**
4616
5488
  * Adds a given agent to a domain
4617
5489
  * @param id - The id of the domain
@@ -4619,7 +5491,7 @@ var src_default = (path9) => {
4619
5491
  * @param version - (Optional) The version of the domain to add the agent to
4620
5492
  * @returns
4621
5493
  */
4622
- addAgentToDomain: addAgentToDomain((0, import_node_path27.join)(path9, "domains")),
5494
+ addAgentToDomain: addAgentToDomain((0, import_node_path29.join)(path11, "domains")),
4623
5495
  /**
4624
5496
  * Adds a given subdomain to a domain
4625
5497
  * @param id - The id of the domain
@@ -4627,7 +5499,7 @@ var src_default = (path9) => {
4627
5499
  * @param version - (Optional) The version of the domain to add the subdomain to
4628
5500
  * @returns
4629
5501
  */
4630
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path27.join)(path9, "domains")),
5502
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path29.join)(path11, "domains")),
4631
5503
  /**
4632
5504
  * Adds a given system to a domain
4633
5505
  * @param id - The id of the domain
@@ -4635,7 +5507,7 @@ var src_default = (path9) => {
4635
5507
  * @param version - (Optional) The version of the domain to add the system to
4636
5508
  * @returns
4637
5509
  */
4638
- addSystemToDomain: addSystemToDomain((0, import_node_path27.join)(path9, "domains")),
5510
+ addSystemToDomain: addSystemToDomain((0, import_node_path29.join)(path11, "domains")),
4639
5511
  /**
4640
5512
  * Adds an entity to a domain
4641
5513
  * @param id - The id of the domain
@@ -4643,7 +5515,7 @@ var src_default = (path9) => {
4643
5515
  * @param version - (Optional) The version of the domain to add the entity to
4644
5516
  * @returns
4645
5517
  */
4646
- addEntityToDomain: addEntityToDomain((0, import_node_path27.join)(path9, "domains")),
5518
+ addEntityToDomain: addEntityToDomain((0, import_node_path29.join)(path11, "domains")),
4647
5519
  /**
4648
5520
  * Add an event to a domain by its id.
4649
5521
  *
@@ -4661,7 +5533,7 @@ var src_default = (path9) => {
4661
5533
  *
4662
5534
  * ```
4663
5535
  */
4664
- addEventToDomain: addMessageToDomain((0, import_node_path27.join)(path9, "domains")),
5536
+ addEventToDomain: addMessageToDomain((0, import_node_path29.join)(path11, "domains")),
4665
5537
  /**
4666
5538
  * Add a command to a domain by its id.
4667
5539
  *
@@ -4679,7 +5551,7 @@ var src_default = (path9) => {
4679
5551
  *
4680
5552
  * ```
4681
5553
  */
4682
- addCommandToDomain: addMessageToDomain((0, import_node_path27.join)(path9, "domains")),
5554
+ addCommandToDomain: addMessageToDomain((0, import_node_path29.join)(path11, "domains")),
4683
5555
  /**
4684
5556
  * Add a query to a domain by its id.
4685
5557
  *
@@ -4697,7 +5569,7 @@ var src_default = (path9) => {
4697
5569
  *
4698
5570
  * ```
4699
5571
  */
4700
- addQueryToDomain: addMessageToDomain((0, import_node_path27.join)(path9, "domains")),
5572
+ addQueryToDomain: addMessageToDomain((0, import_node_path29.join)(path11, "domains")),
4701
5573
  /**
4702
5574
  * ================================
4703
5575
  * Teams
@@ -4710,25 +5582,25 @@ var src_default = (path9) => {
4710
5582
  * @param options - Optional options to write the team
4711
5583
  *
4712
5584
  */
4713
- writeTeam: writeTeam((0, import_node_path27.join)(path9, "teams")),
5585
+ writeTeam: writeTeam((0, import_node_path29.join)(path11, "teams")),
4714
5586
  /**
4715
5587
  * Returns a team from EventCatalog
4716
5588
  * @param id - The id of the team to retrieve
4717
5589
  * @returns Team|Undefined
4718
5590
  */
4719
- getTeam: getTeam((0, import_node_path27.join)(path9, "teams")),
5591
+ getTeam: getTeam((0, import_node_path29.join)(path11, "teams")),
4720
5592
  /**
4721
5593
  * Returns all teams from EventCatalog
4722
5594
  * @returns Team[]|Undefined
4723
5595
  */
4724
- getTeams: getTeams((0, import_node_path27.join)(path9, "teams")),
5596
+ getTeams: getTeams((0, import_node_path29.join)(path11, "teams")),
4725
5597
  /**
4726
5598
  * Remove a team by the team id
4727
5599
  *
4728
5600
  * @param id - The id of the team you want to remove
4729
5601
  *
4730
5602
  */
4731
- rmTeamById: rmTeamById((0, import_node_path27.join)(path9, "teams")),
5603
+ rmTeamById: rmTeamById((0, import_node_path29.join)(path11, "teams")),
4732
5604
  /**
4733
5605
  * ================================
4734
5606
  * Users
@@ -4741,25 +5613,25 @@ var src_default = (path9) => {
4741
5613
  * @param options - Optional options to write the user
4742
5614
  *
4743
5615
  */
4744
- writeUser: writeUser((0, import_node_path27.join)(path9, "users")),
5616
+ writeUser: writeUser((0, import_node_path29.join)(path11, "users")),
4745
5617
  /**
4746
5618
  * Returns a user from EventCatalog
4747
5619
  * @param id - The id of the user to retrieve
4748
5620
  * @returns User|Undefined
4749
5621
  */
4750
- getUser: getUser((0, import_node_path27.join)(path9, "users")),
5622
+ getUser: getUser((0, import_node_path29.join)(path11, "users")),
4751
5623
  /**
4752
5624
  * Returns all user from EventCatalog
4753
5625
  * @returns User[]|Undefined
4754
5626
  */
4755
- getUsers: getUsers((0, import_node_path27.join)(path9)),
5627
+ getUsers: getUsers((0, import_node_path29.join)(path11)),
4756
5628
  /**
4757
5629
  * Remove a user by the user id
4758
5630
  *
4759
5631
  * @param id - The id of the user you want to remove
4760
5632
  *
4761
5633
  */
4762
- rmUserById: rmUserById((0, import_node_path27.join)(path9, "users")),
5634
+ rmUserById: rmUserById((0, import_node_path29.join)(path11, "users")),
4763
5635
  /**
4764
5636
  * ================================
4765
5637
  * Custom Docs
@@ -4770,39 +5642,39 @@ var src_default = (path9) => {
4770
5642
  * @param path - The path to the custom doc to retrieve
4771
5643
  * @returns CustomDoc|Undefined
4772
5644
  */
4773
- getCustomDoc: getCustomDoc((0, import_node_path27.join)(path9, "docs")),
5645
+ getCustomDoc: getCustomDoc((0, import_node_path29.join)(path11, "docs")),
4774
5646
  /**
4775
5647
  * Returns all custom docs from EventCatalog
4776
5648
  * @param options - Optional options to get custom docs from a specific path
4777
5649
  * @returns CustomDoc[]|Undefined
4778
5650
  */
4779
- getCustomDocs: getCustomDocs((0, import_node_path27.join)(path9, "docs")),
5651
+ getCustomDocs: getCustomDocs((0, import_node_path29.join)(path11, "docs")),
4780
5652
  /**
4781
5653
  * Writes a custom doc to EventCatalog
4782
5654
  * @param customDoc - The custom doc to write
4783
5655
  * @param options - Optional options to write the custom doc
4784
5656
  *
4785
5657
  */
4786
- writeCustomDoc: writeCustomDoc((0, import_node_path27.join)(path9, "docs")),
5658
+ writeCustomDoc: writeCustomDoc((0, import_node_path29.join)(path11, "docs")),
4787
5659
  /**
4788
5660
  * Removes a custom doc from EventCatalog
4789
5661
  * @param path - The path to the custom doc to remove
4790
5662
  *
4791
5663
  */
4792
- rmCustomDoc: rmCustomDoc((0, import_node_path27.join)(path9, "docs")),
5664
+ rmCustomDoc: rmCustomDoc((0, import_node_path29.join)(path11, "docs")),
4793
5665
  /**
4794
5666
  * Dumps the catalog to a JSON file.
4795
5667
  * @param directory - The directory to dump the catalog to
4796
5668
  * @returns A JSON file with the catalog
4797
5669
  */
4798
- dumpCatalog: dumpCatalog((0, import_node_path27.join)(path9)),
5670
+ dumpCatalog: dumpCatalog((0, import_node_path29.join)(path11)),
4799
5671
  /**
4800
5672
  * Returns the resources reachable from a catalog resource.
4801
5673
  * @param root - Resource to use as the root of the graph
4802
5674
  * @param options - Traversal depth and whether to return a flat resource list
4803
5675
  * @returns The resolved graph, or undefined when the root does not exist
4804
5676
  */
4805
- getGraph: getGraph((0, import_node_path27.join)(path9)),
5677
+ getGraph: getGraph((0, import_node_path29.join)(path11)),
4806
5678
  /**
4807
5679
  * Returns the event catalog configuration file.
4808
5680
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -4810,7 +5682,7 @@ var src_default = (path9) => {
4810
5682
  * @param directory - The directory of the catalog.
4811
5683
  * @returns A JSON object with the configuration for the event catalog.
4812
5684
  */
4813
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path27.join)(path9)),
5685
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path29.join)(path11)),
4814
5686
  /**
4815
5687
  * ================================
4816
5688
  * Changelogs
@@ -4824,7 +5696,7 @@ var src_default = (path9) => {
4824
5696
  * @param options - Optional options (version, format)
4825
5697
  *
4826
5698
  */
4827
- writeChangelog: writeChangelog((0, import_node_path27.join)(path9)),
5699
+ writeChangelog: writeChangelog((0, import_node_path29.join)(path11)),
4828
5700
  /**
4829
5701
  * Appends a changelog entry to an existing changelog for a resource.
4830
5702
  * If no changelog exists, one is created.
@@ -4834,7 +5706,7 @@ var src_default = (path9) => {
4834
5706
  * @param options - Optional options (version, format)
4835
5707
  *
4836
5708
  */
4837
- appendChangelog: appendChangelog((0, import_node_path27.join)(path9)),
5709
+ appendChangelog: appendChangelog((0, import_node_path29.join)(path11)),
4838
5710
  /**
4839
5711
  * Returns the changelog for a resource in EventCatalog
4840
5712
  *
@@ -4842,7 +5714,7 @@ var src_default = (path9) => {
4842
5714
  * @param options - Optional options (version)
4843
5715
  * @returns Changelog|Undefined
4844
5716
  */
4845
- getChangelog: getChangelog((0, import_node_path27.join)(path9)),
5717
+ getChangelog: getChangelog((0, import_node_path29.join)(path11)),
4846
5718
  /**
4847
5719
  * Removes the changelog for a resource in EventCatalog
4848
5720
  *
@@ -4850,7 +5722,7 @@ var src_default = (path9) => {
4850
5722
  * @param options - Optional options (version)
4851
5723
  *
4852
5724
  */
4853
- rmChangelog: rmChangelog((0, import_node_path27.join)(path9)),
5725
+ rmChangelog: rmChangelog((0, import_node_path29.join)(path11)),
4854
5726
  /**
4855
5727
  * ================================
4856
5728
  * Resources Utils
@@ -4879,26 +5751,26 @@ var src_default = (path9) => {
4879
5751
  * @param path - The path to the message to retrieve
4880
5752
  * @returns Message|Undefined
4881
5753
  */
4882
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path27.join)(path9)),
5754
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path29.join)(path11)),
4883
5755
  /**
4884
5756
  * Returns the producers and consumers (services and agents) for a given message
4885
5757
  * @param id - The id of the message to get the producers and consumers for
4886
5758
  * @param version - Optional version of the message
4887
5759
  * @returns { producers: (Service|Agent)[], consumers: (Service|Agent)[] }
4888
5760
  */
4889
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path27.join)(path9)),
5761
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path29.join)(path11)),
4890
5762
  /**
4891
5763
  * Returns the consumers of a given schema path
4892
5764
  * @param path - The path to the schema to get the consumers for
4893
5765
  * @returns (Service|Agent)[]
4894
5766
  */
4895
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path27.join)(path9)),
5767
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path29.join)(path11)),
4896
5768
  /**
4897
5769
  * Returns the producers of a given schema path
4898
5770
  * @param path - The path to the schema to get the producers for
4899
5771
  * @returns (Service|Agent)[]
4900
5772
  */
4901
- getProducersOfSchema: getProducersOfSchema((0, import_node_path27.join)(path9)),
5773
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path29.join)(path11)),
4902
5774
  /**
4903
5775
  * Returns the schema for a given message (event, command or query) by its id and version.
4904
5776
  * If no version is given, the latest version is used.
@@ -4906,14 +5778,14 @@ var src_default = (path9) => {
4906
5778
  * @param version - Optional version of the message
4907
5779
  * @returns { schema: string, fileName: string } | undefined
4908
5780
  */
4909
- getSchemaForMessage: getSchemaForMessage((0, import_node_path27.join)(path9)),
5781
+ getSchemaForMessage: getSchemaForMessage((0, import_node_path29.join)(path11)),
4910
5782
  /**
4911
5783
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
4912
5784
  * @param id - The id of the resource to get the owners for
4913
5785
  * @param version - Optional version of the resource
4914
5786
  * @returns { owners: User[] }
4915
5787
  */
4916
- getOwnersForResource: getOwnersForResource((0, import_node_path27.join)(path9)),
5788
+ getOwnersForResource: getOwnersForResource((0, import_node_path29.join)(path11)),
4917
5789
  /**
4918
5790
  * ================================
4919
5791
  * Entities
@@ -4925,13 +5797,13 @@ var src_default = (path9) => {
4925
5797
  * @param version - Optional id of the version to get (supports semver)
4926
5798
  * @returns Entity|Undefined
4927
5799
  */
4928
- getEntity: getEntity((0, import_node_path27.join)(path9)),
5800
+ getEntity: getEntity((0, import_node_path29.join)(path11)),
4929
5801
  /**
4930
5802
  * Returns all entities from EventCatalog
4931
5803
  * @param latestOnly - optional boolean, set to true to get only latest versions
4932
5804
  * @returns Entity[]|Undefined
4933
5805
  */
4934
- getEntities: getEntities((0, import_node_path27.join)(path9)),
5806
+ getEntities: getEntities((0, import_node_path29.join)(path11)),
4935
5807
  /**
4936
5808
  * Adds an entity to EventCatalog
4937
5809
  *
@@ -4939,7 +5811,7 @@ var src_default = (path9) => {
4939
5811
  * @param options - Optional options to write the entity
4940
5812
  *
4941
5813
  */
4942
- writeEntity: writeEntity((0, import_node_path27.join)(path9, "entities")),
5814
+ writeEntity: writeEntity((0, import_node_path29.join)(path11, "entities")),
4943
5815
  /**
4944
5816
  * Adds an entity to a system in EventCatalog
4945
5817
  *
@@ -4948,33 +5820,33 @@ var src_default = (path9) => {
4948
5820
  * @param options - Optional options to write the entity
4949
5821
  *
4950
5822
  */
4951
- writeEntityToSystem: writeEntityToSystem((0, import_node_path27.join)(path9)),
5823
+ writeEntityToSystem: writeEntityToSystem((0, import_node_path29.join)(path11)),
4952
5824
  /**
4953
5825
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
4954
5826
  *
4955
5827
  * @param path - The path to your entity, e.g. `/User`
4956
5828
  *
4957
5829
  */
4958
- rmEntity: rmEntity((0, import_node_path27.join)(path9, "entities")),
5830
+ rmEntity: rmEntity((0, import_node_path29.join)(path11, "entities")),
4959
5831
  /**
4960
5832
  * Remove an entity by an entity id
4961
5833
  *
4962
5834
  * @param id - The id of the entity you want to remove
4963
5835
  *
4964
5836
  */
4965
- rmEntityById: rmEntityById((0, import_node_path27.join)(path9)),
5837
+ rmEntityById: rmEntityById((0, import_node_path29.join)(path11)),
4966
5838
  /**
4967
5839
  * Moves a given entity id to the version directory
4968
5840
  * @param id - The id of the entity to version
4969
5841
  */
4970
- versionEntity: versionEntity((0, import_node_path27.join)(path9)),
5842
+ versionEntity: versionEntity((0, import_node_path29.join)(path11)),
4971
5843
  /**
4972
5844
  * Check to see if an entity version exists
4973
5845
  * @param id - The id of the entity
4974
5846
  * @param version - The version of the entity (supports semver)
4975
5847
  * @returns
4976
5848
  */
4977
- entityHasVersion: entityHasVersion((0, import_node_path27.join)(path9)),
5849
+ entityHasVersion: entityHasVersion((0, import_node_path29.join)(path11)),
4978
5850
  /**
4979
5851
  * ================================
4980
5852
  * Flows
@@ -4987,7 +5859,7 @@ var src_default = (path9) => {
4987
5859
  * @param version - Optional version of the flow
4988
5860
  * @returns Flow
4989
5861
  */
4990
- getFlow: getFlow((0, import_node_path27.join)(path9)),
5862
+ getFlow: getFlow((0, import_node_path29.join)(path11)),
4991
5863
  /**
4992
5864
  * Returns all flows from EventCatalog
4993
5865
  *
@@ -4995,7 +5867,7 @@ var src_default = (path9) => {
4995
5867
  * @param latestOnly - optional boolean, set to true to get only latest versions
4996
5868
  * @returns Flow[]|Undefined
4997
5869
  */
4998
- getFlows: getFlows((0, import_node_path27.join)(path9)),
5870
+ getFlows: getFlows((0, import_node_path29.join)(path11)),
4999
5871
  /**
5000
5872
  * Adds a flow to EventCatalog
5001
5873
  *
@@ -5003,14 +5875,14 @@ var src_default = (path9) => {
5003
5875
  * @param options - Optional options to write the flow
5004
5876
  *
5005
5877
  */
5006
- writeFlow: writeFlow((0, import_node_path27.join)(path9, "flows")),
5878
+ writeFlow: writeFlow((0, import_node_path29.join)(path11, "flows")),
5007
5879
  /**
5008
5880
  * Adds a versioned flow to EventCatalog
5009
5881
  *
5010
5882
  * @param flow - The flow to write
5011
5883
  *
5012
5884
  */
5013
- writeVersionedFlow: writeVersionedFlow((0, import_node_path27.join)(path9, "flows")),
5885
+ writeVersionedFlow: writeVersionedFlow((0, import_node_path29.join)(path11, "flows")),
5014
5886
  /**
5015
5887
  * Adds a flow to a domain in EventCatalog
5016
5888
  *
@@ -5019,7 +5891,7 @@ var src_default = (path9) => {
5019
5891
  * @param options - Optional options to write the flow
5020
5892
  *
5021
5893
  */
5022
- writeFlowToDomain: writeFlowToDomain((0, import_node_path27.join)(path9, "domains")),
5894
+ writeFlowToDomain: writeFlowToDomain((0, import_node_path29.join)(path11, "domains")),
5023
5895
  /**
5024
5896
  * Adds a flow to a service in EventCatalog
5025
5897
  *
@@ -5028,7 +5900,7 @@ var src_default = (path9) => {
5028
5900
  * @param options - Optional options to write the flow
5029
5901
  *
5030
5902
  */
5031
- writeFlowToService: writeFlowToService((0, import_node_path27.join)(path9, "services")),
5903
+ writeFlowToService: writeFlowToService((0, import_node_path29.join)(path11, "services")),
5032
5904
  /**
5033
5905
  * Adds a flow to a system in EventCatalog
5034
5906
  *
@@ -5037,7 +5909,7 @@ var src_default = (path9) => {
5037
5909
  * @param options - Optional options to write the flow
5038
5910
  *
5039
5911
  */
5040
- writeFlowToSystem: writeFlowToSystem((0, import_node_path27.join)(path9)),
5912
+ writeFlowToSystem: writeFlowToSystem((0, import_node_path29.join)(path11)),
5041
5913
  /**
5042
5914
  * Adds a flow to an agent in EventCatalog
5043
5915
  *
@@ -5046,33 +5918,33 @@ var src_default = (path9) => {
5046
5918
  * @param options - Optional options to write the flow
5047
5919
  *
5048
5920
  */
5049
- writeFlowToAgent: writeFlowToAgent((0, import_node_path27.join)(path9, "agents")),
5921
+ writeFlowToAgent: writeFlowToAgent((0, import_node_path29.join)(path11, "agents")),
5050
5922
  /**
5051
5923
  * Remove a flow from EventCatalog (modeled on the standard POSIX rm utility)
5052
5924
  *
5053
5925
  * @param path - The path to your flow, e.g. `/PaymentFlow`
5054
5926
  *
5055
5927
  */
5056
- rmFlow: rmFlow((0, import_node_path27.join)(path9, "flows")),
5928
+ rmFlow: rmFlow((0, import_node_path29.join)(path11, "flows")),
5057
5929
  /**
5058
5930
  * Remove a flow by a flow id
5059
5931
  *
5060
5932
  * @param id - The id of the flow you want to remove
5061
5933
  *
5062
5934
  */
5063
- rmFlowById: rmFlowById((0, import_node_path27.join)(path9)),
5935
+ rmFlowById: rmFlowById((0, import_node_path29.join)(path11)),
5064
5936
  /**
5065
5937
  * Moves a given flow id to the version directory
5066
5938
  * @param id - The id of the flow to version
5067
5939
  */
5068
- versionFlow: versionFlow((0, import_node_path27.join)(path9)),
5940
+ versionFlow: versionFlow((0, import_node_path29.join)(path11)),
5069
5941
  /**
5070
5942
  * Check to see if a flow version exists
5071
5943
  * @param id - The id of the flow
5072
5944
  * @param version - The version of the flow (supports semver)
5073
5945
  * @returns
5074
5946
  */
5075
- flowHasVersion: flowHasVersion((0, import_node_path27.join)(path9)),
5947
+ flowHasVersion: flowHasVersion((0, import_node_path29.join)(path11)),
5076
5948
  /**
5077
5949
  * Adds a file to the given flow
5078
5950
  * @param id - The id of the flow to add the file to
@@ -5080,7 +5952,7 @@ var src_default = (path9) => {
5080
5952
  * @param version - Optional version of the flow to add the file to
5081
5953
  * @returns
5082
5954
  */
5083
- addFileToFlow: addFileToFlow((0, import_node_path27.join)(path9)),
5955
+ addFileToFlow: addFileToFlow((0, import_node_path29.join)(path11)),
5084
5956
  /**
5085
5957
  * ================================
5086
5958
  * Data Stores
@@ -5092,42 +5964,42 @@ var src_default = (path9) => {
5092
5964
  * @param options - Optional options to write the data store
5093
5965
  *
5094
5966
  */
5095
- writeDataStore: writeDataStore((0, import_node_path27.join)(path9, "containers")),
5967
+ writeDataStore: writeDataStore((0, import_node_path29.join)(path11, "containers")),
5096
5968
  /**
5097
5969
  * Returns a data store from EventCatalog
5098
5970
  * @param id - The id of the data store to retrieve
5099
5971
  * @param version - Optional id of the version to get (supports semver)
5100
5972
  * @returns Container|Undefined
5101
5973
  */
5102
- getDataStore: getDataStore((0, import_node_path27.join)(path9)),
5974
+ getDataStore: getDataStore((0, import_node_path29.join)(path11)),
5103
5975
  /**
5104
5976
  * Returns all data stores from EventCatalog
5105
5977
  * @param latestOnly - optional boolean, set to true to get only latest versions
5106
5978
  * @returns Container[]|Undefined
5107
5979
  */
5108
- getDataStores: getDataStores((0, import_node_path27.join)(path9)),
5980
+ getDataStores: getDataStores((0, import_node_path29.join)(path11)),
5109
5981
  /**
5110
5982
  * Version a data store by its id
5111
5983
  * @param id - The id of the data store to version
5112
5984
  */
5113
- versionDataStore: versionDataStore((0, import_node_path27.join)(path9, "containers")),
5985
+ versionDataStore: versionDataStore((0, import_node_path29.join)(path11, "containers")),
5114
5986
  /**
5115
5987
  * Remove a data store by its path
5116
5988
  * @param path - The path to the data store to remove
5117
5989
  */
5118
- rmDataStore: rmDataStore((0, import_node_path27.join)(path9, "containers")),
5990
+ rmDataStore: rmDataStore((0, import_node_path29.join)(path11, "containers")),
5119
5991
  /**
5120
5992
  * Remove a data store by its id
5121
5993
  * @param id - The id of the data store to remove
5122
5994
  */
5123
- rmDataStoreById: rmDataStoreById((0, import_node_path27.join)(path9)),
5995
+ rmDataStoreById: rmDataStoreById((0, import_node_path29.join)(path11)),
5124
5996
  /**
5125
5997
  * Check to see if a data store version exists
5126
5998
  * @param id - The id of the data store
5127
5999
  * @param version - The version of the data store (supports semver)
5128
6000
  * @returns
5129
6001
  */
5130
- dataStoreHasVersion: dataStoreHasVersion((0, import_node_path27.join)(path9)),
6002
+ dataStoreHasVersion: dataStoreHasVersion((0, import_node_path29.join)(path11)),
5131
6003
  /**
5132
6004
  * Adds a file to a data store by its id
5133
6005
  * @param id - The id of the data store to add the file to
@@ -5135,21 +6007,21 @@ var src_default = (path9) => {
5135
6007
  * @param version - Optional version of the data store to add the file to
5136
6008
  * @returns
5137
6009
  */
5138
- addFileToDataStore: addFileToDataStore((0, import_node_path27.join)(path9)),
6010
+ addFileToDataStore: addFileToDataStore((0, import_node_path29.join)(path11)),
5139
6011
  /**
5140
6012
  * Writes a data store to a service by its id
5141
6013
  * @param dataStore - The data store to write
5142
6014
  * @param service - The service to write the data store to
5143
6015
  * @returns
5144
6016
  */
5145
- writeDataStoreToService: writeDataStoreToService((0, import_node_path27.join)(path9)),
6017
+ writeDataStoreToService: writeDataStoreToService((0, import_node_path29.join)(path11)),
5146
6018
  /**
5147
6019
  * Writes a data store to a system by its id
5148
6020
  * @param dataStore - The data store to write
5149
6021
  * @param system - The system to write the data store to
5150
6022
  * @returns
5151
6023
  */
5152
- writeDataStoreToSystem: writeDataStoreToSystem((0, import_node_path27.join)(path9)),
6024
+ writeDataStoreToSystem: writeDataStoreToSystem((0, import_node_path29.join)(path11)),
5153
6025
  /**
5154
6026
  * ================================
5155
6027
  * Data Products
@@ -5161,7 +6033,7 @@ var src_default = (path9) => {
5161
6033
  * @param options - Optional options to write the data product
5162
6034
  *
5163
6035
  */
5164
- writeDataProduct: writeDataProduct((0, import_node_path27.join)(path9, "data-products")),
6036
+ writeDataProduct: writeDataProduct((0, import_node_path29.join)(path11, "data-products")),
5165
6037
  /**
5166
6038
  * Writes a data product to a domain in EventCatalog
5167
6039
  * @param dataProduct - The data product to write
@@ -5169,43 +6041,43 @@ var src_default = (path9) => {
5169
6041
  * @param options - Optional options to write the data product
5170
6042
  *
5171
6043
  */
5172
- writeDataProductToDomain: writeDataProductToDomain((0, import_node_path27.join)(path9, "domains")),
6044
+ writeDataProductToDomain: writeDataProductToDomain((0, import_node_path29.join)(path11, "domains")),
5173
6045
  /**
5174
6046
  * Returns a data product from EventCatalog
5175
6047
  * @param id - The id of the data product to retrieve
5176
6048
  * @param version - Optional id of the version to get (supports semver)
5177
6049
  * @returns DataProduct|Undefined
5178
6050
  */
5179
- getDataProduct: getDataProduct((0, import_node_path27.join)(path9)),
6051
+ getDataProduct: getDataProduct((0, import_node_path29.join)(path11)),
5180
6052
  /**
5181
6053
  * Returns all data products from EventCatalog
5182
6054
  * @param latestOnly - optional boolean, set to true to get only latest versions
5183
6055
  * @returns DataProduct[]|Undefined
5184
6056
  */
5185
- getDataProducts: getDataProducts((0, import_node_path27.join)(path9)),
6057
+ getDataProducts: getDataProducts((0, import_node_path29.join)(path11)),
5186
6058
  /**
5187
6059
  * Version a data product by its id
5188
6060
  * @param id - The id of the data product to version
5189
6061
  */
5190
- versionDataProduct: versionDataProduct((0, import_node_path27.join)(path9)),
6062
+ versionDataProduct: versionDataProduct((0, import_node_path29.join)(path11)),
5191
6063
  /**
5192
6064
  * Remove a data product by its path
5193
6065
  * @param path - The path to the data product to remove
5194
6066
  */
5195
- rmDataProduct: rmDataProduct((0, import_node_path27.join)(path9, "data-products")),
6067
+ rmDataProduct: rmDataProduct((0, import_node_path29.join)(path11, "data-products")),
5196
6068
  /**
5197
6069
  * Remove a data product by its id
5198
6070
  * @param id - The id of the data product to remove
5199
6071
  * @param version - Optional version of the data product to remove
5200
6072
  */
5201
- rmDataProductById: rmDataProductById((0, import_node_path27.join)(path9)),
6073
+ rmDataProductById: rmDataProductById((0, import_node_path29.join)(path11)),
5202
6074
  /**
5203
6075
  * Check to see if a data product version exists
5204
6076
  * @param id - The id of the data product
5205
6077
  * @param version - The version of the data product (supports semver)
5206
6078
  * @returns
5207
6079
  */
5208
- dataProductHasVersion: dataProductHasVersion((0, import_node_path27.join)(path9)),
6080
+ dataProductHasVersion: dataProductHasVersion((0, import_node_path29.join)(path11)),
5209
6081
  /**
5210
6082
  * Adds a file to a data product by its id
5211
6083
  * @param id - The id of the data product to add the file to
@@ -5213,7 +6085,7 @@ var src_default = (path9) => {
5213
6085
  * @param version - Optional version of the data product to add the file to
5214
6086
  * @returns
5215
6087
  */
5216
- addFileToDataProduct: addFileToDataProduct((0, import_node_path27.join)(path9)),
6088
+ addFileToDataProduct: addFileToDataProduct((0, import_node_path29.join)(path11)),
5217
6089
  /**
5218
6090
  * Adds a data product to a domain
5219
6091
  * @param id - The id of the domain
@@ -5221,7 +6093,7 @@ var src_default = (path9) => {
5221
6093
  * @param version - (Optional) The version of the domain to add the data product to
5222
6094
  * @returns
5223
6095
  */
5224
- addDataProductToDomain: addDataProductToDomain((0, import_node_path27.join)(path9, "domains")),
6096
+ addDataProductToDomain: addDataProductToDomain((0, import_node_path29.join)(path11, "domains")),
5225
6097
  /**
5226
6098
  * ================================
5227
6099
  * Diagrams
@@ -5233,13 +6105,13 @@ var src_default = (path9) => {
5233
6105
  * @param version - Optional id of the version to get (supports semver)
5234
6106
  * @returns Diagram|Undefined
5235
6107
  */
5236
- getDiagram: getDiagram((0, import_node_path27.join)(path9)),
6108
+ getDiagram: getDiagram((0, import_node_path29.join)(path11)),
5237
6109
  /**
5238
6110
  * Returns all diagrams from EventCatalog
5239
6111
  * @param latestOnly - optional boolean, set to true to get only latest versions
5240
6112
  * @returns Diagram[]|Undefined
5241
6113
  */
5242
- getDiagrams: getDiagrams((0, import_node_path27.join)(path9)),
6114
+ getDiagrams: getDiagrams((0, import_node_path29.join)(path11)),
5243
6115
  /**
5244
6116
  * Adds a diagram to EventCatalog
5245
6117
  *
@@ -5247,33 +6119,33 @@ var src_default = (path9) => {
5247
6119
  * @param options - Optional options to write the diagram
5248
6120
  *
5249
6121
  */
5250
- writeDiagram: writeDiagram((0, import_node_path27.join)(path9, "diagrams")),
6122
+ writeDiagram: writeDiagram((0, import_node_path29.join)(path11, "diagrams")),
5251
6123
  /**
5252
6124
  * Remove a diagram from EventCatalog (modeled on the standard POSIX rm utility)
5253
6125
  *
5254
6126
  * @param path - The path to your diagram, e.g. `/ArchitectureDiagram`
5255
6127
  *
5256
6128
  */
5257
- rmDiagram: rmDiagram((0, import_node_path27.join)(path9, "diagrams")),
6129
+ rmDiagram: rmDiagram((0, import_node_path29.join)(path11, "diagrams")),
5258
6130
  /**
5259
6131
  * Remove a diagram by a diagram id
5260
6132
  *
5261
6133
  * @param id - The id of the diagram you want to remove
5262
6134
  *
5263
6135
  */
5264
- rmDiagramById: rmDiagramById((0, import_node_path27.join)(path9)),
6136
+ rmDiagramById: rmDiagramById((0, import_node_path29.join)(path11)),
5265
6137
  /**
5266
6138
  * Moves a given diagram id to the version directory
5267
6139
  * @param id - The id of the diagram to version
5268
6140
  */
5269
- versionDiagram: versionDiagram((0, import_node_path27.join)(path9)),
6141
+ versionDiagram: versionDiagram((0, import_node_path29.join)(path11)),
5270
6142
  /**
5271
6143
  * Check to see if a diagram version exists
5272
6144
  * @param id - The id of the diagram
5273
6145
  * @param version - The version of the diagram (supports semver)
5274
6146
  * @returns
5275
6147
  */
5276
- diagramHasVersion: diagramHasVersion((0, import_node_path27.join)(path9)),
6148
+ diagramHasVersion: diagramHasVersion((0, import_node_path29.join)(path11)),
5277
6149
  /**
5278
6150
  * Adds a file to the given diagram
5279
6151
  * @param id - The id of the diagram to add the file to
@@ -5281,20 +6153,20 @@ var src_default = (path9) => {
5281
6153
  * @param version - Optional version of the diagram to add the file to
5282
6154
  * @returns
5283
6155
  */
5284
- addFileToDiagram: addFileToDiagram((0, import_node_path27.join)(path9)),
6156
+ addFileToDiagram: addFileToDiagram((0, import_node_path29.join)(path11)),
5285
6157
  /**
5286
6158
  * ================================
5287
6159
  * ADRs
5288
6160
  * ================================
5289
6161
  */
5290
- getAdr: getAdr((0, import_node_path27.join)(path9)),
5291
- getAdrs: getAdrs((0, import_node_path27.join)(path9)),
5292
- writeAdr: writeAdr((0, import_node_path27.join)(path9, "adrs")),
5293
- rmAdr: rmAdr((0, import_node_path27.join)(path9, "adrs")),
5294
- rmAdrById: rmAdrById((0, import_node_path27.join)(path9)),
5295
- versionAdr: versionAdr((0, import_node_path27.join)(path9)),
5296
- adrHasVersion: adrHasVersion((0, import_node_path27.join)(path9)),
5297
- addFileToAdr: addFileToAdr((0, import_node_path27.join)(path9)),
6162
+ getAdr: getAdr((0, import_node_path29.join)(path11)),
6163
+ getAdrs: getAdrs((0, import_node_path29.join)(path11)),
6164
+ writeAdr: writeAdr((0, import_node_path29.join)(path11, "adrs")),
6165
+ rmAdr: rmAdr((0, import_node_path29.join)(path11, "adrs")),
6166
+ rmAdrById: rmAdrById((0, import_node_path29.join)(path11)),
6167
+ versionAdr: versionAdr((0, import_node_path29.join)(path11)),
6168
+ adrHasVersion: adrHasVersion((0, import_node_path29.join)(path11)),
6169
+ addFileToAdr: addFileToAdr((0, import_node_path29.join)(path11)),
5298
6170
  /**
5299
6171
  * ================================
5300
6172
  * DSL
@@ -5313,26 +6185,32 @@ var src_default = (path9) => {
5313
6185
  * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
5314
6186
  * ```
5315
6187
  */
5316
- createSnapshot: createSnapshot((0, import_node_path27.join)(path9)),
5317
- diffSnapshots: diffSnapshots((0, import_node_path27.join)(path9)),
5318
- listSnapshots: listSnapshots((0, import_node_path27.join)(path9)),
5319
- toDSL: toDSL((0, import_node_path27.join)(path9), {
5320
- getEvent: getEvent((0, import_node_path27.join)(path9)),
5321
- getCommand: getCommand((0, import_node_path27.join)(path9)),
5322
- getQuery: getQuery((0, import_node_path27.join)(path9)),
5323
- getService: getService((0, import_node_path27.join)(path9)),
5324
- getServices: getServices((0, import_node_path27.join)(path9)),
5325
- getDomain: getDomain((0, import_node_path27.join)(path9, "domains")),
5326
- getChannel: getChannel((0, import_node_path27.join)(path9)),
5327
- getChannels: getChannels((0, import_node_path27.join)(path9)),
5328
- getContainer: getDataStore((0, import_node_path27.join)(path9)),
5329
- getTeam: getTeam((0, import_node_path27.join)(path9, "teams")),
5330
- getUser: getUser((0, import_node_path27.join)(path9, "users"))
6188
+ createSnapshot: createSnapshot((0, import_node_path29.join)(path11)),
6189
+ buildIndex: buildIndex((0, import_node_path29.join)(path11)),
6190
+ diffSnapshots: diffSnapshots((0, import_node_path29.join)(path11)),
6191
+ listSnapshots: listSnapshots((0, import_node_path29.join)(path11)),
6192
+ toDSL: toDSL((0, import_node_path29.join)(path11), {
6193
+ getEvent: getEvent((0, import_node_path29.join)(path11)),
6194
+ getCommand: getCommand((0, import_node_path29.join)(path11)),
6195
+ getQuery: getQuery((0, import_node_path29.join)(path11)),
6196
+ getService: getService((0, import_node_path29.join)(path11)),
6197
+ getServices: getServices((0, import_node_path29.join)(path11)),
6198
+ getDomain: getDomain((0, import_node_path29.join)(path11, "domains")),
6199
+ getChannel: getChannel((0, import_node_path29.join)(path11)),
6200
+ getChannels: getChannels((0, import_node_path29.join)(path11)),
6201
+ getContainer: getDataStore((0, import_node_path29.join)(path11)),
6202
+ getTeam: getTeam((0, import_node_path29.join)(path11, "teams")),
6203
+ getUser: getUser((0, import_node_path29.join)(path11, "users"))
5331
6204
  })
5332
6205
  };
5333
6206
  };
5334
6207
  // Annotate the CommonJS export names for ESM import in node:
5335
6208
  0 && (module.exports = {
5336
- FlowBuilder
6209
+ FederationIndexSchema,
6210
+ FlowBuilder,
6211
+ InvalidIndexError,
6212
+ hydrate,
6213
+ parseIndex,
6214
+ resolve
5337
6215
  });
5338
6216
  //# sourceMappingURL=index.js.map