@eventcatalog/generator-asyncapi 0.0.2 → 0.0.3

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 CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![PRs Welcome][prs-badge]][prs]
6
6
  <img src="https://img.shields.io/github/actions/workflow/status/event-catalog/generator-asyncapi/verify-build.yml"/>
7
- [![](https://dcbadge.limes.pink/api/server/https://discord.gg/3rjaZMmrAm?style=flat)](https://discord.gg/3rjaZMmrAm) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/david-boyne/) [![blog](https://img.shields.io/badge/blog-EDA--Visuals-brightgreen)](https://eda-visuals.boyney.io/?utm_source=event-catalog-gihub)
7
+ [![](https://dcbadge.limes.pink/api/server/https://discord.gg/3rjaZMmrAm?style=flat)](https://discord.gg/3rjaZMmrAm) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/david-boyne/) [![blog](https://img.shields.io/badge/blog-EDA--Visuals-brightgreen)](https://eda-visuals.boyney.io/?utm_source=event-catalog-gihub) [![blog](https://img.shields.io/badge/license-Dual--License-brightgreen)](https://github.com/event-catalog/generator-asyncapi/blob/main/LICENSE.md)
8
8
 
9
9
  <img alt="header" src="./images/asyncapi.jpeg" />
10
10
 
@@ -129,4 +129,4 @@ You can find the [contributing guidelines here](https://eventcatalog.dev/docs/co
129
129
 
130
130
  # Commercial Use
131
131
 
132
- This project is governed by the [AGPL-3.0](/LICENSE.md) copyleft license. To ensure the sustainability of the project, you can freely make use of this software as long the outcome is distributed under the same license. Otherwise, you must obtain a [commercial license](./LICENSE-COMMERCIAL.md) that removes such restrictions.
132
+ This project is governed by a [dual-license](./LICENSE.md). To ensure the sustainability of the project, you can freely make use of this software if your projects are Open Source. Otherwise for proprietary systems you must obtain a [commercial license](./LICENSE-COMMERCIAL.md).
@@ -0,0 +1,3 @@
1
+ declare const _default: () => void;
2
+
3
+ export { _default as default };
@@ -0,0 +1,3 @@
1
+ declare const _default: () => void;
2
+
3
+ export { _default as default };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/checkLicense.ts
31
+ var checkLicense_exports = {};
32
+ __export(checkLicense_exports, {
33
+ default: () => checkLicense_default
34
+ });
35
+ module.exports = __toCommonJS(checkLicense_exports);
36
+ var import_chalk = __toESM(require("chalk"));
37
+ var checkLicense_default = () => {
38
+ console.log(import_chalk.default.bgBlue(`
39
+ You are using the open source license for this plugin`));
40
+ console.log(
41
+ import_chalk.default.blueBright(
42
+ `This plugin is governed and published under a dual-license.
43
+ If using for internal, commercial or proprietary software, please contact hello@eventcatalog.dev for a license to support the project.`
44
+ )
45
+ );
46
+ };
47
+ //# sourceMappingURL=checkLicense.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/checkLicense.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport default () => {\n console.log(chalk.bgBlue(`\\nYou are using the open source license for this plugin`));\n console.log(\n chalk.blueBright(\n `This plugin is governed and published under a dual-license. \\nIf using for internal, commercial or proprietary software, please contact hello@eventcatalog.dev for a license to support the project.`\n )\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,IAAO,uBAAQ,MAAM;AACnB,UAAQ,IAAI,aAAAA,QAAM,OAAO;AAAA,sDAAyD,CAAC;AACnF,UAAQ;AAAA,IACN,aAAAA,QAAM;AAAA,MACJ;AAAA;AAAA,IACF;AAAA,EACF;AACF;","names":["chalk"]}
@@ -0,0 +1,16 @@
1
+ // src/checkLicense.ts
2
+ import chalk from "chalk";
3
+ var checkLicense_default = () => {
4
+ console.log(chalk.bgBlue(`
5
+ You are using the open source license for this plugin`));
6
+ console.log(
7
+ chalk.blueBright(
8
+ `This plugin is governed and published under a dual-license.
9
+ If using for internal, commercial or proprietary software, please contact hello@eventcatalog.dev for a license to support the project.`
10
+ )
11
+ );
12
+ };
13
+ export {
14
+ checkLicense_default as default
15
+ };
16
+ //# sourceMappingURL=checkLicense.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/checkLicense.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport default () => {\n console.log(chalk.bgBlue(`\\nYou are using the open source license for this plugin`));\n console.log(\n chalk.blueBright(\n `This plugin is governed and published under a dual-license. \\nIf using for internal, commercial or proprietary software, please contact hello@eventcatalog.dev for a license to support the project.`\n )\n );\n};\n"],"mappings":";AAAA,OAAO,WAAW;AAElB,IAAO,uBAAQ,MAAM;AACnB,UAAQ,IAAI,MAAM,OAAO;AAAA,sDAAyD,CAAC;AACnF,UAAQ;AAAA,IACN,MAAM;AAAA,MACJ;AAAA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,13 +1,25 @@
1
+ import { OpenAPIV3_1 } from 'openapi-types';
2
+
3
+ type Props = {
4
+ path: string | string[];
5
+ domain?: Domain;
6
+ debug?: boolean;
7
+ };
1
8
  type Domain = {
2
9
  id: string;
3
10
  name: string;
4
11
  version: string;
5
12
  };
6
- type Props = {
7
- path: string | string[];
8
- domain?: Domain;
9
- debug?: boolean;
13
+ type Operation = {
14
+ path: string;
15
+ method: string;
16
+ operationId: string;
17
+ summary?: string;
18
+ description?: string;
19
+ type: string;
20
+ externalDocs?: OpenAPIV3_1.ExternalDocumentationObject;
21
+ tags: string[];
10
22
  };
11
23
  declare const _default: (config: any, options: Props) => Promise<void>;
12
24
 
13
- export { _default as default };
25
+ export { type Operation, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,25 @@
1
+ import { OpenAPIV3_1 } from 'openapi-types';
2
+
3
+ type Props = {
4
+ path: string | string[];
5
+ domain?: Domain;
6
+ debug?: boolean;
7
+ };
1
8
  type Domain = {
2
9
  id: string;
3
10
  name: string;
4
11
  version: string;
5
12
  };
6
- type Props = {
7
- path: string | string[];
8
- domain?: Domain;
9
- debug?: boolean;
13
+ type Operation = {
14
+ path: string;
15
+ method: string;
16
+ operationId: string;
17
+ summary?: string;
18
+ description?: string;
19
+ type: string;
20
+ externalDocs?: OpenAPIV3_1.ExternalDocumentationObject;
21
+ tags: string[];
10
22
  };
11
23
  declare const _default: (config: any, options: Props) => Promise<void>;
12
24
 
13
- export { _default as default };
25
+ export { type Operation, _default as default };
package/dist/index.js CHANGED
@@ -33,260 +33,253 @@ __export(src_exports, {
33
33
  default: () => src_default
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
- var import_parser = require("@asyncapi/parser");
37
- var import_promises = require("fs/promises");
38
36
  var import_sdk = __toESM(require("@eventcatalog/sdk"));
37
+ var import_promises = require("fs/promises");
38
+ var import_chalk2 = __toESM(require("chalk"));
39
+ var import_swagger_parser = __toESM(require("@apidevtools/swagger-parser"));
39
40
  var import_slugify = __toESM(require("slugify"));
40
41
 
41
- // src/utils/schemas.ts
42
- var getFileExtentionFromSchemaFormat = (format = "") => {
43
- if (format.includes("avro")) return "avsc";
44
- if (format.includes("yml")) return "yml";
45
- if (format.includes("json")) return "json";
46
- if (format.includes("openapi")) return "openapi";
47
- if (format.includes("protobuf")) return "protobuf";
48
- if (format.includes("yaml")) return "yaml";
49
- return "json";
50
- };
51
-
52
- // src/utils/messages.ts
53
- var defaultMarkdown = (document, message) => {
42
+ // src/utils/domains.ts
43
+ var defaultMarkdown = () => {
54
44
  return `
55
- ## Architecture
56
- <NodeGraph />
57
-
58
- ${messageHasSchema(message) ? `
59
- ## Schema
60
- <SchemaViewer file="${getSchemaFileName(message)}" title="Message Schema" maxHeight="500" />
61
- ` : ""}
62
45
 
63
- ${message.externalDocs() ? `
64
- ## External documentation
65
- - [${message.externalDocs()?.description()}](${message.externalDocs()?.url()})
66
- ` : ""}
46
+ ## Architecture diagram
47
+ <NodeGraph />
67
48
 
68
49
  `;
69
50
  };
70
- var getSummary = (message) => {
71
- const messageSummary = message.hasSummary() ? message.summary() : "";
72
- const messageDescription = message.hasDescription() ? message.description() : "";
73
- let eventCatalogMessageSummary = messageSummary;
74
- if (!eventCatalogMessageSummary) {
75
- eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : "";
76
- }
77
- return eventCatalogMessageSummary;
78
- };
79
- var messageHasSchema = (message) => {
80
- return message.hasPayload() && message.schemaFormat();
81
- };
82
- var getSchemaFileName = (message) => {
83
- const extension = getFileExtentionFromSchemaFormat(message.schemaFormat());
84
- return `schema.${extension}`;
85
- };
86
- var getMessageName = (message) => {
87
- return message.hasTitle() && message.title() ? message.title() : message.id();
88
- };
89
51
 
90
52
  // src/utils/services.ts
91
53
  var defaultMarkdown2 = (document) => {
92
54
  return `
93
55
 
94
- ${document.info().hasDescription() ? `${document.info().description()}` : ""}
56
+ ${document.info.description ? `${document.info.description}` : ""}
95
57
 
96
58
  ## Architecture diagram
97
59
  <NodeGraph />
98
60
 
99
- ${document.info().externalDocs() ? `
61
+ ${document.externalDocs ? `
100
62
  ## External documentation
101
- - [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})
63
+ - [${document.externalDocs.description}](${document.externalDocs.url})
102
64
  ` : ""}
103
65
  `;
104
66
  };
105
- var getSummary2 = (document) => {
106
- const summary = document.info().hasDescription() ? document.info().description() : "";
67
+ var getSummary = (document) => {
68
+ const summary = document.info.description ? document.info.description : "";
107
69
  return summary && summary.length < 150 ? summary : "";
108
70
  };
109
71
 
110
- // src/utils/domains.ts
111
- var defaultMarkdown3 = (document) => {
72
+ // src/utils/messages.ts
73
+ var defaultMarkdown3 = (message) => {
112
74
  return `
113
-
114
- ## Architecture diagram
75
+ ## Architecture
115
76
  <NodeGraph />
116
77
 
78
+ ${message.externalDocs ? `
79
+ ## External documentation
80
+ - [${message.externalDocs.description}](${message.externalDocs.url})
81
+ ` : ""}
82
+
117
83
  `;
118
84
  };
85
+ var getSummary2 = (message) => {
86
+ const messageSummary = message.summary ? message.summary : "";
87
+ const messageDescription = message.description ? message.description : "";
88
+ let eventCatalogMessageSummary = messageSummary;
89
+ if (!eventCatalogMessageSummary) {
90
+ eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : "";
91
+ }
92
+ return eventCatalogMessageSummary;
93
+ };
94
+ var getMessageName = (message) => {
95
+ return message.operationId;
96
+ };
119
97
 
120
- // src/index.ts
98
+ // src/checkLicense.ts
121
99
  var import_chalk = __toESM(require("chalk"));
122
- var parser = new import_parser.Parser();
100
+ var checkLicense_default = () => {
101
+ console.log(import_chalk.default.bgBlue(`
102
+ You are using the open source license for this plugin`));
103
+ console.log(
104
+ import_chalk.default.blueBright(
105
+ `This plugin is governed and published under a dual-license.
106
+ If using for internal, commercial or proprietary software, please contact hello@eventcatalog.dev for a license to support the project.`
107
+ )
108
+ );
109
+ };
110
+
111
+ // src/index.ts
112
+ var DEFAULT_MESSAGE_TYPE = "query";
113
+ async function getOperationsByType(openApiPath) {
114
+ try {
115
+ const api = await import_swagger_parser.default.validate(openApiPath);
116
+ const operations = [];
117
+ for (const path in api.paths) {
118
+ const pathItem = api.paths[path];
119
+ for (const method in pathItem) {
120
+ const openAPIOperation = pathItem[method];
121
+ const messageType = openAPIOperation["x-eventcatalog-message-type"] || DEFAULT_MESSAGE_TYPE;
122
+ const operation = {
123
+ path,
124
+ method: method.toUpperCase(),
125
+ operationId: openAPIOperation.operationId,
126
+ externalDocs: openAPIOperation.externalDocs,
127
+ type: messageType,
128
+ description: openAPIOperation.description,
129
+ summary: openAPIOperation.summary,
130
+ tags: openAPIOperation.tags || []
131
+ };
132
+ operations.push(operation);
133
+ }
134
+ }
135
+ return operations;
136
+ } catch (err) {
137
+ console.error("Error parsing OpenAPI document:", err);
138
+ return [];
139
+ }
140
+ }
123
141
  var src_default = async (config, options) => {
124
142
  if (!process.env.PROJECT_DIR) {
125
143
  throw new Error("Please provide catalog url (env variable PROJECT_DIR)");
126
144
  }
127
145
  const {
128
- writeService,
129
146
  writeEvent,
130
- writeCommand,
131
- getService,
132
- versionService,
133
- rmService,
134
147
  getDomain,
148
+ versionDomain,
135
149
  writeDomain,
136
150
  addServiceToDomain,
137
- getCommand,
151
+ getService,
152
+ versionService,
153
+ rmService,
154
+ writeService,
155
+ addFileToService,
156
+ versionCommand,
138
157
  getEvent,
139
- rmEventById,
158
+ getCommand,
140
159
  rmCommandById,
141
- versionCommand,
142
- versionEvent,
143
- addSchemaToCommand,
144
- addSchemaToEvent,
145
- addFileToService,
146
- versionDomain
160
+ rmEventById,
161
+ writeCommand
147
162
  } = (0, import_sdk.default)(process.env.PROJECT_DIR);
148
- const asyncAPIFiles = Array.isArray(options.path) ? options.path : [options.path];
149
- console.log(import_chalk.default.green(`Processing ${asyncAPIFiles.length} AsyncAPI files...`));
150
- for (const path of asyncAPIFiles) {
151
- console.log(import_chalk.default.gray(`Processing ${path}`));
152
- const asyncAPIFile = await (0, import_promises.readFile)(path, "utf-8");
153
- const { document } = await parser.parse(asyncAPIFile);
154
- if (!document) {
155
- console.log(import_chalk.default.red("Failed to parse AsyncAPI file"));
156
- if (options.debug) {
157
- const diagnostics = await parser.validate(asyncAPIFile);
158
- console.log(diagnostics);
159
- } else {
160
- console.log(import_chalk.default.red("Run with debug option in the generator to see diagnostics"));
161
- }
163
+ const openAPIFiles = Array.isArray(options.path) ? options.path : [options.path];
164
+ for (const path of openAPIFiles) {
165
+ console.log(import_chalk2.default.green(`Processing ${path}`));
166
+ try {
167
+ await import_swagger_parser.default.validate(path);
168
+ } catch (error) {
169
+ console.error(import_chalk2.default.red(`Failed to parse OpenAPI file: ${path}`));
170
+ console.error(import_chalk2.default.red(error));
162
171
  continue;
163
172
  }
164
- const operations = document.allOperations();
165
- const documentTags = document.info().tags().all() || [];
166
- const serviceId = (0, import_slugify.default)(document.info().title(), { lower: true, strict: true });
167
- const version = document.info().version();
168
- const sends = [];
169
- const receives = [];
173
+ const openAPIFile = await (0, import_promises.readFile)(path, "utf-8");
174
+ const document = await import_swagger_parser.default.parse(path);
175
+ const operations = await getOperationsByType(path);
176
+ const serviceId = (0, import_slugify.default)(document.info.title, { lower: true, strict: true });
177
+ const version = document.info.version;
170
178
  let serviceMarkdown = defaultMarkdown2(document);
171
179
  if (options.domain) {
172
180
  const { id: domainId, name: domainName, version: domainVersion } = options.domain;
173
181
  const domain = await getDomain(options.domain.id, domainVersion || "latest");
174
182
  const currentDomain = await getDomain(options.domain.id, "latest");
175
- console.log(import_chalk.default.blue(`
183
+ console.log(import_chalk2.default.blue(`
176
184
  Processing domain: ${domainName} (v${domainVersion})`));
177
185
  if (currentDomain && currentDomain.version !== domainVersion) {
178
186
  await versionDomain(domainId);
179
- console.log(import_chalk.default.cyan(` - Versioned previous domain (v${currentDomain.version})`));
187
+ console.log(import_chalk2.default.cyan(` - Versioned previous domain (v${currentDomain.version})`));
180
188
  }
181
189
  if (!domain || domain && domain.version !== domainVersion) {
182
190
  await writeDomain({
183
191
  id: domainId,
184
192
  name: domainName,
185
193
  version: domainVersion,
186
- markdown: defaultMarkdown3(document)
187
- // services: [{ id: serviceId, version: version }],
194
+ markdown: defaultMarkdown()
188
195
  });
189
- console.log(import_chalk.default.cyan(` - Domain (v${domainVersion}) created`));
196
+ console.log(import_chalk2.default.cyan(` - Domain (v${domainVersion}) created`));
190
197
  }
191
198
  if (currentDomain && currentDomain.version === domainVersion) {
192
- console.log(import_chalk.default.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));
199
+ console.log(import_chalk2.default.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));
193
200
  }
194
201
  await addServiceToDomain(domainId, { id: serviceId, version }, domainVersion);
195
202
  }
203
+ const documentTags = document.tags || [];
204
+ let sends = [];
205
+ const receives = [];
196
206
  for (const operation of operations) {
197
- for (const message of operation.messages()) {
198
- const eventType = message.extensions().get("x-eventcatalog-message-type")?.value() || "event";
199
- const messageId = message.id().toLowerCase();
200
- let messageMarkdown = defaultMarkdown(document, message);
201
- const writeMessage = eventType === "event" ? writeEvent : writeCommand;
202
- const versionMessage = eventType === "event" ? versionEvent : versionCommand;
203
- const getMessage = eventType === "event" ? getEvent : getCommand;
204
- const rmMessageById = eventType === "event" ? rmEventById : rmCommandById;
205
- const addSchemaToMessage = eventType === "event" ? addSchemaToEvent : addSchemaToCommand;
206
- const badges = message.tags().all() || [];
207
- const catalogedMessage = await getMessage(message.id().toLowerCase(), "latest");
208
- console.log(import_chalk.default.blue(`Processing message: ${getMessageName(message)} (v${version})`));
209
- if (catalogedMessage) {
210
- messageMarkdown = catalogedMessage.markdown;
211
- if (catalogedMessage.version === version) {
212
- await rmMessageById(messageId, version);
213
- } else {
214
- await versionMessage(messageId);
215
- console.log(import_chalk.default.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));
216
- }
217
- }
218
- await writeMessage(
219
- {
220
- id: messageId,
221
- version,
222
- name: getMessageName(message),
223
- summary: getSummary(message),
224
- markdown: messageMarkdown,
225
- badges: badges.map((badge) => ({ content: badge.name(), textColor: "blue", backgroundColor: "blue" })),
226
- schemaPath: messageHasSchema(message) ? getSchemaFileName(message) : void 0
227
- },
228
- {
229
- path: message.id()
230
- }
231
- );
232
- console.log(import_chalk.default.cyan(` - Message (v${version}) created`));
233
- if (messageHasSchema(message)) {
234
- addSchemaToMessage(
235
- messageId,
236
- {
237
- fileName: getSchemaFileName(message),
238
- schema: JSON.stringify(message.payload()?.json(), null, 4)
239
- },
240
- version
241
- );
242
- console.log(import_chalk.default.cyan(` - Schema added to message (v${version})`));
243
- }
244
- if (operation.action() === "send" || operation.action() === "publish") {
245
- sends.push({ id: messageId, version });
246
- }
247
- if (operation.action() === "receive" || operation.action() === "subscribe") {
248
- receives.push({ id: messageId, version });
207
+ const messageType = operation.type;
208
+ const messageId = getMessageName(operation);
209
+ let messageMarkdown = defaultMarkdown3(operation);
210
+ const versionMessage = versionCommand;
211
+ const getMessage = messageType === "event" ? getEvent : getCommand;
212
+ const rmMessageById = messageType === "event" ? rmEventById : rmCommandById;
213
+ const writeMessage = messageType === "event" ? writeEvent : writeCommand;
214
+ const catalogedMessage = await getMessage(messageId, "latest");
215
+ console.log(import_chalk2.default.blue(`Processing message: ${getMessageName(operation)} (v${version})`));
216
+ if (catalogedMessage) {
217
+ messageMarkdown = catalogedMessage.markdown;
218
+ if (catalogedMessage.version === version) {
219
+ await rmMessageById(messageId, version);
220
+ } else {
221
+ await versionMessage(messageId);
222
+ console.log(import_chalk2.default.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));
249
223
  }
250
224
  }
225
+ await writeMessage(
226
+ {
227
+ id: messageId,
228
+ version,
229
+ name: getMessageName(operation),
230
+ summary: getSummary2(operation),
231
+ markdown: messageMarkdown,
232
+ badges: operation.tags.map((badge) => ({ content: badge, textColor: "blue", backgroundColor: "blue" }))
233
+ },
234
+ {
235
+ path: messageId
236
+ }
237
+ );
238
+ receives.push({
239
+ id: operation.operationId,
240
+ version
241
+ });
242
+ console.log(import_chalk2.default.cyan(` - Message (v${version}) created`));
251
243
  }
252
244
  const latestServiceInCatalog = await getService(serviceId, "latest");
253
- console.log(import_chalk.default.blue(`Processing service: ${document.info().title()} (v${version})`));
245
+ console.log(import_chalk2.default.blue(`Processing service: ${document.info.title} (v${version})`));
254
246
  if (latestServiceInCatalog) {
255
247
  serviceMarkdown = latestServiceInCatalog.markdown;
248
+ sends = latestServiceInCatalog.sends || [];
256
249
  if (latestServiceInCatalog.version !== version) {
257
250
  await versionService(serviceId);
258
- console.log(import_chalk.default.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));
251
+ console.log(import_chalk2.default.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));
259
252
  }
260
253
  if (latestServiceInCatalog.version === version) {
261
- serviceMarkdown = latestServiceInCatalog.markdown;
262
- await rmService(document.info().title());
254
+ await rmService(document.info.title);
263
255
  }
264
256
  }
265
257
  await writeService(
266
258
  {
267
259
  id: serviceId,
268
- name: document.info().title(),
260
+ name: document.info.title,
269
261
  version,
270
- summary: getSummary2(document),
271
- badges: documentTags.map((tag) => ({ content: tag.name(), textColor: "blue", backgroundColor: "blue" })),
262
+ summary: getSummary(document),
263
+ badges: documentTags.map((tag) => ({ content: tag.name, textColor: "blue", backgroundColor: "blue" })),
272
264
  markdown: serviceMarkdown,
273
265
  sends,
274
- schemaPath: path.split("/").pop() || "asyncapi.yml",
266
+ schemaPath: path.split("/").pop() || "openapi.yml",
275
267
  receives
276
268
  },
277
- { path: document.info().title() }
269
+ { path: document.info.title }
278
270
  );
279
271
  await addFileToService(
280
272
  serviceId,
281
273
  {
282
- fileName: path.split("/").pop() || "asyncapi.yml",
283
- content: asyncAPIFile
274
+ fileName: path.split("/").pop() || "openapi.yml",
275
+ content: openAPIFile
284
276
  },
285
277
  version
286
278
  );
287
- console.log(import_chalk.default.cyan(` - Service (v${version}) created`));
288
- console.log(import_chalk.default.green(`
289
- Finished generating event catalog for AsyncAPI ${document.info().title()} (v${version})`));
279
+ console.log(import_chalk2.default.cyan(` - Service (v${version}) created`));
280
+ console.log(import_chalk2.default.green(`
281
+ Finished generating event catalog for AsyncAPI ${document.info.title} (v${version})`));
290
282
  }
283
+ await checkLicense_default();
291
284
  };
292
285
  //# sourceMappingURL=index.js.map