@eventcatalog/sdk 2.11.0 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +86 -1
  2. package/dist/cli/index.d.mts +1 -0
  3. package/dist/cli/index.d.ts +1 -0
  4. package/dist/{eventcatalog.js → cli/index.js} +588 -378
  5. package/dist/cli/index.js.map +1 -0
  6. package/dist/{eventcatalog.mjs → cli/index.mjs} +666 -436
  7. package/dist/cli/index.mjs.map +1 -0
  8. package/dist/cli-docs.d.mts +43 -0
  9. package/dist/cli-docs.d.ts +43 -0
  10. package/dist/cli-docs.js +1614 -0
  11. package/dist/cli-docs.js.map +1 -0
  12. package/dist/cli-docs.mjs +1586 -0
  13. package/dist/cli-docs.mjs.map +1 -0
  14. package/dist/index.d.mts +443 -25
  15. package/dist/index.d.ts +443 -25
  16. package/dist/index.js +204 -121
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +204 -121
  19. package/dist/index.mjs.map +1 -1
  20. package/package.json +13 -4
  21. package/dist/channels.d.mts +0 -214
  22. package/dist/channels.d.ts +0 -214
  23. package/dist/channels.js +0 -432
  24. package/dist/channels.js.map +0 -1
  25. package/dist/channels.mjs +0 -384
  26. package/dist/channels.mjs.map +0 -1
  27. package/dist/commands.d.mts +0 -274
  28. package/dist/commands.d.ts +0 -274
  29. package/dist/commands.js +0 -394
  30. package/dist/commands.js.map +0 -1
  31. package/dist/commands.mjs +0 -350
  32. package/dist/commands.mjs.map +0 -1
  33. package/dist/containers.d.mts +0 -179
  34. package/dist/containers.d.ts +0 -179
  35. package/dist/containers.js +0 -388
  36. package/dist/containers.js.map +0 -1
  37. package/dist/containers.mjs +0 -345
  38. package/dist/containers.mjs.map +0 -1
  39. package/dist/custom-docs.d.mts +0 -89
  40. package/dist/custom-docs.d.ts +0 -89
  41. package/dist/custom-docs.js +0 -164
  42. package/dist/custom-docs.js.map +0 -1
  43. package/dist/custom-docs.mjs +0 -122
  44. package/dist/custom-docs.mjs.map +0 -1
  45. package/dist/data-products.d.mts +0 -225
  46. package/dist/data-products.d.ts +0 -225
  47. package/dist/data-products.js +0 -375
  48. package/dist/data-products.js.map +0 -1
  49. package/dist/data-products.mjs +0 -332
  50. package/dist/data-products.mjs.map +0 -1
  51. package/dist/data-stores.d.mts +0 -179
  52. package/dist/data-stores.d.ts +0 -179
  53. package/dist/data-stores.js +0 -401
  54. package/dist/data-stores.js.map +0 -1
  55. package/dist/data-stores.mjs +0 -356
  56. package/dist/data-stores.mjs.map +0 -1
  57. package/dist/domains.d.mts +0 -347
  58. package/dist/domains.d.ts +0 -347
  59. package/dist/domains.js +0 -547
  60. package/dist/domains.js.map +0 -1
  61. package/dist/domains.mjs +0 -498
  62. package/dist/domains.mjs.map +0 -1
  63. package/dist/entities.d.mts +0 -174
  64. package/dist/entities.d.ts +0 -174
  65. package/dist/entities.js +0 -348
  66. package/dist/entities.js.map +0 -1
  67. package/dist/entities.mjs +0 -307
  68. package/dist/entities.mjs.map +0 -1
  69. package/dist/eventcatalog.d.mts +0 -21
  70. package/dist/eventcatalog.d.ts +0 -21
  71. package/dist/eventcatalog.js.map +0 -1
  72. package/dist/eventcatalog.mjs.map +0 -1
  73. package/dist/events.d.mts +0 -276
  74. package/dist/events.d.ts +0 -276
  75. package/dist/events.js +0 -393
  76. package/dist/events.js.map +0 -1
  77. package/dist/events.mjs +0 -349
  78. package/dist/events.mjs.map +0 -1
  79. package/dist/messages.d.mts +0 -65
  80. package/dist/messages.d.ts +0 -65
  81. package/dist/messages.js +0 -312
  82. package/dist/messages.js.map +0 -1
  83. package/dist/messages.mjs +0 -269
  84. package/dist/messages.mjs.map +0 -1
  85. package/dist/queries.d.mts +0 -276
  86. package/dist/queries.d.ts +0 -276
  87. package/dist/queries.js +0 -394
  88. package/dist/queries.js.map +0 -1
  89. package/dist/queries.mjs +0 -350
  90. package/dist/queries.mjs.map +0 -1
  91. package/dist/services.d.mts +0 -384
  92. package/dist/services.d.ts +0 -384
  93. package/dist/services.js +0 -577
  94. package/dist/services.js.map +0 -1
  95. package/dist/services.mjs +0 -526
  96. package/dist/services.mjs.map +0 -1
  97. package/dist/teams.d.mts +0 -90
  98. package/dist/teams.d.ts +0 -90
  99. package/dist/teams.js +0 -246
  100. package/dist/teams.js.map +0 -1
  101. package/dist/teams.mjs +0 -202
  102. package/dist/teams.mjs.map +0 -1
  103. package/dist/types.d.d.mts +0 -331
  104. package/dist/types.d.d.ts +0 -331
  105. package/dist/types.d.js +0 -19
  106. package/dist/types.d.js.map +0 -1
  107. package/dist/types.d.mjs +0 -1
  108. package/dist/types.d.mjs.map +0 -1
  109. package/dist/users.d.mts +0 -83
  110. package/dist/users.d.ts +0 -83
  111. package/dist/users.js +0 -127
  112. package/dist/users.js.map +0 -1
  113. package/dist/users.mjs +0 -88
  114. package/dist/users.mjs.map +0 -1
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -5,10 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
9
  var __copyProps = (to, from, except, desc) => {
13
10
  if (from && typeof from === "object" || typeof from === "function") {
14
11
  for (let key of __getOwnPropNames(from))
@@ -25,20 +22,39 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
22
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
23
  mod
27
24
  ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
25
 
30
- // src/eventcatalog.ts
31
- var eventcatalog_exports = {};
32
- __export(eventcatalog_exports, {
33
- dumpCatalog: () => dumpCatalog,
34
- getEventCatalogConfigurationFile: () => getEventCatalogConfigurationFile
35
- });
36
- module.exports = __toCommonJS(eventcatalog_exports);
37
- var import_fs = __toESM(require("fs"));
38
- var import_node_path19 = __toESM(require("path"));
26
+ // src/cli/index.ts
27
+ var import_commander = require("commander");
28
+ var import_node_fs8 = require("fs");
29
+ var import_node_path21 = require("path");
30
+
31
+ // src/cli/executor.ts
32
+ var import_node_fs7 = require("fs");
33
+
34
+ // src/cli/parser.ts
35
+ function parseArguments(rawArgs) {
36
+ return rawArgs.map((arg, index) => {
37
+ if (arg.startsWith("{") && arg.endsWith("}") || arg.startsWith("[") && arg.endsWith("]")) {
38
+ try {
39
+ return JSON.parse(arg);
40
+ } catch (error) {
41
+ if (arg.includes(":") || arg.includes(",")) {
42
+ throw new Error(`Invalid JSON in argument ${index + 1}: ${error instanceof Error ? error.message : String(error)}`);
43
+ }
44
+ return arg;
45
+ }
46
+ }
47
+ if (arg === "true") return true;
48
+ if (arg === "false") return false;
49
+ if (/^-?\d+(\.\d+)?$/.test(arg)) {
50
+ return Number(arg);
51
+ }
52
+ return arg;
53
+ });
54
+ }
39
55
 
40
56
  // src/index.ts
41
- var import_node_path18 = require("path");
57
+ var import_node_path20 = require("path");
42
58
 
43
59
  // src/events.ts
44
60
  var import_promises2 = __toESM(require("fs/promises"));
@@ -51,30 +67,30 @@ var import_fs_extra = require("fs-extra");
51
67
  var import_node_path = require("path");
52
68
  var import_gray_matter = __toESM(require("gray-matter"));
53
69
  var import_semver = require("semver");
54
- var versionExists = async (catalogDir, id, version) => {
70
+ var versionExists = async (catalogDir, id, version2) => {
55
71
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
56
- const matchedFiles = await searchFilesForId(files, id, version) || [];
72
+ const matchedFiles = await searchFilesForId(files, id, version2) || [];
57
73
  return matchedFiles.length > 0;
58
74
  };
59
- var findFileById = async (catalogDir, id, version) => {
75
+ var findFileById = async (catalogDir, id, version2) => {
60
76
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
61
77
  const matchedFiles = await searchFilesForId(files, id) || [];
62
78
  const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
63
- if (!version) {
79
+ if (!version2) {
64
80
  return latestVersion;
65
81
  }
66
82
  const parsedFiles = matchedFiles.map((path6) => {
67
83
  const { data } = import_gray_matter.default.read(path6);
68
84
  return { ...data, path: path6 };
69
85
  });
70
- if (version === "latest") {
86
+ if (version2 === "latest") {
71
87
  return latestVersion;
72
88
  }
73
- const exactMatch = parsedFiles.find((c) => c.version === version);
89
+ const exactMatch = parsedFiles.find((c) => c.version === version2);
74
90
  if (exactMatch) {
75
91
  return exactMatch.path;
76
92
  }
77
- const semverRange = (0, import_semver.validRange)(version);
93
+ const semverRange = (0, import_semver.validRange)(version2);
78
94
  if (semverRange) {
79
95
  const match = parsedFiles.filter((c) => {
80
96
  try {
@@ -118,14 +134,14 @@ var readMdxFile = async (path6) => {
118
134
  const { markdown, ...frontmatter } = data;
119
135
  return { ...frontmatter, markdown };
120
136
  };
121
- var searchFilesForId = async (files, id, version) => {
137
+ var searchFilesForId = async (files, id, version2) => {
122
138
  const escapedId = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
123
139
  const idRegex = new RegExp(`^id:\\s*(['"]|>-)?\\s*${escapedId}['"]?\\s*$`, "m");
124
- const versionRegex = new RegExp(`^version:\\s*['"]?${version}['"]?\\s*$`, "m");
140
+ const versionRegex = new RegExp(`^version:\\s*['"]?${version2}['"]?\\s*$`, "m");
125
141
  const matches = files.map((file) => {
126
142
  const content = import_node_fs.default.readFileSync(file, "utf-8");
127
143
  const hasIdMatch = content.match(idRegex);
128
- if (version && !content.match(versionRegex)) {
144
+ if (version2 && !content.match(versionRegex)) {
129
145
  return void 0;
130
146
  }
131
147
  if (hasIdMatch) {
@@ -176,8 +192,8 @@ var versionResource = async (catalogDir, id) => {
176
192
  }
177
193
  const file = matchedFiles[0];
178
194
  const sourceDirectory = (0, import_path.dirname)(file).replace(/[/\\]versioned[/\\][^/\\]+[/\\]/, import_node_path3.default.sep);
179
- const { data: { version = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
180
- const targetDirectory = getVersionedDirectory(sourceDirectory, version);
195
+ const { data: { version: version2 = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
196
+ const targetDirectory = getVersionedDirectory(sourceDirectory, version2);
181
197
  import_node_fs2.default.mkdirSync(targetDirectory, { recursive: true });
182
198
  const ignoreListToCopy = ["events", "commands", "queries", "versioned"];
183
199
  await copyDir(catalogDir, sourceDirectory, targetDirectory, (src) => {
@@ -243,9 +259,9 @@ var writeResource = async (catalogDir, resource, options = {
243
259
  });
244
260
  }
245
261
  };
246
- var getResource = async (catalogDir, id, version, options, filePath) => {
262
+ var getResource = async (catalogDir, id, version2, options, filePath) => {
247
263
  const attachSchema = options?.attachSchema || false;
248
- const file = filePath || (id ? await findFileById(catalogDir, id, version) : void 0);
264
+ const file = filePath || (id ? await findFileById(catalogDir, id, version2) : void 0);
249
265
  if (!file || !import_node_fs2.default.existsSync(file)) return;
250
266
  const { data, content } = import_gray_matter2.default.read(file);
251
267
  if (attachSchema && data?.schemaPath) {
@@ -265,8 +281,8 @@ var getResource = async (catalogDir, id, version, options, filePath) => {
265
281
  markdown: content.trim()
266
282
  };
267
283
  };
268
- var getResourcePath = async (catalogDir, id, version) => {
269
- const file = await findFileById(catalogDir, id, version);
284
+ var getResourcePath = async (catalogDir, id, version2) => {
285
+ const file = await findFileById(catalogDir, id, version2);
270
286
  if (!file) return;
271
287
  return {
272
288
  fullPath: file,
@@ -274,8 +290,8 @@ var getResourcePath = async (catalogDir, id, version) => {
274
290
  directory: (0, import_path.dirname)(file.replace(catalogDir, ""))
275
291
  };
276
292
  };
277
- var getResourceFolderName = async (catalogDir, id, version) => {
278
- const paths = await getResourcePath(catalogDir, id, version);
293
+ var getResourceFolderName = async (catalogDir, id, version2) => {
294
+ const paths = await getResourcePath(catalogDir, id, version2);
279
295
  if (!paths) return;
280
296
  return paths?.directory.split(import_node_path3.default.sep).filter(Boolean).pop();
281
297
  };
@@ -317,9 +333,9 @@ var getResources = async (catalogDir, {
317
333
  };
318
334
  });
319
335
  };
320
- var rmResourceById = async (catalogDir, id, version, options) => {
336
+ var rmResourceById = async (catalogDir, id, version2, options) => {
321
337
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
322
- const matchedFiles = await searchFilesForId(files, id, version);
338
+ const matchedFiles = await searchFilesForId(files, id, version2);
323
339
  if (matchedFiles.length === 0) {
324
340
  throw new Error(`No ${options?.type || "resource"} found with id: ${id}`);
325
341
  }
@@ -344,19 +360,19 @@ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
344
360
  for (let i = 0; i < maxRetries; i++) {
345
361
  try {
346
362
  await import_promises.default.access(path6);
347
- await new Promise((resolve2) => setTimeout(resolve2, delay));
363
+ await new Promise((resolve3) => setTimeout(resolve3, delay));
348
364
  } catch (error) {
349
365
  return;
350
366
  }
351
367
  }
352
368
  throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
353
369
  };
354
- var addFileToResource = async (catalogDir, id, file, version, options) => {
370
+ var addFileToResource = async (catalogDir, id, file, version2, options) => {
355
371
  let pathToResource;
356
372
  if (options?.path) {
357
373
  pathToResource = (0, import_path.join)(catalogDir, options.path, "index.mdx");
358
374
  } else {
359
- pathToResource = await findFileById(catalogDir, id, version);
375
+ pathToResource = await findFileById(catalogDir, id, version2);
360
376
  }
361
377
  if (!pathToResource) throw new Error("Cannot find directory to write file to");
362
378
  import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(pathToResource), { recursive: true });
@@ -368,25 +384,25 @@ var addFileToResource = async (catalogDir, id, file, version, options) => {
368
384
  }
369
385
  import_node_fs2.default.writeFileSync((0, import_path.join)((0, import_path.dirname)(pathToResource), file.fileName), fileContent);
370
386
  };
371
- var getFileFromResource = async (catalogDir, id, file, version) => {
372
- const pathToResource = await findFileById(catalogDir, id, version);
387
+ var getFileFromResource = async (catalogDir, id, file, version2) => {
388
+ const pathToResource = await findFileById(catalogDir, id, version2);
373
389
  if (!pathToResource) throw new Error("Cannot find directory of resource");
374
390
  const exists = await import_promises.default.access((0, import_path.join)((0, import_path.dirname)(pathToResource), file.fileName)).then(() => true).catch(() => false);
375
- if (!exists) throw new Error(`File ${file.fileName} does not exist in resource ${id} v(${version})`);
391
+ if (!exists) throw new Error(`File ${file.fileName} does not exist in resource ${id} v(${version2})`);
376
392
  return import_node_fs2.default.readFileSync((0, import_path.join)((0, import_path.dirname)(pathToResource), file.fileName), "utf-8");
377
393
  };
378
- var getVersionedDirectory = (sourceDirectory, version) => {
379
- return (0, import_path.join)(sourceDirectory, "versioned", version);
394
+ var getVersionedDirectory = (sourceDirectory, version2) => {
395
+ return (0, import_path.join)(sourceDirectory, "versioned", version2);
380
396
  };
381
- var isLatestVersion = async (catalogDir, id, version) => {
382
- const resource = await getResource(catalogDir, id, version);
397
+ var isLatestVersion = async (catalogDir, id, version2) => {
398
+ const resource = await getResource(catalogDir, id, version2);
383
399
  if (!resource) return false;
384
- const pathToResource = await getResourcePath(catalogDir, id, version);
400
+ const pathToResource = await getResourcePath(catalogDir, id, version2);
385
401
  return !pathToResource?.relativePath.replace(/\\/g, "/").includes("/versioned/");
386
402
  };
387
403
 
388
404
  // src/events.ts
389
- var getEvent = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "event", ...options });
405
+ var getEvent = (directory) => async (id, version2, options) => getResource(directory, id, version2, { type: "event", ...options });
390
406
  var getEvents = (directory) => async (options) => getResources(directory, { type: "events", ...options });
391
407
  var writeEvent = (directory) => async (event, options = {
392
408
  path: "",
@@ -405,23 +421,23 @@ var writeEventToService = (directory) => async (event, service, options = { path
405
421
  var rmEvent = (directory) => async (path6) => {
406
422
  await import_promises2.default.rm((0, import_node_path4.join)(directory, path6), { recursive: true });
407
423
  };
408
- var rmEventById = (directory) => async (id, version, persistFiles) => {
409
- await rmResourceById(directory, id, version, { type: "event", persistFiles });
424
+ var rmEventById = (directory) => async (id, version2, persistFiles) => {
425
+ await rmResourceById(directory, id, version2, { type: "event", persistFiles });
410
426
  };
411
427
  var versionEvent = (directory) => async (id) => versionResource(directory, id);
412
- var addFileToEvent = (directory) => async (id, file, version, options) => addFileToResource(directory, id, file, version, options);
413
- var addSchemaToEvent = (directory) => async (id, schema, version, options) => {
414
- await addFileToEvent(directory)(id, { content: schema.schema, fileName: schema.fileName }, version, options);
428
+ var addFileToEvent = (directory) => async (id, file, version2, options) => addFileToResource(directory, id, file, version2, options);
429
+ var addSchemaToEvent = (directory) => async (id, schema, version2, options) => {
430
+ await addFileToEvent(directory)(id, { content: schema.schema, fileName: schema.fileName }, version2, options);
415
431
  };
416
- var eventHasVersion = (directory) => async (id, version) => {
417
- const file = await findFileById(directory, id, version);
432
+ var eventHasVersion = (directory) => async (id, version2) => {
433
+ const file = await findFileById(directory, id, version2);
418
434
  return !!file;
419
435
  };
420
436
 
421
437
  // src/commands.ts
422
438
  var import_promises3 = __toESM(require("fs/promises"));
423
439
  var import_node_path5 = require("path");
424
- var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
440
+ var getCommand = (directory) => async (id, version2, options) => getResource(directory, id, version2, { type: "command", ...options });
425
441
  var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
426
442
  var writeCommand = (directory) => async (command, options = {
427
443
  path: "",
@@ -441,21 +457,21 @@ var writeCommandToService = (directory) => async (command, service, options = {
441
457
  var rmCommand = (directory) => async (path6) => {
442
458
  await import_promises3.default.rm((0, import_node_path5.join)(directory, path6), { recursive: true });
443
459
  };
444
- var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
460
+ var rmCommandById = (directory) => async (id, version2, persistFiles) => rmResourceById(directory, id, version2, { type: "command", persistFiles });
445
461
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
446
- var addFileToCommand = (directory) => async (id, file, version, options) => addFileToResource(directory, id, file, version, options);
447
- var addSchemaToCommand = (directory) => async (id, schema, version, options) => {
448
- await addFileToCommand(directory)(id, { content: schema.schema, fileName: schema.fileName }, version, options);
462
+ var addFileToCommand = (directory) => async (id, file, version2, options) => addFileToResource(directory, id, file, version2, options);
463
+ var addSchemaToCommand = (directory) => async (id, schema, version2, options) => {
464
+ await addFileToCommand(directory)(id, { content: schema.schema, fileName: schema.fileName }, version2, options);
449
465
  };
450
- var commandHasVersion = (directory) => async (id, version) => {
451
- const file = await findFileById(directory, id, version);
466
+ var commandHasVersion = (directory) => async (id, version2) => {
467
+ const file = await findFileById(directory, id, version2);
452
468
  return !!file;
453
469
  };
454
470
 
455
471
  // src/queries.ts
456
472
  var import_promises4 = __toESM(require("fs/promises"));
457
473
  var import_node_path6 = require("path");
458
- var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
474
+ var getQuery = (directory) => async (id, version2, options) => getResource(directory, id, version2, { type: "query", ...options });
459
475
  var writeQuery = (directory) => async (query, options = {
460
476
  path: "",
461
477
  override: false,
@@ -475,23 +491,23 @@ var writeQueryToService = (directory) => async (query, service, options = { path
475
491
  var rmQuery = (directory) => async (path6) => {
476
492
  await import_promises4.default.rm((0, import_node_path6.join)(directory, path6), { recursive: true });
477
493
  };
478
- var rmQueryById = (directory) => async (id, version, persistFiles) => {
479
- await rmResourceById(directory, id, version, { type: "query", persistFiles });
494
+ var rmQueryById = (directory) => async (id, version2, persistFiles) => {
495
+ await rmResourceById(directory, id, version2, { type: "query", persistFiles });
480
496
  };
481
497
  var versionQuery = (directory) => async (id) => versionResource(directory, id);
482
- var addFileToQuery = (directory) => async (id, file, version, options) => addFileToResource(directory, id, file, version, options);
483
- var addSchemaToQuery = (directory) => async (id, schema, version, options) => {
484
- await addFileToQuery(directory)(id, { content: schema.schema, fileName: schema.fileName }, version, options);
498
+ var addFileToQuery = (directory) => async (id, file, version2, options) => addFileToResource(directory, id, file, version2, options);
499
+ var addSchemaToQuery = (directory) => async (id, schema, version2, options) => {
500
+ await addFileToQuery(directory)(id, { content: schema.schema, fileName: schema.fileName }, version2, options);
485
501
  };
486
- var queryHasVersion = (directory) => async (id, version) => {
487
- const file = await findFileById(directory, id, version);
502
+ var queryHasVersion = (directory) => async (id, version2) => {
503
+ const file = await findFileById(directory, id, version2);
488
504
  return !!file;
489
505
  };
490
506
 
491
507
  // src/services.ts
492
508
  var import_promises5 = __toESM(require("fs/promises"));
493
509
  var import_node_path7 = require("path");
494
- var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
510
+ var getService = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "service" });
495
511
  var getServiceByPath = (directory) => async (path6) => {
496
512
  const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
497
513
  return service;
@@ -529,13 +545,13 @@ var versionService = (directory) => async (id) => versionResource(directory, id)
529
545
  var rmService = (directory) => async (path6) => {
530
546
  await import_promises5.default.rm((0, import_node_path7.join)(directory, path6), { recursive: true });
531
547
  };
532
- var rmServiceById = (directory) => async (id, version, persistFiles) => {
533
- await rmResourceById(directory, id, version, { type: "service", persistFiles });
548
+ var rmServiceById = (directory) => async (id, version2, persistFiles) => {
549
+ await rmResourceById(directory, id, version2, { type: "service", persistFiles });
534
550
  };
535
- var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
536
- var getSpecificationFilesForService = (directory) => async (id, version) => {
537
- let service = await getService(directory)(id, version);
538
- const filePathToService = await findFileById(directory, id, version);
551
+ var addFileToService = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
552
+ var getSpecificationFilesForService = (directory) => async (id, version2) => {
553
+ let service = await getService(directory)(id, version2);
554
+ const filePathToService = await findFileById(directory, id, version2);
539
555
  if (!filePathToService) throw new Error("Cannot find directory of service");
540
556
  let specs = [];
541
557
  if (service.specifications) {
@@ -553,16 +569,16 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
553
569
  if (!fileName) {
554
570
  throw new Error(`Specification file name for ${fileName} is undefined`);
555
571
  }
556
- const rawFile = await getFileFromResource(directory, id, { fileName }, version);
572
+ const rawFile = await getFileFromResource(directory, id, { fileName }, version2);
557
573
  return { key, content: rawFile, fileName, path: (0, import_node_path7.join)((0, import_node_path7.dirname)(filePathToService), fileName) };
558
574
  });
559
575
  specs = await Promise.all(getSpecs);
560
576
  }
561
577
  return specs;
562
578
  };
563
- var addMessageToService = (directory) => async (id, direction, event, version) => {
564
- let service = await getService(directory)(id, version);
565
- const servicePath = await getResourcePath(directory, id, version);
579
+ var addMessageToService = (directory) => async (id, direction, event, version2) => {
580
+ let service = await getService(directory)(id, version2);
581
+ const servicePath = await getResourcePath(directory, id, version2);
566
582
  const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
567
583
  if (direction === "sends") {
568
584
  if (service.sends === void 0) {
@@ -587,17 +603,17 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
587
603
  } else {
588
604
  throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
589
605
  }
590
- const existingResource = await findFileById(directory, id, version);
606
+ const existingResource = await findFileById(directory, id, version2);
591
607
  if (!existingResource) {
592
608
  throw new Error(`Cannot find service ${id} in the catalog`);
593
609
  }
594
610
  const path6 = existingResource.split(/[\\/]+services/)[0];
595
611
  const pathToResource = (0, import_node_path7.join)(path6, "services");
596
- await rmServiceById(directory)(id, version);
612
+ await rmServiceById(directory)(id, version2);
597
613
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
598
614
  };
599
- var serviceHasVersion = (directory) => async (id, version) => {
600
- const file = await findFileById(directory, id, version);
615
+ var serviceHasVersion = (directory) => async (id, version2) => {
616
+ const file = await findFileById(directory, id, version2);
601
617
  return !!file;
602
618
  };
603
619
  var isService = (directory) => async (path6) => {
@@ -607,9 +623,9 @@ var isService = (directory) => async (path6) => {
607
623
  return !!service && segments.includes("services");
608
624
  };
609
625
  var toService = (directory) => async (file) => toResource(directory, file);
610
- var addEntityToService = (directory) => async (id, entity, version) => {
611
- let service = await getService(directory)(id, version);
612
- const servicePath = await getResourcePath(directory, id, version);
626
+ var addEntityToService = (directory) => async (id, entity, version2) => {
627
+ let service = await getService(directory)(id, version2);
628
+ const servicePath = await getResourcePath(directory, id, version2);
613
629
  const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
614
630
  if (service.entities === void 0) {
615
631
  service.entities = [];
@@ -620,18 +636,18 @@ var addEntityToService = (directory) => async (id, entity, version) => {
620
636
  }
621
637
  }
622
638
  service.entities.push({ id: entity.id, version: entity.version });
623
- const existingResource = await findFileById(directory, id, version);
639
+ const existingResource = await findFileById(directory, id, version2);
624
640
  if (!existingResource) {
625
641
  throw new Error(`Cannot find service ${id} in the catalog`);
626
642
  }
627
643
  const path6 = existingResource.split(/[\\/]+services/)[0];
628
644
  const pathToResource = (0, import_node_path7.join)(path6, "services");
629
- await rmServiceById(directory)(id, version);
645
+ await rmServiceById(directory)(id, version2);
630
646
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
631
647
  };
632
- var addDataStoreToService = (directory) => async (id, operation, dataStore, version) => {
633
- let service = await getService(directory)(id, version);
634
- const servicePath = await getResourcePath(directory, id, version);
648
+ var addDataStoreToService = (directory) => async (id, operation, dataStore, version2) => {
649
+ let service = await getService(directory)(id, version2);
650
+ const servicePath = await getResourcePath(directory, id, version2);
635
651
  const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
636
652
  if (operation === "writesTo") {
637
653
  if (service.writesTo === void 0) {
@@ -656,13 +672,13 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
656
672
  } else {
657
673
  throw new Error(`Operation ${operation} is invalid, only 'writesTo' and 'readsFrom' are supported`);
658
674
  }
659
- const existingResource = await findFileById(directory, id, version);
675
+ const existingResource = await findFileById(directory, id, version2);
660
676
  if (!existingResource) {
661
677
  throw new Error(`Cannot find service ${id} in the catalog`);
662
678
  }
663
679
  const path6 = existingResource.split(/[\\/]+services/)[0];
664
680
  const pathToResource = (0, import_node_path7.join)(path6, "services");
665
- await rmServiceById(directory)(id, version);
681
+ await rmServiceById(directory)(id, version2);
666
682
  await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
667
683
  };
668
684
 
@@ -671,7 +687,7 @@ var import_promises6 = __toESM(require("fs/promises"));
671
687
  var import_node_path8 = __toESM(require("path"));
672
688
  var import_node_fs3 = __toESM(require("fs"));
673
689
  var import_gray_matter3 = __toESM(require("gray-matter"));
674
- var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
690
+ var getDomain = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "domain" });
675
691
  var getDomains = (directory) => async (options) => getResources(directory, {
676
692
  type: "domains",
677
693
  ignore: ["**/services/**", "**/events/**", "**/commands/**", "**/queries/**", "**/flows/**", "**/entities/**"],
@@ -705,16 +721,16 @@ var versionDomain = (directory) => async (id) => versionResource(directory, id);
705
721
  var rmDomain = (directory) => async (path6) => {
706
722
  await import_promises6.default.rm((0, import_node_path8.join)(directory, path6), { recursive: true });
707
723
  };
708
- var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
709
- var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
710
- var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguageDictionary, version) => {
724
+ var rmDomainById = (directory) => async (id, version2, persistFiles) => rmResourceById(directory, id, version2, { type: "domain", persistFiles });
725
+ var addFileToDomain = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
726
+ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguageDictionary, version2) => {
711
727
  const content = import_gray_matter3.default.stringify("", {
712
728
  ...ubiquitousLanguageDictionary
713
729
  });
714
- await addFileToResource(directory, id, { content, fileName: "ubiquitous-language.mdx" }, version);
730
+ await addFileToResource(directory, id, { content, fileName: "ubiquitous-language.mdx" }, version2);
715
731
  };
716
- var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
717
- const pathToDomain = await findFileById(directory, id, version) || "";
732
+ var getUbiquitousLanguageFromDomain = (directory) => async (id, version2) => {
733
+ const pathToDomain = await findFileById(directory, id, version2) || "";
718
734
  const pathToUbiquitousLanguage = import_node_path8.default.join(import_node_path8.default.dirname(pathToDomain), "ubiquitous-language.mdx");
719
735
  const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
720
736
  if (!fileExists) {
@@ -723,13 +739,13 @@ var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
723
739
  const content = await readMdxFile(pathToUbiquitousLanguage);
724
740
  return content;
725
741
  };
726
- var domainHasVersion = (directory) => async (id, version) => {
727
- const file = await findFileById(directory, id, version);
742
+ var domainHasVersion = (directory) => async (id, version2) => {
743
+ const file = await findFileById(directory, id, version2);
728
744
  return !!file;
729
745
  };
730
- var addServiceToDomain = (directory) => async (id, service, version) => {
731
- let domain = await getDomain(directory)(id, version);
732
- const domainPath = await getResourcePath(directory, id, version);
746
+ var addServiceToDomain = (directory) => async (id, service, version2) => {
747
+ let domain = await getDomain(directory)(id, version2);
748
+ const domainPath = await getResourcePath(directory, id, version2);
733
749
  const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
734
750
  if (domain.services === void 0) {
735
751
  domain.services = [];
@@ -739,12 +755,12 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
739
755
  return;
740
756
  }
741
757
  domain.services.push(service);
742
- await rmDomainById(directory)(id, version, true);
758
+ await rmDomainById(directory)(id, version2, true);
743
759
  await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
744
760
  };
745
- var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
746
- let domain = await getDomain(directory)(id, version);
747
- const domainPath = await getResourcePath(directory, id, version);
761
+ var addSubDomainToDomain = (directory) => async (id, subDomain, version2) => {
762
+ let domain = await getDomain(directory)(id, version2);
763
+ const domainPath = await getResourcePath(directory, id, version2);
748
764
  const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
749
765
  if (domain.domains === void 0) {
750
766
  domain.domains = [];
@@ -754,12 +770,12 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
754
770
  return;
755
771
  }
756
772
  domain.domains.push(subDomain);
757
- await rmDomainById(directory)(id, version, true);
773
+ await rmDomainById(directory)(id, version2, true);
758
774
  await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
759
775
  };
760
- var addEntityToDomain = (directory) => async (id, entity, version) => {
761
- let domain = await getDomain(directory)(id, version);
762
- const domainPath = await getResourcePath(directory, id, version);
776
+ var addEntityToDomain = (directory) => async (id, entity, version2) => {
777
+ let domain = await getDomain(directory)(id, version2);
778
+ const domainPath = await getResourcePath(directory, id, version2);
763
779
  const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
764
780
  if (domain.entities === void 0) {
765
781
  domain.entities = [];
@@ -769,12 +785,12 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
769
785
  return;
770
786
  }
771
787
  domain.entities.push(entity);
772
- await rmDomainById(directory)(id, version, true);
788
+ await rmDomainById(directory)(id, version2, true);
773
789
  await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
774
790
  };
775
- var addDataProductToDomain = (directory) => async (id, dataProduct, version) => {
776
- let domain = await getDomain(directory)(id, version);
777
- const domainPath = await getResourcePath(directory, id, version);
791
+ var addDataProductToDomain = (directory) => async (id, dataProduct, version2) => {
792
+ let domain = await getDomain(directory)(id, version2);
793
+ const domainPath = await getResourcePath(directory, id, version2);
778
794
  const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
779
795
  if (domain.dataProducts === void 0) {
780
796
  domain.dataProducts = [];
@@ -786,12 +802,12 @@ var addDataProductToDomain = (directory) => async (id, dataProduct, version) =>
786
802
  return;
787
803
  }
788
804
  domain.dataProducts.push(dataProduct);
789
- await rmDomainById(directory)(id, version, true);
805
+ await rmDomainById(directory)(id, version2, true);
790
806
  await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
791
807
  };
792
- var addMessageToDomain = (directory) => async (id, direction, message, version) => {
793
- let domain = await getDomain(directory)(id, version);
794
- const domainPath = await getResourcePath(directory, id, version);
808
+ var addMessageToDomain = (directory) => async (id, direction, message, version2) => {
809
+ let domain = await getDomain(directory)(id, version2);
810
+ const domainPath = await getResourcePath(directory, id, version2);
795
811
  const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
796
812
  if (direction === "sends") {
797
813
  if (domain.sends === void 0) {
@@ -816,34 +832,34 @@ var addMessageToDomain = (directory) => async (id, direction, message, version)
816
832
  } else {
817
833
  throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
818
834
  }
819
- const existingResource = await findFileById(directory, id, version);
835
+ const existingResource = await findFileById(directory, id, version2);
820
836
  if (!existingResource) {
821
837
  throw new Error(`Cannot find domain ${id} in the catalog`);
822
838
  }
823
839
  const normalizedPath = existingResource.replace(/\\/g, "/");
824
840
  const lastDomainsIndex = normalizedPath.lastIndexOf("/domains/");
825
841
  const pathToResource = existingResource.substring(0, lastDomainsIndex + "/domains".length);
826
- await rmDomainById(directory)(id, version, true);
842
+ await rmDomainById(directory)(id, version2, true);
827
843
  await writeDomain(pathToResource)(domain, { format: extension === ".md" ? "md" : "mdx" });
828
844
  };
829
845
 
830
846
  // src/channels.ts
831
847
  var import_promises7 = __toESM(require("fs/promises"));
832
848
  var import_node_path9 = require("path");
833
- var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
849
+ var getChannel = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "channel" });
834
850
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
835
851
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
836
852
  var rmChannel = (directory) => async (path6) => {
837
853
  await import_promises7.default.rm((0, import_node_path9.join)(directory, path6), { recursive: true });
838
854
  };
839
- var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
855
+ var rmChannelById = (directory) => async (id, version2, persistFiles) => rmResourceById(directory, id, version2, { type: "channel", persistFiles });
840
856
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
841
- var channelHasVersion = (directory) => async (id, version) => {
842
- const file = await findFileById(directory, id, version);
857
+ var channelHasVersion = (directory) => async (id, version2) => {
858
+ const file = await findFileById(directory, id, version2);
843
859
  return !!file;
844
860
  };
845
- var addMessageToChannel = (directory, collection) => async (id, _message, version) => {
846
- let channel = await getChannel(directory)(id, version);
861
+ var addMessageToChannel = (directory, collection) => async (id, _message, version2) => {
862
+ let channel = await getChannel(directory)(id, version2);
847
863
  const functions = {
848
864
  events: {
849
865
  getMessage: getEvent,
@@ -894,13 +910,13 @@ var getMessageBySchemaPath = (directory) => async (path6, options) => {
894
910
  }
895
911
  const messageFile = files[0];
896
912
  const { data } = import_gray_matter4.default.read(messageFile);
897
- const { id, version } = data;
898
- if (!id || !version) {
913
+ const { id, version: version2 } = data;
914
+ if (!id || !version2) {
899
915
  throw new Error(`Message definition file at ${messageFile} is missing 'id' or 'version' in its frontmatter.`);
900
916
  }
901
- const message = await getResource(directory, id, version, { type: "message", ...options });
917
+ const message = await getResource(directory, id, version2, { type: "message", ...options });
902
918
  if (!message) {
903
- throw new Error(`Message resource with id '${id}' and version '${version}' not found, as referenced in ${messageFile}.`);
919
+ throw new Error(`Message resource with id '${id}' and version '${version2}' not found, as referenced in ${messageFile}.`);
904
920
  }
905
921
  return message;
906
922
  } catch (error) {
@@ -911,12 +927,12 @@ var getMessageBySchemaPath = (directory) => async (path6, options) => {
911
927
  throw new Error(`Failed to retrieve message from ${pathToMessage} due to an unknown error.`);
912
928
  }
913
929
  };
914
- var getProducersAndConsumersForMessage = (directory) => async (id, version, options) => {
930
+ var getProducersAndConsumersForMessage = (directory) => async (id, version2, options) => {
915
931
  const services = await getServices(directory)({ latestOnly: options?.latestOnly ?? true });
916
- const message = await getResource(directory, id, version, { type: "message" });
917
- const isMessageLatestVersion = await isLatestVersion(directory, id, version);
932
+ const message = await getResource(directory, id, version2, { type: "message" });
933
+ const isMessageLatestVersion = await isLatestVersion(directory, id, version2);
918
934
  if (!message) {
919
- throw new Error(`Message resource with id '${id}' and version '${version}' not found.`);
935
+ throw new Error(`Message resource with id '${id}' and version '${version2}' not found.`);
920
936
  }
921
937
  const producers = [];
922
938
  const consumers = [];
@@ -1108,8 +1124,8 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
1108
1124
  var rmTeamById = (catalogDir) => async (id) => {
1109
1125
  await import_promises9.default.rm((0, import_node_path13.join)(catalogDir, `${id}.mdx`), { recursive: true });
1110
1126
  };
1111
- var getOwnersForResource = (catalogDir) => async (id, version) => {
1112
- const resource = await getResource(catalogDir, id, version);
1127
+ var getOwnersForResource = (catalogDir) => async (id, version2) => {
1128
+ const resource = await getResource(catalogDir, id, version2);
1113
1129
  let owners = [];
1114
1130
  if (!resource) return [];
1115
1131
  if (!resource.owners) return [];
@@ -1127,10 +1143,107 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
1127
1143
  return owners;
1128
1144
  };
1129
1145
 
1146
+ // src/eventcatalog.ts
1147
+ var import_fs = __toESM(require("fs"));
1148
+ var import_node_path15 = __toESM(require("path"));
1149
+ var DUMP_VERSION = "0.0.1";
1150
+ var getEventCatalogVersion = async (catalogDir) => {
1151
+ try {
1152
+ const packageJson = import_fs.default.readFileSync((0, import_node_path15.join)(catalogDir, "package.json"), "utf8");
1153
+ const packageJsonObject = JSON.parse(packageJson);
1154
+ return packageJsonObject["dependencies"]["@eventcatalog/core"];
1155
+ } catch (error) {
1156
+ return "unknown";
1157
+ }
1158
+ };
1159
+ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false } = {}) => {
1160
+ return await Promise.all(
1161
+ resources.map(async (resource) => {
1162
+ const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1163
+ let schema = "";
1164
+ if (resource.schemaPath && resourcePath?.fullPath) {
1165
+ const pathToSchema = import_node_path15.default.join(import_node_path15.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1166
+ if (import_fs.default.existsSync(pathToSchema)) {
1167
+ schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1168
+ }
1169
+ }
1170
+ const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
1171
+ return {
1172
+ ...resource,
1173
+ _eventcatalog: eventcatalog
1174
+ };
1175
+ })
1176
+ );
1177
+ };
1178
+ var filterCollection = (collection, options) => {
1179
+ return collection.map((item) => ({
1180
+ ...item,
1181
+ markdown: options?.includeMarkdown ? item.markdown : void 0
1182
+ }));
1183
+ };
1184
+ var getEventCatalogConfigurationFile = (directory) => async () => {
1185
+ try {
1186
+ const path6 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
1187
+ const configModule = await import(path6);
1188
+ return configModule.default;
1189
+ } catch (error) {
1190
+ console.error("Error getting event catalog configuration file", error);
1191
+ return null;
1192
+ }
1193
+ };
1194
+ var dumpCatalog = (directory) => async (options) => {
1195
+ const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = src_default(directory);
1196
+ const { includeMarkdown = true } = options || {};
1197
+ const domains = await getDomains2();
1198
+ const services = await getServices2();
1199
+ const events = await getEvents2();
1200
+ const commands = await getCommands2();
1201
+ const queries = await getQueries2();
1202
+ const teams = await getTeams2();
1203
+ const users = await getUsers3();
1204
+ const channels = await getChannels2();
1205
+ const [
1206
+ hydratedDomains,
1207
+ hydratedServices,
1208
+ hydratedEvents,
1209
+ hydratedQueries,
1210
+ hydratedCommands,
1211
+ hydratedTeams,
1212
+ hydratedUsers,
1213
+ hydratedChannels
1214
+ ] = await Promise.all([
1215
+ hydrateResource(directory, domains),
1216
+ hydrateResource(directory, services),
1217
+ hydrateResource(directory, events),
1218
+ hydrateResource(directory, queries),
1219
+ hydrateResource(directory, commands),
1220
+ hydrateResource(directory, teams),
1221
+ hydrateResource(directory, users),
1222
+ hydrateResource(directory, channels)
1223
+ ]);
1224
+ return {
1225
+ version: DUMP_VERSION,
1226
+ catalogVersion: await getEventCatalogVersion(directory),
1227
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1228
+ resources: {
1229
+ domains: filterCollection(hydratedDomains, { includeMarkdown }),
1230
+ services: filterCollection(hydratedServices, { includeMarkdown }),
1231
+ messages: {
1232
+ events: filterCollection(hydratedEvents, { includeMarkdown }),
1233
+ queries: filterCollection(hydratedQueries, { includeMarkdown }),
1234
+ commands: filterCollection(hydratedCommands, { includeMarkdown })
1235
+ },
1236
+ teams: filterCollection(hydratedTeams, { includeMarkdown }),
1237
+ users: filterCollection(hydratedUsers, { includeMarkdown }),
1238
+ channels: filterCollection(hydratedChannels, { includeMarkdown })
1239
+ }
1240
+ };
1241
+ };
1242
+
1130
1243
  // src/entities.ts
1131
1244
  var import_promises10 = __toESM(require("fs/promises"));
1132
- var import_node_path15 = require("path");
1133
- var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
1245
+ var import_node_path16 = require("path");
1246
+ var getEntity = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "entity" });
1134
1247
  var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
1135
1248
  var writeEntity = (directory) => async (entity, options = {
1136
1249
  path: "",
@@ -1138,21 +1251,21 @@ var writeEntity = (directory) => async (entity, options = {
1138
1251
  format: "mdx"
1139
1252
  }) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
1140
1253
  var rmEntity = (directory) => async (path6) => {
1141
- await import_promises10.default.rm((0, import_node_path15.join)(directory, path6), { recursive: true });
1254
+ await import_promises10.default.rm((0, import_node_path16.join)(directory, path6), { recursive: true });
1142
1255
  };
1143
- var rmEntityById = (directory) => async (id, version, persistFiles) => {
1144
- await rmResourceById(directory, id, version, { type: "entity", persistFiles });
1256
+ var rmEntityById = (directory) => async (id, version2, persistFiles) => {
1257
+ await rmResourceById(directory, id, version2, { type: "entity", persistFiles });
1145
1258
  };
1146
1259
  var versionEntity = (directory) => async (id) => versionResource(directory, id);
1147
- var entityHasVersion = (directory) => async (id, version) => {
1148
- const file = await findFileById(directory, id, version);
1260
+ var entityHasVersion = (directory) => async (id, version2) => {
1261
+ const file = await findFileById(directory, id, version2);
1149
1262
  return !!file;
1150
1263
  };
1151
1264
 
1152
1265
  // src/containers.ts
1153
1266
  var import_promises11 = __toESM(require("fs/promises"));
1154
- var import_node_path16 = require("path");
1155
- var getContainer = (directory) => async (id, version) => getResource(directory, id, version, { type: "container" });
1267
+ var import_node_path17 = require("path");
1268
+ var getContainer = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "container" });
1156
1269
  var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
1157
1270
  var writeContainer = (directory) => async (data, options = {
1158
1271
  path: "",
@@ -1161,23 +1274,23 @@ var writeContainer = (directory) => async (data, options = {
1161
1274
  }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1162
1275
  var versionContainer = (directory) => async (id) => versionResource(directory, id);
1163
1276
  var rmContainer = (directory) => async (path6) => {
1164
- await import_promises11.default.rm((0, import_node_path16.join)(directory, path6), { recursive: true });
1277
+ await import_promises11.default.rm((0, import_node_path17.join)(directory, path6), { recursive: true });
1165
1278
  };
1166
- var rmContainerById = (directory) => async (id, version, persistFiles) => {
1167
- await rmResourceById(directory, id, version, { type: "container", persistFiles });
1279
+ var rmContainerById = (directory) => async (id, version2, persistFiles) => {
1280
+ await rmResourceById(directory, id, version2, { type: "container", persistFiles });
1168
1281
  };
1169
- var containerHasVersion = (directory) => async (id, version) => {
1170
- const file = await findFileById(directory, id, version);
1282
+ var containerHasVersion = (directory) => async (id, version2) => {
1283
+ const file = await findFileById(directory, id, version2);
1171
1284
  return !!file;
1172
1285
  };
1173
- var addFileToContainer = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
1286
+ var addFileToContainer = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
1174
1287
  var writeContainerToService = (directory) => async (container, service, options = { path: "", format: "mdx", override: false }) => {
1175
1288
  const resourcePath = await getResourcePath(directory, service.id, service.version);
1176
1289
  if (!resourcePath) {
1177
1290
  throw new Error("Service not found");
1178
1291
  }
1179
1292
  let pathForContainer = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/containers` : `${resourcePath.directory}/containers`;
1180
- pathForContainer = (0, import_node_path16.join)(pathForContainer, container.id);
1293
+ pathForContainer = (0, import_node_path17.join)(pathForContainer, container.id);
1181
1294
  await writeResource(directory, { ...container }, { ...options, path: pathForContainer, type: "container" });
1182
1295
  };
1183
1296
 
@@ -1194,8 +1307,8 @@ var writeDataStoreToService = writeContainerToService;
1194
1307
 
1195
1308
  // src/data-products.ts
1196
1309
  var import_promises12 = __toESM(require("fs/promises"));
1197
- var import_node_path17 = require("path");
1198
- var getDataProduct = (directory) => async (id, version) => getResource(directory, id, version, { type: "data-product" });
1310
+ var import_node_path18 = require("path");
1311
+ var getDataProduct = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "data-product" });
1199
1312
  var getDataProducts = (directory) => async (options) => getResources(directory, { type: "data-products", latestOnly: options?.latestOnly });
1200
1313
  var writeDataProduct = (directory) => async (dataProduct, options = {
1201
1314
  path: "",
@@ -1204,21 +1317,44 @@ var writeDataProduct = (directory) => async (dataProduct, options = {
1204
1317
  }) => writeResource(directory, { ...dataProduct }, { ...options, type: "data-product" });
1205
1318
  var writeDataProductToDomain = (directory) => async (dataProduct, domain, options = { path: "", format: "mdx", override: false }) => {
1206
1319
  let pathForDataProduct = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/data-products` : `/${domain.id}/data-products`;
1207
- pathForDataProduct = (0, import_node_path17.join)(pathForDataProduct, dataProduct.id);
1320
+ pathForDataProduct = (0, import_node_path18.join)(pathForDataProduct, dataProduct.id);
1208
1321
  await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
1209
1322
  };
1210
1323
  var rmDataProduct = (directory) => async (path6) => {
1211
- await import_promises12.default.rm((0, import_node_path17.join)(directory, path6), { recursive: true });
1324
+ await import_promises12.default.rm((0, import_node_path18.join)(directory, path6), { recursive: true });
1212
1325
  };
1213
- var rmDataProductById = (directory) => async (id, version, persistFiles) => {
1214
- await rmResourceById(directory, id, version, { type: "data-product", persistFiles });
1326
+ var rmDataProductById = (directory) => async (id, version2, persistFiles) => {
1327
+ await rmResourceById(directory, id, version2, { type: "data-product", persistFiles });
1215
1328
  };
1216
1329
  var versionDataProduct = (directory) => async (id) => versionResource(directory, id);
1217
- var dataProductHasVersion = (directory) => async (id, version) => {
1218
- const file = await findFileById(directory, id, version);
1330
+ var dataProductHasVersion = (directory) => async (id, version2) => {
1331
+ const file = await findFileById(directory, id, version2);
1219
1332
  return !!file;
1220
1333
  };
1221
- var addFileToDataProduct = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
1334
+ var addFileToDataProduct = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
1335
+
1336
+ // src/diagrams.ts
1337
+ var import_promises13 = __toESM(require("fs/promises"));
1338
+ var import_node_path19 = require("path");
1339
+ var getDiagram = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "diagram" });
1340
+ var getDiagrams = (directory) => async (options) => getResources(directory, { type: "diagrams", latestOnly: options?.latestOnly });
1341
+ var writeDiagram = (directory) => async (diagram, options = {
1342
+ path: "",
1343
+ override: false,
1344
+ format: "mdx"
1345
+ }) => writeResource(directory, { ...diagram }, { ...options, type: "diagram" });
1346
+ var rmDiagram = (directory) => async (path6) => {
1347
+ await import_promises13.default.rm((0, import_node_path19.join)(directory, path6), { recursive: true });
1348
+ };
1349
+ var rmDiagramById = (directory) => async (id, version2, persistFiles) => {
1350
+ await rmResourceById(directory, id, version2, { type: "diagram", persistFiles });
1351
+ };
1352
+ var versionDiagram = (directory) => async (id) => versionResource(directory, id);
1353
+ var diagramHasVersion = (directory) => async (id, version2) => {
1354
+ const file = await findFileById(directory, id, version2);
1355
+ return !!file;
1356
+ };
1357
+ var addFileToDiagram = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2, { type: "diagram" });
1222
1358
 
1223
1359
  // src/index.ts
1224
1360
  var src_default = (path6) => {
@@ -1229,13 +1365,13 @@ var src_default = (path6) => {
1229
1365
  * @param version - Optional id of the version to get (supports semver)
1230
1366
  * @returns Event|Undefined
1231
1367
  */
1232
- getEvent: getEvent((0, import_node_path18.join)(path6)),
1368
+ getEvent: getEvent((0, import_node_path20.join)(path6)),
1233
1369
  /**
1234
1370
  * Returns all events from EventCatalog
1235
1371
  * @param latestOnly - optional boolean, set to true to get only latest versions
1236
1372
  * @returns Event[]|Undefined
1237
1373
  */
1238
- getEvents: getEvents((0, import_node_path18.join)(path6)),
1374
+ getEvents: getEvents((0, import_node_path20.join)(path6)),
1239
1375
  /**
1240
1376
  * Adds an event to EventCatalog
1241
1377
  *
@@ -1243,7 +1379,7 @@ var src_default = (path6) => {
1243
1379
  * @param options - Optional options to write the event
1244
1380
  *
1245
1381
  */
1246
- writeEvent: writeEvent((0, import_node_path18.join)(path6, "events")),
1382
+ writeEvent: writeEvent((0, import_node_path20.join)(path6, "events")),
1247
1383
  /**
1248
1384
  * Adds an event to a service in EventCatalog
1249
1385
  *
@@ -1252,26 +1388,26 @@ var src_default = (path6) => {
1252
1388
  * @param options - Optional options to write the event
1253
1389
  *
1254
1390
  */
1255
- writeEventToService: writeEventToService((0, import_node_path18.join)(path6)),
1391
+ writeEventToService: writeEventToService((0, import_node_path20.join)(path6)),
1256
1392
  /**
1257
1393
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1258
1394
  *
1259
1395
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1260
1396
  *
1261
1397
  */
1262
- rmEvent: rmEvent((0, import_node_path18.join)(path6, "events")),
1398
+ rmEvent: rmEvent((0, import_node_path20.join)(path6, "events")),
1263
1399
  /**
1264
1400
  * Remove an event by an Event id
1265
1401
  *
1266
1402
  * @param id - The id of the event you want to remove
1267
1403
  *
1268
1404
  */
1269
- rmEventById: rmEventById((0, import_node_path18.join)(path6)),
1405
+ rmEventById: rmEventById((0, import_node_path20.join)(path6)),
1270
1406
  /**
1271
1407
  * Moves a given event id to the version directory
1272
1408
  * @param directory
1273
1409
  */
1274
- versionEvent: versionEvent((0, import_node_path18.join)(path6)),
1410
+ versionEvent: versionEvent((0, import_node_path20.join)(path6)),
1275
1411
  /**
1276
1412
  * Adds a file to the given event
1277
1413
  * @param id - The id of the event to add the file to
@@ -1279,7 +1415,7 @@ var src_default = (path6) => {
1279
1415
  * @param version - Optional version of the event to add the file to
1280
1416
  * @returns
1281
1417
  */
1282
- addFileToEvent: addFileToEvent((0, import_node_path18.join)(path6)),
1418
+ addFileToEvent: addFileToEvent((0, import_node_path20.join)(path6)),
1283
1419
  /**
1284
1420
  * Adds a schema to the given event
1285
1421
  * @param id - The id of the event to add the schema to
@@ -1287,14 +1423,14 @@ var src_default = (path6) => {
1287
1423
  * @param version - Optional version of the event to add the schema to
1288
1424
  * @returns
1289
1425
  */
1290
- addSchemaToEvent: addSchemaToEvent((0, import_node_path18.join)(path6)),
1426
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path20.join)(path6)),
1291
1427
  /**
1292
1428
  * Check to see if an event version exists
1293
1429
  * @param id - The id of the event
1294
1430
  * @param version - The version of the event (supports semver)
1295
1431
  * @returns
1296
1432
  */
1297
- eventHasVersion: eventHasVersion((0, import_node_path18.join)(path6)),
1433
+ eventHasVersion: eventHasVersion((0, import_node_path20.join)(path6)),
1298
1434
  /**
1299
1435
  * ================================
1300
1436
  * Commands
@@ -1306,13 +1442,13 @@ var src_default = (path6) => {
1306
1442
  * @param version - Optional id of the version to get (supports semver)
1307
1443
  * @returns Command|Undefined
1308
1444
  */
1309
- getCommand: getCommand((0, import_node_path18.join)(path6)),
1445
+ getCommand: getCommand((0, import_node_path20.join)(path6)),
1310
1446
  /**
1311
1447
  * Returns all commands from EventCatalog
1312
1448
  * @param latestOnly - optional boolean, set to true to get only latest versions
1313
1449
  * @returns Command[]|Undefined
1314
1450
  */
1315
- getCommands: getCommands((0, import_node_path18.join)(path6)),
1451
+ getCommands: getCommands((0, import_node_path20.join)(path6)),
1316
1452
  /**
1317
1453
  * Adds an command to EventCatalog
1318
1454
  *
@@ -1320,7 +1456,7 @@ var src_default = (path6) => {
1320
1456
  * @param options - Optional options to write the command
1321
1457
  *
1322
1458
  */
1323
- writeCommand: writeCommand((0, import_node_path18.join)(path6, "commands")),
1459
+ writeCommand: writeCommand((0, import_node_path20.join)(path6, "commands")),
1324
1460
  /**
1325
1461
  * Adds a command to a service in EventCatalog
1326
1462
  *
@@ -1329,26 +1465,26 @@ var src_default = (path6) => {
1329
1465
  * @param options - Optional options to write the command
1330
1466
  *
1331
1467
  */
1332
- writeCommandToService: writeCommandToService((0, import_node_path18.join)(path6)),
1468
+ writeCommandToService: writeCommandToService((0, import_node_path20.join)(path6)),
1333
1469
  /**
1334
1470
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1335
1471
  *
1336
1472
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1337
1473
  *
1338
1474
  */
1339
- rmCommand: rmCommand((0, import_node_path18.join)(path6, "commands")),
1475
+ rmCommand: rmCommand((0, import_node_path20.join)(path6, "commands")),
1340
1476
  /**
1341
1477
  * Remove an command by an Event id
1342
1478
  *
1343
1479
  * @param id - The id of the command you want to remove
1344
1480
  *
1345
1481
  */
1346
- rmCommandById: rmCommandById((0, import_node_path18.join)(path6)),
1482
+ rmCommandById: rmCommandById((0, import_node_path20.join)(path6)),
1347
1483
  /**
1348
1484
  * Moves a given command id to the version directory
1349
1485
  * @param directory
1350
1486
  */
1351
- versionCommand: versionCommand((0, import_node_path18.join)(path6)),
1487
+ versionCommand: versionCommand((0, import_node_path20.join)(path6)),
1352
1488
  /**
1353
1489
  * Adds a file to the given command
1354
1490
  * @param id - The id of the command to add the file to
@@ -1356,7 +1492,7 @@ var src_default = (path6) => {
1356
1492
  * @param version - Optional version of the command to add the file to
1357
1493
  * @returns
1358
1494
  */
1359
- addFileToCommand: addFileToCommand((0, import_node_path18.join)(path6)),
1495
+ addFileToCommand: addFileToCommand((0, import_node_path20.join)(path6)),
1360
1496
  /**
1361
1497
  * Adds a schema to the given command
1362
1498
  * @param id - The id of the command to add the schema to
@@ -1364,14 +1500,14 @@ var src_default = (path6) => {
1364
1500
  * @param version - Optional version of the command to add the schema to
1365
1501
  * @returns
1366
1502
  */
1367
- addSchemaToCommand: addSchemaToCommand((0, import_node_path18.join)(path6)),
1503
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path20.join)(path6)),
1368
1504
  /**
1369
1505
  * Check to see if a command version exists
1370
1506
  * @param id - The id of the command
1371
1507
  * @param version - The version of the command (supports semver)
1372
1508
  * @returns
1373
1509
  */
1374
- commandHasVersion: commandHasVersion((0, import_node_path18.join)(path6)),
1510
+ commandHasVersion: commandHasVersion((0, import_node_path20.join)(path6)),
1375
1511
  /**
1376
1512
  * ================================
1377
1513
  * Queries
@@ -1383,13 +1519,13 @@ var src_default = (path6) => {
1383
1519
  * @param version - Optional id of the version to get (supports semver)
1384
1520
  * @returns Query|Undefined
1385
1521
  */
1386
- getQuery: getQuery((0, import_node_path18.join)(path6)),
1522
+ getQuery: getQuery((0, import_node_path20.join)(path6)),
1387
1523
  /**
1388
1524
  * Returns all queries from EventCatalog
1389
1525
  * @param latestOnly - optional boolean, set to true to get only latest versions
1390
1526
  * @returns Query[]|Undefined
1391
1527
  */
1392
- getQueries: getQueries((0, import_node_path18.join)(path6)),
1528
+ getQueries: getQueries((0, import_node_path20.join)(path6)),
1393
1529
  /**
1394
1530
  * Adds a query to EventCatalog
1395
1531
  *
@@ -1397,7 +1533,7 @@ var src_default = (path6) => {
1397
1533
  * @param options - Optional options to write the event
1398
1534
  *
1399
1535
  */
1400
- writeQuery: writeQuery((0, import_node_path18.join)(path6, "queries")),
1536
+ writeQuery: writeQuery((0, import_node_path20.join)(path6, "queries")),
1401
1537
  /**
1402
1538
  * Adds a query to a service in EventCatalog
1403
1539
  *
@@ -1406,26 +1542,26 @@ var src_default = (path6) => {
1406
1542
  * @param options - Optional options to write the query
1407
1543
  *
1408
1544
  */
1409
- writeQueryToService: writeQueryToService((0, import_node_path18.join)(path6)),
1545
+ writeQueryToService: writeQueryToService((0, import_node_path20.join)(path6)),
1410
1546
  /**
1411
1547
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1412
1548
  *
1413
1549
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1414
1550
  *
1415
1551
  */
1416
- rmQuery: rmQuery((0, import_node_path18.join)(path6, "queries")),
1552
+ rmQuery: rmQuery((0, import_node_path20.join)(path6, "queries")),
1417
1553
  /**
1418
1554
  * Remove a query by a Query id
1419
1555
  *
1420
1556
  * @param id - The id of the query you want to remove
1421
1557
  *
1422
1558
  */
1423
- rmQueryById: rmQueryById((0, import_node_path18.join)(path6)),
1559
+ rmQueryById: rmQueryById((0, import_node_path20.join)(path6)),
1424
1560
  /**
1425
1561
  * Moves a given query id to the version directory
1426
1562
  * @param directory
1427
1563
  */
1428
- versionQuery: versionQuery((0, import_node_path18.join)(path6)),
1564
+ versionQuery: versionQuery((0, import_node_path20.join)(path6)),
1429
1565
  /**
1430
1566
  * Adds a file to the given query
1431
1567
  * @param id - The id of the query to add the file to
@@ -1433,7 +1569,7 @@ var src_default = (path6) => {
1433
1569
  * @param version - Optional version of the query to add the file to
1434
1570
  * @returns
1435
1571
  */
1436
- addFileToQuery: addFileToQuery((0, import_node_path18.join)(path6)),
1572
+ addFileToQuery: addFileToQuery((0, import_node_path20.join)(path6)),
1437
1573
  /**
1438
1574
  * Adds a schema to the given query
1439
1575
  * @param id - The id of the query to add the schema to
@@ -1441,14 +1577,14 @@ var src_default = (path6) => {
1441
1577
  * @param version - Optional version of the query to add the schema to
1442
1578
  * @returns
1443
1579
  */
1444
- addSchemaToQuery: addSchemaToQuery((0, import_node_path18.join)(path6)),
1580
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path20.join)(path6)),
1445
1581
  /**
1446
1582
  * Check to see if an query version exists
1447
1583
  * @param id - The id of the query
1448
1584
  * @param version - The version of the query (supports semver)
1449
1585
  * @returns
1450
1586
  */
1451
- queryHasVersion: queryHasVersion((0, import_node_path18.join)(path6)),
1587
+ queryHasVersion: queryHasVersion((0, import_node_path20.join)(path6)),
1452
1588
  /**
1453
1589
  * ================================
1454
1590
  * Channels
@@ -1460,13 +1596,13 @@ var src_default = (path6) => {
1460
1596
  * @param version - Optional id of the version to get (supports semver)
1461
1597
  * @returns Channel|Undefined
1462
1598
  */
1463
- getChannel: getChannel((0, import_node_path18.join)(path6)),
1599
+ getChannel: getChannel((0, import_node_path20.join)(path6)),
1464
1600
  /**
1465
1601
  * Returns all channels from EventCatalog
1466
1602
  * @param latestOnly - optional boolean, set to true to get only latest versions
1467
1603
  * @returns Channel[]|Undefined
1468
1604
  */
1469
- getChannels: getChannels((0, import_node_path18.join)(path6)),
1605
+ getChannels: getChannels((0, import_node_path20.join)(path6)),
1470
1606
  /**
1471
1607
  * Adds an channel to EventCatalog
1472
1608
  *
@@ -1474,33 +1610,33 @@ var src_default = (path6) => {
1474
1610
  * @param options - Optional options to write the channel
1475
1611
  *
1476
1612
  */
1477
- writeChannel: writeChannel((0, import_node_path18.join)(path6, "channels")),
1613
+ writeChannel: writeChannel((0, import_node_path20.join)(path6, "channels")),
1478
1614
  /**
1479
1615
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1480
1616
  *
1481
1617
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1482
1618
  *
1483
1619
  */
1484
- rmChannel: rmChannel((0, import_node_path18.join)(path6, "channels")),
1620
+ rmChannel: rmChannel((0, import_node_path20.join)(path6, "channels")),
1485
1621
  /**
1486
1622
  * Remove an channel by an Event id
1487
1623
  *
1488
1624
  * @param id - The id of the channel you want to remove
1489
1625
  *
1490
1626
  */
1491
- rmChannelById: rmChannelById((0, import_node_path18.join)(path6)),
1627
+ rmChannelById: rmChannelById((0, import_node_path20.join)(path6)),
1492
1628
  /**
1493
1629
  * Moves a given channel id to the version directory
1494
1630
  * @param directory
1495
1631
  */
1496
- versionChannel: versionChannel((0, import_node_path18.join)(path6)),
1632
+ versionChannel: versionChannel((0, import_node_path20.join)(path6)),
1497
1633
  /**
1498
1634
  * Check to see if a channel version exists
1499
1635
  * @param id - The id of the channel
1500
1636
  * @param version - The version of the channel (supports semver)
1501
1637
  * @returns
1502
1638
  */
1503
- channelHasVersion: channelHasVersion((0, import_node_path18.join)(path6)),
1639
+ channelHasVersion: channelHasVersion((0, import_node_path20.join)(path6)),
1504
1640
  /**
1505
1641
  * Add a channel to an event
1506
1642
  *
@@ -1517,7 +1653,7 @@ var src_default = (path6) => {
1517
1653
  *
1518
1654
  * ```
1519
1655
  */
1520
- addEventToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "events"),
1656
+ addEventToChannel: addMessageToChannel((0, import_node_path20.join)(path6), "events"),
1521
1657
  /**
1522
1658
  * Add a channel to an command
1523
1659
  *
@@ -1534,7 +1670,7 @@ var src_default = (path6) => {
1534
1670
  *
1535
1671
  * ```
1536
1672
  */
1537
- addCommandToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "commands"),
1673
+ addCommandToChannel: addMessageToChannel((0, import_node_path20.join)(path6), "commands"),
1538
1674
  /**
1539
1675
  * Add a channel to an query
1540
1676
  *
@@ -1551,7 +1687,7 @@ var src_default = (path6) => {
1551
1687
  *
1552
1688
  * ```
1553
1689
  */
1554
- addQueryToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "queries"),
1690
+ addQueryToChannel: addMessageToChannel((0, import_node_path20.join)(path6), "queries"),
1555
1691
  /**
1556
1692
  * ================================
1557
1693
  * SERVICES
@@ -1564,14 +1700,14 @@ var src_default = (path6) => {
1564
1700
  * @param options - Optional options to write the event
1565
1701
  *
1566
1702
  */
1567
- writeService: writeService((0, import_node_path18.join)(path6, "services")),
1703
+ writeService: writeService((0, import_node_path20.join)(path6, "services")),
1568
1704
  /**
1569
1705
  * Adds a versioned service to EventCatalog
1570
1706
  *
1571
1707
  * @param service - The service to write
1572
1708
  *
1573
1709
  */
1574
- writeVersionedService: writeVersionedService((0, import_node_path18.join)(path6, "services")),
1710
+ writeVersionedService: writeVersionedService((0, import_node_path20.join)(path6, "services")),
1575
1711
  /**
1576
1712
  * Adds a service to a domain in EventCatalog
1577
1713
  *
@@ -1580,45 +1716,45 @@ var src_default = (path6) => {
1580
1716
  * @param options - Optional options to write the event
1581
1717
  *
1582
1718
  */
1583
- writeServiceToDomain: writeServiceToDomain((0, import_node_path18.join)(path6, "domains")),
1719
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path20.join)(path6, "domains")),
1584
1720
  /**
1585
1721
  * Returns a service from EventCatalog
1586
1722
  * @param id - The id of the service to retrieve
1587
1723
  * @param version - Optional id of the version to get (supports semver)
1588
1724
  * @returns Service|Undefined
1589
1725
  */
1590
- getService: getService((0, import_node_path18.join)(path6)),
1726
+ getService: getService((0, import_node_path20.join)(path6)),
1591
1727
  /**
1592
1728
  * Returns a service from EventCatalog by it's path.
1593
1729
  * @param path - The path to the service to retrieve
1594
1730
  * @returns Service|Undefined
1595
1731
  */
1596
- getServiceByPath: getServiceByPath((0, import_node_path18.join)(path6)),
1732
+ getServiceByPath: getServiceByPath((0, import_node_path20.join)(path6)),
1597
1733
  /**
1598
1734
  * Returns all services from EventCatalog
1599
1735
  * @param latestOnly - optional boolean, set to true to get only latest versions
1600
1736
  * @returns Service[]|Undefined
1601
1737
  */
1602
- getServices: getServices((0, import_node_path18.join)(path6)),
1738
+ getServices: getServices((0, import_node_path20.join)(path6)),
1603
1739
  /**
1604
1740
  * Moves a given service id to the version directory
1605
1741
  * @param directory
1606
1742
  */
1607
- versionService: versionService((0, import_node_path18.join)(path6)),
1743
+ versionService: versionService((0, import_node_path20.join)(path6)),
1608
1744
  /**
1609
1745
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1610
1746
  *
1611
1747
  * @param path - The path to your service, e.g. `/InventoryService`
1612
1748
  *
1613
1749
  */
1614
- rmService: rmService((0, import_node_path18.join)(path6, "services")),
1750
+ rmService: rmService((0, import_node_path20.join)(path6, "services")),
1615
1751
  /**
1616
1752
  * Remove an service by an service id
1617
1753
  *
1618
1754
  * @param id - The id of the service you want to remove
1619
1755
  *
1620
1756
  */
1621
- rmServiceById: rmServiceById((0, import_node_path18.join)(path6)),
1757
+ rmServiceById: rmServiceById((0, import_node_path20.join)(path6)),
1622
1758
  /**
1623
1759
  * Adds a file to the given service
1624
1760
  * @param id - The id of the service to add the file to
@@ -1626,21 +1762,21 @@ var src_default = (path6) => {
1626
1762
  * @param version - Optional version of the service to add the file to
1627
1763
  * @returns
1628
1764
  */
1629
- addFileToService: addFileToService((0, import_node_path18.join)(path6)),
1765
+ addFileToService: addFileToService((0, import_node_path20.join)(path6)),
1630
1766
  /**
1631
1767
  * Returns the specifications for a given service
1632
1768
  * @param id - The id of the service to retrieve the specifications for
1633
1769
  * @param version - Optional version of the service
1634
1770
  * @returns
1635
1771
  */
1636
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path18.join)(path6)),
1772
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path20.join)(path6)),
1637
1773
  /**
1638
1774
  * Check to see if a service version exists
1639
1775
  * @param id - The id of the service
1640
1776
  * @param version - The version of the service (supports semver)
1641
1777
  * @returns
1642
1778
  */
1643
- serviceHasVersion: serviceHasVersion((0, import_node_path18.join)(path6)),
1779
+ serviceHasVersion: serviceHasVersion((0, import_node_path20.join)(path6)),
1644
1780
  /**
1645
1781
  * Add an event to a service by it's id.
1646
1782
  *
@@ -1660,7 +1796,7 @@ var src_default = (path6) => {
1660
1796
  *
1661
1797
  * ```
1662
1798
  */
1663
- addEventToService: addMessageToService((0, import_node_path18.join)(path6)),
1799
+ addEventToService: addMessageToService((0, import_node_path20.join)(path6)),
1664
1800
  /**
1665
1801
  * Add a data store to a service by it's id.
1666
1802
  *
@@ -1677,7 +1813,7 @@ var src_default = (path6) => {
1677
1813
  *
1678
1814
  * ```
1679
1815
  */
1680
- addDataStoreToService: addDataStoreToService((0, import_node_path18.join)(path6)),
1816
+ addDataStoreToService: addDataStoreToService((0, import_node_path20.join)(path6)),
1681
1817
  /**
1682
1818
  * Add a command to a service by it's id.
1683
1819
  *
@@ -1697,7 +1833,7 @@ var src_default = (path6) => {
1697
1833
  *
1698
1834
  * ```
1699
1835
  */
1700
- addCommandToService: addMessageToService((0, import_node_path18.join)(path6)),
1836
+ addCommandToService: addMessageToService((0, import_node_path20.join)(path6)),
1701
1837
  /**
1702
1838
  * Add a query to a service by it's id.
1703
1839
  *
@@ -1717,7 +1853,7 @@ var src_default = (path6) => {
1717
1853
  *
1718
1854
  * ```
1719
1855
  */
1720
- addQueryToService: addMessageToService((0, import_node_path18.join)(path6)),
1856
+ addQueryToService: addMessageToService((0, import_node_path20.join)(path6)),
1721
1857
  /**
1722
1858
  * Add an entity to a service by its id.
1723
1859
  *
@@ -1735,7 +1871,7 @@ var src_default = (path6) => {
1735
1871
  *
1736
1872
  * ```
1737
1873
  */
1738
- addEntityToService: addEntityToService((0, import_node_path18.join)(path6)),
1874
+ addEntityToService: addEntityToService((0, import_node_path20.join)(path6)),
1739
1875
  /**
1740
1876
  * Check to see if a service exists by it's path.
1741
1877
  *
@@ -1752,13 +1888,13 @@ var src_default = (path6) => {
1752
1888
  * @param path - The path to the service to check
1753
1889
  * @returns boolean
1754
1890
  */
1755
- isService: isService((0, import_node_path18.join)(path6)),
1891
+ isService: isService((0, import_node_path20.join)(path6)),
1756
1892
  /**
1757
1893
  * Converts a file to a service.
1758
1894
  * @param file - The file to convert to a service.
1759
1895
  * @returns The service.
1760
1896
  */
1761
- toService: toService((0, import_node_path18.join)(path6)),
1897
+ toService: toService((0, import_node_path20.join)(path6)),
1762
1898
  /**
1763
1899
  * ================================
1764
1900
  * Domains
@@ -1771,39 +1907,39 @@ var src_default = (path6) => {
1771
1907
  * @param options - Optional options to write the event
1772
1908
  *
1773
1909
  */
1774
- writeDomain: writeDomain((0, import_node_path18.join)(path6, "domains")),
1910
+ writeDomain: writeDomain((0, import_node_path20.join)(path6, "domains")),
1775
1911
  /**
1776
1912
  * Returns a domain from EventCatalog
1777
1913
  * @param id - The id of the domain to retrieve
1778
1914
  * @param version - Optional id of the version to get (supports semver)
1779
1915
  * @returns Domain|Undefined
1780
1916
  */
1781
- getDomain: getDomain((0, import_node_path18.join)(path6, "domains")),
1917
+ getDomain: getDomain((0, import_node_path20.join)(path6, "domains")),
1782
1918
  /**
1783
1919
  * Returns all domains from EventCatalog
1784
1920
  * @param latestOnly - optional boolean, set to true to get only latest versions
1785
1921
  * @returns Domain[]|Undefined
1786
1922
  */
1787
- getDomains: getDomains((0, import_node_path18.join)(path6)),
1923
+ getDomains: getDomains((0, import_node_path20.join)(path6)),
1788
1924
  /**
1789
1925
  * Moves a given domain id to the version directory
1790
1926
  * @param directory
1791
1927
  */
1792
- versionDomain: versionDomain((0, import_node_path18.join)(path6, "domains")),
1928
+ versionDomain: versionDomain((0, import_node_path20.join)(path6, "domains")),
1793
1929
  /**
1794
1930
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1795
1931
  *
1796
1932
  * @param path - The path to your domain, e.g. `/Payment`
1797
1933
  *
1798
1934
  */
1799
- rmDomain: rmDomain((0, import_node_path18.join)(path6, "domains")),
1935
+ rmDomain: rmDomain((0, import_node_path20.join)(path6, "domains")),
1800
1936
  /**
1801
1937
  * Remove an service by an domain id
1802
1938
  *
1803
1939
  * @param id - The id of the domain you want to remove
1804
1940
  *
1805
1941
  */
1806
- rmDomainById: rmDomainById((0, import_node_path18.join)(path6, "domains")),
1942
+ rmDomainById: rmDomainById((0, import_node_path20.join)(path6, "domains")),
1807
1943
  /**
1808
1944
  * Adds a file to the given domain
1809
1945
  * @param id - The id of the domain to add the file to
@@ -1811,28 +1947,28 @@ var src_default = (path6) => {
1811
1947
  * @param version - Optional version of the domain to add the file to
1812
1948
  * @returns
1813
1949
  */
1814
- addFileToDomain: addFileToDomain((0, import_node_path18.join)(path6, "domains")),
1950
+ addFileToDomain: addFileToDomain((0, import_node_path20.join)(path6, "domains")),
1815
1951
  /**
1816
1952
  * Adds an ubiquitous language dictionary to a domain
1817
1953
  * @param id - The id of the domain to add the ubiquitous language to
1818
1954
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1819
1955
  * @param version - Optional version of the domain to add the ubiquitous language to
1820
1956
  */
1821
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path18.join)(path6, "domains")),
1957
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path20.join)(path6, "domains")),
1822
1958
  /**
1823
1959
  * Get the ubiquitous language dictionary from a domain
1824
1960
  * @param id - The id of the domain to get the ubiquitous language from
1825
1961
  * @param version - Optional version of the domain to get the ubiquitous language from
1826
1962
  * @returns
1827
1963
  */
1828
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path18.join)(path6, "domains")),
1964
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path20.join)(path6, "domains")),
1829
1965
  /**
1830
1966
  * Check to see if a domain version exists
1831
1967
  * @param id - The id of the domain
1832
1968
  * @param version - The version of the domain (supports semver)
1833
1969
  * @returns
1834
1970
  */
1835
- domainHasVersion: domainHasVersion((0, import_node_path18.join)(path6)),
1971
+ domainHasVersion: domainHasVersion((0, import_node_path20.join)(path6)),
1836
1972
  /**
1837
1973
  * Adds a given service to a domain
1838
1974
  * @param id - The id of the domain
@@ -1840,7 +1976,7 @@ var src_default = (path6) => {
1840
1976
  * @param version - (Optional) The version of the domain to add the service to
1841
1977
  * @returns
1842
1978
  */
1843
- addServiceToDomain: addServiceToDomain((0, import_node_path18.join)(path6, "domains")),
1979
+ addServiceToDomain: addServiceToDomain((0, import_node_path20.join)(path6, "domains")),
1844
1980
  /**
1845
1981
  * Adds a given subdomain to a domain
1846
1982
  * @param id - The id of the domain
@@ -1848,7 +1984,7 @@ var src_default = (path6) => {
1848
1984
  * @param version - (Optional) The version of the domain to add the subdomain to
1849
1985
  * @returns
1850
1986
  */
1851
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path18.join)(path6, "domains")),
1987
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path20.join)(path6, "domains")),
1852
1988
  /**
1853
1989
  * Adds an entity to a domain
1854
1990
  * @param id - The id of the domain
@@ -1856,7 +1992,7 @@ var src_default = (path6) => {
1856
1992
  * @param version - (Optional) The version of the domain to add the entity to
1857
1993
  * @returns
1858
1994
  */
1859
- addEntityToDomain: addEntityToDomain((0, import_node_path18.join)(path6, "domains")),
1995
+ addEntityToDomain: addEntityToDomain((0, import_node_path20.join)(path6, "domains")),
1860
1996
  /**
1861
1997
  * Add an event to a domain by its id.
1862
1998
  *
@@ -1874,7 +2010,7 @@ var src_default = (path6) => {
1874
2010
  *
1875
2011
  * ```
1876
2012
  */
1877
- addEventToDomain: addMessageToDomain((0, import_node_path18.join)(path6, "domains")),
2013
+ addEventToDomain: addMessageToDomain((0, import_node_path20.join)(path6, "domains")),
1878
2014
  /**
1879
2015
  * Add a command to a domain by its id.
1880
2016
  *
@@ -1892,7 +2028,7 @@ var src_default = (path6) => {
1892
2028
  *
1893
2029
  * ```
1894
2030
  */
1895
- addCommandToDomain: addMessageToDomain((0, import_node_path18.join)(path6, "domains")),
2031
+ addCommandToDomain: addMessageToDomain((0, import_node_path20.join)(path6, "domains")),
1896
2032
  /**
1897
2033
  * Add a query to a domain by its id.
1898
2034
  *
@@ -1910,7 +2046,7 @@ var src_default = (path6) => {
1910
2046
  *
1911
2047
  * ```
1912
2048
  */
1913
- addQueryToDomain: addMessageToDomain((0, import_node_path18.join)(path6, "domains")),
2049
+ addQueryToDomain: addMessageToDomain((0, import_node_path20.join)(path6, "domains")),
1914
2050
  /**
1915
2051
  * ================================
1916
2052
  * Teams
@@ -1923,25 +2059,25 @@ var src_default = (path6) => {
1923
2059
  * @param options - Optional options to write the team
1924
2060
  *
1925
2061
  */
1926
- writeTeam: writeTeam((0, import_node_path18.join)(path6, "teams")),
2062
+ writeTeam: writeTeam((0, import_node_path20.join)(path6, "teams")),
1927
2063
  /**
1928
2064
  * Returns a team from EventCatalog
1929
2065
  * @param id - The id of the team to retrieve
1930
2066
  * @returns Team|Undefined
1931
2067
  */
1932
- getTeam: getTeam((0, import_node_path18.join)(path6, "teams")),
2068
+ getTeam: getTeam((0, import_node_path20.join)(path6, "teams")),
1933
2069
  /**
1934
2070
  * Returns all teams from EventCatalog
1935
2071
  * @returns Team[]|Undefined
1936
2072
  */
1937
- getTeams: getTeams((0, import_node_path18.join)(path6, "teams")),
2073
+ getTeams: getTeams((0, import_node_path20.join)(path6, "teams")),
1938
2074
  /**
1939
2075
  * Remove a team by the team id
1940
2076
  *
1941
2077
  * @param id - The id of the team you want to remove
1942
2078
  *
1943
2079
  */
1944
- rmTeamById: rmTeamById((0, import_node_path18.join)(path6, "teams")),
2080
+ rmTeamById: rmTeamById((0, import_node_path20.join)(path6, "teams")),
1945
2081
  /**
1946
2082
  * ================================
1947
2083
  * Users
@@ -1954,25 +2090,25 @@ var src_default = (path6) => {
1954
2090
  * @param options - Optional options to write the user
1955
2091
  *
1956
2092
  */
1957
- writeUser: writeUser((0, import_node_path18.join)(path6, "users")),
2093
+ writeUser: writeUser((0, import_node_path20.join)(path6, "users")),
1958
2094
  /**
1959
2095
  * Returns a user from EventCatalog
1960
2096
  * @param id - The id of the user to retrieve
1961
2097
  * @returns User|Undefined
1962
2098
  */
1963
- getUser: getUser((0, import_node_path18.join)(path6, "users")),
2099
+ getUser: getUser((0, import_node_path20.join)(path6, "users")),
1964
2100
  /**
1965
2101
  * Returns all user from EventCatalog
1966
2102
  * @returns User[]|Undefined
1967
2103
  */
1968
- getUsers: getUsers((0, import_node_path18.join)(path6)),
2104
+ getUsers: getUsers((0, import_node_path20.join)(path6)),
1969
2105
  /**
1970
2106
  * Remove a user by the user id
1971
2107
  *
1972
2108
  * @param id - The id of the user you want to remove
1973
2109
  *
1974
2110
  */
1975
- rmUserById: rmUserById((0, import_node_path18.join)(path6, "users")),
2111
+ rmUserById: rmUserById((0, import_node_path20.join)(path6, "users")),
1976
2112
  /**
1977
2113
  * ================================
1978
2114
  * Custom Docs
@@ -1983,32 +2119,32 @@ var src_default = (path6) => {
1983
2119
  * @param path - The path to the custom doc to retrieve
1984
2120
  * @returns CustomDoc|Undefined
1985
2121
  */
1986
- getCustomDoc: getCustomDoc((0, import_node_path18.join)(path6, "docs")),
2122
+ getCustomDoc: getCustomDoc((0, import_node_path20.join)(path6, "docs")),
1987
2123
  /**
1988
2124
  * Returns all custom docs from EventCatalog
1989
2125
  * @param options - Optional options to get custom docs from a specific path
1990
2126
  * @returns CustomDoc[]|Undefined
1991
2127
  */
1992
- getCustomDocs: getCustomDocs((0, import_node_path18.join)(path6, "docs")),
2128
+ getCustomDocs: getCustomDocs((0, import_node_path20.join)(path6, "docs")),
1993
2129
  /**
1994
2130
  * Writes a custom doc to EventCatalog
1995
2131
  * @param customDoc - The custom doc to write
1996
2132
  * @param options - Optional options to write the custom doc
1997
2133
  *
1998
2134
  */
1999
- writeCustomDoc: writeCustomDoc((0, import_node_path18.join)(path6, "docs")),
2135
+ writeCustomDoc: writeCustomDoc((0, import_node_path20.join)(path6, "docs")),
2000
2136
  /**
2001
2137
  * Removes a custom doc from EventCatalog
2002
2138
  * @param path - The path to the custom doc to remove
2003
2139
  *
2004
2140
  */
2005
- rmCustomDoc: rmCustomDoc((0, import_node_path18.join)(path6, "docs")),
2141
+ rmCustomDoc: rmCustomDoc((0, import_node_path20.join)(path6, "docs")),
2006
2142
  /**
2007
2143
  * Dumps the catalog to a JSON file.
2008
2144
  * @param directory - The directory to dump the catalog to
2009
2145
  * @returns A JSON file with the catalog
2010
2146
  */
2011
- dumpCatalog: dumpCatalog((0, import_node_path18.join)(path6)),
2147
+ dumpCatalog: dumpCatalog((0, import_node_path20.join)(path6)),
2012
2148
  /**
2013
2149
  * Returns the event catalog configuration file.
2014
2150
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2016,7 +2152,7 @@ var src_default = (path6) => {
2016
2152
  * @param directory - The directory of the catalog.
2017
2153
  * @returns A JSON object with the configuration for the event catalog.
2018
2154
  */
2019
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path18.join)(path6)),
2155
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path20.join)(path6)),
2020
2156
  /**
2021
2157
  * ================================
2022
2158
  * Resources Utils
@@ -2041,33 +2177,33 @@ var src_default = (path6) => {
2041
2177
  * @param path - The path to the message to retrieve
2042
2178
  * @returns Message|Undefined
2043
2179
  */
2044
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path18.join)(path6)),
2180
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path20.join)(path6)),
2045
2181
  /**
2046
2182
  * Returns the producers and consumers (services) for a given message
2047
2183
  * @param id - The id of the message to get the producers and consumers for
2048
2184
  * @param version - Optional version of the message
2049
2185
  * @returns { producers: Service[], consumers: Service[] }
2050
2186
  */
2051
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path18.join)(path6)),
2187
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path20.join)(path6)),
2052
2188
  /**
2053
2189
  * Returns the consumers of a given schema path
2054
2190
  * @param path - The path to the schema to get the consumers for
2055
2191
  * @returns Service[]
2056
2192
  */
2057
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path18.join)(path6)),
2193
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path20.join)(path6)),
2058
2194
  /**
2059
2195
  * Returns the producers of a given schema path
2060
2196
  * @param path - The path to the schema to get the producers for
2061
2197
  * @returns Service[]
2062
2198
  */
2063
- getProducersOfSchema: getProducersOfSchema((0, import_node_path18.join)(path6)),
2199
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path20.join)(path6)),
2064
2200
  /**
2065
2201
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
2066
2202
  * @param id - The id of the resource to get the owners for
2067
2203
  * @param version - Optional version of the resource
2068
2204
  * @returns { owners: User[] }
2069
2205
  */
2070
- getOwnersForResource: getOwnersForResource((0, import_node_path18.join)(path6)),
2206
+ getOwnersForResource: getOwnersForResource((0, import_node_path20.join)(path6)),
2071
2207
  /**
2072
2208
  * ================================
2073
2209
  * Entities
@@ -2079,13 +2215,13 @@ var src_default = (path6) => {
2079
2215
  * @param version - Optional id of the version to get (supports semver)
2080
2216
  * @returns Entity|Undefined
2081
2217
  */
2082
- getEntity: getEntity((0, import_node_path18.join)(path6)),
2218
+ getEntity: getEntity((0, import_node_path20.join)(path6)),
2083
2219
  /**
2084
2220
  * Returns all entities from EventCatalog
2085
2221
  * @param latestOnly - optional boolean, set to true to get only latest versions
2086
2222
  * @returns Entity[]|Undefined
2087
2223
  */
2088
- getEntities: getEntities((0, import_node_path18.join)(path6)),
2224
+ getEntities: getEntities((0, import_node_path20.join)(path6)),
2089
2225
  /**
2090
2226
  * Adds an entity to EventCatalog
2091
2227
  *
@@ -2093,33 +2229,33 @@ var src_default = (path6) => {
2093
2229
  * @param options - Optional options to write the entity
2094
2230
  *
2095
2231
  */
2096
- writeEntity: writeEntity((0, import_node_path18.join)(path6, "entities")),
2232
+ writeEntity: writeEntity((0, import_node_path20.join)(path6, "entities")),
2097
2233
  /**
2098
2234
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
2099
2235
  *
2100
2236
  * @param path - The path to your entity, e.g. `/User`
2101
2237
  *
2102
2238
  */
2103
- rmEntity: rmEntity((0, import_node_path18.join)(path6, "entities")),
2239
+ rmEntity: rmEntity((0, import_node_path20.join)(path6, "entities")),
2104
2240
  /**
2105
2241
  * Remove an entity by an entity id
2106
2242
  *
2107
2243
  * @param id - The id of the entity you want to remove
2108
2244
  *
2109
2245
  */
2110
- rmEntityById: rmEntityById((0, import_node_path18.join)(path6)),
2246
+ rmEntityById: rmEntityById((0, import_node_path20.join)(path6)),
2111
2247
  /**
2112
2248
  * Moves a given entity id to the version directory
2113
2249
  * @param id - The id of the entity to version
2114
2250
  */
2115
- versionEntity: versionEntity((0, import_node_path18.join)(path6)),
2251
+ versionEntity: versionEntity((0, import_node_path20.join)(path6)),
2116
2252
  /**
2117
2253
  * Check to see if an entity version exists
2118
2254
  * @param id - The id of the entity
2119
2255
  * @param version - The version of the entity (supports semver)
2120
2256
  * @returns
2121
2257
  */
2122
- entityHasVersion: entityHasVersion((0, import_node_path18.join)(path6)),
2258
+ entityHasVersion: entityHasVersion((0, import_node_path20.join)(path6)),
2123
2259
  /**
2124
2260
  * ================================
2125
2261
  * Data Stores
@@ -2131,42 +2267,42 @@ var src_default = (path6) => {
2131
2267
  * @param options - Optional options to write the data store
2132
2268
  *
2133
2269
  */
2134
- writeDataStore: writeDataStore((0, import_node_path18.join)(path6, "containers")),
2270
+ writeDataStore: writeDataStore((0, import_node_path20.join)(path6, "containers")),
2135
2271
  /**
2136
2272
  * Returns a data store from EventCatalog
2137
2273
  * @param id - The id of the data store to retrieve
2138
2274
  * @param version - Optional id of the version to get (supports semver)
2139
2275
  * @returns Container|Undefined
2140
2276
  */
2141
- getDataStore: getDataStore((0, import_node_path18.join)(path6)),
2277
+ getDataStore: getDataStore((0, import_node_path20.join)(path6)),
2142
2278
  /**
2143
2279
  * Returns all data stores from EventCatalog
2144
2280
  * @param latestOnly - optional boolean, set to true to get only latest versions
2145
2281
  * @returns Container[]|Undefined
2146
2282
  */
2147
- getDataStores: getDataStores((0, import_node_path18.join)(path6)),
2283
+ getDataStores: getDataStores((0, import_node_path20.join)(path6)),
2148
2284
  /**
2149
2285
  * Version a data store by its id
2150
2286
  * @param id - The id of the data store to version
2151
2287
  */
2152
- versionDataStore: versionDataStore((0, import_node_path18.join)(path6, "containers")),
2288
+ versionDataStore: versionDataStore((0, import_node_path20.join)(path6, "containers")),
2153
2289
  /**
2154
2290
  * Remove a data store by its path
2155
2291
  * @param path - The path to the data store to remove
2156
2292
  */
2157
- rmDataStore: rmDataStore((0, import_node_path18.join)(path6, "containers")),
2293
+ rmDataStore: rmDataStore((0, import_node_path20.join)(path6, "containers")),
2158
2294
  /**
2159
2295
  * Remove a data store by its id
2160
2296
  * @param id - The id of the data store to remove
2161
2297
  */
2162
- rmDataStoreById: rmDataStoreById((0, import_node_path18.join)(path6)),
2298
+ rmDataStoreById: rmDataStoreById((0, import_node_path20.join)(path6)),
2163
2299
  /**
2164
2300
  * Check to see if a data store version exists
2165
2301
  * @param id - The id of the data store
2166
2302
  * @param version - The version of the data store (supports semver)
2167
2303
  * @returns
2168
2304
  */
2169
- dataStoreHasVersion: dataStoreHasVersion((0, import_node_path18.join)(path6)),
2305
+ dataStoreHasVersion: dataStoreHasVersion((0, import_node_path20.join)(path6)),
2170
2306
  /**
2171
2307
  * Adds a file to a data store by its id
2172
2308
  * @param id - The id of the data store to add the file to
@@ -2174,14 +2310,14 @@ var src_default = (path6) => {
2174
2310
  * @param version - Optional version of the data store to add the file to
2175
2311
  * @returns
2176
2312
  */
2177
- addFileToDataStore: addFileToDataStore((0, import_node_path18.join)(path6)),
2313
+ addFileToDataStore: addFileToDataStore((0, import_node_path20.join)(path6)),
2178
2314
  /**
2179
2315
  * Writes a data store to a service by its id
2180
2316
  * @param dataStore - The data store to write
2181
2317
  * @param service - The service to write the data store to
2182
2318
  * @returns
2183
2319
  */
2184
- writeDataStoreToService: writeDataStoreToService((0, import_node_path18.join)(path6)),
2320
+ writeDataStoreToService: writeDataStoreToService((0, import_node_path20.join)(path6)),
2185
2321
  /**
2186
2322
  * ================================
2187
2323
  * Data Products
@@ -2193,7 +2329,7 @@ var src_default = (path6) => {
2193
2329
  * @param options - Optional options to write the data product
2194
2330
  *
2195
2331
  */
2196
- writeDataProduct: writeDataProduct((0, import_node_path18.join)(path6, "data-products")),
2332
+ writeDataProduct: writeDataProduct((0, import_node_path20.join)(path6, "data-products")),
2197
2333
  /**
2198
2334
  * Writes a data product to a domain in EventCatalog
2199
2335
  * @param dataProduct - The data product to write
@@ -2201,43 +2337,43 @@ var src_default = (path6) => {
2201
2337
  * @param options - Optional options to write the data product
2202
2338
  *
2203
2339
  */
2204
- writeDataProductToDomain: writeDataProductToDomain((0, import_node_path18.join)(path6, "domains")),
2340
+ writeDataProductToDomain: writeDataProductToDomain((0, import_node_path20.join)(path6, "domains")),
2205
2341
  /**
2206
2342
  * Returns a data product from EventCatalog
2207
2343
  * @param id - The id of the data product to retrieve
2208
2344
  * @param version - Optional id of the version to get (supports semver)
2209
2345
  * @returns DataProduct|Undefined
2210
2346
  */
2211
- getDataProduct: getDataProduct((0, import_node_path18.join)(path6)),
2347
+ getDataProduct: getDataProduct((0, import_node_path20.join)(path6)),
2212
2348
  /**
2213
2349
  * Returns all data products from EventCatalog
2214
2350
  * @param latestOnly - optional boolean, set to true to get only latest versions
2215
2351
  * @returns DataProduct[]|Undefined
2216
2352
  */
2217
- getDataProducts: getDataProducts((0, import_node_path18.join)(path6)),
2353
+ getDataProducts: getDataProducts((0, import_node_path20.join)(path6)),
2218
2354
  /**
2219
2355
  * Version a data product by its id
2220
2356
  * @param id - The id of the data product to version
2221
2357
  */
2222
- versionDataProduct: versionDataProduct((0, import_node_path18.join)(path6)),
2358
+ versionDataProduct: versionDataProduct((0, import_node_path20.join)(path6)),
2223
2359
  /**
2224
2360
  * Remove a data product by its path
2225
2361
  * @param path - The path to the data product to remove
2226
2362
  */
2227
- rmDataProduct: rmDataProduct((0, import_node_path18.join)(path6, "data-products")),
2363
+ rmDataProduct: rmDataProduct((0, import_node_path20.join)(path6, "data-products")),
2228
2364
  /**
2229
2365
  * Remove a data product by its id
2230
2366
  * @param id - The id of the data product to remove
2231
2367
  * @param version - Optional version of the data product to remove
2232
2368
  */
2233
- rmDataProductById: rmDataProductById((0, import_node_path18.join)(path6)),
2369
+ rmDataProductById: rmDataProductById((0, import_node_path20.join)(path6)),
2234
2370
  /**
2235
2371
  * Check to see if a data product version exists
2236
2372
  * @param id - The id of the data product
2237
2373
  * @param version - The version of the data product (supports semver)
2238
2374
  * @returns
2239
2375
  */
2240
- dataProductHasVersion: dataProductHasVersion((0, import_node_path18.join)(path6)),
2376
+ dataProductHasVersion: dataProductHasVersion((0, import_node_path20.join)(path6)),
2241
2377
  /**
2242
2378
  * Adds a file to a data product by its id
2243
2379
  * @param id - The id of the data product to add the file to
@@ -2245,7 +2381,7 @@ var src_default = (path6) => {
2245
2381
  * @param version - Optional version of the data product to add the file to
2246
2382
  * @returns
2247
2383
  */
2248
- addFileToDataProduct: addFileToDataProduct((0, import_node_path18.join)(path6)),
2384
+ addFileToDataProduct: addFileToDataProduct((0, import_node_path20.join)(path6)),
2249
2385
  /**
2250
2386
  * Adds a data product to a domain
2251
2387
  * @param id - The id of the domain
@@ -2253,107 +2389,181 @@ var src_default = (path6) => {
2253
2389
  * @param version - (Optional) The version of the domain to add the data product to
2254
2390
  * @returns
2255
2391
  */
2256
- addDataProductToDomain: addDataProductToDomain((0, import_node_path18.join)(path6, "domains"))
2392
+ addDataProductToDomain: addDataProductToDomain((0, import_node_path20.join)(path6, "domains")),
2393
+ /**
2394
+ * ================================
2395
+ * Diagrams
2396
+ * ================================
2397
+ */
2398
+ /**
2399
+ * Returns a diagram from EventCatalog
2400
+ * @param id - The id of the diagram to retrieve
2401
+ * @param version - Optional id of the version to get (supports semver)
2402
+ * @returns Diagram|Undefined
2403
+ */
2404
+ getDiagram: getDiagram((0, import_node_path20.join)(path6)),
2405
+ /**
2406
+ * Returns all diagrams from EventCatalog
2407
+ * @param latestOnly - optional boolean, set to true to get only latest versions
2408
+ * @returns Diagram[]|Undefined
2409
+ */
2410
+ getDiagrams: getDiagrams((0, import_node_path20.join)(path6)),
2411
+ /**
2412
+ * Adds a diagram to EventCatalog
2413
+ *
2414
+ * @param diagram - The diagram to write
2415
+ * @param options - Optional options to write the diagram
2416
+ *
2417
+ */
2418
+ writeDiagram: writeDiagram((0, import_node_path20.join)(path6, "diagrams")),
2419
+ /**
2420
+ * Remove a diagram from EventCatalog (modeled on the standard POSIX rm utility)
2421
+ *
2422
+ * @param path - The path to your diagram, e.g. `/ArchitectureDiagram`
2423
+ *
2424
+ */
2425
+ rmDiagram: rmDiagram((0, import_node_path20.join)(path6, "diagrams")),
2426
+ /**
2427
+ * Remove a diagram by a diagram id
2428
+ *
2429
+ * @param id - The id of the diagram you want to remove
2430
+ *
2431
+ */
2432
+ rmDiagramById: rmDiagramById((0, import_node_path20.join)(path6)),
2433
+ /**
2434
+ * Moves a given diagram id to the version directory
2435
+ * @param id - The id of the diagram to version
2436
+ */
2437
+ versionDiagram: versionDiagram((0, import_node_path20.join)(path6)),
2438
+ /**
2439
+ * Check to see if a diagram version exists
2440
+ * @param id - The id of the diagram
2441
+ * @param version - The version of the diagram (supports semver)
2442
+ * @returns
2443
+ */
2444
+ diagramHasVersion: diagramHasVersion((0, import_node_path20.join)(path6)),
2445
+ /**
2446
+ * Adds a file to the given diagram
2447
+ * @param id - The id of the diagram to add the file to
2448
+ * @param file - File contents to add including the content and the file name
2449
+ * @param version - Optional version of the diagram to add the file to
2450
+ * @returns
2451
+ */
2452
+ addFileToDiagram: addFileToDiagram((0, import_node_path20.join)(path6))
2257
2453
  };
2258
2454
  };
2259
2455
 
2260
- // src/eventcatalog.ts
2261
- var DUMP_VERSION = "0.0.1";
2262
- var getEventCatalogVersion = async (catalogDir) => {
2456
+ // src/cli/executor.ts
2457
+ async function executeFunction(catalogDir, functionName, rawArgs) {
2458
+ if (!(0, import_node_fs7.existsSync)(catalogDir)) {
2459
+ throw new Error(`Catalog directory not found: ${catalogDir}`);
2460
+ }
2461
+ const sdk = src_default(catalogDir);
2462
+ if (!(functionName in sdk)) {
2463
+ throw new Error(`Function '${functionName}' not found. Use 'eventcatalog list' to see available functions.`);
2464
+ }
2465
+ const fn = sdk[functionName];
2466
+ if (typeof fn !== "function") {
2467
+ throw new Error(`'${functionName}' is not a callable function.`);
2468
+ }
2469
+ const parsedArgs = parseArguments(rawArgs);
2263
2470
  try {
2264
- const packageJson = import_fs.default.readFileSync((0, import_node_path19.join)(catalogDir, "package.json"), "utf8");
2265
- const packageJsonObject = JSON.parse(packageJson);
2266
- return packageJsonObject["dependencies"]["@eventcatalog/core"];
2471
+ return await fn(...parsedArgs);
2267
2472
  } catch (error) {
2268
- return "unknown";
2473
+ throw new Error(`Error executing '${functionName}': ${error instanceof Error ? error.message : String(error)}`);
2269
2474
  }
2270
- };
2271
- var hydrateResource = async (catalogDir, resources = [], { attachSchema = false } = {}) => {
2272
- return await Promise.all(
2273
- resources.map(async (resource) => {
2274
- const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
2275
- let schema = "";
2276
- if (resource.schemaPath && resourcePath?.fullPath) {
2277
- const pathToSchema = import_node_path19.default.join(import_node_path19.default.dirname(resourcePath?.fullPath), resource.schemaPath);
2278
- if (import_fs.default.existsSync(pathToSchema)) {
2279
- schema = import_fs.default.readFileSync(pathToSchema, "utf8");
2280
- }
2281
- }
2282
- const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
2283
- return {
2284
- ...resource,
2285
- _eventcatalog: eventcatalog
2286
- };
2287
- })
2288
- );
2289
- };
2290
- var filterCollection = (collection, options) => {
2291
- return collection.map((item) => ({
2292
- ...item,
2293
- markdown: options?.includeMarkdown ? item.markdown : void 0
2294
- }));
2295
- };
2296
- var getEventCatalogConfigurationFile = (directory) => async () => {
2475
+ }
2476
+
2477
+ // src/cli/list.ts
2478
+ function listFunctions(catalogDir = ".") {
2479
+ const sdk = src_default(catalogDir);
2480
+ const functionNames = Object.keys(sdk).filter((key) => typeof sdk[key] === "function");
2481
+ const categories = {
2482
+ Events: [],
2483
+ Commands: [],
2484
+ Queries: [],
2485
+ Channels: [],
2486
+ Services: [],
2487
+ Domains: [],
2488
+ Entities: [],
2489
+ DataStores: [],
2490
+ DataProducts: [],
2491
+ Teams: [],
2492
+ Users: [],
2493
+ "Custom Docs": [],
2494
+ Messages: [],
2495
+ Utilities: []
2496
+ };
2497
+ functionNames.forEach((name) => {
2498
+ if (name.includes("Event")) categories["Events"].push(name);
2499
+ else if (name.includes("Command")) categories["Commands"].push(name);
2500
+ else if (name.includes("Query")) categories["Queries"].push(name);
2501
+ else if (name.includes("Channel")) categories["Channels"].push(name);
2502
+ else if (name.includes("Service")) categories["Services"].push(name);
2503
+ else if (name.includes("Domain")) categories["Domains"].push(name);
2504
+ else if (name.includes("Entity")) categories["Entities"].push(name);
2505
+ else if (name.includes("DataStore")) categories["DataStores"].push(name);
2506
+ else if (name.includes("DataProduct")) categories["DataProducts"].push(name);
2507
+ else if (name.includes("Team")) categories["Teams"].push(name);
2508
+ else if (name.includes("User")) categories["Users"].push(name);
2509
+ else if (name.includes("CustomDoc")) categories["Custom Docs"].push(name);
2510
+ else if (name.includes("Message") || name.includes("Producers") || name.includes("Consumers"))
2511
+ categories["Messages"].push(name);
2512
+ else categories["Utilities"].push(name);
2513
+ });
2514
+ Object.keys(categories).forEach((key) => {
2515
+ if (categories[key].length === 0) {
2516
+ delete categories[key];
2517
+ }
2518
+ });
2519
+ return categories;
2520
+ }
2521
+ function formatListOutput(functions) {
2522
+ let output = "Available EventCatalog SDK Functions:\n\n";
2523
+ Object.entries(functions).forEach(([category, names]) => {
2524
+ output += `${category}:
2525
+ `;
2526
+ names.sort().forEach((name) => {
2527
+ output += ` - ${name}
2528
+ `;
2529
+ });
2530
+ output += "\n";
2531
+ });
2532
+ return output;
2533
+ }
2534
+
2535
+ // src/cli/index.ts
2536
+ var version = "1.0.0";
2537
+ try {
2538
+ const packageJsonPath = (0, import_node_path21.resolve)(__dirname, "../../package.json");
2539
+ const packageJson = JSON.parse((0, import_node_fs8.readFileSync)(packageJsonPath, "utf-8"));
2540
+ version = packageJson.version;
2541
+ } catch {
2542
+ }
2543
+ import_commander.program.name("eventcatalog").description("EventCatalog SDK Command-Line Interface").version(version).option("-d, --dir <path>", "Path to the EventCatalog directory (default: current directory)", ".");
2544
+ import_commander.program.command("list").description("List all available SDK functions").action(() => {
2297
2545
  try {
2298
- const path6 = (0, import_node_path19.join)(directory, "eventcatalog.config.js");
2299
- const configModule = await import(path6);
2300
- return configModule.default;
2546
+ const functions = listFunctions(".");
2547
+ const output = formatListOutput(functions);
2548
+ console.log(output);
2301
2549
  } catch (error) {
2302
- console.error("Error getting event catalog configuration file", error);
2303
- return null;
2550
+ console.error("Error listing functions:", error instanceof Error ? error.message : String(error));
2551
+ process.exit(1);
2552
+ }
2553
+ });
2554
+ import_commander.program.arguments("<function> [args...]").action(async (functionName, args) => {
2555
+ try {
2556
+ const options = import_commander.program.opts();
2557
+ const dir = options.dir || ".";
2558
+ const result = await executeFunction(dir, functionName, args);
2559
+ console.log(JSON.stringify(result, null, 0));
2560
+ } catch (error) {
2561
+ console.error(error instanceof Error ? error.message : String(error));
2562
+ process.exit(1);
2304
2563
  }
2305
- };
2306
- var dumpCatalog = (directory) => async (options) => {
2307
- const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = src_default(directory);
2308
- const { includeMarkdown = true } = options || {};
2309
- const domains = await getDomains2();
2310
- const services = await getServices2();
2311
- const events = await getEvents2();
2312
- const commands = await getCommands2();
2313
- const queries = await getQueries2();
2314
- const teams = await getTeams2();
2315
- const users = await getUsers3();
2316
- const channels = await getChannels2();
2317
- const [
2318
- hydratedDomains,
2319
- hydratedServices,
2320
- hydratedEvents,
2321
- hydratedQueries,
2322
- hydratedCommands,
2323
- hydratedTeams,
2324
- hydratedUsers,
2325
- hydratedChannels
2326
- ] = await Promise.all([
2327
- hydrateResource(directory, domains),
2328
- hydrateResource(directory, services),
2329
- hydrateResource(directory, events),
2330
- hydrateResource(directory, queries),
2331
- hydrateResource(directory, commands),
2332
- hydrateResource(directory, teams),
2333
- hydrateResource(directory, users),
2334
- hydrateResource(directory, channels)
2335
- ]);
2336
- return {
2337
- version: DUMP_VERSION,
2338
- catalogVersion: await getEventCatalogVersion(directory),
2339
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2340
- resources: {
2341
- domains: filterCollection(hydratedDomains, { includeMarkdown }),
2342
- services: filterCollection(hydratedServices, { includeMarkdown }),
2343
- messages: {
2344
- events: filterCollection(hydratedEvents, { includeMarkdown }),
2345
- queries: filterCollection(hydratedQueries, { includeMarkdown }),
2346
- commands: filterCollection(hydratedCommands, { includeMarkdown })
2347
- },
2348
- teams: filterCollection(hydratedTeams, { includeMarkdown }),
2349
- users: filterCollection(hydratedUsers, { includeMarkdown }),
2350
- channels: filterCollection(hydratedChannels, { includeMarkdown })
2351
- }
2352
- };
2353
- };
2354
- // Annotate the CommonJS export names for ESM import in node:
2355
- 0 && (module.exports = {
2356
- dumpCatalog,
2357
- getEventCatalogConfigurationFile
2358
2564
  });
2359
- //# sourceMappingURL=eventcatalog.js.map
2565
+ import_commander.program.parse(process.argv);
2566
+ if (process.argv.length < 3) {
2567
+ import_commander.program.outputHelp();
2568
+ }
2569
+ //# sourceMappingURL=index.js.map