@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.
- 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} +588 -378
- package/dist/cli/index.js.map +1 -0
- package/dist/{eventcatalog.mjs → cli/index.mjs} +666 -436
- 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 +1614 -0
- package/dist/cli-docs.js.map +1 -0
- package/dist/cli-docs.mjs +1586 -0
- package/dist/cli-docs.mjs.map +1 -0
- package/dist/index.d.mts +443 -25
- package/dist/index.d.ts +443 -25
- package/dist/index.js +204 -121
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -121
- 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-products.d.mts +0 -225
- package/dist/data-products.d.ts +0 -225
- package/dist/data-products.js +0 -375
- package/dist/data-products.js.map +0 -1
- package/dist/data-products.mjs +0 -332
- package/dist/data-products.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 -347
- package/dist/domains.d.ts +0 -347
- package/dist/domains.js +0 -547
- package/dist/domains.js.map +0 -1
- package/dist/domains.mjs +0 -498
- 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 -331
- package/dist/types.d.d.ts +0 -331
- 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/events.d.mts
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { Event } from './types.d.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns an event from EventCatalog.
|
|
5
|
-
*
|
|
6
|
-
* You can optionally specify a version to get a specific version of the event
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import utils from '@eventcatalog/utils';
|
|
11
|
-
*
|
|
12
|
-
* const { getEvent } = utils('/path/to/eventcatalog');
|
|
13
|
-
*
|
|
14
|
-
* // Gets the latest version of the event
|
|
15
|
-
* const event = await getEvent('InventoryAdjusted');
|
|
16
|
-
*
|
|
17
|
-
* // Gets a version of the event
|
|
18
|
-
* const event = await getEvent('InventoryAdjusted', '0.0.1');
|
|
19
|
-
*
|
|
20
|
-
* // Get the event with the schema attached
|
|
21
|
-
* const event = await getEvent('InventoryAdjusted', '0.0.1', { attachSchema: true });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare const getEvent: (directory: string) => (id: string, version?: string, options?: {
|
|
25
|
-
attachSchema?: boolean;
|
|
26
|
-
}) => Promise<Event>;
|
|
27
|
-
/**
|
|
28
|
-
* Returns all events from EventCatalog.
|
|
29
|
-
*
|
|
30
|
-
* You can optionally specify if you want to get the latest version of the events.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* import utils from '@eventcatalog/utils';
|
|
35
|
-
*
|
|
36
|
-
* const { getEvents } = utils('/path/to/eventcatalog');
|
|
37
|
-
*
|
|
38
|
-
* // Gets all events (and versions) from the catalog
|
|
39
|
-
* const events = await getEvents();
|
|
40
|
-
*
|
|
41
|
-
* // Gets all events (only latest version) from the catalog
|
|
42
|
-
* const events = await getEvents({ latestOnly: true });
|
|
43
|
-
*
|
|
44
|
-
* // Get all events with the schema attached
|
|
45
|
-
* const events = await getEvents({ attachSchema: true });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
declare const getEvents: (directory: string) => (options?: {
|
|
49
|
-
latestOnly?: boolean;
|
|
50
|
-
attachSchema?: boolean;
|
|
51
|
-
}) => Promise<Event[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Write an event to EventCatalog.
|
|
54
|
-
*
|
|
55
|
-
* You can optionally overide the path of the event.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* import utils from '@eventcatalog/utils';
|
|
60
|
-
*
|
|
61
|
-
* const { writeEvent } = utils('/path/to/eventcatalog');
|
|
62
|
-
*
|
|
63
|
-
* // Write an event to the catalog
|
|
64
|
-
* // Event would be written to events/InventoryAdjusted
|
|
65
|
-
* await writeEvent({
|
|
66
|
-
* id: 'InventoryAdjusted',
|
|
67
|
-
* name: 'Inventory Adjusted',
|
|
68
|
-
* version: '0.0.1',
|
|
69
|
-
* summary: 'This is a summary',
|
|
70
|
-
* markdown: '# Hello world',
|
|
71
|
-
* });
|
|
72
|
-
*
|
|
73
|
-
* // Write an event to the catalog but override the path
|
|
74
|
-
* // Event would be written to events/Inventory/InventoryAdjusted
|
|
75
|
-
* await writeEvent({
|
|
76
|
-
* id: 'InventoryAdjusted',
|
|
77
|
-
* name: 'Inventory Adjusted',
|
|
78
|
-
* version: '0.0.1',
|
|
79
|
-
* summary: 'This is a summary',
|
|
80
|
-
* markdown: '# Hello world',
|
|
81
|
-
* }, { path: "/Inventory/InventoryAdjusted"});
|
|
82
|
-
*
|
|
83
|
-
* // Write a event to the catalog and override the existing content (if there is any)
|
|
84
|
-
* await writeEvent({
|
|
85
|
-
* id: 'InventoryAdjusted',
|
|
86
|
-
* name: 'Inventory Adjusted',
|
|
87
|
-
* version: '0.0.1',
|
|
88
|
-
* summary: 'This is a summary',
|
|
89
|
-
* markdown: '# Hello world',
|
|
90
|
-
* }, { override: true });
|
|
91
|
-
*
|
|
92
|
-
* // Write a event to the catalog and version the previous version
|
|
93
|
-
* // only works if the new version is greater than the previous version
|
|
94
|
-
* await writeEvent({
|
|
95
|
-
* id: 'InventoryAdjusted',
|
|
96
|
-
* name: 'Inventory Adjusted',
|
|
97
|
-
* version: '0.0.1',
|
|
98
|
-
* summary: 'This is a summary',
|
|
99
|
-
* markdown: '# Hello world',
|
|
100
|
-
* }, { versionExistingContent: true });
|
|
101
|
-
*
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
declare const writeEvent: (directory: string) => (event: Event, options?: {
|
|
105
|
-
path?: string;
|
|
106
|
-
override?: boolean;
|
|
107
|
-
versionExistingContent?: boolean;
|
|
108
|
-
format?: "md" | "mdx";
|
|
109
|
-
}) => Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Write an event to a service in EventCatalog.
|
|
112
|
-
*
|
|
113
|
-
* You can optionally override the path of the event.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```ts
|
|
117
|
-
* import utils from '@eventcatalog/utils';
|
|
118
|
-
*
|
|
119
|
-
* const { writeEventToService } = utils('/path/to/eventcatalog');
|
|
120
|
-
*
|
|
121
|
-
* // Write an event to a given service in the catalog
|
|
122
|
-
* // Event would be written to services/Inventory/events/InventoryAdjusted
|
|
123
|
-
* await writeEventToService({
|
|
124
|
-
* id: 'InventoryAdjusted',
|
|
125
|
-
* name: 'Inventory Adjusted',
|
|
126
|
-
* version: '0.0.1',
|
|
127
|
-
* summary: 'This is a summary',
|
|
128
|
-
* markdown: '# Hello world',
|
|
129
|
-
* }, { id: 'Inventory' });
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
declare const writeEventToService: (directory: string) => (event: Event, service: {
|
|
133
|
-
id: string;
|
|
134
|
-
version?: string;
|
|
135
|
-
}, options?: {
|
|
136
|
-
path?: string;
|
|
137
|
-
format?: "md" | "mdx";
|
|
138
|
-
override?: boolean;
|
|
139
|
-
}) => Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* Delete an event at it's given path.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* import utils from '@eventcatalog/utils';
|
|
146
|
-
*
|
|
147
|
-
* const { rmEvent } = utils('/path/to/eventcatalog');
|
|
148
|
-
*
|
|
149
|
-
* // removes an event at the given path (events dir is appended to the given path)
|
|
150
|
-
* // Removes the event at events/InventoryAdjusted
|
|
151
|
-
* await rmEvent('/InventoryAdjusted');
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
declare const rmEvent: (directory: string) => (path: string) => Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
* Delete an event by it's id.
|
|
157
|
-
*
|
|
158
|
-
* Optionally specify a version to delete a specific version of the event.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```ts
|
|
162
|
-
* import utils from '@eventcatalog/utils';
|
|
163
|
-
*
|
|
164
|
-
* const { rmEventById } = utils('/path/to/eventcatalog');
|
|
165
|
-
*
|
|
166
|
-
* // deletes the latest InventoryAdjusted event
|
|
167
|
-
* await rmEventById('InventoryAdjusted');
|
|
168
|
-
*
|
|
169
|
-
* // deletes a specific version of the InventoryAdjusted event
|
|
170
|
-
* await rmEventById('InventoryAdjusted', '0.0.1');
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
declare const rmEventById: (directory: string) => (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* Version an event by it's id.
|
|
176
|
-
*
|
|
177
|
-
* Takes the latest event and moves it to a versioned directory.
|
|
178
|
-
* All files with this event are also versioned (e.g /events/InventoryAdjusted/schema.json)
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```ts
|
|
182
|
-
* import utils from '@eventcatalog/utils';
|
|
183
|
-
*
|
|
184
|
-
* const { versionEvent } = utils('/path/to/eventcatalog');
|
|
185
|
-
*
|
|
186
|
-
* // moves the latest InventoryAdjusted event to a versioned directory
|
|
187
|
-
* // the version within that event is used as the version number.
|
|
188
|
-
* await versionEvent('InventoryAdjusted');
|
|
189
|
-
*
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
declare const versionEvent: (directory: string) => (id: string) => Promise<void>;
|
|
193
|
-
/**
|
|
194
|
-
* Add a file to an event by it's id.
|
|
195
|
-
*
|
|
196
|
-
* Optionally specify a version to add a file to a specific version of the event.
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```ts
|
|
200
|
-
* import utils from '@eventcatalog/utils';
|
|
201
|
-
*
|
|
202
|
-
* const { addFileToEvent } = utils('/path/to/eventcatalog');
|
|
203
|
-
*
|
|
204
|
-
* // adds a file to the latest InventoryAdjusted event
|
|
205
|
-
* await addFileToEvent('InventoryAdjusted', { content: 'Hello world', fileName: 'hello.txt' });
|
|
206
|
-
*
|
|
207
|
-
* // adds a file to a specific version of the InventoryAdjusted event
|
|
208
|
-
* await addFileToEvent('InventoryAdjusted', { content: 'Hello world', fileName: 'hello.txt' }, '0.0.1');
|
|
209
|
-
*
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
declare const addFileToEvent: (directory: string) => (id: string, file: {
|
|
213
|
-
content: string;
|
|
214
|
-
fileName: string;
|
|
215
|
-
}, version?: string, options?: {
|
|
216
|
-
path?: string;
|
|
217
|
-
}) => Promise<void>;
|
|
218
|
-
/**
|
|
219
|
-
* Add a schema to an event by it's id.
|
|
220
|
-
*
|
|
221
|
-
* Optionally specify a version to add a schema to a specific version of the event.
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
* ```ts
|
|
225
|
-
* import utils from '@eventcatalog/utils';
|
|
226
|
-
*
|
|
227
|
-
* const { addFileToEvent } = utils('/path/to/eventcatalog');
|
|
228
|
-
*
|
|
229
|
-
* // JSON schema example
|
|
230
|
-
* const schema = {
|
|
231
|
-
* "$schema": "http://json-schema.org/draft-07/schema#",
|
|
232
|
-
* "type": "object",
|
|
233
|
-
* "properties": {
|
|
234
|
-
* "name": {
|
|
235
|
-
* "type": "string"
|
|
236
|
-
* },
|
|
237
|
-
* "age": {
|
|
238
|
-
* "type": "number"
|
|
239
|
-
* }
|
|
240
|
-
* },
|
|
241
|
-
* "required": ["name", "age"]
|
|
242
|
-
* };
|
|
243
|
-
*
|
|
244
|
-
* // adds a file to the latest InventoryAdjusted event
|
|
245
|
-
* await addFileToEvent('InventoryAdjusted', { schema, fileName: 'schema.json' });
|
|
246
|
-
*
|
|
247
|
-
* // adds a file to a specific version of the InventoryAdjusted event
|
|
248
|
-
* await addFileToEvent('InventoryAdjusted', { schema, fileName: 'schema.json' }, '0.0.1');
|
|
249
|
-
*
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
declare const addSchemaToEvent: (directory: string) => (id: string, schema: {
|
|
253
|
-
schema: string;
|
|
254
|
-
fileName: string;
|
|
255
|
-
}, version?: string, options?: {
|
|
256
|
-
path?: string;
|
|
257
|
-
}) => Promise<void>;
|
|
258
|
-
/**
|
|
259
|
-
* Check to see if the catalog has a version for the given event.
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* ```ts
|
|
263
|
-
* import utils from '@eventcatalog/utils';
|
|
264
|
-
*
|
|
265
|
-
* const { eventHasVersion } = utils('/path/to/eventcatalog');
|
|
266
|
-
*
|
|
267
|
-
* // returns true if version is found for the given event and version (supports semver)
|
|
268
|
-
* await eventHasVersion('InventoryAdjusted', '0.0.1');
|
|
269
|
-
* await eventHasVersion('InventoryAdjusted', 'latest');
|
|
270
|
-
* await eventHasVersion('InventoryAdjusted', '0.0.x');*
|
|
271
|
-
*
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
declare const eventHasVersion: (directory: string) => (id: string, version?: string) => Promise<boolean>;
|
|
275
|
-
|
|
276
|
-
export { addFileToEvent, addSchemaToEvent, eventHasVersion, getEvent, getEvents, rmEvent, rmEventById, versionEvent, writeEvent, writeEventToService };
|
package/dist/events.d.ts
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { Event } from './types.d.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns an event from EventCatalog.
|
|
5
|
-
*
|
|
6
|
-
* You can optionally specify a version to get a specific version of the event
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import utils from '@eventcatalog/utils';
|
|
11
|
-
*
|
|
12
|
-
* const { getEvent } = utils('/path/to/eventcatalog');
|
|
13
|
-
*
|
|
14
|
-
* // Gets the latest version of the event
|
|
15
|
-
* const event = await getEvent('InventoryAdjusted');
|
|
16
|
-
*
|
|
17
|
-
* // Gets a version of the event
|
|
18
|
-
* const event = await getEvent('InventoryAdjusted', '0.0.1');
|
|
19
|
-
*
|
|
20
|
-
* // Get the event with the schema attached
|
|
21
|
-
* const event = await getEvent('InventoryAdjusted', '0.0.1', { attachSchema: true });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare const getEvent: (directory: string) => (id: string, version?: string, options?: {
|
|
25
|
-
attachSchema?: boolean;
|
|
26
|
-
}) => Promise<Event>;
|
|
27
|
-
/**
|
|
28
|
-
* Returns all events from EventCatalog.
|
|
29
|
-
*
|
|
30
|
-
* You can optionally specify if you want to get the latest version of the events.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* import utils from '@eventcatalog/utils';
|
|
35
|
-
*
|
|
36
|
-
* const { getEvents } = utils('/path/to/eventcatalog');
|
|
37
|
-
*
|
|
38
|
-
* // Gets all events (and versions) from the catalog
|
|
39
|
-
* const events = await getEvents();
|
|
40
|
-
*
|
|
41
|
-
* // Gets all events (only latest version) from the catalog
|
|
42
|
-
* const events = await getEvents({ latestOnly: true });
|
|
43
|
-
*
|
|
44
|
-
* // Get all events with the schema attached
|
|
45
|
-
* const events = await getEvents({ attachSchema: true });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
declare const getEvents: (directory: string) => (options?: {
|
|
49
|
-
latestOnly?: boolean;
|
|
50
|
-
attachSchema?: boolean;
|
|
51
|
-
}) => Promise<Event[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Write an event to EventCatalog.
|
|
54
|
-
*
|
|
55
|
-
* You can optionally overide the path of the event.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* import utils from '@eventcatalog/utils';
|
|
60
|
-
*
|
|
61
|
-
* const { writeEvent } = utils('/path/to/eventcatalog');
|
|
62
|
-
*
|
|
63
|
-
* // Write an event to the catalog
|
|
64
|
-
* // Event would be written to events/InventoryAdjusted
|
|
65
|
-
* await writeEvent({
|
|
66
|
-
* id: 'InventoryAdjusted',
|
|
67
|
-
* name: 'Inventory Adjusted',
|
|
68
|
-
* version: '0.0.1',
|
|
69
|
-
* summary: 'This is a summary',
|
|
70
|
-
* markdown: '# Hello world',
|
|
71
|
-
* });
|
|
72
|
-
*
|
|
73
|
-
* // Write an event to the catalog but override the path
|
|
74
|
-
* // Event would be written to events/Inventory/InventoryAdjusted
|
|
75
|
-
* await writeEvent({
|
|
76
|
-
* id: 'InventoryAdjusted',
|
|
77
|
-
* name: 'Inventory Adjusted',
|
|
78
|
-
* version: '0.0.1',
|
|
79
|
-
* summary: 'This is a summary',
|
|
80
|
-
* markdown: '# Hello world',
|
|
81
|
-
* }, { path: "/Inventory/InventoryAdjusted"});
|
|
82
|
-
*
|
|
83
|
-
* // Write a event to the catalog and override the existing content (if there is any)
|
|
84
|
-
* await writeEvent({
|
|
85
|
-
* id: 'InventoryAdjusted',
|
|
86
|
-
* name: 'Inventory Adjusted',
|
|
87
|
-
* version: '0.0.1',
|
|
88
|
-
* summary: 'This is a summary',
|
|
89
|
-
* markdown: '# Hello world',
|
|
90
|
-
* }, { override: true });
|
|
91
|
-
*
|
|
92
|
-
* // Write a event to the catalog and version the previous version
|
|
93
|
-
* // only works if the new version is greater than the previous version
|
|
94
|
-
* await writeEvent({
|
|
95
|
-
* id: 'InventoryAdjusted',
|
|
96
|
-
* name: 'Inventory Adjusted',
|
|
97
|
-
* version: '0.0.1',
|
|
98
|
-
* summary: 'This is a summary',
|
|
99
|
-
* markdown: '# Hello world',
|
|
100
|
-
* }, { versionExistingContent: true });
|
|
101
|
-
*
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
declare const writeEvent: (directory: string) => (event: Event, options?: {
|
|
105
|
-
path?: string;
|
|
106
|
-
override?: boolean;
|
|
107
|
-
versionExistingContent?: boolean;
|
|
108
|
-
format?: "md" | "mdx";
|
|
109
|
-
}) => Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Write an event to a service in EventCatalog.
|
|
112
|
-
*
|
|
113
|
-
* You can optionally override the path of the event.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```ts
|
|
117
|
-
* import utils from '@eventcatalog/utils';
|
|
118
|
-
*
|
|
119
|
-
* const { writeEventToService } = utils('/path/to/eventcatalog');
|
|
120
|
-
*
|
|
121
|
-
* // Write an event to a given service in the catalog
|
|
122
|
-
* // Event would be written to services/Inventory/events/InventoryAdjusted
|
|
123
|
-
* await writeEventToService({
|
|
124
|
-
* id: 'InventoryAdjusted',
|
|
125
|
-
* name: 'Inventory Adjusted',
|
|
126
|
-
* version: '0.0.1',
|
|
127
|
-
* summary: 'This is a summary',
|
|
128
|
-
* markdown: '# Hello world',
|
|
129
|
-
* }, { id: 'Inventory' });
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
declare const writeEventToService: (directory: string) => (event: Event, service: {
|
|
133
|
-
id: string;
|
|
134
|
-
version?: string;
|
|
135
|
-
}, options?: {
|
|
136
|
-
path?: string;
|
|
137
|
-
format?: "md" | "mdx";
|
|
138
|
-
override?: boolean;
|
|
139
|
-
}) => Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* Delete an event at it's given path.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* import utils from '@eventcatalog/utils';
|
|
146
|
-
*
|
|
147
|
-
* const { rmEvent } = utils('/path/to/eventcatalog');
|
|
148
|
-
*
|
|
149
|
-
* // removes an event at the given path (events dir is appended to the given path)
|
|
150
|
-
* // Removes the event at events/InventoryAdjusted
|
|
151
|
-
* await rmEvent('/InventoryAdjusted');
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
declare const rmEvent: (directory: string) => (path: string) => Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
* Delete an event by it's id.
|
|
157
|
-
*
|
|
158
|
-
* Optionally specify a version to delete a specific version of the event.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```ts
|
|
162
|
-
* import utils from '@eventcatalog/utils';
|
|
163
|
-
*
|
|
164
|
-
* const { rmEventById } = utils('/path/to/eventcatalog');
|
|
165
|
-
*
|
|
166
|
-
* // deletes the latest InventoryAdjusted event
|
|
167
|
-
* await rmEventById('InventoryAdjusted');
|
|
168
|
-
*
|
|
169
|
-
* // deletes a specific version of the InventoryAdjusted event
|
|
170
|
-
* await rmEventById('InventoryAdjusted', '0.0.1');
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
declare const rmEventById: (directory: string) => (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* Version an event by it's id.
|
|
176
|
-
*
|
|
177
|
-
* Takes the latest event and moves it to a versioned directory.
|
|
178
|
-
* All files with this event are also versioned (e.g /events/InventoryAdjusted/schema.json)
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```ts
|
|
182
|
-
* import utils from '@eventcatalog/utils';
|
|
183
|
-
*
|
|
184
|
-
* const { versionEvent } = utils('/path/to/eventcatalog');
|
|
185
|
-
*
|
|
186
|
-
* // moves the latest InventoryAdjusted event to a versioned directory
|
|
187
|
-
* // the version within that event is used as the version number.
|
|
188
|
-
* await versionEvent('InventoryAdjusted');
|
|
189
|
-
*
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
declare const versionEvent: (directory: string) => (id: string) => Promise<void>;
|
|
193
|
-
/**
|
|
194
|
-
* Add a file to an event by it's id.
|
|
195
|
-
*
|
|
196
|
-
* Optionally specify a version to add a file to a specific version of the event.
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```ts
|
|
200
|
-
* import utils from '@eventcatalog/utils';
|
|
201
|
-
*
|
|
202
|
-
* const { addFileToEvent } = utils('/path/to/eventcatalog');
|
|
203
|
-
*
|
|
204
|
-
* // adds a file to the latest InventoryAdjusted event
|
|
205
|
-
* await addFileToEvent('InventoryAdjusted', { content: 'Hello world', fileName: 'hello.txt' });
|
|
206
|
-
*
|
|
207
|
-
* // adds a file to a specific version of the InventoryAdjusted event
|
|
208
|
-
* await addFileToEvent('InventoryAdjusted', { content: 'Hello world', fileName: 'hello.txt' }, '0.0.1');
|
|
209
|
-
*
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
declare const addFileToEvent: (directory: string) => (id: string, file: {
|
|
213
|
-
content: string;
|
|
214
|
-
fileName: string;
|
|
215
|
-
}, version?: string, options?: {
|
|
216
|
-
path?: string;
|
|
217
|
-
}) => Promise<void>;
|
|
218
|
-
/**
|
|
219
|
-
* Add a schema to an event by it's id.
|
|
220
|
-
*
|
|
221
|
-
* Optionally specify a version to add a schema to a specific version of the event.
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
* ```ts
|
|
225
|
-
* import utils from '@eventcatalog/utils';
|
|
226
|
-
*
|
|
227
|
-
* const { addFileToEvent } = utils('/path/to/eventcatalog');
|
|
228
|
-
*
|
|
229
|
-
* // JSON schema example
|
|
230
|
-
* const schema = {
|
|
231
|
-
* "$schema": "http://json-schema.org/draft-07/schema#",
|
|
232
|
-
* "type": "object",
|
|
233
|
-
* "properties": {
|
|
234
|
-
* "name": {
|
|
235
|
-
* "type": "string"
|
|
236
|
-
* },
|
|
237
|
-
* "age": {
|
|
238
|
-
* "type": "number"
|
|
239
|
-
* }
|
|
240
|
-
* },
|
|
241
|
-
* "required": ["name", "age"]
|
|
242
|
-
* };
|
|
243
|
-
*
|
|
244
|
-
* // adds a file to the latest InventoryAdjusted event
|
|
245
|
-
* await addFileToEvent('InventoryAdjusted', { schema, fileName: 'schema.json' });
|
|
246
|
-
*
|
|
247
|
-
* // adds a file to a specific version of the InventoryAdjusted event
|
|
248
|
-
* await addFileToEvent('InventoryAdjusted', { schema, fileName: 'schema.json' }, '0.0.1');
|
|
249
|
-
*
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
declare const addSchemaToEvent: (directory: string) => (id: string, schema: {
|
|
253
|
-
schema: string;
|
|
254
|
-
fileName: string;
|
|
255
|
-
}, version?: string, options?: {
|
|
256
|
-
path?: string;
|
|
257
|
-
}) => Promise<void>;
|
|
258
|
-
/**
|
|
259
|
-
* Check to see if the catalog has a version for the given event.
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* ```ts
|
|
263
|
-
* import utils from '@eventcatalog/utils';
|
|
264
|
-
*
|
|
265
|
-
* const { eventHasVersion } = utils('/path/to/eventcatalog');
|
|
266
|
-
*
|
|
267
|
-
* // returns true if version is found for the given event and version (supports semver)
|
|
268
|
-
* await eventHasVersion('InventoryAdjusted', '0.0.1');
|
|
269
|
-
* await eventHasVersion('InventoryAdjusted', 'latest');
|
|
270
|
-
* await eventHasVersion('InventoryAdjusted', '0.0.x');*
|
|
271
|
-
*
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
declare const eventHasVersion: (directory: string) => (id: string, version?: string) => Promise<boolean>;
|
|
275
|
-
|
|
276
|
-
export { addFileToEvent, addSchemaToEvent, eventHasVersion, getEvent, getEvents, rmEvent, rmEventById, versionEvent, writeEvent, writeEventToService };
|