@asyncapi/react-component 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +1 -1
- package/browser/standalone/index.js +3 -3
- package/browser/standalone/without-parser.js +1 -1
- package/browser/without-parser.js +1 -1
- package/lib/cjs/components/Schema.js +9 -9
- package/lib/cjs/components/Schema.js.map +1 -1
- package/lib/cjs/containers/Operations/Operation.js +7 -10
- package/lib/cjs/containers/Operations/Operation.js.map +1 -1
- package/lib/cjs/containers/Operations/ServersList.js +21 -0
- package/lib/cjs/containers/Operations/ServersList.js.map +1 -0
- package/lib/esm/components/Schema.js +9 -9
- package/lib/esm/components/Schema.js.map +1 -1
- package/lib/esm/containers/Operations/Operation.js +7 -10
- package/lib/esm/containers/Operations/Operation.js.map +1 -1
- package/lib/esm/containers/Operations/ServersList.js +14 -0
- package/lib/esm/containers/Operations/ServersList.js.map +1 -0
- package/lib/types/containers/Operations/Operation.d.ts.map +1 -1
- package/lib/types/containers/Operations/ServersList.d.ts +11 -0
- package/lib/types/containers/Operations/ServersList.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -160,22 +160,22 @@ var Schema = function (_a) {
|
|
|
160
160
|
};
|
|
161
161
|
exports.Schema = Schema;
|
|
162
162
|
var SchemaProperties = function (_a) {
|
|
163
|
-
var _b;
|
|
163
|
+
var _b, _c, _d;
|
|
164
164
|
var schema = _a.schema;
|
|
165
|
-
var properties = schema.properties();
|
|
166
|
-
|
|
165
|
+
var properties = Object.entries((_b = schema.properties()) !== null && _b !== void 0 ? _b : {});
|
|
166
|
+
var patternProperties = Object.entries((_c = schema.patternProperties()) !== null && _c !== void 0 ? _c : {});
|
|
167
|
+
if (!properties.length && !patternProperties.length) {
|
|
167
168
|
return null;
|
|
168
169
|
}
|
|
169
|
-
var required = (
|
|
170
|
-
var patternProperties = schema.patternProperties();
|
|
170
|
+
var required = (_d = schema.required()) !== null && _d !== void 0 ? _d : [];
|
|
171
171
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
172
|
-
|
|
172
|
+
properties.map(function (_a) {
|
|
173
173
|
var propertyName = _a[0], property = _a[1];
|
|
174
|
-
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)
|
|
174
|
+
return (react_1.default.createElement(exports.Schema, { key: propertyName, schema: property, schemaName: propertyName, required: required.includes(propertyName), isProperty: true, isCircular: property.isCircular(), dependentRequired: helpers_1.SchemaHelpers.getDependentRequired(propertyName, schema) }));
|
|
175
175
|
}),
|
|
176
|
-
|
|
176
|
+
patternProperties.map(function (_a) {
|
|
177
177
|
var propertyName = _a[0], property = _a[1];
|
|
178
|
-
return (react_1.default.createElement(exports.Schema, { schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular()
|
|
178
|
+
return (react_1.default.createElement(exports.Schema, { key: propertyName, schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular() }));
|
|
179
179
|
})));
|
|
180
180
|
};
|
|
181
181
|
var AdditionalProperties = function (_a) {
|
|
@@ -1 +1 @@
|
|
|
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,E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AAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAGD,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;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 <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </strong>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </strong>\n )}\n {schema.contentMediaType() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </strong>\n )}\n {schema.contentEncoding() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </strong>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map((c) => (\n <strong\n className=\"bg-purple-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </strong>\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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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 <strong className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 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 </strong>\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=\"inline-block bg-orange-600 text-white 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() ?? s.id(),\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() ?? s.id(),\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() ?? s.id(),\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"]}
|
|
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,KAAK,KAAA,EAClB,kBAAkB,EAAlB,UAAU,mBAAG,KAAK,KAAA,EAClB,iBAAiB,uBAAA,EACjB,gBAA8B,EAApB,YAAY,mBAAG,KAAK,KAAA,EAC9B,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA;IAGT,IAAA,KAA4B,IAAA,kBAAU,EAAC,aAAa,CAAC,EAAnD,OAAO,aAAA,EAAE,YAAY,kBAA8B,CAAC;IACtD,IAAA,KAA0B,IAAA,gBAAQ,EAAC,YAAY,IAAI,OAAO,CAAC,EAA1D,QAA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AC,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 <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </strong>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </strong>\n )}\n {schema.contentMediaType() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </strong>\n )}\n {schema.contentEncoding() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </strong>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map((c) => (\n <strong\n className=\"bg-purple-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </strong>\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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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 <strong className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 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 </strong>\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=\"inline-block bg-orange-600 text-white 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() ?? s.id(),\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() ?? s.id(),\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() ?? s.id(),\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 = Object.entries(schema.properties() ?? {});\n const patternProperties = Object.entries(schema.patternProperties() ?? {});\n\n if (!properties.length && !patternProperties.length) {\n return null;\n }\n\n const required = schema.required() ?? [];\n\n return (\n <>\n {properties.map(([propertyName, property]) => (\n <Schema\n key={propertyName}\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 />\n ))}\n\n {patternProperties.map(([propertyName, property]) => (\n <Schema\n key={propertyName}\n schema={property}\n schemaName={propertyName}\n isPatternProperty\n isProperty\n isCircular={property.isCircular()}\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"]}
|
|
@@ -45,8 +45,13 @@ var helpers_1 = require("../../helpers");
|
|
|
45
45
|
var constants_1 = require("../../constants");
|
|
46
46
|
var types_1 = require("../../types");
|
|
47
47
|
var pluginManager_1 = require("../../helpers/pluginManager");
|
|
48
|
+
var ServersList_1 = require("./ServersList");
|
|
48
49
|
var PluginSlotRenderer_1 = require("../../components/PluginSlotRenderer");
|
|
49
50
|
var usePlugin_1 = require("../../contexts/usePlugin");
|
|
51
|
+
var location = globalThis.location;
|
|
52
|
+
var relativePathname = location
|
|
53
|
+
? "".concat(location.pathname).concat(location.search)
|
|
54
|
+
: '';
|
|
50
55
|
var Operation = function (props) {
|
|
51
56
|
var _a = props.type, type = _a === void 0 ? types_1.PayloadType.SEND : _a, operation = props.operation, channelName = props.channelName, channel = props.channel;
|
|
52
57
|
var config = (0, contexts_1.useConfig)();
|
|
@@ -61,11 +66,7 @@ var Operation = function (props) {
|
|
|
61
66
|
return (react_1.default.createElement("div", null,
|
|
62
67
|
react_1.default.createElement("div", { className: "panel-item--center px-8" },
|
|
63
68
|
react_1.default.createElement(exports.OperationInfo, __assign({}, props)),
|
|
64
|
-
|
|
65
|
-
react_1.default.createElement("p", null, "Available only on servers:"),
|
|
66
|
-
react_1.default.createElement("ul", { className: "flex flex-wrap leading-normal" }, servers.map(function (server) { return (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2", key: server.id() },
|
|
67
|
-
react_1.default.createElement("a", { href: "".concat(window.location.pathname, "#").concat(helpers_1.CommonHelpers.getIdentifier('server-' + server.id(), config)), 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 cursor-pointer" },
|
|
68
|
-
react_1.default.createElement("span", { className: "underline" }, server.id())))); })))) : null,
|
|
69
|
+
react_1.default.createElement(ServersList_1.ServersList, { servers: servers || [], config: config, relativePathname: relativePathname }),
|
|
69
70
|
parameters && (react_1.default.createElement("div", { className: "mt-2", id: helpers_1.CommonHelpers.getIdentifier("operation-".concat(type, "-").concat(channelName, "-parameters"), config) },
|
|
70
71
|
react_1.default.createElement(components_1.Schema, { schemaName: "Parameters", schema: parameters, expanded: true }))),
|
|
71
72
|
security && (react_1.default.createElement("div", { className: "mt-2", id: helpers_1.CommonHelpers.getIdentifier("operation-".concat(type, "-").concat(channelName, "-security"), config) },
|
|
@@ -211,11 +212,7 @@ var OperationReplyChannelInfo = function (_a) {
|
|
|
211
212
|
react_1.default.createElement("span", { className: "border text-orange-600 rounded text-xs py-0 px-2" }, channel.address()))),
|
|
212
213
|
channel.hasDescription() && (react_1.default.createElement("div", { className: "mt-2" },
|
|
213
214
|
react_1.default.createElement(components_1.Markdown, null, channel.description()))),
|
|
214
|
-
|
|
215
|
-
react_1.default.createElement("p", null, "Available only on servers:"),
|
|
216
|
-
react_1.default.createElement("ul", { className: "flex flex-wrap leading-normal" }, servers.map(function (server) { return (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2", key: server.id() },
|
|
217
|
-
react_1.default.createElement("a", { href: "".concat(window.location.pathname, "#").concat(helpers_1.CommonHelpers.getIdentifier('server-' + server.id(), config)), 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 cursor-pointer" },
|
|
218
|
-
react_1.default.createElement("span", { className: "underline" }, server.id())))); })))) : null,
|
|
215
|
+
react_1.default.createElement(ServersList_1.ServersList, { servers: servers || [], config: config, relativePathname: relativePathname }),
|
|
219
216
|
channel.messages().all().length > 1 ? (react_1.default.createElement("div", { className: "mt-2" },
|
|
220
217
|
react_1.default.createElement("span", { className: "text-xs text-gray-700" }, "Messages:"),
|
|
221
218
|
react_1.default.createElement("ul", null, channel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../../src/containers/Operations/Operation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAExC,+CAA8C;AAC9C,gDAA+C;AAC/C,+CAO0B;AAC1B,8CAA6C;AAC7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DAAK,CAAC;KACd;IACD,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;IAChC,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAA,EAAE;QACnB,OAAO,6DAAK,CAAC;KACd;IACD,IAAM,YAAY,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IAErC,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,6DAAK,CAAC;KACd;IAED,IAAM,oBAAoB,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IAErD,OAAO,CACL,uCAAK,SAAS,EAAC,MAAM;QACnB,uCACE,SAAS,EAAE,mBACT,IAAI,KAAK,mBAAW,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,UACtD,GACP;QACF,uCAAK,SAAS,EAAC,KAAK;YAClB,sCAAI,SAAS,EAAC,SAAS;gBACrB,wCAAM,SAAS,EAAC,gBAAgB,EAAC,KAAK,EAAE,IAAI,gCAErC,CACJ;YACJ,oBAAoB,IAAI,CACvB,uCAAK,SAAS,EAAC,uBAAuB;;gBAEpC,wCAAM,SAAS,EAAC,uDAAuD,IACpE,oBAAoB,CAChB,CACH,CACP;YACA,YAAY,CAAC,cAAc,EAAE,IAAI,CAChC,uCAAK,SAAS,EAAC,MAAM;gBACnB,8BAAC,qBAAQ,QAAE,YAAY,CAAC,WAAW,EAAE,CAAY,CAC7C,CACP;YACD,8BAAC,uBAAU,IAAC,IAAI,EAAC,oCAAoC,EAAC,IAAI,EAAE,KAAK,GAAI,CACjE,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,yBAAyB,6BAiDpC","sourcesContent":["import React, { useState } from 'react';\nimport { ChannelInterface, OperationInterface } from '@asyncapi/parser';\nimport { Message } from '../Messages/Message';\nimport { Security } from '../Servers/Security';\nimport {\n Markdown,\n Schema,\n Bindings,\n Tags,\n Extensions,\n CollapseButton,\n} from '../../components';\nimport { Href } from '../../components/Href';\nimport { useConfig, useSpec } from '../../contexts';\nimport { CommonHelpers, SchemaHelpers } from '../../helpers';\nimport { EXTERAL_DOCUMENTATION_TEXT } from '../../constants';\nimport { PayloadType, PluginSlot } from '../../types';\nimport { PluginManager } from '../../helpers/pluginManager';\nimport { SlotRenderer } from '../../components/PluginSlotRenderer';\nimport { usePlugin } from '../../contexts/usePlugin';\n\ninterface Props {\n type: PayloadType;\n operation: OperationInterface;\n channelName: string;\n channel: ChannelInterface;\n}\n\nexport const Operation: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n if (!operation || !channel) {\n return null;\n }\n\n // check typeof as fallback for older version than `2.2.0`\n const servers =\n typeof channel.servers === 'function' && channel.servers().all();\n // check typeof as fallback for older version than `2.4.0`\n const security =\n typeof operation.security === 'function' && operation.security();\n const parameters =\n channel.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n return (\n <div>\n <div className=\"panel-item--center px-8\">\n <OperationInfo {...props} />\n {servers && servers.length > 0 ? (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${window.location.pathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\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 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n\n {security && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-security`,\n config,\n )}\n >\n <Security\n security={security}\n header=\"Additional security requirements\"\n />\n </div>\n )}\n\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Channel specific information\"\n bindings={channel.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Channel Extensions\" item={channel} />\n\n {operation.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Operation specific information\"\n bindings={operation.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Operation Extensions\" item={operation} />\n\n {operation.tags() && (\n <div className=\"mt-2\">\n <Tags tags={operation.tags()} />\n </div>\n )}\n </div>\n\n <div\n className=\"w-full mt-4\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-message`,\n config,\n )}\n >\n {operation.messages().length > 1 ? (\n <div className=\"mt-2\">\n <p className=\"px-8\">\n Accepts <strong>one of</strong> the following messages:\n </p>\n <ul>\n {operation\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <p className=\"px-8\">Accepts the following message:</p>\n <div className=\"mt-2\">\n <Message message={operation.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n </div>\n\n <OperationReplyInfo {...props} />\n </div>\n );\n};\n\nexport const OperationInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n const pluginManager = usePlugin();\n const operationSummary = operation.summary();\n const externalDocs = operation.externalDocs();\n const operationId = operation.id();\n const specV = useSpec().version();\n const version = specV.localeCompare('2.6.0', undefined, { numeric: true });\n const isAsyncAPIv2 = version === 0;\n const { backgroundColor, typeLabel } =\n CommonHelpers.getOperationDesignInformation({\n type,\n config,\n isAsyncAPIv2,\n });\n return (\n <>\n <div className=\"mb-4\">\n <h3>\n <span\n className={`font-mono text-white uppercase p-1 rounded mr-2 ${backgroundColor}`}\n title={type}\n >\n {typeLabel}\n </span>{' '}\n <span className=\"font-mono text-base\">{channelName}</span>\n </h3>\n </div>\n\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {operationSummary && (\n <p className=\"text-gray-600 text-sm mt-2\">{operationSummary}</p>\n )}\n {operation.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{operation.description()}</Markdown>\n </div>\n )}\n\n {externalDocs && (\n <ul className=\"leading-normal mt-2 mb-4 space-x-2 space-y-2\">\n {externalDocs && (\n <li className=\"inline-block\">\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 </ul>\n )}\n\n {operationId && (\n <div className=\"border bg-gray-100 rounded px-4 py-2 mt-2\">\n <div className=\"text-sm text-gray-700\">\n Operation ID\n <span className=\"bg-orange-600 text-white rounded text-xs ml-2 py-0 px-2\">\n {operationId}\n </span>\n </div>\n </div>\n )}\n {PluginManager && (\n <SlotRenderer\n slot={PluginSlot.OPERATION}\n context={{\n schema: props,\n }}\n pluginManager={pluginManager}\n />\n )}\n </>\n );\n};\n\nexport const OperationReplyInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation } = props;\n const [showMessages, setShowMessages] = useState(false);\n const [showChannel, setShowChannel] = useState(false);\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (reply === undefined) {\n return <></>;\n }\n\n const replyMessages = reply.messages();\n const explicitChannel = reply.channel();\n\n const replyAddress = reply.address()?.location();\n\n return (\n <div className=\"panel-item\">\n <div className=\"panel-item--center\">\n <div className=\"font-mono px-8 py-4\">\n <div className=\"border rounded\">\n <div\n className={`w-full ${\n type === PayloadType.REPLY\n ? 'bg-green-600 border-green-600'\n : 'bg-blue-600 border-blue-600'\n } text-sm rounded-t h-8 px-4 border text-white flex items-center`}\n >\n <strong>REPLY INFORMATION</strong>\n </div>\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2\" title={type}>\n REPLY CHANNEL INFORMATION\n </span>\n </h3>\n {explicitChannel?.address() ? (\n <div className=\"text-xs text-gray-700\">\n Reply will be provided via this designated address:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {explicitChannel.address()}{' '}\n </span>\n </div>\n ) : (\n replyAddress != null && (\n <div className=\"text-xs text-gray-700\">\n Reply will be directed to the address specified at this\n location:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddress}\n </span>\n </div>\n )\n )}\n <div className=\"mt-2\">\n {explicitChannel && (\n <CollapseButton\n onClick={() => setShowChannel((prev) => !prev)}\n expanded={showChannel}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n View channel details\n </span>\n </CollapseButton>\n )}\n {explicitChannel && (\n <div\n className={`w-full mt-4 ${\n showChannel ? 'block' : 'hidden'\n }`}\n >\n <OperationReplyChannelInfo {...props} />{' '}\n </div>\n )}\n </div>\n </div>\n </div>\n <OperationReplyAddressInfo {...props} />\n {replyMessages.isEmpty() === false && (\n <div className=\"p-4\">\n <CollapseButton\n onClick={() => setShowMessages((prev) => !prev)}\n expanded={showMessages}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n Expected Reply{' '}\n {replyMessages.length > 1 ? 'Messages' : 'Message'}\n </span>\n </CollapseButton>\n <div\n className={`w-full mt-4 ${showMessages ? 'block' : 'hidden'}`}\n >\n {replyMessages.length > 1 ? (\n <div className=\"mt-2\">\n <ul>\n {replyMessages.all().map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <div className=\"mt-2\">\n <Message\n message={replyMessages.all()[0]}\n showExamples\n />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </div>\n\n <Extensions name=\"Operation Reply Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n\nexport const OperationReplyChannelInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n const reply = operation.reply();\n const channel = reply?.channel();\n const channelName = channel?.address() ?? '';\n\n const config = useConfig();\n const servers =\n typeof channel?.servers === 'function' && channel.servers().all();\n const parameters =\n channel?.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n if (!channel) {\n return <></>;\n }\n\n return (\n <div>\n {channel.address() && (\n <div className=\"mt-2 text-xs text-gray-700\">\n Address:{' '}\n <span className=\"border text-orange-600 rounded text-xs py-0 px-2\">\n {channel.address()}\n </span>\n </div>\n )}\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {servers && servers.length > 0 ? (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${window.location.pathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\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 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {channel.messages().all().length > 1 ? (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Messages:</span>\n <ul>\n {channel\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Message:</span>\n <div className=\"mt-2\">\n <Message message={channel.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings name=\"Bindings\" bindings={channel.bindings()} />\n </div>\n )}\n </div>\n );\n};\n\nexport const OperationReplyAddressInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (!reply?.address) {\n return <></>;\n }\n const replyAddress = reply.address();\n\n if (!replyAddress) {\n return <></>;\n }\n\n const replyAddressLocation = replyAddress.location();\n\n return (\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2 uppercase\" title={type}>\n REPLY address information\n </span>\n </h3>\n {replyAddressLocation && (\n <div className=\"text-xs text-gray-700\">\n REPLY will be sent to the address provided in:\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddressLocation}\n </span>\n </div>\n )}\n {replyAddress.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{replyAddress.description()}</Markdown>\n </div>\n )}\n <Extensions name=\"Operation Reply Address Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../../src/containers/Operations/Operation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;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K,SAAS,EAAC,uBAAuB;;gBAEpC,wCAAM,SAAS,EAAC,uDAAuD,IACpE,oBAAoB,CAChB,CACH,CACP;YACA,YAAY,CAAC,cAAc,EAAE,IAAI,CAChC,uCAAK,SAAS,EAAC,MAAM;gBACnB,8BAAC,qBAAQ,QAAE,YAAY,CAAC,WAAW,EAAE,CAAY,CAC7C,CACP;YACD,8BAAC,uBAAU,IAAC,IAAI,EAAC,oCAAoC,EAAC,IAAI,EAAE,KAAK,GAAI,CACjE,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,yBAAyB,6BAiDpC","sourcesContent":["import React, { useState } from 'react';\nimport { ChannelInterface, OperationInterface } from '@asyncapi/parser';\nimport { Message } from '../Messages/Message';\nimport { Security } from '../Servers/Security';\nimport {\n Markdown,\n Schema,\n Bindings,\n Tags,\n Extensions,\n CollapseButton,\n} from '../../components';\nimport { Href } from '../../components/Href';\nimport { useConfig, useSpec } from '../../contexts';\nimport { CommonHelpers, SchemaHelpers } from '../../helpers';\nimport { EXTERAL_DOCUMENTATION_TEXT } from '../../constants';\nimport { PayloadType, PluginSlot } from '../../types';\nimport { PluginManager } from '../../helpers/pluginManager';\nimport { ServersList } from './ServersList';\nimport { SlotRenderer } from '../../components/PluginSlotRenderer';\nimport { usePlugin } from '../../contexts/usePlugin';\n\ninterface Props {\n type: PayloadType;\n operation: OperationInterface;\n channelName: string;\n channel: ChannelInterface;\n}\n\n// Construct the full relative URL, including path, query parameters to avoid path overwrite when\n// location.hash is included\nconst location = globalThis.location;\nconst relativePathname = location\n ? `${location.pathname}${location.search}`\n : '';\n\nexport const Operation: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n if (!operation || !channel) {\n return null;\n }\n\n // check typeof as fallback for older version than `2.2.0`\n const servers =\n typeof channel.servers === 'function' && channel.servers().all();\n // check typeof as fallback for older version than `2.4.0`\n const security =\n typeof operation.security === 'function' && operation.security();\n const parameters =\n channel.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n return (\n <div>\n <div className=\"panel-item--center px-8\">\n <OperationInfo {...props} />\n\n <ServersList\n servers={servers || []}\n config={config}\n relativePathname={relativePathname}\n />\n\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n\n {security && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-security`,\n config,\n )}\n >\n <Security\n security={security}\n header=\"Additional security requirements\"\n />\n </div>\n )}\n\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Channel specific information\"\n bindings={channel.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Channel Extensions\" item={channel} />\n\n {operation.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Operation specific information\"\n bindings={operation.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Operation Extensions\" item={operation} />\n\n {operation.tags() && (\n <div className=\"mt-2\">\n <Tags tags={operation.tags()} />\n </div>\n )}\n </div>\n\n <div\n className=\"w-full mt-4\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-message`,\n config,\n )}\n >\n {operation.messages().length > 1 ? (\n <div className=\"mt-2\">\n <p className=\"px-8\">\n Accepts <strong>one of</strong> the following messages:\n </p>\n <ul>\n {operation\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <p className=\"px-8\">Accepts the following message:</p>\n <div className=\"mt-2\">\n <Message message={operation.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n </div>\n\n <OperationReplyInfo {...props} />\n </div>\n );\n};\n\nexport const OperationInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n const pluginManager = usePlugin();\n const operationSummary = operation.summary();\n const externalDocs = operation.externalDocs();\n const operationId = operation.id();\n const specV = useSpec().version();\n const version = specV.localeCompare('2.6.0', undefined, { numeric: true });\n const isAsyncAPIv2 = version === 0;\n const { backgroundColor, typeLabel } =\n CommonHelpers.getOperationDesignInformation({\n type,\n config,\n isAsyncAPIv2,\n });\n return (\n <>\n <div className=\"mb-4\">\n <h3>\n <span\n className={`font-mono text-white uppercase p-1 rounded mr-2 ${backgroundColor}`}\n title={type}\n >\n {typeLabel}\n </span>{' '}\n <span className=\"font-mono text-base\">{channelName}</span>\n </h3>\n </div>\n\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {operationSummary && (\n <p className=\"text-gray-600 text-sm mt-2\">{operationSummary}</p>\n )}\n {operation.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{operation.description()}</Markdown>\n </div>\n )}\n\n {externalDocs && (\n <ul className=\"leading-normal mt-2 mb-4 space-x-2 space-y-2\">\n {externalDocs && (\n <li className=\"inline-block\">\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 </ul>\n )}\n\n {operationId && (\n <div className=\"border bg-gray-100 rounded px-4 py-2 mt-2\">\n <div className=\"text-sm text-gray-700\">\n Operation ID\n <span className=\"bg-orange-600 text-white rounded text-xs ml-2 py-0 px-2\">\n {operationId}\n </span>\n </div>\n </div>\n )}\n {PluginManager && (\n <SlotRenderer\n slot={PluginSlot.OPERATION}\n context={{\n schema: props,\n }}\n pluginManager={pluginManager}\n />\n )}\n </>\n );\n};\n\nexport const OperationReplyInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation } = props;\n const [showMessages, setShowMessages] = useState(false);\n const [showChannel, setShowChannel] = useState(false);\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (reply === undefined) {\n return <></>;\n }\n\n const replyMessages = reply.messages();\n const explicitChannel = reply.channel();\n\n const replyAddress = reply.address()?.location();\n\n return (\n <div className=\"panel-item\">\n <div className=\"panel-item--center\">\n <div className=\"font-mono px-8 py-4\">\n <div className=\"border rounded\">\n <div\n className={`w-full ${\n type === PayloadType.REPLY\n ? 'bg-green-600 border-green-600'\n : 'bg-blue-600 border-blue-600'\n } text-sm rounded-t h-8 px-4 border text-white flex items-center`}\n >\n <strong>REPLY INFORMATION</strong>\n </div>\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2\" title={type}>\n REPLY CHANNEL INFORMATION\n </span>\n </h3>\n {explicitChannel?.address() ? (\n <div className=\"text-xs text-gray-700\">\n Reply will be provided via this designated address:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {explicitChannel.address()}{' '}\n </span>\n </div>\n ) : (\n replyAddress != null && (\n <div className=\"text-xs text-gray-700\">\n Reply will be directed to the address specified at this\n location:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddress}\n </span>\n </div>\n )\n )}\n <div className=\"mt-2\">\n {explicitChannel && (\n <CollapseButton\n onClick={() => setShowChannel((prev) => !prev)}\n expanded={showChannel}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n View channel details\n </span>\n </CollapseButton>\n )}\n {explicitChannel && (\n <div\n className={`w-full mt-4 ${\n showChannel ? 'block' : 'hidden'\n }`}\n >\n <OperationReplyChannelInfo {...props} />{' '}\n </div>\n )}\n </div>\n </div>\n </div>\n <OperationReplyAddressInfo {...props} />\n {replyMessages.isEmpty() === false && (\n <div className=\"p-4\">\n <CollapseButton\n onClick={() => setShowMessages((prev) => !prev)}\n expanded={showMessages}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n Expected Reply{' '}\n {replyMessages.length > 1 ? 'Messages' : 'Message'}\n </span>\n </CollapseButton>\n <div\n className={`w-full mt-4 ${showMessages ? 'block' : 'hidden'}`}\n >\n {replyMessages.length > 1 ? (\n <div className=\"mt-2\">\n <ul>\n {replyMessages.all().map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <div className=\"mt-2\">\n <Message\n message={replyMessages.all()[0]}\n showExamples\n />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </div>\n\n <Extensions name=\"Operation Reply Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n\nexport const OperationReplyChannelInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n const reply = operation.reply();\n const channel = reply?.channel();\n const channelName = channel?.address() ?? '';\n\n const config = useConfig();\n const servers =\n typeof channel?.servers === 'function' && channel.servers().all();\n const parameters =\n channel?.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n if (!channel) {\n return <></>;\n }\n\n return (\n <div>\n {channel.address() && (\n <div className=\"mt-2 text-xs text-gray-700\">\n Address:{' '}\n <span className=\"border text-orange-600 rounded text-xs py-0 px-2\">\n {channel.address()}\n </span>\n </div>\n )}\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n <ServersList\n servers={servers || []}\n config={config}\n relativePathname={relativePathname}\n />\n {channel.messages().all().length > 1 ? (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Messages:</span>\n <ul>\n {channel\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Message:</span>\n <div className=\"mt-2\">\n <Message message={channel.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings name=\"Bindings\" bindings={channel.bindings()} />\n </div>\n )}\n </div>\n );\n};\n\nexport const OperationReplyAddressInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (!reply?.address) {\n return <></>;\n }\n const replyAddress = reply.address();\n\n if (!replyAddress) {\n return <></>;\n }\n\n const replyAddressLocation = replyAddress.location();\n\n return (\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2 uppercase\" title={type}>\n REPLY address information\n </span>\n </h3>\n {replyAddressLocation && (\n <div className=\"text-xs text-gray-700\">\n REPLY will be sent to the address provided in:\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddressLocation}\n </span>\n </div>\n )}\n {replyAddress.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{replyAddress.description()}</Markdown>\n </div>\n )}\n <Extensions name=\"Operation Reply Address Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ServersList = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var helpers_1 = require("../../helpers");
|
|
9
|
+
var ServersList = function (_a) {
|
|
10
|
+
var servers = _a.servers, config = _a.config, relativePathname = _a.relativePathname;
|
|
11
|
+
if (!servers || servers.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return (react_1.default.createElement("div", { className: "mt-2 text-sm" },
|
|
15
|
+
react_1.default.createElement("p", null, "Available only on servers:"),
|
|
16
|
+
react_1.default.createElement("ul", { className: "flex flex-wrap leading-normal" }, servers.map(function (server) { return (react_1.default.createElement("li", { className: "inline-block mt-2 mr-2", key: server.id() },
|
|
17
|
+
react_1.default.createElement("a", { href: "".concat(relativePathname, "#").concat(helpers_1.CommonHelpers.getIdentifier('server-' + server.id(), config)), 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 cursor-pointer" },
|
|
18
|
+
react_1.default.createElement("span", { className: "underline" }, server.id())))); }))));
|
|
19
|
+
};
|
|
20
|
+
exports.ServersList = ServersList;
|
|
21
|
+
//# sourceMappingURL=ServersList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServersList.js","sourceRoot":"","sources":["../../../../src/containers/Operations/ServersList.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAE1B,yCAA8C;AASvC,IAAM,WAAW,GAA+B,UAAC,EAIvD;QAHC,OAAO,aAAA,EACP,MAAM,YAAA,EACN,gBAAgB,sBAAA;IAEhB,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACpC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,uCAAK,SAAS,EAAC,cAAc;QAC3B,sEAAiC;QACjC,sCAAI,SAAS,EAAC,+BAA+B,IAC1C,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,IAAK,OAAA,CACvB,sCAAI,SAAS,EAAC,wBAAwB,EAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE;YACrD,qCACE,IAAI,EAAE,UAAG,gBAAgB,cAAI,uBAAa,CAAC,aAAa,CACtD,SAAS,GAAG,MAAM,CAAC,EAAE,EAAE,EACvB,MAAM,CACP,CAAE,EACH,SAAS,EAAC,yJAAyJ;gBAEnK,wCAAM,SAAS,EAAC,WAAW,IAAE,MAAM,CAAC,EAAE,EAAE,CAAQ,CAC9C,CACD,CACN,EAZwB,CAYxB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,WAAW,eA6BtB","sourcesContent":["import React from 'react';\nimport { ServerInterface } from '@asyncapi/parser';\nimport { CommonHelpers } from '../../helpers';\nimport { ConfigInterface } from '../../config';\n\ninterface ServersListProps {\n servers: ServerInterface[];\n config: ConfigInterface;\n relativePathname: string;\n}\n\nexport const ServersList: React.FC<ServersListProps> = ({\n servers,\n config,\n relativePathname,\n}) => {\n if (!servers || servers.length === 0) {\n return null;\n }\n\n return (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${relativePathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\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 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"]}
|
|
@@ -133,22 +133,22 @@ export var Schema = function (_a) {
|
|
|
133
133
|
React.createElement(AdditionalItems, { schema: schema }))))));
|
|
134
134
|
};
|
|
135
135
|
var SchemaProperties = function (_a) {
|
|
136
|
-
var _b;
|
|
136
|
+
var _b, _c, _d;
|
|
137
137
|
var schema = _a.schema;
|
|
138
|
-
var properties = schema.properties();
|
|
139
|
-
|
|
138
|
+
var properties = Object.entries((_b = schema.properties()) !== null && _b !== void 0 ? _b : {});
|
|
139
|
+
var patternProperties = Object.entries((_c = schema.patternProperties()) !== null && _c !== void 0 ? _c : {});
|
|
140
|
+
if (!properties.length && !patternProperties.length) {
|
|
140
141
|
return null;
|
|
141
142
|
}
|
|
142
|
-
var required = (
|
|
143
|
-
var patternProperties = schema.patternProperties();
|
|
143
|
+
var required = (_d = schema.required()) !== null && _d !== void 0 ? _d : [];
|
|
144
144
|
return (React.createElement(React.Fragment, null,
|
|
145
|
-
|
|
145
|
+
properties.map(function (_a) {
|
|
146
146
|
var propertyName = _a[0], property = _a[1];
|
|
147
|
-
return (React.createElement(Schema, { schema: property, schemaName: propertyName, required: required.includes(propertyName), isProperty: true, isCircular: property.isCircular(), dependentRequired: SchemaHelpers.getDependentRequired(propertyName, schema)
|
|
147
|
+
return (React.createElement(Schema, { key: propertyName, schema: property, schemaName: propertyName, required: required.includes(propertyName), isProperty: true, isCircular: property.isCircular(), dependentRequired: SchemaHelpers.getDependentRequired(propertyName, schema) }));
|
|
148
148
|
}),
|
|
149
|
-
|
|
149
|
+
patternProperties.map(function (_a) {
|
|
150
150
|
var propertyName = _a[0], property = _a[1];
|
|
151
|
-
return (React.createElement(Schema, { schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular()
|
|
151
|
+
return (React.createElement(Schema, { key: propertyName, schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular() }));
|
|
152
152
|
})));
|
|
153
153
|
};
|
|
154
154
|
var AdditionalProperties = function (_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":"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CAAC;AAC/D,CAAC,CAAC;AAMF,IAAM,eAAe,GAAkD,UAAC,EAEvE;;QADC,MAAM,YAAA;IAEN,IACE,CAAA,MAAA,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,uBAAuB,CAAC,0CAAE,KAAK,EAAE;QACvE,KAAK,EACL;QACA,OAAO,IAAI,CAAC;KACb;IAED,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,OAAO,CAAC,CAAA,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAGD,IAAM,eAAe,GAAG,MAAM,CAAC,eAAe,EAAS,CAAC;IACxD,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;QAC7D,OAAO,CACL,2BAAG,SAAS,EAAC,4BAA4B,oCAErC,CACL,CAAC;KACH;IACD,IAAI,eAAe,KAAK,KAAK,EAAE;QAC7B,OAAO,CACL,2BAAG,SAAS,EAAC,4BAA4B;;YAClB,0CAAoB;wBACvC,CACL,CAAC;KACH;IAED,OAAO,oBAAC,MAAM,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 <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </strong>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </strong>\n )}\n {schema.contentMediaType() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </strong>\n )}\n {schema.contentEncoding() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </strong>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map((c) => (\n <strong\n className=\"bg-purple-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </strong>\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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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 <strong className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 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 </strong>\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=\"inline-block bg-orange-600 text-white 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() ?? s.id(),\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() ?? s.id(),\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() ?? s.id(),\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"]}
|
|
1
|
+
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAe3C,IAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;CACpB,CAAC,CAAC;AAE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E,QAAQ,CAAC,OAAO,CAAC,CAAA,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAGD,IAAM,eAAe,GAAG,MAAM,CAAC,eAAe,EAAS,CAAC;IACxD,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;QAC7D,OAAO,CACL,2BAAG,SAAS,EAAC,4BAA4B,oCAErC,CACL,CAAC;KACH;IACD,IAAI,eAAe,KAAK,KAAK,EAAE;QAC7B,OAAO,CACL,2BAAG,SAAS,EAAC,4BAA4B;;YAClB,0CAAoB;wBACvC,CACL,CAAC;KACH;IAED,OAAO,oBAAC,MAAM,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 <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </strong>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </strong>\n )}\n {schema.contentMediaType() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </strong>\n )}\n {schema.contentEncoding() !== undefined && (\n <strong className=\"bg-yellow-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </strong>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map((c) => (\n <strong\n className=\"bg-purple-600 no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </strong>\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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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=\"inline-block bg-orange-600 text-white 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 <strong className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 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 </strong>\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=\"inline-block bg-orange-600 text-white 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() ?? s.id(),\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() ?? s.id(),\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() ?? s.id(),\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 = Object.entries(schema.properties() ?? {});\n const patternProperties = Object.entries(schema.patternProperties() ?? {});\n\n if (!properties.length && !patternProperties.length) {\n return null;\n }\n\n const required = schema.required() ?? [];\n\n return (\n <>\n {properties.map(([propertyName, property]) => (\n <Schema\n key={propertyName}\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 />\n ))}\n\n {patternProperties.map(([propertyName, property]) => (\n <Schema\n key={propertyName}\n schema={property}\n schemaName={propertyName}\n isPatternProperty\n isProperty\n isCircular={property.isCircular()}\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"]}
|