@eventcatalog/generator-asyncapi 6.3.0 → 6.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/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +22 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1538,7 +1538,7 @@ import path3 from "path";
|
|
|
1538
1538
|
// package.json
|
|
1539
1539
|
var package_default = {
|
|
1540
1540
|
name: "@eventcatalog/generator-asyncapi",
|
|
1541
|
-
version: "6.
|
|
1541
|
+
version: "6.4.0",
|
|
1542
1542
|
description: "AsyncAPI generator for EventCatalog",
|
|
1543
1543
|
scripts: {
|
|
1544
1544
|
build: "tsup",
|
|
@@ -4156,7 +4156,12 @@ var optionsSchema = z.object({
|
|
|
4156
4156
|
parseChannels: z.boolean().optional(),
|
|
4157
4157
|
parseExamples: z.boolean().optional(),
|
|
4158
4158
|
attachHeadersToSchema: z.boolean().optional(),
|
|
4159
|
-
saveParsedSpecFile: z.boolean({ invalid_type_error: "The saveParsedSpecFile is not a boolean in options" }).optional()
|
|
4159
|
+
saveParsedSpecFile: z.boolean({ invalid_type_error: "The saveParsedSpecFile is not a boolean in options" }).optional(),
|
|
4160
|
+
/**
|
|
4161
|
+
* Group messages in the visualiser using the `x-eventcatalog-group` extension
|
|
4162
|
+
* on each message in the AsyncAPI spec.
|
|
4163
|
+
*/
|
|
4164
|
+
groupMessagesBy: z.enum(["x-extension"]).optional()
|
|
4160
4165
|
});
|
|
4161
4166
|
var toUniqueArray = (array) => {
|
|
4162
4167
|
return array.filter((item, index, self) => index === self.findIndex((t) => t.id === item.id && t.version === item.version));
|
|
@@ -4168,10 +4173,12 @@ var consolidateMessages = (array) => {
|
|
|
4168
4173
|
const existing = map.get(key);
|
|
4169
4174
|
if (existing) {
|
|
4170
4175
|
if (item.to) {
|
|
4171
|
-
|
|
4176
|
+
const merged = [...existing.to || [], ...item.to];
|
|
4177
|
+
existing.to = merged.filter((ch, i, arr) => i === arr.findIndex((c) => c.id === ch.id));
|
|
4172
4178
|
}
|
|
4173
4179
|
if (item.from) {
|
|
4174
|
-
|
|
4180
|
+
const merged = [...existing.from || [], ...item.from];
|
|
4181
|
+
existing.from = merged.filter((ch, i, arr) => i === arr.findIndex((c) => c.id === ch.id));
|
|
4175
4182
|
}
|
|
4176
4183
|
} else {
|
|
4177
4184
|
map.set(key, { ...item });
|
|
@@ -4508,6 +4515,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
4508
4515
|
} else {
|
|
4509
4516
|
console.log(chalk4.yellow(` - Skipping external message: ${getMessageName(message2)}(v${messageVersion})`));
|
|
4510
4517
|
}
|
|
4518
|
+
const group = options.groupMessagesBy === "x-extension" ? message2.extensions().get("x-eventcatalog-group")?.value() || void 0 : void 0;
|
|
4511
4519
|
if (parseChannels) {
|
|
4512
4520
|
const operationChannels = operation.channels().all();
|
|
4513
4521
|
const channelPointers = operationChannels.map((channel) => {
|
|
@@ -4515,16 +4523,22 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
4515
4523
|
return { id: channel.id(), ...explicitVersion && { version: explicitVersion } };
|
|
4516
4524
|
});
|
|
4517
4525
|
if (isSent)
|
|
4518
|
-
sends.push({
|
|
4526
|
+
sends.push({
|
|
4527
|
+
id: messageId,
|
|
4528
|
+
version: messageVersion,
|
|
4529
|
+
...channelPointers.length > 0 && { to: channelPointers },
|
|
4530
|
+
...group && { group }
|
|
4531
|
+
});
|
|
4519
4532
|
if (isReceived)
|
|
4520
4533
|
receives.push({
|
|
4521
4534
|
id: messageId,
|
|
4522
4535
|
version: messageVersion,
|
|
4523
|
-
...channelPointers.length > 0 && { from: channelPointers }
|
|
4536
|
+
...channelPointers.length > 0 && { from: channelPointers },
|
|
4537
|
+
...group && { group }
|
|
4524
4538
|
});
|
|
4525
4539
|
} else {
|
|
4526
|
-
if (isSent) sends.push({ id: messageId, version: messageVersion });
|
|
4527
|
-
if (isReceived) receives.push({ id: messageId, version: messageVersion });
|
|
4540
|
+
if (isSent) sends.push({ id: messageId, version: messageVersion, ...group && { group } });
|
|
4541
|
+
if (isReceived) receives.push({ id: messageId, version: messageVersion, ...group && { group } });
|
|
4528
4542
|
}
|
|
4529
4543
|
}
|
|
4530
4544
|
}
|