@redocly/portal-plugin-async-api 1.0.222 → 1.0.223
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/CHANGELOG.md +9 -0
- package/lib/.tsbuildinfo +1 -1
- package/lib/plugin.js +35 -56
- package/lib/plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/plugin.ts +44 -65
package/lib/plugin.js
CHANGED
|
@@ -8,87 +8,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
// FIXME: think of a way to make these imports shorter?
|
|
11
|
-
import { REDOCLY_ROUTE_RBAC } from '@redocly/realm/dist/shared/constants.js';
|
|
12
11
|
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
13
|
-
import
|
|
12
|
+
import * as asyncApi from '@asyncapi/parser';
|
|
14
13
|
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
14
|
+
import { logger } from '@redocly/realm/dist/server/utils/index.js';
|
|
15
|
+
import path from 'node:path';
|
|
15
16
|
const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
|
|
16
17
|
const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
|
|
17
18
|
export default function asyncAPIDocsPlugin() {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const parser = new Parser();
|
|
20
|
+
const parser = new asyncApi.Parser();
|
|
20
21
|
return {
|
|
21
22
|
id: Feature.Asyncapi,
|
|
22
|
-
|
|
23
|
+
loaders: {
|
|
24
|
+
asyncapi: (relativePath, { fs, cache }) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const absolutePath = path.join(fs.cwd, relativePath);
|
|
26
|
+
const { data: yaml } = yield cache.load(relativePath, 'yaml');
|
|
27
|
+
if (!yaml.asyncapi)
|
|
28
|
+
return undefined;
|
|
29
|
+
const { document, diagnostics } = yield asyncApi.fromFile(parser, absolutePath).parse();
|
|
30
|
+
diagnostics
|
|
31
|
+
.filter((d) => d.severity === 0)
|
|
32
|
+
.forEach(({ message, path }) => logger.error(`Cannot parse AsyncAPI schema: ${message} in '${relativePath}:${path.join('.')}'`));
|
|
33
|
+
return document;
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
processContent: (actions, context) => __awaiter(this, void 0, void 0, function* () {
|
|
23
37
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
24
38
|
const asyncAPITemplateId = actions.createTemplate(ASYNCAPI_TEMPLATE_ID, '@redocly/portal-plugin-async-api/template.js');
|
|
25
|
-
const config =
|
|
39
|
+
const config = yield context.getConfig();
|
|
26
40
|
const globalSettings = ((_a = config.theme) === null || _a === void 0 ? void 0 : _a.asyncapi) || {};
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
41
|
+
for (const record of yield context.fs.scan(/(\.ya?ml|\.json)$/)) {
|
|
42
|
+
if (yield context.isPathIgnored(record.relativePath))
|
|
43
|
+
continue;
|
|
44
|
+
const { relativePath } = record;
|
|
45
|
+
const sharedDataId = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
|
|
32
46
|
try {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.forEach(({ message, path }) => console.error(`Cannot parse AsyncAPI schema: ${message} in '${fsRelativePath}:${path.join('.')}'`));
|
|
39
|
-
yield actions.createSharedData(sharedDataKey, (_b = document === null || document === void 0 ? void 0 : document.json()) !== null && _b !== void 0 ? _b : {});
|
|
40
|
-
const route = {
|
|
41
|
-
slug: pageSlug,
|
|
47
|
+
const { data: document } = yield context.cache.load(record.realRelativePath, 'asyncapi');
|
|
48
|
+
if (!document)
|
|
49
|
+
continue;
|
|
50
|
+
yield actions.createSharedData(sharedDataId, (_b = document === null || document === void 0 ? void 0 : document.json()) !== null && _b !== void 0 ? _b : {});
|
|
51
|
+
actions.addRoute({
|
|
42
52
|
fsPath: relativePath,
|
|
43
53
|
templateId: asyncAPITemplateId,
|
|
44
|
-
getStaticData: buildGetStaticDataFn(globalSettings
|
|
45
|
-
versions: contentProvider.versions.getPageVersions(relativePath, pageSlug),
|
|
46
|
-
[REDOCLY_ROUTE_RBAC]: {
|
|
47
|
-
slug: pageSlug,
|
|
48
|
-
fsPath: relativePath,
|
|
49
|
-
},
|
|
54
|
+
getStaticData: buildGetStaticDataFn(globalSettings),
|
|
50
55
|
metadata: Object.assign({ type: 'asyncapi', title: (_e = (_d = (_c = document === null || document === void 0 ? void 0 : document.json()) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.title) !== null && _e !== void 0 ? _e : 'AsyncAPI', description: (_h = (_g = (_f = document === null || document === void 0 ? void 0 : document.json()) === null || _f === void 0 ? void 0 : _f.info) === null || _g === void 0 ? void 0 : _g.description) !== null && _h !== void 0 ? _h : '' }, ((_l = (_k = (_j = document === null || document === void 0 ? void 0 : document.json()) === null || _j === void 0 ? void 0 : _j.info) === null || _k === void 0 ? void 0 : _k['x-metadata']) !== null && _l !== void 0 ? _l : {})),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
actions.addRouteSharedData(route.slug, 'AsyncApiDefinition', sharedDataKey);
|
|
54
|
-
process.chdir(currentScriptLocation);
|
|
56
|
+
sharedData: [{ key: 'AsyncApiDefinition', id: sharedDataId }],
|
|
57
|
+
});
|
|
55
58
|
}
|
|
56
59
|
catch (e) {
|
|
57
|
-
process.chdir(currentScriptLocation);
|
|
58
60
|
console.error(e);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
|
-
function loadDefinitions() {
|
|
62
|
-
var _a;
|
|
63
|
-
const definitions = new Map();
|
|
64
|
-
for (const relativePath of contentProvider.filesList.values()) {
|
|
65
|
-
if (!relativePath.match(/(\.ya?ml|\.json)$/)) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const contentRecord = contentProvider.loadContent(relativePath, 'yaml');
|
|
70
|
-
if (contentRecord.isIgnored) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (!((_a = contentRecord.parsed) === null || _a === void 0 ? void 0 : _a.asyncapi)) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
definitions.set(relativePath, contentRecord.content);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return definitions;
|
|
83
|
-
}
|
|
84
63
|
}),
|
|
85
64
|
};
|
|
86
|
-
function buildGetStaticDataFn(settings
|
|
87
|
-
return function (
|
|
65
|
+
function buildGetStaticDataFn(settings) {
|
|
66
|
+
return function (route, _context) {
|
|
88
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
68
|
return {
|
|
90
69
|
props: {
|
|
91
|
-
settings: Object.assign(Object.assign({}, settings), { baseUrlPath: withPathPrefix(
|
|
70
|
+
settings: Object.assign(Object.assign({}, settings), { baseUrlPath: withPathPrefix(route.slug) }),
|
|
92
71
|
},
|
|
93
72
|
};
|
|
94
73
|
});
|
package/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,+DAA+D,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,IAAI,MAAM,WA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,uBAAR,QAAQ,CAAE,IAAI,EAAE,0CAAE,IAAI,0CAAG,YAAY,CAAC,mCAAI,EAAE,CAAC,CAClD;4BACD,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,oBAAoB,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC;yBAC9D,CAAC,CAAC;qBACJ;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;qBAClB;iBACF;YACH,CAAC,CAAA;SACF,CAAC;QAEF,SAAS,oBAAoB,CAC3B,QAA8B;YAE9B,OAAO,UAAgB,KAAK,EAAE,QAAQ;;oBACpC,OAAO;wBACL,KAAK,EAAE;4BACL,QAAQ,kCACH,QAAQ,KACX,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,GACxC;yBACF;qBACF,CAAC;gBACJ,CAAC;aAAA,CAAC;QACJ,CAAC;IACH,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/portal-plugin-async-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.223",
|
|
4
4
|
"description": "Async API plugin for @redocly/portal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.0.0",
|
|
36
36
|
"react-dom": "^18.0.0",
|
|
37
|
-
"@redocly/realm": "0.
|
|
37
|
+
"@redocly/realm": "0.91.0",
|
|
38
38
|
"@redocly/theme": "0.38.6"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
package/src/plugin.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// FIXME: think of a way to make these imports shorter?
|
|
2
|
-
import { REDOCLY_ROUTE_RBAC } from '@redocly/realm/dist/shared/constants.js';
|
|
3
2
|
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
4
|
-
import
|
|
3
|
+
import * as asyncApi from '@asyncapi/parser';
|
|
5
4
|
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
5
|
+
import { logger } from '@redocly/realm/dist/server/utils/index.js';
|
|
6
|
+
import path from 'node:path';
|
|
6
7
|
|
|
8
|
+
import type { AsyncAPIDocumentInterface } from '@asyncapi/parser';
|
|
7
9
|
import type { PageStaticData } from '@redocly/realm/dist/shared/types';
|
|
8
10
|
import type { AsyncApiDocsSettings } from './config';
|
|
9
11
|
import type {
|
|
@@ -16,105 +18,82 @@ const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
|
|
|
16
18
|
const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
|
|
17
19
|
|
|
18
20
|
export default async function asyncAPIDocsPlugin(): Promise<PluginInstance> {
|
|
19
|
-
const parser = new Parser();
|
|
21
|
+
const parser = new asyncApi.Parser();
|
|
20
22
|
|
|
21
23
|
return {
|
|
22
24
|
id: Feature.Asyncapi,
|
|
23
|
-
|
|
25
|
+
loaders: {
|
|
26
|
+
asyncapi: async (relativePath, { fs, cache }) => {
|
|
27
|
+
const absolutePath = path.join(fs.cwd, relativePath);
|
|
28
|
+
const { data: yaml } = await cache.load<any>(relativePath, 'yaml');
|
|
29
|
+
if (!yaml.asyncapi) return undefined;
|
|
30
|
+
|
|
31
|
+
const { document, diagnostics } = await asyncApi.fromFile(parser, absolutePath).parse();
|
|
32
|
+
|
|
33
|
+
diagnostics
|
|
34
|
+
.filter((d) => d.severity === 0)
|
|
35
|
+
.forEach(({ message, path }) =>
|
|
36
|
+
logger.error(
|
|
37
|
+
`Cannot parse AsyncAPI schema: ${message} in '${relativePath}:${path.join('.')}'`,
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return document;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
processContent: async (actions, context) => {
|
|
24
45
|
const asyncAPITemplateId = actions.createTemplate(
|
|
25
46
|
ASYNCAPI_TEMPLATE_ID,
|
|
26
47
|
'@redocly/portal-plugin-async-api/template.js',
|
|
27
48
|
);
|
|
28
49
|
|
|
29
|
-
const config =
|
|
30
|
-
const globalSettings =
|
|
31
|
-
|
|
32
|
-
const definitions = loadDefinitions();
|
|
33
|
-
const currentScriptLocation = process.cwd();
|
|
50
|
+
const config = await context.getConfig();
|
|
51
|
+
const globalSettings =
|
|
52
|
+
(config.theme as { asyncapi: AsyncApiDocsSettings } | undefined)?.asyncapi || {};
|
|
34
53
|
|
|
35
|
-
for (const
|
|
36
|
-
|
|
54
|
+
for (const record of await context.fs.scan(/(\.ya?ml|\.json)$/)) {
|
|
55
|
+
if (await context.isPathIgnored(record.relativePath)) continue;
|
|
56
|
+
const { relativePath } = record;
|
|
37
57
|
|
|
38
|
-
const
|
|
58
|
+
const sharedDataId = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
|
|
39
59
|
try {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
const { data: document } = await context.cache.load<AsyncAPIDocumentInterface>(
|
|
61
|
+
record.realRelativePath,
|
|
62
|
+
'asyncapi',
|
|
63
|
+
);
|
|
43
64
|
|
|
44
|
-
|
|
45
|
-
.filter((d) => d.severity === 0)
|
|
46
|
-
.forEach(({ message, path }) =>
|
|
47
|
-
console.error(
|
|
48
|
-
`Cannot parse AsyncAPI schema: ${message} in '${fsRelativePath}:${path.join('.')}'`,
|
|
49
|
-
),
|
|
50
|
-
);
|
|
65
|
+
if (!document) continue;
|
|
51
66
|
|
|
52
|
-
await actions.createSharedData(
|
|
67
|
+
await actions.createSharedData(sharedDataId, document?.json() ?? {});
|
|
53
68
|
|
|
54
|
-
|
|
55
|
-
slug: pageSlug,
|
|
69
|
+
actions.addRoute({
|
|
56
70
|
fsPath: relativePath,
|
|
57
71
|
templateId: asyncAPITemplateId,
|
|
58
|
-
getStaticData: buildGetStaticDataFn(globalSettings
|
|
59
|
-
versions: contentProvider.versions.getPageVersions(relativePath, pageSlug),
|
|
60
|
-
[REDOCLY_ROUTE_RBAC]: {
|
|
61
|
-
slug: pageSlug,
|
|
62
|
-
fsPath: relativePath,
|
|
63
|
-
},
|
|
72
|
+
getStaticData: buildGetStaticDataFn(globalSettings),
|
|
64
73
|
metadata: {
|
|
65
74
|
type: 'asyncapi',
|
|
66
75
|
title: document?.json()?.info?.title ?? 'AsyncAPI',
|
|
67
76
|
description: document?.json()?.info?.description ?? '',
|
|
68
77
|
...(document?.json()?.info?.['x-metadata'] ?? {}),
|
|
69
78
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
actions.addRoute(route);
|
|
73
|
-
actions.addRouteSharedData(route.slug, 'AsyncApiDefinition', sharedDataKey);
|
|
74
|
-
process.chdir(currentScriptLocation);
|
|
79
|
+
sharedData: [{ key: 'AsyncApiDefinition', id: sharedDataId }],
|
|
80
|
+
});
|
|
75
81
|
} catch (e) {
|
|
76
|
-
process.chdir(currentScriptLocation);
|
|
77
82
|
console.error(e);
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
|
-
|
|
81
|
-
function loadDefinitions() {
|
|
82
|
-
const definitions: Map<string, unknown> = new Map();
|
|
83
|
-
for (const relativePath of contentProvider.filesList.values()) {
|
|
84
|
-
if (!relativePath.match(/(\.ya?ml|\.json)$/)) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
const contentRecord = contentProvider.loadContent<any>(relativePath, 'yaml');
|
|
90
|
-
if (contentRecord.isIgnored) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (!contentRecord.parsed?.asyncapi) {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
definitions.set(relativePath, contentRecord.content);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return definitions;
|
|
104
|
-
}
|
|
105
85
|
},
|
|
106
86
|
};
|
|
107
87
|
|
|
108
88
|
function buildGetStaticDataFn(
|
|
109
89
|
settings: AsyncApiDocsSettings,
|
|
110
|
-
pageSlug: string,
|
|
111
90
|
): GetStaticDataFn<PageRouteDetails, PageStaticData> {
|
|
112
|
-
return async function (
|
|
91
|
+
return async function (route, _context) {
|
|
113
92
|
return {
|
|
114
93
|
props: {
|
|
115
94
|
settings: {
|
|
116
95
|
...settings,
|
|
117
|
-
baseUrlPath: withPathPrefix(
|
|
96
|
+
baseUrlPath: withPathPrefix(route.slug),
|
|
118
97
|
},
|
|
119
98
|
},
|
|
120
99
|
};
|