@asyncapi/react-component 1.0.0-next.47 → 1.0.0-next.49
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/browser/index.js +32 -27
- package/browser/index.js.LICENSE.txt +88 -0
- package/browser/standalone/index.js +32 -51
- package/browser/standalone/index.js.LICENSE.txt +112 -0
- package/browser/standalone/without-parser.js +14 -41
- package/browser/standalone/without-parser.js.LICENSE.txt +110 -0
- package/browser/without-parser.js +14 -12
- package/browser/without-parser.js.LICENSE.txt +86 -0
- package/lib/cjs/components/Schema.js +40 -57
- package/lib/cjs/components/Schema.js.map +1 -1
- package/lib/cjs/components/Tag.js.map +1 -1
- package/lib/cjs/components/Tags.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/cjs/containers/Info/Info.js +6 -6
- package/lib/cjs/containers/Info/Info.js.map +1 -1
- package/lib/cjs/containers/Messages/Message.js +3 -3
- package/lib/cjs/containers/Messages/Message.js.map +1 -1
- package/lib/cjs/containers/Messages/MessageExample.js.map +1 -1
- package/lib/cjs/containers/Messages/Messages.js +1 -1
- package/lib/cjs/containers/Messages/Messages.js.map +1 -1
- package/lib/cjs/containers/Operations/Operation.js +9 -7
- package/lib/cjs/containers/Operations/Operation.js.map +1 -1
- package/lib/cjs/containers/Operations/Operations.js +10 -10
- package/lib/cjs/containers/Operations/Operations.js.map +1 -1
- package/lib/cjs/containers/Schemas/Schema.js.map +1 -1
- package/lib/cjs/containers/Schemas/Schemas.js +1 -1
- package/lib/cjs/containers/Schemas/Schemas.js.map +1 -1
- package/lib/cjs/containers/Servers/Security.js +44 -32
- package/lib/cjs/containers/Servers/Security.js.map +1 -1
- package/lib/cjs/containers/Servers/Server.js +2 -2
- package/lib/cjs/containers/Servers/Server.js.map +1 -1
- package/lib/cjs/containers/Sidebar/Sidebar.js +42 -31
- package/lib/cjs/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/cjs/contexts/useSpec.js.map +1 -1
- package/lib/cjs/helpers/message.js +16 -14
- package/lib/cjs/helpers/message.js.map +1 -1
- package/lib/cjs/helpers/parser.js +14 -15
- package/lib/cjs/helpers/parser.js.map +1 -1
- package/lib/cjs/helpers/schema.js +18 -24
- package/lib/cjs/helpers/schema.js.map +1 -1
- package/lib/cjs/helpers/server.js.map +1 -1
- package/lib/cjs/helpers/specification.js +21 -26
- package/lib/cjs/helpers/specification.js.map +1 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/components/Schema.js +40 -57
- package/lib/esm/components/Schema.js.map +1 -1
- package/lib/esm/components/Tag.js.map +1 -1
- package/lib/esm/components/Tags.js.map +1 -1
- package/lib/esm/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/esm/containers/Info/Info.js +6 -6
- package/lib/esm/containers/Info/Info.js.map +1 -1
- package/lib/esm/containers/Messages/Message.js +3 -3
- package/lib/esm/containers/Messages/Message.js.map +1 -1
- package/lib/esm/containers/Messages/MessageExample.js.map +1 -1
- package/lib/esm/containers/Messages/Messages.js +1 -1
- package/lib/esm/containers/Messages/Messages.js.map +1 -1
- package/lib/esm/containers/Operations/Operation.js +9 -7
- package/lib/esm/containers/Operations/Operation.js.map +1 -1
- package/lib/esm/containers/Operations/Operations.js +10 -10
- package/lib/esm/containers/Operations/Operations.js.map +1 -1
- package/lib/esm/containers/Schemas/Schema.js.map +1 -1
- package/lib/esm/containers/Schemas/Schemas.js +1 -1
- package/lib/esm/containers/Schemas/Schemas.js.map +1 -1
- package/lib/esm/containers/Servers/Security.js +44 -32
- package/lib/esm/containers/Servers/Security.js.map +1 -1
- package/lib/esm/containers/Servers/Server.js +2 -2
- package/lib/esm/containers/Servers/Server.js.map +1 -1
- package/lib/esm/containers/Sidebar/Sidebar.js +42 -31
- package/lib/esm/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/esm/contexts/useSpec.js.map +1 -1
- package/lib/esm/helpers/message.js +16 -14
- package/lib/esm/helpers/message.js.map +1 -1
- package/lib/esm/helpers/parser.js +15 -13
- package/lib/esm/helpers/parser.js.map +1 -1
- package/lib/esm/helpers/schema.js +14 -17
- package/lib/esm/helpers/schema.js.map +1 -1
- package/lib/esm/helpers/server.js.map +1 -1
- package/lib/esm/helpers/specification.js +21 -23
- package/lib/esm/helpers/specification.js.map +1 -1
- package/lib/esm/types.js.map +1 -1
- package/lib/types/components/Schema.d.ts +2 -2
- package/lib/types/components/Schema.d.ts.map +1 -1
- package/lib/types/components/Tag.d.ts +2 -2
- package/lib/types/components/Tag.d.ts.map +1 -1
- package/lib/types/components/Tags.d.ts +2 -2
- package/lib/types/components/Tags.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts +2 -2
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/Layout.d.ts +2 -2
- package/lib/types/containers/AsyncApi/Layout.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/Standalone.d.ts +2 -2
- package/lib/types/containers/AsyncApi/Standalone.d.ts.map +1 -1
- package/lib/types/containers/Info/Info.d.ts.map +1 -1
- package/lib/types/containers/Messages/Message.d.ts +2 -2
- package/lib/types/containers/Messages/Message.d.ts.map +1 -1
- package/lib/types/containers/Messages/MessageExample.d.ts +3 -3
- package/lib/types/containers/Messages/MessageExample.d.ts.map +1 -1
- package/lib/types/containers/Messages/Messages.d.ts.map +1 -1
- package/lib/types/containers/Operations/Operation.d.ts +3 -3
- package/lib/types/containers/Operations/Operation.d.ts.map +1 -1
- package/lib/types/containers/Operations/Operations.d.ts.map +1 -1
- package/lib/types/containers/Schemas/Schema.d.ts +2 -2
- package/lib/types/containers/Schemas/Schema.d.ts.map +1 -1
- package/lib/types/containers/Schemas/Schemas.d.ts.map +1 -1
- package/lib/types/containers/Servers/Security.d.ts +2 -2
- package/lib/types/containers/Servers/Security.d.ts.map +1 -1
- package/lib/types/containers/Servers/Server.d.ts +2 -2
- package/lib/types/containers/Servers/Server.d.ts.map +1 -1
- package/lib/types/containers/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/types/contexts/useSpec.d.ts +3 -3
- package/lib/types/contexts/useSpec.d.ts.map +1 -1
- package/lib/types/helpers/message.d.ts +3 -3
- package/lib/types/helpers/message.d.ts.map +1 -1
- package/lib/types/helpers/parser.d.ts.map +1 -1
- package/lib/types/helpers/schema.d.ts +8 -9
- package/lib/types/helpers/schema.d.ts.map +1 -1
- package/lib/types/helpers/server.d.ts +2 -2
- package/lib/types/helpers/server.d.ts.map +1 -1
- package/lib/types/helpers/specification.d.ts +5 -5
- package/lib/types/helpers/specification.d.ts.map +1 -1
- package/lib/types/types.d.ts +4 -4
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +12 -10
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The buffer module from node.js, for the browser.
|
|
3
|
+
*
|
|
4
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* URI.js - Mutating URLs
|
|
17
|
+
*
|
|
18
|
+
* Version: 1.19.11
|
|
19
|
+
*
|
|
20
|
+
* Author: Rodney Rehm
|
|
21
|
+
* Web: http://medialize.github.io/URI.js/
|
|
22
|
+
*
|
|
23
|
+
* Licensed under
|
|
24
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/*!
|
|
29
|
+
* URI.js - Mutating URLs
|
|
30
|
+
* IPv6 Support
|
|
31
|
+
*
|
|
32
|
+
* Version: 1.19.11
|
|
33
|
+
*
|
|
34
|
+
* Author: Rodney Rehm
|
|
35
|
+
* Web: http://medialize.github.io/URI.js/
|
|
36
|
+
*
|
|
37
|
+
* Licensed under
|
|
38
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/*!
|
|
43
|
+
* URI.js - Mutating URLs
|
|
44
|
+
* Second Level Domain (SLD) Support
|
|
45
|
+
*
|
|
46
|
+
* Version: 1.19.11
|
|
47
|
+
*
|
|
48
|
+
* Author: Rodney Rehm
|
|
49
|
+
* Web: http://medialize.github.io/URI.js/
|
|
50
|
+
*
|
|
51
|
+
* Licensed under
|
|
52
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/*! *****************************************************************************
|
|
57
|
+
Copyright (c) Microsoft Corporation.
|
|
58
|
+
|
|
59
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
60
|
+
purpose with or without fee is hereby granted.
|
|
61
|
+
|
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
63
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
64
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
65
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
66
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
67
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
68
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
69
|
+
***************************************************************************** */
|
|
70
|
+
|
|
71
|
+
/*! @license DOMPurify 2.3.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.6/LICENSE */
|
|
72
|
+
|
|
73
|
+
/*! https://mths.be/punycode v1.4.0 by @mathias */
|
|
74
|
+
|
|
75
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @license
|
|
79
|
+
* Lodash <https://lodash.com/>
|
|
80
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
81
|
+
* Released under MIT license <https://lodash.com/license>
|
|
82
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
83
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
@@ -32,10 +32,11 @@ var SchemaContext = react_1.default.createContext({
|
|
|
32
32
|
deepExpanded: false,
|
|
33
33
|
});
|
|
34
34
|
var Schema = function (_a) {
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
35
|
+
var _b, _c, _d, _e, _f;
|
|
36
|
+
var schemaName = _a.schemaName, schema = _a.schema, _g = _a.required, required = _g === void 0 ? false : _g, _h = _a.isPatternProperty, isPatternProperty = _h === void 0 ? false : _h, _j = _a.isProperty, isProperty = _j === void 0 ? false : _j, _k = _a.isCircular, isCircular = _k === void 0 ? false : _k, dependentRequired = _a.dependentRequired, _l = _a.expanded, propExpanded = _l === void 0 ? false : _l, _m = _a.onlyTitle, onlyTitle = _m === void 0 ? false : _m;
|
|
37
|
+
var _o = (0, react_1.useContext)(SchemaContext), reverse = _o.reverse, deepExpanded = _o.deepExpanded;
|
|
38
|
+
var _p = (0, react_1.useState)(propExpanded), expanded = _p[0], setExpanded = _p[1];
|
|
39
|
+
var _q = (0, react_1.useState)(false), deepExpand = _q[0], setDeepExpand = _q[1];
|
|
39
40
|
(0, react_1.useEffect)(function () {
|
|
40
41
|
setDeepExpand(deepExpanded);
|
|
41
42
|
}, [deepExpanded, setDeepExpand]);
|
|
@@ -51,33 +52,16 @@ var Schema = function (_a) {
|
|
|
51
52
|
var dependentSchemas = helpers_1.SchemaHelpers.getDependentSchemas(schema);
|
|
52
53
|
var constraints = helpers_1.SchemaHelpers.humanizeConstraints(schema);
|
|
53
54
|
var externalDocs = schema.externalDocs();
|
|
54
|
-
var
|
|
55
|
-
var rawValue =
|
|
56
|
-
var
|
|
57
|
-
|
|
55
|
+
var rawValueExt = schema.extensions().get(helpers_1.SchemaHelpers.extRawValue);
|
|
56
|
+
var rawValue = (rawValueExt === null || rawValueExt === void 0 ? void 0 : rawValueExt.value()) === true;
|
|
57
|
+
var parameterLocationExt = schema
|
|
58
|
+
.extensions()
|
|
59
|
+
.get(helpers_1.SchemaHelpers.extParameterLocation);
|
|
60
|
+
var parameterLocation = (parameterLocationExt === null || parameterLocationExt === void 0 ? void 0 : parameterLocationExt.value()) === true;
|
|
58
61
|
var schemaType = helpers_1.SchemaHelpers.toSchemaType(schema);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
schema.ext('x-parser-circular') ||
|
|
63
|
-
false;
|
|
64
|
-
var uid = schema.uid();
|
|
65
|
-
var schemaItems = schema.items();
|
|
66
|
-
if (schemaItems && !Array.isArray(schemaItems)) {
|
|
67
|
-
isCircular =
|
|
68
|
-
isCircular ||
|
|
69
|
-
schemaItems.isCircular() ||
|
|
70
|
-
schemaItems.ext('x-parser-circular') ||
|
|
71
|
-
false;
|
|
72
|
-
if (isCircular &&
|
|
73
|
-
typeof schemaItems.circularSchema === 'function') {
|
|
74
|
-
schemaType = helpers_1.SchemaHelpers.toSchemaType(schemaItems.circularSchema());
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else if (isCircular &&
|
|
78
|
-
typeof schema.circularSchema === 'function') {
|
|
79
|
-
schemaType = helpers_1.SchemaHelpers.toSchemaType(schema.circularSchema());
|
|
80
|
-
}
|
|
62
|
+
var isExpandable = helpers_1.SchemaHelpers.isExpandable(schema) || dependentSchemas;
|
|
63
|
+
isCircular = isCircular || schema.isCircular() || false;
|
|
64
|
+
var uid = schema.$id();
|
|
81
65
|
var styledSchemaName = isProperty ? 'italic' : '';
|
|
82
66
|
var renderedSchemaName = typeof schemaName === 'string' ? (react_1.default.createElement("span", { className: "break-words text-sm ".concat(styledSchemaName) }, schemaName)) : (schemaName);
|
|
83
67
|
return (react_1.default.createElement(SchemaContext.Provider, { value: { reverse: !reverse, deepExpanded: deepExpand } },
|
|
@@ -98,7 +82,7 @@ var Schema = function (_a) {
|
|
|
98
82
|
rawValue ? (react_1.default.createElement("div", null,
|
|
99
83
|
react_1.default.createElement("div", { className: "text-sm" }, helpers_1.SchemaHelpers.prettifyValue(schema.const(), false)))) : (react_1.default.createElement("div", null,
|
|
100
84
|
react_1.default.createElement("div", null,
|
|
101
|
-
|
|
85
|
+
react_1.default.createElement("div", { className: "capitalize text-sm text-teal-500 font-bold inline-block mr-2" }, isCircular ? "".concat(schemaType, " [CIRCULAR]") : schemaType),
|
|
102
86
|
react_1.default.createElement("div", { className: "inline-block" },
|
|
103
87
|
schema.format() && (react_1.default.createElement("span", { className: "bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs" },
|
|
104
88
|
"format: ",
|
|
@@ -117,7 +101,7 @@ var Schema = function (_a) {
|
|
|
117
101
|
uid && !uid.startsWith('<anonymous-') && (react_1.default.createElement("span", { className: "border text-orange-600 rounded mr-2 p-1 text-xs" },
|
|
118
102
|
"uid: ",
|
|
119
103
|
uid))),
|
|
120
|
-
schema.
|
|
104
|
+
schema.description() !== undefined && (react_1.default.createElement("div", null,
|
|
121
105
|
react_1.default.createElement(index_1.Markdown, null, schema.description()))),
|
|
122
106
|
schema.default() !== undefined && (react_1.default.createElement("div", { className: "text-xs" },
|
|
123
107
|
"Default value:",
|
|
@@ -127,8 +111,8 @@ var Schema = function (_a) {
|
|
|
127
111
|
react_1.default.createElement("span", { className: "border inline-block text-orange-600 rounded ml-1 py-0 px-2" }, helpers_1.SchemaHelpers.prettifyValue(schema.const())))),
|
|
128
112
|
schema.enum() && (react_1.default.createElement("ul", { className: "text-xs" },
|
|
129
113
|
"Allowed values:",
|
|
130
|
-
' ',
|
|
131
|
-
|
|
114
|
+
' ', (_b = schema.enum()) === null || _b === void 0 ? void 0 :
|
|
115
|
+
_b.map(function (e, idx) { return (react_1.default.createElement("li", { key: idx, className: "border inline-block text-orange-600 rounded ml-1 py-0 px-2" },
|
|
132
116
|
react_1.default.createElement("span", null, helpers_1.SchemaHelpers.prettifyValue(e)))); }))),
|
|
133
117
|
parameterLocation && (react_1.default.createElement("div", { className: "text-xs" },
|
|
134
118
|
"Parameter location:",
|
|
@@ -138,24 +122,21 @@ var Schema = function (_a) {
|
|
|
138
122
|
react_1.default.createElement(index_1.Href, { href: externalDocs.url(), title: externalDocs.description() || '' }, "Documentation"))),
|
|
139
123
|
schema.examples() && (react_1.default.createElement("ul", { className: "text-xs" },
|
|
140
124
|
"Examples values:",
|
|
141
|
-
' ',
|
|
142
|
-
|
|
125
|
+
' ', (_c = schema.examples()) === null || _c === void 0 ? void 0 :
|
|
126
|
+
_c.map(function (e, idx) { return (react_1.default.createElement("li", { key: idx, className: "border inline-block text-orange-600 rounded ml-1 py-0 px-2 break-all" },
|
|
143
127
|
react_1.default.createElement("span", null, helpers_1.SchemaHelpers.prettifyValue(e)))); }))))))),
|
|
144
128
|
isCircular || !isExpandable ? null : (react_1.default.createElement("div", { className: "rounded p-4 py-2 border bg-gray-100 ".concat(reverse ? 'bg-gray-200' : '', " ").concat(expanded ? 'block' : 'hidden') },
|
|
145
129
|
react_1.default.createElement(SchemaProperties, { schema: schema }),
|
|
146
130
|
react_1.default.createElement(SchemaItems, { schema: schema }),
|
|
147
131
|
schema.oneOf() &&
|
|
148
|
-
schema
|
|
149
|
-
.oneOf()
|
|
150
|
-
.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Adheres to:' : 'Or to:' })); }),
|
|
132
|
+
((_d = schema
|
|
133
|
+
.oneOf()) === null || _d === void 0 ? void 0 : _d.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Adheres to:' : 'Or to:' })); })),
|
|
151
134
|
schema.anyOf() &&
|
|
152
|
-
schema
|
|
153
|
-
.anyOf()
|
|
154
|
-
.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Can adhere to:' : 'Or to:' })); }),
|
|
135
|
+
((_e = schema
|
|
136
|
+
.anyOf()) === null || _e === void 0 ? void 0 : _e.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Can adhere to:' : 'Or to:' })); })),
|
|
155
137
|
schema.allOf() &&
|
|
156
|
-
schema
|
|
157
|
-
.allOf()
|
|
158
|
-
.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Consists of:' : 'And with:' })); }),
|
|
138
|
+
((_f = schema
|
|
139
|
+
.allOf()) === null || _f === void 0 ? void 0 : _f.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Consists of:' : 'And with:' })); })),
|
|
159
140
|
schema.not() && (react_1.default.createElement(exports.Schema, { schema: schema.not(), schemaName: "Cannot adhere to:" })),
|
|
160
141
|
schema.propertyNames() && (react_1.default.createElement(exports.Schema, { schema: schema.propertyNames(), schemaName: "Property names must adhere to:" })),
|
|
161
142
|
schema.contains() && (react_1.default.createElement(exports.Schema, { schema: schema.contains(), schemaName: "Array must contain at least one of:" })),
|
|
@@ -176,25 +157,26 @@ var SchemaProperties = function (_a) {
|
|
|
176
157
|
}
|
|
177
158
|
var required = schema.required() || [];
|
|
178
159
|
var patternProperties = schema.patternProperties();
|
|
179
|
-
var circularProps = schema.ext('x-parser-circular-props') || [];
|
|
180
160
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
181
161
|
Object.entries(properties).map(function (_a) {
|
|
182
162
|
var propertyName = _a[0], property = _a[1];
|
|
183
|
-
return (react_1.default.createElement(exports.Schema, { schema: property, schemaName: propertyName, required: required.includes(propertyName), isProperty: true, isCircular:
|
|
163
|
+
return (react_1.default.createElement(exports.Schema, { schema: property, schemaName: propertyName, required: required.includes(propertyName), isProperty: true, isCircular: property.isCircular(), dependentRequired: helpers_1.SchemaHelpers.getDependentRequired(propertyName, schema), key: propertyName }));
|
|
184
164
|
}),
|
|
185
|
-
Object.entries(patternProperties).map(function (_a) {
|
|
165
|
+
Object.entries(patternProperties || {}).map(function (_a) {
|
|
186
166
|
var propertyName = _a[0], property = _a[1];
|
|
187
|
-
return (react_1.default.createElement(exports.Schema, { schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular:
|
|
167
|
+
return (react_1.default.createElement(exports.Schema, { schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular(), key: propertyName }));
|
|
188
168
|
})));
|
|
189
169
|
};
|
|
190
170
|
var AdditionalProperties = function (_a) {
|
|
171
|
+
var _b;
|
|
191
172
|
var schema = _a.schema;
|
|
192
|
-
if (
|
|
173
|
+
if (((_b = schema
|
|
174
|
+
.extensions()
|
|
175
|
+
.get(helpers_1.SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) {
|
|
193
176
|
return null;
|
|
194
177
|
}
|
|
195
178
|
var type = schema.type();
|
|
196
|
-
|
|
197
|
-
if (!type.includes('object')) {
|
|
179
|
+
if (type === undefined || !type.includes('object')) {
|
|
198
180
|
return null;
|
|
199
181
|
}
|
|
200
182
|
var additionalProperties = schema.additionalProperties();
|
|
@@ -212,8 +194,7 @@ var AdditionalProperties = function (_a) {
|
|
|
212
194
|
var SchemaItems = function (_a) {
|
|
213
195
|
var schema = _a.schema;
|
|
214
196
|
var type = schema.type();
|
|
215
|
-
|
|
216
|
-
if (!type.includes('array')) {
|
|
197
|
+
if (type === undefined || !type.includes('array')) {
|
|
217
198
|
return null;
|
|
218
199
|
}
|
|
219
200
|
var items = schema.items();
|
|
@@ -228,13 +209,15 @@ var SchemaItems = function (_a) {
|
|
|
228
209
|
return react_1.default.createElement(exports.Schema, { schema: items, schemaName: "Items:" });
|
|
229
210
|
};
|
|
230
211
|
var AdditionalItems = function (_a) {
|
|
212
|
+
var _b;
|
|
231
213
|
var schema = _a.schema;
|
|
232
|
-
if (
|
|
214
|
+
if (((_b = schema
|
|
215
|
+
.extensions()
|
|
216
|
+
.get(helpers_1.SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) {
|
|
233
217
|
return null;
|
|
234
218
|
}
|
|
235
219
|
var type = schema.type();
|
|
236
|
-
|
|
237
|
-
if (!type.includes('array')) {
|
|
220
|
+
if (type === undefined || !type.includes('array')) {
|
|
238
221
|
return null;
|
|
239
222
|
}
|
|
240
223
|
if (!Array.isArray(schema.items())) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+D;AAG/D,iCAAqE;AACrE,sCAA2C;AAc3C,IAAM,aAAa,GAAG,eAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;CACpB,CAAC,CAAC;AAEI,IAAM,MAAM,GAAmC,UAAC,EAUtD;QATC,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,gBAAgB,EAAhB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UAAC,EAEvE;QADC,MAAM,YAAA;IAEN,IAAI,MAAM,CAAC,GAAG,CAAC,uBAAa,CAAC,uBAAuB,CAAC,KAAK,KAAK,EAAE;QAC/D,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACzB,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAED,IAAM,eAAe,GAAG,MAAM,CAAC,eAAe,EAAS,CAAC;IACxD,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;QAC7D,OAAO,CACL,qCAAG,SAAS,EAAC,4BAA4B,oCAErC,CACL,CAAC;KACH;IACD,IAAI,eAAe,KAAK,KAAK,EAAE;QAC7B,OAAO,CACL,qCAAG,SAAS,EAAC,4BAA4B;;YAClB,oDAAoB;wBACvC,CACL,CAAC;KACH;IACD,OAAO,8BAAC,cAAM,IAAC,UAAU,EAAC,mBAAmB,EAAC,MAAM,EAAE,eAAe,GAAI,CAAC;AAC5E,CAAC,CAAC","sourcesContent":["import React, { useState, useEffect, useContext } from 'react';\nimport { Schema as SchemaType } from '@asyncapi/parser';\n\nimport { Href, CollapseButton, Markdown, Extensions } from './index';\nimport { SchemaHelpers } from '../helpers';\n\ninterface Props {\n schemaName?: React.ReactNode;\n schema?: SchemaType;\n required?: boolean;\n isPatternProperty?: boolean;\n isProperty?: boolean;\n isCircular?: boolean;\n dependentRequired?: string[];\n expanded?: boolean;\n onlyTitle?: boolean;\n}\n\nconst SchemaContext = React.createContext({\n reverse: false,\n deepExpanded: false,\n});\n\nexport const Schema: React.FunctionComponent<Props> = ({\n schemaName,\n schema,\n required = false,\n isPatternProperty = false,\n isProperty = false,\n isCircular = false,\n dependentRequired,\n expanded: propExpanded = false,\n onlyTitle = false,\n}) => {\n const { reverse, deepExpanded } = useContext(SchemaContext);\n const [expanded, setExpanded] = useState(propExpanded);\n const [deepExpand, setDeepExpand] = useState(false);\n\n useEffect(() => {\n setDeepExpand(deepExpanded);\n }, [deepExpanded, setDeepExpand]);\n\n useEffect(() => {\n setExpanded(deepExpand);\n }, [deepExpand, setExpanded]);\n\n if (\n !schema ||\n (typeof schemaName === 'string' &&\n (schemaName?.startsWith('x-parser-') ||\n schemaName?.startsWith('x-schema-private-')))\n ) {\n return null;\n }\n\n const dependentSchemas = SchemaHelpers.getDependentSchemas(schema);\n\n const constraints = SchemaHelpers.humanizeConstraints(schema);\n const externalDocs = schema.externalDocs();\n\n const renderType = schema.ext(SchemaHelpers.extRenderType) !== false;\n const rawValue = schema.ext(SchemaHelpers.extRawValue) === true;\n const parameterLocation = schema.ext(SchemaHelpers.extParameterLocation);\n const isExpandable = SchemaHelpers.isExpandable(schema) || dependentSchemas;\n\n let schemaType = SchemaHelpers.toSchemaType(schema);\n isCircular =\n isCircular ||\n schema.isCircular() ||\n schema.ext('x-parser-circular') ||\n false;\n const uid = schema.uid();\n\n const schemaItems = schema.items();\n if (schemaItems && !Array.isArray(schemaItems)) {\n /**\n * fallback for older logic for circular references:\n *\n * checking uid for circular items\n * `x-parser-circular` extension is added to every schema which has circular `items` field,\n * so we must check that `items` is schema (not array of schemas) and infer UID of schema to display which schema is circular (by the name of schema)\n */\n isCircular =\n isCircular ||\n schemaItems.isCircular() ||\n schemaItems.ext('x-parser-circular') ||\n false;\n if (\n isCircular &&\n typeof (schemaItems as any).circularSchema === 'function'\n ) {\n schemaType = SchemaHelpers.toSchemaType(\n (schemaItems as any).circularSchema(),\n );\n }\n } else if (\n isCircular &&\n typeof (schema as any).circularSchema === 'function'\n ) {\n schemaType = SchemaHelpers.toSchemaType((schema as any).circularSchema());\n }\n\n const styledSchemaName = isProperty ? 'italic' : '';\n const renderedSchemaName =\n typeof schemaName === 'string' ? (\n <span className={`break-words text-sm ${styledSchemaName}`}>\n {schemaName}\n </span>\n ) : (\n schemaName\n );\n\n return (\n <SchemaContext.Provider\n value={{ reverse: !reverse, deepExpanded: deepExpand }}\n >\n <div>\n <div className=\"flex py-2\">\n <div className={`${onlyTitle ? '' : 'min-w-1/4'} mr-2`}>\n {isExpandable && !isCircular ? (\n <>\n <CollapseButton\n onClick={() => setExpanded(prev => !prev)}\n expanded={expanded}\n >\n {renderedSchemaName}\n </CollapseButton>\n <button\n type=\"button\"\n onClick={() => setDeepExpand(prev => !prev)}\n className=\"ml-1 text-sm text-gray-500\"\n >\n {deepExpand ? 'Collapse all' : 'Expand all'}\n </button>\n </>\n ) : (\n <span\n className={`break-words text-sm ${isProperty ? 'italic' : ''}`}\n >\n {schemaName}\n </span>\n )}\n {isPatternProperty && (\n <div className=\"text-gray-500 text-xs italic\">\n (pattern property)\n </div>\n )}\n {required && <div className=\"text-red-600 text-xs\">required</div>}\n {dependentRequired && (\n <>\n <div className=\"text-gray-500 text-xs\">\n required when defined:\n </div>\n <div className=\"text-red-600 text-xs\">\n {dependentRequired.join(', ')}\n </div>\n </>\n )}\n {schema.deprecated() && (\n <div className=\"text-red-600 text-xs\">deprecated</div>\n )}\n {schema.writeOnly() && (\n <div className=\"text-gray-500 text-xs\">write-only</div>\n )}\n {schema.readOnly() && (\n <div className=\"text-gray-500 text-xs\">read-only</div>\n )}\n </div>\n {rawValue ? (\n <div>\n <div className=\"text-sm\">\n {SchemaHelpers.prettifyValue(schema.const(), false)}\n </div>\n </div>\n ) : (\n <div>\n <div>\n {renderType && (\n <div className=\"capitalize text-sm text-teal-500 font-bold inline-block mr-2\">\n {isCircular ? `${schemaType} [CIRCULAR]` : schemaType}\n </div>\n )}\n <div className=\"inline-block\">\n {schema.format() && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </span>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </span>\n )}\n {schema.contentMediaType() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </span>\n )}\n {schema.contentEncoding() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </span>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map(c => (\n <span\n className=\"bg-purple-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </span>\n ))}\n\n {uid && !uid.startsWith('<anonymous-') && (\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n uid: {uid}\n </span>\n )}\n </div>\n\n {schema.hasDescription() && (\n <div>\n <Markdown>{schema.description()}</Markdown>\n </div>\n )}\n\n {schema.default() !== undefined && (\n <div className=\"text-xs\">\n Default value:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.default())}\n </span>\n </div>\n )}\n {schema.const() !== undefined && (\n <div className=\"text-xs\">\n Const:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.const())}\n </span>\n </div>\n )}\n {schema.enum() && (\n <ul className=\"text-xs\">\n Allowed values:{' '}\n {schema.enum().map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n {parameterLocation && (\n <div className=\"text-xs\">\n Parameter location:{' '}\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n {parameterLocation}\n </span>\n </div>\n )}\n {externalDocs && (\n <span className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-2 py-0\">\n <Href\n href={externalDocs.url()}\n title={externalDocs.description() || ''}\n >\n Documentation\n </Href>\n </span>\n )}\n {schema.examples() && (\n <ul className=\"text-xs\">\n Examples values:{' '}\n {schema.examples().map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2 break-all\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n )}\n </div>\n\n {isCircular || !isExpandable ? null : (\n <div\n className={`rounded p-4 py-2 border bg-gray-100 ${\n reverse ? 'bg-gray-200' : ''\n } ${expanded ? 'block' : 'hidden'}`}\n >\n <SchemaProperties schema={schema} />\n <SchemaItems schema={schema} />\n\n {schema.oneOf() &&\n schema\n .oneOf()\n .map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Adheres to:' : 'Or to:'}\n />\n ))}\n {schema.anyOf() &&\n schema\n .anyOf()\n .map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Can adhere to:' : 'Or to:'}\n />\n ))}\n {schema.allOf() &&\n schema\n .allOf()\n .map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Consists of:' : 'And with:'}\n />\n ))}\n {schema.not() && (\n <Schema schema={schema.not()} schemaName=\"Cannot adhere to:\" />\n )}\n\n {schema.propertyNames() && (\n <Schema\n schema={schema.propertyNames()}\n schemaName=\"Property names must adhere to:\"\n />\n )}\n {schema.contains() && (\n <Schema\n schema={schema.contains()}\n schemaName=\"Array must contain at least one of:\"\n />\n )}\n\n {schema.if() && (\n <Schema schema={schema.if()} schemaName=\"If schema adheres to:\" />\n )}\n {schema.then() && (\n <Schema\n schema={schema.then()}\n schemaName=\"Then must adhere to:\"\n />\n )}\n {schema.else() && (\n <Schema schema={schema.else()} schemaName=\"Otherwise:\" />\n )}\n\n {dependentSchemas && (\n <Schema\n schema={dependentSchemas}\n schemaName=\"Dependent schemas:\"\n />\n )}\n\n <Extensions item={schema} />\n\n <AdditionalProperties schema={schema} />\n <AdditionalItems schema={schema} />\n </div>\n )}\n </div>\n </SchemaContext.Provider>\n );\n};\n\ninterface SchemaPropertiesProps {\n schema: SchemaType;\n}\n\nconst SchemaProperties: React.FunctionComponent<SchemaPropertiesProps> = ({\n schema,\n}) => {\n const properties = schema.properties() || {};\n if (!Object.keys(properties)) {\n return null;\n }\n\n const required = schema.required() || [];\n const patternProperties = schema.patternProperties();\n const circularProps = schema.ext('x-parser-circular-props') || [];\n\n return (\n <>\n {Object.entries(properties).map(([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n required={required.includes(propertyName)}\n isProperty={true}\n isCircular={circularProps.includes(propertyName)}\n dependentRequired={SchemaHelpers.getDependentRequired(\n propertyName,\n schema,\n )}\n key={propertyName}\n />\n ))}\n {Object.entries(patternProperties).map(([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n isPatternProperty={true}\n isProperty={true}\n isCircular={circularProps.includes(propertyName)}\n key={propertyName}\n />\n ))}\n </>\n );\n};\n\ninterface AdditionalPropertiesProps {\n schema: SchemaType;\n}\n\nconst AdditionalProperties: React.FunctionComponent<AdditionalPropertiesProps> = ({\n schema,\n}) => {\n if (schema.ext(SchemaHelpers.extRenderAdditionalInfo) === false) {\n return null;\n }\n\n let type = schema.type();\n type = Array.isArray(type) ? type : [type];\n if (!type.includes('object')) {\n return null;\n }\n\n const additionalProperties = schema.additionalProperties();\n if (additionalProperties === true || additionalProperties === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are allowed.\n </p>\n );\n }\n if (additionalProperties === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return (\n <Schema schemaName=\"Additional properties:\" schema={additionalProperties} />\n );\n};\n\ninterface SchemaItemsProps {\n schema: SchemaType;\n}\n\nconst SchemaItems: React.FunctionComponent<SchemaItemsProps> = ({ schema }) => {\n let type = schema.type();\n type = Array.isArray(type) ? type : [type];\n if (!type.includes('array')) {\n return null;\n }\n const items = schema.items();\n\n // object in items\n if (\n items &&\n !Array.isArray(items) &&\n Object.keys(items.properties() || {}).length\n ) {\n return <SchemaProperties schema={items} />;\n } else if (Array.isArray(items)) {\n return (\n <>\n {items.map((item, idx) => (\n <Schema schema={item} schemaName={`${idx + 1} item:`} key={idx} />\n ))}\n </>\n );\n }\n return <Schema schema={items} schemaName=\"Items:\" />;\n};\n\ninterface AdditionalItemsProps {\n schema: SchemaType;\n}\n\nconst AdditionalItems: React.FunctionComponent<AdditionalItemsProps> = ({\n schema,\n}) => {\n if (schema.ext(SchemaHelpers.extRenderAdditionalInfo) === false) {\n return null;\n }\n\n let type = schema.type();\n type = Array.isArray(type) ? type : [type];\n if (!type.includes('array')) {\n return null;\n }\n if (!Array.isArray(schema.items())) {\n return null;\n }\n\n const additionalItems = schema.additionalItems() as any;\n if (additionalItems === true || additionalItems === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are allowed.\n </p>\n );\n }\n if (additionalItems === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return <Schema schemaName=\"Additional items:\" schema={additionalItems} />;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+D;AAG/D,iCAAqE;AACrE,sCAA2C;AAc3C,IAAM,aAAa,GAAG,eAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK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AK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;QAC7D,OAAO,CACL,qCAAG,SAAS,EAAC,4BAA4B,oCAErC,CACL,CAAC;KACH;IACD,IAAI,eAAe,KAAK,KAAK,EAAE;QAC7B,OAAO,CACL,qCAAG,SAAS,EAAC,4BAA4B;;YAClB,oDAAoB;wBACvC,CACL,CAAC;KACH;IACD,OAAO,8BAAC,cAAM,IAAC,UAAU,EAAC,mBAAmB,EAAC,MAAM,EAAE,eAAe,GAAI,CAAC;AAC5E,CAAC,CAAC","sourcesContent":["import React, { useState, useEffect, useContext } from 'react';\nimport { SchemaInterface } from '@asyncapi/parser';\n\nimport { Href, CollapseButton, Markdown, Extensions } from './index';\nimport { SchemaHelpers } from '../helpers';\n\ninterface Props {\n schemaName?: React.ReactNode;\n schema?: SchemaInterface;\n required?: boolean;\n isPatternProperty?: boolean;\n isProperty?: boolean;\n isCircular?: boolean;\n dependentRequired?: string[];\n expanded?: boolean;\n onlyTitle?: boolean;\n}\n\nconst SchemaContext = React.createContext({\n reverse: false,\n deepExpanded: false,\n});\n\nexport const Schema: React.FunctionComponent<Props> = ({\n schemaName,\n schema,\n required = false,\n isPatternProperty = false,\n isProperty = false,\n isCircular = false,\n dependentRequired,\n expanded: propExpanded = false,\n onlyTitle = false,\n}) => {\n const { reverse, deepExpanded } = useContext(SchemaContext);\n const [expanded, setExpanded] = useState(propExpanded);\n const [deepExpand, setDeepExpand] = useState(false);\n\n useEffect(() => {\n setDeepExpand(deepExpanded);\n }, [deepExpanded, setDeepExpand]);\n\n useEffect(() => {\n setExpanded(deepExpand);\n }, [deepExpand, setExpanded]);\n\n if (\n !schema ||\n (typeof schemaName === 'string' &&\n (schemaName?.startsWith('x-parser-') ||\n schemaName?.startsWith('x-schema-private-')))\n ) {\n return null;\n }\n\n const dependentSchemas = SchemaHelpers.getDependentSchemas(schema);\n\n const constraints = SchemaHelpers.humanizeConstraints(schema);\n const externalDocs = schema.externalDocs();\n\n const rawValueExt = schema.extensions().get(SchemaHelpers.extRawValue);\n const rawValue = rawValueExt?.value() === true;\n\n const parameterLocationExt = schema\n .extensions()\n .get(SchemaHelpers.extParameterLocation);\n const parameterLocation = parameterLocationExt?.value() === true;\n\n const schemaType = SchemaHelpers.toSchemaType(schema);\n const isExpandable = SchemaHelpers.isExpandable(schema) || dependentSchemas;\n\n isCircular = isCircular || schema.isCircular() || false;\n const uid = schema.$id();\n const styledSchemaName = isProperty ? 'italic' : '';\n const renderedSchemaName =\n typeof schemaName === 'string' ? (\n <span className={`break-words text-sm ${styledSchemaName}`}>\n {schemaName}\n </span>\n ) : (\n schemaName\n );\n\n return (\n <SchemaContext.Provider\n value={{ reverse: !reverse, deepExpanded: deepExpand }}\n >\n <div>\n <div className=\"flex py-2\">\n <div className={`${onlyTitle ? '' : 'min-w-1/4'} mr-2`}>\n {isExpandable && !isCircular ? (\n <>\n <CollapseButton\n onClick={() => setExpanded(prev => !prev)}\n expanded={expanded}\n >\n {renderedSchemaName}\n </CollapseButton>\n <button\n type=\"button\"\n onClick={() => setDeepExpand(prev => !prev)}\n className=\"ml-1 text-sm text-gray-500\"\n >\n {deepExpand ? 'Collapse all' : 'Expand all'}\n </button>\n </>\n ) : (\n <span\n className={`break-words text-sm ${isProperty ? 'italic' : ''}`}\n >\n {schemaName}\n </span>\n )}\n {isPatternProperty && (\n <div className=\"text-gray-500 text-xs italic\">\n (pattern property)\n </div>\n )}\n {required && <div className=\"text-red-600 text-xs\">required</div>}\n {dependentRequired && (\n <>\n <div className=\"text-gray-500 text-xs\">\n required when defined:\n </div>\n <div className=\"text-red-600 text-xs\">\n {dependentRequired.join(', ')}\n </div>\n </>\n )}\n {schema.deprecated() && (\n <div className=\"text-red-600 text-xs\">deprecated</div>\n )}\n {schema.writeOnly() && (\n <div className=\"text-gray-500 text-xs\">write-only</div>\n )}\n {schema.readOnly() && (\n <div className=\"text-gray-500 text-xs\">read-only</div>\n )}\n </div>\n {rawValue ? (\n <div>\n <div className=\"text-sm\">\n {SchemaHelpers.prettifyValue(schema.const(), false)}\n </div>\n </div>\n ) : (\n <div>\n <div>\n <div className=\"capitalize text-sm text-teal-500 font-bold inline-block mr-2\">\n {isCircular ? `${schemaType} [CIRCULAR]` : schemaType}\n </div>\n <div className=\"inline-block\">\n {schema.format() && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </span>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </span>\n )}\n {schema.contentMediaType() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </span>\n )}\n {schema.contentEncoding() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </span>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map(c => (\n <span\n className=\"bg-purple-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </span>\n ))}\n\n {uid && !uid.startsWith('<anonymous-') && (\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n uid: {uid}\n </span>\n )}\n </div>\n\n {schema.description() !== undefined && (\n <div>\n <Markdown>{schema.description()}</Markdown>\n </div>\n )}\n\n {schema.default() !== undefined && (\n <div className=\"text-xs\">\n Default value:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.default())}\n </span>\n </div>\n )}\n {schema.const() !== undefined && (\n <div className=\"text-xs\">\n Const:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.const())}\n </span>\n </div>\n )}\n {schema.enum() && (\n <ul className=\"text-xs\">\n Allowed values:{' '}\n {schema.enum()?.map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n {parameterLocation && (\n <div className=\"text-xs\">\n Parameter location:{' '}\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n {parameterLocation}\n </span>\n </div>\n )}\n {externalDocs && (\n <span className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-2 py-0\">\n <Href\n href={externalDocs.url()}\n title={externalDocs.description() || ''}\n >\n Documentation\n </Href>\n </span>\n )}\n {schema.examples() && (\n <ul className=\"text-xs\">\n Examples values:{' '}\n {schema.examples()?.map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2 break-all\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n )}\n </div>\n\n {isCircular || !isExpandable ? null : (\n <div\n className={`rounded p-4 py-2 border bg-gray-100 ${\n reverse ? 'bg-gray-200' : ''\n } ${expanded ? 'block' : 'hidden'}`}\n >\n <SchemaProperties schema={schema} />\n <SchemaItems schema={schema} />\n\n {schema.oneOf() &&\n schema\n .oneOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Adheres to:' : 'Or to:'}\n />\n ))}\n {schema.anyOf() &&\n schema\n .anyOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Can adhere to:' : 'Or to:'}\n />\n ))}\n {schema.allOf() &&\n schema\n .allOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Consists of:' : 'And with:'}\n />\n ))}\n {schema.not() && (\n <Schema schema={schema.not()} schemaName=\"Cannot adhere to:\" />\n )}\n\n {schema.propertyNames() && (\n <Schema\n schema={schema.propertyNames()}\n schemaName=\"Property names must adhere to:\"\n />\n )}\n {schema.contains() && (\n <Schema\n schema={schema.contains()}\n schemaName=\"Array must contain at least one of:\"\n />\n )}\n\n {schema.if() && (\n <Schema schema={schema.if()} schemaName=\"If schema adheres to:\" />\n )}\n {schema.then() && (\n <Schema\n schema={schema.then()}\n schemaName=\"Then must adhere to:\"\n />\n )}\n {schema.else() && (\n <Schema schema={schema.else()} schemaName=\"Otherwise:\" />\n )}\n\n {dependentSchemas && (\n <Schema\n schema={dependentSchemas}\n schemaName=\"Dependent schemas:\"\n />\n )}\n\n <Extensions item={schema} />\n\n <AdditionalProperties schema={schema} />\n <AdditionalItems schema={schema} />\n </div>\n )}\n </div>\n </SchemaContext.Provider>\n );\n};\n\ninterface SchemaPropertiesProps {\n schema: SchemaInterface;\n}\n\nconst SchemaProperties: React.FunctionComponent<SchemaPropertiesProps> = ({\n schema,\n}) => {\n const properties = schema.properties() || {};\n if (!Object.keys(properties)) {\n return null;\n }\n\n const required = schema.required() || [];\n const patternProperties = schema.patternProperties();\n\n return (\n <>\n {Object.entries(properties).map(([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n required={required.includes(propertyName)}\n isProperty={true}\n isCircular={property.isCircular()}\n dependentRequired={SchemaHelpers.getDependentRequired(\n propertyName,\n schema,\n )}\n key={propertyName}\n />\n ))}\n {Object.entries(patternProperties || {}).map(\n ([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n isPatternProperty={true}\n isProperty={true}\n isCircular={property.isCircular()}\n key={propertyName}\n />\n ),\n )}\n </>\n );\n};\n\ninterface AdditionalPropertiesProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalProperties: React.FunctionComponent<AdditionalPropertiesProps> = ({\n schema,\n}) => {\n if (\n schema\n .extensions()\n .get(SchemaHelpers.extRenderAdditionalInfo)\n ?.value() === false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (type === undefined || !type.includes('object')) {\n return null;\n }\n\n const additionalProperties = schema.additionalProperties();\n if (additionalProperties === true || additionalProperties === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are allowed.\n </p>\n );\n }\n if (additionalProperties === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return (\n <Schema schemaName=\"Additional properties:\" schema={additionalProperties} />\n );\n};\n\ninterface SchemaItemsProps {\n schema: SchemaInterface;\n}\n\nconst SchemaItems: React.FunctionComponent<SchemaItemsProps> = ({ schema }) => {\n const type = schema.type();\n if (type === undefined || !type.includes('array')) {\n return null;\n }\n const items = schema.items();\n\n // object in items\n if (\n items &&\n !Array.isArray(items) &&\n Object.keys(items.properties() || {}).length\n ) {\n return <SchemaProperties schema={items} />;\n } else if (Array.isArray(items)) {\n return (\n <>\n {items.map((item, idx) => (\n <Schema schema={item} schemaName={`${idx + 1} item:`} key={idx} />\n ))}\n </>\n );\n }\n return <Schema schema={items} schemaName=\"Items:\" />;\n};\n\ninterface AdditionalItemsProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalItems: React.FunctionComponent<AdditionalItemsProps> = ({\n schema,\n}) => {\n if (\n schema\n .extensions()\n .get(SchemaHelpers.extRenderAdditionalInfo)\n ?.value() === false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (type === undefined || !type.includes('array')) {\n return null;\n }\n if (!Array.isArray(schema.items())) {\n return null;\n }\n\n const additionalItems = schema.additionalItems() as any;\n if (additionalItems === true || additionalItems === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are allowed.\n </p>\n );\n }\n if (additionalItems === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return <Schema schemaName=\"Additional items:\" schema={additionalItems} />;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/components/Tag.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAG1B,+BAA8B;AAMvB,IAAM,GAAG,GAAmC,UAAC,EAAO;QAAL,GAAG,SAAA;IACvD,IAAM,IAAI,GAAG,WAAI,GAAG,CAAC,IAAI,EAAE,CAAE,CAAC;IAC9B,IAAM,WAAW,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAC5C,IAAM,YAAY,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC;IAExC,IAAM,OAAO,GAAG,CACd,uCACE,KAAK,EAAE,WAAW,EAClB,SAAS,EAAC,0IAA0I;QAEpJ,wCAAM,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAG,IAAI,CAAQ,CAC3D,CACP,CAAC;IAEF,IAAI,YAAY,EAAE;QAChB,OAAO,CACL,8BAAC,WAAI,IAAC,IAAI,EAAE,YAAY,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,IAC/C,OAAO,CACH,CACR,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAtBW,QAAA,GAAG,OAsBd","sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/components/Tag.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAG1B,+BAA8B;AAMvB,IAAM,GAAG,GAAmC,UAAC,EAAO;QAAL,GAAG,SAAA;IACvD,IAAM,IAAI,GAAG,WAAI,GAAG,CAAC,IAAI,EAAE,CAAE,CAAC;IAC9B,IAAM,WAAW,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAC5C,IAAM,YAAY,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC;IAExC,IAAM,OAAO,GAAG,CACd,uCACE,KAAK,EAAE,WAAW,EAClB,SAAS,EAAC,0IAA0I;QAEpJ,wCAAM,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAG,IAAI,CAAQ,CAC3D,CACP,CAAC;IAEF,IAAI,YAAY,EAAE;QAChB,OAAO,CACL,8BAAC,WAAI,IAAC,IAAI,EAAE,YAAY,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,IAC/C,OAAO,CACH,CACR,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAtBW,QAAA,GAAG,OAsBd","sourcesContent":["import React from 'react';\nimport { TagInterface } from '@asyncapi/parser';\n\nimport { Href } from './Href';\n\ninterface Props {\n tag: TagInterface;\n}\n\nexport const Tag: React.FunctionComponent<Props> = ({ tag }) => {\n const name = `#${tag.name()}`;\n const description = tag.description() || '';\n const externalDocs = tag.externalDocs();\n\n const element = (\n <div\n title={description}\n className=\"border border-solid border-blue-300 hover:bg-blue-300 hover:text-blue-600 text-blue-500 font-bold no-underline text-xs rounded px-3 py-1\"\n >\n <span className={externalDocs ? 'underline' : ''}>{name}</span>\n </div>\n );\n\n if (externalDocs) {\n return (\n <Href href={externalDocs.url()} title={description}>\n {element}\n </Href>\n );\n }\n return element;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/Tags.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAG1B,6BAA4B;AAMrB,IAAM,IAAI,GAAmC,UAAC,EAAQ;QAAN,IAAI,UAAA;IACzD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QACzB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,sCAAI,SAAS,EAAC,+BAA+B,IAC1C,IAAI,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,CACf,sCAAI,SAAS,EAAC,wBAAwB,EAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;QACpD,8BAAC,SAAG,IAAC,GAAG,EAAE,GAAG,GAAI,CACd,CACN,EAJgB,CAIhB,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,IAAI,QAcf","sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/Tags.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAG1B,6BAA4B;AAMrB,IAAM,IAAI,GAAmC,UAAC,EAAQ;QAAN,IAAI,UAAA;IACzD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QACzB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,sCAAI,SAAS,EAAC,+BAA+B,IAC1C,IAAI,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,CACf,sCAAI,SAAS,EAAC,wBAAwB,EAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;QACpD,8BAAC,SAAG,IAAC,GAAG,EAAE,GAAG,GAAI,CACd,CACN,EAJgB,CAIhB,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,IAAI,QAcf","sourcesContent":["import React from 'react';\nimport { TagInterface } from '@asyncapi/parser';\n\nimport { Tag } from './Tag';\n\ninterface Props {\n tags?: TagInterface[];\n}\n\nexport const Tags: React.FunctionComponent<Props> = ({ tags }) => {\n if (!tags || !tags.length) {\n return null;\n }\n\n return (\n <ul className=\"flex flex-wrap leading-normal\">\n {tags.map(tag => (\n <li className=\"inline-block mt-2 mr-2\" key={tag.name()}>\n <Tag tag={tag} />\n </li>\n ))}\n </ul>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncApi.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/AsyncApi.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAGzC,4DAA8C;A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AAC;wBACnE,IAAI,UAAU,EAAE;4BACd,IAAI,CAAC,QAAQ,CAAC;gCACZ,QAAQ,EAAE,UAAU;6BACrB,CAAC,CAAC;4BACH,WAAO;yBACR;6BAEG,IAAA,iCAAyB,EAAC,MAAM,CAAC,EAAjC,cAAiC;wBACb,WAAM,gBAAM,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,EAAA;;wBAAhE,aAAa,GAAG,SAAgD;wBACtE,IAAI,CAAC,QAAQ,CAAC;4BACZ,QAAQ,EAAE,aAAa,CAAC,QAAQ;4BAChC,KAAK,EAAE,aAAa,CAAC,KAAK;yBAC3B,CAAC,CAAC;wBACH,WAAO;4BAGM,WAAM,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,EAAA;;wBAAlD,MAAM,GAAG,SAAyC;wBACxD,IAAI,CAAC,QAAQ,CAAC;4BACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;4BACzB,KAAK,EAAE,MAAM,CAAC,KAAK;yBACpB,CAAC,CAAC;;;;;KACJ;IACH,wBAAC;AAAD,CAAC,AAhED,CAAgC,iBAAS,GAgExC;AAED,kBAAe,iBAAiB,CAAC","sourcesContent":["import React, { Component } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"AsyncApi.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/AsyncApi.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAGzC,4DAA8C;AAE9C,qCAIqB;AAErB,yCAA6D;AAY7D;IAAgC,qCAAuC;IAMrE,2BAAY,KAAoB;QAAhC,YACE,kBAAM,KAAK,CAAC,SACb;QAPD,WAAK,GAAkB;YACrB,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,SAAS;SACjB,CAAC;;IAIF,CAAC;IAEK,6CAAiB,GAAvB;;;;gBACE,IAAI,IAAI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;;wBAAhE,aAAa,GAAG,SAAgD;wBACtE,IAAI,CAAC,QAAQ,CAAC;4BACZ,QAAQ,EAAE,aAAa,CAAC,QAAQ;4BAChC,KAAK,EAAE,aAAa,CAAC,KAAK;yBAC3B,CAAC,CAAC;wBACH,WAAO;4BAGM,WAAM,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,EAAA;;wBAAlD,MAAM,GAAG,SAAyC;wBACxD,IAAI,CAAC,QAAQ,CAAC;4BACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;4BACzB,KAAK,EAAE,MAAM,CAAC,KAAK;yBACpB,CAAC,CAAC;;;;;KACJ;IACH,wBAAC;AAAD,CAAC,AAhED,CAAgC,iBAAS,GAgExC;AAED,kBAAe,iBAAiB,CAAC","sourcesContent":["import React, { Component } from 'react';\nimport { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nimport AsyncApiStandalone from './Standalone';\n\nimport {\n isFetchingSchemaInterface,\n ErrorObject,\n PropsSchema,\n} from '../../types';\nimport { ConfigInterface } from '../../config';\nimport { SpecificationHelpers, Parser } from '../../helpers';\n\nexport interface AsyncApiProps {\n schema: PropsSchema;\n config?: Partial<ConfigInterface>;\n}\n\ninterface AsyncAPIState {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nclass AsyncApiComponent extends Component<AsyncApiProps, AsyncAPIState> {\n state: AsyncAPIState = {\n asyncapi: undefined,\n error: undefined,\n };\n\n constructor(props: AsyncApiProps) {\n super(props);\n }\n\n async componentDidMount() {\n if (this.props.schema) {\n const { schema, config } = this.props;\n this.parseSchema(schema, config && config.parserOptions);\n }\n }\n\n async componentDidUpdate(prevProps: AsyncApiProps) {\n const oldSchema = prevProps.schema;\n const newSchema = this.props.schema;\n\n if (oldSchema !== newSchema) {\n const { config } = this.props;\n this.parseSchema(newSchema, config && config.parserOptions);\n }\n }\n\n render() {\n const { schema, config } = this.props;\n const { asyncapi, error } = this.state;\n\n return (\n <AsyncApiStandalone\n schema={asyncapi || schema}\n config={config}\n error={error}\n />\n );\n }\n\n private async parseSchema(schema: PropsSchema, parserOptions?: any) {\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(schema);\n if (parsedSpec) {\n this.setState({\n asyncapi: parsedSpec,\n });\n return;\n }\n\n if (isFetchingSchemaInterface(schema)) {\n const parsedFromUrl = await Parser.parseFromUrl(schema, parserOptions);\n this.setState({\n asyncapi: parsedFromUrl.asyncapi,\n error: parsedFromUrl.error,\n });\n return;\n }\n\n const parsed = await Parser.parse(schema, parserOptions);\n this.setState({\n asyncapi: parsed.asyncapi,\n error: parsed.error,\n });\n }\n}\n\nexport default AsyncApiComponent;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Layout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAExC,4EAAoD;AAEpD,8CAA6C;AAC7C,qCAAoC;AACpC,8CAA6C;AAC7C,uDAAsD;AACtD,iDAAgD;AAChD,8CAA6C;AAC7C,wCAAuC;AAGvC,2CAAqE;AASrE,IAAM,cAAc,GAAmC,UAAC,EAIvD;QAHC,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,aAAY,EAAZ,KAAK,mBAAG,IAAI,KAAA;IAEN,IAAA,KAA4C,IAAA,gBAAQ,EAAC,cAAc,CAAC,EAAnE,iBAAiB,QAAA,EAAE,oBAAoB,QAA4B,CAAC;IAEnE,IAAA,GAAG,GAAK,IAAA,6BAAiB,EAAiB;QAChD,QAAQ,EAAE,UAAC,EAAS;gBAAP,KAAK,WAAA;YAChB,qBAAqB,CAAC;gBACpB,IAAI,KAAK,KAAK,SAAS,EAAE;oBACvB,OAAO;iBACR;gBAED,IAAM,iBAAiB,GACrB,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC;gBACpD,IAAI,iBAAiB,KAAK,iBAAiB,EAAE;oBAC3C,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;iBACzC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,IAdS,CAcR;IAEH,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACrC,OAAO,CACL,8BAAC,wBAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM;QACnC,8BAAC,+BAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ;YAC5C,2CAAS,SAAS,EAAC,UAAU;gBAC3B,uCACE,SAAS,EAAE,UAAG,iBAAiB,8CAA2C,EAC1E,EAAE,EAAE,MAAM,CAAC,QAAQ,IAAI,SAAS,EAChC,GAAG,EAAE,GAAG;oBAEP,UAAU,CAAC,OAAO,IAAI,8BAAC,iBAAO,OAAG;oBAClC,uCAAK,SAAS,EAAC,oCAAoC;wBACjD,uCAAK,SAAS,EAAC,eAAe;4BAC3B,UAAU,CAAC,MAAM,IAAI,KAAK,IAAI,8BAAC,aAAK,IAAC,KAAK,EAAE,KAAK,GAAI;4BACrD,UAAU,CAAC,IAAI,IAAI,8BAAC,WAAI,OAAG;4BAC3B,UAAU,CAAC,OAAO,IAAI,8BAAC,iBAAO,OAAG;4BACjC,UAAU,CAAC,UAAU,IAAI,8BAAC,uBAAU,OAAG;4BACvC,UAAU,CAAC,QAAQ,IAAI,8BAAC,mBAAQ,OAAG;4BACnC,UAAU,CAAC,OAAO,IAAI,8BAAC,iBAAO,OAAG,CAC9B;wBACN,uCAAK,SAAS,EAAC,wDAAwD,GAAG,CACtE,CACF,CACE,CACoB,CACT,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Layout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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ACjD,uCAAK,SAAS,EAAC,eAAe;4BAC3B,UAAU,CAAC,MAAM,IAAI,KAAK,IAAI,8BAAC,aAAK,IAAC,KAAK,EAAE,KAAK,GAAI;4BACrD,UAAU,CAAC,IAAI,IAAI,8BAAC,WAAI,OAAG;4BAC3B,UAAU,CAAC,OAAO,IAAI,8BAAC,iBAAO,OAAG;4BACjC,UAAU,CAAC,UAAU,IAAI,8BAAC,uBAAU,OAAG;4BACvC,UAAU,CAAC,QAAQ,IAAI,8BAAC,mBAAQ,OAAG;4BACnC,UAAU,CAAC,OAAO,IAAI,8BAAC,iBAAO,OAAG,CAC9B;wBACN,uCAAK,SAAS,EAAC,wDAAwD,GAAG,CACtE,CACF,CACE,CACoB,CACT,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { AsyncAPIDocumentInterface } from '@asyncapi/parser';\nimport useResizeObserver from 'use-resize-observer';\n\nimport { Sidebar } from '../Sidebar/Sidebar';\nimport { Info } from '../Info/Info';\nimport { Servers } from '../Servers/Servers';\nimport { Operations } from '../Operations/Operations';\nimport { Messages } from '../Messages/Messages';\nimport { Schemas } from '../Schemas/Schemas';\nimport { Error } from '../Error/Error';\n\nimport { ConfigInterface } from '../../config';\nimport { SpecificationContext, ConfigContext } from '../../contexts';\nimport { ErrorObject } from '../../types';\n\ninterface Props {\n asyncapi: AsyncAPIDocumentInterface;\n config: ConfigInterface;\n error?: ErrorObject;\n}\n\nconst AsyncApiLayout: React.FunctionComponent<Props> = ({\n asyncapi,\n config,\n error = null,\n}) => {\n const [observerClassName, setObserverClassName] = useState('container:xl');\n\n const { ref } = useResizeObserver<HTMLDivElement>({\n onResize: ({ width }) => {\n requestAnimationFrame(() => {\n if (width === undefined) {\n return;\n }\n\n const possibleClassName =\n width <= 1280 ? 'container:xl' : 'container:base';\n if (possibleClassName !== observerClassName) {\n setObserverClassName(possibleClassName);\n }\n });\n },\n });\n\n const configShow = config.show || {};\n return (\n <ConfigContext.Provider value={config}>\n <SpecificationContext.Provider value={asyncapi}>\n <section className=\"aui-root\">\n <div\n className={`${observerClassName} relative md:flex bg-white leading-normal`}\n id={config.schemaID || undefined}\n ref={ref}\n >\n {configShow.sidebar && <Sidebar />}\n <div className=\"panel--center relative py-8 flex-1\">\n <div className=\"relative z-10\">\n {configShow.errors && error && <Error error={error} />}\n {configShow.info && <Info />}\n {configShow.servers && <Servers />}\n {configShow.operations && <Operations />}\n {configShow.messages && <Messages />}\n {configShow.schemas && <Schemas />}\n </div>\n <div className=\"panel--right absolute top-0 right-0 h-full bg-gray-800\" />\n </div>\n </div>\n </section>\n </SpecificationContext.Provider>\n </ConfigContext.Provider>\n );\n};\n\nexport default AsyncApiLayout;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Standalone.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Standalone.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAGzC,yCAAqD;AAErD,uCAA8D;AAE9D,oDAAsC;AACtC,wCAAuC;AAavC;IAAgC,qCAAuC;IAMrE,2BAAY,KAAoB;QAAhC,YACE,kBAAM,KAAK,CAAC,SAOb;QAbD,WAAK,GAAkB;YACrB,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,SAAS;SACjB,CAAC;QAKA,IAAM,UAAU,GAAG,8BAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,UAAU,EAAE;YACd,KAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;SACvC;;IAEH,CAAC;IAEK,6CAAiB,GAAvB;;;gBACE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACxB,IAAI,CAAC,WAAW,CA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;IAEO,uCAAW,GAAnB,UAAoB,MAAmB;QACrC,IAAM,UAAU,GAAG,8BAAoB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YACvC,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IACH,wBAAC;AAAD,CAAC,AA7ED,CAAgC,iBAAS,GA6ExC;AAED,kBAAe,iBAAiB,CAAC","sourcesContent":["import React, { Component } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Standalone.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Standalone.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAGzC,yCAAqD;AAErD,uCAA8D;AAE9D,oDAAsC;AACtC,wCAAuC;AAavC;IAAgC,qCAAuC;IAMrE,2BAAY,KAAoB;QAAhC,YACE,kBAAM,KAAK,CAAC,SAOb;QAbD,WAAK,GAAkB;YACrB,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,SAAS;SACjB,CAAC;QAKA,IAAM,UAAU,GAAG,8BAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,UAAU,EAAE;YACd,KAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;SACvC;;IAEH,CAAC;IAEK,6CAAiB,GAAvB;;;gBACE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBACrC;;;;KACF;IAEK,8CA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AC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YACvC,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IACH,wBAAC;AAAD,CAAC,AA7ED,CAAgC,iBAAS,GA6ExC;AAED,kBAAe,iBAAiB,CAAC","sourcesContent":["import React, { Component } from 'react';\nimport { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nimport { SpecificationHelpers } from '../../helpers';\nimport { ErrorObject, PropsSchema } from '../../types';\nimport { ConfigInterface, defaultConfig } from '../../config';\n\nimport AsyncApiLayout from './Layout';\nimport { Error } from '../Error/Error';\n\nexport interface AsyncApiProps {\n schema: PropsSchema;\n config?: Partial<ConfigInterface>;\n error?: ErrorObject;\n}\n\ninterface AsyncAPIState {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nclass AsyncApiComponent extends Component<AsyncApiProps, AsyncAPIState> {\n state: AsyncAPIState = {\n asyncapi: undefined,\n error: undefined,\n };\n\n constructor(props: AsyncApiProps) {\n super(props);\n\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(props.schema);\n if (parsedSpec) {\n this.state = { asyncapi: parsedSpec };\n }\n return;\n }\n\n async componentDidMount() {\n if (!this.state.asyncapi) {\n this.updateState(this.props.schema);\n }\n }\n\n async componentDidUpdate(prevProps: AsyncApiProps) {\n const oldSchema = prevProps.schema;\n const newSchema = this.props.schema;\n\n if (oldSchema !== newSchema) {\n this.updateState(newSchema);\n }\n }\n\n render() {\n const { config, error: propError } = this.props;\n const { asyncapi, error: stateError } = this.state;\n\n const error = propError || stateError;\n const concatenatedConfig: ConfigInterface = {\n ...defaultConfig,\n ...config,\n show: {\n ...defaultConfig.show,\n ...(!!config && config.show),\n },\n expand: {\n ...defaultConfig.expand,\n ...(!!config && config.expand),\n },\n sidebar: {\n ...defaultConfig.sidebar,\n ...(!!config && config.sidebar),\n },\n };\n\n if (!asyncapi) {\n if (!error) {\n return null;\n }\n return concatenatedConfig.show?.errors && <Error error={error} />;\n }\n\n return (\n <AsyncApiLayout\n asyncapi={asyncapi}\n config={concatenatedConfig}\n error={error}\n />\n );\n }\n\n private updateState(schema: PropsSchema) {\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(schema);\n if (!parsedSpec) {\n this.setState({ asyncapi: undefined });\n return;\n }\n this.setState({ asyncapi: parsedSpec });\n }\n}\n\nexport default AsyncApiComponent;\n"]}
|
|
@@ -14,8 +14,8 @@ var Info = function () {
|
|
|
14
14
|
if (!info) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
var specId = asyncapi.id();
|
|
18
|
-
var externalDocs = asyncapi.externalDocs();
|
|
17
|
+
var specId = asyncapi.info().id();
|
|
18
|
+
var externalDocs = asyncapi.info().externalDocs();
|
|
19
19
|
var license = info.license();
|
|
20
20
|
var termsOfService = info.termsOfService();
|
|
21
21
|
var defaultContentType = asyncapi.defaultContentType();
|
|
@@ -28,7 +28,7 @@ var Info = function () {
|
|
|
28
28
|
"\u00A0",
|
|
29
29
|
info.version()),
|
|
30
30
|
showInfoList && (react_1.default.createElement("ul", { className: "flex flex-wrap mt-2 leading-normal" },
|
|
31
|
-
license && (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2" }, license.url() ? (react_1.default.createElement(components_1.Href, { className: "border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1", href: license.url() },
|
|
31
|
+
license && (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2" }, license.url() ? (react_1.default.createElement(components_1.Href, { className: "border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1", href: license.url() || '' },
|
|
32
32
|
react_1.default.createElement("span", null, license.name()))) : (react_1.default.createElement("span", { className: "border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1" }, license.name())))),
|
|
33
33
|
termsOfService && (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2" },
|
|
34
34
|
react_1.default.createElement(components_1.Href, { className: "border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1", href: termsOfService },
|
|
@@ -41,7 +41,7 @@ var Info = function () {
|
|
|
41
41
|
react_1.default.createElement("span", null, constants_1.EXTERAL_DOCUMENTATION_TEXT)))),
|
|
42
42
|
contact && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
43
43
|
contact.url() && (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2" },
|
|
44
|
-
react_1.default.createElement(components_1.Href, { className: "border border-solid border-purple-300 hover:bg-purple-300 hover:text-purple-600 text-purple-500 font-bold no-underline text-xs uppercase rounded px-3 py-1", href: contact.url() },
|
|
44
|
+
react_1.default.createElement(components_1.Href, { className: "border border-solid border-purple-300 hover:bg-purple-300 hover:text-purple-600 text-purple-500 font-bold no-underline text-xs uppercase rounded px-3 py-1", href: contact.url() || '' },
|
|
45
45
|
react_1.default.createElement("span", null, contact.name() || constants_1.URL_SUPPORT_TEXT)))),
|
|
46
46
|
contact.email() && (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2" },
|
|
47
47
|
react_1.default.createElement(components_1.Href, { className: "border border-solid border-purple-300 hover:bg-purple-300 hover:text-purple-600 text-purple-500 font-bold no-underline text-xs uppercase rounded px-3 py-1", href: "mailto:".concat(contact.email()) },
|
|
@@ -52,8 +52,8 @@ var Info = function () {
|
|
|
52
52
|
specId))))),
|
|
53
53
|
info.hasDescription() && (react_1.default.createElement("div", { className: "mt-4" },
|
|
54
54
|
react_1.default.createElement(components_1.Markdown, null, info.description()))),
|
|
55
|
-
asyncapi.
|
|
56
|
-
react_1.default.createElement(components_1.Tags, { tags: asyncapi.tags() })))),
|
|
55
|
+
asyncapi.info().tags().length > 0 && (react_1.default.createElement("div", { className: "mt-4" },
|
|
56
|
+
react_1.default.createElement(components_1.Tags, { tags: asyncapi.info().tags() })))),
|
|
57
57
|
react_1.default.createElement("div", { className: "panel-item--right" })));
|
|
58
58
|
};
|
|
59
59
|
exports.Info = Info;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Info.js","sourceRoot":"","sources":["../../../../src/containers/Info/Info.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAE1B,+CAAwD;AACxD,2CAAyC;
|
|
1
|
+
{"version":3,"file":"Info.js","sourceRoot":"","sources":["../../../../src/containers/Info/Info.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAE1B,+CAAwD;AACxD,2CAAyC;AACzC,6CAKyB;AAElB,IAAM,IAAI,GAA4B;IAC3C,IAAM,QAAQ,GAAG,IAAA,kBAAO,GAAE,CAAC;IAE3B,IAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,IAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;IACpC,IAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC;IACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/B,IAAM,cAAc,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAC7C,IAAM,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACzD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAE/B,IAAM,YAAY,GAChB,OAAO,IAAI,cAAc,IAAI,kBAAkB,IAAI,OAAO,IAAI,YAAY,CAAC;IAE7E,OAAO,CACL,uCAAK,SAAS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AwB;wBACpC,8BAAC,iBAAI,IACH,SAAS,EAAC,4JAA4J,EACtK,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE;4BAEzB,4CAAO,OAAO,CAAC,IAAI,EAAE,IAAI,4BAAgB,CAAQ,CAC5C,CACJ,CACN;oBACA,OAAO,CAAC,KAAK,EAAE,IAAI,CAClB,sCAAI,SAAS,EAAC,wBAAwB;wBACpC,8BAAC,iBAAI,IACH,SAAS,EAAC,4JAA4J,EACtK,IAAI,EAAE,iBAAU,OAAO,CAAC,KAAK,EAAE,CAAE;4BAEjC,4CAAO,OAAO,CAAC,KAAK,EAAE,CAAQ,CACzB,CACJ,CACN,CACA,CACJ;gBACA,MAAM,IAAI,CACT,sCAAI,SAAS,EAAC,wBAAwB;oBACpC,wCAAM,SAAS,EAAC,oJAAoJ;;wBAC7J,MAAM,CACN,CACJ,CACN,CACE,CACN;YAEA,IAAI,CAAC,cAAc,EAAE,IAAI,CACxB,uCAAK,SAAS,EAAC,MAAM;gBACnB,8BAAC,qBAAQ,QAAE,IAAI,CAAC,WAAW,EAAE,CAAY,CACrC,CACP;YAEA,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,CACpC,uCAAK,SAAS,EAAC,MAAM;gBACnB,8BAAC,iBAAI,IAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAI,CAClC,CACP,CACG;QAEN,uCAAK,SAAS,EAAC,mBAAmB,GAAG,CACjC,CACP,CAAC;AACJ,CAAC,CAAC;AA3HW,QAAA,IAAI,QA2Hf","sourcesContent":["import React from 'react';\n\nimport { Href, Markdown, Tags } from '../../components';\nimport { useSpec } from '../../contexts';\nimport {\n TERMS_OF_SERVICE_TEXT,\n CONTENT_TYPES_SITE,\n URL_SUPPORT_TEXT,\n EXTERAL_DOCUMENTATION_TEXT,\n} from '../../constants';\n\nexport const Info: React.FunctionComponent = () => {\n const asyncapi = useSpec();\n\n const info = asyncapi.info();\n if (!info) {\n return null;\n }\n\n const specId = asyncapi.info().id();\n const externalDocs = asyncapi.info().externalDocs();\n const license = info.license();\n const termsOfService = info.termsOfService();\n const defaultContentType = asyncapi.defaultContentType();\n const contact = info.contact();\n\n const showInfoList =\n license || termsOfService || defaultContentType || contact || externalDocs;\n\n return (\n <div className=\"panel-item\">\n <div className=\"panel-item--center px-8 text-left\" id=\"introduction\">\n <div className=\"text-4xl\">\n {info.title()} {info.version()}\n </div>\n\n {showInfoList && (\n <ul className=\"flex flex-wrap mt-2 leading-normal\">\n {license && (\n <li className=\"inline-block mt-2 mr-2\">\n {license.url() ? (\n <Href\n className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={license.url() || ''}\n >\n <span>{license.name()}</span>\n </Href>\n ) : (\n <span className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\">\n {license.name()}\n </span>\n )}\n </li>\n )}\n {termsOfService && (\n <li className=\"inline-block mt-2 mr-2\">\n <Href\n className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={termsOfService}\n >\n <span>{TERMS_OF_SERVICE_TEXT}</span>\n </Href>\n </li>\n )}\n {defaultContentType && (\n <li className=\"inline-block mt-2 mr-2\">\n <Href\n className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={`${CONTENT_TYPES_SITE}/${defaultContentType}`}\n >\n <span>{defaultContentType}</span>\n </Href>\n </li>\n )}\n {externalDocs && (\n <li className=\"inline-block mt-2 mr-2\">\n <Href\n className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={externalDocs.url()}\n >\n <span>{EXTERAL_DOCUMENTATION_TEXT}</span>\n </Href>\n </li>\n )}\n {contact && (\n <>\n {contact.url() && (\n <li className=\"inline-block mt-2 mr-2\">\n <Href\n className=\"border border-solid border-purple-300 hover:bg-purple-300 hover:text-purple-600 text-purple-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={contact.url() || ''}\n >\n <span>{contact.name() || URL_SUPPORT_TEXT}</span>\n </Href>\n </li>\n )}\n {contact.email() && (\n <li className=\"inline-block mt-2 mr-2\">\n <Href\n className=\"border border-solid border-purple-300 hover:bg-purple-300 hover:text-purple-600 text-purple-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={`mailto:${contact.email()}`}\n >\n <span>{contact.email()}</span>\n </Href>\n </li>\n )}\n </>\n )}\n {specId && (\n <li className=\"inline-block mt-2 mr-2\">\n <span className=\"border border-solid border-blue-300 hover:bg-blue-300 hover:text-blue-600 text-blue-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\">\n ID: {specId}\n </span>\n </li>\n )}\n </ul>\n )}\n\n {info.hasDescription() && (\n <div className=\"mt-4\">\n <Markdown>{info.description()}</Markdown>\n </div>\n )}\n\n {asyncapi.info().tags().length > 0 && (\n <div className=\"mt-4\">\n <Tags tags={asyncapi.info().tags()} />\n </div>\n )}\n </div>\n\n <div className=\"panel-item--right\" />\n </div>\n );\n};\n"]}
|