@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
@@ -1,347 +0,0 @@
1
- import { Domain, UbiquitousLanguageDictionary } from './types.d.mjs';
2
-
3
- /**
4
- * Returns a domain from EventCatalog.
5
- *
6
- * You can optionally specify a version to get a specific version of the domain
7
- *
8
- * @example
9
- * ```ts
10
- * import utils from '@eventcatalog/utils';
11
- *
12
- * const { getDomain } = utils('/path/to/eventcatalog');
13
- *
14
- * // Gets the latest version of the domain
15
- * const domain = await getDomain('Payment');
16
- *
17
- * // Gets a version of the domain
18
- * const domain = await getDomain('Payment', '0.0.1');
19
- * ```
20
- */
21
- declare const getDomain: (directory: string) => (id: string, version?: string) => Promise<Domain>;
22
- /**
23
- * Returns all domains from EventCatalog.
24
- *
25
- * You can optionally specify if you want to get the latest version of the domains.
26
- *
27
- * @example
28
- * ```ts
29
- * import utils from '@eventcatalog/utils';
30
- *
31
- * const { getDomains } = utils('/path/to/eventcatalog');
32
- *
33
- * // Gets all domains (and versions) from the catalog
34
- * const domains = await getDomains();
35
- *
36
- * // Gets all domains (only latest version) from the catalog
37
- * const domains = await getDomains({ latestOnly: true });
38
- * ```
39
- */
40
- declare const getDomains: (directory: string) => (options?: {
41
- latestOnly?: boolean;
42
- }) => Promise<Domain[]>;
43
- /**
44
- * Write a domain to EventCatalog.
45
- *
46
- * You can optionally overide the path of the domain.
47
- *
48
- * @example
49
- * ```ts
50
- * import utils from '@eventcatalog/utils';
51
- *
52
- * const { writeDomain } = utils('/path/to/eventcatalog');
53
- *
54
- * // Write a domain
55
- * // Domain would be written to domains/Payment
56
- * await writeDomain({
57
- * id: 'Payment',
58
- * name: 'Payment domain',
59
- * version: '0.0.1',
60
- * summary: 'Domain for all things to do with payments',
61
- * markdown: '# Hello world',
62
- * });
63
- *
64
- * // Write a domain to the catalog but override the path
65
- * // Domain would be written to domains/Inventory/Payment
66
- * await writeDomain({
67
- * id: 'Payment',
68
- * name: 'Inventory Adjusted',
69
- * version: '0.0.1',
70
- * summary: 'This is a summary',
71
- * markdown: '# Hello world',
72
- * }, { path: "/Inventory/Payment"});
73
- *
74
- * // Write a domain to the catalog and override the existing content (if there is any)
75
- * await writeDomain({
76
- * id: 'Payment',
77
- * name: 'Inventory Adjusted',
78
- * version: '0.0.1',
79
- * summary: 'This is a summary',
80
- * markdown: '# Hello world',
81
- * }, { override: true });
82
- *
83
- * // Write a domain to the catalog and version the previous version
84
- * // only works if the new version is greater than the previous version
85
- * await writeDomain({
86
- * id: 'Payment',
87
- * name: 'Inventory Adjusted',
88
- * version: '0.0.1',
89
- * summary: 'This is a summary',
90
- * markdown: '# Hello world',
91
- * }, { versionExistingContent: true });
92
- *
93
- * ```
94
- */
95
- declare const writeDomain: (directory: string) => (domain: Domain, options?: {
96
- path?: string;
97
- override?: boolean;
98
- versionExistingContent?: boolean;
99
- format?: "md" | "mdx";
100
- }) => Promise<void>;
101
- /**
102
- * Version a domain by it's id.
103
- *
104
- * Takes the latest domain and moves it to a versioned directory.
105
- * All files with this domain are also versioned. (e.g /domains/Payment/openapi.yml)
106
- *
107
- * @example
108
- * ```ts
109
- * import utils from '@eventcatalog/utils';
110
- *
111
- * const { versionDomain } = utils('/path/to/eventcatalog');
112
- *
113
- * // moves the latest Payment domain to a versioned directory
114
- * // the version within that domain is used as the version number.
115
- * await versionDomain('Payment');
116
- *
117
- * ```
118
- */
119
- declare const versionDomain: (directory: string) => (id: string) => Promise<void>;
120
- /**
121
- * Delete a domain at it's given path.
122
- *
123
- * @example
124
- * ```ts
125
- * import utils from '@eventcatalog/utils';
126
- *
127
- * const { rmDomain } = utils('/path/to/eventcatalog');
128
- *
129
- * // Removes the domain at domains/Payment
130
- * await rmDomain('/Payment');
131
- * ```
132
- */
133
- declare const rmDomain: (directory: string) => (path: string) => Promise<void>;
134
- /**
135
- * Delete a domain by it's id.
136
- *
137
- * Optionally specify a version to delete a specific version of the domain.
138
- *
139
- * @example
140
- * ```ts
141
- * import utils from '@eventcatalog/utils';
142
- *
143
- * const { rmDomainById } = utils('/path/to/eventcatalog');
144
- *
145
- * // deletes the latest Payment event
146
- * await rmDomainById('Payment');
147
- *
148
- * // deletes a specific version of the Payment event
149
- * await rmDomainById('Payment', '0.0.1');
150
- * ```
151
- */
152
- declare const rmDomainById: (directory: string) => (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
153
- /**
154
- * Add a file to a domain by it's id.
155
- *
156
- * Optionally specify a version to add a file to a specific version of the domain.
157
- *
158
- * @example
159
- * ```ts
160
- * import utils from '@eventcatalog/utils';
161
- *
162
- * const { addFileToDomain } = utils('/path/to/eventcatalog');
163
- *
164
- * // adds a file to the latest Payment event
165
- * await addFileToDomain('Payment', { content: 'Hello world', fileName: 'hello.txt' });
166
- *
167
- * // adds a file to a specific version of the Payment event
168
- * await addFileToDomain('Payment', { content: 'Hello world', fileName: 'hello.txt' }, '0.0.1');
169
- *
170
- * ```
171
- */
172
- declare const addFileToDomain: (directory: string) => (id: string, file: {
173
- content: string;
174
- fileName: string;
175
- }, version?: string) => Promise<void>;
176
- /**
177
- * Adds a ubiquitous language dictionary to a domain.
178
- *
179
- * Optionally specify a version to add a ubiquitous language dictionary to a specific version of the domain.
180
- *
181
- * @example
182
- * ```ts
183
- * import utils from '@eventcatalog/utils';
184
- *
185
- * const { addUbiquitousLanguageToDomain } = utils('/path/to/eventcatalog');
186
- *
187
- * // Adds a ubiquitous language dictionary to the latest Payment domain
188
- * await addUbiquitousLanguageToDomain('Payment', { dictionary: [{ id: 'Order', name: 'Order', summary: 'All things to do with the payment systems', description: 'This is a description', icon: 'KeyIcon' }] });
189
- *
190
- * // Adds a ubiquitous language dictionary to a specific version of the domain
191
- * await addUbiquitousLanguageToDomain('Payment', { dictionary: [{ id: 'Order', name: 'Order', summary: 'All things to do with the payment systems', description: 'This is a description', icon: 'KeyIcon' }] }, '0.0.1');
192
- * ```
193
- */
194
- declare const addUbiquitousLanguageToDomain: (directory: string) => (id: string, ubiquitousLanguageDictionary: UbiquitousLanguageDictionary, version?: string) => Promise<void>;
195
- /**
196
- * Returns the ubiquitous language dictionary from a domain.
197
- *
198
- * Optionally specify a version to get the ubiquitous language dictionary from a specific version of the domain.
199
- *
200
- * @example
201
- * ```ts
202
- * import utils from '@eventcatalog/utils';
203
- *
204
- * const { getUbiquitousLanguageFromDomain } = utils('/path/to/eventcatalog');
205
- *
206
- * const ubiquitousLanguage = await getUbiquitousLanguageFromDomain('Payment');
207
- *
208
- * // Returns the ubiquitous language dictionary from a specific version of the domain
209
- * const ubiquitousLanguage = await getUbiquitousLanguageFromDomain('Payment', '0.0.1');
210
- * ```
211
- */
212
- declare const getUbiquitousLanguageFromDomain: (directory: string) => (id: string, version?: string) => Promise<{
213
- markdown: any;
214
- } | undefined>;
215
- /**
216
- * Check to see if the catalog has a version for the given domain.
217
- *
218
- * @example
219
- * ```ts
220
- * import utils from '@eventcatalog/utils';
221
- *
222
- * const { domainHasVersion } = utils('/path/to/eventcatalog');
223
- *
224
- * // returns true if version is found for the given event and version (supports semver)
225
- * await domainHasVersion('Orders', '0.0.1');
226
- * await domainHasVersion('Orders', 'latest');
227
- * await domainHasVersion('Orders', '0.0.x');*
228
- *
229
- * ```
230
- */
231
- declare const domainHasVersion: (directory: string) => (id: string, version?: string) => Promise<boolean>;
232
- /**
233
- * Add a service to a domain by it's id.
234
- *
235
- * Optionally specify a version to add the service to a specific version of the domain.
236
- *
237
- * @example
238
- * ```ts
239
- * import utils from '@eventcatalog/utils';
240
- *
241
- * // Adds a service to the domain
242
- * const { addServiceToDomain } = utils('/path/to/eventcatalog');
243
- *
244
- * // Adds a service (Orders Service) to the domain (Orders)
245
- * await addServiceToDomain('Orders', { service: 'Order Service', version: '2.0.0' });
246
- * // Adds a service (Orders Service) to the domain (Orders) with a specific version
247
- * await addServiceToDomain('Orders', { service: 'Order Service', version: '2.0.0' }, '1.0.0');
248
- * ```
249
- */
250
- declare const addServiceToDomain: (directory: string) => (id: string, service: {
251
- id: string;
252
- version: string;
253
- }, version?: string) => Promise<void>;
254
- /**
255
- * Add a subdomain to a domain by it's id.
256
- * Optionally specify a version to add the subdomain to a specific version of the domain
257
- *
258
- * @example
259
- * ```ts
260
- * import utils from '@eventcatalog/utils';
261
- *
262
- * // Adds a subdomain to the given domain
263
- * const { addSubDomainToDomain } = utils('/path/to/eventcatalog');
264
- *
265
- * // Adds a subdomain (Payment Domain) to the domain (Orders)
266
- * await addSubDomainToDomain('Orders', { service: 'Payment Domain', version: '2.0.0' });
267
- * // Adds a subdomain (Inventory Domain) to the domain (Orders) with a specific version
268
- * await addSubDomainToDomain('Orders', { service: 'Inventory Domain', version: '2.0.0' }, '1.0.0');
269
- * ```
270
- */
271
- declare const addSubDomainToDomain: (directory: string) => (id: string, subDomain: {
272
- id: string;
273
- version: string;
274
- }, version?: string) => Promise<void>;
275
- /**
276
- * Add an entity to a domain by its id.
277
- * Optionally specify a version to add the entity to a specific version of the domain.
278
- *
279
- * @example
280
- * ```ts
281
- * import utils from '@eventcatalog/utils';
282
- *
283
- * // Adds an entity to the domain
284
- * const { addEntityToDomain } = utils('/path/to/eventcatalog');
285
- *
286
- * // Adds an entity (User) to the domain (Orders)
287
- * await addEntityToDomain('Orders', { id: 'User', version: '1.0.0' });
288
- * // Adds an entity (Product) to the domain (Orders) with a specific version
289
- * await addEntityToDomain('Orders', { id: 'Product', version: '2.0.0' }, '1.0.0');
290
- * ```
291
- */
292
- declare const addEntityToDomain: (directory: string) => (id: string, entity: {
293
- id: string;
294
- version: string;
295
- }, version?: string) => Promise<void>;
296
- /**
297
- * Add a data product to a domain by its id.
298
- * Optionally specify a version to add the data product to a specific version of the domain.
299
- *
300
- * @example
301
- * ```ts
302
- * import utils from '@eventcatalog/utils';
303
- *
304
- * // Adds a data product to the domain
305
- * const { addDataProductToDomain } = utils('/path/to/eventcatalog');
306
- *
307
- * // Adds a data product (CustomerDataProduct) to the domain (Orders)
308
- * await addDataProductToDomain('Orders', { id: 'CustomerDataProduct', version: '1.0.0' });
309
- * // Adds a data product (SalesDataProduct) to the domain (Orders) with a specific version
310
- * await addDataProductToDomain('Orders', { id: 'SalesDataProduct', version: '2.0.0' }, '1.0.0');
311
- * ```
312
- */
313
- declare const addDataProductToDomain: (directory: string) => (id: string, dataProduct: {
314
- id: string;
315
- version: string;
316
- }, version?: string) => Promise<void>;
317
- /**
318
- * Add an event/command/query to a domain by its id.
319
- *
320
- * Optionally specify a version to add the message to a specific version of the domain.
321
- *
322
- * @example
323
- * ```ts
324
- * import utils from '@eventcatalog/utils';
325
- *
326
- * // Adds an event to the domain
327
- * const { addEventToDomain, addCommandToDomain, addQueryToDomain } = utils('/path/to/eventcatalog');
328
- *
329
- * // Adds a new event (OrderCreated) that the Orders domain will send
330
- * await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
331
- *
332
- * // Adds a new event (PaymentProcessed) that the Orders domain will receive
333
- * await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '1.0.0' });
334
- *
335
- * // Adds a new command (ProcessOrder) that the Orders domain will receive
336
- * await addCommandToDomain('Orders', 'receives', { id: 'ProcessOrder', version: '1.0.0' });
337
- *
338
- * // Adds a message to a specific version of the domain
339
- * await addEventToDomain('Orders', 'sends', { id: 'OrderShipped', version: '1.0.0' }, '2.0.0');
340
- * ```
341
- */
342
- declare const addMessageToDomain: (directory: string) => (id: string, direction: string, message: {
343
- id: string;
344
- version: string;
345
- }, version?: string) => Promise<void>;
346
-
347
- export { addDataProductToDomain, addEntityToDomain, addFileToDomain, addMessageToDomain, addServiceToDomain, addSubDomainToDomain, addUbiquitousLanguageToDomain, domainHasVersion, getDomain, getDomains, getUbiquitousLanguageFromDomain, rmDomain, rmDomainById, versionDomain, writeDomain };
package/dist/domains.d.ts DELETED
@@ -1,347 +0,0 @@
1
- import { Domain, UbiquitousLanguageDictionary } from './types.d.js';
2
-
3
- /**
4
- * Returns a domain from EventCatalog.
5
- *
6
- * You can optionally specify a version to get a specific version of the domain
7
- *
8
- * @example
9
- * ```ts
10
- * import utils from '@eventcatalog/utils';
11
- *
12
- * const { getDomain } = utils('/path/to/eventcatalog');
13
- *
14
- * // Gets the latest version of the domain
15
- * const domain = await getDomain('Payment');
16
- *
17
- * // Gets a version of the domain
18
- * const domain = await getDomain('Payment', '0.0.1');
19
- * ```
20
- */
21
- declare const getDomain: (directory: string) => (id: string, version?: string) => Promise<Domain>;
22
- /**
23
- * Returns all domains from EventCatalog.
24
- *
25
- * You can optionally specify if you want to get the latest version of the domains.
26
- *
27
- * @example
28
- * ```ts
29
- * import utils from '@eventcatalog/utils';
30
- *
31
- * const { getDomains } = utils('/path/to/eventcatalog');
32
- *
33
- * // Gets all domains (and versions) from the catalog
34
- * const domains = await getDomains();
35
- *
36
- * // Gets all domains (only latest version) from the catalog
37
- * const domains = await getDomains({ latestOnly: true });
38
- * ```
39
- */
40
- declare const getDomains: (directory: string) => (options?: {
41
- latestOnly?: boolean;
42
- }) => Promise<Domain[]>;
43
- /**
44
- * Write a domain to EventCatalog.
45
- *
46
- * You can optionally overide the path of the domain.
47
- *
48
- * @example
49
- * ```ts
50
- * import utils from '@eventcatalog/utils';
51
- *
52
- * const { writeDomain } = utils('/path/to/eventcatalog');
53
- *
54
- * // Write a domain
55
- * // Domain would be written to domains/Payment
56
- * await writeDomain({
57
- * id: 'Payment',
58
- * name: 'Payment domain',
59
- * version: '0.0.1',
60
- * summary: 'Domain for all things to do with payments',
61
- * markdown: '# Hello world',
62
- * });
63
- *
64
- * // Write a domain to the catalog but override the path
65
- * // Domain would be written to domains/Inventory/Payment
66
- * await writeDomain({
67
- * id: 'Payment',
68
- * name: 'Inventory Adjusted',
69
- * version: '0.0.1',
70
- * summary: 'This is a summary',
71
- * markdown: '# Hello world',
72
- * }, { path: "/Inventory/Payment"});
73
- *
74
- * // Write a domain to the catalog and override the existing content (if there is any)
75
- * await writeDomain({
76
- * id: 'Payment',
77
- * name: 'Inventory Adjusted',
78
- * version: '0.0.1',
79
- * summary: 'This is a summary',
80
- * markdown: '# Hello world',
81
- * }, { override: true });
82
- *
83
- * // Write a domain to the catalog and version the previous version
84
- * // only works if the new version is greater than the previous version
85
- * await writeDomain({
86
- * id: 'Payment',
87
- * name: 'Inventory Adjusted',
88
- * version: '0.0.1',
89
- * summary: 'This is a summary',
90
- * markdown: '# Hello world',
91
- * }, { versionExistingContent: true });
92
- *
93
- * ```
94
- */
95
- declare const writeDomain: (directory: string) => (domain: Domain, options?: {
96
- path?: string;
97
- override?: boolean;
98
- versionExistingContent?: boolean;
99
- format?: "md" | "mdx";
100
- }) => Promise<void>;
101
- /**
102
- * Version a domain by it's id.
103
- *
104
- * Takes the latest domain and moves it to a versioned directory.
105
- * All files with this domain are also versioned. (e.g /domains/Payment/openapi.yml)
106
- *
107
- * @example
108
- * ```ts
109
- * import utils from '@eventcatalog/utils';
110
- *
111
- * const { versionDomain } = utils('/path/to/eventcatalog');
112
- *
113
- * // moves the latest Payment domain to a versioned directory
114
- * // the version within that domain is used as the version number.
115
- * await versionDomain('Payment');
116
- *
117
- * ```
118
- */
119
- declare const versionDomain: (directory: string) => (id: string) => Promise<void>;
120
- /**
121
- * Delete a domain at it's given path.
122
- *
123
- * @example
124
- * ```ts
125
- * import utils from '@eventcatalog/utils';
126
- *
127
- * const { rmDomain } = utils('/path/to/eventcatalog');
128
- *
129
- * // Removes the domain at domains/Payment
130
- * await rmDomain('/Payment');
131
- * ```
132
- */
133
- declare const rmDomain: (directory: string) => (path: string) => Promise<void>;
134
- /**
135
- * Delete a domain by it's id.
136
- *
137
- * Optionally specify a version to delete a specific version of the domain.
138
- *
139
- * @example
140
- * ```ts
141
- * import utils from '@eventcatalog/utils';
142
- *
143
- * const { rmDomainById } = utils('/path/to/eventcatalog');
144
- *
145
- * // deletes the latest Payment event
146
- * await rmDomainById('Payment');
147
- *
148
- * // deletes a specific version of the Payment event
149
- * await rmDomainById('Payment', '0.0.1');
150
- * ```
151
- */
152
- declare const rmDomainById: (directory: string) => (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
153
- /**
154
- * Add a file to a domain by it's id.
155
- *
156
- * Optionally specify a version to add a file to a specific version of the domain.
157
- *
158
- * @example
159
- * ```ts
160
- * import utils from '@eventcatalog/utils';
161
- *
162
- * const { addFileToDomain } = utils('/path/to/eventcatalog');
163
- *
164
- * // adds a file to the latest Payment event
165
- * await addFileToDomain('Payment', { content: 'Hello world', fileName: 'hello.txt' });
166
- *
167
- * // adds a file to a specific version of the Payment event
168
- * await addFileToDomain('Payment', { content: 'Hello world', fileName: 'hello.txt' }, '0.0.1');
169
- *
170
- * ```
171
- */
172
- declare const addFileToDomain: (directory: string) => (id: string, file: {
173
- content: string;
174
- fileName: string;
175
- }, version?: string) => Promise<void>;
176
- /**
177
- * Adds a ubiquitous language dictionary to a domain.
178
- *
179
- * Optionally specify a version to add a ubiquitous language dictionary to a specific version of the domain.
180
- *
181
- * @example
182
- * ```ts
183
- * import utils from '@eventcatalog/utils';
184
- *
185
- * const { addUbiquitousLanguageToDomain } = utils('/path/to/eventcatalog');
186
- *
187
- * // Adds a ubiquitous language dictionary to the latest Payment domain
188
- * await addUbiquitousLanguageToDomain('Payment', { dictionary: [{ id: 'Order', name: 'Order', summary: 'All things to do with the payment systems', description: 'This is a description', icon: 'KeyIcon' }] });
189
- *
190
- * // Adds a ubiquitous language dictionary to a specific version of the domain
191
- * await addUbiquitousLanguageToDomain('Payment', { dictionary: [{ id: 'Order', name: 'Order', summary: 'All things to do with the payment systems', description: 'This is a description', icon: 'KeyIcon' }] }, '0.0.1');
192
- * ```
193
- */
194
- declare const addUbiquitousLanguageToDomain: (directory: string) => (id: string, ubiquitousLanguageDictionary: UbiquitousLanguageDictionary, version?: string) => Promise<void>;
195
- /**
196
- * Returns the ubiquitous language dictionary from a domain.
197
- *
198
- * Optionally specify a version to get the ubiquitous language dictionary from a specific version of the domain.
199
- *
200
- * @example
201
- * ```ts
202
- * import utils from '@eventcatalog/utils';
203
- *
204
- * const { getUbiquitousLanguageFromDomain } = utils('/path/to/eventcatalog');
205
- *
206
- * const ubiquitousLanguage = await getUbiquitousLanguageFromDomain('Payment');
207
- *
208
- * // Returns the ubiquitous language dictionary from a specific version of the domain
209
- * const ubiquitousLanguage = await getUbiquitousLanguageFromDomain('Payment', '0.0.1');
210
- * ```
211
- */
212
- declare const getUbiquitousLanguageFromDomain: (directory: string) => (id: string, version?: string) => Promise<{
213
- markdown: any;
214
- } | undefined>;
215
- /**
216
- * Check to see if the catalog has a version for the given domain.
217
- *
218
- * @example
219
- * ```ts
220
- * import utils from '@eventcatalog/utils';
221
- *
222
- * const { domainHasVersion } = utils('/path/to/eventcatalog');
223
- *
224
- * // returns true if version is found for the given event and version (supports semver)
225
- * await domainHasVersion('Orders', '0.0.1');
226
- * await domainHasVersion('Orders', 'latest');
227
- * await domainHasVersion('Orders', '0.0.x');*
228
- *
229
- * ```
230
- */
231
- declare const domainHasVersion: (directory: string) => (id: string, version?: string) => Promise<boolean>;
232
- /**
233
- * Add a service to a domain by it's id.
234
- *
235
- * Optionally specify a version to add the service to a specific version of the domain.
236
- *
237
- * @example
238
- * ```ts
239
- * import utils from '@eventcatalog/utils';
240
- *
241
- * // Adds a service to the domain
242
- * const { addServiceToDomain } = utils('/path/to/eventcatalog');
243
- *
244
- * // Adds a service (Orders Service) to the domain (Orders)
245
- * await addServiceToDomain('Orders', { service: 'Order Service', version: '2.0.0' });
246
- * // Adds a service (Orders Service) to the domain (Orders) with a specific version
247
- * await addServiceToDomain('Orders', { service: 'Order Service', version: '2.0.0' }, '1.0.0');
248
- * ```
249
- */
250
- declare const addServiceToDomain: (directory: string) => (id: string, service: {
251
- id: string;
252
- version: string;
253
- }, version?: string) => Promise<void>;
254
- /**
255
- * Add a subdomain to a domain by it's id.
256
- * Optionally specify a version to add the subdomain to a specific version of the domain
257
- *
258
- * @example
259
- * ```ts
260
- * import utils from '@eventcatalog/utils';
261
- *
262
- * // Adds a subdomain to the given domain
263
- * const { addSubDomainToDomain } = utils('/path/to/eventcatalog');
264
- *
265
- * // Adds a subdomain (Payment Domain) to the domain (Orders)
266
- * await addSubDomainToDomain('Orders', { service: 'Payment Domain', version: '2.0.0' });
267
- * // Adds a subdomain (Inventory Domain) to the domain (Orders) with a specific version
268
- * await addSubDomainToDomain('Orders', { service: 'Inventory Domain', version: '2.0.0' }, '1.0.0');
269
- * ```
270
- */
271
- declare const addSubDomainToDomain: (directory: string) => (id: string, subDomain: {
272
- id: string;
273
- version: string;
274
- }, version?: string) => Promise<void>;
275
- /**
276
- * Add an entity to a domain by its id.
277
- * Optionally specify a version to add the entity to a specific version of the domain.
278
- *
279
- * @example
280
- * ```ts
281
- * import utils from '@eventcatalog/utils';
282
- *
283
- * // Adds an entity to the domain
284
- * const { addEntityToDomain } = utils('/path/to/eventcatalog');
285
- *
286
- * // Adds an entity (User) to the domain (Orders)
287
- * await addEntityToDomain('Orders', { id: 'User', version: '1.0.0' });
288
- * // Adds an entity (Product) to the domain (Orders) with a specific version
289
- * await addEntityToDomain('Orders', { id: 'Product', version: '2.0.0' }, '1.0.0');
290
- * ```
291
- */
292
- declare const addEntityToDomain: (directory: string) => (id: string, entity: {
293
- id: string;
294
- version: string;
295
- }, version?: string) => Promise<void>;
296
- /**
297
- * Add a data product to a domain by its id.
298
- * Optionally specify a version to add the data product to a specific version of the domain.
299
- *
300
- * @example
301
- * ```ts
302
- * import utils from '@eventcatalog/utils';
303
- *
304
- * // Adds a data product to the domain
305
- * const { addDataProductToDomain } = utils('/path/to/eventcatalog');
306
- *
307
- * // Adds a data product (CustomerDataProduct) to the domain (Orders)
308
- * await addDataProductToDomain('Orders', { id: 'CustomerDataProduct', version: '1.0.0' });
309
- * // Adds a data product (SalesDataProduct) to the domain (Orders) with a specific version
310
- * await addDataProductToDomain('Orders', { id: 'SalesDataProduct', version: '2.0.0' }, '1.0.0');
311
- * ```
312
- */
313
- declare const addDataProductToDomain: (directory: string) => (id: string, dataProduct: {
314
- id: string;
315
- version: string;
316
- }, version?: string) => Promise<void>;
317
- /**
318
- * Add an event/command/query to a domain by its id.
319
- *
320
- * Optionally specify a version to add the message to a specific version of the domain.
321
- *
322
- * @example
323
- * ```ts
324
- * import utils from '@eventcatalog/utils';
325
- *
326
- * // Adds an event to the domain
327
- * const { addEventToDomain, addCommandToDomain, addQueryToDomain } = utils('/path/to/eventcatalog');
328
- *
329
- * // Adds a new event (OrderCreated) that the Orders domain will send
330
- * await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
331
- *
332
- * // Adds a new event (PaymentProcessed) that the Orders domain will receive
333
- * await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '1.0.0' });
334
- *
335
- * // Adds a new command (ProcessOrder) that the Orders domain will receive
336
- * await addCommandToDomain('Orders', 'receives', { id: 'ProcessOrder', version: '1.0.0' });
337
- *
338
- * // Adds a message to a specific version of the domain
339
- * await addEventToDomain('Orders', 'sends', { id: 'OrderShipped', version: '1.0.0' }, '2.0.0');
340
- * ```
341
- */
342
- declare const addMessageToDomain: (directory: string) => (id: string, direction: string, message: {
343
- id: string;
344
- version: string;
345
- }, version?: string) => Promise<void>;
346
-
347
- export { addDataProductToDomain, addEntityToDomain, addFileToDomain, addMessageToDomain, addServiceToDomain, addSubDomainToDomain, addUbiquitousLanguageToDomain, domainHasVersion, getDomain, getDomains, getUbiquitousLanguageFromDomain, rmDomain, rmDomainById, versionDomain, writeDomain };