@eventcatalog/sdk 2.11.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} +505 -378
- package/dist/cli/index.js.map +1 -0
- package/dist/{eventcatalog.mjs → cli/index.mjs} +583 -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 +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 +330 -3
- package/dist/index.d.ts +330 -3
- 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/index.d.ts
CHANGED
|
@@ -1,5 +1,332 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
type DataProductOutputPointer = {
|
|
266
|
+
id: string;
|
|
267
|
+
version?: string;
|
|
268
|
+
contract?: {
|
|
269
|
+
path: string;
|
|
270
|
+
name: string;
|
|
271
|
+
type?: string;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
interface DataProduct extends BaseSchema {
|
|
276
|
+
inputs?: ResourcePointer[];
|
|
277
|
+
outputs?: DataProductOutputPointer[];
|
|
278
|
+
detailsPanel?: {
|
|
279
|
+
domains?: DetailPanelProperty;
|
|
280
|
+
inputs?: DetailPanelProperty;
|
|
281
|
+
outputs?: DetailPanelProperty;
|
|
282
|
+
versions?: DetailPanelProperty;
|
|
283
|
+
repository?: DetailPanelProperty;
|
|
284
|
+
owners?: DetailPanelProperty;
|
|
285
|
+
changelog?: DetailPanelProperty;
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare enum DataClassification {
|
|
290
|
+
Public = 'public',
|
|
291
|
+
Internal = 'internal',
|
|
292
|
+
Confidential = 'confidential',
|
|
293
|
+
Regulated = 'regulated',
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
interface Container extends BaseSchema {
|
|
297
|
+
container_type: 'database' | 'cache' | 'objectStore' | 'searchIndex' | 'dataWarehouse' | 'dataLake' | 'externalSaaS' | 'other';
|
|
298
|
+
technology?: string;
|
|
299
|
+
authoritative?: boolean;
|
|
300
|
+
access_mode?: string;
|
|
301
|
+
classification?: DataClassification;
|
|
302
|
+
residency?: string;
|
|
303
|
+
retention?: string;
|
|
304
|
+
detailsPanel?: {
|
|
305
|
+
versions?: DetailPanelProperty;
|
|
306
|
+
repository?: DetailPanelProperty;
|
|
307
|
+
owners?: DetailPanelProperty;
|
|
308
|
+
changelog?: DetailPanelProperty;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
type EventCatalog = {
|
|
313
|
+
version: string;
|
|
314
|
+
catalogVersion: string;
|
|
315
|
+
createdAt: string;
|
|
316
|
+
resources: {
|
|
317
|
+
domains?: ExportedResource<Domain>[];
|
|
318
|
+
services?: ExportedResource<Service>[];
|
|
319
|
+
messages?: {
|
|
320
|
+
events?: ExportedResource<Event>[];
|
|
321
|
+
queries?: ExportedResource<Query>[];
|
|
322
|
+
commands?: ExportedResource<Command>[];
|
|
323
|
+
};
|
|
324
|
+
teams?: ExportedResource<Team>[];
|
|
325
|
+
users?: ExportedResource<User>[];
|
|
326
|
+
channels?: ExportedResource<Channel>[];
|
|
327
|
+
customDocs?: ExportedResource<CustomDoc>[];
|
|
328
|
+
};
|
|
329
|
+
};
|
|
3
330
|
|
|
4
331
|
/**
|
|
5
332
|
* Init the SDK for EventCatalog
|
|
@@ -1293,4 +1620,4 @@ declare const _default: (path: string) => {
|
|
|
1293
1620
|
}, version?: string) => Promise<void>;
|
|
1294
1621
|
};
|
|
1295
1622
|
|
|
1296
|
-
export { Channel, Command, Container, CustomDoc, DataProduct, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
|
|
1623
|
+
export { type Badge, type BaseSchema, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, 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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventcatalog/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "SDK to integrate with EventCatalog",
|
|
5
|
+
"bin": {
|
|
6
|
+
"eventcatalog": "./dist/cli/index.js"
|
|
7
|
+
},
|
|
5
8
|
"publishConfig": {
|
|
6
9
|
"access": "public"
|
|
7
10
|
},
|
|
@@ -24,12 +27,17 @@
|
|
|
24
27
|
],
|
|
25
28
|
"exports": {
|
|
26
29
|
".": {
|
|
27
|
-
"require": "./dist/index.js",
|
|
28
|
-
"import": "./dist/index.mjs",
|
|
29
30
|
"types": [
|
|
30
31
|
"./dist/index.d.ts",
|
|
31
32
|
"./dist/events.t.ts"
|
|
32
|
-
]
|
|
33
|
+
],
|
|
34
|
+
"require": "./dist/index.js",
|
|
35
|
+
"import": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./cli-docs": {
|
|
38
|
+
"types": "./dist/cli-docs.d.ts",
|
|
39
|
+
"require": "./dist/cli-docs.js",
|
|
40
|
+
"import": "./dist/cli-docs.mjs"
|
|
33
41
|
}
|
|
34
42
|
},
|
|
35
43
|
"main": "./dist/index.js",
|
|
@@ -37,6 +45,7 @@
|
|
|
37
45
|
"types": "./dist/index.d.ts",
|
|
38
46
|
"dependencies": {
|
|
39
47
|
"@changesets/cli": "^2.29.8",
|
|
48
|
+
"commander": "^12.0.0",
|
|
40
49
|
"fs-extra": "^11.3.2",
|
|
41
50
|
"glob": "^11.1.0",
|
|
42
51
|
"gray-matter": "^4.0.3",
|
package/dist/channels.d.mts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { Channel } from './types.d.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a channel from EventCatalog.
|
|
5
|
-
*
|
|
6
|
-
* You can optionally specify a version to get a specific version of the channel
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import utils from '@eventcatalog/utils';
|
|
11
|
-
*
|
|
12
|
-
* const { getChannel } = utils('/path/to/eventcatalog');
|
|
13
|
-
*
|
|
14
|
-
* // Gets the latest version of the channel
|
|
15
|
-
* const channel = await getChannel('InventoryChannel');
|
|
16
|
-
*
|
|
17
|
-
* // Gets a version of the channel
|
|
18
|
-
* const channel = await getChannel('InventoryChannel', '0.0.1');
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
declare const getChannel: (directory: string) => (id: string, version?: string) => Promise<Channel>;
|
|
22
|
-
/**
|
|
23
|
-
* Returns all channels from EventCatalog.
|
|
24
|
-
*
|
|
25
|
-
* You can optionally specify if you want to get the latest version of the channels.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import utils from '@eventcatalog/utils';
|
|
30
|
-
*
|
|
31
|
-
* const { getChannels } = utils('/path/to/eventcatalog');
|
|
32
|
-
*
|
|
33
|
-
* // Gets all channels (and versions) from the catalog
|
|
34
|
-
* const channels = await getChannels();
|
|
35
|
-
*
|
|
36
|
-
* // Gets all channels (only latest version) from the catalog
|
|
37
|
-
* const channels = await getChannels({ latestOnly: true });
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
declare const getChannels: (directory: string) => (options?: {
|
|
41
|
-
latestOnly?: boolean;
|
|
42
|
-
}) => Promise<Channel[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Write a channel to EventCatalog.
|
|
45
|
-
*
|
|
46
|
-
* You can optionally override the path of the channel.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* import utils from '@eventcatalog/utils';
|
|
51
|
-
*
|
|
52
|
-
* const { writeChannel } = utils('/path/to/eventcatalog');
|
|
53
|
-
*
|
|
54
|
-
* // Write a channel to the catalog
|
|
55
|
-
* // channel would be written to channels/inventory.{env}.events
|
|
56
|
-
* await writeChannel({
|
|
57
|
-
* id: 'inventory.{env}.events',
|
|
58
|
-
* name: 'Inventory channel',
|
|
59
|
-
* version: '0.0.1',
|
|
60
|
-
* summary: 'This is a summary',
|
|
61
|
-
* markdown: '# Hello world',
|
|
62
|
-
* address: inventory.{env}.events,
|
|
63
|
-
* protocols: ['http'],
|
|
64
|
-
* });
|
|
65
|
-
*
|
|
66
|
-
* // Write a channel to the catalog but override the path
|
|
67
|
-
* // channel would be written to channels/Inventory/InventoryChannel
|
|
68
|
-
* await writeChannel({
|
|
69
|
-
* id: 'InventoryChannel',
|
|
70
|
-
* name: 'Update Inventory',
|
|
71
|
-
* version: '0.0.1',
|
|
72
|
-
* summary: 'This is a summary',
|
|
73
|
-
* markdown: '# Hello world',
|
|
74
|
-
* address: inventory.{env}.events,
|
|
75
|
-
* protocols: ['http'],
|
|
76
|
-
* }, { path: "/channels/Inventory/InventoryChannel"});
|
|
77
|
-
*
|
|
78
|
-
* // Write a channel to the catalog and override the existing content (if there is any)
|
|
79
|
-
* await writeChannel({
|
|
80
|
-
* id: 'InventoryChannel',
|
|
81
|
-
* name: 'Update Inventory',
|
|
82
|
-
* version: '0.0.1',
|
|
83
|
-
* summary: 'This is a summary',
|
|
84
|
-
* markdown: '# Hello world',
|
|
85
|
-
* address: inventory.{env}.events,
|
|
86
|
-
* protocols: ['http'],
|
|
87
|
-
* }, { override: true });
|
|
88
|
-
*
|
|
89
|
-
* // Write a channel to the catalog and version the previous version
|
|
90
|
-
* // only works if the new version is greater than the previous version
|
|
91
|
-
* await writeChannel({
|
|
92
|
-
* id: 'InventoryChannel',
|
|
93
|
-
* name: 'Update Inventory',
|
|
94
|
-
* version: '0.0.1',
|
|
95
|
-
* summary: 'This is a summary',
|
|
96
|
-
* markdown: '# Hello world',
|
|
97
|
-
* address: inventory.{env}.events,
|
|
98
|
-
* protocols: ['http'],
|
|
99
|
-
* }, { versionExistingContent: true });
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
declare const writeChannel: (directory: string) => (channel: Channel, options?: {
|
|
103
|
-
path?: string;
|
|
104
|
-
override?: boolean;
|
|
105
|
-
versionExistingContent?: boolean;
|
|
106
|
-
format?: "md" | "mdx";
|
|
107
|
-
}) => Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* Delete a channel at it's given path.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```ts
|
|
113
|
-
* import utils from '@eventcatalog/utils';
|
|
114
|
-
*
|
|
115
|
-
* const { rmChannel } = utils('/path/to/eventcatalog');
|
|
116
|
-
*
|
|
117
|
-
* // removes a channel at the given path (channels dir is appended to the given path)
|
|
118
|
-
* // Removes the channel at channels/InventoryChannel
|
|
119
|
-
* await rmChannel('/InventoryChannel');
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
declare const rmChannel: (directory: string) => (path: string) => Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Delete a channel by it's id.
|
|
125
|
-
*
|
|
126
|
-
* Optionally specify a version to delete a specific version of the channel.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```ts
|
|
130
|
-
* import utils from '@eventcatalog/utils';
|
|
131
|
-
*
|
|
132
|
-
* const { rmChannelById } = utils('/path/to/eventcatalog');
|
|
133
|
-
*
|
|
134
|
-
* // deletes the latest InventoryChannel channel
|
|
135
|
-
* await rmChannelById('inventory.{env}.events');
|
|
136
|
-
*
|
|
137
|
-
* // deletes a specific version of the InventoryChannel channel
|
|
138
|
-
* await rmChannelById('inventory.{env}.events', '0.0.1');
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
declare const rmChannelById: (directory: string) => (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
|
|
142
|
-
/**
|
|
143
|
-
* Version a channel by it's id.
|
|
144
|
-
*
|
|
145
|
-
* Takes the latest channel and moves it to a versioned directory.
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```ts
|
|
149
|
-
* import utils from '@eventcatalog/utils';
|
|
150
|
-
*
|
|
151
|
-
* const { versionChannel } = utils('/path/to/eventcatalog');
|
|
152
|
-
*
|
|
153
|
-
* // moves the latest inventory.{env}.events channel to a versioned directory
|
|
154
|
-
* // the version within that channel is used as the version number.
|
|
155
|
-
* await versionChannel('inventory.{env}.events');
|
|
156
|
-
*
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
declare const versionChannel: (directory: string) => (id: string) => Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* Check to see if the catalog has a version for the given channel.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```ts
|
|
165
|
-
* import utils from '@eventcatalog/utils';
|
|
166
|
-
*
|
|
167
|
-
* const { channelHasVersion } = utils('/path/to/eventcatalog');
|
|
168
|
-
*
|
|
169
|
-
* // returns true if version is found for the given event and version (supports semver)
|
|
170
|
-
* await channelHasVersion('inventory.{env}.events', '0.0.1');
|
|
171
|
-
* await channelHasVersion('inventory.{env}.events', 'latest');
|
|
172
|
-
* await channelHasVersion('inventory.{env}.events', '0.0.x');*
|
|
173
|
-
*
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
declare const channelHasVersion: (directory: string) => (id: string, version?: string) => Promise<boolean>;
|
|
177
|
-
/**
|
|
178
|
-
* Add an event/command/query to a channel by it's id.
|
|
179
|
-
*
|
|
180
|
-
* Optionally specify a version to add the message to a specific version of the service.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* import utils from '@eventcatalog/utils';
|
|
185
|
-
*
|
|
186
|
-
* // Adds an event to the service or command to the service
|
|
187
|
-
* const { addEventToChannel, addCommandToChannel, addQueryToChannel } = utils('/path/to/eventcatalog');
|
|
188
|
-
*
|
|
189
|
-
* // Adds a new event (InventoryUpdatedEvent) that the InventoryService will send
|
|
190
|
-
* await addEventToChannel('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
|
|
191
|
-
* * // Adds a new event (OrderComplete) that the InventoryService will receive
|
|
192
|
-
* await addEventToChannel('InventoryService', 'receives', { event: 'OrderComplete', version: '1.0.0' });
|
|
193
|
-
*
|
|
194
|
-
* // Adds a new command (UpdateInventoryCommand) that the InventoryService will send
|
|
195
|
-
* await addCommandToChannel('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
|
|
196
|
-
* // Adds a new command (VerifyInventory) that the InventoryService will receive
|
|
197
|
-
* await addCommandToChannel('InventoryService', 'receives', { command: 'VerifyInventory', version: '1.0.0' });
|
|
198
|
-
*
|
|
199
|
-
* // Adds a new query (GetInventoryQuery) that the InventoryService will send
|
|
200
|
-
* await addQueryToChannel('InventoryService', 'sends', { query: 'GetInventoryQuery', version: '2.0.0' });
|
|
201
|
-
* // Adds a new query (GetOrder) that the InventoryService will receive
|
|
202
|
-
* await addQueryToChannel('InventoryService', 'receives', { query: 'GetOrder', version: '1.0.0' });
|
|
203
|
-
*
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
declare const addMessageToChannel: (directory: string, collection: string) => (id: string, _message: {
|
|
207
|
-
id: string;
|
|
208
|
-
version: string;
|
|
209
|
-
parameters?: {
|
|
210
|
-
[key: string]: string;
|
|
211
|
-
};
|
|
212
|
-
}, version?: string) => Promise<void>;
|
|
213
|
-
|
|
214
|
-
export { addMessageToChannel, channelHasVersion, getChannel, getChannels, rmChannel, rmChannelById, versionChannel, writeChannel };
|