@eventcatalog/generator-asyncapi 4.0.2 → 4.1.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.mjs CHANGED
@@ -290,7 +290,7 @@ import path2 from "path";
290
290
  // package.json
291
291
  var package_default = {
292
292
  name: "@eventcatalog/generator-asyncapi",
293
- version: "4.0.2",
293
+ version: "4.1.0",
294
294
  description: "AsyncAPI generator for EventCatalog",
295
295
  scripts: {
296
296
  build: "tsup",
@@ -328,14 +328,16 @@ var package_default = {
328
328
  dependencies: {
329
329
  "@asyncapi/avro-schema-parser": "^3.0.24",
330
330
  "@asyncapi/parser": "^3.3.0",
331
- "@eventcatalog/sdk": "^2.2.4",
331
+ "@eventcatalog/sdk": "^2.2.6",
332
332
  chalk: "^4",
333
333
  "fs-extra": "^11.2.0",
334
334
  glob: "^11.0.0",
335
335
  "gray-matter": "^4.0.3",
336
+ "https-proxy-agent": "^7.0.6",
336
337
  "js-yaml": "^4.1.0",
337
338
  lodash: "^4.17.21",
338
339
  minimist: "^1.2.8",
340
+ "node-fetch": "^3.3.2",
339
341
  slugify: "^1.6.6",
340
342
  "update-notifier": "^7.3.1",
341
343
  zod: "^3.23.8"
@@ -1340,9 +1342,12 @@ var defaultMarkdown4 = (_document, channel) => {
1340
1342
  };
1341
1343
 
1342
1344
  // src/checkLicense.ts
1345
+ import fetch2 from "node-fetch";
1346
+ import { HttpsProxyAgent } from "https-proxy-agent";
1343
1347
  import chalk2 from "chalk";
1344
1348
  var checkLicense_default = async (licenseKey) => {
1345
1349
  const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
1350
+ const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;
1346
1351
  if (!LICENSE_KEY) {
1347
1352
  console.log(chalk2.bgRed(`
1348
1353
  This plugin requires a license key to use`));
@@ -1350,13 +1355,29 @@ This plugin requires a license key to use`));
1350
1355
  Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
1351
1356
  process.exit(1);
1352
1357
  }
1353
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
1358
+ const fetchOptions = {
1354
1359
  method: "POST",
1355
1360
  headers: {
1356
1361
  Authorization: `Bearer ${LICENSE_KEY}`,
1357
1362
  "Content-Type": "application/json"
1358
1363
  }
1359
- });
1364
+ };
1365
+ let response;
1366
+ try {
1367
+ if (PROXY_SERVER_URI) {
1368
+ const proxyAgent = new HttpsProxyAgent(PROXY_SERVER_URI);
1369
+ fetchOptions.agent = proxyAgent;
1370
+ }
1371
+ response = await fetch2("https://api.eventcatalog.cloud/functions/v1/license", fetchOptions);
1372
+ } catch (err) {
1373
+ console.log(
1374
+ chalk2.redBright(
1375
+ "Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings."
1376
+ )
1377
+ );
1378
+ console.log(chalk2.red(`Error details: ${err?.message || err}`));
1379
+ process.exit(1);
1380
+ }
1360
1381
  if (response.status !== 200) {
1361
1382
  console.log(chalk2.bgRed(`
1362
1383
  Invalid license key`));
@@ -1584,6 +1605,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
1584
1605
  for (const message of operation.messages()) {
1585
1606
  const eventType = message.extensions().get("x-eventcatalog-message-type")?.value() || "event";
1586
1607
  const messageVersion = message.extensions().get("x-eventcatalog-message-version")?.value() || version;
1608
+ const deprecatedDate = message.extensions().get("x-eventcatalog-deprecated-date")?.value() || null;
1609
+ const deprecatedMessage = message.extensions().get("x-eventcatalog-deprecated-message")?.value() || null;
1587
1610
  const serviceOwnsMessageContract = isServiceMessageOwner(message);
1588
1611
  const isReceived = operation.action() === "receive" || operation.action() === "subscribe";
1589
1612
  const isSent = operation.action() === "send" || operation.action() === "publish";
@@ -1625,7 +1648,10 @@ Processing domain: ${domainName} (v${domainVersion})`));
1625
1648
  badges: badges.map((badge) => ({ content: badge.name(), textColor: "blue", backgroundColor: "blue" })),
1626
1649
  ...messageHasSchema(message) && { schemaPath: getSchemaFileName(message) },
1627
1650
  ...owners && { owners },
1628
- ...channelsForMessage.length > 0 && { channels: channelsForMessage }
1651
+ ...channelsForMessage.length > 0 && { channels: channelsForMessage },
1652
+ ...deprecatedDate && {
1653
+ deprecated: { date: deprecatedDate, ...deprecatedMessage && { message: deprecatedMessage } }
1654
+ }
1629
1655
  },
1630
1656
  {
1631
1657
  override: true,