@eventcatalog/sdk 2.6.7 → 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.
package/dist/index.d.mts CHANGED
@@ -53,19 +53,7 @@ declare const _default: (path: string) => {
53
53
  }, options?: {
54
54
  path?: string;
55
55
  format?: "md" | "mdx";
56
- override
57
- /**
58
- * Returns a command from EventCatalog
59
- * @param id - The id of the command to retrieve
60
- * @param version - Optional id of the version to get (supports semver)
61
- * @returns Command|Undefined
62
- */
63
- ? /**
64
- * Returns a command from EventCatalog
65
- * @param id - The id of the command to retrieve
66
- * @param version - Optional id of the version to get (supports semver)
67
- * @returns Command|Undefined
68
- */: boolean;
56
+ override?: boolean;
69
57
  }) => Promise<void>;
70
58
  /**
71
59
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
@@ -796,14 +784,7 @@ declare const _default: (path: string) => {
796
784
  *
797
785
  */
798
786
  writeUser: (user: User, options?: {
799
- override? /**
800
- * Adds an event to a service in EventCatalog
801
- *
802
- * @param event - The event to write to the service
803
- * @param service - The service and it's id to write to the event to
804
- * @param options - Optional options to write the event
805
- *
806
- */: boolean;
787
+ override?: boolean;
807
788
  }) => Promise<void>;
808
789
  /**
809
790
  * Returns a user from EventCatalog
@@ -912,6 +893,18 @@ declare const _default: (path: string) => {
912
893
  producers: Service[];
913
894
  consumers: Service[];
914
895
  }>;
896
+ /**
897
+ * Returns the consumers of a given schema path
898
+ * @param path - The path to the schema to get the consumers for
899
+ * @returns Service[]
900
+ */
901
+ getConsumersOfSchema: (path: string) => Promise<Service[]>;
902
+ /**
903
+ * Returns the producers of a given schema path
904
+ * @param path - The path to the schema to get the producers for
905
+ * @returns Service[]
906
+ */
907
+ getProducersOfSchema: (path: string) => Promise<Service[]>;
915
908
  /**
916
909
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
917
910
  * @param id - The id of the resource to get the owners for
package/dist/index.d.ts CHANGED
@@ -53,19 +53,7 @@ declare const _default: (path: string) => {
53
53
  }, options?: {
54
54
  path?: string;
55
55
  format?: "md" | "mdx";
56
- override
57
- /**
58
- * Returns a command from EventCatalog
59
- * @param id - The id of the command to retrieve
60
- * @param version - Optional id of the version to get (supports semver)
61
- * @returns Command|Undefined
62
- */
63
- ? /**
64
- * Returns a command from EventCatalog
65
- * @param id - The id of the command to retrieve
66
- * @param version - Optional id of the version to get (supports semver)
67
- * @returns Command|Undefined
68
- */: boolean;
56
+ override?: boolean;
69
57
  }) => Promise<void>;
70
58
  /**
71
59
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
@@ -796,14 +784,7 @@ declare const _default: (path: string) => {
796
784
  *
797
785
  */
798
786
  writeUser: (user: User, options?: {
799
- override? /**
800
- * Adds an event to a service in EventCatalog
801
- *
802
- * @param event - The event to write to the service
803
- * @param service - The service and it's id to write to the event to
804
- * @param options - Optional options to write the event
805
- *
806
- */: boolean;
787
+ override?: boolean;
807
788
  }) => Promise<void>;
808
789
  /**
809
790
  * Returns a user from EventCatalog
@@ -912,6 +893,18 @@ declare const _default: (path: string) => {
912
893
  producers: Service[];
913
894
  consumers: Service[];
914
895
  }>;
896
+ /**
897
+ * Returns the consumers of a given schema path
898
+ * @param path - The path to the schema to get the consumers for
899
+ * @returns Service[]
900
+ */
901
+ getConsumersOfSchema: (path: string) => Promise<Service[]>;
902
+ /**
903
+ * Returns the producers of a given schema path
904
+ * @param path - The path to the schema to get the producers for
905
+ * @returns Service[]
906
+ */
907
+ getProducersOfSchema: (path: string) => Promise<Service[]>;
915
908
  /**
916
909
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
917
910
  * @param id - The id of the resource to get the owners for
package/dist/index.js CHANGED
@@ -713,7 +713,6 @@ var getMessageBySchemaPath = (directory) => async (path5, options) => {
713
713
  }
714
714
  return message;
715
715
  } catch (error) {
716
- console.error(`Failed to get message for schema path ${path5}. Error processing directory ${pathToMessage}:`, error);
717
716
  if (error instanceof Error) {
718
717
  error.message = `Failed to retrieve message from ${pathToMessage}: ${error.message}`;
719
718
  throw error;
@@ -768,6 +767,24 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
768
767
  }
769
768
  return { producers, consumers };
770
769
  };
770
+ var getConsumersOfSchema = (directory) => async (path5) => {
771
+ try {
772
+ const message = await getMessageBySchemaPath(directory)(path5);
773
+ const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
774
+ return consumers;
775
+ } catch (error) {
776
+ return [];
777
+ }
778
+ };
779
+ var getProducersOfSchema = (directory) => async (path5) => {
780
+ try {
781
+ const message = await getMessageBySchemaPath(directory)(path5);
782
+ const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
783
+ return producers;
784
+ } catch (error) {
785
+ return [];
786
+ }
787
+ };
771
788
 
772
789
  // src/custom-docs.ts
773
790
  var import_node_path9 = __toESM(require("path"));
@@ -1744,6 +1761,18 @@ var index_default = (path5) => {
1744
1761
  * @returns { producers: Service[], consumers: Service[] }
1745
1762
  */
1746
1763
  getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path14.join)(path5)),
1764
+ /**
1765
+ * Returns the consumers of a given schema path
1766
+ * @param path - The path to the schema to get the consumers for
1767
+ * @returns Service[]
1768
+ */
1769
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path14.join)(path5)),
1770
+ /**
1771
+ * Returns the producers of a given schema path
1772
+ * @param path - The path to the schema to get the producers for
1773
+ * @returns Service[]
1774
+ */
1775
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path14.join)(path5)),
1747
1776
  /**
1748
1777
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1749
1778
  * @param id - The id of the resource to get the owners for