@eventcatalog/generator-asyncapi 2.7.2 → 2.8.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 CHANGED
@@ -6,7 +6,7 @@
6
6
  <img src="https://img.shields.io/github/actions/workflow/status/event-catalog/generator-asyncapi/verify-build.yml"/>
7
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
- <img alt="header" src="./images/asyncapi.jpeg" />
9
+ <img alt="header" src="https://github.com/event-catalog/generators/blob/main/images/asyncapi.jpeg?raw=true" />
10
10
 
11
11
  <h4>Features: Generate EventCatalogs with your AsyncAPI files, Auto versioning, schema downloads, map to domains, custom AsyncAPI extensions and more... </h4>
12
12
 
@@ -154,4 +154,4 @@ You can find the [contributing guidelines here](https://eventcatalog.dev/docs/co
154
154
 
155
155
  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).
156
156
 
157
- You can purchase a license at https://dashboard.eventcatalog.dev or email us at `hello@eventcatalog.dev`
157
+ You can purchase a license or get a free trial at https://eventcatalog.cloud or email us at `hello@eventcatalog.dev`.
@@ -1,3 +1,3 @@
1
- declare const _default: () => void;
1
+ declare const _default: (licenseKey?: string) => Promise<void>;
2
2
 
3
3
  export { _default as default };
@@ -1,3 +1,3 @@
1
- declare const _default: () => void;
1
+ declare const _default: (licenseKey?: string) => Promise<void>;
2
2
 
3
3
  export { _default as default };
@@ -34,14 +34,97 @@ __export(checkLicense_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(checkLicense_exports);
36
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, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`
44
- )
45
- );
37
+
38
+ // package.json
39
+ var package_default = {
40
+ name: "@eventcatalog/generator-asyncapi",
41
+ version: "2.8.0",
42
+ description: "AsyncAPI generator for EventCatalog",
43
+ scripts: {
44
+ build: "tsup",
45
+ test: "vitest",
46
+ format: "prettier --write .",
47
+ "format:diff": "prettier --list-different .",
48
+ changeset: "changeset",
49
+ release: "changeset publish"
50
+ },
51
+ publishConfig: {
52
+ access: "public"
53
+ },
54
+ keywords: [],
55
+ author: "",
56
+ license: "ISC",
57
+ devDependencies: {
58
+ "@changesets/cli": "^2.27.9",
59
+ "@types/fs-extra": "^11.0.4",
60
+ "@types/js-yaml": "^4.0.9",
61
+ "@types/lodash": "^4.17.7",
62
+ "@types/minimist": "^1.2.5",
63
+ "@types/node": "^20.16.1",
64
+ prettier: "^3.3.3",
65
+ tsup: "^8.1.0",
66
+ typescript: "^5.5.3",
67
+ vitest: "^2.0.2"
68
+ },
69
+ files: [
70
+ "dist",
71
+ "package.json"
72
+ ],
73
+ main: "./dist/index.js",
74
+ module: "./dist/index.mjs",
75
+ types: "./dist/index.d.ts",
76
+ dependencies: {
77
+ "@asyncapi/avro-schema-parser": "^3.0.24",
78
+ "@asyncapi/parser": "^3.3.0",
79
+ "@eventcatalog/sdk": "^1.4.8",
80
+ chalk: "^4",
81
+ "fs-extra": "^11.2.0",
82
+ glob: "^11.0.0",
83
+ "gray-matter": "^4.0.3",
84
+ "js-yaml": "^4.1.0",
85
+ lodash: "^4.17.21",
86
+ minimist: "^1.2.8",
87
+ slugify: "^1.6.6",
88
+ zod: "^3.23.8"
89
+ }
90
+ };
91
+
92
+ // src/checkLicense.ts
93
+ var checkLicense_default = async (licenseKey) => {
94
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
95
+ if (!LICENSE_KEY) {
96
+ console.log(import_chalk.default.bgRed(`
97
+ This plugin requires a license key to use`));
98
+ console.log(import_chalk.default.redBright(`
99
+ Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
100
+ process.exit(1);
101
+ }
102
+ const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
103
+ method: "POST",
104
+ headers: {
105
+ Authorization: `Bearer ${LICENSE_KEY}`,
106
+ "Content-Type": "application/json"
107
+ }
108
+ });
109
+ if (response.status !== 200) {
110
+ console.log(import_chalk.default.bgRed(`
111
+ Invalid license key`));
112
+ console.log(import_chalk.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
113
+ process.exit(1);
114
+ }
115
+ if (response.status === 200) {
116
+ const data = await response.json();
117
+ if (package_default.name !== data.plugin) {
118
+ console.log(import_chalk.default.bgRed(`
119
+ Invalid license key for this plugin`));
120
+ console.log(import_chalk.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
121
+ process.exit(1);
122
+ }
123
+ if (data.is_trial) {
124
+ console.log(import_chalk.default.bgBlue(`
125
+ You are using a trial license for this plugin`));
126
+ }
127
+ }
128
+ return Promise.resolve();
46
129
  };
47
130
  //# sourceMappingURL=checkLicense.js.map
@@ -1 +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, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`\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"]}
1
+ {"version":3,"sources":["../src/checkLicense.ts","../package.json"],"sourcesContent":["import 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\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 response = await fetch('https://api.eventcatalog.cloud/functions/v1/license', {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${LICENSE_KEY}`,\n 'Content-Type': 'application/json',\n },\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\": \"2.8.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\": \"^1.4.8\",\n \"chalk\": \"^4\",\n \"fs-extra\": \"^11.2.0\",\n \"glob\": \"^11.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"minimist\": \"^1.2.8\",\n \"slugify\": \"^1.6.6\",\n \"zod\": \"^3.23.8\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;;;ACAlB;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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,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"]}
@@ -1,14 +1,97 @@
1
1
  // src/checkLicense.ts
2
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, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`
10
- )
11
- );
3
+
4
+ // package.json
5
+ var package_default = {
6
+ name: "@eventcatalog/generator-asyncapi",
7
+ version: "2.8.0",
8
+ description: "AsyncAPI generator for EventCatalog",
9
+ scripts: {
10
+ build: "tsup",
11
+ test: "vitest",
12
+ format: "prettier --write .",
13
+ "format:diff": "prettier --list-different .",
14
+ changeset: "changeset",
15
+ release: "changeset publish"
16
+ },
17
+ publishConfig: {
18
+ access: "public"
19
+ },
20
+ keywords: [],
21
+ author: "",
22
+ license: "ISC",
23
+ devDependencies: {
24
+ "@changesets/cli": "^2.27.9",
25
+ "@types/fs-extra": "^11.0.4",
26
+ "@types/js-yaml": "^4.0.9",
27
+ "@types/lodash": "^4.17.7",
28
+ "@types/minimist": "^1.2.5",
29
+ "@types/node": "^20.16.1",
30
+ prettier: "^3.3.3",
31
+ tsup: "^8.1.0",
32
+ typescript: "^5.5.3",
33
+ vitest: "^2.0.2"
34
+ },
35
+ files: [
36
+ "dist",
37
+ "package.json"
38
+ ],
39
+ main: "./dist/index.js",
40
+ module: "./dist/index.mjs",
41
+ types: "./dist/index.d.ts",
42
+ dependencies: {
43
+ "@asyncapi/avro-schema-parser": "^3.0.24",
44
+ "@asyncapi/parser": "^3.3.0",
45
+ "@eventcatalog/sdk": "^1.4.8",
46
+ chalk: "^4",
47
+ "fs-extra": "^11.2.0",
48
+ glob: "^11.0.0",
49
+ "gray-matter": "^4.0.3",
50
+ "js-yaml": "^4.1.0",
51
+ lodash: "^4.17.21",
52
+ minimist: "^1.2.8",
53
+ slugify: "^1.6.6",
54
+ zod: "^3.23.8"
55
+ }
56
+ };
57
+
58
+ // src/checkLicense.ts
59
+ var checkLicense_default = async (licenseKey) => {
60
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
61
+ if (!LICENSE_KEY) {
62
+ console.log(chalk.bgRed(`
63
+ This plugin requires a license key to use`));
64
+ console.log(chalk.redBright(`
65
+ Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
66
+ process.exit(1);
67
+ }
68
+ const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
69
+ method: "POST",
70
+ headers: {
71
+ Authorization: `Bearer ${LICENSE_KEY}`,
72
+ "Content-Type": "application/json"
73
+ }
74
+ });
75
+ if (response.status !== 200) {
76
+ console.log(chalk.bgRed(`
77
+ Invalid license key`));
78
+ console.log(chalk.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
79
+ process.exit(1);
80
+ }
81
+ if (response.status === 200) {
82
+ const data = await response.json();
83
+ if (package_default.name !== data.plugin) {
84
+ console.log(chalk.bgRed(`
85
+ Invalid license key for this plugin`));
86
+ console.log(chalk.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
87
+ process.exit(1);
88
+ }
89
+ if (data.is_trial) {
90
+ console.log(chalk.bgBlue(`
91
+ You are using a trial license for this plugin`));
92
+ }
93
+ }
94
+ return Promise.resolve();
12
95
  };
13
96
  export {
14
97
  checkLicense_default as default
@@ -1 +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, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`\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":[]}
1
+ {"version":3,"sources":["../src/checkLicense.ts","../package.json"],"sourcesContent":["import 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\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 response = await fetch('https://api.eventcatalog.cloud/functions/v1/license', {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${LICENSE_KEY}`,\n 'Content-Type': 'application/json',\n },\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\": \"2.8.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\": \"^1.4.8\",\n \"chalk\": \"^4\",\n \"fs-extra\": \"^11.2.0\",\n \"glob\": \"^11.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"minimist\": \"^1.2.8\",\n \"slugify\": \"^1.6.6\",\n \"zod\": \"^3.23.8\"\n }\n}\n"],"mappings":";AAAA,OAAO,WAAW;;;ACAlB;AAAA,EACE,MAAQ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A,EACF,CAAC;AAED,MAAI,SAAS,WAAW,KAAK;AAC3B,YAAQ,IAAI,MAAM,MAAM;AAAA,oBAAuB,CAAC;AAChD,YAAQ,IAAI,MAAM,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,MAAM,MAAM;AAAA,oCAAuC,CAAC;AAChE,cAAQ,IAAI,MAAM,UAAU,2FAA2F,CAAC;AACxH,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI,KAAK,UAAU;AACjB,cAAQ,IAAI,MAAM,OAAO;AAAA,8CAAiD,CAAC;AAAA,IAC7E;AAAA,EACF;AAEA,SAAO,QAAQ,QAAQ;AACzB;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  declare const optionsSchema: z.ZodObject<{
4
+ licenseKey: z.ZodOptional<z.ZodString>;
4
5
  services: z.ZodArray<z.ZodObject<{
5
6
  id: z.ZodString;
6
7
  path: z.ZodString;
@@ -37,6 +38,7 @@ declare const optionsSchema: z.ZodObject<{
37
38
  id: string;
38
39
  name?: string | undefined;
39
40
  }[];
41
+ licenseKey?: string | undefined;
40
42
  domain?: {
41
43
  id: string;
42
44
  name: string;
@@ -52,6 +54,7 @@ declare const optionsSchema: z.ZodObject<{
52
54
  id: string;
53
55
  name?: string | undefined;
54
56
  }[];
57
+ licenseKey?: string | undefined;
55
58
  domain?: {
56
59
  id: string;
57
60
  name: string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  declare const optionsSchema: z.ZodObject<{
4
+ licenseKey: z.ZodOptional<z.ZodString>;
4
5
  services: z.ZodArray<z.ZodObject<{
5
6
  id: z.ZodString;
6
7
  path: z.ZodString;
@@ -37,6 +38,7 @@ declare const optionsSchema: z.ZodObject<{
37
38
  id: string;
38
39
  name?: string | undefined;
39
40
  }[];
41
+ licenseKey?: string | undefined;
40
42
  domain?: {
41
43
  id: string;
42
44
  name: string;
@@ -52,6 +54,7 @@ declare const optionsSchema: z.ZodObject<{
52
54
  id: string;
53
55
  name?: string | undefined;
54
56
  }[];
57
+ licenseKey?: string | undefined;
55
58
  domain?: {
56
59
  id: string;
57
60
  name: string;
package/dist/index.js CHANGED
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- default: () => src_default
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
34
  });
35
- module.exports = __toCommonJS(src_exports);
35
+ module.exports = __toCommonJS(index_exports);
36
36
  var import_parser = require("@asyncapi/parser");
37
37
  var import_sdk = __toESM(require("@eventcatalog/sdk"));
38
38
  var import_promises = require("fs/promises");
@@ -182,15 +182,98 @@ var defaultMarkdown4 = (_document, channel) => {
182
182
 
183
183
  // src/checkLicense.ts
184
184
  var import_chalk = __toESM(require("chalk"));
185
- var checkLicense_default = () => {
186
- console.log(import_chalk.default.bgBlue(`
187
- You are using the open source license for this plugin`));
188
- console.log(
189
- import_chalk.default.blueBright(
190
- `This plugin is governed and published under a dual-license.
191
- If using for internal, commercial or proprietary software, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`
192
- )
193
- );
185
+
186
+ // package.json
187
+ var package_default = {
188
+ name: "@eventcatalog/generator-asyncapi",
189
+ version: "2.8.0",
190
+ description: "AsyncAPI generator for EventCatalog",
191
+ scripts: {
192
+ build: "tsup",
193
+ test: "vitest",
194
+ format: "prettier --write .",
195
+ "format:diff": "prettier --list-different .",
196
+ changeset: "changeset",
197
+ release: "changeset publish"
198
+ },
199
+ publishConfig: {
200
+ access: "public"
201
+ },
202
+ keywords: [],
203
+ author: "",
204
+ license: "ISC",
205
+ devDependencies: {
206
+ "@changesets/cli": "^2.27.9",
207
+ "@types/fs-extra": "^11.0.4",
208
+ "@types/js-yaml": "^4.0.9",
209
+ "@types/lodash": "^4.17.7",
210
+ "@types/minimist": "^1.2.5",
211
+ "@types/node": "^20.16.1",
212
+ prettier: "^3.3.3",
213
+ tsup: "^8.1.0",
214
+ typescript: "^5.5.3",
215
+ vitest: "^2.0.2"
216
+ },
217
+ files: [
218
+ "dist",
219
+ "package.json"
220
+ ],
221
+ main: "./dist/index.js",
222
+ module: "./dist/index.mjs",
223
+ types: "./dist/index.d.ts",
224
+ dependencies: {
225
+ "@asyncapi/avro-schema-parser": "^3.0.24",
226
+ "@asyncapi/parser": "^3.3.0",
227
+ "@eventcatalog/sdk": "^1.4.8",
228
+ chalk: "^4",
229
+ "fs-extra": "^11.2.0",
230
+ glob: "^11.0.0",
231
+ "gray-matter": "^4.0.3",
232
+ "js-yaml": "^4.1.0",
233
+ lodash: "^4.17.21",
234
+ minimist: "^1.2.8",
235
+ slugify: "^1.6.6",
236
+ zod: "^3.23.8"
237
+ }
238
+ };
239
+
240
+ // src/checkLicense.ts
241
+ var checkLicense_default = async (licenseKey) => {
242
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
243
+ if (!LICENSE_KEY) {
244
+ console.log(import_chalk.default.bgRed(`
245
+ This plugin requires a license key to use`));
246
+ console.log(import_chalk.default.redBright(`
247
+ Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
248
+ process.exit(1);
249
+ }
250
+ const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
251
+ method: "POST",
252
+ headers: {
253
+ Authorization: `Bearer ${LICENSE_KEY}`,
254
+ "Content-Type": "application/json"
255
+ }
256
+ });
257
+ if (response.status !== 200) {
258
+ console.log(import_chalk.default.bgRed(`
259
+ Invalid license key`));
260
+ console.log(import_chalk.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
261
+ process.exit(1);
262
+ }
263
+ if (response.status === 200) {
264
+ const data = await response.json();
265
+ if (package_default.name !== data.plugin) {
266
+ console.log(import_chalk.default.bgRed(`
267
+ Invalid license key for this plugin`));
268
+ console.log(import_chalk.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
269
+ process.exit(1);
270
+ }
271
+ if (data.is_trial) {
272
+ console.log(import_chalk.default.bgBlue(`
273
+ You are using a trial license for this plugin`));
274
+ }
275
+ }
276
+ return Promise.resolve();
194
277
  };
195
278
 
196
279
  // src/index.ts
@@ -198,6 +281,7 @@ var parser = new import_parser.Parser();
198
281
  parser.registerSchemaParser((0, import_avro_schema_parser.AvroSchemaParser)());
199
282
  var cliArgs = (0, import_minimist.default)(process.argv.slice(2));
200
283
  var optionsSchema = import_zod.z.object({
284
+ licenseKey: import_zod.z.string().optional(),
201
285
  services: import_zod.z.array(
202
286
  import_zod.z.object({
203
287
  id: import_zod.z.string({ required_error: "The service id is required. please provide the service id" }),
@@ -223,13 +307,14 @@ var validateOptions = (options) => {
223
307
  if (error instanceof import_zod.z.ZodError) throw new Error(JSON.stringify(error.issues, null, 2));
224
308
  }
225
309
  };
226
- var src_default = async (config, options) => {
310
+ var index_default = async (config, options) => {
227
311
  if (!process.env.PROJECT_DIR) {
228
312
  process.env.PROJECT_DIR = process.cwd();
229
313
  }
230
314
  if (!process.env.PROJECT_DIR) {
231
315
  throw new Error("Please provide catalog url (env variable PROJECT_DIR)");
232
316
  }
317
+ await checkLicense_default(options.licenseKey);
233
318
  const {
234
319
  writeService,
235
320
  writeEvent,
@@ -507,7 +592,6 @@ Processing domain: ${domainName} (v${domainVersion})`));
507
592
  console.log(import_chalk2.default.green(`
508
593
  Finished generating event catalog for AsyncAPI ${serviceId} (v${version})`));
509
594
  }
510
- await checkLicense_default();
511
595
  };
512
596
  var getParsedSpecFile = (service, document) => {
513
597
  const isSpecFileJSON = service.path.endsWith(".json");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/schemas.ts","../src/utils/messages.ts","../src/utils/services.ts","../src/utils/domains.ts","../src/utils/channels.ts","../src/checkLicense.ts"],"sourcesContent":["import { AsyncAPIDocumentInterface, MessageInterface, Parser, fromFile, fromURL } from '@asyncapi/parser';\nimport utils from '@eventcatalog/sdk';\nimport { readFile } from 'node:fs/promises';\nimport argv from 'minimist';\nimport yaml from 'js-yaml';\nimport { z } from 'zod';\nimport chalk from 'chalk';\nimport path from 'path';\n\n// AsyncAPI Parsers\nimport { AvroSchemaParser } from '@asyncapi/avro-schema-parser';\n\nimport {\n defaultMarkdown as generateMarkdownForMessage,\n getChannelsForMessage,\n getMessageName,\n getSummary as getMessageSummary,\n getSchemaFileName,\n messageHasSchema,\n} from './utils/messages';\nimport { defaultMarkdown as generateMarkdownForService, getSummary as getServiceSummary } from './utils/services';\nimport { defaultMarkdown as generateMarkdownForDomain } from './utils/domains';\nimport { defaultMarkdown as generateMarkdownForChannel, getChannelProtocols } from './utils/channels';\nimport checkLicense from './checkLicense';\n\nimport { EventType, MessageOperations } from './types';\n\nconst parser = new Parser();\n\n// register avro schema support\nparser.registerSchemaParser(AvroSchemaParser());\nconst cliArgs = argv(process.argv.slice(2));\n\nconst optionsSchema = z.object({\n services: z.array(\n z.object({\n id: z.string({ required_error: 'The service id is required. please provide the service id' }),\n path: z.string({ required_error: 'The service path is required. please provide the path to specification file' }),\n name: z.string().optional(),\n }),\n { message: 'Please provide correct services configuration' }\n ),\n domain: z\n .object({\n id: z.string({ required_error: 'The domain id is required. please provide a domain id' }),\n name: z.string({ required_error: 'The domain name is required. please provide a domain name' }),\n version: z.string({ required_error: 'The domain version is required. please provide a domain version' }),\n })\n .optional(),\n debug: z.boolean().optional(),\n parseSchemas: z.boolean().optional(),\n parseChannels: z.boolean().optional(),\n saveParsedSpecFile: z.boolean({ invalid_type_error: 'The saveParsedSpecFile is not a boolean in options' }).optional(),\n});\n\ntype Props = z.infer<typeof optionsSchema>;\ntype Domain = z.infer<typeof optionsSchema>['domain'];\ntype Service = z.infer<typeof optionsSchema>['services'][0];\n\nconst validateOptions = (options: Props) => {\n try {\n optionsSchema.parse(options);\n } catch (error: any) {\n if (error instanceof z.ZodError) throw new Error(JSON.stringify(error.issues, null, 2));\n }\n};\n\nexport default async (config: any, options: Props) => {\n if (!process.env.PROJECT_DIR) {\n process.env.PROJECT_DIR = process.cwd();\n }\n\n if (!process.env.PROJECT_DIR) {\n throw new Error('Please provide catalog url (env variable PROJECT_DIR)');\n }\n\n const {\n writeService,\n writeEvent,\n writeCommand,\n writeQuery,\n getService,\n versionService,\n getDomain,\n writeDomain,\n addServiceToDomain,\n getCommand,\n getEvent,\n getQuery,\n versionCommand,\n versionEvent,\n versionQuery,\n addSchemaToCommand,\n addSchemaToEvent,\n addSchemaToQuery,\n addFileToService,\n versionDomain,\n getSpecificationFilesForService,\n writeChannel,\n getChannel,\n versionChannel,\n } = utils(process.env.PROJECT_DIR);\n\n // Define the message operations mapping with proper types\n const MESSAGE_OPERATIONS: Record<EventType, MessageOperations> = {\n event: {\n write: writeEvent,\n version: versionEvent,\n get: getEvent,\n addSchema: addSchemaToEvent,\n },\n command: {\n write: writeCommand,\n version: versionCommand,\n get: getCommand,\n addSchema: addSchemaToCommand,\n },\n query: {\n write: writeQuery,\n version: versionQuery,\n get: getQuery,\n addSchema: addSchemaToQuery,\n },\n };\n\n // Should the file that is written to the catalog be parsed (https://github.com/asyncapi/parser-js) or as it is?\n validateOptions(options);\n\n const { services, saveParsedSpecFile = false, parseSchemas = true, parseChannels = false } = options;\n // const asyncAPIFiles = Array.isArray(options.path) ? options.path : [options.path];\n console.log(chalk.green(`Processing ${services.length} AsyncAPI files...`));\n for (const service of services) {\n console.log(chalk.gray(`Processing ${service.path}`));\n\n const { document, diagnostics } = service.path.startsWith('http')\n ? await fromURL(parser, service.path).parse({\n parseSchemas,\n })\n : await fromFile(parser, service.path).parse({\n parseSchemas,\n });\n\n if (!document) {\n console.log(chalk.red('Failed to parse AsyncAPI file'));\n if (options.debug || cliArgs.debug) {\n console.log(diagnostics);\n } else {\n console.log(chalk.red('Run with debug option in the generator to see diagnostics'));\n }\n continue;\n }\n\n const operations = document.allOperations();\n const channels = document.allChannels();\n const documentTags = document.info().tags().all() || [];\n\n const serviceId = service.id;\n\n const serviceName = service.name || document.info().title();\n const version = document.info().version();\n\n // What messages does this service send and receive\n let sends = [];\n let receives = [];\n\n let owners = null;\n let repository = null;\n\n let serviceSpecifications = {};\n let serviceSpecificationsFiles = [];\n let serviceMarkdown = generateMarkdownForService(document);\n\n // Manage domain\n if (options.domain) {\n // Try and get the domain\n const { id: domainId, name: domainName, version: domainVersion } = options.domain;\n const domain = await getDomain(options.domain.id, domainVersion || 'latest');\n const currentDomain = await getDomain(options.domain.id, 'latest');\n\n console.log(chalk.blue(`\\nProcessing domain: ${domainName} (v${domainVersion})`));\n\n // Found a domain, but the versions do not match\n if (currentDomain && currentDomain.version !== domainVersion) {\n await versionDomain(domainId);\n console.log(chalk.cyan(` - Versioned previous domain (v${currentDomain.version})`));\n }\n\n // Do we need to create a new domain?\n if (!domain || (domain && domain.version !== domainVersion)) {\n await writeDomain({\n id: domainId,\n name: domainName,\n version: domainVersion,\n markdown: generateMarkdownForDomain(document),\n // services: [{ id: serviceId, version: version }],\n });\n console.log(chalk.cyan(` - Domain (v${domainVersion}) created`));\n }\n\n if (currentDomain && currentDomain.version === domainVersion) {\n console.log(chalk.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));\n }\n\n // Add the service to the domain\n await addServiceToDomain(domainId, { id: serviceId, version: version }, domainVersion);\n }\n\n // Parse channels\n if (parseChannels) {\n for (const channel of channels) {\n const channelAsJSON = channel.json();\n const channelId = channel.id();\n const params = channelAsJSON?.parameters || {};\n const protocols = getChannelProtocols(channel);\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || version;\n let channelMarkdown = generateMarkdownForChannel(document, channel);\n\n console.log(chalk.blue(`Processing channel: ${channelId} (v${channelVersion})`));\n\n const paramsForCatalog = Object.keys(params).reduce(\n (acc, key) => {\n const param = params[key];\n acc[key] = {};\n if (param.enum) acc[key].enum = param.enum;\n if (param.default) acc[key].default = param.default;\n if (param.examples) acc[key].examples = param.examples;\n if (param.description) acc[key].description = param.description;\n return acc;\n },\n {} as Record<string, { enum?: string[]; default?: string; examples?: string[]; description?: string }>\n );\n\n const catalogedChannel = await getChannel(channelId, 'latest');\n\n if (catalogedChannel) {\n channelMarkdown = catalogedChannel.markdown;\n if (catalogedChannel.version !== channelVersion) {\n await versionChannel(channelId);\n console.log(chalk.cyan(` - Versioned previous channel: ${channelId} (v${channelVersion})`));\n }\n }\n\n await writeChannel(\n {\n id: channelId,\n name: channelAsJSON?.title || channel.id(),\n markdown: channelMarkdown,\n version: channelVersion,\n ...(Object.keys(paramsForCatalog).length > 0 && { parameters: paramsForCatalog }),\n ...(channel.address() && { address: channel.address() }),\n ...(channelAsJSON?.summary && { summary: channelAsJSON.summary }),\n ...(protocols.length > 0 && { protocols }),\n },\n { override: true }\n );\n\n console.log(chalk.cyan(` - Message ${channelId} (v${version}) created`));\n }\n }\n\n // Find events/commands\n for (const operation of operations) {\n for (const message of operation.messages()) {\n const eventType = (message.extensions().get('x-eventcatalog-message-type')?.value() as EventType) || 'event';\n const messageVersion = message.extensions().get('x-eventcatalog-message-version')?.value() || version;\n\n // does this service own or just consume the message?\n const serviceOwnsMessageContract = isServiceMessageOwner(message);\n const isReceived = operation.action() === 'receive' || operation.action() === 'subscribe';\n const isSent = operation.action() === 'send' || operation.action() === 'publish';\n\n const messageId = message.id().toLowerCase();\n\n if (eventType !== 'event' && eventType !== 'command' && eventType !== 'query') {\n throw new Error('Invalid message type');\n }\n\n const {\n write: writeMessage,\n version: versionMessage,\n get: getMessage,\n addSchema: addSchemaToMessage,\n } = MESSAGE_OPERATIONS[eventType];\n\n let messageMarkdown = generateMarkdownForMessage(document, message);\n const badges = message.tags().all() || [];\n\n console.log(chalk.blue(`Processing message: ${getMessageName(message)} (v${messageVersion})`));\n\n if (serviceOwnsMessageContract) {\n // Check if the message already exists in the catalog\n const catalogedMessage = await getMessage(message.id().toLowerCase(), 'latest');\n\n if (catalogedMessage) {\n // persist markdown if it exists\n messageMarkdown = catalogedMessage.markdown;\n\n if (catalogedMessage.version !== messageVersion) {\n // if the version does not match, we need to version the message\n await versionMessage(messageId);\n console.log(chalk.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));\n }\n }\n\n const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document) : [];\n\n // Write the message to the catalog\n await writeMessage(\n {\n id: messageId,\n version: messageVersion,\n name: getMessageName(message),\n summary: getMessageSummary(message),\n markdown: messageMarkdown,\n badges: badges.map((badge) => ({ content: badge.name(), textColor: 'blue', backgroundColor: 'blue' })),\n schemaPath: messageHasSchema(message) ? getSchemaFileName(message) : undefined,\n ...(channelsForMessage.length > 0 && { channels: channelsForMessage }),\n },\n {\n override: true,\n path: message.id(),\n }\n );\n\n console.log(chalk.cyan(` - Message (v${messageVersion}) created`));\n // Check if the message has a payload, if it does then document in EventCatalog\n if (messageHasSchema(message)) {\n // Get the schema from the original payload if it exists\n const schema = message.payload()?.extensions()?.get('x-parser-original-payload')?.json() || message.payload()?.json();\n\n await addSchemaToMessage(\n messageId,\n {\n fileName: getSchemaFileName(message),\n schema: JSON.stringify(schema, null, 4),\n },\n messageVersion\n );\n console.log(chalk.cyan(` - Schema added to message (v${messageVersion})`));\n }\n } else {\n // Message is not owned by this service, therefore we don't need to document it\n console.log(chalk.yellow(` - Skipping external message: ${getMessageName(message)}(v${messageVersion})`));\n }\n // Add the message to the correct array\n if (isSent) sends.push({ id: messageId, version: messageVersion });\n if (isReceived) receives.push({ id: messageId, version: messageVersion });\n }\n }\n\n // Check if service is already defined... if the versions do not match then create service.\n const latestServiceInCatalog = await getService(serviceId, 'latest');\n\n console.log(chalk.blue(`Processing service: ${serviceId} (v${version})`));\n\n if (latestServiceInCatalog) {\n serviceMarkdown = latestServiceInCatalog.markdown;\n owners = latestServiceInCatalog.owners || ([] as any);\n repository = latestServiceInCatalog.repository || null;\n\n // Found a service, and versions do not match, we need to version the one already there\n if (latestServiceInCatalog.version !== version) {\n await versionService(serviceId);\n console.log(chalk.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));\n }\n\n // Match found, persist data\n if (latestServiceInCatalog.version === version) {\n // we want to preserve the markdown any any spec files that are already there\n serviceMarkdown = latestServiceInCatalog.markdown;\n serviceSpecifications = latestServiceInCatalog.specifications ?? {};\n sends = latestServiceInCatalog.sends ? [...latestServiceInCatalog.sends, ...sends] : sends;\n receives = latestServiceInCatalog.receives ? [...latestServiceInCatalog.receives, ...receives] : receives;\n serviceSpecificationsFiles = await getSpecificationFilesForService(serviceId, version);\n }\n }\n\n const fileName = path.basename(service.path);\n\n await writeService(\n {\n id: serviceId,\n name: serviceName,\n version: version,\n summary: getServiceSummary(document),\n badges: documentTags.map((tag) => ({ content: tag.name(), textColor: 'blue', backgroundColor: 'blue' })),\n markdown: serviceMarkdown,\n sends,\n receives,\n schemaPath: fileName || 'asyncapi.yml',\n specifications: {\n ...serviceSpecifications,\n asyncapiPath: fileName || 'asyncapi.yml',\n },\n ...(owners && { owners }),\n ...(repository && { repository }),\n },\n {\n override: true,\n }\n );\n\n // What files need added to the service (speficiation files)\n const specFiles = [\n // add any previous spec files to the list\n ...serviceSpecificationsFiles,\n {\n content: saveParsedSpecFile ? getParsedSpecFile(service, document) : await getRawSpecFile(service),\n fileName: path.basename(service.path) || 'asyncapi.yml',\n },\n ];\n\n for (const specFile of specFiles) {\n await addFileToService(\n serviceId,\n {\n fileName: specFile.fileName,\n content: specFile.content,\n },\n version\n );\n }\n\n console.log(chalk.cyan(` - Service (v${version}) created`));\n\n console.log(chalk.green(`\\nFinished generating event catalog for AsyncAPI ${serviceId} (v${version})`));\n }\n\n await checkLicense();\n};\n\nconst getParsedSpecFile = (service: Service, document: AsyncAPIDocumentInterface) => {\n const isSpecFileJSON = service.path.endsWith('.json');\n return isSpecFileJSON\n ? JSON.stringify(document.meta().asyncapi.parsed, null, 4)\n : yaml.dump(document.meta().asyncapi.parsed, { noRefs: true });\n};\n\nconst getRawSpecFile = async (service: Service) => {\n if (service.path.startsWith('http')) {\n try {\n const response = await fetch(service.path);\n return response.text();\n } catch (error) {\n console.log(chalk.red(`\\nFailed to request AsyncAPI file from ${service.path}`));\n return '';\n }\n } else {\n return await readFile(service.path, 'utf8');\n }\n};\n/**\n * Is the AsyncAPI specification (service) the owner of the message?\n * This is determined by the 'x-eventcatalog-role' extension in the message\n *\n * @param message\n * @returns boolean\n *\n * default is provider (AsyncAPI file / service owns the message)\n */\nconst isServiceMessageOwner = (message: MessageInterface): boolean => {\n const value = message.extensions().get('x-eventcatalog-role')?.value() || 'provider';\n return value === 'provider';\n};\n","export const getFileExtentionFromSchemaFormat = (format: string | undefined = '') => {\n if (format.includes('avro')) return 'avsc';\n if (format.includes('yml')) return 'yml';\n if (format.includes('json')) return 'json';\n if (format.includes('openapi')) return 'openapi';\n if (format.includes('protobuf')) return 'protobuf';\n if (format.includes('yaml')) return 'yaml';\n\n return 'json';\n};\n","import {\n MessageInterface,\n AsyncAPIDocumentInterface,\n ChannelInterface,\n ChannelsInterface,\n MessagesInterface,\n} from '@asyncapi/parser';\nimport { getFileExtentionFromSchemaFormat } from './schemas';\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, message: MessageInterface) => {\n return `\n## Architecture\n<NodeGraph />\n\n${\n messageHasSchema(message) && messageIsJSON(message)\n ? `\n## Schema\n<SchemaViewer file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n${\n messageHasSchema(message) && !messageIsJSON(message)\n ? `\n## Schema\n<Schema file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n\n${\n message.externalDocs()\n ? `\n## External documentation\n- [${message.externalDocs()?.description()}](${message.externalDocs()?.url()})\n`\n : ''\n}\n\n`;\n};\n\nexport const getSummary = (message: MessageInterface) => {\n const messageSummary = message.hasSummary() ? message.summary() : '';\n const messageDescription = message.hasDescription() ? message.description() : '';\n\n let eventCatalogMessageSummary = messageSummary;\n\n if (!eventCatalogMessageSummary) {\n eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : '';\n }\n\n return eventCatalogMessageSummary;\n};\n\nexport const messageHasSchema = (message: MessageInterface) => {\n return message.hasPayload() && message.schemaFormat();\n};\n\nexport const messageIsJSON = (message: MessageInterface) => {\n const fileName = getSchemaFileName(message);\n return fileName.endsWith('.json');\n};\n\nexport const getSchemaFileName = (message: MessageInterface) => {\n const extension = getFileExtentionFromSchemaFormat(message.schemaFormat());\n return `schema.${extension}`;\n};\n\nexport const getMessageName = (message: MessageInterface) => {\n return message.hasTitle() && message.title() ? (message.title() as string) : message.id();\n};\n\nexport const getChannelsForMessage = (\n message: MessageInterface,\n channels: ChannelsInterface,\n document: AsyncAPIDocumentInterface\n): { id: string; version: string }[] => {\n let channelsForMessage: ChannelInterface[] = [];\n const globalVersion = document.info().version();\n\n // Go through all channels and link messages they document\n for (const channel of channels) {\n for (const channelMessage of channel.messages() as MessagesInterface) {\n if (channelMessage.id() === message.id()) {\n channelsForMessage.push(channel);\n }\n }\n }\n\n // You can also document a message directly to a channel, add them too\n for (const messageChannel of message.channels()) {\n channelsForMessage.push(messageChannel);\n }\n\n // Make them unique, as there may be overlapping channels\n const uniqueChannels = channelsForMessage.filter(\n (channel, index, self) => index === self.findIndex((t) => t.id() === channel.id())\n );\n\n return uniqueChannels.map((channel) => {\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || globalVersion;\n return {\n id: channel.id(),\n version: channelVersion,\n };\n });\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n${document.info().hasDescription() ? `${document.info().description()}` : ''} \n\n## Architecture diagram\n<NodeGraph />\n\n${\n document.info().externalDocs()\n ? `\n## External documentation\n- [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})\n`\n : ''\n}\n`;\n};\n\nexport const getSummary = (document: AsyncAPIDocumentInterface) => {\n const summary = document.info().hasDescription() ? document.info().description() : '';\n return summary && summary.length < 150 ? summary : '';\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n## Architecture diagram\n<NodeGraph />\n\n`;\n};\n","import { AsyncAPIDocumentInterface, ChannelInterface } from '@asyncapi/parser';\n\nexport const getChannelProtocols = (channel: ChannelInterface): string[] => {\n const protocols = [];\n\n const bindings = channel.bindings();\n for (const binding of bindings) {\n protocols.push(binding.protocol());\n }\n\n return protocols;\n};\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, channel: ChannelInterface) => {\n return `\n ${\n channel.hasDescription()\n ? `\n ## Overview\n ${channel.description()}\n `\n : ''\n }\n\n <ChannelInformation />\n\n ${\n channel.json()?.externalDocs\n ? `\n ## External documentation\n - [${channel.json()?.externalDocs?.description}](${channel.json()?.externalDocs?.url})\n `\n : ''\n }\n \n `;\n};\n","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, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`\n )\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuF;AACvF,iBAAkB;AAClB,sBAAyB;AACzB,sBAAiB;AACjB,qBAAiB;AACjB,iBAAkB;AAClB,IAAAA,gBAAkB;AAClB,kBAAiB;AAGjB,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W,MAAM,MAAM,QAAQ,IAAI;AACzC,aAAO,SAAS,KAAK;AAAA,IACvB,SAAS,OAAO;AACd,cAAQ,IAAI,cAAAJ,QAAM,IAAI;AAAA,uCAA0C,QAAQ,IAAI,EAAE,CAAC;AAC/E,aAAO;AAAA,IACT;AAAA,EACF,OAAO;AACL,WAAO,UAAM,0BAAS,QAAQ,MAAM,MAAM;AAAA,EAC5C;AACF;AAUA,IAAM,wBAAwB,CAAC,YAAuC;AACpE,QAAM,QAAQ,QAAQ,WAAW,EAAE,IAAI,qBAAqB,GAAG,MAAM,KAAK;AAC1E,SAAO,UAAU;AACnB;","names":["import_chalk","defaultMarkdown","getSummary","defaultMarkdown","defaultMarkdown","chalk","argv","utils","chalk","defaultMarkdown","path","getSummary","yaml"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/schemas.ts","../src/utils/messages.ts","../src/utils/services.ts","../src/utils/domains.ts","../src/utils/channels.ts","../src/checkLicense.ts","../package.json"],"sourcesContent":["import { AsyncAPIDocumentInterface, MessageInterface, Parser, fromFile, fromURL } from '@asyncapi/parser';\nimport utils from '@eventcatalog/sdk';\nimport { readFile } from 'node:fs/promises';\nimport argv from 'minimist';\nimport yaml from 'js-yaml';\nimport { z } from 'zod';\nimport chalk from 'chalk';\nimport path from 'path';\n\n// AsyncAPI Parsers\nimport { AvroSchemaParser } from '@asyncapi/avro-schema-parser';\n\nimport {\n defaultMarkdown as generateMarkdownForMessage,\n getChannelsForMessage,\n getMessageName,\n getSummary as getMessageSummary,\n getSchemaFileName,\n messageHasSchema,\n} from './utils/messages';\nimport { defaultMarkdown as generateMarkdownForService, getSummary as getServiceSummary } from './utils/services';\nimport { defaultMarkdown as generateMarkdownForDomain } from './utils/domains';\nimport { defaultMarkdown as generateMarkdownForChannel, getChannelProtocols } from './utils/channels';\nimport checkLicense from './checkLicense';\n\nimport { EventType, MessageOperations } from './types';\n\nconst parser = new Parser();\n\n// register avro schema support\nparser.registerSchemaParser(AvroSchemaParser());\nconst cliArgs = argv(process.argv.slice(2));\n\nconst optionsSchema = z.object({\n licenseKey: z.string().optional(),\n services: z.array(\n z.object({\n id: z.string({ required_error: 'The service id is required. please provide the service id' }),\n path: z.string({ required_error: 'The service path is required. please provide the path to specification file' }),\n name: z.string().optional(),\n }),\n { message: 'Please provide correct services configuration' }\n ),\n domain: z\n .object({\n id: z.string({ required_error: 'The domain id is required. please provide a domain id' }),\n name: z.string({ required_error: 'The domain name is required. please provide a domain name' }),\n version: z.string({ required_error: 'The domain version is required. please provide a domain version' }),\n })\n .optional(),\n debug: z.boolean().optional(),\n parseSchemas: z.boolean().optional(),\n parseChannels: z.boolean().optional(),\n saveParsedSpecFile: z.boolean({ invalid_type_error: 'The saveParsedSpecFile is not a boolean in options' }).optional(),\n});\n\ntype Props = z.infer<typeof optionsSchema>;\ntype Domain = z.infer<typeof optionsSchema>['domain'];\ntype Service = z.infer<typeof optionsSchema>['services'][0];\n\nconst validateOptions = (options: Props) => {\n try {\n optionsSchema.parse(options);\n } catch (error: any) {\n if (error instanceof z.ZodError) throw new Error(JSON.stringify(error.issues, null, 2));\n }\n};\n\nexport default async (config: any, options: Props) => {\n if (!process.env.PROJECT_DIR) {\n process.env.PROJECT_DIR = process.cwd();\n }\n\n if (!process.env.PROJECT_DIR) {\n throw new Error('Please provide catalog url (env variable PROJECT_DIR)');\n }\n\n await checkLicense(options.licenseKey);\n\n const {\n writeService,\n writeEvent,\n writeCommand,\n writeQuery,\n getService,\n versionService,\n getDomain,\n writeDomain,\n addServiceToDomain,\n getCommand,\n getEvent,\n getQuery,\n versionCommand,\n versionEvent,\n versionQuery,\n addSchemaToCommand,\n addSchemaToEvent,\n addSchemaToQuery,\n addFileToService,\n versionDomain,\n getSpecificationFilesForService,\n writeChannel,\n getChannel,\n versionChannel,\n } = utils(process.env.PROJECT_DIR);\n\n // Define the message operations mapping with proper types\n const MESSAGE_OPERATIONS: Record<EventType, MessageOperations> = {\n event: {\n write: writeEvent,\n version: versionEvent,\n get: getEvent,\n addSchema: addSchemaToEvent,\n },\n command: {\n write: writeCommand,\n version: versionCommand,\n get: getCommand,\n addSchema: addSchemaToCommand,\n },\n query: {\n write: writeQuery,\n version: versionQuery,\n get: getQuery,\n addSchema: addSchemaToQuery,\n },\n };\n\n // Should the file that is written to the catalog be parsed (https://github.com/asyncapi/parser-js) or as it is?\n validateOptions(options);\n\n const { services, saveParsedSpecFile = false, parseSchemas = true, parseChannels = false } = options;\n // const asyncAPIFiles = Array.isArray(options.path) ? options.path : [options.path];\n console.log(chalk.green(`Processing ${services.length} AsyncAPI files...`));\n for (const service of services) {\n console.log(chalk.gray(`Processing ${service.path}`));\n\n const { document, diagnostics } = service.path.startsWith('http')\n ? await fromURL(parser, service.path).parse({\n parseSchemas,\n })\n : await fromFile(parser, service.path).parse({\n parseSchemas,\n });\n\n if (!document) {\n console.log(chalk.red('Failed to parse AsyncAPI file'));\n if (options.debug || cliArgs.debug) {\n console.log(diagnostics);\n } else {\n console.log(chalk.red('Run with debug option in the generator to see diagnostics'));\n }\n continue;\n }\n\n const operations = document.allOperations();\n const channels = document.allChannels();\n const documentTags = document.info().tags().all() || [];\n\n const serviceId = service.id;\n\n const serviceName = service.name || document.info().title();\n const version = document.info().version();\n\n // What messages does this service send and receive\n let sends = [];\n let receives = [];\n\n let owners = null;\n let repository = null;\n\n let serviceSpecifications = {};\n let serviceSpecificationsFiles = [];\n let serviceMarkdown = generateMarkdownForService(document);\n\n // Manage domain\n if (options.domain) {\n // Try and get the domain\n const { id: domainId, name: domainName, version: domainVersion } = options.domain;\n const domain = await getDomain(options.domain.id, domainVersion || 'latest');\n const currentDomain = await getDomain(options.domain.id, 'latest');\n\n console.log(chalk.blue(`\\nProcessing domain: ${domainName} (v${domainVersion})`));\n\n // Found a domain, but the versions do not match\n if (currentDomain && currentDomain.version !== domainVersion) {\n await versionDomain(domainId);\n console.log(chalk.cyan(` - Versioned previous domain (v${currentDomain.version})`));\n }\n\n // Do we need to create a new domain?\n if (!domain || (domain && domain.version !== domainVersion)) {\n await writeDomain({\n id: domainId,\n name: domainName,\n version: domainVersion,\n markdown: generateMarkdownForDomain(document),\n // services: [{ id: serviceId, version: version }],\n });\n console.log(chalk.cyan(` - Domain (v${domainVersion}) created`));\n }\n\n if (currentDomain && currentDomain.version === domainVersion) {\n console.log(chalk.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));\n }\n\n // Add the service to the domain\n await addServiceToDomain(domainId, { id: serviceId, version: version }, domainVersion);\n }\n\n // Parse channels\n if (parseChannels) {\n for (const channel of channels) {\n const channelAsJSON = channel.json();\n const channelId = channel.id();\n const params = channelAsJSON?.parameters || {};\n const protocols = getChannelProtocols(channel);\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || version;\n let channelMarkdown = generateMarkdownForChannel(document, channel);\n\n console.log(chalk.blue(`Processing channel: ${channelId} (v${channelVersion})`));\n\n const paramsForCatalog = Object.keys(params).reduce(\n (acc, key) => {\n const param = params[key];\n acc[key] = {};\n if (param.enum) acc[key].enum = param.enum;\n if (param.default) acc[key].default = param.default;\n if (param.examples) acc[key].examples = param.examples;\n if (param.description) acc[key].description = param.description;\n return acc;\n },\n {} as Record<string, { enum?: string[]; default?: string; examples?: string[]; description?: string }>\n );\n\n const catalogedChannel = await getChannel(channelId, 'latest');\n\n if (catalogedChannel) {\n channelMarkdown = catalogedChannel.markdown;\n if (catalogedChannel.version !== channelVersion) {\n await versionChannel(channelId);\n console.log(chalk.cyan(` - Versioned previous channel: ${channelId} (v${channelVersion})`));\n }\n }\n\n await writeChannel(\n {\n id: channelId,\n name: channelAsJSON?.title || channel.id(),\n markdown: channelMarkdown,\n version: channelVersion,\n ...(Object.keys(paramsForCatalog).length > 0 && { parameters: paramsForCatalog }),\n ...(channel.address() && { address: channel.address() }),\n ...(channelAsJSON?.summary && { summary: channelAsJSON.summary }),\n ...(protocols.length > 0 && { protocols }),\n },\n { override: true }\n );\n\n console.log(chalk.cyan(` - Message ${channelId} (v${version}) created`));\n }\n }\n\n // Find events/commands\n for (const operation of operations) {\n for (const message of operation.messages()) {\n const eventType = (message.extensions().get('x-eventcatalog-message-type')?.value() as EventType) || 'event';\n const messageVersion = message.extensions().get('x-eventcatalog-message-version')?.value() || version;\n\n // does this service own or just consume the message?\n const serviceOwnsMessageContract = isServiceMessageOwner(message);\n const isReceived = operation.action() === 'receive' || operation.action() === 'subscribe';\n const isSent = operation.action() === 'send' || operation.action() === 'publish';\n\n const messageId = message.id().toLowerCase();\n\n if (eventType !== 'event' && eventType !== 'command' && eventType !== 'query') {\n throw new Error('Invalid message type');\n }\n\n const {\n write: writeMessage,\n version: versionMessage,\n get: getMessage,\n addSchema: addSchemaToMessage,\n } = MESSAGE_OPERATIONS[eventType];\n\n let messageMarkdown = generateMarkdownForMessage(document, message);\n const badges = message.tags().all() || [];\n\n console.log(chalk.blue(`Processing message: ${getMessageName(message)} (v${messageVersion})`));\n\n if (serviceOwnsMessageContract) {\n // Check if the message already exists in the catalog\n const catalogedMessage = await getMessage(message.id().toLowerCase(), 'latest');\n\n if (catalogedMessage) {\n // persist markdown if it exists\n messageMarkdown = catalogedMessage.markdown;\n\n if (catalogedMessage.version !== messageVersion) {\n // if the version does not match, we need to version the message\n await versionMessage(messageId);\n console.log(chalk.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));\n }\n }\n\n const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document) : [];\n\n // Write the message to the catalog\n await writeMessage(\n {\n id: messageId,\n version: messageVersion,\n name: getMessageName(message),\n summary: getMessageSummary(message),\n markdown: messageMarkdown,\n badges: badges.map((badge) => ({ content: badge.name(), textColor: 'blue', backgroundColor: 'blue' })),\n schemaPath: messageHasSchema(message) ? getSchemaFileName(message) : undefined,\n ...(channelsForMessage.length > 0 && { channels: channelsForMessage }),\n },\n {\n override: true,\n path: message.id(),\n }\n );\n\n console.log(chalk.cyan(` - Message (v${messageVersion}) created`));\n // Check if the message has a payload, if it does then document in EventCatalog\n if (messageHasSchema(message)) {\n // Get the schema from the original payload if it exists\n const schema = message.payload()?.extensions()?.get('x-parser-original-payload')?.json() || message.payload()?.json();\n\n await addSchemaToMessage(\n messageId,\n {\n fileName: getSchemaFileName(message),\n schema: JSON.stringify(schema, null, 4),\n },\n messageVersion\n );\n console.log(chalk.cyan(` - Schema added to message (v${messageVersion})`));\n }\n } else {\n // Message is not owned by this service, therefore we don't need to document it\n console.log(chalk.yellow(` - Skipping external message: ${getMessageName(message)}(v${messageVersion})`));\n }\n // Add the message to the correct array\n if (isSent) sends.push({ id: messageId, version: messageVersion });\n if (isReceived) receives.push({ id: messageId, version: messageVersion });\n }\n }\n\n // Check if service is already defined... if the versions do not match then create service.\n const latestServiceInCatalog = await getService(serviceId, 'latest');\n\n console.log(chalk.blue(`Processing service: ${serviceId} (v${version})`));\n\n if (latestServiceInCatalog) {\n serviceMarkdown = latestServiceInCatalog.markdown;\n owners = latestServiceInCatalog.owners || ([] as any);\n repository = latestServiceInCatalog.repository || null;\n\n // Found a service, and versions do not match, we need to version the one already there\n if (latestServiceInCatalog.version !== version) {\n await versionService(serviceId);\n console.log(chalk.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));\n }\n\n // Match found, persist data\n if (latestServiceInCatalog.version === version) {\n // we want to preserve the markdown any any spec files that are already there\n serviceMarkdown = latestServiceInCatalog.markdown;\n serviceSpecifications = latestServiceInCatalog.specifications ?? {};\n sends = latestServiceInCatalog.sends ? [...latestServiceInCatalog.sends, ...sends] : sends;\n receives = latestServiceInCatalog.receives ? [...latestServiceInCatalog.receives, ...receives] : receives;\n serviceSpecificationsFiles = await getSpecificationFilesForService(serviceId, version);\n }\n }\n\n const fileName = path.basename(service.path);\n\n await writeService(\n {\n id: serviceId,\n name: serviceName,\n version: version,\n summary: getServiceSummary(document),\n badges: documentTags.map((tag) => ({ content: tag.name(), textColor: 'blue', backgroundColor: 'blue' })),\n markdown: serviceMarkdown,\n sends,\n receives,\n schemaPath: fileName || 'asyncapi.yml',\n specifications: {\n ...serviceSpecifications,\n asyncapiPath: fileName || 'asyncapi.yml',\n },\n ...(owners && { owners }),\n ...(repository && { repository }),\n },\n {\n override: true,\n }\n );\n\n // What files need added to the service (speficiation files)\n const specFiles = [\n // add any previous spec files to the list\n ...serviceSpecificationsFiles,\n {\n content: saveParsedSpecFile ? getParsedSpecFile(service, document) : await getRawSpecFile(service),\n fileName: path.basename(service.path) || 'asyncapi.yml',\n },\n ];\n\n for (const specFile of specFiles) {\n await addFileToService(\n serviceId,\n {\n fileName: specFile.fileName,\n content: specFile.content,\n },\n version\n );\n }\n\n console.log(chalk.cyan(` - Service (v${version}) created`));\n\n console.log(chalk.green(`\\nFinished generating event catalog for AsyncAPI ${serviceId} (v${version})`));\n }\n};\n\nconst getParsedSpecFile = (service: Service, document: AsyncAPIDocumentInterface) => {\n const isSpecFileJSON = service.path.endsWith('.json');\n return isSpecFileJSON\n ? JSON.stringify(document.meta().asyncapi.parsed, null, 4)\n : yaml.dump(document.meta().asyncapi.parsed, { noRefs: true });\n};\n\nconst getRawSpecFile = async (service: Service) => {\n if (service.path.startsWith('http')) {\n try {\n const response = await fetch(service.path);\n return response.text();\n } catch (error) {\n console.log(chalk.red(`\\nFailed to request AsyncAPI file from ${service.path}`));\n return '';\n }\n } else {\n return await readFile(service.path, 'utf8');\n }\n};\n/**\n * Is the AsyncAPI specification (service) the owner of the message?\n * This is determined by the 'x-eventcatalog-role' extension in the message\n *\n * @param message\n * @returns boolean\n *\n * default is provider (AsyncAPI file / service owns the message)\n */\nconst isServiceMessageOwner = (message: MessageInterface): boolean => {\n const value = message.extensions().get('x-eventcatalog-role')?.value() || 'provider';\n return value === 'provider';\n};\n","export const getFileExtentionFromSchemaFormat = (format: string | undefined = '') => {\n if (format.includes('avro')) return 'avsc';\n if (format.includes('yml')) return 'yml';\n if (format.includes('json')) return 'json';\n if (format.includes('openapi')) return 'openapi';\n if (format.includes('protobuf')) return 'protobuf';\n if (format.includes('yaml')) return 'yaml';\n\n return 'json';\n};\n","import {\n MessageInterface,\n AsyncAPIDocumentInterface,\n ChannelInterface,\n ChannelsInterface,\n MessagesInterface,\n} from '@asyncapi/parser';\nimport { getFileExtentionFromSchemaFormat } from './schemas';\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, message: MessageInterface) => {\n return `\n## Architecture\n<NodeGraph />\n\n${\n messageHasSchema(message) && messageIsJSON(message)\n ? `\n## Schema\n<SchemaViewer file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n${\n messageHasSchema(message) && !messageIsJSON(message)\n ? `\n## Schema\n<Schema file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n\n${\n message.externalDocs()\n ? `\n## External documentation\n- [${message.externalDocs()?.description()}](${message.externalDocs()?.url()})\n`\n : ''\n}\n\n`;\n};\n\nexport const getSummary = (message: MessageInterface) => {\n const messageSummary = message.hasSummary() ? message.summary() : '';\n const messageDescription = message.hasDescription() ? message.description() : '';\n\n let eventCatalogMessageSummary = messageSummary;\n\n if (!eventCatalogMessageSummary) {\n eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : '';\n }\n\n return eventCatalogMessageSummary;\n};\n\nexport const messageHasSchema = (message: MessageInterface) => {\n return message.hasPayload() && message.schemaFormat();\n};\n\nexport const messageIsJSON = (message: MessageInterface) => {\n const fileName = getSchemaFileName(message);\n return fileName.endsWith('.json');\n};\n\nexport const getSchemaFileName = (message: MessageInterface) => {\n const extension = getFileExtentionFromSchemaFormat(message.schemaFormat());\n return `schema.${extension}`;\n};\n\nexport const getMessageName = (message: MessageInterface) => {\n return message.hasTitle() && message.title() ? (message.title() as string) : message.id();\n};\n\nexport const getChannelsForMessage = (\n message: MessageInterface,\n channels: ChannelsInterface,\n document: AsyncAPIDocumentInterface\n): { id: string; version: string }[] => {\n let channelsForMessage: ChannelInterface[] = [];\n const globalVersion = document.info().version();\n\n // Go through all channels and link messages they document\n for (const channel of channels) {\n for (const channelMessage of channel.messages() as MessagesInterface) {\n if (channelMessage.id() === message.id()) {\n channelsForMessage.push(channel);\n }\n }\n }\n\n // You can also document a message directly to a channel, add them too\n for (const messageChannel of message.channels()) {\n channelsForMessage.push(messageChannel);\n }\n\n // Make them unique, as there may be overlapping channels\n const uniqueChannels = channelsForMessage.filter(\n (channel, index, self) => index === self.findIndex((t) => t.id() === channel.id())\n );\n\n return uniqueChannels.map((channel) => {\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || globalVersion;\n return {\n id: channel.id(),\n version: channelVersion,\n };\n });\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n${document.info().hasDescription() ? `${document.info().description()}` : ''} \n\n## Architecture diagram\n<NodeGraph />\n\n${\n document.info().externalDocs()\n ? `\n## External documentation\n- [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})\n`\n : ''\n}\n`;\n};\n\nexport const getSummary = (document: AsyncAPIDocumentInterface) => {\n const summary = document.info().hasDescription() ? document.info().description() : '';\n return summary && summary.length < 150 ? summary : '';\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n## Architecture diagram\n<NodeGraph />\n\n`;\n};\n","import { AsyncAPIDocumentInterface, ChannelInterface } from '@asyncapi/parser';\n\nexport const getChannelProtocols = (channel: ChannelInterface): string[] => {\n const protocols = [];\n\n const bindings = channel.bindings();\n for (const binding of bindings) {\n protocols.push(binding.protocol());\n }\n\n return protocols;\n};\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, channel: ChannelInterface) => {\n return `\n ${\n channel.hasDescription()\n ? `\n ## Overview\n ${channel.description()}\n `\n : ''\n }\n\n <ChannelInformation />\n\n ${\n channel.json()?.externalDocs\n ? `\n ## External documentation\n - [${channel.json()?.externalDocs?.description}](${channel.json()?.externalDocs?.url})\n `\n : ''\n }\n \n `;\n};\n","import 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\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 response = await fetch('https://api.eventcatalog.cloud/functions/v1/license', {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${LICENSE_KEY}`,\n 'Content-Type': 'application/json',\n },\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\": \"2.8.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\": \"^1.4.8\",\n \"chalk\": \"^4\",\n \"fs-extra\": \"^11.2.0\",\n \"glob\": \"^11.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"minimist\": \"^1.2.8\",\n \"slugify\": \"^1.6.6\",\n \"zod\": \"^3.23.8\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuF;AACvF,iBAAkB;AAClB,sBAAyB;AACzB,sBAAiB;AACjB,qBAAiB;AACjB,iBAAkB;AAClB,IAAAA,gBAAkB;AAClB,kBAAiB;AAGjB,gCAAiC;;;ACV1B,IAAM,mCAAmC,CAAC,SAA6B,OAAO;AACnF,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AACpC,MAAI,OAAO,SAAS,KAAK,EAAG,QAAO;AACnC,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AACpC,MAAI,OAAO,SAAS,SAAS,EAAG,QAAO;AACvC,MAAI,OAAO,SAAS,UAAU,EAAG,QAAO;AACxC,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AAEpC,SAAO;AACT;;;ACAO,IAAM,kBAAkB,CAAC,WAAsC,YAA8B;AAClG,SAAO;AAAA;AAAA;AAAA;AAAA,EAK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AC;AACjE;AAEA,IAAM,iBAAiB,OAAO,YAAqB;AACjD,MAAI,QAAQ,KAAK,WAAW,MAAM,GAAG;AACnC,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,QAAQ,IAAI;AACzC,aAAO,SAAS,KAAK;AAAA,IACvB,SAAS,OAAO;AACd,cAAQ,IAAI,cAAAJ,QAAM,IAAI;AAAA,uCAA0C,QAAQ,IAAI,EAAE,CAAC;AAC/E,aAAO;AAAA,IACT;AAAA,EACF,OAAO;AACL,WAAO,UAAM,0BAAS,QAAQ,MAAM,MAAM;AAAA,EAC5C;AACF;AAUA,IAAM,wBAAwB,CAAC,YAAuC;AACpE,QAAM,QAAQ,QAAQ,WAAW,EAAE,IAAI,qBAAqB,GAAG,MAAM,KAAK;AAC1E,SAAO,UAAU;AACnB;","names":["import_chalk","defaultMarkdown","getSummary","defaultMarkdown","defaultMarkdown","chalk","argv","utils","chalk","defaultMarkdown","path","getSummary","yaml"]}
package/dist/index.mjs CHANGED
@@ -148,15 +148,98 @@ var defaultMarkdown4 = (_document, channel) => {
148
148
 
149
149
  // src/checkLicense.ts
150
150
  import chalk from "chalk";
151
- var checkLicense_default = () => {
152
- console.log(chalk.bgBlue(`
153
- You are using the open source license for this plugin`));
154
- console.log(
155
- chalk.blueBright(
156
- `This plugin is governed and published under a dual-license.
157
- If using for internal, commercial or proprietary software, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`
158
- )
159
- );
151
+
152
+ // package.json
153
+ var package_default = {
154
+ name: "@eventcatalog/generator-asyncapi",
155
+ version: "2.8.0",
156
+ description: "AsyncAPI generator for EventCatalog",
157
+ scripts: {
158
+ build: "tsup",
159
+ test: "vitest",
160
+ format: "prettier --write .",
161
+ "format:diff": "prettier --list-different .",
162
+ changeset: "changeset",
163
+ release: "changeset publish"
164
+ },
165
+ publishConfig: {
166
+ access: "public"
167
+ },
168
+ keywords: [],
169
+ author: "",
170
+ license: "ISC",
171
+ devDependencies: {
172
+ "@changesets/cli": "^2.27.9",
173
+ "@types/fs-extra": "^11.0.4",
174
+ "@types/js-yaml": "^4.0.9",
175
+ "@types/lodash": "^4.17.7",
176
+ "@types/minimist": "^1.2.5",
177
+ "@types/node": "^20.16.1",
178
+ prettier: "^3.3.3",
179
+ tsup: "^8.1.0",
180
+ typescript: "^5.5.3",
181
+ vitest: "^2.0.2"
182
+ },
183
+ files: [
184
+ "dist",
185
+ "package.json"
186
+ ],
187
+ main: "./dist/index.js",
188
+ module: "./dist/index.mjs",
189
+ types: "./dist/index.d.ts",
190
+ dependencies: {
191
+ "@asyncapi/avro-schema-parser": "^3.0.24",
192
+ "@asyncapi/parser": "^3.3.0",
193
+ "@eventcatalog/sdk": "^1.4.8",
194
+ chalk: "^4",
195
+ "fs-extra": "^11.2.0",
196
+ glob: "^11.0.0",
197
+ "gray-matter": "^4.0.3",
198
+ "js-yaml": "^4.1.0",
199
+ lodash: "^4.17.21",
200
+ minimist: "^1.2.8",
201
+ slugify: "^1.6.6",
202
+ zod: "^3.23.8"
203
+ }
204
+ };
205
+
206
+ // src/checkLicense.ts
207
+ var checkLicense_default = async (licenseKey) => {
208
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
209
+ if (!LICENSE_KEY) {
210
+ console.log(chalk.bgRed(`
211
+ This plugin requires a license key to use`));
212
+ console.log(chalk.redBright(`
213
+ Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
214
+ process.exit(1);
215
+ }
216
+ const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
217
+ method: "POST",
218
+ headers: {
219
+ Authorization: `Bearer ${LICENSE_KEY}`,
220
+ "Content-Type": "application/json"
221
+ }
222
+ });
223
+ if (response.status !== 200) {
224
+ console.log(chalk.bgRed(`
225
+ Invalid license key`));
226
+ console.log(chalk.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
227
+ process.exit(1);
228
+ }
229
+ if (response.status === 200) {
230
+ const data = await response.json();
231
+ if (package_default.name !== data.plugin) {
232
+ console.log(chalk.bgRed(`
233
+ Invalid license key for this plugin`));
234
+ console.log(chalk.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
235
+ process.exit(1);
236
+ }
237
+ if (data.is_trial) {
238
+ console.log(chalk.bgBlue(`
239
+ You are using a trial license for this plugin`));
240
+ }
241
+ }
242
+ return Promise.resolve();
160
243
  };
161
244
 
162
245
  // src/index.ts
@@ -164,6 +247,7 @@ var parser = new Parser();
164
247
  parser.registerSchemaParser(AvroSchemaParser());
165
248
  var cliArgs = argv(process.argv.slice(2));
166
249
  var optionsSchema = z.object({
250
+ licenseKey: z.string().optional(),
167
251
  services: z.array(
168
252
  z.object({
169
253
  id: z.string({ required_error: "The service id is required. please provide the service id" }),
@@ -189,13 +273,14 @@ var validateOptions = (options) => {
189
273
  if (error instanceof z.ZodError) throw new Error(JSON.stringify(error.issues, null, 2));
190
274
  }
191
275
  };
192
- var src_default = async (config, options) => {
276
+ var index_default = async (config, options) => {
193
277
  if (!process.env.PROJECT_DIR) {
194
278
  process.env.PROJECT_DIR = process.cwd();
195
279
  }
196
280
  if (!process.env.PROJECT_DIR) {
197
281
  throw new Error("Please provide catalog url (env variable PROJECT_DIR)");
198
282
  }
283
+ await checkLicense_default(options.licenseKey);
199
284
  const {
200
285
  writeService,
201
286
  writeEvent,
@@ -473,7 +558,6 @@ Processing domain: ${domainName} (v${domainVersion})`));
473
558
  console.log(chalk2.green(`
474
559
  Finished generating event catalog for AsyncAPI ${serviceId} (v${version})`));
475
560
  }
476
- await checkLicense_default();
477
561
  };
478
562
  var getParsedSpecFile = (service, document) => {
479
563
  const isSpecFileJSON = service.path.endsWith(".json");
@@ -498,6 +582,6 @@ var isServiceMessageOwner = (message) => {
498
582
  return value === "provider";
499
583
  };
500
584
  export {
501
- src_default as default
585
+ index_default as default
502
586
  };
503
587
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/schemas.ts","../src/utils/messages.ts","../src/utils/services.ts","../src/utils/domains.ts","../src/utils/channels.ts","../src/checkLicense.ts"],"sourcesContent":["import { AsyncAPIDocumentInterface, MessageInterface, Parser, fromFile, fromURL } from '@asyncapi/parser';\nimport utils from '@eventcatalog/sdk';\nimport { readFile } from 'node:fs/promises';\nimport argv from 'minimist';\nimport yaml from 'js-yaml';\nimport { z } from 'zod';\nimport chalk from 'chalk';\nimport path from 'path';\n\n// AsyncAPI Parsers\nimport { AvroSchemaParser } from '@asyncapi/avro-schema-parser';\n\nimport {\n defaultMarkdown as generateMarkdownForMessage,\n getChannelsForMessage,\n getMessageName,\n getSummary as getMessageSummary,\n getSchemaFileName,\n messageHasSchema,\n} from './utils/messages';\nimport { defaultMarkdown as generateMarkdownForService, getSummary as getServiceSummary } from './utils/services';\nimport { defaultMarkdown as generateMarkdownForDomain } from './utils/domains';\nimport { defaultMarkdown as generateMarkdownForChannel, getChannelProtocols } from './utils/channels';\nimport checkLicense from './checkLicense';\n\nimport { EventType, MessageOperations } from './types';\n\nconst parser = new Parser();\n\n// register avro schema support\nparser.registerSchemaParser(AvroSchemaParser());\nconst cliArgs = argv(process.argv.slice(2));\n\nconst optionsSchema = z.object({\n services: z.array(\n z.object({\n id: z.string({ required_error: 'The service id is required. please provide the service id' }),\n path: z.string({ required_error: 'The service path is required. please provide the path to specification file' }),\n name: z.string().optional(),\n }),\n { message: 'Please provide correct services configuration' }\n ),\n domain: z\n .object({\n id: z.string({ required_error: 'The domain id is required. please provide a domain id' }),\n name: z.string({ required_error: 'The domain name is required. please provide a domain name' }),\n version: z.string({ required_error: 'The domain version is required. please provide a domain version' }),\n })\n .optional(),\n debug: z.boolean().optional(),\n parseSchemas: z.boolean().optional(),\n parseChannels: z.boolean().optional(),\n saveParsedSpecFile: z.boolean({ invalid_type_error: 'The saveParsedSpecFile is not a boolean in options' }).optional(),\n});\n\ntype Props = z.infer<typeof optionsSchema>;\ntype Domain = z.infer<typeof optionsSchema>['domain'];\ntype Service = z.infer<typeof optionsSchema>['services'][0];\n\nconst validateOptions = (options: Props) => {\n try {\n optionsSchema.parse(options);\n } catch (error: any) {\n if (error instanceof z.ZodError) throw new Error(JSON.stringify(error.issues, null, 2));\n }\n};\n\nexport default async (config: any, options: Props) => {\n if (!process.env.PROJECT_DIR) {\n process.env.PROJECT_DIR = process.cwd();\n }\n\n if (!process.env.PROJECT_DIR) {\n throw new Error('Please provide catalog url (env variable PROJECT_DIR)');\n }\n\n const {\n writeService,\n writeEvent,\n writeCommand,\n writeQuery,\n getService,\n versionService,\n getDomain,\n writeDomain,\n addServiceToDomain,\n getCommand,\n getEvent,\n getQuery,\n versionCommand,\n versionEvent,\n versionQuery,\n addSchemaToCommand,\n addSchemaToEvent,\n addSchemaToQuery,\n addFileToService,\n versionDomain,\n getSpecificationFilesForService,\n writeChannel,\n getChannel,\n versionChannel,\n } = utils(process.env.PROJECT_DIR);\n\n // Define the message operations mapping with proper types\n const MESSAGE_OPERATIONS: Record<EventType, MessageOperations> = {\n event: {\n write: writeEvent,\n version: versionEvent,\n get: getEvent,\n addSchema: addSchemaToEvent,\n },\n command: {\n write: writeCommand,\n version: versionCommand,\n get: getCommand,\n addSchema: addSchemaToCommand,\n },\n query: {\n write: writeQuery,\n version: versionQuery,\n get: getQuery,\n addSchema: addSchemaToQuery,\n },\n };\n\n // Should the file that is written to the catalog be parsed (https://github.com/asyncapi/parser-js) or as it is?\n validateOptions(options);\n\n const { services, saveParsedSpecFile = false, parseSchemas = true, parseChannels = false } = options;\n // const asyncAPIFiles = Array.isArray(options.path) ? options.path : [options.path];\n console.log(chalk.green(`Processing ${services.length} AsyncAPI files...`));\n for (const service of services) {\n console.log(chalk.gray(`Processing ${service.path}`));\n\n const { document, diagnostics } = service.path.startsWith('http')\n ? await fromURL(parser, service.path).parse({\n parseSchemas,\n })\n : await fromFile(parser, service.path).parse({\n parseSchemas,\n });\n\n if (!document) {\n console.log(chalk.red('Failed to parse AsyncAPI file'));\n if (options.debug || cliArgs.debug) {\n console.log(diagnostics);\n } else {\n console.log(chalk.red('Run with debug option in the generator to see diagnostics'));\n }\n continue;\n }\n\n const operations = document.allOperations();\n const channels = document.allChannels();\n const documentTags = document.info().tags().all() || [];\n\n const serviceId = service.id;\n\n const serviceName = service.name || document.info().title();\n const version = document.info().version();\n\n // What messages does this service send and receive\n let sends = [];\n let receives = [];\n\n let owners = null;\n let repository = null;\n\n let serviceSpecifications = {};\n let serviceSpecificationsFiles = [];\n let serviceMarkdown = generateMarkdownForService(document);\n\n // Manage domain\n if (options.domain) {\n // Try and get the domain\n const { id: domainId, name: domainName, version: domainVersion } = options.domain;\n const domain = await getDomain(options.domain.id, domainVersion || 'latest');\n const currentDomain = await getDomain(options.domain.id, 'latest');\n\n console.log(chalk.blue(`\\nProcessing domain: ${domainName} (v${domainVersion})`));\n\n // Found a domain, but the versions do not match\n if (currentDomain && currentDomain.version !== domainVersion) {\n await versionDomain(domainId);\n console.log(chalk.cyan(` - Versioned previous domain (v${currentDomain.version})`));\n }\n\n // Do we need to create a new domain?\n if (!domain || (domain && domain.version !== domainVersion)) {\n await writeDomain({\n id: domainId,\n name: domainName,\n version: domainVersion,\n markdown: generateMarkdownForDomain(document),\n // services: [{ id: serviceId, version: version }],\n });\n console.log(chalk.cyan(` - Domain (v${domainVersion}) created`));\n }\n\n if (currentDomain && currentDomain.version === domainVersion) {\n console.log(chalk.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));\n }\n\n // Add the service to the domain\n await addServiceToDomain(domainId, { id: serviceId, version: version }, domainVersion);\n }\n\n // Parse channels\n if (parseChannels) {\n for (const channel of channels) {\n const channelAsJSON = channel.json();\n const channelId = channel.id();\n const params = channelAsJSON?.parameters || {};\n const protocols = getChannelProtocols(channel);\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || version;\n let channelMarkdown = generateMarkdownForChannel(document, channel);\n\n console.log(chalk.blue(`Processing channel: ${channelId} (v${channelVersion})`));\n\n const paramsForCatalog = Object.keys(params).reduce(\n (acc, key) => {\n const param = params[key];\n acc[key] = {};\n if (param.enum) acc[key].enum = param.enum;\n if (param.default) acc[key].default = param.default;\n if (param.examples) acc[key].examples = param.examples;\n if (param.description) acc[key].description = param.description;\n return acc;\n },\n {} as Record<string, { enum?: string[]; default?: string; examples?: string[]; description?: string }>\n );\n\n const catalogedChannel = await getChannel(channelId, 'latest');\n\n if (catalogedChannel) {\n channelMarkdown = catalogedChannel.markdown;\n if (catalogedChannel.version !== channelVersion) {\n await versionChannel(channelId);\n console.log(chalk.cyan(` - Versioned previous channel: ${channelId} (v${channelVersion})`));\n }\n }\n\n await writeChannel(\n {\n id: channelId,\n name: channelAsJSON?.title || channel.id(),\n markdown: channelMarkdown,\n version: channelVersion,\n ...(Object.keys(paramsForCatalog).length > 0 && { parameters: paramsForCatalog }),\n ...(channel.address() && { address: channel.address() }),\n ...(channelAsJSON?.summary && { summary: channelAsJSON.summary }),\n ...(protocols.length > 0 && { protocols }),\n },\n { override: true }\n );\n\n console.log(chalk.cyan(` - Message ${channelId} (v${version}) created`));\n }\n }\n\n // Find events/commands\n for (const operation of operations) {\n for (const message of operation.messages()) {\n const eventType = (message.extensions().get('x-eventcatalog-message-type')?.value() as EventType) || 'event';\n const messageVersion = message.extensions().get('x-eventcatalog-message-version')?.value() || version;\n\n // does this service own or just consume the message?\n const serviceOwnsMessageContract = isServiceMessageOwner(message);\n const isReceived = operation.action() === 'receive' || operation.action() === 'subscribe';\n const isSent = operation.action() === 'send' || operation.action() === 'publish';\n\n const messageId = message.id().toLowerCase();\n\n if (eventType !== 'event' && eventType !== 'command' && eventType !== 'query') {\n throw new Error('Invalid message type');\n }\n\n const {\n write: writeMessage,\n version: versionMessage,\n get: getMessage,\n addSchema: addSchemaToMessage,\n } = MESSAGE_OPERATIONS[eventType];\n\n let messageMarkdown = generateMarkdownForMessage(document, message);\n const badges = message.tags().all() || [];\n\n console.log(chalk.blue(`Processing message: ${getMessageName(message)} (v${messageVersion})`));\n\n if (serviceOwnsMessageContract) {\n // Check if the message already exists in the catalog\n const catalogedMessage = await getMessage(message.id().toLowerCase(), 'latest');\n\n if (catalogedMessage) {\n // persist markdown if it exists\n messageMarkdown = catalogedMessage.markdown;\n\n if (catalogedMessage.version !== messageVersion) {\n // if the version does not match, we need to version the message\n await versionMessage(messageId);\n console.log(chalk.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));\n }\n }\n\n const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document) : [];\n\n // Write the message to the catalog\n await writeMessage(\n {\n id: messageId,\n version: messageVersion,\n name: getMessageName(message),\n summary: getMessageSummary(message),\n markdown: messageMarkdown,\n badges: badges.map((badge) => ({ content: badge.name(), textColor: 'blue', backgroundColor: 'blue' })),\n schemaPath: messageHasSchema(message) ? getSchemaFileName(message) : undefined,\n ...(channelsForMessage.length > 0 && { channels: channelsForMessage }),\n },\n {\n override: true,\n path: message.id(),\n }\n );\n\n console.log(chalk.cyan(` - Message (v${messageVersion}) created`));\n // Check if the message has a payload, if it does then document in EventCatalog\n if (messageHasSchema(message)) {\n // Get the schema from the original payload if it exists\n const schema = message.payload()?.extensions()?.get('x-parser-original-payload')?.json() || message.payload()?.json();\n\n await addSchemaToMessage(\n messageId,\n {\n fileName: getSchemaFileName(message),\n schema: JSON.stringify(schema, null, 4),\n },\n messageVersion\n );\n console.log(chalk.cyan(` - Schema added to message (v${messageVersion})`));\n }\n } else {\n // Message is not owned by this service, therefore we don't need to document it\n console.log(chalk.yellow(` - Skipping external message: ${getMessageName(message)}(v${messageVersion})`));\n }\n // Add the message to the correct array\n if (isSent) sends.push({ id: messageId, version: messageVersion });\n if (isReceived) receives.push({ id: messageId, version: messageVersion });\n }\n }\n\n // Check if service is already defined... if the versions do not match then create service.\n const latestServiceInCatalog = await getService(serviceId, 'latest');\n\n console.log(chalk.blue(`Processing service: ${serviceId} (v${version})`));\n\n if (latestServiceInCatalog) {\n serviceMarkdown = latestServiceInCatalog.markdown;\n owners = latestServiceInCatalog.owners || ([] as any);\n repository = latestServiceInCatalog.repository || null;\n\n // Found a service, and versions do not match, we need to version the one already there\n if (latestServiceInCatalog.version !== version) {\n await versionService(serviceId);\n console.log(chalk.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));\n }\n\n // Match found, persist data\n if (latestServiceInCatalog.version === version) {\n // we want to preserve the markdown any any spec files that are already there\n serviceMarkdown = latestServiceInCatalog.markdown;\n serviceSpecifications = latestServiceInCatalog.specifications ?? {};\n sends = latestServiceInCatalog.sends ? [...latestServiceInCatalog.sends, ...sends] : sends;\n receives = latestServiceInCatalog.receives ? [...latestServiceInCatalog.receives, ...receives] : receives;\n serviceSpecificationsFiles = await getSpecificationFilesForService(serviceId, version);\n }\n }\n\n const fileName = path.basename(service.path);\n\n await writeService(\n {\n id: serviceId,\n name: serviceName,\n version: version,\n summary: getServiceSummary(document),\n badges: documentTags.map((tag) => ({ content: tag.name(), textColor: 'blue', backgroundColor: 'blue' })),\n markdown: serviceMarkdown,\n sends,\n receives,\n schemaPath: fileName || 'asyncapi.yml',\n specifications: {\n ...serviceSpecifications,\n asyncapiPath: fileName || 'asyncapi.yml',\n },\n ...(owners && { owners }),\n ...(repository && { repository }),\n },\n {\n override: true,\n }\n );\n\n // What files need added to the service (speficiation files)\n const specFiles = [\n // add any previous spec files to the list\n ...serviceSpecificationsFiles,\n {\n content: saveParsedSpecFile ? getParsedSpecFile(service, document) : await getRawSpecFile(service),\n fileName: path.basename(service.path) || 'asyncapi.yml',\n },\n ];\n\n for (const specFile of specFiles) {\n await addFileToService(\n serviceId,\n {\n fileName: specFile.fileName,\n content: specFile.content,\n },\n version\n );\n }\n\n console.log(chalk.cyan(` - Service (v${version}) created`));\n\n console.log(chalk.green(`\\nFinished generating event catalog for AsyncAPI ${serviceId} (v${version})`));\n }\n\n await checkLicense();\n};\n\nconst getParsedSpecFile = (service: Service, document: AsyncAPIDocumentInterface) => {\n const isSpecFileJSON = service.path.endsWith('.json');\n return isSpecFileJSON\n ? JSON.stringify(document.meta().asyncapi.parsed, null, 4)\n : yaml.dump(document.meta().asyncapi.parsed, { noRefs: true });\n};\n\nconst getRawSpecFile = async (service: Service) => {\n if (service.path.startsWith('http')) {\n try {\n const response = await fetch(service.path);\n return response.text();\n } catch (error) {\n console.log(chalk.red(`\\nFailed to request AsyncAPI file from ${service.path}`));\n return '';\n }\n } else {\n return await readFile(service.path, 'utf8');\n }\n};\n/**\n * Is the AsyncAPI specification (service) the owner of the message?\n * This is determined by the 'x-eventcatalog-role' extension in the message\n *\n * @param message\n * @returns boolean\n *\n * default is provider (AsyncAPI file / service owns the message)\n */\nconst isServiceMessageOwner = (message: MessageInterface): boolean => {\n const value = message.extensions().get('x-eventcatalog-role')?.value() || 'provider';\n return value === 'provider';\n};\n","export const getFileExtentionFromSchemaFormat = (format: string | undefined = '') => {\n if (format.includes('avro')) return 'avsc';\n if (format.includes('yml')) return 'yml';\n if (format.includes('json')) return 'json';\n if (format.includes('openapi')) return 'openapi';\n if (format.includes('protobuf')) return 'protobuf';\n if (format.includes('yaml')) return 'yaml';\n\n return 'json';\n};\n","import {\n MessageInterface,\n AsyncAPIDocumentInterface,\n ChannelInterface,\n ChannelsInterface,\n MessagesInterface,\n} from '@asyncapi/parser';\nimport { getFileExtentionFromSchemaFormat } from './schemas';\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, message: MessageInterface) => {\n return `\n## Architecture\n<NodeGraph />\n\n${\n messageHasSchema(message) && messageIsJSON(message)\n ? `\n## Schema\n<SchemaViewer file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n${\n messageHasSchema(message) && !messageIsJSON(message)\n ? `\n## Schema\n<Schema file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n\n${\n message.externalDocs()\n ? `\n## External documentation\n- [${message.externalDocs()?.description()}](${message.externalDocs()?.url()})\n`\n : ''\n}\n\n`;\n};\n\nexport const getSummary = (message: MessageInterface) => {\n const messageSummary = message.hasSummary() ? message.summary() : '';\n const messageDescription = message.hasDescription() ? message.description() : '';\n\n let eventCatalogMessageSummary = messageSummary;\n\n if (!eventCatalogMessageSummary) {\n eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : '';\n }\n\n return eventCatalogMessageSummary;\n};\n\nexport const messageHasSchema = (message: MessageInterface) => {\n return message.hasPayload() && message.schemaFormat();\n};\n\nexport const messageIsJSON = (message: MessageInterface) => {\n const fileName = getSchemaFileName(message);\n return fileName.endsWith('.json');\n};\n\nexport const getSchemaFileName = (message: MessageInterface) => {\n const extension = getFileExtentionFromSchemaFormat(message.schemaFormat());\n return `schema.${extension}`;\n};\n\nexport const getMessageName = (message: MessageInterface) => {\n return message.hasTitle() && message.title() ? (message.title() as string) : message.id();\n};\n\nexport const getChannelsForMessage = (\n message: MessageInterface,\n channels: ChannelsInterface,\n document: AsyncAPIDocumentInterface\n): { id: string; version: string }[] => {\n let channelsForMessage: ChannelInterface[] = [];\n const globalVersion = document.info().version();\n\n // Go through all channels and link messages they document\n for (const channel of channels) {\n for (const channelMessage of channel.messages() as MessagesInterface) {\n if (channelMessage.id() === message.id()) {\n channelsForMessage.push(channel);\n }\n }\n }\n\n // You can also document a message directly to a channel, add them too\n for (const messageChannel of message.channels()) {\n channelsForMessage.push(messageChannel);\n }\n\n // Make them unique, as there may be overlapping channels\n const uniqueChannels = channelsForMessage.filter(\n (channel, index, self) => index === self.findIndex((t) => t.id() === channel.id())\n );\n\n return uniqueChannels.map((channel) => {\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || globalVersion;\n return {\n id: channel.id(),\n version: channelVersion,\n };\n });\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n${document.info().hasDescription() ? `${document.info().description()}` : ''} \n\n## Architecture diagram\n<NodeGraph />\n\n${\n document.info().externalDocs()\n ? `\n## External documentation\n- [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})\n`\n : ''\n}\n`;\n};\n\nexport const getSummary = (document: AsyncAPIDocumentInterface) => {\n const summary = document.info().hasDescription() ? document.info().description() : '';\n return summary && summary.length < 150 ? summary : '';\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n## Architecture diagram\n<NodeGraph />\n\n`;\n};\n","import { AsyncAPIDocumentInterface, ChannelInterface } from '@asyncapi/parser';\n\nexport const getChannelProtocols = (channel: ChannelInterface): string[] => {\n const protocols = [];\n\n const bindings = channel.bindings();\n for (const binding of bindings) {\n protocols.push(binding.protocol());\n }\n\n return protocols;\n};\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, channel: ChannelInterface) => {\n return `\n ${\n channel.hasDescription()\n ? `\n ## Overview\n ${channel.description()}\n `\n : ''\n }\n\n <ChannelInformation />\n\n ${\n channel.json()?.externalDocs\n ? `\n ## External documentation\n - [${channel.json()?.externalDocs?.description}](${channel.json()?.externalDocs?.url})\n `\n : ''\n }\n \n `;\n};\n","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, you can purchase a license at https://dashboard.eventcatalog.dev/ or contact us hello@eventcatalog.dev.`\n )\n );\n};\n"],"mappings":";AAAA,SAAsD,QAAQ,UAAU,eAAe;AACvF,OAAO,WAAW;AAClB,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,SAAS,SAAS;AAClB,OAAOA,YAAW;AAClB,OAAO,UAAU;AAGjB,SAAS,wBAAwB;;;ACV1B,IAAM,mCAAmC,CAAC,SAA6B,OAAO;AACnF,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AACpC,MAAI,OAAO,SAAS,K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AAQ,QAAQ,WAAW,EAAE,IAAI,qBAAqB,GAAG,MAAM,KAAK;AAC1E,SAAO,UAAU;AACnB;","names":["chalk","defaultMarkdown","getSummary","defaultMarkdown","defaultMarkdown","chalk","defaultMarkdown","getSummary"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/schemas.ts","../src/utils/messages.ts","../src/utils/services.ts","../src/utils/domains.ts","../src/utils/channels.ts","../src/checkLicense.ts","../package.json"],"sourcesContent":["import { AsyncAPIDocumentInterface, MessageInterface, Parser, fromFile, fromURL } from '@asyncapi/parser';\nimport utils from '@eventcatalog/sdk';\nimport { readFile } from 'node:fs/promises';\nimport argv from 'minimist';\nimport yaml from 'js-yaml';\nimport { z } from 'zod';\nimport chalk from 'chalk';\nimport path from 'path';\n\n// AsyncAPI Parsers\nimport { AvroSchemaParser } from '@asyncapi/avro-schema-parser';\n\nimport {\n defaultMarkdown as generateMarkdownForMessage,\n getChannelsForMessage,\n getMessageName,\n getSummary as getMessageSummary,\n getSchemaFileName,\n messageHasSchema,\n} from './utils/messages';\nimport { defaultMarkdown as generateMarkdownForService, getSummary as getServiceSummary } from './utils/services';\nimport { defaultMarkdown as generateMarkdownForDomain } from './utils/domains';\nimport { defaultMarkdown as generateMarkdownForChannel, getChannelProtocols } from './utils/channels';\nimport checkLicense from './checkLicense';\n\nimport { EventType, MessageOperations } from './types';\n\nconst parser = new Parser();\n\n// register avro schema support\nparser.registerSchemaParser(AvroSchemaParser());\nconst cliArgs = argv(process.argv.slice(2));\n\nconst optionsSchema = z.object({\n licenseKey: z.string().optional(),\n services: z.array(\n z.object({\n id: z.string({ required_error: 'The service id is required. please provide the service id' }),\n path: z.string({ required_error: 'The service path is required. please provide the path to specification file' }),\n name: z.string().optional(),\n }),\n { message: 'Please provide correct services configuration' }\n ),\n domain: z\n .object({\n id: z.string({ required_error: 'The domain id is required. please provide a domain id' }),\n name: z.string({ required_error: 'The domain name is required. please provide a domain name' }),\n version: z.string({ required_error: 'The domain version is required. please provide a domain version' }),\n })\n .optional(),\n debug: z.boolean().optional(),\n parseSchemas: z.boolean().optional(),\n parseChannels: z.boolean().optional(),\n saveParsedSpecFile: z.boolean({ invalid_type_error: 'The saveParsedSpecFile is not a boolean in options' }).optional(),\n});\n\ntype Props = z.infer<typeof optionsSchema>;\ntype Domain = z.infer<typeof optionsSchema>['domain'];\ntype Service = z.infer<typeof optionsSchema>['services'][0];\n\nconst validateOptions = (options: Props) => {\n try {\n optionsSchema.parse(options);\n } catch (error: any) {\n if (error instanceof z.ZodError) throw new Error(JSON.stringify(error.issues, null, 2));\n }\n};\n\nexport default async (config: any, options: Props) => {\n if (!process.env.PROJECT_DIR) {\n process.env.PROJECT_DIR = process.cwd();\n }\n\n if (!process.env.PROJECT_DIR) {\n throw new Error('Please provide catalog url (env variable PROJECT_DIR)');\n }\n\n await checkLicense(options.licenseKey);\n\n const {\n writeService,\n writeEvent,\n writeCommand,\n writeQuery,\n getService,\n versionService,\n getDomain,\n writeDomain,\n addServiceToDomain,\n getCommand,\n getEvent,\n getQuery,\n versionCommand,\n versionEvent,\n versionQuery,\n addSchemaToCommand,\n addSchemaToEvent,\n addSchemaToQuery,\n addFileToService,\n versionDomain,\n getSpecificationFilesForService,\n writeChannel,\n getChannel,\n versionChannel,\n } = utils(process.env.PROJECT_DIR);\n\n // Define the message operations mapping with proper types\n const MESSAGE_OPERATIONS: Record<EventType, MessageOperations> = {\n event: {\n write: writeEvent,\n version: versionEvent,\n get: getEvent,\n addSchema: addSchemaToEvent,\n },\n command: {\n write: writeCommand,\n version: versionCommand,\n get: getCommand,\n addSchema: addSchemaToCommand,\n },\n query: {\n write: writeQuery,\n version: versionQuery,\n get: getQuery,\n addSchema: addSchemaToQuery,\n },\n };\n\n // Should the file that is written to the catalog be parsed (https://github.com/asyncapi/parser-js) or as it is?\n validateOptions(options);\n\n const { services, saveParsedSpecFile = false, parseSchemas = true, parseChannels = false } = options;\n // const asyncAPIFiles = Array.isArray(options.path) ? options.path : [options.path];\n console.log(chalk.green(`Processing ${services.length} AsyncAPI files...`));\n for (const service of services) {\n console.log(chalk.gray(`Processing ${service.path}`));\n\n const { document, diagnostics } = service.path.startsWith('http')\n ? await fromURL(parser, service.path).parse({\n parseSchemas,\n })\n : await fromFile(parser, service.path).parse({\n parseSchemas,\n });\n\n if (!document) {\n console.log(chalk.red('Failed to parse AsyncAPI file'));\n if (options.debug || cliArgs.debug) {\n console.log(diagnostics);\n } else {\n console.log(chalk.red('Run with debug option in the generator to see diagnostics'));\n }\n continue;\n }\n\n const operations = document.allOperations();\n const channels = document.allChannels();\n const documentTags = document.info().tags().all() || [];\n\n const serviceId = service.id;\n\n const serviceName = service.name || document.info().title();\n const version = document.info().version();\n\n // What messages does this service send and receive\n let sends = [];\n let receives = [];\n\n let owners = null;\n let repository = null;\n\n let serviceSpecifications = {};\n let serviceSpecificationsFiles = [];\n let serviceMarkdown = generateMarkdownForService(document);\n\n // Manage domain\n if (options.domain) {\n // Try and get the domain\n const { id: domainId, name: domainName, version: domainVersion } = options.domain;\n const domain = await getDomain(options.domain.id, domainVersion || 'latest');\n const currentDomain = await getDomain(options.domain.id, 'latest');\n\n console.log(chalk.blue(`\\nProcessing domain: ${domainName} (v${domainVersion})`));\n\n // Found a domain, but the versions do not match\n if (currentDomain && currentDomain.version !== domainVersion) {\n await versionDomain(domainId);\n console.log(chalk.cyan(` - Versioned previous domain (v${currentDomain.version})`));\n }\n\n // Do we need to create a new domain?\n if (!domain || (domain && domain.version !== domainVersion)) {\n await writeDomain({\n id: domainId,\n name: domainName,\n version: domainVersion,\n markdown: generateMarkdownForDomain(document),\n // services: [{ id: serviceId, version: version }],\n });\n console.log(chalk.cyan(` - Domain (v${domainVersion}) created`));\n }\n\n if (currentDomain && currentDomain.version === domainVersion) {\n console.log(chalk.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));\n }\n\n // Add the service to the domain\n await addServiceToDomain(domainId, { id: serviceId, version: version }, domainVersion);\n }\n\n // Parse channels\n if (parseChannels) {\n for (const channel of channels) {\n const channelAsJSON = channel.json();\n const channelId = channel.id();\n const params = channelAsJSON?.parameters || {};\n const protocols = getChannelProtocols(channel);\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || version;\n let channelMarkdown = generateMarkdownForChannel(document, channel);\n\n console.log(chalk.blue(`Processing channel: ${channelId} (v${channelVersion})`));\n\n const paramsForCatalog = Object.keys(params).reduce(\n (acc, key) => {\n const param = params[key];\n acc[key] = {};\n if (param.enum) acc[key].enum = param.enum;\n if (param.default) acc[key].default = param.default;\n if (param.examples) acc[key].examples = param.examples;\n if (param.description) acc[key].description = param.description;\n return acc;\n },\n {} as Record<string, { enum?: string[]; default?: string; examples?: string[]; description?: string }>\n );\n\n const catalogedChannel = await getChannel(channelId, 'latest');\n\n if (catalogedChannel) {\n channelMarkdown = catalogedChannel.markdown;\n if (catalogedChannel.version !== channelVersion) {\n await versionChannel(channelId);\n console.log(chalk.cyan(` - Versioned previous channel: ${channelId} (v${channelVersion})`));\n }\n }\n\n await writeChannel(\n {\n id: channelId,\n name: channelAsJSON?.title || channel.id(),\n markdown: channelMarkdown,\n version: channelVersion,\n ...(Object.keys(paramsForCatalog).length > 0 && { parameters: paramsForCatalog }),\n ...(channel.address() && { address: channel.address() }),\n ...(channelAsJSON?.summary && { summary: channelAsJSON.summary }),\n ...(protocols.length > 0 && { protocols }),\n },\n { override: true }\n );\n\n console.log(chalk.cyan(` - Message ${channelId} (v${version}) created`));\n }\n }\n\n // Find events/commands\n for (const operation of operations) {\n for (const message of operation.messages()) {\n const eventType = (message.extensions().get('x-eventcatalog-message-type')?.value() as EventType) || 'event';\n const messageVersion = message.extensions().get('x-eventcatalog-message-version')?.value() || version;\n\n // does this service own or just consume the message?\n const serviceOwnsMessageContract = isServiceMessageOwner(message);\n const isReceived = operation.action() === 'receive' || operation.action() === 'subscribe';\n const isSent = operation.action() === 'send' || operation.action() === 'publish';\n\n const messageId = message.id().toLowerCase();\n\n if (eventType !== 'event' && eventType !== 'command' && eventType !== 'query') {\n throw new Error('Invalid message type');\n }\n\n const {\n write: writeMessage,\n version: versionMessage,\n get: getMessage,\n addSchema: addSchemaToMessage,\n } = MESSAGE_OPERATIONS[eventType];\n\n let messageMarkdown = generateMarkdownForMessage(document, message);\n const badges = message.tags().all() || [];\n\n console.log(chalk.blue(`Processing message: ${getMessageName(message)} (v${messageVersion})`));\n\n if (serviceOwnsMessageContract) {\n // Check if the message already exists in the catalog\n const catalogedMessage = await getMessage(message.id().toLowerCase(), 'latest');\n\n if (catalogedMessage) {\n // persist markdown if it exists\n messageMarkdown = catalogedMessage.markdown;\n\n if (catalogedMessage.version !== messageVersion) {\n // if the version does not match, we need to version the message\n await versionMessage(messageId);\n console.log(chalk.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));\n }\n }\n\n const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document) : [];\n\n // Write the message to the catalog\n await writeMessage(\n {\n id: messageId,\n version: messageVersion,\n name: getMessageName(message),\n summary: getMessageSummary(message),\n markdown: messageMarkdown,\n badges: badges.map((badge) => ({ content: badge.name(), textColor: 'blue', backgroundColor: 'blue' })),\n schemaPath: messageHasSchema(message) ? getSchemaFileName(message) : undefined,\n ...(channelsForMessage.length > 0 && { channels: channelsForMessage }),\n },\n {\n override: true,\n path: message.id(),\n }\n );\n\n console.log(chalk.cyan(` - Message (v${messageVersion}) created`));\n // Check if the message has a payload, if it does then document in EventCatalog\n if (messageHasSchema(message)) {\n // Get the schema from the original payload if it exists\n const schema = message.payload()?.extensions()?.get('x-parser-original-payload')?.json() || message.payload()?.json();\n\n await addSchemaToMessage(\n messageId,\n {\n fileName: getSchemaFileName(message),\n schema: JSON.stringify(schema, null, 4),\n },\n messageVersion\n );\n console.log(chalk.cyan(` - Schema added to message (v${messageVersion})`));\n }\n } else {\n // Message is not owned by this service, therefore we don't need to document it\n console.log(chalk.yellow(` - Skipping external message: ${getMessageName(message)}(v${messageVersion})`));\n }\n // Add the message to the correct array\n if (isSent) sends.push({ id: messageId, version: messageVersion });\n if (isReceived) receives.push({ id: messageId, version: messageVersion });\n }\n }\n\n // Check if service is already defined... if the versions do not match then create service.\n const latestServiceInCatalog = await getService(serviceId, 'latest');\n\n console.log(chalk.blue(`Processing service: ${serviceId} (v${version})`));\n\n if (latestServiceInCatalog) {\n serviceMarkdown = latestServiceInCatalog.markdown;\n owners = latestServiceInCatalog.owners || ([] as any);\n repository = latestServiceInCatalog.repository || null;\n\n // Found a service, and versions do not match, we need to version the one already there\n if (latestServiceInCatalog.version !== version) {\n await versionService(serviceId);\n console.log(chalk.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));\n }\n\n // Match found, persist data\n if (latestServiceInCatalog.version === version) {\n // we want to preserve the markdown any any spec files that are already there\n serviceMarkdown = latestServiceInCatalog.markdown;\n serviceSpecifications = latestServiceInCatalog.specifications ?? {};\n sends = latestServiceInCatalog.sends ? [...latestServiceInCatalog.sends, ...sends] : sends;\n receives = latestServiceInCatalog.receives ? [...latestServiceInCatalog.receives, ...receives] : receives;\n serviceSpecificationsFiles = await getSpecificationFilesForService(serviceId, version);\n }\n }\n\n const fileName = path.basename(service.path);\n\n await writeService(\n {\n id: serviceId,\n name: serviceName,\n version: version,\n summary: getServiceSummary(document),\n badges: documentTags.map((tag) => ({ content: tag.name(), textColor: 'blue', backgroundColor: 'blue' })),\n markdown: serviceMarkdown,\n sends,\n receives,\n schemaPath: fileName || 'asyncapi.yml',\n specifications: {\n ...serviceSpecifications,\n asyncapiPath: fileName || 'asyncapi.yml',\n },\n ...(owners && { owners }),\n ...(repository && { repository }),\n },\n {\n override: true,\n }\n );\n\n // What files need added to the service (speficiation files)\n const specFiles = [\n // add any previous spec files to the list\n ...serviceSpecificationsFiles,\n {\n content: saveParsedSpecFile ? getParsedSpecFile(service, document) : await getRawSpecFile(service),\n fileName: path.basename(service.path) || 'asyncapi.yml',\n },\n ];\n\n for (const specFile of specFiles) {\n await addFileToService(\n serviceId,\n {\n fileName: specFile.fileName,\n content: specFile.content,\n },\n version\n );\n }\n\n console.log(chalk.cyan(` - Service (v${version}) created`));\n\n console.log(chalk.green(`\\nFinished generating event catalog for AsyncAPI ${serviceId} (v${version})`));\n }\n};\n\nconst getParsedSpecFile = (service: Service, document: AsyncAPIDocumentInterface) => {\n const isSpecFileJSON = service.path.endsWith('.json');\n return isSpecFileJSON\n ? JSON.stringify(document.meta().asyncapi.parsed, null, 4)\n : yaml.dump(document.meta().asyncapi.parsed, { noRefs: true });\n};\n\nconst getRawSpecFile = async (service: Service) => {\n if (service.path.startsWith('http')) {\n try {\n const response = await fetch(service.path);\n return response.text();\n } catch (error) {\n console.log(chalk.red(`\\nFailed to request AsyncAPI file from ${service.path}`));\n return '';\n }\n } else {\n return await readFile(service.path, 'utf8');\n }\n};\n/**\n * Is the AsyncAPI specification (service) the owner of the message?\n * This is determined by the 'x-eventcatalog-role' extension in the message\n *\n * @param message\n * @returns boolean\n *\n * default is provider (AsyncAPI file / service owns the message)\n */\nconst isServiceMessageOwner = (message: MessageInterface): boolean => {\n const value = message.extensions().get('x-eventcatalog-role')?.value() || 'provider';\n return value === 'provider';\n};\n","export const getFileExtentionFromSchemaFormat = (format: string | undefined = '') => {\n if (format.includes('avro')) return 'avsc';\n if (format.includes('yml')) return 'yml';\n if (format.includes('json')) return 'json';\n if (format.includes('openapi')) return 'openapi';\n if (format.includes('protobuf')) return 'protobuf';\n if (format.includes('yaml')) return 'yaml';\n\n return 'json';\n};\n","import {\n MessageInterface,\n AsyncAPIDocumentInterface,\n ChannelInterface,\n ChannelsInterface,\n MessagesInterface,\n} from '@asyncapi/parser';\nimport { getFileExtentionFromSchemaFormat } from './schemas';\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, message: MessageInterface) => {\n return `\n## Architecture\n<NodeGraph />\n\n${\n messageHasSchema(message) && messageIsJSON(message)\n ? `\n## Schema\n<SchemaViewer file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n${\n messageHasSchema(message) && !messageIsJSON(message)\n ? `\n## Schema\n<Schema file=\"${getSchemaFileName(message)}\" title=\"Message Schema\" maxHeight=\"500\" />\n`\n : ''\n}\n\n${\n message.externalDocs()\n ? `\n## External documentation\n- [${message.externalDocs()?.description()}](${message.externalDocs()?.url()})\n`\n : ''\n}\n\n`;\n};\n\nexport const getSummary = (message: MessageInterface) => {\n const messageSummary = message.hasSummary() ? message.summary() : '';\n const messageDescription = message.hasDescription() ? message.description() : '';\n\n let eventCatalogMessageSummary = messageSummary;\n\n if (!eventCatalogMessageSummary) {\n eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : '';\n }\n\n return eventCatalogMessageSummary;\n};\n\nexport const messageHasSchema = (message: MessageInterface) => {\n return message.hasPayload() && message.schemaFormat();\n};\n\nexport const messageIsJSON = (message: MessageInterface) => {\n const fileName = getSchemaFileName(message);\n return fileName.endsWith('.json');\n};\n\nexport const getSchemaFileName = (message: MessageInterface) => {\n const extension = getFileExtentionFromSchemaFormat(message.schemaFormat());\n return `schema.${extension}`;\n};\n\nexport const getMessageName = (message: MessageInterface) => {\n return message.hasTitle() && message.title() ? (message.title() as string) : message.id();\n};\n\nexport const getChannelsForMessage = (\n message: MessageInterface,\n channels: ChannelsInterface,\n document: AsyncAPIDocumentInterface\n): { id: string; version: string }[] => {\n let channelsForMessage: ChannelInterface[] = [];\n const globalVersion = document.info().version();\n\n // Go through all channels and link messages they document\n for (const channel of channels) {\n for (const channelMessage of channel.messages() as MessagesInterface) {\n if (channelMessage.id() === message.id()) {\n channelsForMessage.push(channel);\n }\n }\n }\n\n // You can also document a message directly to a channel, add them too\n for (const messageChannel of message.channels()) {\n channelsForMessage.push(messageChannel);\n }\n\n // Make them unique, as there may be overlapping channels\n const uniqueChannels = channelsForMessage.filter(\n (channel, index, self) => index === self.findIndex((t) => t.id() === channel.id())\n );\n\n return uniqueChannels.map((channel) => {\n const channelVersion = channel.extensions().get('x-eventcatalog-channel-version')?.value() || globalVersion;\n return {\n id: channel.id(),\n version: channelVersion,\n };\n });\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n${document.info().hasDescription() ? `${document.info().description()}` : ''} \n\n## Architecture diagram\n<NodeGraph />\n\n${\n document.info().externalDocs()\n ? `\n## External documentation\n- [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})\n`\n : ''\n}\n`;\n};\n\nexport const getSummary = (document: AsyncAPIDocumentInterface) => {\n const summary = document.info().hasDescription() ? document.info().description() : '';\n return summary && summary.length < 150 ? summary : '';\n};\n","import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport const defaultMarkdown = (document: AsyncAPIDocumentInterface) => {\n return `\n\n## Architecture diagram\n<NodeGraph />\n\n`;\n};\n","import { AsyncAPIDocumentInterface, ChannelInterface } from '@asyncapi/parser';\n\nexport const getChannelProtocols = (channel: ChannelInterface): string[] => {\n const protocols = [];\n\n const bindings = channel.bindings();\n for (const binding of bindings) {\n protocols.push(binding.protocol());\n }\n\n return protocols;\n};\n\nexport const defaultMarkdown = (_document: AsyncAPIDocumentInterface, channel: ChannelInterface) => {\n return `\n ${\n channel.hasDescription()\n ? `\n ## Overview\n ${channel.description()}\n `\n : ''\n }\n\n <ChannelInformation />\n\n ${\n channel.json()?.externalDocs\n ? `\n ## External documentation\n - [${channel.json()?.externalDocs?.description}](${channel.json()?.externalDocs?.url})\n `\n : ''\n }\n \n `;\n};\n","import 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\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 response = await fetch('https://api.eventcatalog.cloud/functions/v1/license', {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${LICENSE_KEY}`,\n 'Content-Type': 'application/json',\n },\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\": \"2.8.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\": \"^1.4.8\",\n \"chalk\": \"^4\",\n \"fs-extra\": \"^11.2.0\",\n \"glob\": \"^11.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"minimist\": \"^1.2.8\",\n \"slugify\": \"^1.6.6\",\n \"zod\": \"^3.23.8\"\n }\n}\n"],"mappings":";AAAA,SAAsD,QAAQ,UAAU,eAAe;AACvF,OAAO,WAAW;AAClB,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,SAAS,SAAS;AAClB,OAAOA,YAAW;AAClB,OAAO,UAAU;AAGjB,SAAS,wBAAwB;;;ACV1B,IAAM,mCAAmC,CAAC,SAA6B,OAAO;AACnF,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AACpC,MAAI,OAAO,SAAS,KAAK,EAAG,QAAO;AACnC,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AACpC,MAAI,OAAO,SAAS,SAAS,EAAG,QAAO;AACvC,MAAI,OAAO,SAAS,UAAU,EAAG,QAAO;AACxC,MAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AAEpC,SAAO;AACT;;;ACAO,IAAM,kBAAkB,CAAC,WAAsC,YAA8B;AAClG,SAAO;AAAA;AAAA;AAAA;AAAA,EAKP,iBAAiB,OAAO,KAAK,cAAc,OAAO,IAC9C;AAAA;AAAA,sBAEgB,kBAAkB,OAAO,CAAC;AAAA,IAE1C,EACN;AAAA,EAEE,iBAAiB,OAAO,KAAK,CAAC,cAAc,OAAO,IAC/C;AAAA;AAAA,gBAEU,kBAAkB,OAAO,CAAC;AAAA,IAEpC,EACN;AAAA;AAAA,EAGE,QAAQ,aAAa,IACjB;AAAA;AAAA,KAED,QAAQ,aAAa,GAAG,YAAY,CAAC,KAAK,QAAQ,aAAa,GAAG,IAAI,CAAC;AAAA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Summary"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventcatalog/generator-asyncapi",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "description": "AsyncAPI generator for EventCatalog",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@asyncapi/avro-schema-parser": "^3.0.24",
32
32
  "@asyncapi/parser": "^3.3.0",
33
- "@eventcatalog/sdk": "^1.4.4",
33
+ "@eventcatalog/sdk": "^1.4.8",
34
34
  "chalk": "^4",
35
35
  "fs-extra": "^11.2.0",
36
36
  "glob": "^11.0.0",
package/LICENSE.md DELETED
@@ -1,42 +0,0 @@
1
- ## This plugin is available under a dual license model:
2
-
3
- - [AGPL-3.0 License](./LICENSE-OPENSOURCE.md) for open-source use
4
- - [Commercial License](./LICENSE-COMMERCIAL.md) for proprietary use, internal use, and private modifications
5
-
6
- _Dual license of this project allows us to keep opens source and make EventCatalog sustainable_.
7
-
8
- ## AGPL-3.0 License (Open Source)
9
-
10
- This software is licensed under the terms of the [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html) (AGPL-3.0), a copy-left open-source license that allows you to use, modify, and distribute the software under the following conditions:
11
-
12
- If you modify this software or create derivative works, you must make the source code of those modifications available under the same AGPL-3.0 license when:
13
-
14
- - You distribute the software.
15
- - You use the software to provide services (e.g., via a web server or cloud-based service) to others.
16
- - Any software that interacts with users over a network, such as in a SaaS or web service, must also be made open-source under AGPL-3.0 if it uses this software (network use).
17
-
18
- You can find the full AGPL-3.0 license text here: [AGPL-3.0 License](./LICENSE-OPENSOURCE.md).
19
-
20
- ## Commercial License (Proprietary/Internal Use)
21
-
22
- If you plan to use this software in a proprietary or internal context (without making the source code public), you acquire a commercial license.
23
-
24
- Under the Commercial License, you are free to:
25
-
26
- - Use this software without open-source obligations, including for proprietary, internal, or commercial purposes.
27
- - Modify the software without being required to release the modifications to the public.
28
- - Use the software in private or internal services without the obligation to share the source code with external users.
29
-
30
- ### When Do You Need a Commercial License?
31
-
32
- You will need a Commercial License in the following cases:
33
-
34
- - You are using the software for internal business purposes and do not wish to release the source code under AGPL-3.0.
35
- - You are building proprietary software or SaaS platforms where you do not want to share the source code with customers or the public.
36
- - You are creating a closed-source product that incorporates this software.
37
-
38
- If you would like to obtain a Commercial License or have any questions, please contact us at **hello@eventcatalog.dev**.
39
-
40
- ## Contributing
41
-
42
- By contributing to this project, you agree that your contributions will be licensed under the same AGPL-3.0 license.