@eventcatalog/generator-asyncapi 4.5.1 → 4.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +45 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
8
8
|
path: z.ZodString;
|
|
9
9
|
draft: z.ZodOptional<z.ZodBoolean>;
|
|
10
10
|
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
11
12
|
owners: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
13
|
generateMarkdown: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
13
14
|
service: z.ZodObject<{
|
|
@@ -47,6 +48,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
47
48
|
id: string;
|
|
48
49
|
draft?: boolean | undefined;
|
|
49
50
|
name?: string | undefined;
|
|
51
|
+
summary?: string | undefined;
|
|
50
52
|
owners?: string[] | undefined;
|
|
51
53
|
generateMarkdown?: ((args_0: {
|
|
52
54
|
service: {
|
|
@@ -62,6 +64,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
62
64
|
id: string;
|
|
63
65
|
draft?: boolean | undefined;
|
|
64
66
|
name?: string | undefined;
|
|
67
|
+
summary?: string | undefined;
|
|
65
68
|
owners?: string[] | undefined;
|
|
66
69
|
generateMarkdown?: ((args_0: {
|
|
67
70
|
service: {
|
|
@@ -198,6 +201,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
198
201
|
id: string;
|
|
199
202
|
draft?: boolean | undefined;
|
|
200
203
|
name?: string | undefined;
|
|
204
|
+
summary?: string | undefined;
|
|
201
205
|
owners?: string[] | undefined;
|
|
202
206
|
generateMarkdown?: ((args_0: {
|
|
203
207
|
service: {
|
|
@@ -248,6 +252,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
248
252
|
id: string;
|
|
249
253
|
draft?: boolean | undefined;
|
|
250
254
|
name?: string | undefined;
|
|
255
|
+
summary?: string | undefined;
|
|
251
256
|
owners?: string[] | undefined;
|
|
252
257
|
generateMarkdown?: ((args_0: {
|
|
253
258
|
service: {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
8
8
|
path: z.ZodString;
|
|
9
9
|
draft: z.ZodOptional<z.ZodBoolean>;
|
|
10
10
|
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
11
12
|
owners: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
13
|
generateMarkdown: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
13
14
|
service: z.ZodObject<{
|
|
@@ -47,6 +48,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
47
48
|
id: string;
|
|
48
49
|
draft?: boolean | undefined;
|
|
49
50
|
name?: string | undefined;
|
|
51
|
+
summary?: string | undefined;
|
|
50
52
|
owners?: string[] | undefined;
|
|
51
53
|
generateMarkdown?: ((args_0: {
|
|
52
54
|
service: {
|
|
@@ -62,6 +64,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
62
64
|
id: string;
|
|
63
65
|
draft?: boolean | undefined;
|
|
64
66
|
name?: string | undefined;
|
|
67
|
+
summary?: string | undefined;
|
|
65
68
|
owners?: string[] | undefined;
|
|
66
69
|
generateMarkdown?: ((args_0: {
|
|
67
70
|
service: {
|
|
@@ -198,6 +201,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
198
201
|
id: string;
|
|
199
202
|
draft?: boolean | undefined;
|
|
200
203
|
name?: string | undefined;
|
|
204
|
+
summary?: string | undefined;
|
|
201
205
|
owners?: string[] | undefined;
|
|
202
206
|
generateMarkdown?: ((args_0: {
|
|
203
207
|
service: {
|
|
@@ -248,6 +252,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
248
252
|
id: string;
|
|
249
253
|
draft?: boolean | undefined;
|
|
250
254
|
name?: string | undefined;
|
|
255
|
+
summary?: string | undefined;
|
|
251
256
|
owners?: string[] | undefined;
|
|
252
257
|
generateMarkdown?: ((args_0: {
|
|
253
258
|
service: {
|
package/dist/index.js
CHANGED
|
@@ -303,7 +303,7 @@ var import_path3 = __toESM(require("path"));
|
|
|
303
303
|
// package.json
|
|
304
304
|
var package_default = {
|
|
305
305
|
name: "@eventcatalog/generator-asyncapi",
|
|
306
|
-
version: "4.5.
|
|
306
|
+
version: "4.5.3",
|
|
307
307
|
description: "AsyncAPI generator for EventCatalog",
|
|
308
308
|
scripts: {
|
|
309
309
|
build: "tsup",
|
|
@@ -341,7 +341,7 @@ var package_default = {
|
|
|
341
341
|
dependencies: {
|
|
342
342
|
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
343
343
|
"@asyncapi/parser": "^3.4.0",
|
|
344
|
-
"@eventcatalog/sdk": "^2.
|
|
344
|
+
"@eventcatalog/sdk": "^2.7.5",
|
|
345
345
|
chalk: "^4",
|
|
346
346
|
"fs-extra": "^11.2.0",
|
|
347
347
|
glob: "^11.0.0",
|
|
@@ -1183,31 +1183,34 @@ var getInstalledVersionOfPackage = (packageName) => {
|
|
|
1183
1183
|
async function checkForPackageUpdate(packageName) {
|
|
1184
1184
|
const installedVersion = getInstalledVersionOfPackage(packageName);
|
|
1185
1185
|
if (!installedVersion || installedVersion === "latest") return;
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1186
|
+
try {
|
|
1187
|
+
const pkg = { name: packageName, version: installedVersion };
|
|
1188
|
+
const updateNotifierModule = await import("update-notifier");
|
|
1189
|
+
const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
|
|
1190
|
+
const info = await notifier.fetchInfo();
|
|
1191
|
+
if (info?.type !== "latest") {
|
|
1192
|
+
const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
|
|
1192
1193
|
Run npm i ${packageName} to update`;
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1194
|
+
console.log(
|
|
1195
|
+
boxen(message2, {
|
|
1196
|
+
padding: 1,
|
|
1197
|
+
margin: 1,
|
|
1198
|
+
align: "center",
|
|
1199
|
+
borderColor: "yellow",
|
|
1200
|
+
borderStyle: {
|
|
1201
|
+
topLeft: " ",
|
|
1202
|
+
topRight: " ",
|
|
1203
|
+
bottomLeft: " ",
|
|
1204
|
+
bottomRight: " ",
|
|
1205
|
+
right: " ",
|
|
1206
|
+
top: "-",
|
|
1207
|
+
bottom: "-",
|
|
1208
|
+
left: " "
|
|
1209
|
+
}
|
|
1210
|
+
})
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
} catch (error) {
|
|
1211
1214
|
}
|
|
1212
1215
|
}
|
|
1213
1216
|
|
|
@@ -2727,6 +2730,7 @@ var optionsSchema = import_zod.z.object({
|
|
|
2727
2730
|
path: import_zod.z.string({ required_error: "The service path is required. please provide the path to specification file" }),
|
|
2728
2731
|
draft: import_zod.z.boolean().optional(),
|
|
2729
2732
|
name: import_zod.z.string().optional(),
|
|
2733
|
+
summary: import_zod.z.string().optional(),
|
|
2730
2734
|
owners: import_zod.z.array(import_zod.z.string()).optional(),
|
|
2731
2735
|
generateMarkdown: import_zod.z.function().args(
|
|
2732
2736
|
import_zod.z.object({
|
|
@@ -2877,6 +2881,8 @@ var index_default = async (config, options) => {
|
|
|
2877
2881
|
let receives = [];
|
|
2878
2882
|
let owners = service.owners || null;
|
|
2879
2883
|
let repository = null;
|
|
2884
|
+
let badges = null;
|
|
2885
|
+
let attachments = null;
|
|
2880
2886
|
let serviceSpecifications = {};
|
|
2881
2887
|
let serviceSpecificationsFiles = [];
|
|
2882
2888
|
const generatedMarkdownForService = defaultMarkdown2(document);
|
|
@@ -2998,7 +3004,9 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2998
3004
|
} = MESSAGE_OPERATIONS[eventType];
|
|
2999
3005
|
const generatedMarkdownForMessage = defaultMarkdown(document, message2);
|
|
3000
3006
|
let messageMarkdown = options.messages?.generateMarkdown ? options.messages.generateMarkdown({ message: message2, document, markdown: generatedMarkdownForMessage }) : generatedMarkdownForMessage;
|
|
3001
|
-
const
|
|
3007
|
+
const badges2 = message2.tags().all() || [];
|
|
3008
|
+
let messageBadges = null;
|
|
3009
|
+
let messageAttachments = null;
|
|
3002
3010
|
console.log(import_chalk4.default.blue(`Processing message: ${getMessageName(message2)} (v${messageVersion})`));
|
|
3003
3011
|
let messagePath = (0, import_node_path.join)(servicePath, folder, message2.id());
|
|
3004
3012
|
if (options.writeFilesToRoot) {
|
|
@@ -3008,6 +3016,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3008
3016
|
const catalogedMessage = await getMessage(message2.id().toLowerCase(), "latest");
|
|
3009
3017
|
if (catalogedMessage) {
|
|
3010
3018
|
messageMarkdown = catalogedMessage.markdown;
|
|
3019
|
+
messageBadges = catalogedMessage.badges || null;
|
|
3020
|
+
messageAttachments = catalogedMessage.attachments || null;
|
|
3011
3021
|
if (catalogedMessage.version !== messageVersion) {
|
|
3012
3022
|
await versionMessage(messageId);
|
|
3013
3023
|
console.log(import_chalk4.default.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));
|
|
@@ -3021,9 +3031,10 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3021
3031
|
name: getMessageName(message2),
|
|
3022
3032
|
summary: getSummary(message2),
|
|
3023
3033
|
markdown: messageMarkdown,
|
|
3024
|
-
badges:
|
|
3034
|
+
badges: messageBadges || badges2.map((badge) => ({ content: badge.name(), textColor: "blue", backgroundColor: "blue" })),
|
|
3025
3035
|
...messageHasSchema(message2) && { schemaPath: getSchemaFileName(message2) },
|
|
3026
3036
|
...owners && { owners },
|
|
3037
|
+
...messageAttachments && { attachments: messageAttachments },
|
|
3027
3038
|
...channelsForMessage.length > 0 && { channels: channelsForMessage },
|
|
3028
3039
|
...deprecatedDate && {
|
|
3029
3040
|
deprecated: { date: deprecatedDate, ...deprecatedMessage && { message: deprecatedMessage } }
|
|
@@ -3065,6 +3076,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3065
3076
|
owners = latestServiceInCatalog.owners || owners;
|
|
3066
3077
|
repository = latestServiceInCatalog.repository || null;
|
|
3067
3078
|
styles2 = latestServiceInCatalog.styles || null;
|
|
3079
|
+
badges = latestServiceInCatalog.badges || null;
|
|
3080
|
+
attachments = latestServiceInCatalog.attachments || null;
|
|
3068
3081
|
if (latestServiceInCatalog.version !== version) {
|
|
3069
3082
|
await versionService(serviceId);
|
|
3070
3083
|
console.log(import_chalk4.default.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));
|
|
@@ -3083,8 +3096,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3083
3096
|
id: serviceId,
|
|
3084
3097
|
name: serviceName,
|
|
3085
3098
|
version,
|
|
3086
|
-
summary: getSummary2(document),
|
|
3087
|
-
badges: documentTags.map((tag2) => ({ content: tag2.name(), textColor: "blue", backgroundColor: "blue" })),
|
|
3099
|
+
summary: service.summary || getSummary2(document),
|
|
3100
|
+
badges: badges || documentTags.map((tag2) => ({ content: tag2.name(), textColor: "blue", backgroundColor: "blue" })),
|
|
3088
3101
|
markdown: serviceMarkdown,
|
|
3089
3102
|
sends,
|
|
3090
3103
|
receives,
|
|
@@ -3096,7 +3109,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3096
3109
|
...owners && { owners },
|
|
3097
3110
|
...repository && { repository },
|
|
3098
3111
|
...styles2 && { styles: styles2 },
|
|
3099
|
-
...isServiceMarkedAsDraft && { draft: true }
|
|
3112
|
+
...isServiceMarkedAsDraft && { draft: true },
|
|
3113
|
+
...attachments && { attachments }
|
|
3100
3114
|
},
|
|
3101
3115
|
{
|
|
3102
3116
|
path: servicePath,
|