@eventcatalog/sdk 2.10.0 → 2.12.0
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/README.md +86 -1
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/{eventcatalog.js → cli/index.js} +691 -347
- package/dist/cli/index.js.map +1 -0
- package/dist/{eventcatalog.mjs → cli/index.mjs} +765 -401
- package/dist/cli/index.mjs.map +1 -0
- package/dist/cli-docs.d.mts +43 -0
- package/dist/cli-docs.d.ts +43 -0
- package/dist/cli-docs.js +1513 -0
- package/dist/cli-docs.js.map +1 -0
- package/dist/cli-docs.mjs +1485 -0
- package/dist/cli-docs.mjs.map +1 -0
- package/dist/index.d.mts +504 -4
- package/dist/index.d.ts +504 -4
- package/dist/index.js +325 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -4
- package/dist/channels.d.mts +0 -214
- package/dist/channels.d.ts +0 -214
- package/dist/channels.js +0 -432
- package/dist/channels.js.map +0 -1
- package/dist/channels.mjs +0 -384
- package/dist/channels.mjs.map +0 -1
- package/dist/commands.d.mts +0 -274
- package/dist/commands.d.ts +0 -274
- package/dist/commands.js +0 -394
- package/dist/commands.js.map +0 -1
- package/dist/commands.mjs +0 -350
- package/dist/commands.mjs.map +0 -1
- package/dist/containers.d.mts +0 -179
- package/dist/containers.d.ts +0 -179
- package/dist/containers.js +0 -388
- package/dist/containers.js.map +0 -1
- package/dist/containers.mjs +0 -345
- package/dist/containers.mjs.map +0 -1
- package/dist/custom-docs.d.mts +0 -89
- package/dist/custom-docs.d.ts +0 -89
- package/dist/custom-docs.js +0 -164
- package/dist/custom-docs.js.map +0 -1
- package/dist/custom-docs.mjs +0 -122
- package/dist/custom-docs.mjs.map +0 -1
- package/dist/data-stores.d.mts +0 -179
- package/dist/data-stores.d.ts +0 -179
- package/dist/data-stores.js +0 -401
- package/dist/data-stores.js.map +0 -1
- package/dist/data-stores.mjs +0 -356
- package/dist/data-stores.mjs.map +0 -1
- package/dist/domains.d.mts +0 -297
- package/dist/domains.d.ts +0 -297
- package/dist/domains.js +0 -480
- package/dist/domains.js.map +0 -1
- package/dist/domains.mjs +0 -433
- package/dist/domains.mjs.map +0 -1
- package/dist/entities.d.mts +0 -174
- package/dist/entities.d.ts +0 -174
- package/dist/entities.js +0 -348
- package/dist/entities.js.map +0 -1
- package/dist/entities.mjs +0 -307
- package/dist/entities.mjs.map +0 -1
- package/dist/eventcatalog.d.mts +0 -21
- package/dist/eventcatalog.d.ts +0 -21
- package/dist/eventcatalog.js.map +0 -1
- package/dist/eventcatalog.mjs.map +0 -1
- package/dist/events.d.mts +0 -276
- package/dist/events.d.ts +0 -276
- package/dist/events.js +0 -393
- package/dist/events.js.map +0 -1
- package/dist/events.mjs +0 -349
- package/dist/events.mjs.map +0 -1
- package/dist/messages.d.mts +0 -65
- package/dist/messages.d.ts +0 -65
- package/dist/messages.js +0 -312
- package/dist/messages.js.map +0 -1
- package/dist/messages.mjs +0 -269
- package/dist/messages.mjs.map +0 -1
- package/dist/queries.d.mts +0 -276
- package/dist/queries.d.ts +0 -276
- package/dist/queries.js +0 -394
- package/dist/queries.js.map +0 -1
- package/dist/queries.mjs +0 -350
- package/dist/queries.mjs.map +0 -1
- package/dist/services.d.mts +0 -384
- package/dist/services.d.ts +0 -384
- package/dist/services.js +0 -577
- package/dist/services.js.map +0 -1
- package/dist/services.mjs +0 -526
- package/dist/services.mjs.map +0 -1
- package/dist/teams.d.mts +0 -90
- package/dist/teams.d.ts +0 -90
- package/dist/teams.js +0 -246
- package/dist/teams.js.map +0 -1
- package/dist/teams.mjs +0 -202
- package/dist/teams.mjs.map +0 -1
- package/dist/types.d.d.mts +0 -304
- package/dist/types.d.d.ts +0 -304
- package/dist/types.d.js +0 -19
- package/dist/types.d.js.map +0 -1
- package/dist/types.d.mjs +0 -1
- package/dist/types.d.mjs.map +0 -1
- package/dist/users.d.mts +0 -83
- package/dist/users.d.ts +0 -83
- package/dist/users.js +0 -127
- package/dist/users.js.map +0 -1
- package/dist/users.mjs +0 -88
- package/dist/users.mjs.map +0 -1
package/dist/domains.d.mts
DELETED
|
@@ -1,297 +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
|
-
export { addEntityToDomain, addFileToDomain, addServiceToDomain, addSubDomainToDomain, addUbiquitousLanguageToDomain, domainHasVersion, getDomain, getDomains, getUbiquitousLanguageFromDomain, rmDomain, rmDomainById, versionDomain, writeDomain };
|
package/dist/domains.d.ts
DELETED
|
@@ -1,297 +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
|
-
export { addEntityToDomain, addFileToDomain, addServiceToDomain, addSubDomainToDomain, addUbiquitousLanguageToDomain, domainHasVersion, getDomain, getDomains, getUbiquitousLanguageFromDomain, rmDomain, rmDomainById, versionDomain, writeDomain };
|