@asyncapi/react-component 1.0.2 → 1.1.0

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.
Files changed (34) hide show
  1. package/browser/index.js +21 -21
  2. package/browser/standalone/index.js +21 -21
  3. package/browser/standalone/without-parser.js +11 -11
  4. package/browser/without-parser.js +11 -11
  5. package/lib/cjs/components/Schema.js +3 -3
  6. package/lib/cjs/components/Schema.js.map +1 -1
  7. package/lib/cjs/containers/AsyncApi/Standalone.js.map +1 -1
  8. package/lib/cjs/containers/Servers/Security.js +2 -3
  9. package/lib/cjs/containers/Servers/Security.js.map +1 -1
  10. package/lib/cjs/helpers/message.js +3 -3
  11. package/lib/cjs/helpers/message.js.map +1 -1
  12. package/lib/cjs/helpers/schema.js +9 -0
  13. package/lib/cjs/helpers/schema.js.map +1 -1
  14. package/lib/cjs/helpers/server.js +4 -6
  15. package/lib/cjs/helpers/server.js.map +1 -1
  16. package/lib/esm/components/Schema.js +3 -3
  17. package/lib/esm/components/Schema.js.map +1 -1
  18. package/lib/esm/containers/AsyncApi/Standalone.js.map +1 -1
  19. package/lib/esm/containers/Servers/Security.js +2 -3
  20. package/lib/esm/containers/Servers/Security.js.map +1 -1
  21. package/lib/esm/helpers/message.js +3 -3
  22. package/lib/esm/helpers/message.js.map +1 -1
  23. package/lib/esm/helpers/schema.js +9 -0
  24. package/lib/esm/helpers/schema.js.map +1 -1
  25. package/lib/esm/helpers/server.js +4 -6
  26. package/lib/esm/helpers/server.js.map +1 -1
  27. package/lib/types/components/Schema.d.ts.map +1 -1
  28. package/lib/types/containers/AsyncApi/Standalone.d.ts.map +1 -1
  29. package/lib/types/containers/Servers/Security.d.ts.map +1 -1
  30. package/lib/types/helpers/message.d.ts.map +1 -1
  31. package/lib/types/helpers/schema.d.ts +1 -0
  32. package/lib/types/helpers/schema.d.ts.map +1 -1
  33. package/lib/types/helpers/server.d.ts.map +1 -1
  34. package/package.json +2 -2
@@ -1 +1 @@
1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,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjD,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAED,IAAM,eAAe,GAAG,MAAM,CAAC,eAAe,EAAS,CAAC;IACxD,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;QAC7D,OAAO,CACL,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;IACD,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}\n\nconst SchemaContext = React.createContext({\n reverse: false,\n deepExpanded: false,\n});\n\nexport const Schema: React.FunctionComponent<Props> = ({\n schemaName,\n schema,\n required = false,\n isPatternProperty = false,\n isProperty = false,\n isCircular = false,\n dependentRequired,\n expanded: propExpanded = false,\n onlyTitle = false,\n}) => {\n const { reverse, deepExpanded } = useContext(SchemaContext);\n const [expanded, setExpanded] = useState(propExpanded);\n const [deepExpand, setDeepExpand] = useState(false);\n\n useEffect(() => {\n setDeepExpand(deepExpanded);\n }, [deepExpanded, setDeepExpand]);\n\n useEffect(() => {\n setExpanded(deepExpand);\n }, [deepExpand, setExpanded]);\n\n if (\n !schema ||\n (typeof schemaName === 'string' &&\n (schemaName?.startsWith('x-parser-') ||\n schemaName?.startsWith('x-schema-private-')))\n ) {\n return null;\n }\n\n const dependentSchemas = SchemaHelpers.getDependentSchemas(schema);\n\n const constraints = SchemaHelpers.humanizeConstraints(schema);\n const externalDocs = schema.externalDocs();\n\n const rawValueExt = schema.extensions().get(SchemaHelpers.extRawValue);\n const rawValue = rawValueExt?.value() === true;\n\n const parameterLocationExt = schema\n .extensions()\n .get(SchemaHelpers.extParameterLocation);\n const parameterLocation = parameterLocationExt?.value() === true;\n\n const schemaType = SchemaHelpers.toSchemaType(schema);\n const isExpandable = SchemaHelpers.isExpandable(schema) || dependentSchemas;\n\n isCircular = isCircular || schema.isCircular() || false;\n const uid = schema.$id();\n const styledSchemaName = isProperty ? 'italic' : '';\n const renderedSchemaName =\n typeof schemaName === 'string' ? (\n <span className={`break-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 ? (\n <>\n <CollapseButton\n onClick={() => setExpanded(prev => !prev)}\n expanded={expanded}\n >\n {renderedSchemaName}\n </CollapseButton>\n <button\n type=\"button\"\n onClick={() => setDeepExpand(prev => !prev)}\n className=\"ml-1 text-sm text-gray-500\"\n >\n {deepExpand ? 'Collapse all' : 'Expand all'}\n </button>\n </>\n ) : (\n <span\n className={`break-anywhere text-sm ${\n isProperty ? 'italic' : ''\n }`}\n >\n {schemaName}\n </span>\n )}\n {isPatternProperty && (\n <div className=\"text-gray-500 text-xs italic\">\n (pattern property)\n </div>\n )}\n {required && <div className=\"text-red-600 text-xs\">required</div>}\n {dependentRequired && (\n <>\n <div className=\"text-gray-500 text-xs\">\n required when defined:\n </div>\n <div className=\"text-red-600 text-xs\">\n {dependentRequired.join(', ')}\n </div>\n </>\n )}\n {schema.deprecated() && (\n <div className=\"text-red-600 text-xs\">deprecated</div>\n )}\n {schema.writeOnly() && (\n <div className=\"text-gray-500 text-xs\">write-only</div>\n )}\n {schema.readOnly() && (\n <div className=\"text-gray-500 text-xs\">read-only</div>\n )}\n </div>\n {rawValue ? (\n <div>\n <div className=\"text-sm\">\n {SchemaHelpers.prettifyValue(schema.const(), false)}\n </div>\n </div>\n ) : (\n <div>\n <div>\n <div className=\"capitalize text-sm text-teal-500 font-bold inline-block mr-2\">\n {isCircular ? `${schemaType} [CIRCULAR]` : schemaType}\n </div>\n <div className=\"inline-block\">\n {schema.format() && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </span>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </span>\n )}\n {schema.contentMediaType() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </span>\n )}\n {schema.contentEncoding() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </span>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map(c => (\n <span\n className=\"bg-purple-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </span>\n ))}\n\n {uid && !uid.startsWith('<anonymous-') && (\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n uid: {uid}\n </span>\n )}\n </div>\n\n {schema.description() !== undefined && (\n <div>\n <Markdown>{schema.description()}</Markdown>\n </div>\n )}\n\n {schema.default() !== undefined && (\n <div className=\"text-xs\">\n Default value:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.default())}\n </span>\n </div>\n )}\n {schema.const() !== undefined && (\n <div className=\"text-xs\">\n Const:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.const())}\n </span>\n </div>\n )}\n {schema.enum() && (\n <ul className=\"text-xs\">\n Allowed values:{' '}\n {schema.enum()?.map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n {parameterLocation && (\n <div className=\"text-xs\">\n Parameter location:{' '}\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n {parameterLocation}\n </span>\n </div>\n )}\n {externalDocs && (\n <span className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-2 py-0\">\n <Href\n href={externalDocs.url()}\n title={externalDocs.description() || ''}\n >\n Documentation\n </Href>\n </span>\n )}\n {schema.examples() && (\n <ul className=\"text-xs\">\n Examples values:{' '}\n {schema.examples()?.map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2 break-all\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n )}\n </div>\n\n {isCircular || !isExpandable ? null : (\n <div\n className={`rounded p-4 py-2 border bg-gray-100 ${\n reverse ? 'bg-gray-200' : ''\n } ${expanded ? 'block' : 'hidden'}`}\n >\n <SchemaProperties schema={schema} />\n <SchemaItems schema={schema} />\n\n {schema.oneOf() &&\n schema\n .oneOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Adheres to:' : 'Or to:'}\n />\n ))}\n {schema.anyOf() &&\n schema\n .anyOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Can adhere to:' : 'Or to:'}\n />\n ))}\n {schema.allOf() &&\n schema\n .allOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={idx === 0 ? 'Consists of:' : 'And with:'}\n />\n ))}\n {schema.not() && (\n <Schema schema={schema.not()} schemaName=\"Cannot adhere to:\" />\n )}\n\n {schema.propertyNames() && (\n <Schema\n schema={schema.propertyNames()}\n schemaName=\"Property names must adhere to:\"\n />\n )}\n {schema.contains() && (\n <Schema\n schema={schema.contains()}\n schemaName=\"Array must contain at least one of:\"\n />\n )}\n\n {schema.if() && (\n <Schema schema={schema.if()} schemaName=\"If schema adheres to:\" />\n )}\n {schema.then() && (\n <Schema\n schema={schema.then()}\n schemaName=\"Then must adhere to:\"\n />\n )}\n {schema.else() && (\n <Schema schema={schema.else()} schemaName=\"Otherwise:\" />\n )}\n\n {dependentSchemas && (\n <Schema\n schema={dependentSchemas}\n schemaName=\"Dependent schemas:\"\n />\n )}\n\n <Extensions item={schema} />\n\n <AdditionalProperties schema={schema} />\n <AdditionalItems schema={schema} />\n </div>\n )}\n </div>\n </SchemaContext.Provider>\n );\n};\n\ninterface SchemaPropertiesProps {\n schema: SchemaInterface;\n}\n\nconst SchemaProperties: React.FunctionComponent<SchemaPropertiesProps> = ({\n schema,\n}) => {\n const properties = schema.properties();\n if (properties === undefined || !Object.keys(properties)) {\n return null;\n }\n\n const required = schema.required() || [];\n const patternProperties = schema.patternProperties();\n\n return (\n <>\n {Object.entries(properties).map(([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n required={required.includes(propertyName)}\n isProperty={true}\n isCircular={property.isCircular()}\n dependentRequired={SchemaHelpers.getDependentRequired(\n propertyName,\n schema,\n )}\n key={propertyName}\n />\n ))}\n {Object.entries(patternProperties || {}).map(\n ([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n isPatternProperty={true}\n isProperty={true}\n isCircular={property.isCircular()}\n key={propertyName}\n />\n ),\n )}\n </>\n );\n};\n\ninterface AdditionalPropertiesProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalProperties: React.FunctionComponent<AdditionalPropertiesProps> = ({\n schema,\n}) => {\n if (\n schema\n .extensions()\n .get(SchemaHelpers.extRenderAdditionalInfo)\n ?.value() === false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (type === undefined || !type.includes('object')) {\n return null;\n }\n\n const additionalProperties = schema.additionalProperties();\n if (additionalProperties === true || additionalProperties === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are allowed.\n </p>\n );\n }\n if (additionalProperties === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return (\n <Schema schemaName=\"Additional properties:\" schema={additionalProperties} />\n );\n};\n\ninterface SchemaItemsProps {\n schema: SchemaInterface;\n}\n\nconst SchemaItems: React.FunctionComponent<SchemaItemsProps> = ({ schema }) => {\n const type = schema.type();\n if (type === undefined || !type.includes('array')) {\n return null;\n }\n const items = schema.items();\n\n // object in items\n if (\n items &&\n !Array.isArray(items) &&\n Object.keys(items.properties() || {}).length\n ) {\n return <SchemaProperties schema={items} />;\n } else if (Array.isArray(items)) {\n return (\n <>\n {items.map((item, idx) => (\n <Schema schema={item} schemaName={`${idx + 1} item:`} key={idx} />\n ))}\n </>\n );\n }\n return <Schema schema={items} schemaName=\"Items:\" />;\n};\n\ninterface AdditionalItemsProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalItems: React.FunctionComponent<AdditionalItemsProps> = ({\n schema,\n}) => {\n if (\n schema\n .extensions()\n .get(SchemaHelpers.extRenderAdditionalInfo)\n ?.value() === false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (type === undefined || !type.includes('array')) {\n return null;\n }\n if (!Array.isArray(schema.items())) {\n return null;\n }\n\n const additionalItems = schema.additionalItems() as any;\n if (additionalItems === true || additionalItems === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are allowed.\n </p>\n );\n }\n if (additionalItems === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return <Schema schemaName=\"Additional items:\" schema={additionalItems} />;\n};\n"]}
1
+ {"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;AAc3C,IAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,MAAM,GAAmC,UAAC,EAUtD;;QATC,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;IAEX,IAAA,KAA4B,UAAU,CAAC,aAAa,CAAC,EAAnD,OAAO,aAAA,EAAE,YAAY,kBAA8B,CAAC;IACtD,IAAA,KAA0B,QAAQ,CAAC,YAAY,CAAC,EAA/C,QAAQ,QAAA,EAAE,WAAW,QAA0B,CAA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MAAM,IAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC,QAAQ,GAAG,CAAC;AACvD,CAAC,CAAC;AAMF,IAAM,eAAe,GAAkD,UAAC,EAEvE;;QADC,MAAM,YAAA;IAEN,IACE,CAAA,MAAA,MAAM;SACH,UAAU,EAAE;SACZ,GAAG,CAAC,aAAa,CAAC,uBAAuB,CAAC,0CACzC,KAAK,EAAE,MAAK,KAAK,EACrB;QACA,OAAO,IAAI,CAAC;KACb;IAED,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjD,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAED,IAAM,eAAe,GAAG,MAAM,CAAC,eAAe,EAAS,CAAC;IACxD,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;QAC7D,OAAO,CACL,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;IACD,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}\n\nconst SchemaContext = React.createContext({\n reverse: false,\n deepExpanded: false,\n});\n\nexport const Schema: React.FunctionComponent<Props> = ({\n schemaName,\n schema,\n required = false,\n isPatternProperty = false,\n isProperty = false,\n isCircular = false,\n dependentRequired,\n expanded: propExpanded = false,\n onlyTitle = false,\n}) => {\n const { reverse, deepExpanded } = useContext(SchemaContext);\n const [expanded, setExpanded] = useState(propExpanded);\n const [deepExpand, setDeepExpand] = useState(false);\n\n useEffect(() => {\n setDeepExpand(deepExpanded);\n }, [deepExpanded, setDeepExpand]);\n\n useEffect(() => {\n setExpanded(deepExpand);\n }, [deepExpand, setExpanded]);\n\n if (\n !schema ||\n (typeof schemaName === 'string' &&\n (schemaName?.startsWith('x-parser-') ||\n schemaName?.startsWith('x-schema-private-')))\n ) {\n return null;\n }\n\n const dependentSchemas = SchemaHelpers.getDependentSchemas(schema);\n\n const constraints = SchemaHelpers.humanizeConstraints(schema);\n const externalDocs = schema.externalDocs();\n\n const rawValueExt = schema.extensions().get(SchemaHelpers.extRawValue);\n const rawValue = rawValueExt?.value() === true;\n\n const parameterLocationExt = schema\n .extensions()\n .get(SchemaHelpers.extParameterLocation);\n const parameterLocation = parameterLocationExt?.value() === true;\n\n const schemaType = SchemaHelpers.toSchemaType(schema);\n const isExpandable = SchemaHelpers.isExpandable(schema) || dependentSchemas;\n\n isCircular = isCircular || schema.isCircular() || false;\n const uid = schema.$id();\n const styledSchemaName = isProperty ? 'italic' : '';\n const renderedSchemaName =\n typeof schemaName === 'string' ? (\n <span className={`break-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 ? (\n <>\n <CollapseButton\n onClick={() => setExpanded(prev => !prev)}\n expanded={expanded}\n >\n {renderedSchemaName}\n </CollapseButton>\n <button\n type=\"button\"\n onClick={() => setDeepExpand(prev => !prev)}\n className=\"ml-1 text-sm text-gray-500\"\n >\n {deepExpand ? 'Collapse all' : 'Expand all'}\n </button>\n </>\n ) : (\n <span\n className={`break-anywhere text-sm ${\n isProperty ? 'italic' : ''\n }`}\n >\n {schemaName}\n </span>\n )}\n {isPatternProperty && (\n <div className=\"text-gray-500 text-xs italic\">\n (pattern property)\n </div>\n )}\n {required && <div className=\"text-red-600 text-xs\">required</div>}\n {dependentRequired && (\n <>\n <div className=\"text-gray-500 text-xs\">\n required when defined:\n </div>\n <div className=\"text-red-600 text-xs\">\n {dependentRequired.join(', ')}\n </div>\n </>\n )}\n {schema.deprecated() && (\n <div className=\"text-red-600 text-xs\">deprecated</div>\n )}\n {schema.writeOnly() && (\n <div className=\"text-gray-500 text-xs\">write-only</div>\n )}\n {schema.readOnly() && (\n <div className=\"text-gray-500 text-xs\">read-only</div>\n )}\n </div>\n {rawValue ? (\n <div>\n <div className=\"text-sm\">\n {SchemaHelpers.prettifyValue(schema.const(), false)}\n </div>\n </div>\n ) : (\n <div>\n <div>\n <div className=\"capitalize text-sm text-teal-500 font-bold inline-block mr-2\">\n {isCircular ? `${schemaType} [CIRCULAR]` : schemaType}\n </div>\n <div className=\"inline-block\">\n {schema.format() && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n format: {schema.format()}\n </span>\n )}\n\n {/* related to string */}\n {schema.pattern() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded mr-2 p-1 text-xs\">\n must match: {schema.pattern()}\n </span>\n )}\n {schema.contentMediaType() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n media type: {schema.contentMediaType()}\n </span>\n )}\n {schema.contentEncoding() !== undefined && (\n <span className=\"bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\">\n encoding: {schema.contentEncoding()}\n </span>\n )}\n\n {/* constraints */}\n {!!constraints.length &&\n constraints.map(c => (\n <span\n className=\"bg-purple-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs\"\n key={c}\n >\n {c}\n </span>\n ))}\n\n {uid && !uid.startsWith('<anonymous-') && (\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n uid: {uid}\n </span>\n )}\n </div>\n\n {schema.description() !== undefined && (\n <div>\n <Markdown>{schema.description()}</Markdown>\n </div>\n )}\n\n {schema.default() !== undefined && (\n <div className=\"text-xs\">\n Default value:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.default())}\n </span>\n </div>\n )}\n {schema.const() !== undefined && (\n <div className=\"text-xs\">\n Const:\n <span className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\">\n {SchemaHelpers.prettifyValue(schema.const())}\n </span>\n </div>\n )}\n {schema.enum() && (\n <ul className=\"text-xs\">\n Allowed values:{' '}\n {schema.enum()?.map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n {parameterLocation && (\n <div className=\"text-xs\">\n Parameter location:{' '}\n <span className=\"border text-orange-600 rounded mr-2 p-1 text-xs\">\n {parameterLocation}\n </span>\n </div>\n )}\n {externalDocs && (\n <span className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-2 py-0\">\n <Href\n href={externalDocs.url()}\n title={externalDocs.description() || ''}\n >\n Documentation\n </Href>\n </span>\n )}\n {schema.examples() && (\n <ul className=\"text-xs\">\n Examples values:{' '}\n {schema.examples()?.map((e, idx) => (\n <li\n key={idx}\n className=\"border inline-block text-orange-600 rounded ml-1 py-0 px-2 break-all\"\n >\n <span>{SchemaHelpers.prettifyValue(e)}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n )}\n </div>\n\n {isCircular || !isExpandable ? null : (\n <div\n className={`rounded p-4 py-2 border bg-gray-100 ${\n reverse ? 'bg-gray-200' : ''\n } ${expanded ? 'block' : 'hidden'}`}\n >\n <SchemaProperties schema={schema} />\n <SchemaItems schema={schema} />\n\n {schema.oneOf() &&\n schema\n .oneOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Adheres to',\n 'Or to',\n s.title(),\n )}\n />\n ))}\n {schema.anyOf() &&\n schema\n .anyOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Can adhere to',\n 'Or to',\n s.title(),\n )}\n />\n ))}\n {schema.allOf() &&\n schema\n .allOf()\n ?.map((s, idx) => (\n <Schema\n key={idx}\n schema={s}\n schemaName={SchemaHelpers.applicatorSchemaName(\n idx,\n 'Consists of',\n 'And of',\n s.title(),\n )}\n />\n ))}\n {schema.not() && (\n <Schema schema={schema.not()} schemaName=\"Cannot adhere to:\" />\n )}\n\n {schema.propertyNames() && (\n <Schema\n schema={schema.propertyNames()}\n schemaName=\"Property names must adhere to:\"\n />\n )}\n {schema.contains() && (\n <Schema\n schema={schema.contains()}\n schemaName=\"Array must contain at least one of:\"\n />\n )}\n\n {schema.if() && (\n <Schema schema={schema.if()} schemaName=\"If schema adheres to:\" />\n )}\n {schema.then() && (\n <Schema\n schema={schema.then()}\n schemaName=\"Then must adhere to:\"\n />\n )}\n {schema.else() && (\n <Schema schema={schema.else()} schemaName=\"Otherwise:\" />\n )}\n\n {dependentSchemas && (\n <Schema\n schema={dependentSchemas}\n schemaName=\"Dependent schemas:\"\n />\n )}\n\n <Extensions item={schema} />\n\n <AdditionalProperties schema={schema} />\n <AdditionalItems schema={schema} />\n </div>\n )}\n </div>\n </SchemaContext.Provider>\n );\n};\n\ninterface SchemaPropertiesProps {\n schema: SchemaInterface;\n}\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={true}\n isCircular={property.isCircular()}\n dependentRequired={SchemaHelpers.getDependentRequired(\n propertyName,\n schema,\n )}\n key={propertyName}\n />\n ))}\n {Object.entries(patternProperties || {}).map(\n ([propertyName, property]) => (\n <Schema\n schema={property}\n schemaName={propertyName}\n isPatternProperty={true}\n isProperty={true}\n isCircular={property.isCircular()}\n key={propertyName}\n />\n ),\n )}\n </>\n );\n};\n\ninterface AdditionalPropertiesProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalProperties: React.FunctionComponent<AdditionalPropertiesProps> = ({\n schema,\n}) => {\n if (\n schema\n .extensions()\n .get(SchemaHelpers.extRenderAdditionalInfo)\n ?.value() === false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (type === undefined || !type.includes('object')) {\n return null;\n }\n\n const additionalProperties = schema.additionalProperties();\n if (additionalProperties === true || additionalProperties === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are allowed.\n </p>\n );\n }\n if (additionalProperties === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional properties are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return (\n <Schema schemaName=\"Additional properties:\" schema={additionalProperties} />\n );\n};\n\ninterface SchemaItemsProps {\n schema: SchemaInterface;\n}\n\nconst SchemaItems: React.FunctionComponent<SchemaItemsProps> = ({ schema }) => {\n const type = schema.type();\n if (type === undefined || !type.includes('array')) {\n return null;\n }\n const items = schema.items();\n\n // object in items\n if (\n items &&\n !Array.isArray(items) &&\n Object.keys(items.properties() || {}).length\n ) {\n return <SchemaProperties schema={items} />;\n } else if (Array.isArray(items)) {\n return (\n <>\n {items.map((item, idx) => (\n <Schema schema={item} schemaName={`${idx + 1} item:`} key={idx} />\n ))}\n </>\n );\n }\n return <Schema schema={items} schemaName=\"Items:\" />;\n};\n\ninterface AdditionalItemsProps {\n schema: SchemaInterface;\n}\n\nconst AdditionalItems: React.FunctionComponent<AdditionalItemsProps> = ({\n schema,\n}) => {\n if (\n schema\n .extensions()\n .get(SchemaHelpers.extRenderAdditionalInfo)\n ?.value() === false\n ) {\n return null;\n }\n\n const type = schema.type();\n if (type === undefined || !type.includes('array')) {\n return null;\n }\n if (!Array.isArray(schema.items())) {\n return null;\n }\n\n const additionalItems = schema.additionalItems() as any;\n if (additionalItems === true || additionalItems === undefined) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are allowed.\n </p>\n );\n }\n if (additionalItems === false) {\n return (\n <p className=\"mt-2 text-xs text-gray-700\">\n Additional items are <strong>NOT</strong> allowed.\n </p>\n );\n }\n return <Schema schemaName=\"Additional items:\" schema={additionalItems} />;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Standalone.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Standalone.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAmB,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAavC;IAAgC,qCAAuC;IAMrE,2BAAY,KAAoB;QAAhC,YACE,kBAAM,KAAK,CAAC,SAOb;QAbD,WAAK,GAAkB;YACrB,QAAQ,EAAE,SAAS;YACnB,K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QAAQ,EAAE;YACb,IAAI,CAAC,KAAK,EAAE;gBACV,OAAO,IAAI,CAAC;aACb;YACD,OAAO,CAAA,MAAA,kBAAkB,CAAC,IAAI,0CAAE,MAAM,KAAI,oBAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;SACnE;QAED,OAAO,CACL,oBAAC,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;IACJ,CAAC;IAEO,uCAAW,GAAnB,UAAoB,MAAmB;QACrC,IAAM,UAAU,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YACvC,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IACH,wBAAC;AAAD,CAAC,AA7ED,CAAgC,SAAS,GA6ExC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { Component } from 'react';\nimport { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nimport { SpecificationHelpers } from '../../helpers';\nimport { ErrorObject, PropsSchema } from '../../types';\nimport { ConfigInterface, defaultConfig } from '../../config';\n\nimport AsyncApiLayout from './Layout';\nimport { Error } from '../Error/Error';\n\nexport interface AsyncApiProps {\n schema: PropsSchema;\n config?: Partial<ConfigInterface>;\n error?: ErrorObject;\n}\n\ninterface AsyncAPIState {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nclass AsyncApiComponent extends Component<AsyncApiProps, AsyncAPIState> {\n state: AsyncAPIState = {\n asyncapi: undefined,\n error: undefined,\n };\n\n constructor(props: AsyncApiProps) {\n super(props);\n\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(props.schema);\n if (parsedSpec) {\n this.state = { asyncapi: parsedSpec };\n }\n return;\n }\n\n async componentDidMount() {\n if (!this.state.asyncapi) {\n this.updateState(this.props.schema);\n }\n }\n\n async componentDidUpdate(prevProps: AsyncApiProps) {\n const oldSchema = prevProps.schema;\n const newSchema = this.props.schema;\n\n if (oldSchema !== newSchema) {\n this.updateState(newSchema);\n }\n }\n\n render() {\n const { config, error: propError } = this.props;\n const { asyncapi, error: stateError } = this.state;\n\n const error = propError || stateError;\n const concatenatedConfig: ConfigInterface = {\n ...defaultConfig,\n ...config,\n show: {\n ...defaultConfig.show,\n ...(!!config && config.show),\n },\n expand: {\n ...defaultConfig.expand,\n ...(!!config && config.expand),\n },\n sidebar: {\n ...defaultConfig.sidebar,\n ...(!!config && config.sidebar),\n },\n };\n\n if (!asyncapi) {\n if (!error) {\n return null;\n }\n return concatenatedConfig.show?.errors && <Error error={error} />;\n }\n\n return (\n <AsyncApiLayout\n asyncapi={asyncapi}\n config={concatenatedConfig}\n error={error}\n />\n );\n }\n\n private updateState(schema: PropsSchema) {\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(schema);\n if (!parsedSpec) {\n this.setState({ asyncapi: undefined });\n return;\n }\n this.setState({ asyncapi: parsedSpec });\n }\n}\n\nexport default AsyncApiComponent;\n"]}
1
+ {"version":3,"file":"Standalone.js","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Standalone.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAmB,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAavC;IAAgC,qCAAuC;IAMrE,2B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AC,OAAO,GACrB,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,IAElC,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,KAAK,EAAE;gBACV,OAAO,IAAI,CAAC;aACb;YACD,OAAO,CAAA,MAAA,kBAAkB,CAAC,IAAI,0CAAE,MAAM,KAAI,oBAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;SACnE;QAED,OAAO,CACL,oBAAC,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;IACJ,CAAC;IAEO,uCAAW,GAAnB,UAAoB,MAAmB;QACrC,IAAM,UAAU,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YACvC,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IACH,wBAAC;AAAD,CAAC,AA5ED,CAAgC,SAAS,GA4ExC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { Component } from 'react';\nimport { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nimport { SpecificationHelpers } from '../../helpers';\nimport { ErrorObject, PropsSchema } from '../../types';\nimport { ConfigInterface, defaultConfig } from '../../config';\n\nimport AsyncApiLayout from './Layout';\nimport { Error } from '../Error/Error';\n\nexport interface AsyncApiProps {\n schema: PropsSchema;\n config?: Partial<ConfigInterface>;\n error?: ErrorObject;\n}\n\ninterface AsyncAPIState {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nclass AsyncApiComponent extends Component<AsyncApiProps, AsyncAPIState> {\n state: AsyncAPIState = {\n asyncapi: undefined,\n error: undefined,\n };\n\n constructor(props: AsyncApiProps) {\n super(props);\n\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(props.schema);\n if (parsedSpec) {\n this.state = { asyncapi: parsedSpec };\n }\n }\n\n async componentDidMount() {\n if (!this.state.asyncapi) {\n this.updateState(this.props.schema);\n }\n }\n\n async componentDidUpdate(prevProps: AsyncApiProps) {\n const oldSchema = prevProps.schema;\n const newSchema = this.props.schema;\n\n if (oldSchema !== newSchema) {\n this.updateState(newSchema);\n }\n }\n\n render() {\n const { config, error: propError } = this.props;\n const { asyncapi, error: stateError } = this.state;\n\n const error = propError || stateError;\n const concatenatedConfig: ConfigInterface = {\n ...defaultConfig,\n ...config,\n show: {\n ...defaultConfig.show,\n ...(!!config && config.show),\n },\n expand: {\n ...defaultConfig.expand,\n ...(!!config && config.expand),\n },\n sidebar: {\n ...defaultConfig.sidebar,\n ...(!!config && config.sidebar),\n },\n };\n\n if (!asyncapi) {\n if (!error) {\n return null;\n }\n return concatenatedConfig.show?.errors && <Error error={error} />;\n }\n\n return (\n <AsyncApiLayout\n asyncapi={asyncapi}\n config={concatenatedConfig}\n error={error}\n />\n );\n }\n\n private updateState(schema: PropsSchema) {\n const parsedSpec = SpecificationHelpers.retrieveParsedSpec(schema);\n if (!parsedSpec) {\n this.setState({ asyncapi: undefined });\n return;\n }\n this.setState({ asyncapi: parsedSpec });\n }\n}\n\nexport default AsyncApiComponent;\n"]}
@@ -7,8 +7,7 @@ export var Security = function (_a) {
7
7
  var asyncapi = useSpec();
8
8
  var securitySchemes = !asyncapi.components().isEmpty() && asyncapi.components().securitySchemes();
9
9
  var renderedSecurities;
10
- if (!security ||
11
- !security.length ||
10
+ if (!(security === null || security === void 0 ? void 0 : security.length) ||
12
11
  !securitySchemes ||
13
12
  !Object.keys(securitySchemes).length) {
14
13
  if (protocol === 'kafka' || protocol === 'kafka-secure') {
@@ -134,7 +133,7 @@ var SecurityItem = function (_a) {
134
133
  React.createElement("span", null,
135
134
  ServerHelpers.securityType(securitySchema.type()),
136
135
  schemas.length > 0 && (React.createElement("ul", { className: "inline-block ml-2" }, schemas.map(function (schema, idx) { return (React.createElement("li", { className: "inline-block font-bold no-underline bg-blue-400 text-white text-xs uppercase rounded px-2 py-0 ml-1", key: idx }, schema)); })))))),
137
- securitySchema && securitySchema.hasDescription() && (React.createElement("div", null,
136
+ (securitySchema === null || securitySchema === void 0 ? void 0 : securitySchema.hasDescription()) && (React.createElement("div", null,
138
137
  React.createElement(Markdown, null, securitySchema.description()))),
139
138
  renderedFlows && renderedFlows.length > 0 && (React.createElement("ul", { className: "my-2" },
140
139
  React.createElement("li", null, renderedFlows))),
@@ -1 +1 @@
1
- {"version":3,"file":"Security.js","sourceRoot":"","sources":["../../../../src/containers/Servers/Security.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQ9C,MAAM,CAAC,IAAM,QAAQ,GAAmC,UAAC,EAIxD;QAHC,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,cAAmB,EAAnB,MAAM,mBAAG,UAAU,KAAA;IAEnB,IAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;IAC3B,IAAM,eAAe,GACnB,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,eAAe,EAAE,CAAC;IAE9E,IAAI,kBAAkB,CAAC;IACvB,IACE,CAAC,QAAQ;QACT,CAAC,QAAQ,CAAC,MAAM;QAChB,CAAC,eAAe;QAChB,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,EACpC;QACA,IAA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P,4BAAI,SAAS,EAAC,cAAc,IACzB,MAAM;oBACL,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,EAAsB;4BAArB,SAAS,QAAA,EAAE,SAAS,QAAA;wBAAM,OAAA,CACrD,4BACE,SAAS,EAAC,6FAA6F,EACvG,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,SAAS,IAEb,SAAS,CACP,CACN;oBARsD,CAQtD,CAAC,CACD,CACD,CACP,CACG,CACP,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,CACL;QACG,cAAc,IAAI,OAAO,IAAI,CAC5B;YACE;gBACG,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;gBACjD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,4BAAI,SAAS,EAAC,mBAAmB,IAC9B,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,CAC5B,4BACE,SAAS,EAAC,qGAAqG,EAC/G,GAAG,EAAE,GAAG,IAEP,MAAM,CACJ,CACN,EAP6B,CAO7B,CAAC,CACC,CACN,CACI,CACH,CACP;QAEA,cAAc,IAAI,cAAc,CAAC,cAAc,EAAE,IAAI,CACpD;YACE,oBAAC,QAAQ,QAAE,cAAc,CAAC,WAAW,EAAE,CAAY,CAC/C,CACP;QAEA,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC5C,4BAAI,SAAS,EAAC,MAAM;YAClB,gCAAK,aAAa,CAAM,CACrB,CACN;QAEA,qBAAqB,IAAI,iCAAM,qBAAqB,CAAO,CACxD,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n OAuthFlowInterface,\n SecurityRequirementsInterface,\n SecuritySchemeInterface,\n} from '@asyncapi/parser';\n\nimport { Href, Markdown } from '../../components';\nimport { useSpec } from '../../contexts';\nimport { ServerHelpers } from '../../helpers';\n\ninterface Props {\n security: SecurityRequirementsInterface[];\n protocol?: string;\n header?: string;\n}\n\nexport const Security: React.FunctionComponent<Props> = ({\n security = [],\n protocol = '',\n header = 'Security',\n}) => {\n const asyncapi = useSpec();\n const securitySchemes =\n !asyncapi.components().isEmpty() && asyncapi.components().securitySchemes();\n\n let renderedSecurities;\n if (\n !security ||\n !security.length ||\n !securitySchemes ||\n !Object.keys(securitySchemes).length\n ) {\n if (protocol === 'kafka' || protocol === 'kafka-secure') {\n renderedSecurities = (\n <SecurityItem protocol={protocol} securitySchema={null} />\n );\n }\n } else {\n const securities: React.ReactNodeArray = Object.values(security)\n .map(requirement => {\n const requirements = requirement.all();\n const key = Object.keys(requirements)[0];\n const def = securitySchemes[String(key)];\n const requiredScopes: string[] = requirements[String(key)];\n\n if (!def) {\n return null;\n }\n return (\n <SecurityItem\n protocol={protocol}\n securitySchema={def}\n requiredScopes={requiredScopes}\n key={def.type()}\n />\n );\n })\n .filter(Boolean);\n\n renderedSecurities = (\n <ul>\n {securities.map((s, idx) => (\n <li className=\"mt-2\" key={idx}>\n {s}\n </li>\n ))}\n </ul>\n );\n }\n\n if (!renderedSecurities) {\n return null;\n }\n\n return (\n <div className=\"text-sm mt-4\">\n <h5 className=\"text-gray-800\">{header}:</h5>\n {renderedSecurities}\n </div>\n );\n};\n\nfunction collectSecuritySchemas(\n securitySchema: SecuritySchemeInterface | null,\n requiredScopes: string[] = [],\n): React.ReactNodeArray {\n const schemas: React.ReactNodeArray = [];\n if (securitySchema) {\n if (securitySchema.name()) {\n schemas.push(<span>Name: {securitySchema.name()}</span>);\n }\n if (securitySchema.in()) {\n schemas.push(<span>In: {securitySchema.in()}</span>);\n }\n if (securitySchema.scheme()) {\n schemas.push(<span>Scheme: {securitySchema.scheme()}</span>);\n }\n if (securitySchema.bearerFormat()) {\n schemas.push(<span>Bearer format: {securitySchema.bearerFormat()}</span>);\n }\n if (securitySchema.openIdConnectUrl()) {\n schemas.push(\n <Href\n href={securitySchema.openIdConnectUrl() as string}\n className=\"underline\"\n >\n Connect URL\n </Href>,\n );\n }\n if (requiredScopes.length) {\n schemas.push(<span>Required scopes: {requiredScopes.join(', ')}</span>);\n }\n }\n return schemas;\n}\n\ninterface SecurityItemProps {\n securitySchema: SecuritySchemeInterface | null;\n protocol: string;\n requiredScopes?: string[];\n}\n\nconst SecurityItem: React.FunctionComponent<SecurityItemProps> = ({\n securitySchema,\n protocol,\n requiredScopes,\n}) => {\n const schemas: React.ReactNodeArray = collectSecuritySchemas(\n securitySchema,\n requiredScopes,\n );\n\n let renderedKafkaSecurity;\n if (['kafka', 'kafka-secure'].includes(protocol)) {\n const { securityProtocol, saslMechanism } = ServerHelpers.getKafkaSecurity(\n protocol,\n securitySchema,\n );\n\n renderedKafkaSecurity = (\n <div className=\"px-4 py-2 ml-2 mb-2 border border-gray-400 bg-gray-100 rounded\">\n {securityProtocol && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n security.protocol:\n </span>\n <span className=\"inline-block font-bold no-underline bg-indigo-400 text-white text-xs rounded py-0 px-1 ml-1\">\n {securityProtocol}\n </span>\n </div>\n )}\n {saslMechanism && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n sasl.mechanism:\n </span>\n <span className=\"inline-block font-bold no-underline bg-indigo-400 text-white text-xs rounded py-0 px-1 ml-1\">\n {saslMechanism}\n </span>\n </div>\n )}\n </div>\n );\n }\n\n const flows = securitySchema?.flows();\n const unwrappedFlows: Record<string, OAuthFlowInterface> = {};\n if (flows?.hasImplicit()) {\n unwrappedFlows.implicit = flows.implicit() as OAuthFlowInterface;\n }\n if (flows?.hasAuthorizationCode()) {\n unwrappedFlows.authorizationCode = flows.authorizationCode() as OAuthFlowInterface;\n }\n if (flows?.hasClientCredentials()) {\n unwrappedFlows.clientCredentials = flows.clientCredentials() as OAuthFlowInterface;\n }\n if (flows?.hasPassword()) {\n unwrappedFlows.password = flows.implicit() as OAuthFlowInterface;\n }\n const renderedFlows = Object.entries(unwrappedFlows).map(\n ([flowName, flow]) => {\n const authorizationUrl = flow.authorizationUrl();\n const tokenUrl = flow.tokenUrl();\n const refreshUrl = flow.refreshUrl();\n const scopes = flow.scopes();\n\n return (\n <div\n className=\"px-4 py-2 ml-2 mb-2 border border-gray-400 bg-gray-100 rounded\"\n key={flowName}\n >\n <div>\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Flow:\n </span>\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n {ServerHelpers.flowName(flowName)}\n </span>\n </div>\n\n {authorizationUrl && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Auth URL:\n </span>\n <Href href={authorizationUrl} className=\"underline\">\n {authorizationUrl}\n </Href>\n </div>\n )}\n {tokenUrl && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Token URL:\n </span>\n <Href href={tokenUrl} className=\"underline\">\n {tokenUrl}\n </Href>\n </div>\n )}\n {refreshUrl && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Refresh URL:\n </span>\n <Href href={refreshUrl} className=\"underline\">\n {refreshUrl}\n </Href>\n </div>\n )}\n {scopes && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Scopes:\n </span>\n <ul className=\"inline-block\">\n {scopes &&\n Object.entries(scopes).map(([scopeName, scopeDesc]) => (\n <li\n className=\"inline-block font-bold no-underline bg-indigo-400 text-white text-xs rounded py-0 px-1 ml-1\"\n title={scopeDesc}\n key={scopeName}\n >\n {scopeName}\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n },\n );\n\n return (\n <div>\n {securitySchema && schemas && (\n <div>\n <span>\n {ServerHelpers.securityType(securitySchema.type())}\n {schemas.length > 0 && (\n <ul className=\"inline-block ml-2\">\n {schemas.map((schema, idx) => (\n <li\n className=\"inline-block font-bold no-underline bg-blue-400 text-white text-xs uppercase rounded px-2 py-0 ml-1\"\n key={idx}\n >\n {schema}\n </li>\n ))}\n </ul>\n )}\n </span>\n </div>\n )}\n\n {securitySchema && securitySchema.hasDescription() && (\n <div>\n <Markdown>{securitySchema.description()}</Markdown>\n </div>\n )}\n\n {renderedFlows && renderedFlows.length > 0 && (\n <ul className=\"my-2\">\n <li>{renderedFlows}</li>\n </ul>\n )}\n\n {renderedKafkaSecurity && <div>{renderedKafkaSecurity}</div>}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"Security.js","sourceRoot":"","sources":["../../../../src/containers/Servers/Security.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQ9C,MAAM,CAAC,IAAM,QAAQ,GAAmC,UAAC,EAIxD;QAHC,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,cAAmB,EAAnB,MAAM,mBAAG,UAAU,KAAA;IAEnB,IAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;IAC3B,IAAM,eAAe,GACnB,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,eAAe,EAAE,CAAC;IAE9E,IAAI,kBAAkB,CAAC;IACvB,IACE,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA;QACjB,CAAC,eAAe;QAChB,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,EACpC;QACA,IAAI,QAAQ,K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AAS,EAAC,cAAc,IACzB,MAAM;oBACL,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,EAAsB;4BAArB,SAAS,QAAA,EAAE,SAAS,QAAA;wBAAM,OAAA,CACrD,4BACE,SAAS,EAAC,6FAA6F,EACvG,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,SAAS,IAEb,SAAS,CACP,CACN;oBARsD,CAQtD,CAAC,CACD,CACD,CACP,CACG,CACP,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,CACL;QACG,cAAc,IAAI,OAAO,IAAI,CAC5B;YACE;gBACG,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;gBACjD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,4BAAI,SAAS,EAAC,mBAAmB,IAC9B,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,CAC5B,4BACE,SAAS,EAAC,qGAAqG,EAC/G,GAAG,EAAE,GAAG,IAEP,MAAM,CACJ,CACN,EAP6B,CAO7B,CAAC,CACC,CACN,CACI,CACH,CACP;QAEA,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,cAAc,EAAE,KAAI,CACnC;YACE,oBAAC,QAAQ,QAAE,cAAc,CAAC,WAAW,EAAE,CAAY,CAC/C,CACP;QAEA,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC5C,4BAAI,SAAS,EAAC,MAAM;YAClB,gCAAK,aAAa,CAAM,CACrB,CACN;QAEA,qBAAqB,IAAI,iCAAM,qBAAqB,CAAO,CACxD,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n OAuthFlowInterface,\n SecurityRequirementsInterface,\n SecuritySchemeInterface,\n} from '@asyncapi/parser';\n\nimport { Href, Markdown } from '../../components';\nimport { useSpec } from '../../contexts';\nimport { ServerHelpers } from '../../helpers';\n\ninterface Props {\n security: SecurityRequirementsInterface[];\n protocol?: string;\n header?: string;\n}\n\nexport const Security: React.FunctionComponent<Props> = ({\n security = [],\n protocol = '',\n header = 'Security',\n}) => {\n const asyncapi = useSpec();\n const securitySchemes =\n !asyncapi.components().isEmpty() && asyncapi.components().securitySchemes();\n\n let renderedSecurities;\n if (\n !security?.length ||\n !securitySchemes ||\n !Object.keys(securitySchemes).length\n ) {\n if (protocol === 'kafka' || protocol === 'kafka-secure') {\n renderedSecurities = (\n <SecurityItem protocol={protocol} securitySchema={null} />\n );\n }\n } else {\n const securities: React.ReactNodeArray = Object.values(security)\n .map(requirement => {\n const requirements = requirement.all();\n const key = Object.keys(requirements)[0];\n const def = securitySchemes[String(key)];\n const requiredScopes: string[] = requirements[String(key)];\n\n if (!def) {\n return null;\n }\n return (\n <SecurityItem\n protocol={protocol}\n securitySchema={def}\n requiredScopes={requiredScopes}\n key={def.type()}\n />\n );\n })\n .filter(Boolean);\n\n renderedSecurities = (\n <ul>\n {securities.map((s, idx) => (\n <li className=\"mt-2\" key={idx}>\n {s}\n </li>\n ))}\n </ul>\n );\n }\n\n if (!renderedSecurities) {\n return null;\n }\n\n return (\n <div className=\"text-sm mt-4\">\n <h5 className=\"text-gray-800\">{header}:</h5>\n {renderedSecurities}\n </div>\n );\n};\n\nfunction collectSecuritySchemas(\n securitySchema: SecuritySchemeInterface | null,\n requiredScopes: string[] = [],\n): React.ReactNodeArray {\n const schemas: React.ReactNodeArray = [];\n if (securitySchema) {\n if (securitySchema.name()) {\n schemas.push(<span>Name: {securitySchema.name()}</span>);\n }\n if (securitySchema.in()) {\n schemas.push(<span>In: {securitySchema.in()}</span>);\n }\n if (securitySchema.scheme()) {\n schemas.push(<span>Scheme: {securitySchema.scheme()}</span>);\n }\n if (securitySchema.bearerFormat()) {\n schemas.push(<span>Bearer format: {securitySchema.bearerFormat()}</span>);\n }\n if (securitySchema.openIdConnectUrl()) {\n schemas.push(\n <Href\n href={securitySchema.openIdConnectUrl() as string}\n className=\"underline\"\n >\n Connect URL\n </Href>,\n );\n }\n if (requiredScopes.length) {\n schemas.push(<span>Required scopes: {requiredScopes.join(', ')}</span>);\n }\n }\n return schemas;\n}\n\ninterface SecurityItemProps {\n securitySchema: SecuritySchemeInterface | null;\n protocol: string;\n requiredScopes?: string[];\n}\n\nconst SecurityItem: React.FunctionComponent<SecurityItemProps> = ({\n securitySchema,\n protocol,\n requiredScopes,\n}) => {\n const schemas: React.ReactNodeArray = collectSecuritySchemas(\n securitySchema,\n requiredScopes,\n );\n\n let renderedKafkaSecurity;\n if (['kafka', 'kafka-secure'].includes(protocol)) {\n const { securityProtocol, saslMechanism } = ServerHelpers.getKafkaSecurity(\n protocol,\n securitySchema,\n );\n\n renderedKafkaSecurity = (\n <div className=\"px-4 py-2 ml-2 mb-2 border border-gray-400 bg-gray-100 rounded\">\n {securityProtocol && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n security.protocol:\n </span>\n <span className=\"inline-block font-bold no-underline bg-indigo-400 text-white text-xs rounded py-0 px-1 ml-1\">\n {securityProtocol}\n </span>\n </div>\n )}\n {saslMechanism && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n sasl.mechanism:\n </span>\n <span className=\"inline-block font-bold no-underline bg-indigo-400 text-white text-xs rounded py-0 px-1 ml-1\">\n {saslMechanism}\n </span>\n </div>\n )}\n </div>\n );\n }\n\n const flows = securitySchema?.flows();\n const unwrappedFlows: Record<string, OAuthFlowInterface> = {};\n if (flows?.hasImplicit()) {\n unwrappedFlows.implicit = flows.implicit() as OAuthFlowInterface;\n }\n if (flows?.hasAuthorizationCode()) {\n unwrappedFlows.authorizationCode = flows.authorizationCode() as OAuthFlowInterface;\n }\n if (flows?.hasClientCredentials()) {\n unwrappedFlows.clientCredentials = flows.clientCredentials() as OAuthFlowInterface;\n }\n if (flows?.hasPassword()) {\n unwrappedFlows.password = flows.implicit() as OAuthFlowInterface;\n }\n const renderedFlows = Object.entries(unwrappedFlows).map(\n ([flowName, flow]) => {\n const authorizationUrl = flow.authorizationUrl();\n const tokenUrl = flow.tokenUrl();\n const refreshUrl = flow.refreshUrl();\n const scopes = flow.scopes();\n\n return (\n <div\n className=\"px-4 py-2 ml-2 mb-2 border border-gray-400 bg-gray-100 rounded\"\n key={flowName}\n >\n <div>\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Flow:\n </span>\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n {ServerHelpers.flowName(flowName)}\n </span>\n </div>\n\n {authorizationUrl && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Auth URL:\n </span>\n <Href href={authorizationUrl} className=\"underline\">\n {authorizationUrl}\n </Href>\n </div>\n )}\n {tokenUrl && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Token URL:\n </span>\n <Href href={tokenUrl} className=\"underline\">\n {tokenUrl}\n </Href>\n </div>\n )}\n {refreshUrl && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Refresh URL:\n </span>\n <Href href={refreshUrl} className=\"underline\">\n {refreshUrl}\n </Href>\n </div>\n )}\n {scopes && (\n <div className=\"mt-1\">\n <span className=\"text-xs font-bold text-gray-600 mt-1 mr-1 uppercase\">\n Scopes:\n </span>\n <ul className=\"inline-block\">\n {scopes &&\n Object.entries(scopes).map(([scopeName, scopeDesc]) => (\n <li\n className=\"inline-block font-bold no-underline bg-indigo-400 text-white text-xs rounded py-0 px-1 ml-1\"\n title={scopeDesc}\n key={scopeName}\n >\n {scopeName}\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n },\n );\n\n return (\n <div>\n {securitySchema && schemas && (\n <div>\n <span>\n {ServerHelpers.securityType(securitySchema.type())}\n {schemas.length > 0 && (\n <ul className=\"inline-block ml-2\">\n {schemas.map((schema, idx) => (\n <li\n className=\"inline-block font-bold no-underline bg-blue-400 text-white text-xs uppercase rounded px-2 py-0 ml-1\"\n key={idx}\n >\n {schema}\n </li>\n ))}\n </ul>\n )}\n </span>\n </div>\n )}\n\n {securitySchema?.hasDescription() && (\n <div>\n <Markdown>{securitySchema.description()}</Markdown>\n </div>\n )}\n\n {renderedFlows && renderedFlows.length > 0 && (\n <ul className=\"my-2\">\n <li>{renderedFlows}</li>\n </ul>\n )}\n\n {renderedKafkaSecurity && <div>{renderedKafkaSecurity}</div>}\n </div>\n );\n};\n"]}
@@ -46,7 +46,7 @@ var MessageHelpers = (function () {
46
46
  }
47
47
  }
48
48
  var payload = msg.payload();
49
- if (payload && payload.examples()) {
49
+ if (payload === null || payload === void 0 ? void 0 : payload.examples()) {
50
50
  return (_a = payload.examples()) === null || _a === void 0 ? void 0 : _a.map(function (example) { return ({ example: example }); });
51
51
  }
52
52
  return;
@@ -72,10 +72,10 @@ var MessageHelpers = (function () {
72
72
  }
73
73
  }
74
74
  var headers = msg.headers();
75
- if (headers && headers.examples()) {
75
+ if (headers === null || headers === void 0 ? void 0 : headers.examples()) {
76
76
  return (_a = headers.examples()) === null || _a === void 0 ? void 0 : _a.map(function (example) { return ({ example: example }); });
77
77
  }
78
- return;
78
+ return undefined;
79
79
  };
80
80
  return MessageHelpers;
81
81
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/helpers/message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC;IAAA;IAsFA,CAAC;IArFQ,8BAAe,GAAtB,UAAuB,MAAW,EAAE,OAAiB;QAAjB,wBAAA,EAAA,YAAiB;QACnD,IAAI;YACF,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SAC5D;QAAC,OAAO,CAAC,EA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AED,OAAO;IACT,CAAC;IACH,qBAAC;AAAD,CAAC,AAtFD,IAsFC","sourcesContent":["import { MessageInterface } from '@asyncapi/parser';\n// @ts-ignore\nimport { sample } from 'openapi-sampler';\n\nimport { MessageExample } from '../types';\n\nexport class MessageHelpers {\n static generateExample(schema: any, options: any = {}) {\n try {\n return this.sanitizeExample(sample(schema, options)) || '';\n } catch (e) {\n return '';\n }\n }\n\n static sanitizeExample(schema: any): any {\n if (typeof schema === 'object' && schema && !Array.isArray(schema)) {\n return Object.entries(schema).reduce((obj, [propertyName, property]) => {\n if (\n !propertyName.startsWith('x-parser-') &&\n !propertyName.startsWith('x-schema-private-')\n ) {\n obj[propertyName] = this.sanitizeExample(property);\n }\n return obj;\n }, {});\n }\n return schema;\n }\n\n static getPayloadExamples(\n msg: MessageInterface,\n ): MessageExample[] | undefined {\n const examples = msg.examples().all();\n\n if (examples.some(e => e.hasPayload())) {\n const messageExamples = examples\n .flatMap(e => {\n if (!e.payload()) {\n return;\n }\n return {\n name: e.name(),\n summary: e.summary(),\n example: e.payload(),\n };\n })\n .filter(Boolean) as MessageExample[];\n\n if (messageExamples.length > 0) {\n return messageExamples;\n }\n }\n\n const payload = msg.payload();\n if (payload && payload.examples()) {\n return payload.examples()?.map(example => ({ example }));\n }\n\n return;\n }\n\n static getHeadersExamples(\n msg: MessageInterface,\n ): MessageExample[] | undefined {\n const examples = msg.examples().all();\n if (examples.some(e => e.hasHeaders())) {\n const messageExamples = examples\n .flatMap(e => {\n if (!e.hasHeaders()) {\n return;\n }\n return {\n name: e.name(),\n summary: e.summary(),\n example: e.headers(),\n };\n })\n .filter(Boolean) as MessageExample[];\n\n if (messageExamples.length > 0) {\n return messageExamples;\n }\n }\n\n const headers = msg.headers();\n if (headers && headers.examples()) {\n return headers.examples()?.map(example => ({ example }));\n }\n\n return;\n }\n}\n"]}
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/helpers/message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,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e,CAAC;aACxB;SACF;QAED,IAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAAE,EAAE;YACvB,OAAO,MAAA,OAAO,CAAC,QAAQ,EAAE,0CAAE,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,EAAb,CAAa,CAAC,CAAC;SAC1D;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACH,qBAAC;AAAD,CAAC,AApFD,IAoFC","sourcesContent":["import { MessageInterface } from '@asyncapi/parser';\n// @ts-ignore\nimport { sample } from 'openapi-sampler';\n\nimport { MessageExample } from '../types';\n\nexport class MessageHelpers {\n static generateExample(schema: any, options: any = {}) {\n try {\n return this.sanitizeExample(sample(schema, options)) || '';\n } catch (e) {\n return '';\n }\n }\n\n static sanitizeExample(schema: any): any {\n if (typeof schema === 'object' && schema && !Array.isArray(schema)) {\n return Object.entries(schema).reduce((obj, [propertyName, property]) => {\n if (\n !propertyName.startsWith('x-parser-') &&\n !propertyName.startsWith('x-schema-private-')\n ) {\n obj[propertyName] = this.sanitizeExample(property);\n }\n return obj;\n }, {});\n }\n return schema;\n }\n\n static getPayloadExamples(\n msg: MessageInterface,\n ): MessageExample[] | undefined {\n const examples = msg.examples().all();\n\n if (examples.some(e => e.hasPayload())) {\n const messageExamples = examples\n .flatMap(e => {\n if (!e.payload()) {\n return;\n }\n return {\n name: e.name(),\n summary: e.summary(),\n example: e.payload(),\n };\n })\n .filter(Boolean) as MessageExample[];\n\n if (messageExamples.length > 0) {\n return messageExamples;\n }\n }\n\n const payload = msg.payload();\n if (payload?.examples()) {\n return payload.examples()?.map(example => ({ example }));\n }\n return;\n }\n\n static getHeadersExamples(\n msg: MessageInterface,\n ): MessageExample[] | undefined {\n const examples = msg.examples().all();\n if (examples.some(e => e.hasHeaders())) {\n const messageExamples = examples\n .flatMap(e => {\n if (!e.hasHeaders()) {\n return;\n }\n return {\n name: e.name(),\n summary: e.summary(),\n example: e.headers(),\n };\n })\n .filter(Boolean) as MessageExample[];\n\n if (messageExamples.length > 0) {\n return messageExamples;\n }\n }\n\n const headers = msg.headers();\n if (headers?.examples()) {\n return headers.examples()?.map(example => ({ example }));\n }\n return undefined;\n }\n}\n"]}
@@ -90,6 +90,15 @@ var SchemaHelpers = (function () {
90
90
  }
91
91
  return type;
92
92
  };
93
+ SchemaHelpers.applicatorSchemaName = function (idx, firstCase, otherCases, title) {
94
+ var suffix = (title !== null && " ".concat(title, ":")) || ":";
95
+ if (idx === 0) {
96
+ return "".concat(firstCase).concat(suffix);
97
+ }
98
+ else {
99
+ return "".concat(otherCases).concat(suffix);
100
+ }
101
+ };
93
102
  SchemaHelpers.prettifyValue = function (value, strict) {
94
103
  if (strict === void 0) { strict = true; }
95
104
  var typeOf = typeof value;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/helpers/schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAIL,QAAQ,IAAI,WAAW,GAGxB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAE3B,gCAAW,CAAA;IAEX,sDAAiC,CAAA;IAEjC,oCAAe,CAAA;IAEf,wCAAmB,CAAA;AACrB,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED,IAAM,eAAe,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;IACR,MAAM;CACP,CAAC;AACF,IAAM,sBAAsB,GAA2B;IAErD,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,QAAQ;IACjB,gBAAgB,EAAE,QAAQ;IAC1B,eAAe,EAAE,QAAQ;IAEzB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,QAAQ;IACjB,gBAAg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K,EAAE,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAzB,CAAyB,CAAC;;gBAChD,GAAC,IAAI,CAAC,uBAAuB,IAAG,KAAK;mBACrC;SACH;QACD;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,EAAM;wBAAL,CAAC,QAAA,EAAE,CAAC,QAAA;oBAClD,GAAG,CAAC,CAAC,CAAC,GAAG,KAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;oBACnC,OAAO,GAAG,CAAC;gBACb,CAAC,EAAE,EAAE,CAAC;;YACN,GAAC,IAAI,CAAC,uBAAuB,IAAG,KAAK;eACrC;IACJ,CAAC;IAEc,0BAAY,GAA3B,UAA4B,KAAU;QACpC,IACE,KAAK;YACL,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;gBACnC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;oBACxB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,EAA5B,CAA4B,CAAC,CAAC,CAAC,EAClE;YACA,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IA1dM,qCAAuB,GAAG,yCAAyC,CAAC;IACpE,yBAAW,GAAG,4BAA4B,CAAC;IAC3C,kCAAoB,GAAG,qCAAqC,CAAC;IAydtE,oBAAC;CAAA,AA5dD,IA4dC;SA5dY,aAAa","sourcesContent":["import {\n SchemaInterface,\n ChannelParametersInterface,\n ServerVariablesInterface,\n SchemaV2 as SchemaClass,\n ExtensionInterface,\n ExtensionsInterface,\n} from '@asyncapi/parser';\n\nexport enum SchemaCustomTypes {\n // for `true` and `{}` schemas\n ANY = 'any',\n // for schemas without `type` keyword\n RESTRICTED_ANY = 'restricted any',\n // for `false` and `{ not: {}, ... }` schemas\n NEVER = 'never',\n // for types that we cannot infer\n UNKNOWN = 'unknown',\n}\n\nconst jsonSchemaTypes = [\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'array',\n 'object',\n 'null',\n];\nconst jsonSchemaKeywordTypes: Record<string, string> = {\n // string\n maxLength: 'string',\n minLength: 'string',\n pattern: 'string',\n contentMediaType: 'string',\n contentEncoding: 'string',\n // number\n multipleOf: 'number',\n maximum: 'number',\n exclusiveMaximum: 'number',\n minimum: 'number',\n exclusiveMinimum: 'number',\n // array\n items: 'array',\n maxItems: 'array',\n minItems: 'array',\n uniqueItems: 'array',\n contains: 'array',\n additionalItems: 'array',\n // object\n maxProperties: 'object',\n minProperties: 'object',\n required: 'object',\n properties: 'object',\n patternProperties: 'object',\n propertyNames: 'object',\n dependencies: 'object',\n additionalProperties: 'object',\n};\nconst jsonSchemaKeywords = Object.keys(jsonSchemaKeywordTypes);\n\nexport class SchemaHelpers {\n static extRenderAdditionalInfo = 'x-schema-private-render-additional-info';\n static extRawValue = 'x-schema-private-raw-value';\n static extParameterLocation = 'x-schema-private-parameter-location';\n\n static toSchemaType(schema: SchemaInterface): string {\n if (!schema || typeof schema.json !== 'function') {\n return SchemaCustomTypes.UNKNOWN;\n }\n if (schema.isBooleanSchema()) {\n if (schema.json() === true) {\n return SchemaCustomTypes.ANY;\n } else {\n return SchemaCustomTypes.NEVER;\n }\n }\n // handle case with `{}` schemas\n if (Object.keys(schema.json()).length === 0) {\n return SchemaCustomTypes.ANY;\n }\n // handle case with `{ not: {}, ... }` schemas\n const not = schema.not();\n if (not && this.inferType(not) === SchemaCustomTypes.ANY) {\n return SchemaCustomTypes.NEVER;\n }\n\n let type = this.inferType(schema);\n if (Array.isArray(type)) {\n return type.map(t => this.toType(t, schema)).join(' | ');\n }\n type = this.toType(type, schema);\n const combinedType = this.toCombinedType(schema);\n\n if (type && combinedType) {\n return `${type} ${combinedType}`;\n }\n if (combinedType) {\n return combinedType;\n }\n return type;\n }\n\n static prettifyValue(value: any, strict = true): string {\n const typeOf = typeof value;\n if (typeOf === 'string') {\n return strict ? `\"${value}\"` : value;\n }\n if (typeOf === 'number' || typeOf === 'bigint' || typeOf === 'boolean') {\n return `${value}`;\n }\n if (Array.isArray(value)) {\n return `[${value.toString()}]`;\n }\n return JSON.stringify(value);\n }\n\n static humanizeConstraints(schema: SchemaInterface): string[] {\n const constraints: string[] = [];\n\n // related to number/integer\n const numberRange = this.humanizeNumberRangeConstraint(\n schema.minimum(),\n schema.exclusiveMinimum(),\n schema.maximum(),\n schema.exclusiveMaximum(),\n );\n if (numberRange !== undefined) {\n constraints.push(numberRange);\n }\n const multipleOfConstraint = this.humanizeMultipleOfConstraint(\n schema.multipleOf(),\n );\n if (multipleOfConstraint !== undefined) {\n constraints.push(multipleOfConstraint);\n }\n\n // related to string\n const stringRange = this.humanizeRangeConstraint(\n 'characters',\n schema.minLength(),\n schema.maxLength(),\n );\n if (stringRange !== undefined) {\n constraints.push(stringRange);\n }\n\n // related to array\n const hasUniqueItems = schema.uniqueItems();\n const arrayRange = this.humanizeRangeConstraint(\n hasUniqueItems ? 'unique items' : 'items',\n schema.minItems(),\n schema.maxItems(),\n );\n if (arrayRange !== undefined) {\n constraints.push(arrayRange);\n }\n\n // related to object\n const objectRange = this.humanizeRangeConstraint(\n 'properties',\n schema.minProperties(),\n schema.maxProperties(),\n );\n if (objectRange !== undefined) {\n constraints.push(objectRange);\n }\n\n return constraints;\n }\n\n static isExpandable(schema: SchemaInterface): boolean {\n let type = this.inferType(schema);\n type = Array.isArray(type) ? type : [type];\n if (type.includes('object') || type.includes('array')) {\n return true;\n }\n\n if (\n schema.oneOf() ||\n schema.anyOf() ||\n schema.allOf() ||\n Object.keys(schema.properties() || {}).length > 0 ||\n schema.items() ||\n schema.not() ||\n schema.if() ||\n schema.then() ||\n schema.else()\n ) {\n return true;\n }\n\n const customExtensions = this.getCustomExtensions(schema);\n if (customExtensions && Object.keys(customExtensions).length) {\n return true;\n }\n\n return false;\n }\n\n static serverVariablesToSchema(\n urlVariables?: ServerVariablesInterface,\n ): SchemaInterface | undefined {\n if (!urlVariables || urlVariables.length === 0) {\n return undefined;\n }\n const obj = {};\n urlVariables.all().forEach(variable => {\n obj[variable.id()] = { ...(variable.json() || {}) };\n obj[variable.id()].type = 'string';\n });\n\n const json = {\n type: 'object',\n properties: obj,\n required: Object.keys(obj),\n [this.extRenderAdditionalInfo]: false,\n };\n return new SchemaClass(json as any);\n }\n\n static parametersToSchema(\n parameters?: ChannelParametersInterface,\n ): SchemaInterface | undefined {\n if (!parameters || parameters.isEmpty()) {\n return undefined;\n }\n const obj = {};\n parameters.all().forEach(parameter => {\n const parameterSchema = parameter.schema();\n obj[parameter.id()] = { ...(parameterSchema?.json() ?? {}) };\n obj[parameter.id()].description = parameter.hasDescription()\n ? parameter.description()\n : undefined;\n obj[parameter.id()][this.extParameterLocation] = parameter.hasLocation()\n ? parameter.location()\n : undefined;\n });\n\n const json = {\n type: 'object',\n properties: obj,\n required: Object.keys(obj),\n [this.extRenderAdditionalInfo]: false,\n };\n return new SchemaClass(json as any);\n }\n\n static jsonToSchema(value: any): any {\n const json = this.jsonFieldToSchema(value);\n return new SchemaClass(json);\n }\n\n /**\n * Retrieves from given value all custom extensions (value with key started by `x-`).\n * However, it skips those private extensions that begin with `x-parser-` and `x-schema-private-`.\n *\n * @param value\n */\n static getCustomExtensions(value: any) {\n if (!value || typeof value.extensions !== 'function') {\n return;\n }\n const extensions = value.extensions() as ExtensionsInterface;\n const filteredExtensions = {};\n for (const ext of extensions.all()) {\n const extType = ext as ExtensionInterface;\n if (\n !extType.id().startsWith('x-parser-') &&\n !extType.id().startsWith('x-schema-private-')\n ) {\n filteredExtensions[extType.id()] = extType.value();\n }\n }\n return filteredExtensions;\n }\n\n /**\n * Retrieves from given schema all dependent required requires by given propertyName from `dependencies` object.\n *\n * @param propertyName\n * @param schema\n */\n static getDependentRequired(\n propertyName: string,\n schema: SchemaInterface,\n ): string[] | undefined {\n const dependentRequired: string[] = [];\n const dependencies = schema.dependencies();\n if (!dependencies) {\n return;\n }\n\n for (const [prop, array] of Object.entries(dependencies)) {\n if (Array.isArray(array) && array.includes(propertyName)) {\n dependentRequired.push(prop);\n }\n }\n return dependentRequired.length ? dependentRequired : undefined;\n }\n\n /**\n * Retrieves from given schema all dependent schemas from `dependencies` object.\n *\n * @param schema\n */\n static getDependentSchemas(\n schema: SchemaInterface,\n ): SchemaInterface | undefined {\n const dependencies = schema.dependencies();\n if (!dependencies) {\n return;\n }\n\n const records: Record<string, SchemaInterface> = {};\n for (const [prop, propSchema] of Object.entries(dependencies)) {\n if (typeof propSchema === 'object' && !Array.isArray(propSchema)) {\n records[prop] = propSchema;\n }\n }\n if (!Object.keys(records).length) {\n return undefined;\n }\n\n const json = {\n type: 'object',\n properties: Object.entries(records).reduce(\n (obj, [propertyName, propertySchema]) => {\n obj[propertyName] = { ...(propertySchema.json() || {}) };\n return obj;\n },\n {},\n ),\n [this.extRenderAdditionalInfo]: false,\n };\n return new SchemaClass(json as any);\n }\n\n private static toType(type: string, schema: SchemaInterface): string {\n if (schema.isCircular()) {\n return type;\n }\n if (type === 'array') {\n const items = schema.items();\n if (Array.isArray(items)) {\n return this.toItemsType(items, schema);\n }\n if (!items) {\n return `array<${SchemaCustomTypes.ANY}>`;\n }\n return `array<${this.toSchemaType(items) || SchemaCustomTypes.UNKNOWN}>`;\n }\n return type;\n }\n\n private static toItemsType(\n items: SchemaInterface[],\n schema: SchemaInterface,\n ): string {\n const types = items.map(item => this.toSchemaType(item)).join(', ');\n const additionalItems = schema.additionalItems();\n if (additionalItems !== undefined && additionalItems !== false) {\n const additionalType =\n additionalItems === true\n ? SchemaCustomTypes.ANY\n : this.toSchemaType(additionalItems);\n return `tuple<${types ||\n SchemaCustomTypes.UNKNOWN}, ...optional<${additionalType}>>`;\n }\n return `tuple<${types || SchemaCustomTypes.UNKNOWN}>`;\n }\n\n private static toCombinedType(schema: SchemaInterface): string | undefined {\n const oneOf = schema.oneOf();\n if (oneOf) {\n return 'oneOf';\n }\n if (schema.anyOf()) {\n return 'anyOf';\n }\n if (schema.allOf()) {\n return 'allOf';\n }\n return;\n }\n\n private static inferType(schema: SchemaInterface): string[] | string {\n let types = schema.type();\n\n if (types !== undefined) {\n if (Array.isArray(types)) {\n // if types have `integer` and `number` types, `integer` is unnecessary\n if (types.includes('integer') && types.includes('number')) {\n types = types.filter(t => t !== 'integer');\n }\n return types.length === 1 ? types[0] : types;\n }\n return types;\n }\n\n const constValue = schema.const();\n if (constValue !== undefined) {\n return typeof constValue;\n }\n const enumValue = schema.enum();\n if (Array.isArray(enumValue) && enumValue.length) {\n const inferredType = Array.from(new Set(enumValue.map(e => typeof e)));\n return inferredType.length === 1 ? inferredType[0] : inferredType;\n }\n\n const schemaKeys = Object.keys(schema.json() || {}) || [];\n const hasInferredTypes = jsonSchemaKeywords.some(key =>\n schemaKeys.includes(key),\n );\n if (hasInferredTypes === true) {\n return SchemaCustomTypes.RESTRICTED_ANY;\n }\n if (this.toCombinedType(schema)) {\n return '';\n }\n return SchemaCustomTypes.ANY;\n }\n\n private static humanizeNumberRangeConstraint(\n min: number | undefined,\n exclusiveMin: number | undefined,\n max: number | undefined,\n exclusiveMax: number | undefined,\n ): string | undefined {\n const hasExclusiveMin = exclusiveMin !== undefined;\n const hasMin = min !== undefined || hasExclusiveMin;\n const hasExclusiveMax = exclusiveMax !== undefined;\n const hasMax = max !== undefined || hasExclusiveMax;\n\n let numberRange;\n if (hasMin && hasMax) {\n numberRange = hasExclusiveMin ? '( ' : '[ ';\n numberRange += hasExclusiveMin ? exclusiveMin : min;\n numberRange += ' .. ';\n numberRange += hasExclusiveMax ? exclusiveMax : max;\n numberRange += hasExclusiveMax ? ' )' : ' ]';\n } else if (hasMin) {\n numberRange = hasExclusiveMin ? '> ' : '>= ';\n numberRange += hasExclusiveMin ? exclusiveMin : min;\n } else if (hasMax) {\n numberRange = hasExclusiveMax ? '< ' : '<= ';\n numberRange += hasExclusiveMax ? exclusiveMax : max;\n }\n return numberRange;\n }\n\n private static humanizeMultipleOfConstraint(\n multipleOf: number | undefined,\n ): string | undefined {\n if (multipleOf === undefined) {\n return;\n }\n const strigifiedMultipleOf = multipleOf.toString(10);\n if (!/^0\\.0*1$/.test(strigifiedMultipleOf)) {\n return `multiple of ${strigifiedMultipleOf}`;\n }\n return `decimal places <= ${strigifiedMultipleOf.split('.')[1].length}`;\n }\n\n private static humanizeRangeConstraint(\n description: string,\n min: number | undefined,\n max: number | undefined,\n ): string | undefined {\n let stringRange;\n if (min !== undefined && max !== undefined) {\n if (min === max) {\n stringRange = `${min} ${description}`;\n } else {\n stringRange = `[ ${min} .. ${max} ] ${description}`;\n }\n } else if (max !== undefined) {\n stringRange = `<= ${max} ${description}`;\n } else if (min !== undefined) {\n if (min === 1) {\n stringRange = 'non-empty';\n } else {\n stringRange = `>= ${min} ${description}`;\n }\n }\n return stringRange;\n }\n\n private static jsonFieldToSchema(value: any): any {\n if (value === undefined || value === null) {\n return {\n type: 'string',\n const: '',\n [this.extRawValue]: true,\n };\n }\n if (typeof value !== 'object') {\n const str =\n typeof value.toString === 'function' ? value.toString() : value;\n return {\n type: 'string',\n const: str,\n [this.extRawValue]: true,\n };\n }\n if (this.isJSONSchema(value)) {\n return value;\n }\n if (Array.isArray(value)) {\n return {\n type: 'array',\n items: value.map(v => this.jsonFieldToSchema(v)),\n [this.extRenderAdditionalInfo]: false,\n };\n }\n return {\n type: 'object',\n properties: Object.entries(value).reduce((obj, [k, v]) => {\n obj[k] = this.jsonFieldToSchema(v);\n return obj;\n }, {}),\n [this.extRenderAdditionalInfo]: false,\n };\n }\n\n private static isJSONSchema(value: any): boolean {\n if (\n value &&\n typeof value === 'object' &&\n (jsonSchemaTypes.includes(value.type) ||\n (Array.isArray(value.type) &&\n value.type.some((t: string) => !jsonSchemaTypes.includes(t))))\n ) {\n return true;\n }\n return false;\n }\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/helpers/schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAIL,QAAQ,IAAI,WAAW,GAGxB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAE3B,gCAAW,CAAA;IAEX,sDAAiC,CAAA;IAEjC,oCAAe,CAAA;IAEf,wCAAmB,CAAA;AACrB,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED,IAAM,eAAe,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;IACR,MAAM;CACP,CAAC;AACF,IAAM,sBAAsB,GAA2B;IAErD,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,QAAQ;IACjB,gBAAgB,EAAE,QAAQ;IAC1B,eAAe,EAAE,QAAQ;IAEzB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,QAAQ;IACjB,gBAAgB,EAAE,QAAQ;IAC1B,OAAO,EAAE,QAAQ;IACjB,gBAAgB,EAAE,QAAQ;IAE1B,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,OAAO;IACjB,WAAW,EAAE,OAAO;IACpB,QAAQ,EAAE,OAAO;IACjB,eAAe,EAAE,OAAO;IAExB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,QAAQ;IACpB,iBAAiB,EAAE,QAAQ;IAC3B,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE,QAAQ;IACtB,oBAAoB,EAAE,QAAQ;CAC/B,CAAC;AACF,IAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;A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AI,EAAE,QAAQ;gBACd,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,EAAM;wBAAL,CAAC,QAAA,EAAE,CAAC,QAAA;oBAClD,GAAG,CAAC,CAAC,CAAC,GAAG,KAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;oBACnC,OAAO,GAAG,CAAC;gBACb,CAAC,EAAE,EAAE,CAAC;;YACN,GAAC,IAAI,CAAC,uBAAuB,IAAG,KAAK;eACrC;IACJ,CAAC;IAEc,0BAAY,GAA3B,UAA4B,KAAU;QACpC,IACE,KAAK;YACL,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;gBACnC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;oBACxB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,EAA5B,CAA4B,CAAC,CAAC,CAAC,EAClE;YACA,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAxeM,qCAAuB,GAAG,yCAAyC,CAAC;IACpE,yBAAW,GAAG,4BAA4B,CAAC;IAC3C,kCAAoB,GAAG,qCAAqC,CAAC;IAuetE,oBAAC;CAAA,AA1eD,IA0eC;SA1eY,aAAa","sourcesContent":["import {\n SchemaInterface,\n ChannelParametersInterface,\n ServerVariablesInterface,\n SchemaV2 as SchemaClass,\n ExtensionInterface,\n ExtensionsInterface,\n} from '@asyncapi/parser';\n\nexport enum SchemaCustomTypes {\n // for `true` and `{}` schemas\n ANY = 'any',\n // for schemas without `type` keyword\n RESTRICTED_ANY = 'restricted any',\n // for `false` and `{ not: {}, ... }` schemas\n NEVER = 'never',\n // for types that we cannot infer\n UNKNOWN = 'unknown',\n}\n\nconst jsonSchemaTypes = [\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'array',\n 'object',\n 'null',\n];\nconst jsonSchemaKeywordTypes: Record<string, string> = {\n // string\n maxLength: 'string',\n minLength: 'string',\n pattern: 'string',\n contentMediaType: 'string',\n contentEncoding: 'string',\n // number\n multipleOf: 'number',\n maximum: 'number',\n exclusiveMaximum: 'number',\n minimum: 'number',\n exclusiveMinimum: 'number',\n // array\n items: 'array',\n maxItems: 'array',\n minItems: 'array',\n uniqueItems: 'array',\n contains: 'array',\n additionalItems: 'array',\n // object\n maxProperties: 'object',\n minProperties: 'object',\n required: 'object',\n properties: 'object',\n patternProperties: 'object',\n propertyNames: 'object',\n dependencies: 'object',\n additionalProperties: 'object',\n};\nconst jsonSchemaKeywords = Object.keys(jsonSchemaKeywordTypes);\n\nexport class SchemaHelpers {\n static extRenderAdditionalInfo = 'x-schema-private-render-additional-info';\n static extRawValue = 'x-schema-private-raw-value';\n static extParameterLocation = 'x-schema-private-parameter-location';\n\n static toSchemaType(schema: SchemaInterface): string {\n if (!schema || typeof schema.json !== 'function') {\n return SchemaCustomTypes.UNKNOWN;\n }\n if (schema.isBooleanSchema()) {\n if (schema.json() === true) {\n return SchemaCustomTypes.ANY;\n } else {\n return SchemaCustomTypes.NEVER;\n }\n }\n // handle case with `{}` schemas\n if (Object.keys(schema.json()).length === 0) {\n return SchemaCustomTypes.ANY;\n }\n // handle case with `{ not: {}, ... }` schemas\n const not = schema.not();\n if (not && this.inferType(not) === SchemaCustomTypes.ANY) {\n return SchemaCustomTypes.NEVER;\n }\n\n let type = this.inferType(schema);\n if (Array.isArray(type)) {\n return type.map(t => this.toType(t, schema)).join(' | ');\n }\n type = this.toType(type, schema);\n const combinedType = this.toCombinedType(schema);\n\n if (type && combinedType) {\n return `${type} ${combinedType}`;\n }\n if (combinedType) {\n return combinedType;\n }\n return type;\n }\n\n static applicatorSchemaName(\n idx: number,\n firstCase: string,\n otherCases: string,\n title?: string,\n ) {\n const suffix = (title !== null && ` ${title}:`) || `:`;\n if (idx === 0) {\n return `${firstCase}${suffix}`;\n } else {\n return `${otherCases}${suffix}`;\n }\n }\n\n static prettifyValue(value: any, strict = true): string {\n const typeOf = typeof value;\n if (typeOf === 'string') {\n return strict ? `\"${value}\"` : value;\n }\n if (typeOf === 'number' || typeOf === 'bigint' || typeOf === 'boolean') {\n return `${value}`;\n }\n if (Array.isArray(value)) {\n return `[${value.toString()}]`;\n }\n return JSON.stringify(value);\n }\n\n static humanizeConstraints(schema: SchemaInterface): string[] {\n const constraints: string[] = [];\n\n // related to number/integer\n const numberRange = this.humanizeNumberRangeConstraint(\n schema.minimum(),\n schema.exclusiveMinimum(),\n schema.maximum(),\n schema.exclusiveMaximum(),\n );\n if (numberRange !== undefined) {\n constraints.push(numberRange);\n }\n const multipleOfConstraint = this.humanizeMultipleOfConstraint(\n schema.multipleOf(),\n );\n if (multipleOfConstraint !== undefined) {\n constraints.push(multipleOfConstraint);\n }\n\n // related to string\n const stringRange = this.humanizeRangeConstraint(\n 'characters',\n schema.minLength(),\n schema.maxLength(),\n );\n if (stringRange !== undefined) {\n constraints.push(stringRange);\n }\n\n // related to array\n const hasUniqueItems = schema.uniqueItems();\n const arrayRange = this.humanizeRangeConstraint(\n hasUniqueItems ? 'unique items' : 'items',\n schema.minItems(),\n schema.maxItems(),\n );\n if (arrayRange !== undefined) {\n constraints.push(arrayRange);\n }\n\n // related to object\n const objectRange = this.humanizeRangeConstraint(\n 'properties',\n schema.minProperties(),\n schema.maxProperties(),\n );\n if (objectRange !== undefined) {\n constraints.push(objectRange);\n }\n\n return constraints;\n }\n\n static isExpandable(schema: SchemaInterface): boolean {\n let type = this.inferType(schema);\n type = Array.isArray(type) ? type : [type];\n if (type.includes('object') || type.includes('array')) {\n return true;\n }\n\n if (\n schema.oneOf() ||\n schema.anyOf() ||\n schema.allOf() ||\n Object.keys(schema.properties() || {}).length > 0 ||\n schema.items() ||\n schema.not() ||\n schema.if() ||\n schema.then() ||\n schema.else()\n ) {\n return true;\n }\n\n const customExtensions = this.getCustomExtensions(schema);\n if (customExtensions && Object.keys(customExtensions).length) {\n return true;\n }\n\n return false;\n }\n\n static serverVariablesToSchema(\n urlVariables?: ServerVariablesInterface,\n ): SchemaInterface | undefined {\n if (!urlVariables || urlVariables.length === 0) {\n return undefined;\n }\n const obj = {};\n urlVariables.all().forEach(variable => {\n obj[variable.id()] = { ...(variable.json() || {}) };\n obj[variable.id()].type = 'string';\n });\n\n const json = {\n type: 'object',\n properties: obj,\n required: Object.keys(obj),\n [this.extRenderAdditionalInfo]: false,\n };\n return new SchemaClass(json as any);\n }\n\n static parametersToSchema(\n parameters?: ChannelParametersInterface,\n ): SchemaInterface | undefined {\n if (!parameters || parameters.isEmpty()) {\n return undefined;\n }\n const obj = {};\n parameters.all().forEach(parameter => {\n const parameterSchema = parameter.schema();\n obj[parameter.id()] = { ...(parameterSchema?.json() ?? {}) };\n obj[parameter.id()].description = parameter.hasDescription()\n ? parameter.description()\n : undefined;\n obj[parameter.id()][this.extParameterLocation] = parameter.hasLocation()\n ? parameter.location()\n : undefined;\n });\n\n const json = {\n type: 'object',\n properties: obj,\n required: Object.keys(obj),\n [this.extRenderAdditionalInfo]: false,\n };\n return new SchemaClass(json as any);\n }\n\n static jsonToSchema(value: any): any {\n const json = this.jsonFieldToSchema(value);\n return new SchemaClass(json);\n }\n\n /**\n * Retrieves from given value all custom extensions (value with key started by `x-`).\n * However, it skips those private extensions that begin with `x-parser-` and `x-schema-private-`.\n *\n * @param value\n */\n static getCustomExtensions(value: any) {\n if (!value || typeof value.extensions !== 'function') {\n return;\n }\n const extensions = value.extensions() as ExtensionsInterface;\n const filteredExtensions = {};\n for (const ext of extensions.all()) {\n const extType = ext as ExtensionInterface;\n if (\n !extType.id().startsWith('x-parser-') &&\n !extType.id().startsWith('x-schema-private-')\n ) {\n filteredExtensions[extType.id()] = extType.value();\n }\n }\n return filteredExtensions;\n }\n\n /**\n * Retrieves from given schema all dependent required requires by given propertyName from `dependencies` object.\n *\n * @param propertyName\n * @param schema\n */\n static getDependentRequired(\n propertyName: string,\n schema: SchemaInterface,\n ): string[] | undefined {\n const dependentRequired: string[] = [];\n const dependencies = schema.dependencies();\n if (!dependencies) {\n return;\n }\n\n for (const [prop, array] of Object.entries(dependencies)) {\n if (Array.isArray(array) && array.includes(propertyName)) {\n dependentRequired.push(prop);\n }\n }\n return dependentRequired.length ? dependentRequired : undefined;\n }\n\n /**\n * Retrieves from given schema all dependent schemas from `dependencies` object.\n *\n * @param schema\n */\n static getDependentSchemas(\n schema: SchemaInterface,\n ): SchemaInterface | undefined {\n const dependencies = schema.dependencies();\n if (!dependencies) {\n return;\n }\n\n const records: Record<string, SchemaInterface> = {};\n for (const [prop, propSchema] of Object.entries(dependencies)) {\n if (typeof propSchema === 'object' && !Array.isArray(propSchema)) {\n records[prop] = propSchema;\n }\n }\n if (!Object.keys(records).length) {\n return undefined;\n }\n\n const json = {\n type: 'object',\n properties: Object.entries(records).reduce(\n (obj, [propertyName, propertySchema]) => {\n obj[propertyName] = { ...(propertySchema.json() || {}) };\n return obj;\n },\n {},\n ),\n [this.extRenderAdditionalInfo]: false,\n };\n return new SchemaClass(json as any);\n }\n\n private static toType(type: string, schema: SchemaInterface): string {\n if (schema.isCircular()) {\n return type;\n }\n if (type === 'array') {\n const items = schema.items();\n if (Array.isArray(items)) {\n return this.toItemsType(items, schema);\n }\n if (!items) {\n return `array<${SchemaCustomTypes.ANY}>`;\n }\n return `array<${this.toSchemaType(items) || SchemaCustomTypes.UNKNOWN}>`;\n }\n return type;\n }\n\n private static toItemsType(\n items: SchemaInterface[],\n schema: SchemaInterface,\n ): string {\n const types = items.map(item => this.toSchemaType(item)).join(', ');\n const additionalItems = schema.additionalItems();\n if (additionalItems !== undefined && additionalItems !== false) {\n const additionalType =\n additionalItems === true\n ? SchemaCustomTypes.ANY\n : this.toSchemaType(additionalItems);\n return `tuple<${types ||\n SchemaCustomTypes.UNKNOWN}, ...optional<${additionalType}>>`;\n }\n return `tuple<${types || SchemaCustomTypes.UNKNOWN}>`;\n }\n\n private static toCombinedType(schema: SchemaInterface): string | undefined {\n const oneOf = schema.oneOf();\n if (oneOf) {\n return 'oneOf';\n }\n if (schema.anyOf()) {\n return 'anyOf';\n }\n if (schema.allOf()) {\n return 'allOf';\n }\n return;\n }\n\n private static inferType(schema: SchemaInterface): string[] | string {\n let types = schema.type();\n\n if (types !== undefined) {\n if (Array.isArray(types)) {\n // if types have `integer` and `number` types, `integer` is unnecessary\n if (types.includes('integer') && types.includes('number')) {\n types = types.filter(t => t !== 'integer');\n }\n return types.length === 1 ? types[0] : types;\n }\n return types;\n }\n\n const constValue = schema.const();\n if (constValue !== undefined) {\n return typeof constValue;\n }\n const enumValue = schema.enum();\n if (Array.isArray(enumValue) && enumValue.length) {\n const inferredType = Array.from(new Set(enumValue.map(e => typeof e)));\n return inferredType.length === 1 ? inferredType[0] : inferredType;\n }\n\n const schemaKeys = Object.keys(schema.json() || {}) || [];\n const hasInferredTypes = jsonSchemaKeywords.some(key =>\n schemaKeys.includes(key),\n );\n if (hasInferredTypes === true) {\n return SchemaCustomTypes.RESTRICTED_ANY;\n }\n if (this.toCombinedType(schema)) {\n return '';\n }\n return SchemaCustomTypes.ANY;\n }\n\n private static humanizeNumberRangeConstraint(\n min: number | undefined,\n exclusiveMin: number | undefined,\n max: number | undefined,\n exclusiveMax: number | undefined,\n ): string | undefined {\n const hasExclusiveMin = exclusiveMin !== undefined;\n const hasMin = min !== undefined || hasExclusiveMin;\n const hasExclusiveMax = exclusiveMax !== undefined;\n const hasMax = max !== undefined || hasExclusiveMax;\n\n let numberRange;\n if (hasMin && hasMax) {\n numberRange = hasExclusiveMin ? '( ' : '[ ';\n numberRange += hasExclusiveMin ? exclusiveMin : min;\n numberRange += ' .. ';\n numberRange += hasExclusiveMax ? exclusiveMax : max;\n numberRange += hasExclusiveMax ? ' )' : ' ]';\n } else if (hasMin) {\n numberRange = hasExclusiveMin ? '> ' : '>= ';\n numberRange += hasExclusiveMin ? exclusiveMin : min;\n } else if (hasMax) {\n numberRange = hasExclusiveMax ? '< ' : '<= ';\n numberRange += hasExclusiveMax ? exclusiveMax : max;\n }\n return numberRange;\n }\n\n private static humanizeMultipleOfConstraint(\n multipleOf: number | undefined,\n ): string | undefined {\n if (multipleOf === undefined) {\n return;\n }\n const strigifiedMultipleOf = multipleOf.toString(10);\n if (!/^0\\.0*1$/.test(strigifiedMultipleOf)) {\n return `multiple of ${strigifiedMultipleOf}`;\n }\n return `decimal places <= ${strigifiedMultipleOf.split('.')[1].length}`;\n }\n\n private static humanizeRangeConstraint(\n description: string,\n min: number | undefined,\n max: number | undefined,\n ): string | undefined {\n let stringRange;\n if (min !== undefined && max !== undefined) {\n if (min === max) {\n stringRange = `${min} ${description}`;\n } else {\n stringRange = `[ ${min} .. ${max} ] ${description}`;\n }\n } else if (max !== undefined) {\n stringRange = `<= ${max} ${description}`;\n } else if (min !== undefined) {\n if (min === 1) {\n stringRange = 'non-empty';\n } else {\n stringRange = `>= ${min} ${description}`;\n }\n }\n return stringRange;\n }\n\n private static jsonFieldToSchema(value: any): any {\n if (value === undefined || value === null) {\n return {\n type: 'string',\n const: '',\n [this.extRawValue]: true,\n };\n }\n if (typeof value !== 'object') {\n const str =\n typeof value.toString === 'function' ? value.toString() : value;\n return {\n type: 'string',\n const: str,\n [this.extRawValue]: true,\n };\n }\n if (this.isJSONSchema(value)) {\n return value;\n }\n if (Array.isArray(value)) {\n return {\n type: 'array',\n items: value.map(v => this.jsonFieldToSchema(v)),\n [this.extRenderAdditionalInfo]: false,\n };\n }\n return {\n type: 'object',\n properties: Object.entries(value).reduce((obj, [k, v]) => {\n obj[k] = this.jsonFieldToSchema(v);\n return obj;\n }, {}),\n [this.extRenderAdditionalInfo]: false,\n };\n }\n\n private static isJSONSchema(value: any): boolean {\n if (\n value &&\n typeof value === 'object' &&\n (jsonSchemaTypes.includes(value.type) ||\n (Array.isArray(value.type) &&\n value.type.some((t: string) => !jsonSchemaTypes.includes(t))))\n ) {\n return true;\n }\n return false;\n }\n}\n"]}
@@ -56,13 +56,11 @@ var ServerHelpers = (function () {
56
56
  securityProtocol = 'PLAINTEXT';
57
57
  }
58
58
  }
59
+ else if (securitySchema) {
60
+ securityProtocol = 'SASL_SSL';
61
+ }
59
62
  else {
60
- if (securitySchema) {
61
- securityProtocol = 'SASL_SSL';
62
- }
63
- else {
64
- securityProtocol = 'SSL';
65
- }
63
+ securityProtocol = 'SSL';
66
64
  }
67
65
  if (securitySchema) {
68
66
  switch (securitySchema.type()) {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/helpers/server.ts"],"names":[],"mappings":"AAEA;IAAA;IA2FA,CAAC;IA1FQ,0BAAY,GAAnB,UAAoB,KAAa;QAC/B,QAAQ,KAAK,EAAE;YACb,KAAK,QAAQ;gBACX,OAAO,SAAS,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB,KAAK,eAAe;gBAClB,OAAO,SAAS,CAAC;YACnB,KAAK,MAAM;gBACT,OAAO,MAAM,CAAC;YAChB,KAAK,cAAc;gBACjB,OAAO,eAAe,CAAC;YACzB,KAAK,MAAM;gBACT,OAAO,OAAO,CAAC;YACjB,KAAK,qBAAqB;gBACxB,OAAO,sBAAsB,CAAC;YAChC,KAAK,sBAAsB;gBACzB,OAAO,uBAAuB,CAAC;YACjC,KAAK,YAAY;gBACf,OAAO,cAAc,CAAC;YACxB,KAAK,aAAa;gBAChB,OAAO,aAAa,CAAC;YACvB,KAAK,aAAa;gBAChB,OAAO,aAAa,CAAC;YACvB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC;IAEM,sBAAQ,GAAf,UAAgB,KAAa;QAC3B,QAAQ,KAAK,EAAE;YACb,KAAK,UAAU;gBACb,OAAO,UAAU,CAAC;YACpB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAC;YACpB,KAAK,mBAAmB;gBACtB,OAAO,oBAAoB,CAAC;YAC9B,KAAK,mBAAmB;gBACtB,OAAO,oBAAoB,CAAC;YAC9B;gBACE,OAAO,UAAU,CAAC;SACrB;IACH,CAAC;IAEM,8BAAgB,GAAvB,UACE,QAAgB,EAChB,cAA8C;QAE9C,IAAI,gBAAgB,CAAC;QACrB,IAAI,aAAa,CAAC;QAClB,IAAI,QAAQ,KAAK,OAAO,EAAE;YACxB,IAAI,cAAc,EAAE;gBAClB,gBAAgB,GAAG,gBAAgB,CAAC;aACrC;iBAAM;gBACL,gBAAgB,GAAG,WAAW,CAAC;aAChC;SACF;aAAM;YACL,IAAI,cAAc,EAAE;gBAClB,gBAAgB,GAAG,UAAU,CAAC;aAC/B;iBAAM;gBACL,gBAAgB,GAAG,KAAK,CAAC;aAC1B;SACF;QACD,IAAI,cAAc,EAAE;YAClB,QAAQ,cAAc,CAAC,IAAI,EAAE,EAAE;gBAC7B,KAAK,OAAO;oBACV,aAAa,GAAG,OAAO,CAAC;oBACxB,MAAM;gBACR,KAAK,aAAa;oBAChB,aAAa,GAAG,eAAe,CAAC;oBAChC,MAAM;gBACR,KAAK,aAAa;oBAChB,aAAa,GAAG,eAAe,CAAC;oBAChC,MAAM;gBACR,KAAK,QAAQ;oBACX,aAAa,GAAG,aAAa,CAAC;oBAC9B,MAAM;gBACR,KAAK,QAAQ;oBACX,aAAa,GAAG,QAAQ,CAAC;oBACzB,MAAM;gBACR,KAAK,MAAM;oBACT,gBAAgB,GAAG,KAAK,CAAC;oBACzB,MAAM;aACT;SACF;QAED,OAAO,EAAE,gBAAgB,kBAAA,EAAE,aAAa,eAAA,EAAE,CAAC;IAC7C,CAAC;IACH,oBAAC;AAAD,CAAC,AA3FD,IA2FC","sourcesContent":["import { SecuritySchemeInterface } from '@asyncapi/parser';\n\nexport class ServerHelpers {\n static securityType(value: string) {\n switch (value) {\n case 'apiKey':\n return 'API key';\n case 'oauth2':\n return 'OAuth2';\n case 'openIdConnect':\n return 'Open ID';\n case 'http':\n return 'HTTP';\n case 'userPassword':\n return 'User/Password';\n case 'X509':\n return 'X509:';\n case 'symmetricEncryption':\n return 'Symmetric Encription';\n case 'asymmetricEncryption':\n return 'Asymmetric Encription';\n case 'httpApiKey':\n return 'HTTP API key';\n case 'scramSha256':\n return 'ScramSha256';\n case 'scramSha512':\n return 'ScramSha512';\n case 'gssapi':\n return 'GSSAPI';\n default:\n return 'API key';\n }\n }\n\n static flowName(value: string) {\n switch (value) {\n case 'implicit':\n return 'Implicit';\n case 'password':\n return 'Password';\n case 'clientCredentials':\n return 'Client credentials';\n case 'authorizationCode':\n return 'Authorization Code';\n default:\n return 'Implicit';\n }\n }\n\n static getKafkaSecurity(\n protocol: string,\n securitySchema: SecuritySchemeInterface | null,\n ) {\n let securityProtocol;\n let saslMechanism;\n if (protocol === 'kafka') {\n if (securitySchema) {\n securityProtocol = 'SASL_PLAINTEXT';\n } else {\n securityProtocol = 'PLAINTEXT';\n }\n } else {\n if (securitySchema) {\n securityProtocol = 'SASL_SSL';\n } else {\n securityProtocol = 'SSL';\n }\n }\n if (securitySchema) {\n switch (securitySchema.type()) {\n case 'plain':\n saslMechanism = 'PLAIN';\n break;\n case 'scramSha256':\n saslMechanism = 'SCRAM-SHA-256';\n break;\n case 'scramSha512':\n saslMechanism = 'SCRAM-SHA-512';\n break;\n case 'oauth2':\n saslMechanism = 'OAUTHBEARER';\n break;\n case 'gssapi':\n saslMechanism = 'GSSAPI';\n break;\n case 'X509':\n securityProtocol = 'SSL';\n break;\n }\n }\n\n return { securityProtocol, saslMechanism };\n }\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/helpers/server.ts"],"names":[],"mappings":"AAEA;IAAA;IA0FA,CAAC;IAzFQ,0BAAY,GAAnB,UAAoB,KAAa;QAC/B,QAAQ,KAAK,EAAE;YACb,KAAK,QAAQ;gBACX,OAAO,SAAS,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB,KAA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OAAO,CAAC;oBACxB,MAAM;gBACR,KAAK,aAAa;oBAChB,aAAa,GAAG,eAAe,CAAC;oBAChC,MAAM;gBACR,KAAK,aAAa;oBAChB,aAAa,GAAG,eAAe,CAAC;oBAChC,MAAM;gBACR,KAAK,QAAQ;oBACX,aAAa,GAAG,aAAa,CAAC;oBAC9B,MAAM;gBACR,KAAK,QAAQ;oBACX,aAAa,GAAG,QAAQ,CAAC;oBACzB,MAAM;gBACR,KAAK,MAAM;oBACT,gBAAgB,GAAG,KAAK,CAAC;oBACzB,MAAM;aACT;SACF;QAED,OAAO,EAAE,gBAAgB,kBAAA,EAAE,aAAa,eAAA,EAAE,CAAC;IAC7C,CAAC;IACH,oBAAC;AAAD,CAAC,AA1FD,IA0FC","sourcesContent":["import { SecuritySchemeInterface } from '@asyncapi/parser';\n\nexport class ServerHelpers {\n static securityType(value: string) {\n switch (value) {\n case 'apiKey':\n return 'API key';\n case 'oauth2':\n return 'OAuth2';\n case 'openIdConnect':\n return 'Open ID';\n case 'http':\n return 'HTTP';\n case 'userPassword':\n return 'User/Password';\n case 'X509':\n return 'X509:';\n case 'symmetricEncryption':\n return 'Symmetric Encription';\n case 'asymmetricEncryption':\n return 'Asymmetric Encription';\n case 'httpApiKey':\n return 'HTTP API key';\n case 'scramSha256':\n return 'ScramSha256';\n case 'scramSha512':\n return 'ScramSha512';\n case 'gssapi':\n return 'GSSAPI';\n default:\n return 'API key';\n }\n }\n\n static flowName(value: string) {\n switch (value) {\n case 'implicit':\n return 'Implicit';\n case 'password':\n return 'Password';\n case 'clientCredentials':\n return 'Client credentials';\n case 'authorizationCode':\n return 'Authorization Code';\n default:\n return 'Implicit';\n }\n }\n\n static getKafkaSecurity(\n protocol: string,\n securitySchema: SecuritySchemeInterface | null,\n ) {\n let securityProtocol;\n let saslMechanism;\n if (protocol === 'kafka') {\n if (securitySchema) {\n securityProtocol = 'SASL_PLAINTEXT';\n } else {\n securityProtocol = 'PLAINTEXT';\n }\n } else if (securitySchema) {\n securityProtocol = 'SASL_SSL';\n } else {\n securityProtocol = 'SSL';\n }\n\n if (securitySchema) {\n switch (securitySchema.type()) {\n case 'plain':\n saslMechanism = 'PLAIN';\n break;\n case 'scramSha256':\n saslMechanism = 'SCRAM-SHA-256';\n break;\n case 'scramSha512':\n saslMechanism = 'SCRAM-SHA-512';\n break;\n case 'oauth2':\n saslMechanism = 'OAUTHBEARER';\n break;\n case 'gssapi':\n saslMechanism = 'GSSAPI';\n break;\n case 'X509':\n securityProtocol = 'SSL';\n break;\n }\n }\n\n return { securityProtocol, saslMechanism };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKnD,UAAU,KAAK;IACb,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAOD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAwUjD,CAAC"}
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/components/Schema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKnD,UAAU,KAAK;IACb,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAOD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAuVjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Standalone.d.ts","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Standalone.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,eAAe,EAAiB,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,cAAM,iBAAkB,SAAQ,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACrE,KAAK,EAAE,aAAa,CAGlB;gBAEU,KAAK,EAAE,aAAa;IAU1B,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,EAAE,aAAa;IASjD,MAAM;IAsCN,OAAO,CAAC,WAAW;CAQpB;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"Standalone.d.ts","sourceRoot":"","sources":["../../../../src/containers/AsyncApi/Standalone.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,eAAe,EAAiB,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,cAAM,iBAAkB,SAAQ,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACrE,KAAK,EAAE,aAAa,CAGlB;gBAEU,KAAK,EAAE,aAAa;IAS1B,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,EAAE,aAAa;IASjD,MAAM;IAsCN,OAAO,CAAC,WAAW;CAQpB;AAED,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../../src/containers/Servers/Security.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,6BAA6B,EAE9B,MAAM,kBAAkB,CAAC;AAM1B,UAAU,KAAK;IACb,QAAQ,EAAE,6BAA6B,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAgEnD,CAAC"}
1
+ {"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../../src/containers/Servers/Security.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,6BAA6B,EAE9B,MAAM,kBAAkB,CAAC;AAM1B,UAAU,KAAK;IACb,QAAQ,EAAE,6BAA6B,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CA+DnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/helpers/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,qBAAa,cAAc;IACzB,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,GAAE,GAAQ;IAQrD,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG;IAexC,MAAM,CAAC,kBAAkB,CACvB,GAAG,EAAE,gBAAgB,GACpB,cAAc,EAAE,GAAG,SAAS;IA8B/B,MAAM,CAAC,kBAAkB,CACvB,GAAG,EAAE,gBAAgB,GACpB,cAAc,EAAE,GAAG,SAAS;CA4BhC"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/helpers/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,qBAAa,cAAc;IACzB,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,GAAE,GAAQ;IAQrD,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG;IAexC,MAAM,CAAC,kBAAkB,CACvB,GAAG,EAAE,gBAAgB,GACpB,cAAc,EAAE,GAAG,SAAS;IA6B/B,MAAM,CAAC,kBAAkB,CACvB,GAAG,EAAE,gBAAgB,GACpB,cAAc,EAAE,GAAG,SAAS;CA2BhC"}
@@ -10,6 +10,7 @@ export declare class SchemaHelpers {
10
10
  static extRawValue: string;
11
11
  static extParameterLocation: string;
12
12
  static toSchemaType(schema: SchemaInterface): string;
13
+ static applicatorSchemaName(idx: number, firstCase: string, otherCases: string, title?: string): string;
13
14
  static prettifyValue(value: any, strict?: boolean): string;
14
15
  static humanizeConstraints(schema: SchemaInterface): string[];
15
16
  static isExpandable(schema: SchemaInterface): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/helpers/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAE1B,oBAAY,iBAAiB;IAE3B,GAAG,QAAQ;IAEX,cAAc,mBAAmB;IAEjC,KAAK,UAAU;IAEf,OAAO,YAAY;CACpB;AA2CD,qBAAa,aAAa;IACxB,MAAM,CAAC,uBAAuB,SAA6C;IAC3E,MAAM,CAAC,WAAW,SAAgC;IAClD,MAAM,CAAC,oBAAoB,SAAyC;IAEpE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;IAqCpD,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,UAAO,GAAG,MAAM;IAcvD,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE;IAsD7D,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;IA6BrD,MAAM,CAAC,uBAAuB,CAC5B,YAAY,CAAC,EAAE,wBAAwB,GACtC,eAAe,GAAG,SAAS;IAmB9B,MAAM,CAAC,kBAAkB,CACvB,UAAU,CAAC,EAAE,0BAA0B,GACtC,eAAe,GAAG,SAA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AAC,KAAK,EAAE,MAAM;IA+BjC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAe7B,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,uBAAuB,GAAG,IAAI;;;;CA0CjD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/helpers/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,aAAa;IACxB,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM;IA+BjC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAe7B,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,uBAAuB,GAAG,IAAI;;;;CAyCjD"}