@eventcatalog/sdk 2.11.0 → 2.12.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.
Files changed (114) hide show
  1. package/README.md +86 -1
  2. package/dist/cli/index.d.mts +1 -0
  3. package/dist/cli/index.d.ts +1 -0
  4. package/dist/{eventcatalog.js → cli/index.js} +588 -378
  5. package/dist/cli/index.js.map +1 -0
  6. package/dist/{eventcatalog.mjs → cli/index.mjs} +666 -436
  7. package/dist/cli/index.mjs.map +1 -0
  8. package/dist/cli-docs.d.mts +43 -0
  9. package/dist/cli-docs.d.ts +43 -0
  10. package/dist/cli-docs.js +1614 -0
  11. package/dist/cli-docs.js.map +1 -0
  12. package/dist/cli-docs.mjs +1586 -0
  13. package/dist/cli-docs.mjs.map +1 -0
  14. package/dist/index.d.mts +443 -25
  15. package/dist/index.d.ts +443 -25
  16. package/dist/index.js +204 -121
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +204 -121
  19. package/dist/index.mjs.map +1 -1
  20. package/package.json +13 -4
  21. package/dist/channels.d.mts +0 -214
  22. package/dist/channels.d.ts +0 -214
  23. package/dist/channels.js +0 -432
  24. package/dist/channels.js.map +0 -1
  25. package/dist/channels.mjs +0 -384
  26. package/dist/channels.mjs.map +0 -1
  27. package/dist/commands.d.mts +0 -274
  28. package/dist/commands.d.ts +0 -274
  29. package/dist/commands.js +0 -394
  30. package/dist/commands.js.map +0 -1
  31. package/dist/commands.mjs +0 -350
  32. package/dist/commands.mjs.map +0 -1
  33. package/dist/containers.d.mts +0 -179
  34. package/dist/containers.d.ts +0 -179
  35. package/dist/containers.js +0 -388
  36. package/dist/containers.js.map +0 -1
  37. package/dist/containers.mjs +0 -345
  38. package/dist/containers.mjs.map +0 -1
  39. package/dist/custom-docs.d.mts +0 -89
  40. package/dist/custom-docs.d.ts +0 -89
  41. package/dist/custom-docs.js +0 -164
  42. package/dist/custom-docs.js.map +0 -1
  43. package/dist/custom-docs.mjs +0 -122
  44. package/dist/custom-docs.mjs.map +0 -1
  45. package/dist/data-products.d.mts +0 -225
  46. package/dist/data-products.d.ts +0 -225
  47. package/dist/data-products.js +0 -375
  48. package/dist/data-products.js.map +0 -1
  49. package/dist/data-products.mjs +0 -332
  50. package/dist/data-products.mjs.map +0 -1
  51. package/dist/data-stores.d.mts +0 -179
  52. package/dist/data-stores.d.ts +0 -179
  53. package/dist/data-stores.js +0 -401
  54. package/dist/data-stores.js.map +0 -1
  55. package/dist/data-stores.mjs +0 -356
  56. package/dist/data-stores.mjs.map +0 -1
  57. package/dist/domains.d.mts +0 -347
  58. package/dist/domains.d.ts +0 -347
  59. package/dist/domains.js +0 -547
  60. package/dist/domains.js.map +0 -1
  61. package/dist/domains.mjs +0 -498
  62. package/dist/domains.mjs.map +0 -1
  63. package/dist/entities.d.mts +0 -174
  64. package/dist/entities.d.ts +0 -174
  65. package/dist/entities.js +0 -348
  66. package/dist/entities.js.map +0 -1
  67. package/dist/entities.mjs +0 -307
  68. package/dist/entities.mjs.map +0 -1
  69. package/dist/eventcatalog.d.mts +0 -21
  70. package/dist/eventcatalog.d.ts +0 -21
  71. package/dist/eventcatalog.js.map +0 -1
  72. package/dist/eventcatalog.mjs.map +0 -1
  73. package/dist/events.d.mts +0 -276
  74. package/dist/events.d.ts +0 -276
  75. package/dist/events.js +0 -393
  76. package/dist/events.js.map +0 -1
  77. package/dist/events.mjs +0 -349
  78. package/dist/events.mjs.map +0 -1
  79. package/dist/messages.d.mts +0 -65
  80. package/dist/messages.d.ts +0 -65
  81. package/dist/messages.js +0 -312
  82. package/dist/messages.js.map +0 -1
  83. package/dist/messages.mjs +0 -269
  84. package/dist/messages.mjs.map +0 -1
  85. package/dist/queries.d.mts +0 -276
  86. package/dist/queries.d.ts +0 -276
  87. package/dist/queries.js +0 -394
  88. package/dist/queries.js.map +0 -1
  89. package/dist/queries.mjs +0 -350
  90. package/dist/queries.mjs.map +0 -1
  91. package/dist/services.d.mts +0 -384
  92. package/dist/services.d.ts +0 -384
  93. package/dist/services.js +0 -577
  94. package/dist/services.js.map +0 -1
  95. package/dist/services.mjs +0 -526
  96. package/dist/services.mjs.map +0 -1
  97. package/dist/teams.d.mts +0 -90
  98. package/dist/teams.d.ts +0 -90
  99. package/dist/teams.js +0 -246
  100. package/dist/teams.js.map +0 -1
  101. package/dist/teams.mjs +0 -202
  102. package/dist/teams.mjs.map +0 -1
  103. package/dist/types.d.d.mts +0 -331
  104. package/dist/types.d.d.ts +0 -331
  105. package/dist/types.d.js +0 -19
  106. package/dist/types.d.js.map +0 -1
  107. package/dist/types.d.mjs +0 -1
  108. package/dist/types.d.mjs.map +0 -1
  109. package/dist/users.d.mts +0 -83
  110. package/dist/users.d.ts +0 -83
  111. package/dist/users.js +0 -127
  112. package/dist/users.js.map +0 -1
  113. package/dist/users.mjs +0 -88
  114. package/dist/users.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,5 +1,341 @@
1
- import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity, Container, DataProduct } from './types.d.mjs';
2
- export { Badge, BaseSchema, ChannelPointer, DataProductOutputPointer, ReceivesPointer, ResourceGroup, ResourcePointer, SendsPointer, Specification, Specifications, UbiquitousLanguage } from './types.d.mjs';
1
+ // Base type for all resources (domains, services and messages)
2
+ interface BaseSchema {
3
+ id: string;
4
+ name: string;
5
+ summary?: string;
6
+ version: string;
7
+ badges?: Badge[];
8
+ sidebar?: {
9
+ badge?: string;
10
+ };
11
+ owners?: string[];
12
+ schemaPath?: string;
13
+ markdown: string;
14
+ repository?: {
15
+ language?: string;
16
+ url?: string;
17
+ };
18
+ deprecated?:
19
+ | boolean
20
+ | {
21
+ date?: string;
22
+ message?: string;
23
+ };
24
+ styles?: {
25
+ icon?: string;
26
+ node?: {
27
+ color?: string;
28
+ label?: string;
29
+ };
30
+ };
31
+ attachments?:
32
+ | string[]
33
+ | {
34
+ url: string;
35
+ title?: string;
36
+ type?: string;
37
+ description?: string;
38
+ icon?: string;
39
+ }[];
40
+ resourceGroups?: ResourceGroup[];
41
+ diagrams?: ResourcePointer[];
42
+ editUrl?: string;
43
+ draft?: boolean | { title?: string; message?: string };
44
+ // SDK types
45
+ schema?: any;
46
+ }
47
+
48
+ type ResourcePointer = {
49
+ id: string;
50
+ version?: string;
51
+ type?: string;
52
+ };
53
+
54
+ type SendsPointer = {
55
+ id: string;
56
+ version?: string;
57
+ to?: ChannelPointer[];
58
+ };
59
+
60
+ type ReceivesPointer = {
61
+ id: string;
62
+ version?: string;
63
+ from?: ChannelPointer[];
64
+ };
65
+
66
+ interface ResourceGroup {
67
+ id?: string;
68
+ title?: string;
69
+ items: ResourcePointer[];
70
+ limit?: number;
71
+ sidebar?: boolean;
72
+ }
73
+
74
+ interface ChannelPointer extends ResourcePointer {
75
+ parameters?: Record<string, string>;
76
+ }
77
+
78
+ type Message = Event | Command | Query;
79
+
80
+ interface CustomDoc {
81
+ title: string;
82
+ summary: string;
83
+ slug?: string;
84
+ sidebar?: {
85
+ label: string;
86
+ order: number;
87
+ };
88
+ owners?: string[];
89
+ badges?: Badge[];
90
+ fileName?: string;
91
+ markdown: string;
92
+ }
93
+
94
+ interface MessageDetailsPanelProperty {
95
+ producers?: DetailPanelProperty;
96
+ consumers?: DetailPanelProperty;
97
+ channels?: DetailPanelProperty;
98
+ versions?: DetailPanelProperty;
99
+ repository?: DetailPanelProperty;
100
+ }
101
+
102
+ interface Event extends BaseSchema {
103
+ channels?: ChannelPointer[];
104
+ detailsPanel?: MessageDetailsPanelProperty;
105
+ }
106
+ interface Command extends BaseSchema {
107
+ channels?: ChannelPointer[];
108
+ detailsPanel?: MessageDetailsPanelProperty;
109
+ }
110
+ interface Query extends BaseSchema {
111
+ channels?: ChannelPointer[];
112
+ detailsPanel?: MessageDetailsPanelProperty;
113
+ }
114
+ interface Channel extends BaseSchema {
115
+ address?: string;
116
+ protocols?: string[];
117
+ routes?: ChannelPointer[];
118
+ detailsPanel?: {
119
+ producers?: DetailPanelProperty;
120
+ consumers?: DetailPanelProperty;
121
+ messages?: DetailPanelProperty;
122
+ protocols?: DetailPanelProperty;
123
+ versions?: DetailPanelProperty;
124
+ repository?: DetailPanelProperty;
125
+ owners?: DetailPanelProperty;
126
+ changelog?: DetailPanelProperty;
127
+ };
128
+ // parameters?: Record<string, Parameter>;
129
+ parameters?: {
130
+ [key: string]: {
131
+ enum?: string[];
132
+ default?: string;
133
+ examples?: string[];
134
+ description?: string;
135
+ };
136
+ };
137
+ }
138
+
139
+ interface Specifications {
140
+ asyncapiPath?: string;
141
+ openapiPath?: string;
142
+ graphqlPath?: string;
143
+ }
144
+
145
+ interface Specification {
146
+ type: 'openapi' | 'asyncapi' | 'graphql';
147
+ path: string;
148
+ name?: string;
149
+ }
150
+
151
+ interface Service extends BaseSchema {
152
+ sends?: SendsPointer[];
153
+ receives?: ReceivesPointer[];
154
+ entities?: ResourcePointer[];
155
+ writesTo?: ResourcePointer[];
156
+ readsFrom?: ResourcePointer[];
157
+ specifications?: Specifications | Specification[];
158
+ detailsPanel?: {
159
+ domains?: DetailPanelProperty;
160
+ messages?: DetailPanelProperty;
161
+ versions?: DetailPanelProperty;
162
+ specifications?: DetailPanelProperty;
163
+ entities?: DetailPanelProperty;
164
+ repository?: DetailPanelProperty;
165
+ owners?: DetailPanelProperty;
166
+ changelog?: DetailPanelProperty;
167
+ };
168
+ }
169
+
170
+ interface Domain extends BaseSchema {
171
+ services?: ResourcePointer[];
172
+ domains?: ResourcePointer[];
173
+ entities?: ResourcePointer[];
174
+ dataProducts?: ResourcePointer[];
175
+ sends?: SendsPointer[];
176
+ receives?: ReceivesPointer[];
177
+ detailsPanel?: {
178
+ parentDomains?: DetailPanelProperty;
179
+ subdomains?: DetailPanelProperty;
180
+ services?: DetailPanelProperty;
181
+ entities?: DetailPanelProperty;
182
+ messages?: DetailPanelProperty;
183
+ ubiquitousLanguage?: DetailPanelProperty;
184
+ repository?: DetailPanelProperty;
185
+ versions?: DetailPanelProperty;
186
+ owners?: DetailPanelProperty;
187
+ changelog?: DetailPanelProperty;
188
+ };
189
+ }
190
+
191
+ interface Team {
192
+ id: string;
193
+ name: string;
194
+ summary?: string;
195
+ email?: string;
196
+ hidden?: boolean;
197
+ slackDirectMessageUrl?: string;
198
+ members?: User[];
199
+ ownedCommands?: Command[];
200
+ ownedServices?: Service[];
201
+ ownedEvents?: Event[];
202
+ markdown: string;
203
+ }
204
+
205
+ interface User {
206
+ id: string;
207
+ name: string;
208
+ avatarUrl: string;
209
+ role?: string;
210
+ hidden?: boolean;
211
+ email?: string;
212
+ slackDirectMessageUrl?: string;
213
+ ownedServices?: Service[];
214
+ ownedEvents?: Event[];
215
+ ownedCommands?: Command[];
216
+ associatedTeams?: Team[];
217
+ markdown: string;
218
+ }
219
+
220
+ interface Badge {
221
+ content: string;
222
+ backgroundColor: string;
223
+ textColor: string;
224
+ icon?: string;
225
+ }
226
+
227
+ interface UbiquitousLanguage {
228
+ id: string;
229
+ name: string;
230
+ summary?: string;
231
+ description?: string;
232
+ icon?: string;
233
+ }
234
+
235
+ interface UbiquitousLanguageDictionary {
236
+ dictionary: UbiquitousLanguage[];
237
+ }
238
+
239
+ interface DetailPanelProperty {
240
+ visible: boolean;
241
+ }
242
+
243
+ interface Entity extends BaseSchema {
244
+ aggregateRoot?: boolean;
245
+ identifier?: string;
246
+ properties?: {
247
+ name: string;
248
+ type: string;
249
+ required?: boolean;
250
+ description?: string;
251
+ references?: string;
252
+ referencesIdentifier?: string;
253
+ relationType?: string;
254
+ }[];
255
+ detailsPanel?: {
256
+ domains?: DetailPanelProperty;
257
+ services?: DetailPanelProperty;
258
+ messages?: DetailPanelProperty;
259
+ versions?: DetailPanelProperty;
260
+ owners?: DetailPanelProperty;
261
+ changelog?: DetailPanelProperty;
262
+ };
263
+ }
264
+
265
+ interface Diagram extends BaseSchema {
266
+ detailsPanel?: {
267
+ versions?: DetailPanelProperty;
268
+ owners?: DetailPanelProperty;
269
+ changelog?: DetailPanelProperty;
270
+ attachments?: DetailPanelProperty;
271
+ };
272
+ }
273
+
274
+ type DataProductOutputPointer = {
275
+ id: string;
276
+ version?: string;
277
+ contract?: {
278
+ path: string;
279
+ name: string;
280
+ type?: string;
281
+ };
282
+ };
283
+
284
+ interface DataProduct extends BaseSchema {
285
+ inputs?: ResourcePointer[];
286
+ outputs?: DataProductOutputPointer[];
287
+ detailsPanel?: {
288
+ domains?: DetailPanelProperty;
289
+ inputs?: DetailPanelProperty;
290
+ outputs?: DetailPanelProperty;
291
+ versions?: DetailPanelProperty;
292
+ repository?: DetailPanelProperty;
293
+ owners?: DetailPanelProperty;
294
+ changelog?: DetailPanelProperty;
295
+ };
296
+ }
297
+
298
+ declare enum DataClassification {
299
+ Public = 'public',
300
+ Internal = 'internal',
301
+ Confidential = 'confidential',
302
+ Regulated = 'regulated',
303
+ }
304
+
305
+ interface Container extends BaseSchema {
306
+ container_type: 'database' | 'cache' | 'objectStore' | 'searchIndex' | 'dataWarehouse' | 'dataLake' | 'externalSaaS' | 'other';
307
+ technology?: string;
308
+ authoritative?: boolean;
309
+ access_mode?: string;
310
+ classification?: DataClassification;
311
+ residency?: string;
312
+ retention?: string;
313
+ detailsPanel?: {
314
+ versions?: DetailPanelProperty;
315
+ repository?: DetailPanelProperty;
316
+ owners?: DetailPanelProperty;
317
+ changelog?: DetailPanelProperty;
318
+ };
319
+ }
320
+
321
+ type EventCatalog = {
322
+ version: string;
323
+ catalogVersion: string;
324
+ createdAt: string;
325
+ resources: {
326
+ domains?: ExportedResource<Domain>[];
327
+ services?: ExportedResource<Service>[];
328
+ messages?: {
329
+ events?: ExportedResource<Event>[];
330
+ queries?: ExportedResource<Query>[];
331
+ commands?: ExportedResource<Command>[];
332
+ };
333
+ teams?: ExportedResource<Team>[];
334
+ users?: ExportedResource<User>[];
335
+ channels?: ExportedResource<Channel>[];
336
+ customDocs?: ExportedResource<CustomDoc>[];
337
+ };
338
+ };
3
339
 
4
340
  /**
5
341
  * Init the SDK for EventCatalog
@@ -479,7 +815,23 @@ declare const _default: (path: string) => {
479
815
  writeServiceToDomain: (service: Service, domain: {
480
816
  id: string;
481
817
  version?: string;
482
- direction?: 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;
483
835
  }, options?: {
484
836
  path?: string;
485
837
  format?: "md" | "mdx";
@@ -696,14 +1048,7 @@ declare const _default: (path: string) => {
696
1048
  *
697
1049
  */
698
1050
  writeDomain: (domain: Domain, options?: {
699
- path? /**
700
- * Adds an event to a service in EventCatalog
701
- *
702
- * @param event - The event to write to the service
703
- * @param service - The service and it's id to write to the event to
704
- * @param options - Optional options to write the event
705
- *
706
- */: string;
1051
+ path?: string;
707
1052
  override?: boolean;
708
1053
  versionExistingContent?: boolean;
709
1054
  format?: "md" | "mdx";
@@ -1186,12 +1531,7 @@ declare const _default: (path: string) => {
1186
1531
  }, options?: {
1187
1532
  path?: string;
1188
1533
  format?: "md" | "mdx";
1189
- override? /**
1190
- * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1191
- *
1192
- * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1193
- *
1194
- */: boolean;
1534
+ override?: boolean;
1195
1535
  }) => Promise<void>;
1196
1536
  /**
1197
1537
  * ================================
@@ -1223,13 +1563,7 @@ declare const _default: (path: string) => {
1223
1563
  }, options?: {
1224
1564
  path?: string;
1225
1565
  format?: "md" | "mdx";
1226
- override? /**
1227
- * Adds a schema to the given event
1228
- * @param id - The id of the event to add the schema to
1229
- * @param schema - Schema contents to add including the content and the file name
1230
- * @param version - Optional version of the event to add the schema to
1231
- * @returns
1232
- */: boolean;
1566
+ override?: boolean;
1233
1567
  }) => Promise<void>;
1234
1568
  /**
1235
1569
  * Returns a data product from EventCatalog
@@ -1291,6 +1625,90 @@ declare const _default: (path: string) => {
1291
1625
  id: string;
1292
1626
  version: string;
1293
1627
  }, version?: string) => Promise<void>;
1628
+ /**
1629
+ * ================================
1630
+ * Diagrams
1631
+ * ================================
1632
+ */
1633
+ /**
1634
+ * Returns a diagram from EventCatalog
1635
+ * @param id - The id of the diagram to retrieve
1636
+ * @param version - Optional id of the version to get (supports semver)
1637
+ * @returns Diagram|Undefined
1638
+ */
1639
+ getDiagram: (id: string, version?: string) => Promise<Diagram>;
1640
+ /**
1641
+ * Returns all diagrams from EventCatalog
1642
+ * @param latestOnly - optional boolean, set to true to get only latest versions
1643
+ * @returns Diagram[]|Undefined
1644
+ */
1645
+ getDiagrams: (options?: {
1646
+ latestOnly?: boolean;
1647
+ }) => Promise<Diagram[]>;
1648
+ /**
1649
+ * Adds a diagram to EventCatalog
1650
+ *
1651
+ * @param diagram - The diagram to write
1652
+ * @param options - Optional options to write the diagram
1653
+ *
1654
+ */
1655
+ 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;
1671
+ override?: boolean;
1672
+ versionExistingContent?: boolean;
1673
+ format?: "md" | "mdx";
1674
+ }) => Promise<void>;
1675
+ /**
1676
+ * Remove a diagram from EventCatalog (modeled on the standard POSIX rm utility)
1677
+ *
1678
+ * @param path - The path to your diagram, e.g. `/ArchitectureDiagram`
1679
+ *
1680
+ */
1681
+ rmDiagram: (path: string) => Promise<void>;
1682
+ /**
1683
+ * Remove a diagram by a diagram id
1684
+ *
1685
+ * @param id - The id of the diagram you want to remove
1686
+ *
1687
+ */
1688
+ rmDiagramById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1689
+ /**
1690
+ * Moves a given diagram id to the version directory
1691
+ * @param id - The id of the diagram to version
1692
+ */
1693
+ versionDiagram: (id: string) => Promise<void>;
1694
+ /**
1695
+ * Check to see if a diagram version exists
1696
+ * @param id - The id of the diagram
1697
+ * @param version - The version of the diagram (supports semver)
1698
+ * @returns
1699
+ */
1700
+ diagramHasVersion: (id: string, version?: string) => Promise<boolean>;
1701
+ /**
1702
+ * Adds a file to the given diagram
1703
+ * @param id - The id of the diagram to add the file to
1704
+ * @param file - File contents to add including the content and the file name
1705
+ * @param version - Optional version of the diagram to add the file to
1706
+ * @returns
1707
+ */
1708
+ addFileToDiagram: (id: string, file: {
1709
+ content: string;
1710
+ fileName: string;
1711
+ }, version?: string) => Promise<void>;
1294
1712
  };
1295
1713
 
1296
- export { Channel, Command, Container, CustomDoc, DataProduct, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
1714
+ 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 };