@redocly/reference-docs 2.7.5 → 2.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli/commands/redocly-docs-cli.min.js +3042 -331
- package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +367 -0
- package/dist/console.redocly-reference-docs.min.js +484 -21
- package/dist/oauth2-redirect.js +5 -3
- package/dist/redocly-reference-docs.min.js +3426 -109
- package/lib/components/index.d.ts +3 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/redoc-lib/src/components/ContentItems/ContentItems.js +1 -1
- package/lib/redoc-lib/src/components/Markdown/SanitizedMdBlock.js +1 -1
- package/lib/redoc-lib/src/components/RequestSamples/useCodeSamples.js +1 -1
- package/lib/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
- package/lib/redoc-lib/src/index.d.ts +2 -1
- package/lib/redoc-lib/src/index.js +1 -1
- package/lib/redoc-lib/src/services/OpenAPIParser.js +1 -1
- package/lib/redoc-lib/src/services/SearchStore.d.ts +1 -1
- package/lib/redoc-lib/src/services/SearchStore.js +2 -51
- package/lib/redoc-lib/src/services/SearchWorker.worker.js +1 -1
- package/lib/redoc-lib/src/styled-components.d.ts +1 -1
- package/lib/redoc-lib/src/theme.js +1 -1
- package/lib/redoc-lib/src/utils/loadAndBundleSpec.d.ts +1 -1
- package/lib/redoc-lib/src/utils/openapi.js +1 -1
- package/lib/services/ProMenu.js +1 -1
- package/lib/services/ProStore.d.ts +1 -1
- package/lib/services/ProStore.js +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +1 -1
- package/lib-esm/components/index.d.ts +3 -2
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/index.js +1 -1
- package/lib-esm/redoc-lib/src/components/ContentItems/ContentItems.js +1 -1
- package/lib-esm/redoc-lib/src/components/Markdown/SanitizedMdBlock.js +1 -1
- package/lib-esm/redoc-lib/src/components/RequestSamples/useCodeSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
- package/lib-esm/redoc-lib/src/index.d.ts +2 -1
- package/lib-esm/redoc-lib/src/index.js +1 -1
- package/lib-esm/redoc-lib/src/services/OpenAPIParser.js +1 -1
- package/lib-esm/redoc-lib/src/services/SearchStore.d.ts +1 -1
- package/lib-esm/redoc-lib/src/services/SearchStore.js +2 -51
- package/lib-esm/redoc-lib/src/services/SearchWorker.worker.js +1 -1
- package/lib-esm/redoc-lib/src/styled-components.d.ts +1 -1
- package/lib-esm/redoc-lib/src/theme.js +1 -1
- package/lib-esm/redoc-lib/src/utils/loadAndBundleSpec.d.ts +1 -1
- package/lib-esm/redoc-lib/src/utils/openapi.js +1 -1
- package/lib-esm/services/ProMenu.js +1 -1
- package/lib-esm/services/ProStore.d.ts +1 -1
- package/lib-esm/services/ProStore.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/code-helpers.js +1 -1
- package/package.json +19 -32
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a,_b;import{darken,lighten,readableColor,transparentize}from"polished";import{ZERO_BREAKPOINT}from"./utils/media-css";var defaultTheme={spacing:{unit:5,sectionHorizontal:function(r){return 8*r.spacing.unit},sectionVertical:function(r){return 4*r.spacing.unit}},breakpoints:{small:"50rem",medium:"85rem",large:"105rem"},colors:{tonalOffset:.2,primary:{main:"#0065FB",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.primary.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.primary.main)},contrastText:function(r){var o=r.colors;return readableColor(o.primary.main)}},secondary:{main:"#E4E7EB",light:"#F5F7FA",dark:"#E4E7EB",contrastText:"#3E4C59"},accent:{main:"#59C3FF",light:"#b3dcf3",dark:"#033B73",contrastText:"#ffffff"},success:{main:"#41DE50",light:function(r){var o=r.colors;return lighten(2*o.tonalOffset,o.success.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.success.main)},contrastText:function(r){var o=r.colors;return readableColor(o.success.main)}},warning:{main:"#ffa500",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.warning.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.warning.main)},contrastText:"#ffffff"},error:{main:"#FF6161",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.error.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.error.main)},contrastText:"#ffffff"},text:{primary:"#1F2933",secondary:"#7b8794",light:"#F5F7FA"},border:{dark:"#616E7C",light:"#E4E7EB"},responses:{success:{borderColor:"#B1E996",backgroundColor:"#F6FFF4",tabTextColor:function(r){return r.colors.responses.success.borderColor}},error:{borderColor:"#FFC9C9",backgroundColor:"#FFF4F4",tabTextColor:function(r){return r.colors.responses.error.borderColor}},redirect:{borderColor:function(r){return r.colors.warning.main},backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.redirect.borderColor)},tabTextColor:function(r){return r.colors.responses.redirect.borderColor}},info:{borderColor:"#87ceeb",backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.info.borderColor)},tabTextColor:function(r){return r.colors.responses.info.borderColor}}},http:{get:"#3A9601",post:"#0065FB",put:"#93527B",options:"#947014",patch:"#bf581d",delete:"#C83637",basic:"#707070",link:"#07818F",head:"#A23DAD"}},schema:{linesColor:function(r){return r.colors.border.light},defaultDetailsWidth:"70%",typeNameColor:function(r){return r.colors.text.secondary},typeTitleColor:function(r){return r.schema.typeNameColor},requireLabelColor:"#FF0000",labelsTextSize:"0.9em",nestingSpacing:"1em",nestedBackground:function(r){return r.colors.secondary.light},caretColor:function(r){return r.colors.text.primary},caretSize:"9px"},typography:{fontSize:"14px",lineHeight:"1.5em",fontWeightRegular:"400",fontWeightBold:"600",fontWeightLight:"300",fontFamily:"Source Sans Pro, sans-serif",smoothing:"antialiased",optimizeSpeed:!0,headings:{fontFamily:function(r){return r.typography.fontFamily},fontWeight:"700",lineHeight:"1.6em"},code:{fontSize:"13px",fontFamily:"Source Code Pro, monospace",lineHeight:function(r){return r.typography.lineHeight},fontWeight:function(r){return r.typography.fontWeightRegular},color:"#e53935",backgroundColor:"rgba(38, 50, 56, 0.05)",wrap:!1},links:{color:function(r){return r.colors.primary.main},visited:function(r){return r.typography.links.color},hover:function(r){var o=r.typography;return lighten(.2,o.links.color)},textDecoration:"auto"},fieldName:{fontSize:function(r){return r.typography.code.fontSize},fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.code.fontWeight}}},sidebar:{separatorLabelColor:function(r){return r.sidebar.textColor},separatorLineColor:"#DADADA",caretColor:function(r){return r.sidebar.textColor},caretSize:function(r){return r.sidebar.spacing.unit},spacing:{unit:8,paddingHorizontal:function(r){return r.sidebar.spacing.unit},paddingVertical:function(r){return r.sidebar.spacing.unit},offsetTop:function(r){return 2*r.sidebar.spacing.unit},offsetLeft:function(r){return 2*r.sidebar.spacing.unit},offsetNesting:function(r){return 2*r.sidebar.spacing.unit}},borderRadius:"4px",fontFamily:function(r){return r.typography.fontFamily},fontSize:function(r){return r.typography.fontSize},showAtBreakpoint:"small",width:"285px",backgroundColor:"#fff",rightLineColor:function(r){return r.colors.border.light},textColor:function(r){return r.colors.text.primary},activeTextColor:function(r){return r.sidebar.textColor},activeBgColor:function(r){return r.colors.border.light}},components:{buttons:{borderRadius:function(r){return r.shape.borderRadius},hoverStyle:"",fontWeight:function(r){return r.typography.fontWeightBold},boxShadow:"none",hoverBoxShadow:"0px 0px 12px 0px rgba(0, 0, 0, 0.1)",fontFamily:"inherit",sizes:{small:{fontSize:"12px",padding:"8px 10px",minWidth:"90px"},medium:{fontSize:"14px",padding:"8px 20px",minWidth:"120px"},large:{fontSize:"14px",padding:"12px 24px",minWidth:"150px"},xlarge:{fontSize:"16px",padding:"20px 24px",minWidth:"200px"}}},httpBadges:{borderRadius:"16px",fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.fontWeightBold},color:function(r){return r.colors.text.light},sizes:{medium:{fontSize:"12px",lineHeight:"20px"},small:{fontSize:"8px",lineHeight:"15px"}}},tryItButton:{fullWidth:!1},tryItSendButton:{fullWidth:!1},panels:{borderRadius:"8px"},layoutControls:{top:"20px",width:"36px",height:"36px"}},logo:{maxHeight:function(r){return r.sidebar.width},maxWidth:function(r){return r.sidebar.width},gutter:"2px"},rightPanel:{showAtBreakpoint:"medium",backgroundColor:"#1F2933",panelBackgroundColor:"#52606D",panelControlsBackgroundColor:"#323F4B",width:"37.5%",textColor:"#ffffff"},codeBlock:{backgroundColor:function(r){return r.rightPanel.panelControlsBackgroundColor}},shape:{borderRadius:"4px"},layout:{showDarkRightPanel:!
|
|
1
|
+
var _a,_b;import{darken,lighten,readableColor,transparentize}from"polished";import{ZERO_BREAKPOINT}from"./utils/media-css";var defaultTheme={spacing:{unit:5,sectionHorizontal:function(r){return 8*r.spacing.unit},sectionVertical:function(r){return 4*r.spacing.unit}},breakpoints:{small:"50rem",medium:"85rem",large:"105rem"},colors:{tonalOffset:.2,primary:{main:"#0065FB",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.primary.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.primary.main)},contrastText:function(r){var o=r.colors;return readableColor(o.primary.main)}},secondary:{main:"#E4E7EB",light:"#F5F7FA",dark:"#E4E7EB",contrastText:"#3E4C59"},accent:{main:"#59C3FF",light:"#b3dcf3",dark:"#033B73",contrastText:"#ffffff"},success:{main:"#41DE50",light:function(r){var o=r.colors;return lighten(2*o.tonalOffset,o.success.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.success.main)},contrastText:function(r){var o=r.colors;return readableColor(o.success.main)}},warning:{main:"#ffa500",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.warning.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.warning.main)},contrastText:"#ffffff"},error:{main:"#FF6161",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.error.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.error.main)},contrastText:"#ffffff"},text:{primary:"#1F2933",secondary:"#7b8794",light:"#F5F7FA"},border:{dark:"#616E7C",light:"#E4E7EB"},responses:{success:{borderColor:"#B1E996",backgroundColor:"#F6FFF4",tabTextColor:function(r){return r.colors.responses.success.borderColor}},error:{borderColor:"#FFC9C9",backgroundColor:"#FFF4F4",tabTextColor:function(r){return r.colors.responses.error.borderColor}},redirect:{borderColor:function(r){return r.colors.warning.main},backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.redirect.borderColor)},tabTextColor:function(r){return r.colors.responses.redirect.borderColor}},info:{borderColor:"#87ceeb",backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.info.borderColor)},tabTextColor:function(r){return r.colors.responses.info.borderColor}}},http:{get:"#3A9601",post:"#0065FB",put:"#93527B",options:"#947014",patch:"#bf581d",delete:"#C83637",basic:"#707070",link:"#07818F",head:"#A23DAD"}},schema:{linesColor:function(r){return r.colors.border.light},defaultDetailsWidth:"70%",typeNameColor:function(r){return r.colors.text.secondary},typeTitleColor:function(r){return r.schema.typeNameColor},requireLabelColor:"#FF0000",labelsTextSize:"0.9em",nestingSpacing:"1em",nestedBackground:function(r){return r.colors.secondary.light},caretColor:function(r){return r.colors.text.primary},caretSize:"9px"},typography:{fontSize:"14px",lineHeight:"1.5em",fontWeightRegular:"400",fontWeightBold:"600",fontWeightLight:"300",fontFamily:"Source Sans Pro, sans-serif",smoothing:"antialiased",optimizeSpeed:!0,headings:{fontFamily:function(r){return r.typography.fontFamily},fontWeight:"700",lineHeight:"1.6em"},code:{fontSize:"13px",fontFamily:"Source Code Pro, monospace",lineHeight:function(r){return r.typography.lineHeight},fontWeight:function(r){return r.typography.fontWeightRegular},color:"#e53935",backgroundColor:"rgba(38, 50, 56, 0.05)",wrap:!1},links:{color:function(r){return r.colors.primary.main},visited:function(r){return r.typography.links.color},hover:function(r){var o=r.typography;return lighten(.2,o.links.color)},textDecoration:"auto"},fieldName:{fontSize:function(r){return r.typography.code.fontSize},fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.code.fontWeight}}},sidebar:{separatorLabelColor:function(r){return r.sidebar.textColor},separatorLineColor:"#DADADA",caretColor:function(r){return r.sidebar.textColor},caretSize:function(r){return r.sidebar.spacing.unit},spacing:{unit:8,paddingHorizontal:function(r){return r.sidebar.spacing.unit},paddingVertical:function(r){return r.sidebar.spacing.unit},offsetTop:function(r){return 2*r.sidebar.spacing.unit},offsetLeft:function(r){return 2*r.sidebar.spacing.unit},offsetNesting:function(r){return 2*r.sidebar.spacing.unit}},borderRadius:"4px",fontFamily:function(r){return r.typography.fontFamily},fontSize:function(r){return r.typography.fontSize},showAtBreakpoint:"small",width:"285px",backgroundColor:"#fff",rightLineColor:function(r){return r.colors.border.light},textColor:function(r){return r.colors.text.primary},activeTextColor:function(r){return r.sidebar.textColor},activeBgColor:function(r){return r.colors.border.light}},components:{buttons:{borderRadius:function(r){return r.shape.borderRadius},hoverStyle:"",fontWeight:function(r){return r.typography.fontWeightBold},boxShadow:"none",hoverBoxShadow:"0px 0px 12px 0px rgba(0, 0, 0, 0.1)",fontFamily:"inherit",sizes:{small:{fontSize:"12px",padding:"8px 10px",minWidth:"90px"},medium:{fontSize:"14px",padding:"8px 20px",minWidth:"120px"},large:{fontSize:"14px",padding:"12px 24px",minWidth:"150px"},xlarge:{fontSize:"16px",padding:"20px 24px",minWidth:"200px"}}},httpBadges:{borderRadius:"16px",fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.fontWeightBold},color:function(r){return r.colors.text.light},sizes:{medium:{fontSize:"12px",lineHeight:"20px"},small:{fontSize:"8px",lineHeight:"15px"}}},tryItButton:{fullWidth:!1},tryItSendButton:{fullWidth:!1},panels:{borderRadius:"8px"},layoutControls:{top:"20px",width:"36px",height:"36px"}},logo:{maxHeight:function(r){return r.sidebar.width},maxWidth:function(r){return r.sidebar.width},gutter:"2px"},rightPanel:{showAtBreakpoint:"medium",backgroundColor:"#1F2933",panelBackgroundColor:"#52606D",panelControlsBackgroundColor:"#323F4B",width:"37.5%",textColor:"#ffffff"},codeBlock:{backgroundColor:function(r){return r.rightPanel.panelControlsBackgroundColor}},shape:{borderRadius:"4px"},layout:{showDarkRightPanel:!1,stacked:{maxWidth:(_a={},_a[ZERO_BREAKPOINT]="",_a.small="90%",_a.medium="75%",_a.large="1200px",_a)},"three-panel":{middlePanelMaxWidth:"none",maxWidth:(_b={},_b[ZERO_BREAKPOINT]="100%",_b.small="100%",_b.medium="100%",_b.large="1800px",_b)}}};export default defaultTheme;export function resolveTheme(r){var o={},t=0,n=function(e,i){Object.keys(e).forEach((function(a){var l=(i?i+".":"")+a,c=e[a];"function"==typeof c?Object.defineProperty(e,a,{get:function(){if(!o[l]){if(++t>1e3)throw new Error("Theme probably contains circular dependency at "+l+": "+c.toString());o[l]=c(r)}return o[l]},enumerable:!0}):"object"==typeof c&&n(c,l)}))};return n(r,""),JSON.parse(JSON.stringify(r))}
|
|
2
2
|
//# sourceMappingURL=theme.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from '@redocly/openapi-core';
|
|
2
|
-
import { OpenAPIDefinition } from '../types';
|
|
2
|
+
import type { OpenAPIDefinition } from '../types';
|
|
3
3
|
export declare function loadAndBundleDefinition(specUrlOrObject: GenericObject | string): Promise<OpenAPIDefinition>;
|
|
4
4
|
export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
|
|
5
5
|
export declare function convertSwagger2OpenAPI(spec: any): Promise<OpenAPIDefinition>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__spreadArray}from"tslib";import{dirname}from"path";import UrlTemplate from"url-template";import{IS_BROWSER}from"./dom";import{isNumeric,removeQueryString,resolveUrl}from"./helpers";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r){if(void 0===r&&(r=!1),"default"===e)return r?"error":"success";var t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");var i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}var operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationSummary(e){return e.summary||e.operationId||e.description&&e.description.substring(0,50)||"<no summary>"}var schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;for(var r=0,t=Object.keys(schemaKeywordTypes);r<t.length;r++){var i=t[r],n=schemaKeywordTypes[i];if(void 0!==e[i])return n}return"any"}export function isPrimitiveType(e,r){if(void 0===r&&(r=e.type),void 0!==e.oneOf||void 0!==e.anyOf)return!1;var t=!0,i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties),void 0!==e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return"application/x-www-form-urlencoded"===e}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((function(e){return e.toString()})).join(t):"object"==typeof e?Object.keys(e).map((function(r){return""+r+t+e[r]})).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((function(t){return e[t]?r+"["+t+"]="+e[t]:void 0})).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){var i,n="__redoc_param_name__",a=r?"*":"";return UrlTemplate.parse("{?"+n+a+"}").expand((i={},i[n]=t,i)).substring(1).replace(/__redoc_param_name__/g,e)}export function urlFormEncodePayload(e,r){if(void 0===r&&(r={}),Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((function(t){var i=e[t],n=r[t]||{},a=n.style,o=void 0===a?"form":a,s=n.explode,u=void 0===s||s;switch(o){case"form":return serializeFormValue(t,u,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+o),""}})).join("&")}function serializePathParameter(e,r,t,i){var n,a=t?"*":"",o="";"label"===r?o=".":"matrix"===r&&(o=";");var s="__redoc_param_name__";return UrlTemplate.parse("{"+o+s+a+"}").expand((n={},n[s]=i,n)).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){switch(r){case"form":return serializeFormValue(e,t,i);case"spaceDelimited":return Array.isArray(i)?t?serializeFormValue(e,t,i):e+"="+i.join("%20"):(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(i)?t?serializeFormValue(e,t,i):e+"="+i.join("|"):(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(i)||"object"!=typeof i?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(i,e);default:return console.warn("Unexpected style for query: "+r),""}}function serializeHeaderParameter(e,r,t){var i;switch(e){case"simple":var n=r?"*":"",a="__redoc_param_name__",o=UrlTemplate.parse("{"+a+n+"}");return decodeURIComponent(o.expand(((i={})[a]=t,i)));default:return console.warn("Unexpected style for header: "+e),""}}function serializeCookieParameter(e,r,t,i){switch(r){case"form":return serializeFormValue(e,t,i);default:return console.warn("Unexpected style for cookie: "+r),""}}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn("Parameter serialization as "+r+" is not supported"),"")}export function serializeParameterValue(e,r){var t=e.name,i=e.style,n=e.explode,a=void 0!==n&&n,o=e.serializationMime;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return t+"="+serializeParameterValueWithMime(r,o);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn("Missing style attribute or content for parameter "+t),"";switch(e.in){case"path":return serializePathParameter(t,i,a,r);case"query":return serializeQueryParameter(t,i,a,r);case"header":return serializeHeaderParameter(i,a,r);case"cookie":return serializeCookieParameter(t,i,a,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}export function isNamedDefinition(e){return/^#\/components\/(schemas|pathItems)\/[^/]+$/.test(e||"")}export function getDefinitionName(e){if(e){var r=e.match(/^#\/components\/(schemas|pathItems)\/([^/]+)$/);return null===r?void 0:r[1]}}function humanizeMultipleOfConstraint(e){if(void 0!==e){var r=e.toString(10);return/^0\.0*1$/.test(r)?"decimal places <= "+r.split(".")[1].length:"multiple of "+r}}function humanizeRangeConstraint(e,r,t){var i;return void 0!==r&&void 0!==t?i=r===t?r+" "+e:"[ "+r+" .. "+t+" ] "+e:void 0!==t?i="<= "+t+" "+e:void 0!==r&&(i=1===r?"non-empty":">= "+r+" "+e),i}export function humanizeNumberRange(e){var r,t,i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,a="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,o="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?(a?"( ":"[ ")+i+" .. "+n+(o?" )":" ]"):void 0!==n?(o?"< ":"<= ")+n:void 0!==i?(a?"> ":">= ")+i:void 0}export function humanizeConstraints(e){var r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);var i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);var n=humanizeMultipleOfConstraint(e.multipleOf);void 0!==n&&r.push(n);var a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r){void 0===r&&(r=[]);var t=[],i=[],n=[];return e.forEach((function(e){e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort((function(e,t){return r.indexOf(e.name)-r.indexOf(t.name)})),__spreadArray(__spreadArray(__spreadArray([],i,!0),n,!0),t,!0)}export function sortByField(e,r){return __spreadArray([],e,!0).sort((function(e,t){return e[r].localeCompare(t[r])}))}export function mergeParams(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=[]);var i={};return t.forEach((function(r){r=e.shallowDeref(r),i[r.name+"_"+r.in]=!0})),(r=r.filter((function(r){return r=e.shallowDeref(r),!i[r.name+"_"+r.in]}))).concat(t)}export function mergeSimilarMediaTypes(e){var r={};return Object.keys(e).forEach((function(t){var i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=__assign(__assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(/(?:{)([\w-.]+)(?:})/g,(function(e,t){return r[t]&&r[t].default||e}))}export function normalizeServers(e,r){var t=void 0===e?removeQueryString(function(){if(!IS_BROWSER)return"";var e=window.location.href;return e.endsWith(".html")?dirname(e):e}()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((function(e){return __assign(__assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export var SECURITY_DEFINITIONS_COMPONENT_NAME="security-definitions";export var SECURITY_DEFINITIONS_JSX_NAME="SecurityDefinitions";export var SCHEMA_DEFINITION_JSX_NAME="SchemaDefinition";export var SECURITY_SCHEMES_SECTION_PREFIX="section/Authentication/";export function setSecuritySchemePrefix(e){SECURITY_SCHEMES_SECTION_PREFIX=e}export var shortenHTTPVerb=function(e){return{delete:"del",options:"opts"}[e]||e};export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0}}export function extractExtensions(e,r){return Object.keys(e).filter((function(e){return!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1})).reduce((function(r,t){return r[t]=e[t],r}),{})}export function pluralizeType(e){return e.split(" or ").map((function(e){return e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")})).join(" or ")}export function getContentWithLegacyExamples(e){var r=e.content,t=e["x-examples"],i=e["x-example"];if(t){r=__assign({},r);for(var n=0,a=Object.keys(t);n<a.length;n++){var o=t[c=a[n]];r[c]=__assign(__assign({},r[c]),{examples:o})}}else if(i){r=__assign({},r);for(var s=0,u=Object.keys(i);s<u.length;s++){var c,m=i[c=u[s]];r[c]=__assign(__assign({},r[c]),{example:m})}}return r}
|
|
1
|
+
import{__assign,__spreadArray}from"tslib";import{dirname}from"path";import UrlTemplate from"url-template";import{IS_BROWSER}from"./dom";import{isNumeric,removeQueryString,resolveUrl}from"./helpers";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r){if(void 0===r&&(r=!1),"default"===e)return r?"error":"success";var t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");var i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}var operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationSummary(e){return e.summary||e.operationId||e.description&&e.description.substring(0,50)||"<no summary>"}var schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;for(var r=0,t=Object.keys(schemaKeywordTypes);r<t.length;r++){var i=t[r],n=schemaKeywordTypes[i];if(void 0!==e[i])return n}return"any"}export function isPrimitiveType(e,r){if(void 0===r&&(r=e.type),void 0!==e.oneOf||void 0!==e.anyOf)return!1;var t=!0,i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties),void 0!==e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return"application/x-www-form-urlencoded"===e}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((function(e){return e.toString()})).join(t):"object"==typeof e?Object.keys(e).map((function(r){return""+r+t+e[r]})).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((function(t){return e[t]?r+"["+t+"]="+e[t]:void 0})).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){var i,n="__redoc_param_name__",a=r?"*":"";return UrlTemplate.parse("{?"+n+a+"}").expand((i={},i[n]=t,i)).substring(1).replace(/__redoc_param_name__/g,e)}export function urlFormEncodePayload(e,r){if(void 0===r&&(r={}),Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((function(t){var i=e[t],n=r[t]||{},a=n.style,o=void 0===a?"form":a,s=n.explode,u=void 0===s||s;switch(o){case"form":return serializeFormValue(t,u,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+o),""}})).join("&")}function serializePathParameter(e,r,t,i){var n,a=t?"*":"",o="";"label"===r?o=".":"matrix"===r&&(o=";");var s="__redoc_param_name__";return UrlTemplate.parse("{"+o+s+a+"}").expand((n={},n[s]=i,n)).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){switch(r){case"form":return serializeFormValue(e,t,i);case"spaceDelimited":return Array.isArray(i)?t?serializeFormValue(e,t,i):e+"="+i.join("%20"):(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(i)?t?serializeFormValue(e,t,i):e+"="+i.join("|"):(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(i)||"object"!=typeof i?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(i,e);default:return console.warn("Unexpected style for query: "+r),""}}function serializeHeaderParameter(e,r,t){var i;if("simple"===e){var n=r?"*":"",a="__redoc_param_name__",o=UrlTemplate.parse("{"+a+n+"}");return decodeURIComponent(o.expand(((i={})[a]=t,i)))}return console.warn("Unexpected style for header: "+e),""}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn("Parameter serialization as "+r+" is not supported"),"")}export function serializeParameterValue(e,r){var t=e.name,i=e.style,n=e.explode,a=void 0!==n&&n,o=e.serializationMime;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return t+"="+serializeParameterValueWithMime(r,o);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn("Missing style attribute or content for parameter "+t),"";switch(e.in){case"path":return serializePathParameter(t,i,a,r);case"query":return serializeQueryParameter(t,i,a,r);case"header":return serializeHeaderParameter(i,a,r);case"cookie":return serializeCookieParameter(t,i,a,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}export function isNamedDefinition(e){return/^#\/components\/(schemas|pathItems)\/[^/]+$/.test(e||"")}export function getDefinitionName(e){if(e){var r=e.match(/^#\/components\/(schemas|pathItems)\/([^/]+)$/);return null===r?void 0:r[1]}}function humanizeMultipleOfConstraint(e){if(void 0!==e){var r=e.toString(10);return/^0\.0*1$/.test(r)?"decimal places <= "+r.split(".")[1].length:"multiple of "+r}}function humanizeRangeConstraint(e,r,t){var i;return void 0!==r&&void 0!==t?i=r===t?r+" "+e:"[ "+r+" .. "+t+" ] "+e:void 0!==t?i="<= "+t+" "+e:void 0!==r&&(i=1===r?"non-empty":">= "+r+" "+e),i}export function humanizeNumberRange(e){var r,t,i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,a="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,o="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?(a?"( ":"[ ")+i+" .. "+n+(o?" )":" ]"):void 0!==n?(o?"< ":"<= ")+n:void 0!==i?(a?"> ":">= ")+i:void 0}export function humanizeConstraints(e){var r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);var i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);var n=humanizeMultipleOfConstraint(e.multipleOf);void 0!==n&&r.push(n);var a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r){void 0===r&&(r=[]);var t=[],i=[],n=[];return e.forEach((function(e){e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort((function(e,t){return r.indexOf(e.name)-r.indexOf(t.name)})),__spreadArray(__spreadArray(__spreadArray([],i,!0),n,!0),t,!0)}export function sortByField(e,r){return __spreadArray([],e,!0).sort((function(e,t){return e[r].localeCompare(t[r])}))}export function mergeParams(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=[]);var i={};return t.forEach((function(r){r=e.shallowDeref(r),i[r.name+"_"+r.in]=!0})),(r=r.filter((function(r){return r=e.shallowDeref(r),!i[r.name+"_"+r.in]}))).concat(t)}export function mergeSimilarMediaTypes(e){var r={};return Object.keys(e).forEach((function(t){var i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=__assign(__assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(/(?:{)([\w-.]+)(?:})/g,(function(e,t){return r[t]&&r[t].default||e}))}export function normalizeServers(e,r){var t=void 0===e?removeQueryString(function(){if(!IS_BROWSER)return"";var e=window.location.href;return e.endsWith(".html")?dirname(e):e}()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((function(e){return __assign(__assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export var SECURITY_DEFINITIONS_COMPONENT_NAME="security-definitions";export var SECURITY_DEFINITIONS_JSX_NAME="SecurityDefinitions";export var SCHEMA_DEFINITION_JSX_NAME="SchemaDefinition";export var SECURITY_SCHEMES_SECTION_PREFIX="section/Authentication/";export function setSecuritySchemePrefix(e){SECURITY_SCHEMES_SECTION_PREFIX=e}export var shortenHTTPVerb=function(e){return{delete:"del",options:"opts"}[e]||e};export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0}}export function extractExtensions(e,r){return Object.keys(e).filter((function(e){return!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1})).reduce((function(r,t){return r[t]=e[t],r}),{})}export function pluralizeType(e){return e.split(" or ").map((function(e){return e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")})).join(" or ")}export function getContentWithLegacyExamples(e){var r=e.content,t=e["x-examples"],i=e["x-example"];if(t){r=__assign({},r);for(var n=0,a=Object.keys(t);n<a.length;n++){var o=t[c=a[n]];r[c]=__assign(__assign({},r[c]),{examples:o})}}else if(i){r=__assign({},r);for(var s=0,u=Object.keys(i);s<u.length;s++){var c,m=i[c=u[s]];r[c]=__assign(__assign({},r[c]),{example:m})}}return r}
|
|
2
2
|
//# sourceMappingURL=openapi.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate}from"tslib";import{flattenByProp,SECURITY_SCHEMES_SECTION_PREFIX,querySelector,GROUP_DEPTH}from"../redoc-lib";import{action,observable,makeObservable}from"mobx";import{VersionedSpecStore}from"./VersionedSpecStore";import{SECTION_ATTR}from"../redoc-lib/src/services/constants";import{history as historyInst}from"../redoc-lib/src/services/HistoryService";var ProMenu=function(){function e(e,t,i,r){var n=this;Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"history",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"flatItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeRenderItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"renderItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"activeItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"sideBarOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_unsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hashUnsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getItemById",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.flatItems.find((function(t){return t.id===e}))}}),Object.defineProperty(this,"initOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];i&&((t=n.flatItems.find((function(e){return e.id===i})))?(n.activate(t,!1,!1,!1,e),t.active=!1):i.startsWith(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t,!1,!1,!1,e),t&&(t.active=!1)))}}),Object.defineProperty(this,"updateOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];if(i)if(t=n.flatItems.find((function(e){return e.id===i})))n.activateAndScroll(t,!1,void 0,e);else{var r=(n.history.basePath?n.history.basePath+"/":"")+SECURITY_SCHEMES_SECTION_PREFIX;i.startsWith(r)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t)),n.scroll.prevOffsetY=0,n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+i+'"]')}}}),Object.defineProperty(this,"updateVersionOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.split("/")[0],i=n.definition.versionsInfo.findIndex((function(e){return e.id===t}));i<0&&(i=n.definition.versionsInfo.findIndex((function(e){return e.isDefault}))),n.definition.activeVersionIdx!==i&&(n.definition.changeVersion(i<0?0:i),n.updateItemsByVersionChange(!1,e));var r=t+"/"+SECURITY_SCHEMES_SECTION_PREFIX;if(e.startsWith(r)){var o=n.flatItems.find((function(e){return r.startsWith(e.id)}));n.activate(o,!1,!0),setTimeout((function(){return n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0)}}}),Object.defineProperty(this,"updateOnScroll",{enumerable:!0,configurable:!0,writable:!0,value:function(e){for(var t=e?1:-1,i=n.activeItemIdx;(-1!==i||e)&&!(i>=n.flatItems.length-1&&e);){if(e){var r=!1,o=n.flatItems[i+1];switch(n.options.pagination){case"section":r=o&&("spec"===o.type||"group"===o.type||"tag"===o.type);break;case"item":r="section"!==(null==o?void 0:o.type)}var a=n.getElementAt(i+1);if(-1===i&&"tag"===n.flatItems[0].type&&(r=!1),n.scroll.isElementBellow(a)||r)break}else{var s=n.flatItems[i]&&n.flatItems[i].type;r="section"===n.options.pagination&&("spec"===s||"group"===s||"tag"===s)||"item"===n.options.pagination&&"section"!==s,a=n.getElementAt(i);if(n.scroll.isElementAbove(a)||r)break}i+=t}var l=n.flatItems[i];"none"===n.options.pagination||"section"===n.options.pagination?l&&l.active||n.activate(l,!0,!0,!1):l&&"section"===l.type&&(l.active||n.activate(l,!0,!0,!1))}}),makeObservable(this),this.items=e.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return e.absoluteIdx=t})),i.disableSidebar||this.subscribe(),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.pagination,n.definition instanceof VersionedSpecStore,n.history)})),this.renderItems=this.buildRenderItems(0),this.activeItemIdx=-1,this.activeRenderItemIdx=-1,this.definition instanceof VersionedSpecStore&&this.history.subscribe(this.updateVersionOnHistory)}return Object.defineProperty(e,"updateOnHistory",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e=historyInst.currentId),e&&t.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._unsubscribe=this.scroll.subscribe(this.updateOnScroll),this._hashUnsubscribe=this.history.subscribe(this.updateOnHistory)}}),Object.defineProperty(e.prototype,"toggleSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!this.sideBarOpened}}),Object.defineProperty(e.prototype,"closeSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!1}}),Object.defineProperty(e.prototype,"getElementAt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"getElementAtOrFirstChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&"group"===t.type&&(t=t.items[0]),t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this.flatItems[this.activeItemIdx]||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateItemsByVersionChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=this.activeItem&&this.activeItem.active?this.activeItem.absoluteIdx:-1;t=t&&withoutVersion(t)||this.activeItem&&this.activeItem.active&&withoutVersion(this.activeItem.id)||"",this.deactivate(this.activeItem),this.items=this.definition.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.options.pagination,i.definition instanceof VersionedSpecStore,i.history)}));var n=t?(this.flatItems.find((function(e){return withoutVersion(e.id)===t}))||{absoluteIdx:-1}).absoluteIdx:-1;if(-1!==n&&"none"!==this.options.pagination||(this.renderItems=this.buildRenderItems(0)),this.activeItemIdx=-1,-1!==n)this.activate(this.flatItems[n],e);else if(-1!==r)this.activateAndScroll(this.flatItems[0],e);else if(e){var o=this.definition.versionsInfo[this.definition.activeVersionIdx];if(!this.history.currentId&&o.isDefault)return;this.history.replace(o.id)}}}),Object.defineProperty(e.prototype,"buildRenderItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("none"===this.options.pagination)return this.items;var t=this.flatItems[e];if(t||(t=this.flatItems[0]),"spec"===t.type)return this.buildRenderItems(e+1);if("section"===t.type){var i=[],r=getParentOfType(t,"tag");if("section"===this.options.pagination&&r)return[r];if("item"===this.options.pagination&&r)return[__assign(__assign({},r),{items:getLeadingSectionItems(r)})];for(var n=getParentSpecItem(t),o=(null==n?void 0:n.items)||this.items,a=0;a<o.length&&"section"===o[a].type;a++)i.push(o[a]);return i}switch(this.options.pagination){case"section":if("operation"===t.type&&t.parent)return[t.parent];if("group"!==t.type)return[t];case"item":return"operation"===t.type?[t]:[__assign(__assign({},t),{items:getLeadingSectionItems(t)})];default:return[]}}}),Object.defineProperty(e.prototype,"activateBase",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){var n,o,a,s=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),(null===(n=this.activeItem)||void 0===n?void 0:n.id)===(null==e?void 0:e.id)&&!r)return t&&e&&this.history.replace(e.id,i),void(e&&!e.active&&e.activate());if(!e||"group"!==e.type)if(this.deactivate(this.activeItem),e){if(!(e.depth<=GROUP_DEPTH)){this.activeItemIdx=e.absoluteIdx,t&&this.history.replace(e.id,i),e.activate(),e.expand();var l=new URLSearchParams(r),c="request"===l.get("t"),u="response"===l.get("t"),d=l.get("c"),f=l.get("ct"),p=l.get("in"),v=l.get("path"),b=(null==v?void 0:v.split(this.options.deepLinkSeparator))||[],h=e;if(p)for(var m=h.parameters,I=function(e){var t=null==m?void 0:m.find((function(t){return t.name===e}));null==t||t.expand(),m=null===(o=null==t?void 0:t.schema)||void 0===o?void 0:o.fields},y=0,g=b;y<g.length;y++){I(g[y])}else if(c){var O=null===(a=h.requestBody)||void 0===a?void 0:a.content;h.activateMimeName(f||h.activeMimeName),setTimeout((function(){var e;return s.activateField(b,null===(e=null==O?void 0:O.active)||void 0===e?void 0:e.schema)}),0)}else if(u){var S=h.responses.find((function(e){return e.code===d}));(null==S?void 0:S.expanded)||null==S||S.expand(),h.activateMimeName(f||h.activeMimeName),setTimeout((function(){var e,t;return s.activateField(b,null===(t=null===(e=null==S?void 0:S.content)||void 0===e?void 0:e.active)||void 0===t?void 0:t.schema)}),0)}}}else this.history.replace("",i)}}),Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r,n){var o=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===r&&(r=!0),"none"===this.options.pagination)return this.activateBase(e,t,i,n),void(!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0));if("group"!==(null==e?void 0:e.type)){if(e&&"item"===this.options.pagination&&"tag"===e.type&&!e.description){if(e.expanded)return void e.collapse();e.expand(),e=this.flatItems[e.absoluteIdx+1]}if(this.activateBase(e,e&&t,i,n),this.activeRenderItemIdx=e?e.absoluteIdx:this.activeRenderItemIdx,this.activeRenderItemIdx>=0){var a=this.buildRenderItems(this.activeRenderItemIdx);a.some((function(e,t){return e.id!==o.renderItems[t].id}))&&(this.renderItems=a),this.renderItems[0]&&(this.activeRenderItemIdx=this.renderItems[0].absoluteIdx)}r&&setTimeout((function(){return o.scrollToActive()})),!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0)}}}),Object.defineProperty(e.prototype,"activateField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var i,r=function(r){var n=e[r],o=r===e.length-1;if((null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items),null==t?void 0:t.oneOf){var a=Number(n);return null==t||t.activateOneOf(a),t=null==t?void 0:t.oneOf[a],"continue"}(null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items);var s=null===(i=null==t?void 0:t.fields)||void 0===i?void 0:i.find((function(e){return e.name===n}));o||null==s||s.expand(),t=null==s?void 0:s.schema},n=0;n<e.length-1;n++)r(n)}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0!==e)for(e.deactivate();void 0!==e;)e.collapse(),e=e.parent}}),Object.defineProperty(e.prototype,"activateAndScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){void 0===r&&(r="");var n=r.split(this.options.deepLinkPrefix)[1],o=e&&this.getItemById(e.id)||e;this.activate(o,t,i,!1,n),this.scrollToActive(n?r:""),o&&o.items.length||this.closeSidebar()}}),Object.defineProperty(e.prototype,"scrollToActive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e?setTimeout((function(){return t.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0):this.scroll.scrollIntoView(this.getElementAt(this.activeItemIdx))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;null===(e=this._unsubscribe)||void 0===e||e.call(this),null===(t=this._hashUnsubscribe)||void 0===t||t.call(this)}}),__decorate([observable],e.prototype,"flatItems",void 0),__decorate([observable],e.prototype,"items",void 0),__decorate([observable],e.prototype,"activeRenderItemIdx",void 0),__decorate([observable.ref],e.prototype,"renderItems",void 0),__decorate([observable],e.prototype,"activeItemIdx",void 0),__decorate([observable],e.prototype,"sideBarOpened",void 0),__decorate([action],e.prototype,"toggleSidebar",null),__decorate([action],e.prototype,"closeSidebar",null),__decorate([action],e.prototype,"activateBase",null),__decorate([action],e.prototype,"activate",null),__decorate([action.bound],e.prototype,"activateAndScroll",null),e}();export{ProMenu};function withoutVersion(e){return e.split("/").slice(1).join("/")}function getParentSpecItem(e){for(;e;){if("spec"===e.type)return e;e=e.parent}}function getParentOfType(e,t){if(e&&e.parent)return e.parent.type===t?e.parent:getParentOfType(e.parent,t)}function getLeadingSectionItems(e){for(var t=[],i=0,r=e.items;i<r.length;i++){var n=r[i];if("section"!==n.type)break;t.push(n)}return t}function normalizeItem(e,t,i,r,n){if(e.absoluteIdx=t,"none"!==i){var o=getParentOfType(e,"tag");if(e.parent&&o&&!("_id_normalized"in e)){if(r){var a=e.id.split("/"),s=a[0],l=a[1],c=withoutVersion(e.id);if("operation"===e.type&&!l.startsWith("operation"))return;e.id=s+"/"+withoutVersion(o.id)+"/"+c}else{if("operation"===e.type&&!e.id.startsWith("operation"))return;e.id=o.id+"/"+e.id}e._id_normalized=!0}}"group"!==e.type&&(e.href=n.linkForId(e.id))}
|
|
1
|
+
import{__assign,__decorate}from"tslib";import{flattenByProp,SECURITY_SCHEMES_SECTION_PREFIX,querySelector,GROUP_DEPTH}from"../redoc-lib";import{action,observable,makeObservable}from"mobx";import{VersionedSpecStore}from"./VersionedSpecStore";import{SECTION_ATTR}from"../redoc-lib/src/services/constants";import{history as historyInst}from"../redoc-lib/src/services/HistoryService";var ProMenu=function(){function e(e,t,i,r){var n=this;Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"history",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"flatItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeRenderItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"renderItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"activeItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"sideBarOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_unsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hashUnsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getItemById",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.flatItems.find((function(t){return t.id===e}))}}),Object.defineProperty(this,"initOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];i&&((t=n.flatItems.find((function(e){return e.id===i})))?(n.activate(t,!1,!1,!1,e),t.active=!1):i.startsWith(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t,!1,!1,!1,e),t&&(t.active=!1)))}}),Object.defineProperty(this,"updateOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];if(i)if(t=n.flatItems.find((function(e){return e.id===i})))n.activateAndScroll(t,!1,void 0,e);else{if(i.includes(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t)),n.scroll.prevOffsetY=0,n.history.basePath){var r=i.split(n.history.basePath+"/")[1];i=r||i}n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+i+'"]')}}}),Object.defineProperty(this,"updateVersionOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.split("/")[0],i=n.definition.versionsInfo.findIndex((function(e){return e.id===t}));i<0&&(i=n.definition.versionsInfo.findIndex((function(e){return e.isDefault}))),n.definition.activeVersionIdx!==i&&(n.definition.changeVersion(i<0?0:i),n.updateItemsByVersionChange(!1,e));var r=t+"/"+SECURITY_SCHEMES_SECTION_PREFIX;if(e.startsWith(r)){var o=n.flatItems.find((function(e){return r.startsWith(e.id)}));n.activate(o,!1,!0),setTimeout((function(){return n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0)}}}),Object.defineProperty(this,"updateOnScroll",{enumerable:!0,configurable:!0,writable:!0,value:function(e){for(var t=e?1:-1,i=n.activeItemIdx;(-1!==i||e)&&!(i>=n.flatItems.length-1&&e);){if(e){var r=!1,o=n.flatItems[i+1];switch(n.options.pagination){case"section":r=o&&("spec"===o.type||"group"===o.type||"tag"===o.type);break;case"item":r="section"!==(null==o?void 0:o.type)}var a=n.getElementAt(i+1);if(-1===i&&"tag"===n.flatItems[0].type&&(r=!1),n.scroll.isElementBellow(a)||r)break}else{var s=n.flatItems[i]&&n.flatItems[i].type;r="section"===n.options.pagination&&("spec"===s||"group"===s||"tag"===s)||"item"===n.options.pagination&&"section"!==s,a=n.getElementAt(i);if(n.scroll.isElementAbove(a)||r)break}i+=t}var l=n.flatItems[i];"none"===n.options.pagination||"section"===n.options.pagination?l&&l.active||n.activate(l,!0,!0,!1):l&&"section"===l.type&&(l.active||n.activate(l,!0,!0,!1))}}),makeObservable(this),this.items=e.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return e.absoluteIdx=t})),i.disableSidebar||this.subscribe(),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.pagination,n.definition instanceof VersionedSpecStore,n.history)})),this.renderItems=this.buildRenderItems(0),this.activeItemIdx=-1,this.activeRenderItemIdx=-1,this.definition instanceof VersionedSpecStore&&this.history.subscribe(this.updateVersionOnHistory)}return Object.defineProperty(e,"updateOnHistory",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e=historyInst.currentId),e&&t.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._unsubscribe=this.scroll.subscribe(this.updateOnScroll),this._hashUnsubscribe=this.history.subscribe(this.updateOnHistory)}}),Object.defineProperty(e.prototype,"toggleSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!this.sideBarOpened}}),Object.defineProperty(e.prototype,"closeSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!1}}),Object.defineProperty(e.prototype,"getElementAt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"getElementAtOrFirstChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&"group"===t.type&&(t=t.items[0]),t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this.flatItems[this.activeItemIdx]||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateItemsByVersionChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=this.activeItem&&this.activeItem.active?this.activeItem.absoluteIdx:-1;t=t&&withoutVersion(t)||this.activeItem&&this.activeItem.active&&withoutVersion(this.activeItem.id)||"",this.deactivate(this.activeItem),this.items=this.definition.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.options.pagination,i.definition instanceof VersionedSpecStore,i.history)}));var n=t?(this.flatItems.find((function(e){return withoutVersion(e.id)===t}))||{absoluteIdx:-1}).absoluteIdx:-1;if(-1!==n&&"none"!==this.options.pagination||(this.renderItems=this.buildRenderItems(0)),this.activeItemIdx=-1,-1!==n)this.activate(this.flatItems[n],e);else if(-1!==r)this.activateAndScroll(this.flatItems[0],e);else if(e){var o=this.definition.versionsInfo[this.definition.activeVersionIdx];if(!this.history.currentId&&o.isDefault)return;this.history.replace(o.id)}}}),Object.defineProperty(e.prototype,"buildRenderItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("none"===this.options.pagination)return this.items;var t=this.flatItems[e];if(t||(t=this.flatItems[0]),"spec"===t.type)return this.buildRenderItems(e+1);if("section"===t.type){var i=[],r=getParentOfType(t,"tag");if("section"===this.options.pagination&&r)return[r];if("item"===this.options.pagination&&r)return[__assign(__assign({},r),{items:getLeadingSectionItems(r)})];for(var n=getParentSpecItem(t),o=(null==n?void 0:n.items)||this.items,a=0;a<o.length&&"section"===o[a].type;a++)i.push(o[a]);return i}switch(this.options.pagination){case"section":if("operation"===t.type&&t.parent)return[t.parent];if("group"!==t.type)return[t];case"item":return"operation"===t.type?[t]:[__assign(__assign({},t),{items:getLeadingSectionItems(t)})];default:return[]}}}),Object.defineProperty(e.prototype,"activateBase",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){var n,o,a,s=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),(null===(n=this.activeItem)||void 0===n?void 0:n.id)===(null==e?void 0:e.id)&&!r)return t&&e&&this.history.replace(e.id,i),void(e&&!e.active&&e.activate());if(!e||"group"!==e.type)if(this.deactivate(this.activeItem),e){if(!(e.depth<=GROUP_DEPTH)){this.activeItemIdx=e.absoluteIdx,t&&this.history.replace(e.id,i),e.activate(),e.expand();var l=new URLSearchParams(r),c="request"===l.get("t"),u="response"===l.get("t"),d=l.get("c"),f=l.get("ct"),p=l.get("in"),v=l.get("path"),b=(null==v?void 0:v.split(this.options.deepLinkSeparator))||[],h=e;if(p)for(var m=h.parameters,I=function(e){var t=null==m?void 0:m.find((function(t){return t.name===e}));null==t||t.expand(),m=null===(o=null==t?void 0:t.schema)||void 0===o?void 0:o.fields},y=0,g=b;y<g.length;y++){I(g[y])}else if(c){var O=null===(a=h.requestBody)||void 0===a?void 0:a.content;h.activateMimeName(f||h.activeMimeName),setTimeout((function(){var e;return s.activateField(b,null===(e=null==O?void 0:O.active)||void 0===e?void 0:e.schema)}),0)}else if(u){var S=h.responses.find((function(e){return e.code===d}));(null==S?void 0:S.expanded)||null==S||S.expand(),h.activateMimeName(f||h.activeMimeName),setTimeout((function(){var e,t;return s.activateField(b,null===(t=null===(e=null==S?void 0:S.content)||void 0===e?void 0:e.active)||void 0===t?void 0:t.schema)}),0)}}}else this.history.replace("",i)}}),Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r,n){var o=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===r&&(r=!0),"none"===this.options.pagination)return this.activateBase(e,t,i,n),void(!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0));if("group"!==(null==e?void 0:e.type)){if(e&&"item"===this.options.pagination&&"tag"===e.type&&!e.description){if(e.expanded)return void e.collapse();e.expand(),e=this.flatItems[e.absoluteIdx+1]}if(this.activateBase(e,e&&t,i,n),this.activeRenderItemIdx=e?e.absoluteIdx:this.activeRenderItemIdx,this.activeRenderItemIdx>=0){var a=this.buildRenderItems(this.activeRenderItemIdx);a.some((function(e,t){return e.id!==o.renderItems[t].id}))&&(this.renderItems=a),this.renderItems[0]&&(this.activeRenderItemIdx=this.renderItems[0].absoluteIdx)}r&&setTimeout((function(){return o.scrollToActive()})),!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0)}}}),Object.defineProperty(e.prototype,"activateField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var i,r=function(r){var n=e[r],o=r===e.length-1;if((null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items),null==t?void 0:t.oneOf){var a=Number(n);return null==t||t.activateOneOf(a),t=null==t?void 0:t.oneOf[a],"continue"}(null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items);var s=null===(i=null==t?void 0:t.fields)||void 0===i?void 0:i.find((function(e){return e.name===n}));o||null==s||s.expand(),t=null==s?void 0:s.schema},n=0;n<e.length-1;n++)r(n)}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0!==e)for(e.deactivate();void 0!==e;)e.collapse(),e=e.parent}}),Object.defineProperty(e.prototype,"activateAndScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){void 0===r&&(r="");var n=r.split(this.options.deepLinkPrefix)[1],o=e&&this.getItemById(e.id)||e;this.activate(o,t,i,!1,n),this.scrollToActive(n?r:""),o&&o.items.length||this.closeSidebar()}}),Object.defineProperty(e.prototype,"scrollToActive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e?setTimeout((function(){return t.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0):this.scroll.scrollIntoView(this.getElementAt(this.activeItemIdx))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;null===(e=this._unsubscribe)||void 0===e||e.call(this),null===(t=this._hashUnsubscribe)||void 0===t||t.call(this)}}),__decorate([observable],e.prototype,"flatItems",void 0),__decorate([observable],e.prototype,"items",void 0),__decorate([observable],e.prototype,"activeRenderItemIdx",void 0),__decorate([observable.ref],e.prototype,"renderItems",void 0),__decorate([observable],e.prototype,"activeItemIdx",void 0),__decorate([observable],e.prototype,"sideBarOpened",void 0),__decorate([action],e.prototype,"toggleSidebar",null),__decorate([action],e.prototype,"closeSidebar",null),__decorate([action],e.prototype,"activateBase",null),__decorate([action],e.prototype,"activate",null),__decorate([action.bound],e.prototype,"activateAndScroll",null),e}();export{ProMenu};function withoutVersion(e){return e.split("/").slice(1).join("/")}function getParentSpecItem(e){for(;e;){if("spec"===e.type)return e;e=e.parent}}function getParentOfType(e,t){if(e&&e.parent)return e.parent.type===t?e.parent:getParentOfType(e.parent,t)}function getLeadingSectionItems(e){for(var t=[],i=0,r=e.items;i<r.length;i++){var n=r[i];if("section"!==n.type)break;t.push(n)}return t}function normalizeItem(e,t,i,r,n){if(e.absoluteIdx=t,"none"!==i){var o=getParentOfType(e,"tag");if(e.parent&&o&&!("_id_normalized"in e)){if(r){var a=e.id.split("/"),s=a[0],l=a[1],c=withoutVersion(e.id);if("operation"===e.type&&!l.startsWith("operation"))return;e.id=s+"/"+withoutVersion(o.id)+"/"+c}else{if("operation"===e.type&&!e.id.startsWith("operation"))return;e.id=o.id+"/"+e.id}e._id_normalized=!0}}"group"!==e.type&&(e.href=n.linkForId(e.id))}
|
|
2
2
|
//# sourceMappingURL=ProMenu.js.map
|
|
@@ -140,7 +140,7 @@ export declare class ProStore {
|
|
|
140
140
|
enableConsole(): void;
|
|
141
141
|
tryItOut(operation?: OperationModel): void;
|
|
142
142
|
setActiveSampleLanguage(language: string): void;
|
|
143
|
-
activateSampleLanguage:
|
|
143
|
+
activateSampleLanguage: (...args: string[]) => void;
|
|
144
144
|
startLoader(): void;
|
|
145
145
|
stopLoader(): void;
|
|
146
146
|
dereferenceSpecForTryIt(specIdx: number | undefined, op: OperationModel): Promise<GenericObject>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{debounce}from"lodash";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{MultipleSpecsStore}from"./MultipleSpecsStore";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromStorage,toStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e){return n.setActiveSampleLanguage(e)}),500)}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r||a):new ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore(e,this.options):a?new VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadLink=i.downloadDefinitionUrl,this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser";break;default:this.options.pagination="none",this.options.routingStrategy="hash"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return __awaiter(this,void 0,void 0,(function(){var a,s,l,p,u,c,h;return __generator(this,(function(d){switch(d.label){case 0:return a=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,s=JSON.parse(JSON.stringify(a)),l=__assign(__assign({},getSpecVersionObj(s)),{components:s.components,paths:(c={},c[t.path]=(h={},h[t.httpVerb]=null===(o=null===(i=s.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],h.parameters=null===(r=null===(n=s.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,h),c)}),p=new Config({}),u=createParsedDocument(l),[4,bundle({config:p,doc:u,dereference:!0})];case 1:return d.sent(),[2,s]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore||this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
1
|
+
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{MultipleSpecsStore}from"./MultipleSpecsStore";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromStorage,toStorage,toLocalStorage,fromLocalStorage,setGlobalStore,debounce}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e){return n.setActiveSampleLanguage(e)}),500)}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r||a):new ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore(e,this.options):a?new VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadLink=i.downloadDefinitionUrl,this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return __awaiter(this,void 0,void 0,(function(){var a,s,l,p,u,c,h;return __generator(this,(function(d){switch(d.label){case 0:return a=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,s=JSON.parse(JSON.stringify(a)),l=__assign(__assign({},getSpecVersionObj(s)),{components:s.components,paths:(c={},c[t.path]=(h={},h[t.httpVerb]=null===(o=null===(i=s.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],h.parameters=null===(r=null===(n=s.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,h),c)}),p=new Config({}),u=createParsedDocument(l),[4,bundle({config:p,doc:u,dereference:!0})];case 1:return d.sent(),[2,s]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore||this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
2
2
|
//# sourceMappingURL=ProStore.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign}from"tslib";import{VariableType}from"./constants";export function getPreserveTransformer(r){var e=r.body,n=r.authorizationHeader;return function(r,a,t){return e&&"body"===a&&"string"==typeof r.body?r.body:n&&"Authorization"===a&&"string"==typeof r.Authorization?r.Authorization:t}}export function addIndentation(r,e){var n=void 0===e?{}:e,a=n.level,t=void 0===a?0:a,i=n.indent,o=void 0===i?" ":i,s=n.firstLine,p=void 0===s||s,l=o.repeat(t),u=r.replace(/(\r\n|\n|\r)/gm,"\n"+l);return p?l.concat(u):u}export function parseUrlIntoOperands(r,e){for(var n=
|
|
1
|
+
import{__assign}from"tslib";import{VariableType}from"./constants";export function getPreserveTransformer(r){var e=r.body,n=r.authorizationHeader;return function(r,a,t){return e&&"body"===a&&"string"==typeof r.body?r.body:n&&"Authorization"===a&&"string"==typeof r.Authorization?r.Authorization:t}}export function addIndentation(r,e){var n=void 0===e?{}:e,a=n.level,t=void 0===a?0:a,i=n.indent,o=void 0===i?" ":i,s=n.firstLine,p=void 0===s||s,l=o.repeat(t),u=r.replace(/(\r\n|\n|\r)/gm,"\n"+l);return p?l.concat(u):u}export function parseUrlIntoOperands(r,e){for(var n=Object.keys(e).map((function(e){return{name:e,idx:r.indexOf("{"+e+"}")}})).filter((function(r){return r.idx>-1})).sort((function(r,e){return r.idx-e.idx})),a=[],t=0,i=0,o=n;i<o.length;i++){var s=o[i],p=s.name,l=s.idx;l>t&&a.push({type:"string",value:r.substring(t,l)}),a.push({type:"variable",name:p}),t=l+p.length+2}return t<r.length&&a.push({type:"string",value:r.substring(t)}),a}export function buildUrlExpression(r,e){var n=e.langOptions,a=n.joinSymbol,t=n.variableWrapperFn,i=n.stringLiteral,o=n.urlFieldName,s=n.rawName,p=r.pathParameters,l=void 0===p?{}:p,u=r.serverVariables,v=void 0===u?{}:u,d=__assign(__assign({},l),v);return parseUrlIntoOperands(r[o]||"",d).map((function(r){if("variable"===r.type){var n=d[r.name],a=s?r.name:e.var(r.name,VariableType.PATH);return t(a,n)}return i(r.value)})).join(a)}export function printUrlVariablesDeclarations(r,e,n){var a=r.pathParameters,t=void 0===a?{}:a,i=r.serverVariables,o=void 0===i?{}:i;Object.entries(__assign(__assign({},t),o)).forEach((function(r){var a=r[0],t=r[1]||"YOUR_"+a+"_PARAMETER",i=e.var(a,VariableType.PATH);void 0!==n?e.push(n,e.langOptions.variableDeclaration(i),t):e.push(e.langOptions.variableDeclaration(i),t)}))}
|
|
2
2
|
//# sourceMappingURL=code-helpers.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/reference-docs",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
4
4
|
"description": "Redocly Reference Docs",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"handlebars": "^4.7.6",
|
|
30
30
|
"hotkeys-js": "^3.7.6",
|
|
31
31
|
"informed": "3.33.0",
|
|
32
|
-
"json-pointer": "^0.6.
|
|
32
|
+
"json-pointer": "^0.6.1",
|
|
33
33
|
"kleur": "^3.0.3",
|
|
34
34
|
"lunr": "^2.3.8",
|
|
35
35
|
"mark.js": "^8.11.1",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"mkdirp": "^0.5.1",
|
|
38
38
|
"mobx-react": "^7.2.0",
|
|
39
39
|
"node-libs-browser": "^2.2.0",
|
|
40
|
-
"openapi-sampler": "^1.0.
|
|
40
|
+
"openapi-sampler": "^1.0.1",
|
|
41
|
+
"path-browserify": "^1.0.1",
|
|
41
42
|
"perfect-scrollbar": "^1.4.0",
|
|
42
43
|
"polished": "^3.6.5",
|
|
43
44
|
"prismjs": "^1.22.0",
|
|
@@ -51,24 +52,24 @@
|
|
|
51
52
|
"stringify-object": "^3.3.0",
|
|
52
53
|
"styled-components": "^4.1.1 || ^5.1.1",
|
|
53
54
|
"swagger-client": "^3.13.3",
|
|
54
|
-
"swagger2openapi": "^
|
|
55
|
+
"swagger2openapi": "^7.0.8",
|
|
55
56
|
"tslib": "^2.2.0",
|
|
56
57
|
"url-template": "^2.0.8",
|
|
57
|
-
"yargs": "^
|
|
58
|
+
"yargs": "^17.3.0"
|
|
58
59
|
},
|
|
59
60
|
"scripts": {
|
|
60
61
|
"prepublishOnly-local": "npm run clean && npm run bundle && npm run compile-lib && npm run bundle-cli && npm run prepublish-test",
|
|
61
62
|
"clean": "rm -rf bin dist lib lib-esm cli-zip",
|
|
62
|
-
"bundle": "webpack --mode=production
|
|
63
|
+
"bundle": "webpack --mode=production",
|
|
63
64
|
"compile-lib": "npm run compile-es5 && npm run compile-esm && npm run bundle-worker",
|
|
64
65
|
"compile-es5": "rm -rf lib && tsc -p tsconfig.lib.json && node scripts/minify.js lib",
|
|
65
66
|
"compile-esm": "rm -rf lib-esm && tsc -p tsconfig.lib-esm.json && node scripts/minify.js lib-esm",
|
|
66
|
-
"bundle-worker": "webpack --config webpack.config.worker.js --mode=production
|
|
67
|
-
"bundle-cli": "webpack --config webpack.config.server.js --mode=production
|
|
67
|
+
"bundle-worker": "webpack --config webpack.config.worker.js --mode=production",
|
|
68
|
+
"bundle-cli": "webpack --config webpack.config.server.js --mode=production && cp -Rf src/cli/assets bin/cli/assets",
|
|
68
69
|
"publish-cli-s3": "scripts/publish-cli-s3.sh",
|
|
69
70
|
"publish-cdn": "scripts/publish-cdn.sh",
|
|
70
71
|
"pack-sourcemaps": "rm -rf reference-docs.sourcemaps.tag.gz && find lib lib-esm -name \"*.js.map\" | xargs tar -czvf reference-docs.sourcemaps.tar.gz",
|
|
71
|
-
"start": "webpack
|
|
72
|
+
"start": "webpack serve --mode=development --hot",
|
|
72
73
|
"stats": "webpack --json --profile --mode=production -p > stats.json && npx webpack-bundle-analyzer stats.json",
|
|
73
74
|
"prettier": "prettier --write \"src/cli/cli.ts\" \"src/**/*.{ts,tsx}\" \"playground/**/*.{ts,tsx}\"",
|
|
74
75
|
"lint": "eslint --fix . --ext .ts,.tsx --cache",
|
|
@@ -95,17 +96,9 @@
|
|
|
95
96
|
"styled-components": "^4.1.1 || ^5.1.1"
|
|
96
97
|
},
|
|
97
98
|
"devDependencies": {
|
|
98
|
-
"@babel/core": "^7.9.0",
|
|
99
|
-
"@babel/parser": "^7.9.4",
|
|
100
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
|
|
101
|
-
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
|
|
102
|
-
"@babel/plugin-syntax-decorators": "^7.8.3",
|
|
103
|
-
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
|
104
|
-
"@babel/plugin-syntax-jsx": "^7.8.3",
|
|
105
|
-
"@babel/plugin-syntax-typescript": "^7.8.3",
|
|
106
99
|
"@percy/cli": "^1.0.0-beta.68",
|
|
107
100
|
"@percy/cypress": "^3.1.1",
|
|
108
|
-
"@testing-library/jest-dom": "^
|
|
101
|
+
"@testing-library/jest-dom": "^5.15.1",
|
|
109
102
|
"@testing-library/react": "^11.1.0",
|
|
110
103
|
"@testing-library/user-event": "^12.1.10",
|
|
111
104
|
"@types/codemirror": "0.0.88",
|
|
@@ -113,7 +106,6 @@
|
|
|
113
106
|
"@types/enzyme-to-json": "^1.5.3",
|
|
114
107
|
"@types/jest": "^25.1.4",
|
|
115
108
|
"@types/json-pointer": "^1.0.30",
|
|
116
|
-
"@types/lodash": "^4.14.149",
|
|
117
109
|
"@types/mark.js": "^8.11.5",
|
|
118
110
|
"@types/marked": "^3.0.1",
|
|
119
111
|
"@types/node": "^14.14.37",
|
|
@@ -127,36 +119,32 @@
|
|
|
127
119
|
"@types/webpack-env": "^1.14.1",
|
|
128
120
|
"@typescript-eslint/eslint-plugin": "^4.28.3",
|
|
129
121
|
"@typescript-eslint/parser": "^4.28.3",
|
|
130
|
-
"babel-loader": "^8.1.0",
|
|
131
|
-
"babel-plugin-styled-components": "^1.10.6",
|
|
132
|
-
"babylon": "7.0.0-beta.47",
|
|
133
122
|
"core-js": "^3.5.0",
|
|
134
123
|
"css-loader": "^3.3.2",
|
|
135
124
|
"cypress": "^8.4.0",
|
|
136
125
|
"cypress-file-upload": "^5.0.8",
|
|
137
126
|
"enzyme": "^3.7.0",
|
|
138
127
|
"enzyme-to-json": "^3.6.2",
|
|
128
|
+
"esbuild-loader": "^2.16.0",
|
|
139
129
|
"eslint": "^7.30.0",
|
|
140
130
|
"eslint-import-resolver-typescript": "^2.4.0",
|
|
141
131
|
"eslint-plugin-import": "^2.23.4",
|
|
142
|
-
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
143
132
|
"eslint-plugin-react": "^7.25.1",
|
|
144
133
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
134
|
+
"fork-ts-checker-webpack-plugin": "^6.5.0",
|
|
145
135
|
"html-webpack-plugin": "^4.0.3",
|
|
146
136
|
"husky": "^7.0.0",
|
|
147
137
|
"jest": "^26.6.3",
|
|
148
138
|
"jest-styled-components": "^7.0.4",
|
|
149
|
-
"json-schema": "^0.
|
|
150
|
-
"lodash": "^4.17.20",
|
|
139
|
+
"json-schema": "^0.4.0",
|
|
151
140
|
"mobx": "^6.3.2",
|
|
152
141
|
"prettier": "^2.3.2",
|
|
153
142
|
"pretty-quick": "^3.0.0",
|
|
154
|
-
"raw-loader": "^4.0.2",
|
|
155
143
|
"react": "^17.0.0",
|
|
156
144
|
"react-dom": "^17.0.0",
|
|
157
145
|
"react-hot-loader": "^4.12.18",
|
|
158
146
|
"react-test-renderer": "^17.0.2",
|
|
159
|
-
"string-replace-loader": "^
|
|
147
|
+
"string-replace-loader": "^3.1.0",
|
|
160
148
|
"style-loader": "^1.0.1",
|
|
161
149
|
"terser": "^5.6.1",
|
|
162
150
|
"ts-jest": "^26.4.4",
|
|
@@ -165,11 +153,10 @@
|
|
|
165
153
|
"typescript": "4.4.2",
|
|
166
154
|
"unfetch": "^4.1.0",
|
|
167
155
|
"url-polyfill": "^1.1.7",
|
|
168
|
-
"webpack": "^
|
|
169
|
-
"webpack-cli": "^
|
|
170
|
-
"webpack-dev-server": "^
|
|
171
|
-
"
|
|
172
|
-
"workerize-loader": "^1.3.0",
|
|
156
|
+
"webpack": "^5.64.4",
|
|
157
|
+
"webpack-cli": "^4.9.1",
|
|
158
|
+
"webpack-dev-server": "^4.6.0",
|
|
159
|
+
"workerize-loader": "github:redocly/workerize-loader#webpack-5-dist",
|
|
173
160
|
"yaml-js": "^0.2.3"
|
|
174
161
|
},
|
|
175
162
|
"jest": {
|