@eventcatalog/generator-asyncapi 4.1.0 → 4.2.1
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.js +1275 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1286 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/dist/checkLicense.d.mts +0 -3
- package/dist/checkLicense.d.ts +0 -3
- package/dist/checkLicense.js +0 -152
- package/dist/checkLicense.js.map +0 -1
- package/dist/checkLicense.mjs +0 -121
- package/dist/checkLicense.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventcatalog/generator-asyncapi",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "AsyncAPI generator for EventCatalog",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -30,12 +30,11 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
32
32
|
"@asyncapi/parser": "^3.3.0",
|
|
33
|
-
"@eventcatalog/sdk": "^2.
|
|
33
|
+
"@eventcatalog/sdk": "^2.5.5",
|
|
34
34
|
"chalk": "^4",
|
|
35
35
|
"fs-extra": "^11.2.0",
|
|
36
36
|
"glob": "^11.0.0",
|
|
37
37
|
"gray-matter": "^4.0.3",
|
|
38
|
-
"https-proxy-agent": "^7.0.6",
|
|
39
38
|
"js-yaml": "^4.1.0",
|
|
40
39
|
"lodash": "^4.17.21",
|
|
41
40
|
"minimist": "^1.2.8",
|
package/dist/checkLicense.d.mts
DELETED
package/dist/checkLicense.d.ts
DELETED
package/dist/checkLicense.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
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_node_fetch = __toESM(require("node-fetch"));
|
|
37
|
-
var import_https_proxy_agent = require("https-proxy-agent");
|
|
38
|
-
var import_chalk = __toESM(require("chalk"));
|
|
39
|
-
|
|
40
|
-
// package.json
|
|
41
|
-
var package_default = {
|
|
42
|
-
name: "@eventcatalog/generator-asyncapi",
|
|
43
|
-
version: "4.1.0",
|
|
44
|
-
description: "AsyncAPI generator for EventCatalog",
|
|
45
|
-
scripts: {
|
|
46
|
-
build: "tsup",
|
|
47
|
-
test: "vitest",
|
|
48
|
-
format: "prettier --write .",
|
|
49
|
-
"format:diff": "prettier --list-different .",
|
|
50
|
-
changeset: "changeset",
|
|
51
|
-
release: "changeset publish"
|
|
52
|
-
},
|
|
53
|
-
publishConfig: {
|
|
54
|
-
access: "public"
|
|
55
|
-
},
|
|
56
|
-
keywords: [],
|
|
57
|
-
author: "",
|
|
58
|
-
license: "ISC",
|
|
59
|
-
devDependencies: {
|
|
60
|
-
"@changesets/cli": "^2.27.9",
|
|
61
|
-
"@types/fs-extra": "^11.0.4",
|
|
62
|
-
"@types/js-yaml": "^4.0.9",
|
|
63
|
-
"@types/lodash": "^4.17.7",
|
|
64
|
-
"@types/minimist": "^1.2.5",
|
|
65
|
-
"@types/node": "^20.16.1",
|
|
66
|
-
prettier: "^3.3.3",
|
|
67
|
-
tsup: "^8.1.0",
|
|
68
|
-
typescript: "^5.5.3",
|
|
69
|
-
vitest: "^2.0.2"
|
|
70
|
-
},
|
|
71
|
-
files: [
|
|
72
|
-
"dist",
|
|
73
|
-
"package.json"
|
|
74
|
-
],
|
|
75
|
-
main: "./dist/index.js",
|
|
76
|
-
module: "./dist/index.mjs",
|
|
77
|
-
types: "./dist/index.d.ts",
|
|
78
|
-
dependencies: {
|
|
79
|
-
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
80
|
-
"@asyncapi/parser": "^3.3.0",
|
|
81
|
-
"@eventcatalog/sdk": "^2.2.6",
|
|
82
|
-
chalk: "^4",
|
|
83
|
-
"fs-extra": "^11.2.0",
|
|
84
|
-
glob: "^11.0.0",
|
|
85
|
-
"gray-matter": "^4.0.3",
|
|
86
|
-
"https-proxy-agent": "^7.0.6",
|
|
87
|
-
"js-yaml": "^4.1.0",
|
|
88
|
-
lodash: "^4.17.21",
|
|
89
|
-
minimist: "^1.2.8",
|
|
90
|
-
"node-fetch": "^3.3.2",
|
|
91
|
-
slugify: "^1.6.6",
|
|
92
|
-
"update-notifier": "^7.3.1",
|
|
93
|
-
zod: "^3.23.8"
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// src/checkLicense.ts
|
|
98
|
-
var checkLicense_default = async (licenseKey) => {
|
|
99
|
-
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
|
|
100
|
-
const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;
|
|
101
|
-
if (!LICENSE_KEY) {
|
|
102
|
-
console.log(import_chalk.default.bgRed(`
|
|
103
|
-
This plugin requires a license key to use`));
|
|
104
|
-
console.log(import_chalk.default.redBright(`
|
|
105
|
-
Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
const fetchOptions = {
|
|
109
|
-
method: "POST",
|
|
110
|
-
headers: {
|
|
111
|
-
Authorization: `Bearer ${LICENSE_KEY}`,
|
|
112
|
-
"Content-Type": "application/json"
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
let response;
|
|
116
|
-
try {
|
|
117
|
-
if (PROXY_SERVER_URI) {
|
|
118
|
-
const proxyAgent = new import_https_proxy_agent.HttpsProxyAgent(PROXY_SERVER_URI);
|
|
119
|
-
fetchOptions.agent = proxyAgent;
|
|
120
|
-
}
|
|
121
|
-
response = await (0, import_node_fetch.default)("https://api.eventcatalog.cloud/functions/v1/license", fetchOptions);
|
|
122
|
-
} catch (err) {
|
|
123
|
-
console.log(
|
|
124
|
-
import_chalk.default.redBright(
|
|
125
|
-
"Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings."
|
|
126
|
-
)
|
|
127
|
-
);
|
|
128
|
-
console.log(import_chalk.default.red(`Error details: ${err?.message || err}`));
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
if (response.status !== 200) {
|
|
132
|
-
console.log(import_chalk.default.bgRed(`
|
|
133
|
-
Invalid license key`));
|
|
134
|
-
console.log(import_chalk.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
if (response.status === 200) {
|
|
138
|
-
const data = await response.json();
|
|
139
|
-
if (package_default.name !== data.plugin) {
|
|
140
|
-
console.log(import_chalk.default.bgRed(`
|
|
141
|
-
Invalid license key for this plugin`));
|
|
142
|
-
console.log(import_chalk.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
143
|
-
process.exit(1);
|
|
144
|
-
}
|
|
145
|
-
if (data.is_trial) {
|
|
146
|
-
console.log(import_chalk.default.bgBlue(`
|
|
147
|
-
You are using a trial license for this plugin`));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return Promise.resolve();
|
|
151
|
-
};
|
|
152
|
-
//# sourceMappingURL=checkLicense.js.map
|
package/dist/checkLicense.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/checkLicense.ts","../package.json"],"sourcesContent":["import fetch from 'node-fetch';\nimport { HttpsProxyAgent } from 'https-proxy-agent';\nimport chalk from 'chalk';\nimport pkg from '../package.json';\n\ntype LicenseResponse = {\n is_trial: boolean;\n plugin: string;\n state: string;\n};\n\nexport default async (licenseKey?: string) => {\n const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;\n const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;\n\n if (!LICENSE_KEY) {\n console.log(chalk.bgRed(`\\nThis plugin requires a license key to use`));\n console.log(chalk.redBright(`\\nVisit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));\n process.exit(1);\n }\n\n // Verify the license key\n const fetchOptions: any = {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${LICENSE_KEY}`,\n 'Content-Type': 'application/json',\n },\n };\n let response: any;\n try {\n if (PROXY_SERVER_URI) {\n const proxyAgent = new HttpsProxyAgent(PROXY_SERVER_URI);\n fetchOptions.agent = proxyAgent;\n }\n response = await fetch('https://api.eventcatalog.cloud/functions/v1/license', fetchOptions);\n } catch (err: any) {\n console.log(\n chalk.redBright(\n 'Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings.'\n )\n );\n console.log(chalk.red(`Error details: ${err?.message || err}`));\n process.exit(1);\n }\n\n if (response.status !== 200) {\n console.log(chalk.bgRed(`\\nInvalid license key`));\n console.log(chalk.redBright('Please check your plugin license key or purchase a license at https://eventcatalog.cloud/'));\n process.exit(1);\n }\n\n if (response.status === 200) {\n const data = (await response.json()) as LicenseResponse;\n\n if (pkg.name !== data.plugin) {\n console.log(chalk.bgRed(`\\nInvalid license key for this plugin`));\n console.log(chalk.redBright('Please check your plugin license key or purchase a license at https://eventcatalog.cloud/'));\n process.exit(1);\n }\n\n if (data.is_trial) {\n console.log(chalk.bgBlue(`\\nYou are using a trial license for this plugin`));\n }\n }\n\n return Promise.resolve();\n};\n","{\n \"name\": \"@eventcatalog/generator-asyncapi\",\n \"version\": \"4.1.0\",\n \"description\": \"AsyncAPI generator for EventCatalog\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"test\": \"vitest\",\n \"format\": \"prettier --write .\",\n \"format:diff\": \"prettier --list-different .\",\n \"changeset\": \"changeset\",\n \"release\": \"changeset publish\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.27.9\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/lodash\": \"^4.17.7\",\n \"@types/minimist\": \"^1.2.5\",\n \"@types/node\": \"^20.16.1\",\n \"prettier\": \"^3.3.3\",\n \"tsup\": \"^8.1.0\",\n \"typescript\": \"^5.5.3\",\n \"vitest\": \"^2.0.2\"\n },\n \"files\": [\n \"dist\",\n \"package.json\"\n ],\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"dependencies\": {\n \"@asyncapi/avro-schema-parser\": \"^3.0.24\",\n \"@asyncapi/parser\": \"^3.3.0\",\n \"@eventcatalog/sdk\": \"^2.2.6\",\n \"chalk\": \"^4\",\n \"fs-extra\": \"^11.2.0\",\n \"glob\": \"^11.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"https-proxy-agent\": \"^7.0.6\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"minimist\": \"^1.2.8\",\n \"node-fetch\": \"^3.3.2\",\n \"slugify\": \"^1.6.6\",\n \"update-notifier\": \"^7.3.1\",\n \"zod\": \"^3.23.8\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAkB;AAClB,+BAAgC;AAChC,mBAAkB;;;ACFlB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,eAAe;AAAA,IACf,WAAa;AAAA,IACb,SAAW;AAAA,EACb;AAAA,EACA,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,UAAY,CAAC;AAAA,EACb,QAAU;AAAA,EACV,SAAW;AAAA,EACX,iBAAmB;AAAA,IACjB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,UAAY;AAAA,IACZ,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,QAAU;AAAA,EACZ;AAAA,E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,KAAK;AAC3B,YAAQ,IAAI,aAAAA,QAAM,MAAM;AAAA,oBAAuB,CAAC;AAChD,YAAQ,IAAI,aAAAA,QAAM,UAAU,2FAA2F,CAAC;AACxH,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,MAAI,SAAS,WAAW,KAAK;AAC3B,UAAM,OAAQ,MAAM,SAAS,KAAK;AAElC,QAAI,gBAAI,SAAS,KAAK,QAAQ;AAC5B,cAAQ,IAAI,aAAAA,QAAM,MAAM;AAAA,oCAAuC,CAAC;AAChE,cAAQ,IAAI,aAAAA,QAAM,UAAU,2FAA2F,CAAC;AACxH,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI,KAAK,UAAU;AACjB,cAAQ,IAAI,aAAAA,QAAM,OAAO;AAAA,8CAAiD,CAAC;AAAA,IAC7E;AAAA,EACF;AAEA,SAAO,QAAQ,QAAQ;AACzB;","names":["chalk","fetch"]}
|
package/dist/checkLicense.mjs
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
// src/checkLicense.ts
|
|
2
|
-
import fetch from "node-fetch";
|
|
3
|
-
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
|
|
6
|
-
// package.json
|
|
7
|
-
var package_default = {
|
|
8
|
-
name: "@eventcatalog/generator-asyncapi",
|
|
9
|
-
version: "4.1.0",
|
|
10
|
-
description: "AsyncAPI generator for EventCatalog",
|
|
11
|
-
scripts: {
|
|
12
|
-
build: "tsup",
|
|
13
|
-
test: "vitest",
|
|
14
|
-
format: "prettier --write .",
|
|
15
|
-
"format:diff": "prettier --list-different .",
|
|
16
|
-
changeset: "changeset",
|
|
17
|
-
release: "changeset publish"
|
|
18
|
-
},
|
|
19
|
-
publishConfig: {
|
|
20
|
-
access: "public"
|
|
21
|
-
},
|
|
22
|
-
keywords: [],
|
|
23
|
-
author: "",
|
|
24
|
-
license: "ISC",
|
|
25
|
-
devDependencies: {
|
|
26
|
-
"@changesets/cli": "^2.27.9",
|
|
27
|
-
"@types/fs-extra": "^11.0.4",
|
|
28
|
-
"@types/js-yaml": "^4.0.9",
|
|
29
|
-
"@types/lodash": "^4.17.7",
|
|
30
|
-
"@types/minimist": "^1.2.5",
|
|
31
|
-
"@types/node": "^20.16.1",
|
|
32
|
-
prettier: "^3.3.3",
|
|
33
|
-
tsup: "^8.1.0",
|
|
34
|
-
typescript: "^5.5.3",
|
|
35
|
-
vitest: "^2.0.2"
|
|
36
|
-
},
|
|
37
|
-
files: [
|
|
38
|
-
"dist",
|
|
39
|
-
"package.json"
|
|
40
|
-
],
|
|
41
|
-
main: "./dist/index.js",
|
|
42
|
-
module: "./dist/index.mjs",
|
|
43
|
-
types: "./dist/index.d.ts",
|
|
44
|
-
dependencies: {
|
|
45
|
-
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
46
|
-
"@asyncapi/parser": "^3.3.0",
|
|
47
|
-
"@eventcatalog/sdk": "^2.2.6",
|
|
48
|
-
chalk: "^4",
|
|
49
|
-
"fs-extra": "^11.2.0",
|
|
50
|
-
glob: "^11.0.0",
|
|
51
|
-
"gray-matter": "^4.0.3",
|
|
52
|
-
"https-proxy-agent": "^7.0.6",
|
|
53
|
-
"js-yaml": "^4.1.0",
|
|
54
|
-
lodash: "^4.17.21",
|
|
55
|
-
minimist: "^1.2.8",
|
|
56
|
-
"node-fetch": "^3.3.2",
|
|
57
|
-
slugify: "^1.6.6",
|
|
58
|
-
"update-notifier": "^7.3.1",
|
|
59
|
-
zod: "^3.23.8"
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// src/checkLicense.ts
|
|
64
|
-
var checkLicense_default = async (licenseKey) => {
|
|
65
|
-
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
|
|
66
|
-
const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;
|
|
67
|
-
if (!LICENSE_KEY) {
|
|
68
|
-
console.log(chalk.bgRed(`
|
|
69
|
-
This plugin requires a license key to use`));
|
|
70
|
-
console.log(chalk.redBright(`
|
|
71
|
-
Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
const fetchOptions = {
|
|
75
|
-
method: "POST",
|
|
76
|
-
headers: {
|
|
77
|
-
Authorization: `Bearer ${LICENSE_KEY}`,
|
|
78
|
-
"Content-Type": "application/json"
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
let response;
|
|
82
|
-
try {
|
|
83
|
-
if (PROXY_SERVER_URI) {
|
|
84
|
-
const proxyAgent = new HttpsProxyAgent(PROXY_SERVER_URI);
|
|
85
|
-
fetchOptions.agent = proxyAgent;
|
|
86
|
-
}
|
|
87
|
-
response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", fetchOptions);
|
|
88
|
-
} catch (err) {
|
|
89
|
-
console.log(
|
|
90
|
-
chalk.redBright(
|
|
91
|
-
"Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings."
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
console.log(chalk.red(`Error details: ${err?.message || err}`));
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
if (response.status !== 200) {
|
|
98
|
-
console.log(chalk.bgRed(`
|
|
99
|
-
Invalid license key`));
|
|
100
|
-
console.log(chalk.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
if (response.status === 200) {
|
|
104
|
-
const data = await response.json();
|
|
105
|
-
if (package_default.name !== data.plugin) {
|
|
106
|
-
console.log(chalk.bgRed(`
|
|
107
|
-
Invalid license key for this plugin`));
|
|
108
|
-
console.log(chalk.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
if (data.is_trial) {
|
|
112
|
-
console.log(chalk.bgBlue(`
|
|
113
|
-
You are using a trial license for this plugin`));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return Promise.resolve();
|
|
117
|
-
};
|
|
118
|
-
export {
|
|
119
|
-
checkLicense_default as default
|
|
120
|
-
};
|
|
121
|
-
//# sourceMappingURL=checkLicense.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/checkLicense.ts","../package.json"],"sourcesContent":["import fetch from 'node-fetch';\nimport { HttpsProxyAgent } from 'https-proxy-agent';\nimport chalk from 'chalk';\nimport pkg from '../package.json';\n\ntype LicenseResponse = {\n is_trial: boolean;\n plugin: string;\n state: string;\n};\n\nexport default async (licenseKey?: string) => {\n const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;\n const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;\n\n if (!LICENSE_KEY) {\n console.log(chalk.bgRed(`\\nThis plugin requires a license key to use`));\n console.log(chalk.redBright(`\\nVisit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));\n process.exit(1);\n }\n\n // Verify the license key\n const fetchOptions: any = {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${LICENSE_KEY}`,\n 'Content-Type': 'application/json',\n },\n };\n let response: any;\n try {\n if (PROXY_SERVER_URI) {\n const proxyAgent = new HttpsProxyAgent(PROXY_SERVER_URI);\n fetchOptions.agent = proxyAgent;\n }\n response = await fetch('https://api.eventcatalog.cloud/functions/v1/license', fetchOptions);\n } catch (err: any) {\n console.log(\n chalk.redBright(\n 'Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings.'\n )\n );\n console.log(chalk.red(`Error details: ${err?.message || err}`));\n process.exit(1);\n }\n\n if (response.status !== 200) {\n console.log(chalk.bgRed(`\\nInvalid license key`));\n console.log(chalk.redBright('Please check your plugin license key or purchase a license at https://eventcatalog.cloud/'));\n process.exit(1);\n }\n\n if (response.status === 200) {\n const data = (await response.json()) as LicenseResponse;\n\n if (pkg.name !== data.plugin) {\n console.log(chalk.bgRed(`\\nInvalid license key for this plugin`));\n console.log(chalk.redBright('Please check your plugin license key or purchase a license at https://eventcatalog.cloud/'));\n process.exit(1);\n }\n\n if (data.is_trial) {\n console.log(chalk.bgBlue(`\\nYou are using a trial license for this plugin`));\n }\n }\n\n return Promise.resolve();\n};\n","{\n \"name\": \"@eventcatalog/generator-asyncapi\",\n \"version\": \"4.1.0\",\n \"description\": \"AsyncAPI generator for EventCatalog\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"test\": \"vitest\",\n \"format\": \"prettier --write .\",\n \"format:diff\": \"prettier --list-different .\",\n \"changeset\": \"changeset\",\n \"release\": \"changeset publish\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.27.9\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/lodash\": \"^4.17.7\",\n \"@types/minimist\": \"^1.2.5\",\n \"@types/node\": \"^20.16.1\",\n \"prettier\": \"^3.3.3\",\n \"tsup\": \"^8.1.0\",\n \"typescript\": \"^5.5.3\",\n \"vitest\": \"^2.0.2\"\n },\n \"files\": [\n \"dist\",\n \"package.json\"\n ],\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"dependencies\": {\n \"@asyncapi/avro-schema-parser\": \"^3.0.24\",\n \"@asyncapi/parser\": \"^3.3.0\",\n \"@eventcatalog/sdk\": \"^2.2.6\",\n \"chalk\": \"^4\",\n \"fs-extra\": \"^11.2.0\",\n \"glob\": \"^11.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"https-proxy-agent\": \"^7.0.6\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"minimist\": \"^1.2.8\",\n \"node-fetch\": \"^3.3.2\",\n \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