@redocly/portal-plugin-async-api 1.0.202 → 1.0.203
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 +14 -0
- package/lib/.tsbuildinfo +1 -1
- package/lib/config.d.ts +2 -98
- package/lib/config.js +1 -13
- package/lib/config.js.map +1 -1
- package/lib/plugin.js +10 -9
- package/lib/plugin.js.map +1 -1
- package/lib/styles.js +21 -616
- package/lib/styles.js.map +1 -1
- package/lib/template.d.ts +1 -1
- package/lib/template.js +16 -9
- package/lib/template.js.map +1 -1
- package/package.json +5 -5
- package/src/config.ts +1 -14
- package/src/plugin.ts +16 -8
- package/src/styles.tsx +21 -616
- package/src/template.tsx +18 -34
package/lib/config.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const asyncApiDocsSchema: {
|
|
|
11
11
|
readonly hideInfo: {
|
|
12
12
|
readonly type: "boolean";
|
|
13
13
|
};
|
|
14
|
-
readonly
|
|
14
|
+
readonly hideOperations: {
|
|
15
15
|
readonly type: "boolean";
|
|
16
16
|
};
|
|
17
17
|
readonly hideServers: {
|
|
@@ -23,54 +23,6 @@ declare const asyncApiDocsSchema: {
|
|
|
23
23
|
readonly hideSchemas: {
|
|
24
24
|
readonly type: "boolean";
|
|
25
25
|
};
|
|
26
|
-
readonly expandChannels: {
|
|
27
|
-
readonly type: "object";
|
|
28
|
-
readonly properties: {
|
|
29
|
-
readonly root: {
|
|
30
|
-
readonly type: "boolean";
|
|
31
|
-
};
|
|
32
|
-
readonly elements: {
|
|
33
|
-
readonly type: "boolean";
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
readonly additionalProperties: false;
|
|
37
|
-
};
|
|
38
|
-
readonly expandServers: {
|
|
39
|
-
readonly type: "object";
|
|
40
|
-
readonly properties: {
|
|
41
|
-
readonly root: {
|
|
42
|
-
readonly type: "boolean";
|
|
43
|
-
};
|
|
44
|
-
readonly elements: {
|
|
45
|
-
readonly type: "boolean";
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
readonly additionalProperties: false;
|
|
49
|
-
};
|
|
50
|
-
readonly expandMessages: {
|
|
51
|
-
readonly type: "object";
|
|
52
|
-
readonly properties: {
|
|
53
|
-
readonly root: {
|
|
54
|
-
readonly type: "boolean";
|
|
55
|
-
};
|
|
56
|
-
readonly elements: {
|
|
57
|
-
readonly type: "boolean";
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
readonly additionalProperties: false;
|
|
61
|
-
};
|
|
62
|
-
readonly expandSchemas: {
|
|
63
|
-
readonly type: "object";
|
|
64
|
-
readonly properties: {
|
|
65
|
-
readonly root: {
|
|
66
|
-
readonly type: "boolean";
|
|
67
|
-
};
|
|
68
|
-
readonly elements: {
|
|
69
|
-
readonly type: "boolean";
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
readonly additionalProperties: false;
|
|
73
|
-
};
|
|
74
26
|
};
|
|
75
27
|
readonly additionalProperties: false;
|
|
76
28
|
};
|
|
@@ -89,7 +41,7 @@ export declare const themeConfigSchema: {
|
|
|
89
41
|
readonly hideInfo: {
|
|
90
42
|
readonly type: "boolean";
|
|
91
43
|
};
|
|
92
|
-
readonly
|
|
44
|
+
readonly hideOperations: {
|
|
93
45
|
readonly type: "boolean";
|
|
94
46
|
};
|
|
95
47
|
readonly hideServers: {
|
|
@@ -101,54 +53,6 @@ export declare const themeConfigSchema: {
|
|
|
101
53
|
readonly hideSchemas: {
|
|
102
54
|
readonly type: "boolean";
|
|
103
55
|
};
|
|
104
|
-
readonly expandChannels: {
|
|
105
|
-
readonly type: "object";
|
|
106
|
-
readonly properties: {
|
|
107
|
-
readonly root: {
|
|
108
|
-
readonly type: "boolean";
|
|
109
|
-
};
|
|
110
|
-
readonly elements: {
|
|
111
|
-
readonly type: "boolean";
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
readonly additionalProperties: false;
|
|
115
|
-
};
|
|
116
|
-
readonly expandServers: {
|
|
117
|
-
readonly type: "object";
|
|
118
|
-
readonly properties: {
|
|
119
|
-
readonly root: {
|
|
120
|
-
readonly type: "boolean";
|
|
121
|
-
};
|
|
122
|
-
readonly elements: {
|
|
123
|
-
readonly type: "boolean";
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
readonly additionalProperties: false;
|
|
127
|
-
};
|
|
128
|
-
readonly expandMessages: {
|
|
129
|
-
readonly type: "object";
|
|
130
|
-
readonly properties: {
|
|
131
|
-
readonly root: {
|
|
132
|
-
readonly type: "boolean";
|
|
133
|
-
};
|
|
134
|
-
readonly elements: {
|
|
135
|
-
readonly type: "boolean";
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
readonly additionalProperties: false;
|
|
139
|
-
};
|
|
140
|
-
readonly expandSchemas: {
|
|
141
|
-
readonly type: "object";
|
|
142
|
-
readonly properties: {
|
|
143
|
-
readonly root: {
|
|
144
|
-
readonly type: "boolean";
|
|
145
|
-
};
|
|
146
|
-
readonly elements: {
|
|
147
|
-
readonly type: "boolean";
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
readonly additionalProperties: false;
|
|
151
|
-
};
|
|
152
56
|
};
|
|
153
57
|
readonly additionalProperties: false;
|
|
154
58
|
};
|
package/lib/config.js
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
const expandSectionSchema = {
|
|
2
|
-
type: 'object',
|
|
3
|
-
properties: {
|
|
4
|
-
root: { type: 'boolean' },
|
|
5
|
-
elements: { type: 'boolean' },
|
|
6
|
-
},
|
|
7
|
-
additionalProperties: false,
|
|
8
|
-
};
|
|
9
1
|
const asyncApiDocsSchema = {
|
|
10
2
|
type: 'object',
|
|
11
3
|
properties: {
|
|
12
4
|
schemaId: { type: 'string' },
|
|
13
5
|
hideErrors: { type: 'boolean' },
|
|
14
6
|
hideInfo: { type: 'boolean' },
|
|
15
|
-
|
|
7
|
+
hideOperations: { type: 'boolean' },
|
|
16
8
|
hideServers: { type: 'boolean' },
|
|
17
9
|
hideMessages: { type: 'boolean' },
|
|
18
10
|
hideSchemas: { type: 'boolean' },
|
|
19
|
-
expandChannels: expandSectionSchema,
|
|
20
|
-
expandServers: expandSectionSchema,
|
|
21
|
-
expandMessages: expandSectionSchema,
|
|
22
|
-
expandSchemas: expandSectionSchema,
|
|
23
11
|
},
|
|
24
12
|
additionalProperties: false,
|
|
25
13
|
};
|
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC/B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAChC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACjC;IACD,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,kBAAkB;KAC7B;CACO,CAAC"}
|
package/lib/plugin.js
CHANGED
|
@@ -7,35 +7,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import path from 'path';
|
|
11
10
|
// FIXME: think of a way to make these imports shorter?
|
|
12
11
|
import { REDOCLY_ROUTE_RBAC } from '@redocly/realm/dist/shared/constants.js';
|
|
13
12
|
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
14
|
-
import
|
|
13
|
+
import { fromFile, Parser } from '@asyncapi/parser';
|
|
15
14
|
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
16
15
|
const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
|
|
17
16
|
const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
|
|
18
17
|
export default function asyncAPIDocsPlugin() {
|
|
19
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const parser = new Parser();
|
|
20
20
|
return {
|
|
21
21
|
id: Feature.Asyncapi,
|
|
22
22
|
processContent: (contentProvider, actions) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
23
|
+
var _a, _b;
|
|
24
24
|
const asyncAPITemplateId = actions.createTemplate(ASYNCAPI_TEMPLATE_ID, '@redocly/portal-plugin-async-api/template.js');
|
|
25
25
|
const config = actions.getConfig();
|
|
26
26
|
const globalSettings = ((_a = config.theme) === null || _a === void 0 ? void 0 : _a.asyncapi) || {};
|
|
27
27
|
const definitions = loadDefinitions();
|
|
28
28
|
const currentScriptLocation = process.cwd();
|
|
29
|
-
for (const [relativePath
|
|
29
|
+
for (const [relativePath] of definitions) {
|
|
30
30
|
const pageSlug = contentProvider.slugFromRelativePath(relativePath);
|
|
31
31
|
const sharedDataKey = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
|
|
32
32
|
try {
|
|
33
|
+
const absolutePath = contentProvider.getFsAbsolutePath(relativePath);
|
|
33
34
|
const fsRelativePath = contentProvider.getFsRelativePath(relativePath);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
yield actions.createSharedData(sharedDataKey,
|
|
35
|
+
const { document, diagnostics } = yield fromFile(parser, absolutePath).parse();
|
|
36
|
+
diagnostics
|
|
37
|
+
.filter((d) => d.severity === 0)
|
|
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 : {});
|
|
39
40
|
const route = {
|
|
40
41
|
slug: pageSlug,
|
|
41
42
|
fsPath: relativePath,
|
package/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,+DAA+D,CAAC;AAUxF,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,2BAA2B,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,OAAO,UAAgB,kBAAkB;;QAC9C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAE5B,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAO,eAAe,EAAE,OAAO,EAAE,EAAE;;gBACjD,MAAM,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAC/C,oBAAoB,EACpB,8CAA8C,CAC/C,CAAC;gBAEF,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAuC,CAAC;gBACxE,MAAM,cAAc,GAAG,CAAA,MAAA,MAAM,CAAC,KAAK,0CAAE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