@eventcatalog/sdk 2.13.2 → 2.14.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.
package/dist/index.d.mts CHANGED
@@ -191,6 +191,8 @@ interface Domain extends BaseSchema {
191
191
  interface Team {
192
192
  id: string;
193
193
  name: string;
194
+ avatarUrl?: string;
195
+ role?: string;
194
196
  summary?: string;
195
197
  email?: string;
196
198
  hidden?: boolean;
@@ -337,6 +339,12 @@ type EventCatalog = {
337
339
  };
338
340
  };
339
341
 
342
+ type ResourceType = 'event' | 'command' | 'query' | 'service' | 'domain';
343
+ interface ToDSLOptions {
344
+ type: ResourceType;
345
+ hydrate?: boolean;
346
+ }
347
+
340
348
  /**
341
349
  * Init the SDK for EventCatalog
342
350
  *
@@ -729,7 +737,18 @@ declare const _default: (path: string) => {
729
737
  addEventToChannel: (id: string, _message: {
730
738
  id: string;
731
739
  version: string;
732
- parameters?: {
740
+ parameters
741
+ /**
742
+ * Returns a query from EventCatalog
743
+ * @param id - The id of the query to retrieve
744
+ * @param version - Optional id of the version to get (supports semver)
745
+ * @returns Query|Undefined
746
+ */
747
+ ? /**
748
+ * ================================
749
+ * Queries
750
+ * ================================
751
+ */: {
733
752
  [key: string]: string;
734
753
  };
735
754
  }, version?: string) => Promise<void>;
@@ -752,7 +771,18 @@ declare const _default: (path: string) => {
752
771
  addCommandToChannel: (id: string, _message: {
753
772
  id: string;
754
773
  version: string;
755
- parameters?: {
774
+ parameters
775
+ /**
776
+ * Returns a query from EventCatalog
777
+ * @param id - The id of the query to retrieve
778
+ * @param version - Optional id of the version to get (supports semver)
779
+ * @returns Query|Undefined
780
+ */
781
+ ? /**
782
+ * ================================
783
+ * Queries
784
+ * ================================
785
+ */: {
756
786
  [key: string]: string;
757
787
  };
758
788
  }, version?: string) => Promise<void>;
@@ -775,7 +805,18 @@ declare const _default: (path: string) => {
775
805
  addQueryToChannel: (id: string, _message: {
776
806
  id: string;
777
807
  version: string;
778
- parameters?: {
808
+ parameters
809
+ /**
810
+ * Returns a query from EventCatalog
811
+ * @param id - The id of the query to retrieve
812
+ * @param version - Optional id of the version to get (supports semver)
813
+ * @returns Query|Undefined
814
+ */
815
+ ? /**
816
+ * ================================
817
+ * Queries
818
+ * ================================
819
+ */: {
779
820
  [key: string]: string;
780
821
  };
781
822
  }, version?: string) => Promise<void>;
@@ -794,7 +835,15 @@ declare const _default: (path: string) => {
794
835
  writeService: (service: Service, options?: {
795
836
  path?: string;
796
837
  override?: boolean;
797
- versionExistingContent?: boolean;
838
+ versionExistingContent
839
+ /**
840
+ * Moves a given event id to the version directory
841
+ * @param directory
842
+ */
843
+ ? /**
844
+ * Moves a given event id to the version directory
845
+ * @param directory
846
+ */: boolean;
798
847
  format?: "md" | "mdx";
799
848
  }) => Promise<void>;
800
849
  /**
@@ -815,23 +864,7 @@ declare const _default: (path: string) => {
815
864
  writeServiceToDomain: (service: Service, domain: {
816
865
  id: string;
817
866
  version?: string;
818
- direction
819
- /**
820
- * Adds a command to a service in EventCatalog
821
- *
822
- * @param command - The command to write to the service
823
- * @param service - The service and it's id to write to the command to
824
- * @param options - Optional options to write the command
825
- *
826
- */
827
- ? /**
828
- * Adds a command to a service in EventCatalog
829
- *
830
- * @param command - The command to write to the service
831
- * @param service - The service and it's id to write to the command to
832
- * @param options - Optional options to write the command
833
- *
834
- */: string;
867
+ direction?: string;
835
868
  }, options?: {
836
869
  path?: string;
837
870
  format?: "md" | "mdx";
@@ -1653,21 +1686,7 @@ declare const _default: (path: string) => {
1653
1686
  *
1654
1687
  */
1655
1688
  writeDiagram: (diagram: Diagram, options?: {
1656
- path
1657
- /**
1658
- * Adds an event to EventCatalog
1659
- *
1660
- * @param event - The event to write
1661
- * @param options - Optional options to write the event
1662
- *
1663
- */
1664
- ? /**
1665
- * Adds an event to EventCatalog
1666
- *
1667
- * @param event - The event to write
1668
- * @param options - Optional options to write the event
1669
- *
1670
- */: string;
1689
+ path?: string;
1671
1690
  override?: boolean;
1672
1691
  versionExistingContent?: boolean;
1673
1692
  format?: "md" | "mdx";
@@ -1709,6 +1728,25 @@ declare const _default: (path: string) => {
1709
1728
  content: string;
1710
1729
  fileName: string;
1711
1730
  }, version?: string) => Promise<void>;
1731
+ /**
1732
+ * ================================
1733
+ * DSL
1734
+ * ================================
1735
+ */
1736
+ /**
1737
+ * Converts catalog resources to EventCatalog DSL (.ec) format strings.
1738
+ *
1739
+ * @param resource - A resource or array of resources to convert
1740
+ * @param options - Options including type ('event'|'command'|'query'|'service'|'domain') and optional hydrate flag
1741
+ * @returns A DSL string representation
1742
+ *
1743
+ * @example
1744
+ * ```ts
1745
+ * const dsl = await sdk.toDSL(event, { type: 'event' });
1746
+ * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
1747
+ * ```
1748
+ */
1749
+ toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
1712
1750
  };
1713
1751
 
1714
1752
  export { type Badge, type BaseSchema, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Diagram, type Domain, type Entity, type Event, type EventCatalog, type Message, type Query, type ReceivesPointer, type ResourceGroup, type ResourcePointer, type SendsPointer, type Service, type Specification, type Specifications, type Team, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };
package/dist/index.d.ts CHANGED
@@ -191,6 +191,8 @@ interface Domain extends BaseSchema {
191
191
  interface Team {
192
192
  id: string;
193
193
  name: string;
194
+ avatarUrl?: string;
195
+ role?: string;
194
196
  summary?: string;
195
197
  email?: string;
196
198
  hidden?: boolean;
@@ -337,6 +339,12 @@ type EventCatalog = {
337
339
  };
338
340
  };
339
341
 
342
+ type ResourceType = 'event' | 'command' | 'query' | 'service' | 'domain';
343
+ interface ToDSLOptions {
344
+ type: ResourceType;
345
+ hydrate?: boolean;
346
+ }
347
+
340
348
  /**
341
349
  * Init the SDK for EventCatalog
342
350
  *
@@ -729,7 +737,18 @@ declare const _default: (path: string) => {
729
737
  addEventToChannel: (id: string, _message: {
730
738
  id: string;
731
739
  version: string;
732
- parameters?: {
740
+ parameters
741
+ /**
742
+ * Returns a query from EventCatalog
743
+ * @param id - The id of the query to retrieve
744
+ * @param version - Optional id of the version to get (supports semver)
745
+ * @returns Query|Undefined
746
+ */
747
+ ? /**
748
+ * ================================
749
+ * Queries
750
+ * ================================
751
+ */: {
733
752
  [key: string]: string;
734
753
  };
735
754
  }, version?: string) => Promise<void>;
@@ -752,7 +771,18 @@ declare const _default: (path: string) => {
752
771
  addCommandToChannel: (id: string, _message: {
753
772
  id: string;
754
773
  version: string;
755
- parameters?: {
774
+ parameters
775
+ /**
776
+ * Returns a query from EventCatalog
777
+ * @param id - The id of the query to retrieve
778
+ * @param version - Optional id of the version to get (supports semver)
779
+ * @returns Query|Undefined
780
+ */
781
+ ? /**
782
+ * ================================
783
+ * Queries
784
+ * ================================
785
+ */: {
756
786
  [key: string]: string;
757
787
  };
758
788
  }, version?: string) => Promise<void>;
@@ -775,7 +805,18 @@ declare const _default: (path: string) => {
775
805
  addQueryToChannel: (id: string, _message: {
776
806
  id: string;
777
807
  version: string;
778
- parameters?: {
808
+ parameters
809
+ /**
810
+ * Returns a query from EventCatalog
811
+ * @param id - The id of the query to retrieve
812
+ * @param version - Optional id of the version to get (supports semver)
813
+ * @returns Query|Undefined
814
+ */
815
+ ? /**
816
+ * ================================
817
+ * Queries
818
+ * ================================
819
+ */: {
779
820
  [key: string]: string;
780
821
  };
781
822
  }, version?: string) => Promise<void>;
@@ -794,7 +835,15 @@ declare const _default: (path: string) => {
794
835
  writeService: (service: Service, options?: {
795
836
  path?: string;
796
837
  override?: boolean;
797
- versionExistingContent?: boolean;
838
+ versionExistingContent
839
+ /**
840
+ * Moves a given event id to the version directory
841
+ * @param directory
842
+ */
843
+ ? /**
844
+ * Moves a given event id to the version directory
845
+ * @param directory
846
+ */: boolean;
798
847
  format?: "md" | "mdx";
799
848
  }) => Promise<void>;
800
849
  /**
@@ -815,23 +864,7 @@ declare const _default: (path: string) => {
815
864
  writeServiceToDomain: (service: Service, domain: {
816
865
  id: string;
817
866
  version?: string;
818
- direction
819
- /**
820
- * Adds a command to a service in EventCatalog
821
- *
822
- * @param command - The command to write to the service
823
- * @param service - The service and it's id to write to the command to
824
- * @param options - Optional options to write the command
825
- *
826
- */
827
- ? /**
828
- * Adds a command to a service in EventCatalog
829
- *
830
- * @param command - The command to write to the service
831
- * @param service - The service and it's id to write to the command to
832
- * @param options - Optional options to write the command
833
- *
834
- */: string;
867
+ direction?: string;
835
868
  }, options?: {
836
869
  path?: string;
837
870
  format?: "md" | "mdx";
@@ -1653,21 +1686,7 @@ declare const _default: (path: string) => {
1653
1686
  *
1654
1687
  */
1655
1688
  writeDiagram: (diagram: Diagram, options?: {
1656
- path
1657
- /**
1658
- * Adds an event to EventCatalog
1659
- *
1660
- * @param event - The event to write
1661
- * @param options - Optional options to write the event
1662
- *
1663
- */
1664
- ? /**
1665
- * Adds an event to EventCatalog
1666
- *
1667
- * @param event - The event to write
1668
- * @param options - Optional options to write the event
1669
- *
1670
- */: string;
1689
+ path?: string;
1671
1690
  override?: boolean;
1672
1691
  versionExistingContent?: boolean;
1673
1692
  format?: "md" | "mdx";
@@ -1709,6 +1728,25 @@ declare const _default: (path: string) => {
1709
1728
  content: string;
1710
1729
  fileName: string;
1711
1730
  }, version?: string) => Promise<void>;
1731
+ /**
1732
+ * ================================
1733
+ * DSL
1734
+ * ================================
1735
+ */
1736
+ /**
1737
+ * Converts catalog resources to EventCatalog DSL (.ec) format strings.
1738
+ *
1739
+ * @param resource - A resource or array of resources to convert
1740
+ * @param options - Options including type ('event'|'command'|'query'|'service'|'domain') and optional hydrate flag
1741
+ * @returns A DSL string representation
1742
+ *
1743
+ * @example
1744
+ * ```ts
1745
+ * const dsl = await sdk.toDSL(event, { type: 'event' });
1746
+ * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
1747
+ * ```
1748
+ */
1749
+ toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
1712
1750
  };
1713
1751
 
1714
1752
  export { type Badge, type BaseSchema, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Diagram, type Domain, type Entity, type Event, type EventCatalog, type Message, type Query, type ReceivesPointer, type ResourceGroup, type ResourcePointer, type SendsPointer, type Service, type Specification, type Specifications, type Team, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };