@asyncapi/react-component 1.4.9 → 1.4.10
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 +1 -1
- package/browser/standalone/index.js +1 -1
- package/browser/standalone/without-parser.js +1 -1
- package/browser/without-parser.js +1 -1
- package/lib/cjs/components/Bindings.js.map +1 -1
- package/lib/cjs/components/CollapseButton.js +3 -2
- package/lib/cjs/components/CollapseButton.js.map +1 -1
- package/lib/cjs/components/Extensions.js.map +1 -1
- package/lib/cjs/components/Schema.js +31 -34
- package/lib/cjs/components/Schema.js.map +1 -1
- package/lib/cjs/components/Tag.js +2 -1
- package/lib/cjs/components/Tag.js.map +1 -1
- package/lib/cjs/components/Tags.js.map +1 -1
- package/lib/cjs/config/config.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/AsyncApi.js +3 -3
- package/lib/cjs/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Layout.js +5 -4
- package/lib/cjs/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Standalone.js +9 -56
- package/lib/cjs/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/cjs/containers/Error/Error.js +2 -2
- package/lib/cjs/containers/Error/Error.js.map +1 -1
- package/lib/cjs/containers/Info/Info.js +5 -4
- package/lib/cjs/containers/Info/Info.js.map +1 -1
- package/lib/cjs/containers/Messages/Message.js +1 -1
- package/lib/cjs/containers/Messages/Message.js.map +1 -1
- package/lib/cjs/containers/Messages/MessageExample.js +5 -3
- package/lib/cjs/containers/Messages/MessageExample.js.map +1 -1
- package/lib/cjs/containers/Messages/Messages.js +1 -5
- package/lib/cjs/containers/Messages/Messages.js.map +1 -1
- package/lib/cjs/containers/Operations/Operation.js +7 -4
- package/lib/cjs/containers/Operations/Operation.js.map +1 -1
- package/lib/cjs/containers/Operations/Operations.js +1 -3
- package/lib/cjs/containers/Operations/Operations.js.map +1 -1
- package/lib/cjs/containers/Schemas/Schemas.js +1 -5
- package/lib/cjs/containers/Schemas/Schemas.js.map +1 -1
- package/lib/cjs/containers/Servers/Security.js +5 -10
- package/lib/cjs/containers/Servers/Security.js.map +1 -1
- package/lib/cjs/containers/Servers/Server.js.map +1 -1
- package/lib/cjs/containers/Servers/Servers.js +1 -3
- package/lib/cjs/containers/Servers/Servers.js.map +1 -1
- package/lib/cjs/containers/Sidebar/Sidebar.js +15 -18
- package/lib/cjs/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/cjs/contexts/useSpec.js.map +1 -1
- package/lib/cjs/helpers/bindingsHelpers.js.map +1 -1
- package/lib/cjs/helpers/common.js +4 -8
- package/lib/cjs/helpers/common.js.map +1 -1
- package/lib/cjs/helpers/marked.js.map +1 -1
- package/lib/cjs/helpers/message.js +1 -1
- package/lib/cjs/helpers/message.js.map +1 -1
- package/lib/cjs/helpers/parser.js.map +1 -1
- package/lib/cjs/helpers/schema.js +6 -16
- package/lib/cjs/helpers/schema.js.map +1 -1
- package/lib/cjs/helpers/server.js.map +1 -1
- package/lib/cjs/helpers/sidebar.js.map +1 -1
- package/lib/cjs/helpers/specification.js +3 -3
- package/lib/cjs/helpers/specification.js.map +1 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/components/Bindings.js.map +1 -1
- package/lib/esm/components/CollapseButton.js +3 -2
- package/lib/esm/components/CollapseButton.js.map +1 -1
- package/lib/esm/components/Extensions.js.map +1 -1
- package/lib/esm/components/Schema.js +31 -34
- package/lib/esm/components/Schema.js.map +1 -1
- package/lib/esm/components/Tag.js +2 -1
- package/lib/esm/components/Tag.js.map +1 -1
- package/lib/esm/components/Tags.js.map +1 -1
- package/lib/esm/config/config.js.map +1 -1
- package/lib/esm/containers/AsyncApi/AsyncApi.js +3 -3
- package/lib/esm/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Layout.js +5 -4
- package/lib/esm/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Standalone.js +9 -56
- package/lib/esm/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/esm/containers/Error/Error.js +2 -2
- package/lib/esm/containers/Error/Error.js.map +1 -1
- package/lib/esm/containers/Info/Info.js +5 -4
- package/lib/esm/containers/Info/Info.js.map +1 -1
- package/lib/esm/containers/Messages/Message.js +1 -1
- package/lib/esm/containers/Messages/Message.js.map +1 -1
- package/lib/esm/containers/Messages/MessageExample.js +5 -3
- package/lib/esm/containers/Messages/MessageExample.js.map +1 -1
- package/lib/esm/containers/Messages/Messages.js +1 -5
- package/lib/esm/containers/Messages/Messages.js.map +1 -1
- package/lib/esm/containers/Operations/Operation.js +7 -4
- package/lib/esm/containers/Operations/Operation.js.map +1 -1
- package/lib/esm/containers/Operations/Operations.js +1 -3
- package/lib/esm/containers/Operations/Operations.js.map +1 -1
- package/lib/esm/containers/Schemas/Schemas.js +1 -5
- package/lib/esm/containers/Schemas/Schemas.js.map +1 -1
- package/lib/esm/containers/Servers/Security.js +5 -10
- package/lib/esm/containers/Servers/Security.js.map +1 -1
- package/lib/esm/containers/Servers/Server.js.map +1 -1
- package/lib/esm/containers/Servers/Servers.js +1 -3
- package/lib/esm/containers/Servers/Servers.js.map +1 -1
- package/lib/esm/containers/Sidebar/Sidebar.js +15 -18
- package/lib/esm/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/esm/contexts/useSpec.js.map +1 -1
- package/lib/esm/helpers/bindingsHelpers.js.map +1 -1
- package/lib/esm/helpers/common.js +4 -8
- package/lib/esm/helpers/common.js.map +1 -1
- package/lib/esm/helpers/marked.js.map +1 -1
- package/lib/esm/helpers/message.js +1 -1
- package/lib/esm/helpers/message.js.map +1 -1
- package/lib/esm/helpers/parser.js.map +1 -1
- package/lib/esm/helpers/schema.js +6 -16
- package/lib/esm/helpers/schema.js.map +1 -1
- package/lib/esm/helpers/server.js.map +1 -1
- package/lib/esm/helpers/sidebar.js.map +1 -1
- package/lib/esm/helpers/specification.js +3 -3
- package/lib/esm/helpers/specification.js.map +1 -1
- package/lib/esm/types.js.map +1 -1
- package/lib/types/components/Bindings.d.ts.map +1 -1
- package/lib/types/components/Extensions.d.ts.map +1 -1
- package/lib/types/components/Schema.d.ts.map +1 -1
- package/lib/types/config/config.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts +0 -1
- package/lib/types/containers/AsyncApi/AsyncApi.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/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.map +1 -1
- package/lib/types/containers/Operations/Operations.d.ts.map +1 -1
- package/lib/types/containers/Schemas/Schemas.d.ts.map +1 -1
- package/lib/types/containers/Servers/Security.d.ts.map +1 -1
- package/lib/types/containers/Servers/Servers.d.ts.map +1 -1
- package/lib/types/contexts/useSpec.d.ts.map +1 -1
- package/lib/types/helpers/bindingsHelpers.d.ts.map +1 -1
- package/lib/types/helpers/common.d.ts.map +1 -1
- package/lib/types/helpers/marked.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/types/helpers/server.d.ts.map +1 -1
- package/lib/types/helpers/sidebar.d.ts +1 -1
- package/lib/types/helpers/sidebar.d.ts.map +1 -1
- package/lib/types/helpers/specification.d.ts +1 -1
- 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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../../src/components/Bindings.tsx"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../../src/components/Bindings.tsx"],"names":[],"mappings":";;;;;;AACA,gDAA0B;AAC1B,mCAAkC;AAClC,sCAA2C;AAQpC,IAAM,QAAQ,GAAmC,UAAC,EAGxD;QAFC,YAAqC,EAArC,IAAI,mBAAG,8BAA8B,KAAA,EACrC,QAAQ,cAAA;IAER,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;QACnC,OAAO,IAAI,CAAC;KACb;IAED,IAAM,gBAAgB,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAC,OAAO;QAClD,IAAM,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAErC,IAAM,MAAM,GAAG,uBAAa,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACxD,IAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAM,UAAU,GAAG,CACjB,uCAAK,SAAS,EAAC,sBAAsB;YACnC,4CAAO,IAAI,CAAQ;YACnB,wCAAM,SAAS,EAAC,wFAAwF,IACrG,QAAQ,CACJ,CACH,CACP,CAAC;QACF,OAAO,CACL,MAAM,KAAK,SAAS,IAAI,CACtB,8BAAC,eAAM,IACL,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,QAAQ,EACb,SAAS,SACT,CACH,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,8DAAG,gBAAgB,CAAI,CAAC;AACjC,CAAC,CAAC;AAlCW,QAAA,QAAQ,YAkCnB","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React from 'react';\nimport { Schema } from './Schema';\nimport { SchemaHelpers } from '../helpers';\nimport { BindingsInterface } from '@asyncapi/parser';\n\ninterface Props {\n name?: string;\n bindings: BindingsInterface;\n}\n\nexport const Bindings: React.FunctionComponent<Props> = ({\n name = 'Binding specific information',\n bindings,\n}) => {\n if (!bindings || bindings.isEmpty()) {\n return null;\n }\n\n const renderedBindings = bindings.all().map((binding) => {\n const bindingValue = binding.value();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const schema = SchemaHelpers.jsonToSchema(bindingValue);\n const protocol = binding.protocol();\n const schemaName = (\n <div className=\"inline-block text-sm\">\n <span>{name}</span>\n <span className=\"bg-teal-500 font-bold no-underline text-white uppercase rounded mx-2 px-2 py-1 text-xs\">\n {protocol}\n </span>\n </div>\n );\n return (\n schema !== undefined && (\n <Schema\n schemaName={schemaName}\n schema={schema}\n key={protocol}\n onlyTitle\n />\n )\n );\n });\n\n return <>{renderedBindings}</>;\n};\n"]}
|
|
@@ -33,10 +33,11 @@ var HiChevronRight = function (props) {
|
|
|
33
33
|
react_1.default.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" })));
|
|
34
34
|
};
|
|
35
35
|
var CollapseButton = function (_a) {
|
|
36
|
-
var
|
|
36
|
+
var _b;
|
|
37
|
+
var chevronProps = _a.chevronProps, _c = _a.expanded, expanded = _c === void 0 ? false : _c, children = _a.children, rest = __rest(_a, ["chevronProps", "expanded", "children"]);
|
|
37
38
|
return (react_1.default.createElement("button", __assign({}, rest, { className: "focus:outline-none ".concat(rest.className), type: "button" }),
|
|
38
39
|
react_1.default.createElement("div", { className: "inline-block" }, children),
|
|
39
|
-
react_1.default.createElement(HiChevronRight, __assign({}, chevronProps, { className: "inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ".concat(expanded ? '-rotate-90' : '', " ").concat((chevronProps === null || chevronProps === void 0 ? void 0 : chevronProps.className)
|
|
40
|
+
react_1.default.createElement(HiChevronRight, __assign({}, chevronProps, { className: "inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ".concat(expanded ? '-rotate-90' : '', " ").concat((_b = chevronProps === null || chevronProps === void 0 ? void 0 : chevronProps.className) !== null && _b !== void 0 ? _b : '') }))));
|
|
40
41
|
};
|
|
41
42
|
exports.CollapseButton = CollapseButton;
|
|
42
43
|
//# sourceMappingURL=CollapseButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapseButton.js","sourceRoot":"","sources":["../../../src/components/CollapseButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAmE;AAOnE,IAAM,cAAc,GAAG,UAAC,KAAqC;IAArC,sBAAA,EAAA,UAAqC;IAAK,OAAA,CAEhE,gDACE,MAAM,EAAC,cAAc,EACrB,IAAI,EAAC,cAAc,EACnB,WAAW,EAAC,GAAG,EACf,OAAO,EAAC,WAAW,EACnB,MAAM,EAAC,KAAK,EACZ,KAAK,EAAC,KAAK,EACX,KAAK,EAAC,4BAA4B,IAC9B,KAAK;QAET,wCACE,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,oHAAoH,EACtH,QAAQ,EAAC,SAAS,GAClB,CACE,CACP;AAlBiE,CAkBjE,CAAC;AAEK,IAAM,cAAc,GAAmC,UAAC,EAK9D
|
|
1
|
+
{"version":3,"file":"CollapseButton.js","sourceRoot":"","sources":["../../../src/components/CollapseButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAmE;AAOnE,IAAM,cAAc,GAAG,UAAC,KAAqC;IAArC,sBAAA,EAAA,UAAqC;IAAK,OAAA,CAEhE,gDACE,MAAM,EAAC,cAAc,EACrB,IAAI,EAAC,cAAc,EACnB,WAAW,EAAC,GAAG,EACf,OAAO,EAAC,WAAW,EACnB,MAAM,EAAC,KAAK,EACZ,KAAK,EAAC,KAAK,EACX,KAAK,EAAC,4BAA4B,IAC9B,KAAK;QAET,wCACE,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,oHAAoH,EACtH,QAAQ,EAAC,SAAS,GAClB,CACE,CACP;AAlBiE,CAkBjE,CAAC;AAEK,IAAM,cAAc,GAAmC,UAAC,EAK9D;;IAJC,IAAA,YAAY,kBAAA,EACZ,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,QAAQ,cAAA,EACL,IAAI,cAJsD,wCAK9D,CADQ;IACH,OAAA,CACJ,qDACM,IAAI,IACR,SAAS,EAAE,6BAAsB,IAAI,CAAC,SAAS,CAAE,EACjD,IAAI,EAAC,QAAQ;QAEb,uCAAK,SAAS,EAAC,cAAc,IAAE,QAAQ,CAAO;QAC9C,8BAAC,cAAc,eACT,YAAY,IAChB,SAAS,EAAE,kIACT,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,cAC1B,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,mCAAI,EAAE,CAAE,IACnC,CACK,CACV,CAAA;CAAA,CAAC;AAnBW,QAAA,cAAc,kBAmBzB","sourcesContent":["import React, { ButtonHTMLAttributes, SVGAttributes } from 'react';\n\ninterface Props extends ButtonHTMLAttributes<HTMLButtonElement> {\n chevronProps?: SVGAttributes<SVGElement>;\n expanded?: boolean;\n}\n\nconst HiChevronRight = (props: SVGAttributes<SVGElement> = {}) => (\n // Copied from https://icon-sets.iconify.design/heroicons-solid/chevron-right/\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 20 20\"\n height=\"1em\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\nexport const CollapseButton: React.FunctionComponent<Props> = ({\n chevronProps,\n expanded = false,\n children,\n ...rest\n}) => (\n <button\n {...rest}\n className={`focus:outline-none ${rest.className}`}\n type=\"button\"\n >\n <div className=\"inline-block\">{children}</div>\n <HiChevronRight\n {...chevronProps}\n className={`inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ${\n expanded ? '-rotate-90' : ''\n } ${chevronProps?.className ?? ''}`}\n />\n </button>\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extensions.js","sourceRoot":"","sources":["../../../src/components/Extensions.tsx"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"Extensions.js","sourceRoot":"","sources":["../../../src/components/Extensions.tsx"],"names":[],"mappings":";;;;;;AAGA,gDAA0B;AAE1B,mCAAkC;AAElC,sCAA2C;AAQpC,IAAM,UAAU,GAAmC,UAAC,EAG1D;QAFC,YAAmB,EAAnB,IAAI,mBAAG,YAAY,KAAA,EACnB,IAAI,UAAA;IAEJ,IAAM,UAAU,GAAG,uBAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IAED,IAAM,MAAM,GAAG,uBAAa,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAEtD,OAAO,CACL,MAAM,IAAI,CACR,uCAAK,SAAS,EAAC,MAAM;QACnB,8BAAC,eAAM,IAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAG,CAClD,CACP,CACF,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,UAAU,cAkBrB","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport React from 'react';\n\nimport { Schema } from './Schema';\n\nimport { SchemaHelpers } from '../helpers';\n\ninterface Props {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n item: any;\n}\n\nexport const Extensions: React.FunctionComponent<Props> = ({\n name = 'Extensions',\n item,\n}) => {\n const extensions = SchemaHelpers.getCustomExtensions(item);\n if (!extensions || !Object.keys(extensions).length) {\n return null;\n }\n\n const schema = SchemaHelpers.jsonToSchema(extensions);\n\n return (\n schema && (\n <div className=\"mt-2\">\n <Schema schemaName={name} schema={schema} onlyTitle />\n </div>\n )\n );\n};\n"]}
|
|
@@ -32,21 +32,21 @@ var SchemaContext = react_1.default.createContext({
|
|
|
32
32
|
deepExpanded: false,
|
|
33
33
|
});
|
|
34
34
|
var Schema = function (_a) {
|
|
35
|
-
var _b, _c, _d, _e, _f;
|
|
36
|
-
var schemaName = _a.schemaName, schema = _a.schema,
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
35
|
+
var _b, _c, _d, _e, _f, _g;
|
|
36
|
+
var schemaName = _a.schemaName, schema = _a.schema, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.isPatternProperty, isPatternProperty = _j === void 0 ? false : _j, _k = _a.isProperty, isProperty = _k === void 0 ? false : _k, _l = _a.isCircular, isCircular = _l === void 0 ? false : _l, dependentRequired = _a.dependentRequired, _m = _a.expanded, propExpanded = _m === void 0 ? false : _m, _o = _a.onlyTitle, onlyTitle = _o === void 0 ? false : _o, _p = _a.isArray, isArray = _p === void 0 ? false : _p;
|
|
37
|
+
var _q = (0, react_1.useContext)(SchemaContext), reverse = _q.reverse, deepExpanded = _q.deepExpanded;
|
|
38
|
+
var _r = (0, react_1.useState)(propExpanded || isArray), expanded = _r[0], setExpanded = _r[1];
|
|
39
|
+
var _s = (0, react_1.useState)(false), deepExpand = _s[0], setDeepExpand = _s[1];
|
|
40
40
|
(0, react_1.useEffect)(function () {
|
|
41
41
|
if (!isArray) {
|
|
42
42
|
setDeepExpand(deepExpanded);
|
|
43
43
|
}
|
|
44
|
-
}, [deepExpanded, setDeepExpand]);
|
|
44
|
+
}, [isArray, deepExpanded, setDeepExpand]);
|
|
45
45
|
(0, react_1.useEffect)(function () {
|
|
46
46
|
if (!isArray) {
|
|
47
47
|
setExpanded(deepExpand);
|
|
48
48
|
}
|
|
49
|
-
}, [deepExpand, setExpanded]);
|
|
49
|
+
}, [isArray, deepExpand, setExpanded]);
|
|
50
50
|
if (!schema ||
|
|
51
51
|
(typeof schemaName === 'string' &&
|
|
52
52
|
((schemaName === null || schemaName === void 0 ? void 0 : schemaName.startsWith('x-parser-')) ||
|
|
@@ -123,24 +123,21 @@ var Schema = function (_a) {
|
|
|
123
123
|
' ',
|
|
124
124
|
react_1.default.createElement("span", { className: "border text-orange-600 rounded mr-2 p-1 text-xs" }, parameterLocation))),
|
|
125
125
|
externalDocs && (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-2 py-0" },
|
|
126
|
-
react_1.default.createElement(index_1.Href, { href: externalDocs.url(), title: externalDocs.description()
|
|
126
|
+
react_1.default.createElement(index_1.Href, { href: externalDocs.url(), title: (_c = externalDocs.description()) !== null && _c !== void 0 ? _c : '' }, "Documentation"))),
|
|
127
127
|
schema.examples() && (react_1.default.createElement("ul", { className: "text-xs" },
|
|
128
128
|
"Examples values:",
|
|
129
|
-
' ', (
|
|
130
|
-
|
|
129
|
+
' ', (_d = schema.examples()) === null || _d === void 0 ? void 0 :
|
|
130
|
+
_d.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" },
|
|
131
131
|
react_1.default.createElement("span", null, helpers_1.SchemaHelpers.prettifyValue(e)))); }))))))),
|
|
132
132
|
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') },
|
|
133
|
-
react_1.default.createElement(SchemaProperties, { schema: schema
|
|
134
|
-
react_1.default.createElement(SchemaItems, { schema: schema }),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
schema.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
schema.allOf() &&
|
|
142
|
-
((_f = schema
|
|
143
|
-
.allOf()) === null || _f === void 0 ? void 0 : _f.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: helpers_1.SchemaHelpers.applicatorSchemaName(idx, 'Consists of', 'And of', s.title()) })); })),
|
|
133
|
+
react_1.default.createElement(SchemaProperties, { schema: schema }),
|
|
134
|
+
react_1.default.createElement(SchemaItems, { schema: schema }), (_e = schema
|
|
135
|
+
.oneOf()) === null || _e === void 0 ? void 0 :
|
|
136
|
+
_e.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: helpers_1.SchemaHelpers.applicatorSchemaName(idx, 'Adheres to', 'Or to', s.title()) })); }), (_f = schema
|
|
137
|
+
.anyOf()) === null || _f === void 0 ? void 0 :
|
|
138
|
+
_f.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: helpers_1.SchemaHelpers.applicatorSchemaName(idx, 'Can adhere to', 'Or to', s.title()) })); }), (_g = schema
|
|
139
|
+
.allOf()) === null || _g === void 0 ? void 0 :
|
|
140
|
+
_g.map(function (s, idx) { return (react_1.default.createElement(exports.Schema, { key: idx, schema: s, schemaName: helpers_1.SchemaHelpers.applicatorSchemaName(idx, 'Consists of', 'And of', s.title()) })); }),
|
|
144
141
|
schema.not() && (react_1.default.createElement(exports.Schema, { schema: schema.not(), schemaName: "Cannot adhere to:" })),
|
|
145
142
|
schema.propertyNames() && (react_1.default.createElement(exports.Schema, { schema: schema.propertyNames(), schemaName: "Property names must adhere to:" })),
|
|
146
143
|
schema.contains() && (react_1.default.createElement(exports.Schema, { schema: schema.contains(), schemaName: "Array must contain at least one of:" })),
|
|
@@ -154,19 +151,20 @@ var Schema = function (_a) {
|
|
|
154
151
|
};
|
|
155
152
|
exports.Schema = Schema;
|
|
156
153
|
var SchemaProperties = function (_a) {
|
|
157
|
-
var
|
|
154
|
+
var _b;
|
|
155
|
+
var schema = _a.schema;
|
|
158
156
|
var properties = schema.properties();
|
|
159
157
|
if (properties === undefined || !Object.keys(properties)) {
|
|
160
158
|
return null;
|
|
161
159
|
}
|
|
162
|
-
var required = schema.required()
|
|
160
|
+
var required = (_b = schema.required()) !== null && _b !== void 0 ? _b : [];
|
|
163
161
|
var patternProperties = schema.patternProperties();
|
|
164
162
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
165
163
|
Object.entries(properties).map(function (_a) {
|
|
166
164
|
var propertyName = _a[0], property = _a[1];
|
|
167
165
|
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 }));
|
|
168
166
|
}),
|
|
169
|
-
Object.entries(patternProperties
|
|
167
|
+
Object.entries(patternProperties !== null && patternProperties !== void 0 ? patternProperties : {}).map(function (_a) {
|
|
170
168
|
var propertyName = _a[0], property = _a[1];
|
|
171
169
|
return (react_1.default.createElement(exports.Schema, { schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular(), key: propertyName }));
|
|
172
170
|
})));
|
|
@@ -174,13 +172,12 @@ var SchemaProperties = function (_a) {
|
|
|
174
172
|
var AdditionalProperties = function (_a) {
|
|
175
173
|
var _b;
|
|
176
174
|
var schema = _a.schema;
|
|
177
|
-
if (((_b = schema
|
|
178
|
-
|
|
179
|
-
.get(helpers_1.SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) {
|
|
175
|
+
if (((_b = schema.extensions().get(helpers_1.SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) ===
|
|
176
|
+
false) {
|
|
180
177
|
return null;
|
|
181
178
|
}
|
|
182
179
|
var type = schema.type();
|
|
183
|
-
if (type ===
|
|
180
|
+
if (!(type === null || type === void 0 ? void 0 : type.includes('object'))) {
|
|
184
181
|
return null;
|
|
185
182
|
}
|
|
186
183
|
var additionalProperties = schema.additionalProperties();
|
|
@@ -196,15 +193,16 @@ var AdditionalProperties = function (_a) {
|
|
|
196
193
|
return (react_1.default.createElement(exports.Schema, { schemaName: "Additional properties:", schema: additionalProperties }));
|
|
197
194
|
};
|
|
198
195
|
var SchemaItems = function (_a) {
|
|
196
|
+
var _b;
|
|
199
197
|
var schema = _a.schema;
|
|
200
198
|
var type = schema.type();
|
|
201
|
-
if (type ===
|
|
199
|
+
if (!(type === null || type === void 0 ? void 0 : type.includes('array'))) {
|
|
202
200
|
return null;
|
|
203
201
|
}
|
|
204
202
|
var items = schema.items();
|
|
205
203
|
if (items &&
|
|
206
204
|
!Array.isArray(items) &&
|
|
207
|
-
Object.keys(items.properties()
|
|
205
|
+
Object.keys((_b = items.properties()) !== null && _b !== void 0 ? _b : {}).length) {
|
|
208
206
|
return react_1.default.createElement(exports.Schema, { schema: items, isArray: true });
|
|
209
207
|
}
|
|
210
208
|
else if (Array.isArray(items)) {
|
|
@@ -215,13 +213,12 @@ var SchemaItems = function (_a) {
|
|
|
215
213
|
var AdditionalItems = function (_a) {
|
|
216
214
|
var _b;
|
|
217
215
|
var schema = _a.schema;
|
|
218
|
-
if (((_b = schema
|
|
219
|
-
|
|
220
|
-
.get(helpers_1.SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) {
|
|
216
|
+
if (((_b = schema.extensions().get(helpers_1.SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) ===
|
|
217
|
+
false) {
|
|
221
218
|
return null;
|
|
222
219
|
}
|
|
223
220
|
var type = schema.type();
|
|
224
|
-
if (type ===
|
|
221
|
+
if (!(type === null || type === void 0 ? void 0 : type.includes('array'))) {
|
|
225
222
|
return null;
|
|
226
223
|
}
|
|
227
224
|
if (!Array.isArray(schema.items())) {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QAAQ,GAAG,CAAC;AACtE,CAAC,CAAC;AAMF,IAAM,eAAe,GAAkD,UAAC,EAEvE;;QADC,MAAM,YAAA;IAEN,IACE,CAAA,MAAA,MAAM;SACH,UAAU,EAAE;SACZ,GAAG,CAAC,uBAAa,CAAC,uBAAuB,CAAC,0CACzC,KAAK,EAAE,MAAK,KAAK,EACrB;QACA,OAAO,IAAI,CAAC;KACb;IAED,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjD,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 { 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 isArray?: 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 isArray = false,\n}) => {\n const { reverse, deepExpanded } = useContext(SchemaContext);\n const [expanded, setExpanded] = useState(propExpanded || isArray);\n const [deepExpand, setDeepExpand] = useState(false);\n\n useEffect(() => {\n if (!isArray) {\n setDeepExpand(deepExpanded);\n }\n }, [deepExpanded, setDeepExpand]);\n\n useEffect(() => {\n if (!isArray) {\n setExpanded(deepExpand);\n }\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-anywhere 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 && !isArray ? (\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-anywhere text-sm ${\n isProperty ? 'italic' : ''\n }`}\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} isArray={isArray} />\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={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Adheres to',\n 'Or to',\n s.title(),\n )}\n />\n ))}\n {schema.anyOf() &&\n schema\n .anyOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Can adhere to',\n 'Or to',\n s.title(),\n )}\n />\n ))}\n {schema.allOf() &&\n schema\n .allOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Consists of',\n 'And of',\n s.title(),\n )}\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 isArray: boolean;\n}\n\nconst SchemaProperties: React.FunctionComponent<SchemaPropertiesProps> = ({\n schema,\n isArray,\n}) => {\n const properties = schema.properties();\n if (properties === undefined || !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 <Schema schema={items} isArray={true} />;\n } else if (Array.isArray(items)) {\n return (\n <>\n {items.map((item, idx) => (\n <Schema\n schema={item}\n isArray={true}\n schemaName={`${idx + 1} item:`}\n key={idx}\n />\n ))}\n </>\n );\n }\n return <Schema schema={items} isArray={true} 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
|
+
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+D;AAG/D,iCAAqE;AACrE,sCAA2C;AAe3C,IAAM,aAAa,GAAG,eAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;CACpB,CAAC,CAAC;AAEI,IAAM,MAAM,GAAmC,UAAC,EAYtD;;QAXC,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,yBAAyB,EAAzB,iBAAiB,mBAAG,KAAK,KAAA,EACzB,kBAAkB,EAAlB,UAAU,mBAAG,KA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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;IAED,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 isArray?: 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 isArray = false,\n // eslint-disable-next-line sonarjs/cognitive-complexity\n}) => {\n const { reverse, deepExpanded } = useContext(SchemaContext);\n const [expanded, setExpanded] = useState(propExpanded || isArray);\n const [deepExpand, setDeepExpand] = useState(false);\n\n useEffect(() => {\n if (!isArray) {\n setDeepExpand(deepExpanded);\n }\n }, [isArray, deepExpanded, setDeepExpand]);\n\n useEffect(() => {\n if (!isArray) {\n setExpanded(deepExpand);\n }\n }, [isArray, 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-anywhere 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 && !isArray ? (\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-anywhere text-sm ${\n isProperty ? 'italic' : ''\n }`}\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\n .oneOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Adheres to',\n 'Or to',\n s.title(),\n )}\n />\n ))}\n {schema\n .anyOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Can adhere to',\n 'Or to',\n s.title(),\n )}\n />\n ))}\n {schema\n .allOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Consists of',\n 'And of',\n s.title(),\n )}\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 (properties === undefined || !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\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\n isProperty\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<\n AdditionalPropertiesProps\n> = ({ schema }) => {\n if (\n schema.extensions().get(SchemaHelpers.extRenderAdditionalInfo)?.value() ===\n false\n ) {\n return null;\n }\n\n const type = schema.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: SchemaInterface;\n}\n\nconst SchemaItems: React.FunctionComponent<SchemaItemsProps> = ({ schema }) => {\n const type = schema.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 <Schema schema={items} isArray />;\n } else if (Array.isArray(items)) {\n return (\n <>\n {items.map((item, idx) => (\n <Schema\n schema={item}\n isArray\n schemaName={`${idx + 1} item:`}\n key={idx}\n />\n ))}\n </>\n );\n }\n return <Schema schema={items} isArray schemaName=\"Items:\" />;\n};\n\ninterface AdditionalItemsProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalItems: React.FunctionComponent<AdditionalItemsProps> = ({\n schema,\n}) => {\n if (\n schema.extensions().get(SchemaHelpers.extRenderAdditionalInfo)?.value() ===\n false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (!type?.includes('array')) {\n return null;\n }\n if (!Array.isArray(schema.items())) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n return <Schema schemaName=\"Additional items:\" schema={additionalItems} />;\n};\n"]}
|
|
@@ -7,9 +7,10 @@ exports.Tag = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var Href_1 = require("./Href");
|
|
9
9
|
var Tag = function (_a) {
|
|
10
|
+
var _b;
|
|
10
11
|
var tag = _a.tag;
|
|
11
12
|
var name = "#".concat(tag.name());
|
|
12
|
-
var description = tag.description()
|
|
13
|
+
var description = (_b = tag.description()) !== null && _b !== void 0 ? _b : '';
|
|
13
14
|
var externalDocs = tag.externalDocs();
|
|
14
15
|
var element = (react_1.default.createElement("div", { title: description, 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" },
|
|
15
16
|
react_1.default.createElement("span", { className: externalDocs ? 'underline' : '' }, name)));
|
|
@@ -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
|
|
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,MAAA,GAAG,CAAC,WAAW,EAAE,mCAAI,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,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,sCAAI,SAAS,EAAC,+BAA+B,IAC1C,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,
|
|
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,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,sCAAI,SAAS,EAAC,+BAA+B,IAC1C,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,CACvB,sCAAI,SAAS,EAAC,wBAAwB,EAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;QACpD,8BAAC,SAAG,IAAC,GAAG,EAAE,GAAG,GAAI,CACd,CACN,EAJwB,CAIxB,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,IAAI,QAcf","sourcesContent":["import React from 'react';\nimport { TagsInterface } from '@asyncapi/parser';\n\nimport { Tag } from './Tag';\n\ninterface Props {\n tags?: TagsInterface;\n}\n\nexport const Tags: React.FunctionComponent<Props> = ({ tags }) => {\n if (!tags?.length) {\n return null;\n }\n\n return (\n <ul className=\"flex flex-wrap leading-normal\">\n {tags.all().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":"config.js","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConfigInterface {\n schemaID?: string;\n show?: ShowConfig;\n expand?: ExpandConfig;\n sidebar?: SideBarConfig;\n parserOptions?: any;\n publishLabel?: string;\n subscribeLabel?: string;\n sendLabel?: string;\n receiveLabel?: string;\n requestLabel?: string;\n replyLabel?: string;\n}\n\nexport interface ShowConfig {\n sidebar?: boolean;\n info?: boolean;\n servers?: boolean;\n operations?: boolean;\n messages?: boolean;\n schemas?: boolean;\n errors?: boolean;\n}\n\nexport interface ExpandConfig {\n messageExamples?: boolean;\n}\n\nexport interface SideBarConfig {\n showServers?: 'byDefault' | 'bySpecTags' | 'byServersTags';\n showOperations?: 'byDefault' | 'bySpecTags' | 'byOperationsTags';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConfigInterface {\n schemaID?: string;\n show?: ShowConfig;\n expand?: ExpandConfig;\n sidebar?: SideBarConfig;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parserOptions?: any;\n publishLabel?: string;\n subscribeLabel?: string;\n sendLabel?: string;\n receiveLabel?: string;\n requestLabel?: string;\n replyLabel?: string;\n}\n\nexport interface ShowConfig {\n sidebar?: boolean;\n info?: boolean;\n servers?: boolean;\n operations?: boolean;\n messages?: boolean;\n schemas?: boolean;\n errors?: boolean;\n}\n\nexport interface ExpandConfig {\n messageExamples?: boolean;\n}\n\nexport interface SideBarConfig {\n showServers?: 'byDefault' | 'bySpecTags' | 'byServersTags';\n showOperations?: 'byDefault' | 'bySpecTags' | 'byOperationsTags';\n}\n"]}
|
|
@@ -83,8 +83,8 @@ var types_1 = require("../../types");
|
|
|
83
83
|
var helpers_1 = require("../../helpers");
|
|
84
84
|
var AsyncApiComponent = (function (_super) {
|
|
85
85
|
__extends(AsyncApiComponent, _super);
|
|
86
|
-
function AsyncApiComponent(
|
|
87
|
-
var _this = _super.
|
|
86
|
+
function AsyncApiComponent() {
|
|
87
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
88
88
|
_this.state = {
|
|
89
89
|
asyncapi: undefined,
|
|
90
90
|
error: undefined,
|
|
@@ -130,7 +130,7 @@ var AsyncApiComponent = (function (_super) {
|
|
|
130
130
|
AsyncApiComponent.prototype.render = function () {
|
|
131
131
|
var _a = this.props, schema = _a.schema, config = _a.config;
|
|
132
132
|
var _b = this.state, asyncapi = _b.asyncapi, error = _b.error;
|
|
133
|
-
return (react_1.default.createElement(Standalone_1.default, { schema: asyncapi
|
|
133
|
+
return (react_1.default.createElement(Standalone_1.default, { schema: asyncapi !== null && asyncapi !== void 0 ? asyncapi : schema, config: config, error: error }));
|
|
134
134
|
};
|
|
135
135
|
AsyncApiComponent.prototype.parseSchema = function (schema, parserOptions) {
|
|
136
136
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IAAvE;QAAA,qEA6DC;QA5DC,WAAK,GAAkB;YACrB,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,SAAS;SACjB,CAAC;;IAyDJ,CAAC;IAvDO,6CAAiB,GAAvB;;;;;;6BACM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAjB,cAAiB;wBACb,KAAqB,IAAI,CAAC,KAAK,EAA7B,MAAM,YAAA,EAAE,MAAM,YAAA,CAAgB;wBACtC,WAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,M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BACZ,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,AA7DD,CAAgC,iBAAS,GA6DxC;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 async componentDidMount() {\n if (this.props.schema) {\n const { schema, config } = this.props;\n await this.parseSchema(schema, 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 await this.parseSchema(newSchema, 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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"]}
|
|
@@ -37,8 +37,9 @@ var Schemas_1 = require("../Schemas/Schemas");
|
|
|
37
37
|
var Error_1 = require("../Error/Error");
|
|
38
38
|
var contexts_1 = require("../../contexts");
|
|
39
39
|
var AsyncApiLayout = function (_a) {
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var _b, _c;
|
|
41
|
+
var asyncapi = _a.asyncapi, config = _a.config, _d = _a.error, error = _d === void 0 ? null : _d;
|
|
42
|
+
var _e = (0, react_1.useState)('container:xl'), observerClassName = _e[0], setObserverClassName = _e[1];
|
|
42
43
|
var ref = (0, use_resize_observer_1.default)({
|
|
43
44
|
onResize: function (_a) {
|
|
44
45
|
var width = _a.width;
|
|
@@ -53,11 +54,11 @@ var AsyncApiLayout = function (_a) {
|
|
|
53
54
|
});
|
|
54
55
|
},
|
|
55
56
|
}).ref;
|
|
56
|
-
var configShow = config.show
|
|
57
|
+
var configShow = (_b = config.show) !== null && _b !== void 0 ? _b : {};
|
|
57
58
|
return (react_1.default.createElement(contexts_1.ConfigContext.Provider, { value: config },
|
|
58
59
|
react_1.default.createElement(contexts_1.SpecificationContext.Provider, { value: asyncapi },
|
|
59
60
|
react_1.default.createElement("section", { className: "aui-root" },
|
|
60
|
-
react_1.default.createElement("div", { className: "".concat(observerClassName, " relative md:flex bg-white leading-normal"), id: config.schemaID
|
|
61
|
+
react_1.default.createElement("div", { className: "".concat(observerClassName, " relative md:flex bg-white leading-normal"), id: (_c = config.schemaID) !== null && _c !== void 0 ? _c : undefined, ref: ref },
|
|
61
62
|
configShow.sidebar && react_1.default.createElement(Sidebar_1.Sidebar, null),
|
|
62
63
|
react_1.default.createElement("div", { className: "panel--center relative py-8 flex-1" },
|
|
63
64
|
react_1.default.createElement("div", { className: "relative z-10" },
|
|
@@ -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
|
|
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;gBA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port { 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"]}
|
|
@@ -48,42 +48,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
48
48
|
__setModuleDefault(result, mod);
|
|
49
49
|
return result;
|
|
50
50
|
};
|
|
51
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
52
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
53
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
54
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
55
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
56
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
57
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
61
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
62
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
63
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
64
|
-
function step(op) {
|
|
65
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
66
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
67
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
68
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
69
|
-
switch (op[0]) {
|
|
70
|
-
case 0: case 1: t = op; break;
|
|
71
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
72
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
73
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
74
|
-
default:
|
|
75
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
76
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
77
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
78
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
79
|
-
if (t[2]) _.ops.pop();
|
|
80
|
-
_.trys.pop(); continue;
|
|
81
|
-
}
|
|
82
|
-
op = body.call(thisArg, _);
|
|
83
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
84
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
51
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
88
52
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
89
53
|
};
|
|
@@ -108,33 +72,22 @@ var AsyncApiComponent = (function (_super) {
|
|
|
108
72
|
return _this;
|
|
109
73
|
}
|
|
110
74
|
AsyncApiComponent.prototype.componentDidMount = function () {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.updateState(this.props.schema);
|
|
115
|
-
}
|
|
116
|
-
return [2];
|
|
117
|
-
});
|
|
118
|
-
});
|
|
75
|
+
if (!this.state.asyncapi) {
|
|
76
|
+
this.updateState(this.props.schema);
|
|
77
|
+
}
|
|
119
78
|
};
|
|
120
79
|
AsyncApiComponent.prototype.componentDidUpdate = function (prevProps) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (oldSchema !== newSchema) {
|
|
127
|
-
this.updateState(newSchema);
|
|
128
|
-
}
|
|
129
|
-
return [2];
|
|
130
|
-
});
|
|
131
|
-
});
|
|
80
|
+
var oldSchema = prevProps.schema;
|
|
81
|
+
var newSchema = this.props.schema;
|
|
82
|
+
if (oldSchema !== newSchema) {
|
|
83
|
+
this.updateState(newSchema);
|
|
84
|
+
}
|
|
132
85
|
};
|
|
133
86
|
AsyncApiComponent.prototype.render = function () {
|
|
134
87
|
var _a;
|
|
135
88
|
var _b = this.props, config = _b.config, propError = _b.error;
|
|
136
89
|
var _c = this.state, asyncapi = _c.asyncapi, stateError = _c.error;
|
|
137
|
-
var error = propError
|
|
90
|
+
var error = propError !== null && propError !== void 0 ? propError : stateError;
|
|
138
91
|
var concatenatedConfig = __assign(__assign(__assign({}, config_1.defaultConfig), config), { show: __assign(__assign({}, config_1.defaultConfig.show), (!!config && config.show)), expand: __assign(__assign({}, config_1.defaultConfig.expand), (!!config && config.expand)), sidebar: __assign(__assign({}, config_1.defaultConfig.sidebar), (!!config && config.sidebar)) });
|
|
139
92
|
if (!asyncapi) {
|
|
140
93
|
if (!error) {
|