@eventcatalog/sdk 2.4.0 → 2.5.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.
@@ -21,6 +21,14 @@ type EventCatalogObject = {
21
21
  customDocs?: ExportedResource<CustomDoc>[];
22
22
  };
23
23
  };
24
+ /**
25
+ * Returns the event catalog configuration file.
26
+ * The event catalog configuration file is the file that contains the configuration for the event catalog.
27
+ *
28
+ * @param directory - The directory of the catalog.
29
+ * @returns A JSON object with the configuration for the event catalog.
30
+ */
31
+ declare const getEventCatalogConfigurationFile: (directory: string) => () => Promise<any>;
24
32
  /**
25
33
  * Dumps the catalog to a JSON file.
26
34
  *
@@ -31,4 +39,4 @@ declare const dumpCatalog: (directory: string) => (options?: {
31
39
  includeMarkdown?: boolean;
32
40
  }) => Promise<EventCatalogObject>;
33
41
 
34
- export { type EventCatalogObject, dumpCatalog };
42
+ export { type EventCatalogObject, dumpCatalog, getEventCatalogConfigurationFile };
@@ -21,6 +21,14 @@ type EventCatalogObject = {
21
21
  customDocs?: ExportedResource<CustomDoc>[];
22
22
  };
23
23
  };
24
+ /**
25
+ * Returns the event catalog configuration file.
26
+ * The event catalog configuration file is the file that contains the configuration for the event catalog.
27
+ *
28
+ * @param directory - The directory of the catalog.
29
+ * @returns A JSON object with the configuration for the event catalog.
30
+ */
31
+ declare const getEventCatalogConfigurationFile: (directory: string) => () => Promise<any>;
24
32
  /**
25
33
  * Dumps the catalog to a JSON file.
26
34
  *
@@ -31,4 +39,4 @@ declare const dumpCatalog: (directory: string) => (options?: {
31
39
  includeMarkdown?: boolean;
32
40
  }) => Promise<EventCatalogObject>;
33
41
 
34
- export { type EventCatalogObject, dumpCatalog };
42
+ export { type EventCatalogObject, dumpCatalog, getEventCatalogConfigurationFile };
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/eventcatalog.ts
31
31
  var eventcatalog_exports = {};
32
32
  __export(eventcatalog_exports, {
33
- dumpCatalog: () => dumpCatalog
33
+ dumpCatalog: () => dumpCatalog,
34
+ getEventCatalogConfigurationFile: () => getEventCatalogConfigurationFile
34
35
  });
35
36
  module.exports = __toCommonJS(eventcatalog_exports);
36
37
  var import_fs = __toESM(require("fs"));
@@ -1461,6 +1462,14 @@ var index_default = (path4) => {
1461
1462
  * @returns A JSON file with the catalog
1462
1463
  */
1463
1464
  dumpCatalog: dumpCatalog((0, import_node_path11.join)(path4)),
1465
+ /**
1466
+ * Returns the event catalog configuration file.
1467
+ * The event catalog configuration file is the file that contains the configuration for the event catalog.
1468
+ *
1469
+ * @param directory - The directory of the catalog.
1470
+ * @returns A JSON object with the configuration for the event catalog.
1471
+ */
1472
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path11.join)(path4)),
1464
1473
  /**
1465
1474
  * ================================
1466
1475
  * Resources Utils
@@ -1509,6 +1518,16 @@ var filterCollection = (collection, options) => {
1509
1518
  markdown: options?.includeMarkdown ? item.markdown : void 0
1510
1519
  }));
1511
1520
  };
1521
+ var getEventCatalogConfigurationFile = (directory) => async () => {
1522
+ try {
1523
+ const path4 = (0, import_node_path12.join)(directory, "eventcatalog.config.js");
1524
+ const configModule = await import(path4);
1525
+ return configModule.default;
1526
+ } catch (error) {
1527
+ console.error("Error getting event catalog configuration file", error);
1528
+ return null;
1529
+ }
1530
+ };
1512
1531
  var dumpCatalog = (directory) => async (options) => {
1513
1532
  const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers2 } = index_default(directory);
1514
1533
  const { includeMarkdown = true } = options || {};
@@ -1559,6 +1578,7 @@ var dumpCatalog = (directory) => async (options) => {
1559
1578
  };
1560
1579
  // Annotate the CommonJS export names for ESM import in node:
1561
1580
  0 && (module.exports = {
1562
- dumpCatalog
1581
+ dumpCatalog,
1582
+ getEventCatalogConfigurationFile
1563
1583
  });
1564
1584
  //# sourceMappingURL=eventcatalog.js.map