@eventcatalog/sdk 2.3.7 → 2.5.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 +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +130 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +153 -127
- 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 +13 -1
- package/dist/types.d.d.ts +13 -1
- 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.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { join as join13 } from "
|
|
2
|
+
import { join as join13 } from "path";
|
|
3
3
|
|
|
4
4
|
// src/events.ts
|
|
5
|
-
import fs2 from "
|
|
6
|
-
import { join as join3 } from "
|
|
5
|
+
import fs2 from "fs/promises";
|
|
6
|
+
import { join as join3 } from "path";
|
|
7
7
|
|
|
8
8
|
// src/internal/utils.ts
|
|
9
9
|
import { globSync } from "glob";
|
|
10
|
-
import fsSync from "
|
|
10
|
+
import fsSync from "fs";
|
|
11
11
|
import { copy } from "fs-extra";
|
|
12
|
-
import { join, dirname, normalize, resolve, relative } from "
|
|
12
|
+
import { join, dirname, normalize, resolve, relative } from "path";
|
|
13
13
|
import matter from "gray-matter";
|
|
14
14
|
import { satisfies, validRange, valid } from "semver";
|
|
15
15
|
var versionExists = async (catalogDir, id, version) => {
|
|
@@ -115,8 +115,8 @@ var uniqueVersions = (messages) => {
|
|
|
115
115
|
// src/internal/resources.ts
|
|
116
116
|
import { dirname as dirname2, join as join2 } from "path";
|
|
117
117
|
import matter2 from "gray-matter";
|
|
118
|
-
import fs from "
|
|
119
|
-
import fsSync2 from "
|
|
118
|
+
import fs from "fs/promises";
|
|
119
|
+
import fsSync2 from "fs";
|
|
120
120
|
import { satisfies as satisfies2 } from "semver";
|
|
121
121
|
import { lock, unlock } from "proper-lockfile";
|
|
122
122
|
var versionResource = async (catalogDir, id) => {
|
|
@@ -187,9 +187,22 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
var getResource = async (catalogDir, id, version, options) => {
|
|
190
|
+
const attachSchema = options?.attachSchema || false;
|
|
190
191
|
const file = await findFileById(catalogDir, id, version);
|
|
191
192
|
if (!file) return;
|
|
192
193
|
const { data, content } = matter2.read(file);
|
|
194
|
+
if (attachSchema && data?.schemaPath) {
|
|
195
|
+
const resourceDirectory = dirname2(file);
|
|
196
|
+
const pathToSchema = join2(resourceDirectory, data.schemaPath);
|
|
197
|
+
if (fsSync2.existsSync(pathToSchema)) {
|
|
198
|
+
const schema = fsSync2.readFileSync(pathToSchema, "utf8");
|
|
199
|
+
try {
|
|
200
|
+
data.schema = JSON.parse(schema);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
data.schema = schema;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
193
206
|
return {
|
|
194
207
|
...data,
|
|
195
208
|
markdown: content.trim()
|
|
@@ -208,7 +221,8 @@ var getResources = async (catalogDir, {
|
|
|
208
221
|
type,
|
|
209
222
|
latestOnly = false,
|
|
210
223
|
ignore = [],
|
|
211
|
-
pattern = ""
|
|
224
|
+
pattern = "",
|
|
225
|
+
attachSchema = false
|
|
212
226
|
}) => {
|
|
213
227
|
const ignoreList = latestOnly ? `**/versioned/**` : "";
|
|
214
228
|
const filePattern = pattern || `${catalogDir}/**/${type}/**/index.{md,mdx}`;
|
|
@@ -216,6 +230,18 @@ var getResources = async (catalogDir, {
|
|
|
216
230
|
if (files.length === 0) return;
|
|
217
231
|
return files.map((file) => {
|
|
218
232
|
const { data, content } = matter2.read(file);
|
|
233
|
+
if (attachSchema && data?.schemaPath) {
|
|
234
|
+
const resourceDirectory = dirname2(file);
|
|
235
|
+
const pathToSchema = join2(resourceDirectory, data.schemaPath);
|
|
236
|
+
if (fsSync2.existsSync(pathToSchema)) {
|
|
237
|
+
const schema = fsSync2.readFileSync(pathToSchema, "utf8");
|
|
238
|
+
try {
|
|
239
|
+
data.schema = JSON.parse(schema);
|
|
240
|
+
} catch (error) {
|
|
241
|
+
data.schema = schema;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
219
245
|
return {
|
|
220
246
|
...data,
|
|
221
247
|
markdown: content.trim()
|
|
@@ -266,7 +292,7 @@ var getVersionedDirectory = (sourceDirectory, version) => {
|
|
|
266
292
|
};
|
|
267
293
|
|
|
268
294
|
// src/events.ts
|
|
269
|
-
var getEvent = (directory) => async (id, version) => getResource(directory, id, version, { type: "event" });
|
|
295
|
+
var getEvent = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "event", ...options });
|
|
270
296
|
var getEvents = (directory) => async (options) => getResources(directory, { type: "events", ...options });
|
|
271
297
|
var writeEvent = (directory) => async (event, options = {
|
|
272
298
|
path: "",
|
|
@@ -299,9 +325,9 @@ var eventHasVersion = (directory) => async (id, version) => {
|
|
|
299
325
|
};
|
|
300
326
|
|
|
301
327
|
// src/commands.ts
|
|
302
|
-
import fs3 from "
|
|
303
|
-
import { join as join4 } from "
|
|
304
|
-
var getCommand = (directory) => async (id, version) => getResource(directory, id, version, { type: "command" });
|
|
328
|
+
import fs3 from "fs/promises";
|
|
329
|
+
import { join as join4 } from "path";
|
|
330
|
+
var getCommand = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "command", ...options });
|
|
305
331
|
var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
|
|
306
332
|
var writeCommand = (directory) => async (command, options = {
|
|
307
333
|
path: "",
|
|
@@ -333,9 +359,9 @@ var commandHasVersion = (directory) => async (id, version) => {
|
|
|
333
359
|
};
|
|
334
360
|
|
|
335
361
|
// src/queries.ts
|
|
336
|
-
import fs4 from "
|
|
337
|
-
import { join as join5 } from "
|
|
338
|
-
var getQuery = (directory) => async (id, version) => getResource(directory, id, version, { type: "query" });
|
|
362
|
+
import fs4 from "fs/promises";
|
|
363
|
+
import { join as join5 } from "path";
|
|
364
|
+
var getQuery = (directory) => async (id, version, options) => getResource(directory, id, version, { type: "query", ...options });
|
|
339
365
|
var writeQuery = (directory) => async (query, options = {
|
|
340
366
|
path: "",
|
|
341
367
|
override: false,
|
|
@@ -369,8 +395,8 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
369
395
|
};
|
|
370
396
|
|
|
371
397
|
// src/services.ts
|
|
372
|
-
import fs5 from "
|
|
373
|
-
import { join as join6, dirname as dirname4, extname } from "
|
|
398
|
+
import fs5 from "fs/promises";
|
|
399
|
+
import { join as join6, dirname as dirname4, extname } from "path";
|
|
374
400
|
var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
|
|
375
401
|
var getServices = (directory) => async (options) => getResources(directory, {
|
|
376
402
|
type: "services",
|
|
@@ -469,9 +495,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
|
|
|
469
495
|
};
|
|
470
496
|
|
|
471
497
|
// src/domains.ts
|
|
472
|
-
import fs6 from "
|
|
473
|
-
import path, { join as join7 } from "
|
|
474
|
-
import fsSync3 from "
|
|
498
|
+
import fs6 from "fs/promises";
|
|
499
|
+
import path, { join as join7 } from "path";
|
|
500
|
+
import fsSync3 from "fs";
|
|
475
501
|
import matter3 from "gray-matter";
|
|
476
502
|
var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
|
|
477
503
|
var getDomains = (directory) => async (options) => getResources(directory, {
|
|
@@ -552,8 +578,8 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
|
|
|
552
578
|
};
|
|
553
579
|
|
|
554
580
|
// src/channels.ts
|
|
555
|
-
import fs7 from "
|
|
556
|
-
import { join as join8, extname as extname2 } from "
|
|
581
|
+
import fs7 from "fs/promises";
|
|
582
|
+
import { join as join8, extname as extname2 } from "path";
|
|
557
583
|
var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
|
|
558
584
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
559
585
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
@@ -605,101 +631,14 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
605
631
|
await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
|
|
606
632
|
};
|
|
607
633
|
|
|
608
|
-
// src/eventcatalog.ts
|
|
609
|
-
import fs8 from "fs";
|
|
610
|
-
import path2, { join as join9 } from "node:path";
|
|
611
|
-
var DUMP_VERSION = "0.0.1";
|
|
612
|
-
var getEventCatalogVersion = async (catalogDir) => {
|
|
613
|
-
try {
|
|
614
|
-
const packageJson = fs8.readFileSync(join9(catalogDir, "package.json"), "utf8");
|
|
615
|
-
const packageJsonObject = JSON.parse(packageJson);
|
|
616
|
-
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
617
|
-
} catch (error) {
|
|
618
|
-
return "unknown";
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
var hydrateResource = async (catalogDir, resources, { attachSchema = false } = {}) => {
|
|
622
|
-
return await Promise.all(
|
|
623
|
-
resources.map(async (resource) => {
|
|
624
|
-
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
625
|
-
let schema = "";
|
|
626
|
-
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
627
|
-
const pathToSchema = path2.join(path2.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
628
|
-
if (fs8.existsSync(pathToSchema)) {
|
|
629
|
-
schema = fs8.readFileSync(pathToSchema, "utf8");
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
|
|
633
|
-
return {
|
|
634
|
-
...resource,
|
|
635
|
-
_eventcatalog: eventcatalog
|
|
636
|
-
};
|
|
637
|
-
})
|
|
638
|
-
);
|
|
639
|
-
};
|
|
640
|
-
var filterCollection = (collection, options) => {
|
|
641
|
-
return collection.map((item) => ({
|
|
642
|
-
...item,
|
|
643
|
-
markdown: options?.includeMarkdown ? item.markdown : void 0
|
|
644
|
-
}));
|
|
645
|
-
};
|
|
646
|
-
var dumpCatalog = (directory) => async (options) => {
|
|
647
|
-
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers2 } = index_default(directory);
|
|
648
|
-
const { includeMarkdown = true } = options || {};
|
|
649
|
-
const domains = await getDomains2();
|
|
650
|
-
const services = await getServices2();
|
|
651
|
-
const events = await getEvents2();
|
|
652
|
-
const commands = await getCommands2();
|
|
653
|
-
const queries = await getQueries2();
|
|
654
|
-
const teams = await getTeams2();
|
|
655
|
-
const users = await getUsers2();
|
|
656
|
-
const channels = await getChannels2();
|
|
657
|
-
const [
|
|
658
|
-
hydratedDomains,
|
|
659
|
-
hydratedServices,
|
|
660
|
-
hydratedEvents,
|
|
661
|
-
hydratedQueries,
|
|
662
|
-
hydratedCommands,
|
|
663
|
-
hydratedTeams,
|
|
664
|
-
hydratedUsers,
|
|
665
|
-
hydratedChannels
|
|
666
|
-
] = await Promise.all([
|
|
667
|
-
hydrateResource(directory, domains),
|
|
668
|
-
hydrateResource(directory, services),
|
|
669
|
-
hydrateResource(directory, events),
|
|
670
|
-
hydrateResource(directory, queries),
|
|
671
|
-
hydrateResource(directory, commands),
|
|
672
|
-
hydrateResource(directory, teams),
|
|
673
|
-
hydrateResource(directory, users),
|
|
674
|
-
hydrateResource(directory, channels)
|
|
675
|
-
]);
|
|
676
|
-
return {
|
|
677
|
-
version: DUMP_VERSION,
|
|
678
|
-
catalogVersion: await getEventCatalogVersion(directory),
|
|
679
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
680
|
-
resources: {
|
|
681
|
-
domains: filterCollection(hydratedDomains, { includeMarkdown }),
|
|
682
|
-
services: filterCollection(hydratedServices, { includeMarkdown }),
|
|
683
|
-
messages: {
|
|
684
|
-
events: filterCollection(hydratedEvents, { includeMarkdown }),
|
|
685
|
-
queries: filterCollection(hydratedQueries, { includeMarkdown }),
|
|
686
|
-
commands: filterCollection(hydratedCommands, { includeMarkdown })
|
|
687
|
-
},
|
|
688
|
-
teams: filterCollection(hydratedTeams, { includeMarkdown }),
|
|
689
|
-
users: filterCollection(hydratedUsers, { includeMarkdown }),
|
|
690
|
-
channels: filterCollection(hydratedChannels, { includeMarkdown })
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
};
|
|
694
|
-
|
|
695
634
|
// src/custom-docs.ts
|
|
696
|
-
import
|
|
697
|
-
import fsSync4 from "
|
|
698
|
-
import
|
|
635
|
+
import path2, { join as join9 } from "path";
|
|
636
|
+
import fsSync4 from "fs";
|
|
637
|
+
import fs8 from "fs/promises";
|
|
699
638
|
import matter4 from "gray-matter";
|
|
700
639
|
import slugify from "slugify";
|
|
701
640
|
var getCustomDoc = (directory) => async (filePath) => {
|
|
702
|
-
const fullPath =
|
|
641
|
+
const fullPath = path2.join(directory, filePath);
|
|
703
642
|
const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
|
|
704
643
|
const fileExists = fsSync4.existsSync(fullPathWithExtension);
|
|
705
644
|
if (!fileExists) {
|
|
@@ -718,20 +657,20 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
|
|
|
718
657
|
const { fileName, ...rest } = customDoc;
|
|
719
658
|
const name = fileName || slugify(customDoc.title, { lower: true });
|
|
720
659
|
const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
|
|
721
|
-
const fullPath =
|
|
722
|
-
fsSync4.mkdirSync(
|
|
660
|
+
const fullPath = path2.join(directory, options.path || "", withExtension);
|
|
661
|
+
fsSync4.mkdirSync(path2.dirname(fullPath), { recursive: true });
|
|
723
662
|
const document = matter4.stringify(customDoc.markdown.trim(), rest);
|
|
724
663
|
fsSync4.writeFileSync(fullPath, document);
|
|
725
664
|
};
|
|
726
665
|
var rmCustomDoc = (directory) => async (filePath) => {
|
|
727
666
|
const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
|
|
728
|
-
await
|
|
667
|
+
await fs8.rm(join9(directory, withExtension), { recursive: true });
|
|
729
668
|
};
|
|
730
669
|
|
|
731
670
|
// src/teams.ts
|
|
732
|
-
import
|
|
733
|
-
import fsSync5 from "
|
|
734
|
-
import { join as
|
|
671
|
+
import fs9 from "fs/promises";
|
|
672
|
+
import fsSync5 from "fs";
|
|
673
|
+
import { join as join10 } from "path";
|
|
735
674
|
import matter5 from "gray-matter";
|
|
736
675
|
var getTeam = (catalogDir) => async (id) => {
|
|
737
676
|
const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
|
|
@@ -767,16 +706,16 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
|
|
|
767
706
|
}
|
|
768
707
|
const { markdown, ...frontmatter } = resource;
|
|
769
708
|
const document = matter5.stringify(markdown, frontmatter);
|
|
770
|
-
fsSync5.mkdirSync(
|
|
771
|
-
fsSync5.writeFileSync(
|
|
709
|
+
fsSync5.mkdirSync(join10(catalogDir, ""), { recursive: true });
|
|
710
|
+
fsSync5.writeFileSync(join10(catalogDir, "", `${resource.id}.mdx`), document);
|
|
772
711
|
};
|
|
773
712
|
var rmTeamById = (catalogDir) => async (id) => {
|
|
774
|
-
await
|
|
713
|
+
await fs9.rm(join10(catalogDir, `${id}.mdx`), { recursive: true });
|
|
775
714
|
};
|
|
776
715
|
|
|
777
716
|
// src/users.ts
|
|
778
|
-
import fsSync6 from "
|
|
779
|
-
import { join as
|
|
717
|
+
import fsSync6 from "fs";
|
|
718
|
+
import { join as join11 } from "path";
|
|
780
719
|
import matter6 from "gray-matter";
|
|
781
720
|
var getUser = (catalogDir) => async (id) => {
|
|
782
721
|
const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
|
|
@@ -814,11 +753,98 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
|
|
|
814
753
|
}
|
|
815
754
|
const { markdown, ...frontmatter } = resource;
|
|
816
755
|
const document = matter6.stringify(markdown, frontmatter);
|
|
817
|
-
fsSync6.mkdirSync(
|
|
818
|
-
fsSync6.writeFileSync(
|
|
756
|
+
fsSync6.mkdirSync(join11(catalogDir, ""), { recursive: true });
|
|
757
|
+
fsSync6.writeFileSync(join11(catalogDir, "", `${resource.id}.mdx`), document);
|
|
819
758
|
};
|
|
820
759
|
var rmUserById = (catalogDir) => async (id) => {
|
|
821
|
-
fsSync6.rmSync(
|
|
760
|
+
fsSync6.rmSync(join11(catalogDir, `${id}.mdx`), { recursive: true });
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
// src/eventcatalog.ts
|
|
764
|
+
import fs10 from "fs";
|
|
765
|
+
import path3, { join as join12 } from "path";
|
|
766
|
+
var DUMP_VERSION = "0.0.1";
|
|
767
|
+
var getEventCatalogVersion = async (catalogDir) => {
|
|
768
|
+
try {
|
|
769
|
+
const packageJson = fs10.readFileSync(join12(catalogDir, "package.json"), "utf8");
|
|
770
|
+
const packageJsonObject = JSON.parse(packageJson);
|
|
771
|
+
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
772
|
+
} catch (error) {
|
|
773
|
+
return "unknown";
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
var hydrateResource = async (catalogDir, resources, { attachSchema = false } = {}) => {
|
|
777
|
+
return await Promise.all(
|
|
778
|
+
resources.map(async (resource) => {
|
|
779
|
+
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
780
|
+
let schema = "";
|
|
781
|
+
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
782
|
+
const pathToSchema = path3.join(path3.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
783
|
+
if (fs10.existsSync(pathToSchema)) {
|
|
784
|
+
schema = fs10.readFileSync(pathToSchema, "utf8");
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
|
|
788
|
+
return {
|
|
789
|
+
...resource,
|
|
790
|
+
_eventcatalog: eventcatalog
|
|
791
|
+
};
|
|
792
|
+
})
|
|
793
|
+
);
|
|
794
|
+
};
|
|
795
|
+
var filterCollection = (collection, options) => {
|
|
796
|
+
return collection.map((item) => ({
|
|
797
|
+
...item,
|
|
798
|
+
markdown: options?.includeMarkdown ? item.markdown : void 0
|
|
799
|
+
}));
|
|
800
|
+
};
|
|
801
|
+
var dumpCatalog = (directory) => async (options) => {
|
|
802
|
+
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers2 } = index_default(directory);
|
|
803
|
+
const { includeMarkdown = true } = options || {};
|
|
804
|
+
const domains = await getDomains2();
|
|
805
|
+
const services = await getServices2();
|
|
806
|
+
const events = await getEvents2();
|
|
807
|
+
const commands = await getCommands2();
|
|
808
|
+
const queries = await getQueries2();
|
|
809
|
+
const teams = await getTeams2();
|
|
810
|
+
const users = await getUsers2();
|
|
811
|
+
const channels = await getChannels2();
|
|
812
|
+
const [
|
|
813
|
+
hydratedDomains,
|
|
814
|
+
hydratedServices,
|
|
815
|
+
hydratedEvents,
|
|
816
|
+
hydratedQueries,
|
|
817
|
+
hydratedCommands,
|
|
818
|
+
hydratedTeams,
|
|
819
|
+
hydratedUsers,
|
|
820
|
+
hydratedChannels
|
|
821
|
+
] = await Promise.all([
|
|
822
|
+
hydrateResource(directory, domains),
|
|
823
|
+
hydrateResource(directory, services),
|
|
824
|
+
hydrateResource(directory, events),
|
|
825
|
+
hydrateResource(directory, queries),
|
|
826
|
+
hydrateResource(directory, commands),
|
|
827
|
+
hydrateResource(directory, teams),
|
|
828
|
+
hydrateResource(directory, users),
|
|
829
|
+
hydrateResource(directory, channels)
|
|
830
|
+
]);
|
|
831
|
+
return {
|
|
832
|
+
version: DUMP_VERSION,
|
|
833
|
+
catalogVersion: await getEventCatalogVersion(directory),
|
|
834
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
835
|
+
resources: {
|
|
836
|
+
domains: filterCollection(hydratedDomains, { includeMarkdown }),
|
|
837
|
+
services: filterCollection(hydratedServices, { includeMarkdown }),
|
|
838
|
+
messages: {
|
|
839
|
+
events: filterCollection(hydratedEvents, { includeMarkdown }),
|
|
840
|
+
queries: filterCollection(hydratedQueries, { includeMarkdown }),
|
|
841
|
+
commands: filterCollection(hydratedCommands, { includeMarkdown })
|
|
842
|
+
},
|
|
843
|
+
teams: filterCollection(hydratedTeams, { includeMarkdown }),
|
|
844
|
+
users: filterCollection(hydratedUsers, { includeMarkdown }),
|
|
845
|
+
channels: filterCollection(hydratedChannels, { includeMarkdown })
|
|
846
|
+
}
|
|
847
|
+
};
|
|
822
848
|
};
|
|
823
849
|
|
|
824
850
|
// src/index.ts
|