@eventcatalog/sdk 2.6.6 → 2.6.8

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.
@@ -222,8 +222,8 @@ var getResourcePath = async (catalogDir, id, version) => {
222
222
  directory: dirname2(file.replace(catalogDir, ""))
223
223
  };
224
224
  };
225
- var toResource = async (catalogDir, file) => {
226
- const { data, content } = matter2.read(file);
225
+ var toResource = async (catalogDir, rawContents) => {
226
+ const { data, content } = matter2(rawContents);
227
227
  return {
228
228
  ...data,
229
229
  markdown: content.trim()
@@ -683,7 +683,6 @@ var getMessageBySchemaPath = (directory) => async (path5, options) => {
683
683
  }
684
684
  return message;
685
685
  } catch (error) {
686
- console.error(`Failed to get message for schema path ${path5}. Error processing directory ${pathToMessage}:`, error);
687
686
  if (error instanceof Error) {
688
687
  error.message = `Failed to retrieve message from ${pathToMessage}: ${error.message}`;
689
688
  throw error;
@@ -738,6 +737,24 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
738
737
  }
739
738
  return { producers, consumers };
740
739
  };
740
+ var getConsumersOfSchema = (directory) => async (path5) => {
741
+ try {
742
+ const message = await getMessageBySchemaPath(directory)(path5);
743
+ const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
744
+ return consumers;
745
+ } catch (error) {
746
+ return [];
747
+ }
748
+ };
749
+ var getProducersOfSchema = (directory) => async (path5) => {
750
+ try {
751
+ const message = await getMessageBySchemaPath(directory)(path5);
752
+ const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
753
+ return producers;
754
+ } catch (error) {
755
+ return [];
756
+ }
757
+ };
741
758
 
742
759
  // src/custom-docs.ts
743
760
  import path2, { join as join10 } from "path";
@@ -1617,6 +1634,18 @@ var index_default = (path5) => {
1617
1634
  * @returns { producers: Service[], consumers: Service[] }
1618
1635
  */
1619
1636
  getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join13(path5)),
1637
+ /**
1638
+ * Returns the consumers of a given schema path
1639
+ * @param path - The path to the schema to get the consumers for
1640
+ * @returns Service[]
1641
+ */
1642
+ getConsumersOfSchema: getConsumersOfSchema(join13(path5)),
1643
+ /**
1644
+ * Returns the producers of a given schema path
1645
+ * @param path - The path to the schema to get the producers for
1646
+ * @returns Service[]
1647
+ */
1648
+ getProducersOfSchema: getProducersOfSchema(join13(path5)),
1620
1649
  /**
1621
1650
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1622
1651
  * @param id - The id of the resource to get the owners for