@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/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 };
|
package/dist/channels.d.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { Channel } from './types.d.js';
|
|
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 };
|