@eventcatalog/sdk 2.26.0 → 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
@@ -1,5 +1,9 @@
1
+ interface ExtensionProperties {
2
+ [key: `x-${string}`]: unknown;
3
+ }
4
+
1
5
  // Base type for all resources (domains, services and messages)
2
- interface BaseSchema {
6
+ interface BaseSchema extends ExtensionProperties {
3
7
  id: string;
4
8
  name: string;
5
9
  summary?: string;
@@ -52,6 +56,61 @@ type ResourcePointer = {
52
56
  type?: string;
53
57
  };
54
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
+
55
114
  type SystemScope = 'internal' | 'external';
56
115
 
57
116
  type SystemRelationshipPointer = {
@@ -1456,23 +1515,7 @@ declare const _default: (path: string) => {
1456
1515
  id: string;
1457
1516
  version?: string;
1458
1517
  }, options?: {
1459
- path
1460
- /**
1461
- * Adds an event to a service in EventCatalog
1462
- *
1463
- * @param event - The event to write to the service
1464
- * @param service - The service and it's id to write to the event to
1465
- * @param options - Optional options to write the event
1466
- *
1467
- */
1468
- ? /**
1469
- * Adds an event to a service in EventCatalog
1470
- *
1471
- * @param event - The event to write to the service
1472
- * @param service - The service and it's id to write to the event to
1473
- * @param options - Optional options to write the event
1474
- *
1475
- */: string;
1518
+ path?: string;
1476
1519
  format?: "md" | "mdx";
1477
1520
  override?: boolean;
1478
1521
  }) => Promise<void>;
@@ -2311,6 +2354,13 @@ declare const _default: (path: string) => {
2311
2354
  dumpCatalog: (options?: {
2312
2355
  includeMarkdown?: boolean;
2313
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;
2314
2364
  /**
2315
2365
  * Returns the event catalog configuration file.
2316
2366
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2580,13 +2630,19 @@ declare const _default: (path: string) => {
2580
2630
  */
2581
2631
  writeFlowToDomain: (flow: Flow, domain: {
2582
2632
  id: string;
2583
- 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
+ ? /**
2584
2642
  * Returns all events from EventCatalog
2585
2643
  * @param latestOnly - optional boolean, set to true to get only latest versions
2586
2644
  * @returns Event[]|Undefined
2587
2645
  */: string;
2588
- }, options?: {
2589
- path?: string;
2590
2646
  format?: "md" | "mdx";
2591
2647
  override?: boolean;
2592
2648
  }) => Promise<void>;
@@ -2603,12 +2659,7 @@ declare const _default: (path: string) => {
2603
2659
  version?: string;
2604
2660
  }, options?: {
2605
2661
  path?: string;
2606
- format? /**
2607
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
2608
- *
2609
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
2610
- *
2611
- */: "md" | "mdx";
2662
+ format?: "md" | "mdx";
2612
2663
  override?: boolean;
2613
2664
  }) => Promise<void>;
2614
2665
  /**
@@ -2639,7 +2690,18 @@ declare const _default: (path: string) => {
2639
2690
  id: string;
2640
2691
  version?: string;
2641
2692
  }, options?: {
2642
- 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;
2643
2705
  format?: "md" | "mdx";
2644
2706
  override?: boolean;
2645
2707
  }) => Promise<void>;
@@ -2982,4 +3044,4 @@ declare const _default: (path: string) => {
2982
3044
  toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
2983
3045
  };
2984
3046
 
2985
- 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 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
@@ -1,5 +1,9 @@
1
+ interface ExtensionProperties {
2
+ [key: `x-${string}`]: unknown;
3
+ }
4
+
1
5
  // Base type for all resources (domains, services and messages)
2
- interface BaseSchema {
6
+ interface BaseSchema extends ExtensionProperties {
3
7
  id: string;
4
8
  name: string;
5
9
  summary?: string;
@@ -52,6 +56,61 @@ type ResourcePointer = {
52
56
  type?: string;
53
57
  };
54
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
+
55
114
  type SystemScope = 'internal' | 'external';
56
115
 
57
116
  type SystemRelationshipPointer = {
@@ -1456,23 +1515,7 @@ declare const _default: (path: string) => {
1456
1515
  id: string;
1457
1516
  version?: string;
1458
1517
  }, options?: {
1459
- path
1460
- /**
1461
- * Adds an event to a service in EventCatalog
1462
- *
1463
- * @param event - The event to write to the service
1464
- * @param service - The service and it's id to write to the event to
1465
- * @param options - Optional options to write the event
1466
- *
1467
- */
1468
- ? /**
1469
- * Adds an event to a service in EventCatalog
1470
- *
1471
- * @param event - The event to write to the service
1472
- * @param service - The service and it's id to write to the event to
1473
- * @param options - Optional options to write the event
1474
- *
1475
- */: string;
1518
+ path?: string;
1476
1519
  format?: "md" | "mdx";
1477
1520
  override?: boolean;
1478
1521
  }) => Promise<void>;
@@ -2311,6 +2354,13 @@ declare const _default: (path: string) => {
2311
2354
  dumpCatalog: (options?: {
2312
2355
  includeMarkdown?: boolean;
2313
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;
2314
2364
  /**
2315
2365
  * Returns the event catalog configuration file.
2316
2366
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2580,13 +2630,19 @@ declare const _default: (path: string) => {
2580
2630
  */
2581
2631
  writeFlowToDomain: (flow: Flow, domain: {
2582
2632
  id: string;
2583
- 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
+ ? /**
2584
2642
  * Returns all events from EventCatalog
2585
2643
  * @param latestOnly - optional boolean, set to true to get only latest versions
2586
2644
  * @returns Event[]|Undefined
2587
2645
  */: string;
2588
- }, options?: {
2589
- path?: string;
2590
2646
  format?: "md" | "mdx";
2591
2647
  override?: boolean;
2592
2648
  }) => Promise<void>;
@@ -2603,12 +2659,7 @@ declare const _default: (path: string) => {
2603
2659
  version?: string;
2604
2660
  }, options?: {
2605
2661
  path?: string;
2606
- format? /**
2607
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
2608
- *
2609
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
2610
- *
2611
- */: "md" | "mdx";
2662
+ format?: "md" | "mdx";
2612
2663
  override?: boolean;
2613
2664
  }) => Promise<void>;
2614
2665
  /**
@@ -2639,7 +2690,18 @@ declare const _default: (path: string) => {
2639
2690
  id: string;
2640
2691
  version?: string;
2641
2692
  }, options?: {
2642
- 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;
2643
2705
  format?: "md" | "mdx";
2644
2706
  override?: boolean;
2645
2707
  }) => Promise<void>;
@@ -2982,4 +3044,4 @@ declare const _default: (path: string) => {
2982
3044
  toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
2983
3045
  };
2984
3046
 
2985
- 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 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 };