@eventcatalog/sdk 2.13.2 → 2.14.0

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
  *
@@ -629,7 +637,13 @@ declare const _default: (path: string) => {
629
637
  content: string;
630
638
  fileName: string;
631
639
  }, version?: string, options?: {
632
- path?: string;
640
+ path? /**
641
+ * Adds a schema to the given command
642
+ * @param id - The id of the command to add the schema to
643
+ * @param schema - Schema contents to add including the content and the file name
644
+ * @param version - Optional version of the command to add the schema to
645
+ * @returns
646
+ */: string;
633
647
  }) => Promise<void>;
634
648
  /**
635
649
  * Adds a schema to the given query
@@ -815,23 +829,7 @@ declare const _default: (path: string) => {
815
829
  writeServiceToDomain: (service: Service, domain: {
816
830
  id: string;
817
831
  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;
832
+ direction?: string;
835
833
  }, options?: {
836
834
  path?: string;
837
835
  format?: "md" | "mdx";
@@ -1653,21 +1651,7 @@ declare const _default: (path: string) => {
1653
1651
  *
1654
1652
  */
1655
1653
  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;
1654
+ path?: string;
1671
1655
  override?: boolean;
1672
1656
  versionExistingContent?: boolean;
1673
1657
  format?: "md" | "mdx";
@@ -1709,6 +1693,25 @@ declare const _default: (path: string) => {
1709
1693
  content: string;
1710
1694
  fileName: string;
1711
1695
  }, version?: string) => Promise<void>;
1696
+ /**
1697
+ * ================================
1698
+ * DSL
1699
+ * ================================
1700
+ */
1701
+ /**
1702
+ * Converts catalog resources to EventCatalog DSL (.ec) format strings.
1703
+ *
1704
+ * @param resource - A resource or array of resources to convert
1705
+ * @param options - Options including type ('event'|'command'|'query'|'service'|'domain') and optional hydrate flag
1706
+ * @returns A DSL string representation
1707
+ *
1708
+ * @example
1709
+ * ```ts
1710
+ * const dsl = await sdk.toDSL(event, { type: 'event' });
1711
+ * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
1712
+ * ```
1713
+ */
1714
+ toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
1712
1715
  };
1713
1716
 
1714
1717
  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
  *
@@ -629,7 +637,13 @@ declare const _default: (path: string) => {
629
637
  content: string;
630
638
  fileName: string;
631
639
  }, version?: string, options?: {
632
- path?: string;
640
+ path? /**
641
+ * Adds a schema to the given command
642
+ * @param id - The id of the command to add the schema to
643
+ * @param schema - Schema contents to add including the content and the file name
644
+ * @param version - Optional version of the command to add the schema to
645
+ * @returns
646
+ */: string;
633
647
  }) => Promise<void>;
634
648
  /**
635
649
  * Adds a schema to the given query
@@ -815,23 +829,7 @@ declare const _default: (path: string) => {
815
829
  writeServiceToDomain: (service: Service, domain: {
816
830
  id: string;
817
831
  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;
832
+ direction?: string;
835
833
  }, options?: {
836
834
  path?: string;
837
835
  format?: "md" | "mdx";
@@ -1653,21 +1651,7 @@ declare const _default: (path: string) => {
1653
1651
  *
1654
1652
  */
1655
1653
  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;
1654
+ path?: string;
1671
1655
  override?: boolean;
1672
1656
  versionExistingContent?: boolean;
1673
1657
  format?: "md" | "mdx";
@@ -1709,6 +1693,25 @@ declare const _default: (path: string) => {
1709
1693
  content: string;
1710
1694
  fileName: string;
1711
1695
  }, version?: string) => Promise<void>;
1696
+ /**
1697
+ * ================================
1698
+ * DSL
1699
+ * ================================
1700
+ */
1701
+ /**
1702
+ * Converts catalog resources to EventCatalog DSL (.ec) format strings.
1703
+ *
1704
+ * @param resource - A resource or array of resources to convert
1705
+ * @param options - Options including type ('event'|'command'|'query'|'service'|'domain') and optional hydrate flag
1706
+ * @returns A DSL string representation
1707
+ *
1708
+ * @example
1709
+ * ```ts
1710
+ * const dsl = await sdk.toDSL(event, { type: 'event' });
1711
+ * const dsl = await sdk.toDSL(services, { type: 'service', hydrate: true });
1712
+ * ```
1713
+ */
1714
+ toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
1712
1715
  };
1713
1716
 
1714
1717
  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 };