@eventcatalog/generator-asyncapi 4.0.3 → 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/README.md +11 -0
- package/dist/checkLicense.js +24 -3
- package/dist/checkLicense.js.map +1 -1
- package/dist/checkLicense.mjs +24 -3
- package/dist/checkLicense.mjs.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
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
|
|
293
|
+
version: "4.1.0",
|
|
294
294
|
description: "AsyncAPI generator for EventCatalog",
|
|
295
295
|
scripts: {
|
|
296
296
|
build: "tsup",
|
|
@@ -333,9 +333,11 @@ var package_default = {
|
|
|
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
|
|
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`));
|