@eventcatalog/generator-asyncapi 6.2.0 → 6.3.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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2024-2026 EventCatalog Ltd
2
+
3
+ This software is dual-licensed:
4
+
5
+ * For open-source projects: licensed under the GNU Affero General Public
6
+ License v3.0 (AGPL-3.0). See LICENSE-OPENSOURCE.md for the full terms.
7
+
8
+ * For proprietary, internal, or commercial use: licensed under the EventCatalog
9
+ Commercial License. See LICENSE-COMMERCIAL.md for the full terms.
10
+
11
+ If you are using these plugins for internal business purposes and do not wish
12
+ to release your source code under AGPL-3.0, you must obtain a Commercial
13
+ License.
14
+
15
+ To obtain a Commercial License:
16
+ - Purchase a subscription at https://www.eventcatalog.dev/pricing
17
+ - Purchase individual plugins at https://eventcatalog.cloud/
18
+ - Free 14-day trial at https://eventcatalog.cloud/
19
+ - Contact us at hello@eventcatalog.dev
package/dist/index.js CHANGED
@@ -1543,7 +1543,7 @@ var import_path3 = __toESM(require("path"));
1543
1543
  // package.json
1544
1544
  var package_default = {
1545
1545
  name: "@eventcatalog/generator-asyncapi",
1546
- version: "6.2.0",
1546
+ version: "6.3.0",
1547
1547
  description: "AsyncAPI generator for EventCatalog",
1548
1548
  scripts: {
1549
1549
  build: "tsup",
@@ -1581,7 +1581,7 @@ var package_default = {
1581
1581
  dependencies: {
1582
1582
  "@asyncapi/avro-schema-parser": "3.0.24",
1583
1583
  "@asyncapi/parser": "3.6.0",
1584
- "@eventcatalog/sdk": "2.18.2",
1584
+ "@eventcatalog/sdk": "2.18.4",
1585
1585
  chalk: "4.1.2",
1586
1586
  "fs-extra": "^11.2.0",
1587
1587
  glob: "^12.0.0",
@@ -4166,6 +4166,24 @@ var optionsSchema = import_zod.z.object({
4166
4166
  var toUniqueArray = (array) => {
4167
4167
  return array.filter((item, index, self) => index === self.findIndex((t) => t.id === item.id && t.version === item.version));
4168
4168
  };
4169
+ var consolidateMessages = (array) => {
4170
+ const map = /* @__PURE__ */ new Map();
4171
+ for (const item of array) {
4172
+ const key = `${item.id}::${item.version}`;
4173
+ const existing = map.get(key);
4174
+ if (existing) {
4175
+ if (item.to) {
4176
+ existing.to = [...existing.to || [], ...item.to];
4177
+ }
4178
+ if (item.from) {
4179
+ existing.from = [...existing.from || [], ...item.from];
4180
+ }
4181
+ } else {
4182
+ map.set(key, { ...item });
4183
+ }
4184
+ }
4185
+ return Array.from(map.values());
4186
+ };
4169
4187
  var mergeAsyncApiIntoSpecifications = (existingSpecs, asyncapiFileName) => {
4170
4188
  if (Array.isArray(existingSpecs)) {
4171
4189
  return [...existingSpecs.filter((spec) => spec.type !== "asyncapi"), { type: "asyncapi", path: asyncapiFileName }];
@@ -4286,6 +4304,8 @@ var index_default = async (config, options) => {
4286
4304
  let badges = null;
4287
4305
  let attachments = null;
4288
4306
  let diagrams = null;
4307
+ let flows = null;
4308
+ let entities = null;
4289
4309
  let serviceSpecifications = {};
4290
4310
  let serviceSpecificationsFiles = [];
4291
4311
  let configuredWritesTo = service.writesTo || [];
@@ -4523,6 +4543,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
4523
4543
  badges = latestServiceInCatalog.badges || null;
4524
4544
  attachments = latestServiceInCatalog.attachments || null;
4525
4545
  diagrams = latestServiceInCatalog.diagrams || null;
4546
+ flows = latestServiceInCatalog.flows || null;
4547
+ entities = latestServiceInCatalog.entities || null;
4526
4548
  serviceWritesTo = latestServiceInCatalog.writesTo ? latestServiceInCatalog.writesTo : configuredWritesTo;
4527
4549
  serviceReadsFrom = latestServiceInCatalog.readsFrom ? latestServiceInCatalog.readsFrom : configuredReadsFrom;
4528
4550
  if (latestServiceInCatalog.version !== version) {
@@ -4540,6 +4562,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
4540
4562
  }
4541
4563
  }
4542
4564
  const fileName = import_path3.default.basename(service.path);
4565
+ sends = consolidateMessages(sends);
4566
+ receives = consolidateMessages(receives);
4543
4567
  await writeService(
4544
4568
  {
4545
4569
  id: serviceId,
@@ -4556,6 +4580,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
4556
4580
  ...repository && { repository },
4557
4581
  ...styles2 && { styles: styles2 },
4558
4582
  ...diagrams && { diagrams },
4583
+ ...flows && { flows },
4584
+ ...entities && { entities },
4559
4585
  ...isServiceMarkedAsDraft && { draft: true },
4560
4586
  ...attachments && { attachments },
4561
4587
  ...serviceWritesTo.length > 0 ? { writesTo: serviceWritesTo } : {},