@eventcatalog/sdk 2.26.1 → 2.26.3

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 = {
@@ -392,18 +447,27 @@ interface DetailPanelProperty {
392
447
  visible: boolean;
393
448
  }
394
449
 
450
+ interface EntityProperty {
451
+ name: string;
452
+ type: string;
453
+ required?: boolean;
454
+ description?: string;
455
+ references?: string;
456
+ referencesIdentifier?: string;
457
+ referenceTarget?: 'entity';
458
+ relationType?: string;
459
+ enum?: string[];
460
+ properties?: EntityProperty[];
461
+ items?: {
462
+ type: string;
463
+ properties?: EntityProperty[];
464
+ };
465
+ }
466
+
395
467
  interface Entity extends BaseSchema {
396
468
  aggregateRoot?: boolean;
397
469
  identifier?: string;
398
- properties?: {
399
- name: string;
400
- type: string;
401
- required?: boolean;
402
- description?: string;
403
- references?: string;
404
- referencesIdentifier?: string;
405
- relationType?: string;
406
- }[];
470
+ properties?: EntityProperty[];
407
471
  detailsPanel?: {
408
472
  domains?: DetailPanelProperty;
409
473
  services?: DetailPanelProperty;
@@ -1460,23 +1524,7 @@ declare const _default: (path: string) => {
1460
1524
  id: string;
1461
1525
  version?: string;
1462
1526
  }, 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;
1527
+ path?: string;
1480
1528
  format?: "md" | "mdx";
1481
1529
  override?: boolean;
1482
1530
  }) => Promise<void>;
@@ -2315,6 +2363,13 @@ declare const _default: (path: string) => {
2315
2363
  dumpCatalog: (options?: {
2316
2364
  includeMarkdown?: boolean;
2317
2365
  }) => Promise<EventCatalog>;
2366
+ /**
2367
+ * Returns the resources reachable from a catalog resource.
2368
+ * @param root - Resource to use as the root of the graph
2369
+ * @param options - Traversal depth and whether to return a flat resource list
2370
+ * @returns The resolved graph, or undefined when the root does not exist
2371
+ */
2372
+ getGraph: GetCatalogGraph;
2318
2373
  /**
2319
2374
  * Returns the event catalog configuration file.
2320
2375
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2584,13 +2639,19 @@ declare const _default: (path: string) => {
2584
2639
  */
2585
2640
  writeFlowToDomain: (flow: Flow, domain: {
2586
2641
  id: string;
2587
- version? /**
2642
+ version?: string;
2643
+ }, options?: {
2644
+ path
2645
+ /**
2646
+ * Returns all events from EventCatalog
2647
+ * @param latestOnly - optional boolean, set to true to get only latest versions
2648
+ * @returns Event[]|Undefined
2649
+ */
2650
+ ? /**
2588
2651
  * Returns all events from EventCatalog
2589
2652
  * @param latestOnly - optional boolean, set to true to get only latest versions
2590
2653
  * @returns Event[]|Undefined
2591
2654
  */: string;
2592
- }, options?: {
2593
- path?: string;
2594
2655
  format?: "md" | "mdx";
2595
2656
  override?: boolean;
2596
2657
  }) => Promise<void>;
@@ -2607,12 +2668,7 @@ declare const _default: (path: string) => {
2607
2668
  version?: string;
2608
2669
  }, options?: {
2609
2670
  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";
2671
+ format?: "md" | "mdx";
2616
2672
  override?: boolean;
2617
2673
  }) => Promise<void>;
2618
2674
  /**
@@ -2643,7 +2699,18 @@ declare const _default: (path: string) => {
2643
2699
  id: string;
2644
2700
  version?: string;
2645
2701
  }, options?: {
2646
- path?: string;
2702
+ path
2703
+ /**
2704
+ * Returns a command from EventCatalog
2705
+ * @param id - The id of the command to retrieve
2706
+ * @param version - Optional id of the version to get (supports semver)
2707
+ * @returns Command|Undefined
2708
+ */
2709
+ ? /**
2710
+ * ================================
2711
+ * Commands
2712
+ * ================================
2713
+ */: string;
2647
2714
  format?: "md" | "mdx";
2648
2715
  override?: boolean;
2649
2716
  }) => Promise<void>;
@@ -2986,4 +3053,4 @@ declare const _default: (path: string) => {
2986
3053
  toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
2987
3054
  };
2988
3055
 
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 };
3056
+ 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 EntityProperty, 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 = {
@@ -392,18 +447,27 @@ interface DetailPanelProperty {
392
447
  visible: boolean;
393
448
  }
394
449
 
450
+ interface EntityProperty {
451
+ name: string;
452
+ type: string;
453
+ required?: boolean;
454
+ description?: string;
455
+ references?: string;
456
+ referencesIdentifier?: string;
457
+ referenceTarget?: 'entity';
458
+ relationType?: string;
459
+ enum?: string[];
460
+ properties?: EntityProperty[];
461
+ items?: {
462
+ type: string;
463
+ properties?: EntityProperty[];
464
+ };
465
+ }
466
+
395
467
  interface Entity extends BaseSchema {
396
468
  aggregateRoot?: boolean;
397
469
  identifier?: string;
398
- properties?: {
399
- name: string;
400
- type: string;
401
- required?: boolean;
402
- description?: string;
403
- references?: string;
404
- referencesIdentifier?: string;
405
- relationType?: string;
406
- }[];
470
+ properties?: EntityProperty[];
407
471
  detailsPanel?: {
408
472
  domains?: DetailPanelProperty;
409
473
  services?: DetailPanelProperty;
@@ -1460,23 +1524,7 @@ declare const _default: (path: string) => {
1460
1524
  id: string;
1461
1525
  version?: string;
1462
1526
  }, 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;
1527
+ path?: string;
1480
1528
  format?: "md" | "mdx";
1481
1529
  override?: boolean;
1482
1530
  }) => Promise<void>;
@@ -2315,6 +2363,13 @@ declare const _default: (path: string) => {
2315
2363
  dumpCatalog: (options?: {
2316
2364
  includeMarkdown?: boolean;
2317
2365
  }) => Promise<EventCatalog>;
2366
+ /**
2367
+ * Returns the resources reachable from a catalog resource.
2368
+ * @param root - Resource to use as the root of the graph
2369
+ * @param options - Traversal depth and whether to return a flat resource list
2370
+ * @returns The resolved graph, or undefined when the root does not exist
2371
+ */
2372
+ getGraph: GetCatalogGraph;
2318
2373
  /**
2319
2374
  * Returns the event catalog configuration file.
2320
2375
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -2584,13 +2639,19 @@ declare const _default: (path: string) => {
2584
2639
  */
2585
2640
  writeFlowToDomain: (flow: Flow, domain: {
2586
2641
  id: string;
2587
- version? /**
2642
+ version?: string;
2643
+ }, options?: {
2644
+ path
2645
+ /**
2646
+ * Returns all events from EventCatalog
2647
+ * @param latestOnly - optional boolean, set to true to get only latest versions
2648
+ * @returns Event[]|Undefined
2649
+ */
2650
+ ? /**
2588
2651
  * Returns all events from EventCatalog
2589
2652
  * @param latestOnly - optional boolean, set to true to get only latest versions
2590
2653
  * @returns Event[]|Undefined
2591
2654
  */: string;
2592
- }, options?: {
2593
- path?: string;
2594
2655
  format?: "md" | "mdx";
2595
2656
  override?: boolean;
2596
2657
  }) => Promise<void>;
@@ -2607,12 +2668,7 @@ declare const _default: (path: string) => {
2607
2668
  version?: string;
2608
2669
  }, options?: {
2609
2670
  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";
2671
+ format?: "md" | "mdx";
2616
2672
  override?: boolean;
2617
2673
  }) => Promise<void>;
2618
2674
  /**
@@ -2643,7 +2699,18 @@ declare const _default: (path: string) => {
2643
2699
  id: string;
2644
2700
  version?: string;
2645
2701
  }, options?: {
2646
- path?: string;
2702
+ path
2703
+ /**
2704
+ * Returns a command from EventCatalog
2705
+ * @param id - The id of the command to retrieve
2706
+ * @param version - Optional id of the version to get (supports semver)
2707
+ * @returns Command|Undefined
2708
+ */
2709
+ ? /**
2710
+ * ================================
2711
+ * Commands
2712
+ * ================================
2713
+ */: string;
2647
2714
  format?: "md" | "mdx";
2648
2715
  override?: boolean;
2649
2716
  }) => Promise<void>;
@@ -2986,4 +3053,4 @@ declare const _default: (path: string) => {
2986
3053
  toDSL: (resource: (Event | Command | Query | Service | Domain) | (Event | Command | Query | Service | Domain)[], options: ToDSLOptions) => Promise<string>;
2987
3054
  };
2988
3055
 
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 };
3056
+ 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 EntityProperty, 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 };