@eventcatalog/sdk 2.26.1 → 2.26.2

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
@@ -56,6 +56,61 @@ type ResourcePointer = {
56
56
  type?: string;
57
57
  };
58
58
 
59
+ type CatalogGraphResourceType =
60
+ | 'domain'
61
+ | 'system'
62
+ | 'service'
63
+ | 'agent'
64
+ | 'event'
65
+ | 'command'
66
+ | 'query'
67
+ | 'flow'
68
+ | 'channel'
69
+ | 'entity'
70
+ | 'container'
71
+ | 'data-product'
72
+ | 'adr';
73
+
74
+ type CatalogGraphRoot = {
75
+ type: CatalogGraphResourceType;
76
+ id: string;
77
+ version?: string;
78
+ };
79
+
80
+ type CatalogGraphOptions = {
81
+ /** Number of relationship levels to traverse. Defaults to the complete reachable graph. */
82
+ depth?: number;
83
+ /** Return one deduplicated resource list instead of nested children. */
84
+ flat?: boolean;
85
+ };
86
+
87
+ type CatalogGraphResource = {
88
+ type: CatalogGraphResourceType;
89
+ id: string;
90
+ version: string;
91
+ };
92
+
93
+ type CatalogGraphNode = CatalogGraphResource & {
94
+ children: CatalogGraphNode[];
95
+ };
96
+
97
+ type NestedCatalogGraph = {
98
+ root: CatalogGraphNode;
99
+ };
100
+
101
+ type FlatCatalogGraph = {
102
+ root: CatalogGraphResource;
103
+ resources: CatalogGraphResource[];
104
+ };
105
+
106
+ type CatalogGraph = NestedCatalogGraph | FlatCatalogGraph;
107
+
108
+ interface GetCatalogGraph {
109
+ (root: CatalogGraphRoot, options: CatalogGraphOptions & { flat: true }): Promise<FlatCatalogGraph | undefined>;
110
+ (root: CatalogGraphRoot, options?: CatalogGraphOptions & { flat?: false }): Promise<NestedCatalogGraph | undefined>;
111
+ (root: CatalogGraphRoot, options: CatalogGraphOptions): Promise<CatalogGraph | undefined>;
112
+ }
113
+
59
114
  type SystemScope = 'internal' | 'external';
60
115
 
61
116
  type SystemRelationshipPointer = {
@@ -1460,23 +1515,7 @@ declare const _default: (path: string) => {
1460
1515
  id: string;
1461
1516
  version?: string;
1462
1517
  }, options?: {
1463
- path
1464
- /**
1465
- * Adds an event to a service in EventCatalog
1466
- *
1467
- * @param event - The event to write to the service
1468
- * @param service - The service and it's id to write to the event to
1469
- * @param options - Optional options to write the event
1470
- *
1471
- */
1472
- ? /**
1473
- * Adds an event to a service in EventCatalog
1474
- *
1475
- * @param event - The event to write to the service
1476
- * @param service - The service and it's id to write to the event to
1477
- * @param options - Optional options to write the event
1478
- *
1479
- */: string;
1518
+ path?: string;
1480
1519
  format?: "md" | "mdx";
1481
1520
  override?: boolean;
1482
1521
  }) => Promise<void>;
@@ -2315,6 +2354,13 @@ declare const _default: (path: string) => {
2315
2354
  dumpCatalog: (options?: {
2316
2355
  includeMarkdown?: boolean;
2317
2356
  }) => Promise<EventCatalog>;
2357
+ /**
2358
+ * Returns the resources reachable from a catalog resource.
2359
+ * @param root - Resource to use as the root of the graph
2360
+ * @param options - Traversal depth and whether to return a flat resource list
2361
+ * @returns The resolved graph, or undefined when the root does not exist
2362
+ */
2363
+ getGraph: GetCatalogGraph;
2318
2364
  /**
2319
2365
  * Returns the event catalog configuration file.
2320
2366
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2584,13 +2630,19 @@ declare const _default: (path: string) => {
2584
2630
  */
2585
2631
  writeFlowToDomain: (flow: Flow, domain: {
2586
2632
  id: string;
2587
- version? /**
2633
+ version?: string;
2634
+ }, options?: {
2635
+ path
2636
+ /**
2637
+ * Returns all events from EventCatalog
2638
+ * @param latestOnly - optional boolean, set to true to get only latest versions
2639
+ * @returns Event[]|Undefined
2640
+ */
2641
+ ? /**
2588
2642
  * Returns all events from EventCatalog
2589
2643
  * @param latestOnly - optional boolean, set to true to get only latest versions
2590
2644
  * @returns Event[]|Undefined
2591
2645
  */: string;
2592
- }, options?: {
2593
- path?: string;
2594
2646
  format?: "md" | "mdx";
2595
2647
  override?: boolean;
2596
2648
  }) => Promise<void>;
@@ -2607,12 +2659,7 @@ declare const _default: (path: string) => {
2607
2659
  version?: string;
2608
2660
  }, options?: {
2609
2661
  path?: string;
2610
- format? /**
2611
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
2612
- *
2613
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
2614
- *
2615
- */: "md" | "mdx";
2662
+ format?: "md" | "mdx";
2616
2663
  override?: boolean;
2617
2664
  }) => Promise<void>;
2618
2665
  /**
@@ -2643,7 +2690,18 @@ declare const _default: (path: string) => {
2643
2690
  id: string;
2644
2691
  version?: string;
2645
2692
  }, options?: {
2646
- path?: string;
2693
+ path
2694
+ /**
2695
+ * Returns a command from EventCatalog
2696
+ * @param id - The id of the command to retrieve
2697
+ * @param version - Optional id of the version to get (supports semver)
2698
+ * @returns Command|Undefined
2699
+ */
2700
+ ? /**
2701
+ * ================================
2702
+ * Commands
2703
+ * ================================
2704
+ */: string;
2647
2705
  format?: "md" | "mdx";
2648
2706
  override?: boolean;
2649
2707
  }) => Promise<void>;
@@ -2986,4 +3044,4 @@ declare const _default: (path: string) => {
2986
3044
  toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
2987
3045
  };
2988
3046
 
2989
- export { type Adr, type AdrPointer, type AdrResourcePointer, type AdrStatus, type Agent, type AgentModel, type AgentTool, type Badge, type BaseSchema, type CatalogSnapshot, type Changelog, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Diagram, type DiffSummary, type Domain, type Entity, type Event, type EventCatalog, type ExtensionProperties, type Flow, type FlowActorStepInput, type FlowAgentStepInput, FlowBuilder, type FlowBuilderInput, type FlowCustomStepInput, type FlowDataProductStepInput, type FlowDataStoreStepInput, type FlowExternalSystemStepInput, type FlowMessageStepInput, type FlowServiceStepInput, type FlowStep, type FlowStepInput, type FlowSubFlowStepInput, type Message, type MessagePointerInput, type Operation, type Query, type ReceivesPointer, type RelationshipChange, type ResourceChange, type ResourceChangeType, type ResourceGroup, type ResourcePointer, type SchemaPointer, type SendsPointer, type Service, type SnapshotDiff, type SnapshotGitInfo, type SnapshotMeta, type SnapshotOptions, type SnapshotResourceType, type SnapshotResources, type SnapshotResult, type Specification, type Specifications, type System, type SystemActorRelationship, type SystemRelationshipPointer, type SystemScope, type Team, type TriggerPointer, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };
3047
+ export { type Adr, type AdrPointer, type AdrResourcePointer, type AdrStatus, type Agent, type AgentModel, type AgentTool, type Badge, type BaseSchema, type CatalogGraph, type CatalogGraphNode, type CatalogGraphOptions, type CatalogGraphResource, type CatalogGraphResourceType, type CatalogGraphRoot, type CatalogSnapshot, type Changelog, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Diagram, type DiffSummary, type Domain, type Entity, type Event, type EventCatalog, type ExtensionProperties, type FlatCatalogGraph, type Flow, type FlowActorStepInput, type FlowAgentStepInput, FlowBuilder, type FlowBuilderInput, type FlowCustomStepInput, type FlowDataProductStepInput, type FlowDataStoreStepInput, type FlowExternalSystemStepInput, type FlowMessageStepInput, type FlowServiceStepInput, type FlowStep, type FlowStepInput, type FlowSubFlowStepInput, type GetCatalogGraph, type Message, type MessagePointerInput, type NestedCatalogGraph, type Operation, type Query, type ReceivesPointer, type RelationshipChange, type ResourceChange, type ResourceChangeType, type ResourceGroup, type ResourcePointer, type SchemaPointer, type SendsPointer, type Service, type SnapshotDiff, type SnapshotGitInfo, type SnapshotMeta, type SnapshotOptions, type SnapshotResourceType, type SnapshotResources, type SnapshotResult, type Specification, type Specifications, type System, type SystemActorRelationship, type SystemRelationshipPointer, type SystemScope, type Team, type TriggerPointer, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };
package/dist/index.d.ts CHANGED
@@ -56,6 +56,61 @@ type ResourcePointer = {
56
56
  type?: string;
57
57
  };
58
58
 
59
+ type CatalogGraphResourceType =
60
+ | 'domain'
61
+ | 'system'
62
+ | 'service'
63
+ | 'agent'
64
+ | 'event'
65
+ | 'command'
66
+ | 'query'
67
+ | 'flow'
68
+ | 'channel'
69
+ | 'entity'
70
+ | 'container'
71
+ | 'data-product'
72
+ | 'adr';
73
+
74
+ type CatalogGraphRoot = {
75
+ type: CatalogGraphResourceType;
76
+ id: string;
77
+ version?: string;
78
+ };
79
+
80
+ type CatalogGraphOptions = {
81
+ /** Number of relationship levels to traverse. Defaults to the complete reachable graph. */
82
+ depth?: number;
83
+ /** Return one deduplicated resource list instead of nested children. */
84
+ flat?: boolean;
85
+ };
86
+
87
+ type CatalogGraphResource = {
88
+ type: CatalogGraphResourceType;
89
+ id: string;
90
+ version: string;
91
+ };
92
+
93
+ type CatalogGraphNode = CatalogGraphResource & {
94
+ children: CatalogGraphNode[];
95
+ };
96
+
97
+ type NestedCatalogGraph = {
98
+ root: CatalogGraphNode;
99
+ };
100
+
101
+ type FlatCatalogGraph = {
102
+ root: CatalogGraphResource;
103
+ resources: CatalogGraphResource[];
104
+ };
105
+
106
+ type CatalogGraph = NestedCatalogGraph | FlatCatalogGraph;
107
+
108
+ interface GetCatalogGraph {
109
+ (root: CatalogGraphRoot, options: CatalogGraphOptions & { flat: true }): Promise<FlatCatalogGraph | undefined>;
110
+ (root: CatalogGraphRoot, options?: CatalogGraphOptions & { flat?: false }): Promise<NestedCatalogGraph | undefined>;
111
+ (root: CatalogGraphRoot, options: CatalogGraphOptions): Promise<CatalogGraph | undefined>;
112
+ }
113
+
59
114
  type SystemScope = 'internal' | 'external';
60
115
 
61
116
  type SystemRelationshipPointer = {
@@ -1460,23 +1515,7 @@ declare const _default: (path: string) => {
1460
1515
  id: string;
1461
1516
  version?: string;
1462
1517
  }, options?: {
1463
- path
1464
- /**
1465
- * Adds an event to a service in EventCatalog
1466
- *
1467
- * @param event - The event to write to the service
1468
- * @param service - The service and it's id to write to the event to
1469
- * @param options - Optional options to write the event
1470
- *
1471
- */
1472
- ? /**
1473
- * Adds an event to a service in EventCatalog
1474
- *
1475
- * @param event - The event to write to the service
1476
- * @param service - The service and it's id to write to the event to
1477
- * @param options - Optional options to write the event
1478
- *
1479
- */: string;
1518
+ path?: string;
1480
1519
  format?: "md" | "mdx";
1481
1520
  override?: boolean;
1482
1521
  }) => Promise<void>;
@@ -2315,6 +2354,13 @@ declare const _default: (path: string) => {
2315
2354
  dumpCatalog: (options?: {
2316
2355
  includeMarkdown?: boolean;
2317
2356
  }) => Promise<EventCatalog>;
2357
+ /**
2358
+ * Returns the resources reachable from a catalog resource.
2359
+ * @param root - Resource to use as the root of the graph
2360
+ * @param options - Traversal depth and whether to return a flat resource list
2361
+ * @returns The resolved graph, or undefined when the root does not exist
2362
+ */
2363
+ getGraph: GetCatalogGraph;
2318
2364
  /**
2319
2365
  * Returns the event catalog configuration file.
2320
2366
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2584,13 +2630,19 @@ declare const _default: (path: string) => {
2584
2630
  */
2585
2631
  writeFlowToDomain: (flow: Flow, domain: {
2586
2632
  id: string;
2587
- version? /**
2633
+ version?: string;
2634
+ }, options?: {
2635
+ path
2636
+ /**
2637
+ * Returns all events from EventCatalog
2638
+ * @param latestOnly - optional boolean, set to true to get only latest versions
2639
+ * @returns Event[]|Undefined
2640
+ */
2641
+ ? /**
2588
2642
  * Returns all events from EventCatalog
2589
2643
  * @param latestOnly - optional boolean, set to true to get only latest versions
2590
2644
  * @returns Event[]|Undefined
2591
2645
  */: string;
2592
- }, options?: {
2593
- path?: string;
2594
2646
  format?: "md" | "mdx";
2595
2647
  override?: boolean;
2596
2648
  }) => Promise<void>;
@@ -2607,12 +2659,7 @@ declare const _default: (path: string) => {
2607
2659
  version?: string;
2608
2660
  }, options?: {
2609
2661
  path?: string;
2610
- format? /**
2611
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
2612
- *
2613
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
2614
- *
2615
- */: "md" | "mdx";
2662
+ format?: "md" | "mdx";
2616
2663
  override?: boolean;
2617
2664
  }) => Promise<void>;
2618
2665
  /**
@@ -2643,7 +2690,18 @@ declare const _default: (path: string) => {
2643
2690
  id: string;
2644
2691
  version?: string;
2645
2692
  }, options?: {
2646
- path?: string;
2693
+ path
2694
+ /**
2695
+ * Returns a command from EventCatalog
2696
+ * @param id - The id of the command to retrieve
2697
+ * @param version - Optional id of the version to get (supports semver)
2698
+ * @returns Command|Undefined
2699
+ */
2700
+ ? /**
2701
+ * ================================
2702
+ * Commands
2703
+ * ================================
2704
+ */: string;
2647
2705
  format?: "md" | "mdx";
2648
2706
  override?: boolean;
2649
2707
  }) => Promise<void>;
@@ -2986,4 +3044,4 @@ declare const _default: (path: string) => {
2986
3044
  toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
2987
3045
  };
2988
3046
 
2989
- export { type Adr, type AdrPointer, type AdrResourcePointer, type AdrStatus, type Agent, type AgentModel, type AgentTool, type Badge, type BaseSchema, type CatalogSnapshot, type Changelog, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Diagram, type DiffSummary, type Domain, type Entity, type Event, type EventCatalog, type ExtensionProperties, type Flow, type FlowActorStepInput, type FlowAgentStepInput, FlowBuilder, type FlowBuilderInput, type FlowCustomStepInput, type FlowDataProductStepInput, type FlowDataStoreStepInput, type FlowExternalSystemStepInput, type FlowMessageStepInput, type FlowServiceStepInput, type FlowStep, type FlowStepInput, type FlowSubFlowStepInput, type Message, type MessagePointerInput, type Operation, type Query, type ReceivesPointer, type RelationshipChange, type ResourceChange, type ResourceChangeType, type ResourceGroup, type ResourcePointer, type SchemaPointer, type SendsPointer, type Service, type SnapshotDiff, type SnapshotGitInfo, type SnapshotMeta, type SnapshotOptions, type SnapshotResourceType, type SnapshotResources, type SnapshotResult, type Specification, type Specifications, type System, type SystemActorRelationship, type SystemRelationshipPointer, type SystemScope, type Team, type TriggerPointer, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };
3047
+ export { type Adr, type AdrPointer, type AdrResourcePointer, type AdrStatus, type Agent, type AgentModel, type AgentTool, type Badge, type BaseSchema, type CatalogGraph, type CatalogGraphNode, type CatalogGraphOptions, type CatalogGraphResource, type CatalogGraphResourceType, type CatalogGraphRoot, type CatalogSnapshot, type Changelog, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Diagram, type DiffSummary, type Domain, type Entity, type Event, type EventCatalog, type ExtensionProperties, type FlatCatalogGraph, type Flow, type FlowActorStepInput, type FlowAgentStepInput, FlowBuilder, type FlowBuilderInput, type FlowCustomStepInput, type FlowDataProductStepInput, type FlowDataStoreStepInput, type FlowExternalSystemStepInput, type FlowMessageStepInput, type FlowServiceStepInput, type FlowStep, type FlowStepInput, type FlowSubFlowStepInput, type GetCatalogGraph, type Message, type MessagePointerInput, type NestedCatalogGraph, type Operation, type Query, type ReceivesPointer, type RelationshipChange, type ResourceChange, type ResourceChangeType, type ResourceGroup, type ResourcePointer, type SchemaPointer, type SendsPointer, type Service, type SnapshotDiff, type SnapshotGitInfo, type SnapshotMeta, type SnapshotOptions, type SnapshotResourceType, type SnapshotResources, type SnapshotResult, type Specification, type Specifications, type System, type SystemActorRelationship, type SystemRelationshipPointer, type SystemScope, type Team, type TriggerPointer, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };