@eventcatalog/sdk 2.3.7 → 2.4.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/dist/channels.js +30 -4
- package/dist/channels.js.map +1 -1
- package/dist/channels.mjs +44 -12
- package/dist/channels.mjs.map +1 -1
- package/dist/commands.d.mts +10 -1
- package/dist/commands.d.ts +10 -1
- package/dist/commands.js +28 -2
- package/dist/commands.js.map +1 -1
- package/dist/commands.mjs +34 -8
- package/dist/commands.mjs.map +1 -1
- package/dist/custom-docs.js +15 -1
- package/dist/custom-docs.js.map +1 -1
- package/dist/custom-docs.mjs +26 -9
- package/dist/custom-docs.mjs.map +1 -1
- package/dist/domains.js +27 -1
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +34 -8
- package/dist/domains.mjs.map +1 -1
- package/dist/eventcatalog.js +30 -4
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +57 -31
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/events.d.mts +10 -1
- package/dist/events.d.ts +10 -1
- package/dist/events.js +28 -2
- package/dist/events.js.map +1 -1
- package/dist/events.mjs +34 -8
- package/dist/events.mjs.map +1 -1
- package/dist/index.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -31
- package/dist/index.mjs.map +1 -1
- package/dist/queries.d.mts +10 -1
- package/dist/queries.d.ts +10 -1
- package/dist/queries.js +28 -2
- package/dist/queries.js.map +1 -1
- package/dist/queries.mjs +34 -8
- package/dist/queries.mjs.map +1 -1
- package/dist/services.js +27 -1
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +33 -7
- package/dist/services.mjs.map +1 -1
- package/dist/teams.mjs +7 -6
- package/dist/teams.mjs.map +1 -1
- package/dist/types.d.d.mts +3 -0
- package/dist/types.d.d.ts +3 -0
- package/dist/types.d.js.map +1 -1
- package/dist/users.mjs +7 -6
- package/dist/users.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,9 @@ declare const _default: (path: string) => {
|
|
|
14
14
|
* @param version - Optional id of the version to get (supports semver)
|
|
15
15
|
* @returns Event|Undefined
|
|
16
16
|
*/
|
|
17
|
-
getEvent: (id: string, version?: string
|
|
17
|
+
getEvent: (id: string, version?: string, options?: {
|
|
18
|
+
attachSchema?: boolean;
|
|
19
|
+
}) => Promise<Event>;
|
|
18
20
|
/**
|
|
19
21
|
* Returns all events from EventCatalog
|
|
20
22
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
@@ -22,6 +24,7 @@ declare const _default: (path: string) => {
|
|
|
22
24
|
*/
|
|
23
25
|
getEvents: (options?: {
|
|
24
26
|
latestOnly?: boolean;
|
|
27
|
+
attachSchema?: boolean;
|
|
25
28
|
}) => Promise<Event[]>;
|
|
26
29
|
/**
|
|
27
30
|
* Adds an event to EventCatalog
|
|
@@ -111,7 +114,9 @@ declare const _default: (path: string) => {
|
|
|
111
114
|
* @param version - Optional id of the version to get (supports semver)
|
|
112
115
|
* @returns Command|Undefined
|
|
113
116
|
*/
|
|
114
|
-
getCommand: (id: string, version?: string
|
|
117
|
+
getCommand: (id: string, version?: string, options?: {
|
|
118
|
+
attachSchema?: boolean;
|
|
119
|
+
}) => Promise<Command>;
|
|
115
120
|
/**
|
|
116
121
|
* Returns all commands from EventCatalog
|
|
117
122
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
@@ -119,6 +124,7 @@ declare const _default: (path: string) => {
|
|
|
119
124
|
*/
|
|
120
125
|
getCommands: (options?: {
|
|
121
126
|
latestOnly?: boolean;
|
|
127
|
+
attachSchema?: boolean;
|
|
122
128
|
}) => Promise<Command[]>;
|
|
123
129
|
/**
|
|
124
130
|
* Adds an command to EventCatalog
|
|
@@ -208,7 +214,9 @@ declare const _default: (path: string) => {
|
|
|
208
214
|
* @param version - Optional id of the version to get (supports semver)
|
|
209
215
|
* @returns Query|Undefined
|
|
210
216
|
*/
|
|
211
|
-
getQuery: (id: string, version?: string
|
|
217
|
+
getQuery: (id: string, version?: string, options?: {
|
|
218
|
+
attachSchema?: boolean;
|
|
219
|
+
}) => Promise<Query>;
|
|
212
220
|
/**
|
|
213
221
|
* Returns all queries from EventCatalog
|
|
214
222
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
@@ -216,6 +224,7 @@ declare const _default: (path: string) => {
|
|
|
216
224
|
*/
|
|
217
225
|
getQueries: (options?: {
|
|
218
226
|
latestOnly?: boolean;
|
|
227
|
+
attachSchema?: boolean;
|
|
219
228
|
}) => Promise<Query[]>;
|
|
220
229
|
/**
|
|
221
230
|
* Adds a query to EventCatalog
|
package/dist/index.js
CHANGED
|
@@ -221,9 +221,22 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
var getResource = async (catalogDir, id, version, options) => {
|
|
224
|
+
const attachSchema = options?.attachSchema || false;
|
|
224
225
|
const file = await findFileById(catalogDir, id, version);
|
|
225
226
|
if (!file) return;
|
|
226
227
|
const { data, content } = import_gray_matter2.default.read(file);
|
|
228
|
+
if (attachSchema && data?.schemaPath) {
|
|
229
|
+
const resourceDirectory = (0, import_path.dirname)(file);
|
|
230
|
+
const pathToSchema = (0, import_path.join)(resourceDirectory, data.schemaPath);
|
|
231
|
+
if (import_node_fs2.default.existsSync(pathToSchema)) {
|
|
232
|
+
const schema = import_node_fs2.default.readFileSync(pathToSchema, "utf8");
|
|
233
|
+
try {
|
|
234
|
+
data.schema = JSON.parse(schema);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
data.schema = schema;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
227
240
|
return {
|
|
228
241
|
...data,
|
|
229
242
|
markdown: content.trim()
|
|
@@ -242,7 +255,8 @@ var getResources = async (catalogDir, {
|
|
|
242
255
|
type,
|
|
243
256
|
latestOnly = false,
|
|
244
257
|
ignore = [],
|
|
245
|
-
pattern = ""
|
|
258
|
+
pattern = "",
|
|
259
|
+
attachSchema = false
|
|
246
260
|
}) => {
|
|
247
261
|
const ignoreList = latestOnly ? `**/versioned/**` : "";
|
|
248
262
|
const filePattern = pattern || `${catalogDir}/**/${type}/**/index.{md,mdx}`;
|
|
@@ -250,6 +264,18 @@ var getResources = async (catalogDir, {
|
|
|
250
264
|
if (files.length === 0) return;
|
|
251
265
|
return files.map((file) => {
|
|
252
266
|
const { data, content } = import_gray_matter2.default.read(file);
|
|
267
|
+
if (attachSchema && data?.schemaPath) {
|
|
268
|
+
const resourceDirectory = (0, import_path.dirname)(file);
|
|
269
|
+
const pathToSchema = (0, import_path.join)(resourceDirectory, data.schemaPath);
|
|
270
|
+
if (import_node_fs2.default.existsSync(pathToSchema)) {
|
|
271
|
+
const schema = import_node_fs2.default.readFileSync(pathToSchema, "utf8");
|
|
272
|
+
try {
|
|
273
|
+
data.schema = JSON.parse(schema);
|
|
274
|
+
} catch (error) {
|
|
275
|
+
data.schema = schema;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
253
279
|
return {
|
|
254
280
|
...data,
|
|
255
281
|
markdown: content.trim()
|
|
@@ -300,7 +326,7 @@ var getVersionedDirectory = (sourceDirectory, version) => {
|
|
|
300
326
|
};
|
|
301
327
|
|
|
302
328
|
// src/events.ts
|
|
303
|
-
var getEvent = (directory) => async (id, version) => getResource(directory, id, version, { type: "event" });
|
|
329
|
+
var getEvent = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "event", ...options });
|
|
304
330
|
var getEvents = (directory) => async (options) => getResources(directory, { type: "events", ...options });
|
|
305
331
|
var writeEvent = (directory) => async (event, options = {
|
|
306
332
|
path: "",
|
|
@@ -335,7 +361,7 @@ var eventHasVersion = (directory) => async (id, version) => {
|
|
|
335
361
|
// src/commands.ts
|
|
336
362
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
337
363
|
var import_node_path3 = require("path");
|
|
338
|
-
var getCommand = (directory) => async (id, version) => getResource(directory, id, version, { type: "command" });
|
|
364
|
+
var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
|
|
339
365
|
var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
|
|
340
366
|
var writeCommand = (directory) => async (command, options = {
|
|
341
367
|
path: "",
|
|
@@ -369,7 +395,7 @@ var commandHasVersion = (directory) => async (id, version) => {
|
|
|
369
395
|
// src/queries.ts
|
|
370
396
|
var import_promises4 = __toESM(require("fs/promises"));
|
|
371
397
|
var import_node_path4 = require("path");
|
|
372
|
-
var getQuery = (directory) => async (id, version) => getResource(directory, id, version, { type: "query" });
|
|
398
|
+
var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
|
|
373
399
|
var writeQuery = (directory) => async (query, options = {
|
|
374
400
|
path: "",
|
|
375
401
|
override: false,
|