@redocly/reference-docs 2.34.0 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,11 @@ export declare class RedocNormalizedOptions {
46
46
  expandSingleSchemaField: boolean;
47
47
  schemaExpansionLevel: number;
48
48
  samplesTabsMaxCount: number;
49
+ mockServer: {
50
+ url: string;
51
+ position: 'first' | 'last' | 'replace' | 'off';
52
+ description: string;
53
+ } | null;
49
54
  unstable_tryItButtonOverride?: {
50
55
  label: string;
51
56
  link?: string;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RedocNormalizedOptions=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),theme_1=(0,tslib_1.__importStar)(require("../theme")),utils_1=require("../utils"),utils_2=require("../../../utils"),types_1=require("../../../types"),Labels_1=require("./Labels"),RedocNormalizedOptions=function(){function e(a,i){var t,l,r,o,n,s;void 0===i&&(i={}),Object.defineProperty(this,"theme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scrollYOffset",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideHostname",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInfoDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandResponses",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requiredPropsFirst",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortPropsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortEnumValuesAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortOperationsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortTagsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativeScrollbars",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathInMiddlePanel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"untrustedDefinition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideDownloadButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"downloadDefinitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showChangeLayoutButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onlyRequiredInSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showConsole",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendXUserAgentInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generatedPayloadSamplesMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showExtensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preserveOriginalExtensionsName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSingleRequestSampleTab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideRequestPayloadSample",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menuToggle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"jsonSampleExpandLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enumSkipQuotes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaTitles",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSecuritySection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showSecuritySchemeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simpleOneOfTypeLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"payloadSampleIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandSingleSchemaField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaExpansionLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"samplesTabsMaxCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_tryItButtonOverride",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowedMdComponents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultServerVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxDisplayedEnumValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreNamedSchemas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_ignoreMimeParameters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_externalCodeSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaPattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOneOfDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideFab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"markdownHeadingsAnchorLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaDefinitionsTagName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minCharacterLengthToInitSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxResponseHeadersToShowInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showWebhookVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showObjectSchemaExamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showAccessMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableTryItRequestUrlEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this);var u=null===(t=(a=(0,tslib_1.__assign)((0,tslib_1.__assign)({},i),a)).theme)||void 0===t?void 0:t.extensionsHook;(null===(l=a.theme)||void 0===l?void 0:l.menu)&&!(null===(r=a.theme)||void 0===r?void 0:r.sidebar)&&(console.warn('Theme setting "menu" is deprecated. Rename to "sidebar"'),a.theme.sidebar=a.theme.menu),(null===(o=a.theme)||void 0===o?void 0:o.codeSample)&&!(null===(n=a.theme)||void 0===n?void 0:n.codeBlock)&&(console.warn('Theme setting "codeSample" is deprecated. Rename to "codeBlock"'),a.theme.codeBlock=a.theme.codeSample),this.theme=(0,theme_1.resolveTheme)((0,utils_1.mergeObjects)({},theme_1.default,(0,tslib_1.__assign)((0,tslib_1.__assign)({},a.theme),{extensionsHook:void 0}))),this.theme.mediaQueries={print:"@media print"};for(var b=0,d=Object.entries(this.theme.breakpoints);b<d.length;b++){var c=d[b],h=c[0],m=c[1];this.theme.mediaQueries[h]="@media screen and (min-width: "+m+")"}this.theme.extensionsHook=u,(0,Labels_1.setRedocLabels)(a.labels),this.scrollYOffset=e.normalizeScrollYOffset(a.scrollYOffset),this.hideHostname=e.normalizeHideHostname(a.hideHostname),this.expandResponses=e.normalizeExpandResponses(a.expandResponses),this.requiredPropsFirst=(0,utils_1.argValueToBoolean)(a.requiredPropsFirst),this.sortPropsAlphabetically=(0,utils_1.argValueToBoolean)(a.sortPropsAlphabetically),this.sortEnumValuesAlphabetically=(0,utils_1.argValueToBoolean)(a.sortEnumValuesAlphabetically),this.sortOperationsAlphabetically=(0,utils_1.argValueToBoolean)(a.sortOperationsAlphabetically),this.sortTagsAlphabetically=(0,utils_1.argValueToBoolean)(a.sortTagsAlphabetically),this.nativeScrollbars=(0,utils_1.argValueToBoolean)(a.nativeScrollbars),this.pathInMiddlePanel=(0,utils_1.argValueToBoolean)(a.pathInMiddlePanel),this.untrustedDefinition=(0,utils_1.argValueToBoolean)(a.untrustedDefinition),this.hideDownloadButton=void 0===a.hideDownloadButton?null:(0,utils_1.argValueToBoolean)(a.hideDownloadButton),this.downloadDefinitionUrl=a.downloadDefinitionUrl,this.hideInfoDescription=(0,utils_1.argValueToBoolean)(a.hideInfoDescription),this.disableSearch=(0,utils_1.argValueToBoolean)(a.disableSearch),this.onlyRequiredInSamples=(0,utils_1.argValueToBoolean)(a.onlyRequiredInSamples),this.generatedPayloadSamplesMaxDepth=(0,utils_1.argValueToInt)(a.generatedPayloadSamplesMaxDepth)||8,this.sendXUserAgentInTryIt=(0,utils_1.argValueToBoolean)(a.sendXUserAgentInTryIt),this.showExtensions=e.normalizeShowExtensions(a.showExtensions),this.preserveOriginalExtensionsName=(0,utils_1.argValueToBoolean)(a.preserveOriginalExtensionsName,!1),this.hideSingleRequestSampleTab=(0,utils_1.argValueToBoolean)(a.hideSingleRequestSampleTab),this.hideRequestPayloadSample=(0,utils_1.argValueToBoolean)(a.hideRequestPayloadSample),this.menuToggle=(0,utils_1.argValueToBoolean)(a.menuToggle,!0),this.jsonSampleExpandLevel=(0,utils_1.argValueToExpandLevel)(a.jsonSampleExpandLevel,2),this.enumSkipQuotes=(0,utils_1.argValueToBoolean)(a.enumSkipQuotes),this.hideSchemaTitles=(0,utils_1.argValueToBoolean)(a.hideSchemaTitles),this.hideSecuritySection=(0,utils_1.argValueToBoolean)(a.hideSecuritySection),this.showSecuritySchemeType=(0,utils_1.argValueToBoolean)(a.showSecuritySchemeType),this.simpleOneOfTypeLabel=(0,utils_1.argValueToBoolean)(a.simpleOneOfTypeLabel),this.payloadSampleIdx=e.normalizePayloadSampleIdx(a.payloadSampleIdx),this.expandSingleSchemaField=(0,utils_1.argValueToBoolean)(a.expandSingleSchemaField),this.schemaExpansionLevel=(0,utils_1.argValueToExpandLevel)(a.schemaExpansionLevel),this.samplesTabsMaxCount=(0,utils_1.argValueToInt)(a.samplesTabsMaxCount)||5,this.unstable_tryItButtonOverride=a.unstable_tryItButtonOverride||null,this.unstable_ignoreMimeParameters=(0,utils_1.argValueToBoolean)(a.unstable_ignoreMimeParameters),this.allowedMdComponents=a.allowedMdComponents||{},this.expandDefaultServerVariables=(0,utils_1.argValueToBoolean)(a.expandDefaultServerVariables),this.expandDefaultRequest=(0,utils_1.argValueToBoolean)(a.expandDefaultRequest,!0),this.expandDefaultResponse=(0,utils_1.argValueToBoolean)(a.expandDefaultResponse,!0),this.maxDisplayedEnumValues=(0,utils_1.argValueToNumber)(a.maxDisplayedEnumValues);var p=Array.isArray(a.ignoreNamedSchemas)?a.ignoreNamedSchemas:null===(s=a.ignoreNamedSchemas)||void 0===s?void 0:s.split(",").map((function(e){return e.trim()}));this.ignoreNamedSchemas=new Set(p),this.unstable_externalCodeSamples=a.unstable_externalCodeSamples||[],this.hooks=a.hooks||(0,utils_2.getWindowReferenceOptions)(types_1.WindowReferenceOptions.HOOKS)||{},this.hooks.ReplaceTryItAuthPanel&&!this.hooks.ReplaceTryItSecurityPanel&&(console.warn("[warn] ReplaceTryItAuthPanel is deprecated, use ReplaceTryItSecurityPanel instead"),this.hooks.ReplaceTryItSecurityPanel=this.hooks.ReplaceTryItAuthPanel),this.hideSchemaPattern=(0,utils_1.argValueToBoolean)(a.hideSchemaPattern),this.hideOneOfDescription=(0,utils_1.argValueToBoolean)(a.hideOneOfDescription),this.hideFab=(0,utils_1.argValueToBoolean)(a.hideFab),this.markdownHeadingsAnchorLevel=(0,utils_1.argValueToNumber)(a.markdownHeadingsAnchorLevel,2),this.schemaDefinitionsTagName=a.schemaDefinitionsTagName,this.minCharacterLengthToInitSearch=(0,utils_1.argValueToNumber)(a.minCharacterLengthToInitSearch,3),this.maxResponseHeadersToShowInTryIt=(0,utils_1.argValueToNumber)(a.maxResponseHeadersToShowInTryIt),this.showWebhookVerb=(0,utils_1.argValueToBoolean)(a.showWebhookVerb),this.showObjectSchemaExamples=(0,utils_1.argValueToBoolean)(a.showObjectSchemaExamples),this.showAccessMode=(0,utils_1.argValueToBoolean)(a.showAccessMode),this.disableTryItRequestUrlEncoding=(0,utils_1.argValueToBoolean)(a.disableTryItRequestUrlEncoding,!1)}return Object.defineProperty(e,"normalizeExpandResponses",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("all"===e)return"all";if("string"==typeof e){var a={};return e.split(",").forEach((function(e){a[e.trim()]=!0})),a}return void 0!==e&&console.warn('expandResponses must be a string but received value "'+e+'" of type '+typeof e),{}}}),Object.defineProperty(e,"normalizeHideHostname",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e}}),Object.defineProperty(e,"normalizeScrollYOffset",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("string"==typeof e&&!(0,utils_1.isNumeric)(e)){var a=(0,utils_1.querySelector)(e);a||console.warn("scrollYOffset value is a selector to non-existing element. Using offset 0 by default");var i=a&&a.getBoundingClientRect().bottom||0;return function(){return i}}return"number"==typeof e||(0,utils_1.isNumeric)(e)?function(){return"number"==typeof e?e:parseFloat(e)}:"function"==typeof e?function(){var a=e();return"number"!=typeof a&&console.warn('scrollYOffset should return number but returned value "'+a+'" of type '+typeof a),a}:(void 0!==e&&console.warn("Wrong value for scrollYOffset ReDoc option: should be string, number or function"),function(){return 0})}}),Object.defineProperty(e,"normalizeShowExtensions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e)return!1;if(""===e)return!0;if("string"!=typeof e)return e;switch(e){case"true":return!0;case"false":return!1;default:return e.split(",").map((function(e){return e.trim()}))}}}),Object.defineProperty(e,"normalizePayloadSampleIdx",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"number"==typeof e?Math.max(0,e):"string"==typeof e&&isFinite(e)?parseInt(e,10):0}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showConsole",void 0),e}();exports.RedocNormalizedOptions=RedocNormalizedOptions;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RedocNormalizedOptions=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),theme_1=(0,tslib_1.__importStar)(require("../theme")),utils_1=require("../utils"),utils_2=require("../../../utils"),types_1=require("../../../types"),Labels_1=require("./Labels"),RedocNormalizedOptions=function(){function e(a,i){var t,l,r,o,n,s;void 0===i&&(i={}),Object.defineProperty(this,"theme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scrollYOffset",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideHostname",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInfoDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandResponses",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requiredPropsFirst",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortPropsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortEnumValuesAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortOperationsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortTagsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativeScrollbars",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathInMiddlePanel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"untrustedDefinition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideDownloadButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"downloadDefinitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showChangeLayoutButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onlyRequiredInSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showConsole",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendXUserAgentInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generatedPayloadSamplesMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showExtensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preserveOriginalExtensionsName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSingleRequestSampleTab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideRequestPayloadSample",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menuToggle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"jsonSampleExpandLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enumSkipQuotes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaTitles",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSecuritySection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showSecuritySchemeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simpleOneOfTypeLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"payloadSampleIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandSingleSchemaField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaExpansionLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"samplesTabsMaxCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mockServer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_tryItButtonOverride",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowedMdComponents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultServerVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxDisplayedEnumValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreNamedSchemas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_ignoreMimeParameters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_externalCodeSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaPattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOneOfDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideFab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"markdownHeadingsAnchorLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaDefinitionsTagName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minCharacterLengthToInitSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxResponseHeadersToShowInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showWebhookVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showObjectSchemaExamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showAccessMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableTryItRequestUrlEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this);var u=null===(t=(a=(0,tslib_1.__assign)((0,tslib_1.__assign)({},i),a)).theme)||void 0===t?void 0:t.extensionsHook;(null===(l=a.theme)||void 0===l?void 0:l.menu)&&!(null===(r=a.theme)||void 0===r?void 0:r.sidebar)&&(console.warn('Theme setting "menu" is deprecated. Rename to "sidebar"'),a.theme.sidebar=a.theme.menu),(null===(o=a.theme)||void 0===o?void 0:o.codeSample)&&!(null===(n=a.theme)||void 0===n?void 0:n.codeBlock)&&(console.warn('Theme setting "codeSample" is deprecated. Rename to "codeBlock"'),a.theme.codeBlock=a.theme.codeSample),this.theme=(0,theme_1.resolveTheme)((0,utils_1.mergeObjects)({},theme_1.default,(0,tslib_1.__assign)((0,tslib_1.__assign)({},a.theme),{extensionsHook:void 0}))),this.theme.mediaQueries={print:"@media print"};for(var b=0,d=Object.entries(this.theme.breakpoints);b<d.length;b++){var c=d[b],h=c[0],m=c[1];this.theme.mediaQueries[h]="@media screen and (min-width: "+m+")"}this.theme.extensionsHook=u,(0,Labels_1.setRedocLabels)(a.labels),this.scrollYOffset=e.normalizeScrollYOffset(a.scrollYOffset),this.hideHostname=e.normalizeHideHostname(a.hideHostname),this.expandResponses=e.normalizeExpandResponses(a.expandResponses),this.requiredPropsFirst=(0,utils_1.argValueToBoolean)(a.requiredPropsFirst),this.sortPropsAlphabetically=(0,utils_1.argValueToBoolean)(a.sortPropsAlphabetically),this.sortEnumValuesAlphabetically=(0,utils_1.argValueToBoolean)(a.sortEnumValuesAlphabetically),this.sortOperationsAlphabetically=(0,utils_1.argValueToBoolean)(a.sortOperationsAlphabetically),this.sortTagsAlphabetically=(0,utils_1.argValueToBoolean)(a.sortTagsAlphabetically),this.nativeScrollbars=(0,utils_1.argValueToBoolean)(a.nativeScrollbars),this.pathInMiddlePanel=(0,utils_1.argValueToBoolean)(a.pathInMiddlePanel),this.untrustedDefinition=(0,utils_1.argValueToBoolean)(a.untrustedDefinition),this.hideDownloadButton=void 0===a.hideDownloadButton?null:(0,utils_1.argValueToBoolean)(a.hideDownloadButton),this.downloadDefinitionUrl=a.downloadDefinitionUrl,this.hideInfoDescription=(0,utils_1.argValueToBoolean)(a.hideInfoDescription),this.disableSearch=(0,utils_1.argValueToBoolean)(a.disableSearch),this.onlyRequiredInSamples=(0,utils_1.argValueToBoolean)(a.onlyRequiredInSamples),this.generatedPayloadSamplesMaxDepth=(0,utils_1.argValueToInt)(a.generatedPayloadSamplesMaxDepth)||8,this.sendXUserAgentInTryIt=(0,utils_1.argValueToBoolean)(a.sendXUserAgentInTryIt),this.showExtensions=e.normalizeShowExtensions(a.showExtensions),this.preserveOriginalExtensionsName=(0,utils_1.argValueToBoolean)(a.preserveOriginalExtensionsName,!1),this.hideSingleRequestSampleTab=(0,utils_1.argValueToBoolean)(a.hideSingleRequestSampleTab),this.hideRequestPayloadSample=(0,utils_1.argValueToBoolean)(a.hideRequestPayloadSample),this.menuToggle=(0,utils_1.argValueToBoolean)(a.menuToggle,!0),this.jsonSampleExpandLevel=(0,utils_1.argValueToExpandLevel)(a.jsonSampleExpandLevel,2),this.enumSkipQuotes=(0,utils_1.argValueToBoolean)(a.enumSkipQuotes),this.hideSchemaTitles=(0,utils_1.argValueToBoolean)(a.hideSchemaTitles),this.hideSecuritySection=(0,utils_1.argValueToBoolean)(a.hideSecuritySection),this.showSecuritySchemeType=(0,utils_1.argValueToBoolean)(a.showSecuritySchemeType),this.simpleOneOfTypeLabel=(0,utils_1.argValueToBoolean)(a.simpleOneOfTypeLabel),this.payloadSampleIdx=e.normalizePayloadSampleIdx(a.payloadSampleIdx),this.expandSingleSchemaField=(0,utils_1.argValueToBoolean)(a.expandSingleSchemaField),this.schemaExpansionLevel=(0,utils_1.argValueToExpandLevel)(a.schemaExpansionLevel),this.samplesTabsMaxCount=(0,utils_1.argValueToInt)(a.samplesTabsMaxCount)||5,this.unstable_tryItButtonOverride=a.unstable_tryItButtonOverride||null,this.unstable_ignoreMimeParameters=(0,utils_1.argValueToBoolean)(a.unstable_ignoreMimeParameters),this.allowedMdComponents=a.allowedMdComponents||{},this.expandDefaultServerVariables=(0,utils_1.argValueToBoolean)(a.expandDefaultServerVariables),this.expandDefaultRequest=(0,utils_1.argValueToBoolean)(a.expandDefaultRequest,!0),this.expandDefaultResponse=(0,utils_1.argValueToBoolean)(a.expandDefaultResponse,!0),this.maxDisplayedEnumValues=(0,utils_1.argValueToNumber)(a.maxDisplayedEnumValues);var p=Array.isArray(a.ignoreNamedSchemas)?a.ignoreNamedSchemas:null===(s=a.ignoreNamedSchemas)||void 0===s?void 0:s.split(",").map((function(e){return e.trim()}));this.ignoreNamedSchemas=new Set(p),this.unstable_externalCodeSamples=a.unstable_externalCodeSamples||[],this.hooks=a.hooks||(0,utils_2.getWindowReferenceOptions)(types_1.WindowReferenceOptions.HOOKS)||{},this.hooks.ReplaceTryItAuthPanel&&!this.hooks.ReplaceTryItSecurityPanel&&(console.warn("[warn] ReplaceTryItAuthPanel is deprecated, use ReplaceTryItSecurityPanel instead"),this.hooks.ReplaceTryItSecurityPanel=this.hooks.ReplaceTryItAuthPanel),this.hideSchemaPattern=(0,utils_1.argValueToBoolean)(a.hideSchemaPattern),this.hideOneOfDescription=(0,utils_1.argValueToBoolean)(a.hideOneOfDescription),this.hideFab=(0,utils_1.argValueToBoolean)(a.hideFab),this.markdownHeadingsAnchorLevel=(0,utils_1.argValueToNumber)(a.markdownHeadingsAnchorLevel,2),this.schemaDefinitionsTagName=a.schemaDefinitionsTagName,this.minCharacterLengthToInitSearch=(0,utils_1.argValueToNumber)(a.minCharacterLengthToInitSearch,3),this.maxResponseHeadersToShowInTryIt=(0,utils_1.argValueToNumber)(a.maxResponseHeadersToShowInTryIt),this.showWebhookVerb=(0,utils_1.argValueToBoolean)(a.showWebhookVerb),this.showObjectSchemaExamples=(0,utils_1.argValueToBoolean)(a.showObjectSchemaExamples),this.showAccessMode=(0,utils_1.argValueToBoolean)(a.showAccessMode),this.disableTryItRequestUrlEncoding=(0,utils_1.argValueToBoolean)(a.disableTryItRequestUrlEncoding,!1)}return Object.defineProperty(e,"normalizeExpandResponses",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("all"===e)return"all";if("string"==typeof e){var a={};return e.split(",").forEach((function(e){a[e.trim()]=!0})),a}return void 0!==e&&console.warn('expandResponses must be a string but received value "'+e+'" of type '+typeof e),{}}}),Object.defineProperty(e,"normalizeHideHostname",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e}}),Object.defineProperty(e,"normalizeScrollYOffset",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("string"==typeof e&&!(0,utils_1.isNumeric)(e)){var a=(0,utils_1.querySelector)(e);a||console.warn("scrollYOffset value is a selector to non-existing element. Using offset 0 by default");var i=a&&a.getBoundingClientRect().bottom||0;return function(){return i}}return"number"==typeof e||(0,utils_1.isNumeric)(e)?function(){return"number"==typeof e?e:parseFloat(e)}:"function"==typeof e?function(){var a=e();return"number"!=typeof a&&console.warn('scrollYOffset should return number but returned value "'+a+'" of type '+typeof a),a}:(void 0!==e&&console.warn("Wrong value for scrollYOffset ReDoc option: should be string, number or function"),function(){return 0})}}),Object.defineProperty(e,"normalizeShowExtensions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e)return!1;if(""===e)return!0;if("string"!=typeof e)return e;switch(e){case"true":return!0;case"false":return!1;default:return e.split(",").map((function(e){return e.trim()}))}}}),Object.defineProperty(e,"normalizePayloadSampleIdx",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"number"==typeof e?Math.max(0,e):"string"==typeof e&&isFinite(e)?parseInt(e,10):0}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showConsole",void 0),e}();exports.RedocNormalizedOptions=RedocNormalizedOptions;
2
2
  //# sourceMappingURL=RedocNormalizedOptions.js.map
@@ -88,5 +88,6 @@ export declare class OperationModel implements IMenuItem {
88
88
  setRequestValues(values: {
89
89
  [field: string]: any;
90
90
  }): void;
91
+ private mergeInMockServer;
91
92
  private generateCodeSamples;
92
93
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperationModel=exports.isPayloadSample=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),utils_1=require("../../utils"),generator_1=require("../../../../services/code-samples/generator"),utils_2=require("../../../../components/console/utils"),Callback_1=require("./Callback"),Field_1=require("./Field"),RequestBody_1=require("./RequestBody"),Response_1=require("./Response"),SecurityRequirement_1=require("./SecurityRequirement");function isPayloadSample(e){return"payload"===e.lang&&"requestBodyContent"in e}exports.isPayloadSample=isPayloadSample;var isCodeSamplesWarningPrinted=!1,OperationModel=function(){function e(e,t,i,r,o){var a,n;void 0===o&&(o=!1),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"operationDefinition",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),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,"href",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"operation"}),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,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ready",{enumerable:!0,configurable:!0,writable:!0,value:!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,"activeMimeName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeServer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultMimeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"operationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deprecated",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"path",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"servers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"security",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isWebhook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.pointer=t.pointer,this.description=t.description,this.parent=i,this.externalDocs=t.externalDocs,this.deprecated=!!t.deprecated,this.httpVerb=t.httpVerb,this.deprecated=!!t.deprecated,this.operationId=t.operationId,this.path=t.pathName,this.isCallback=o,this.isWebhook=t.isWebhook,this.isEvent=this.isCallback||this.isWebhook,this.name=(0,utils_1.getOperationSummary)(t),this.defaultExampleName=t.defaultSampleName;var l=null===(n=null===(a=this.requestBody)||void 0===a?void 0:a.content)||void 0===n?void 0:n.mediaTypes,s=(l||[])[0],u=Object.keys((null==s?void 0:s.examples)||[])[0];this.activeExampleName=!1!==t.defaultSampleName&&(t.defaultSampleName||u),this.defaultMimeType=t.defaultMimeType;var p=null==l?void 0:l.find((function(e){return e.name===t.defaultMimeType}));this.activeMimeName=(null==p?void 0:p.name)||(null==s?void 0:s.name),this.isCallback?(this.security=(t.security||[]).map((function(t){return new SecurityRequirement_1.SecurityRequirementModel(t,e)})),this.servers=(0,utils_1.normalizeServers)("",t.servers||t.pathServers||[])):(this.id=(0,utils_1.sanitizeItemId)(void 0!==t.operationId?"operation/"+t.operationId:void 0!==i?i.id+this.pointer:this.pointer),this.security=(t.security||e.definition.security||[]).map((function(t){return new SecurityRequirement_1.SecurityRequirementModel(t,e)})),this.servers=(0,utils_1.normalizeServers)(e.definitionUrl,t.servers||t.pathServers||e.definition.servers||[])),r.showExtensions&&(this.extensions=(0,utils_1.extractExtensions)(t,r.showExtensions)),this.activeServer=(0,utils_2.getInitialServerWithVariables)(this.servers)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),Object.defineProperty(e.prototype,"toggle",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!this.expanded}}),Object.defineProperty(e.prototype,"activateMimeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeMimeName=e}}),Object.defineProperty(e.prototype,"activateExampleName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeExampleName=e}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(e.prototype,"requestBody",{get:function(){return this.operationDefinition.requestBody&&new RequestBody_1.RequestBodyModel({parser:this.parser,infoOrRef:this.operationDefinition.requestBody,options:this.options,operation:this,isEvent:this.isEvent})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){var e,t=null===(e=this.requestBody)||void 0===e?void 0:e.content;return(null==t?void 0:t.hasSample)?{lang:"payload",label:"Payload",source:"",requestBodyContent:t}:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSamples",{get:function(){var e,t;return(null===(t=null===(e=this.requestBody)||void 0===e?void 0:e.content)||void 0===t?void 0:t.hasSample)||this.definitionSamples.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definitionSamples",{get:function(){var e=this.operationDefinition["x-codeSamples"]||this.operationDefinition["x-code-samples"]||[];return this.operationDefinition["x-code-samples"]&&!isCodeSamplesWarningPrinted&&(isCodeSamplesWarningPrinted=!0,console.warn('"x-code-samples" is deprecated. Use "x-codeSamples" instead')),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allCodeSamples",{get:function(){var e,t=this.options,i=t.payloadSampleIdx,r=t.hideRequestPayloadSample,o=[];if(!this.isWebhook){var a=this.options.generateCodeSamples||{},n=new Set(this.definitionSamples.map((function(e){return e.lang.toLowerCase()}))),l=(null===(e=a.languages)||void 0===e?void 0:e.filter((function(e){var t=e.lang;return!n.has(t.toLowerCase())})))||[];o=this.generateCodeSamples(l,a)}var s=this.definitionSamples.concat(o),u=Math.min(s.length,i);return this.payload&&!r&&s.splice(u,0,this.payload),s},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parameters",{get:function(){var e=this,t=(0,utils_1.mergeParams)(this.parser,this.operationDefinition.pathParameters,this.operationDefinition.parameters).map((function(t){return new Field_1.FieldModel(e.parser,t,e.pointer,e.options,void 0,{operation:e,type:"request"})}));return this.options.sortPropsAlphabetically?(0,utils_1.sortByField)(t,"name"):this.options.requiredPropsFirst?(0,utils_1.sortByRequired)(t):t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responses",{get:function(){var e=this,t=!1;return Object.keys(this.operationDefinition.responses||[]).filter((function(e){return"default"===e||("success"===(0,utils_1.getStatusCodeType)(e)&&(t=!0),(0,utils_1.isStatusCode)(e))})).map((function(i){return new Response_1.ResponseModel({parser:e.parser,code:i,defaultAsError:t,infoOrRef:e.operationDefinition.responses[i],options:e.options,isEvent:e.isEvent,operation:e})}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"callbacks",{get:function(){var e=this;return Object.keys(this.operationDefinition.callbacks||[]).map((function(t){var i;return new Callback_1.CallbackModel(e.parser,t,null===(i=e.operationDefinition.callbacks)||void 0===i?void 0:i[t],e.pointer,e.options)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hideTryItPanel",{get:function(){return!0===this.operationDefinition["x-hideTryItPanel"]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"setActiveServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeServer=e}}),Object.defineProperty(e.prototype,"setRequestValues",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.requestValues=e}}),Object.defineProperty(e.prototype,"generateCodeSamples",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=t.skipOptionalParameters,o=t.withOAuth2Call;return e.map((function(e){var t=e.lang,a=e.label,n=e.options;return{lang:t,label:a,get:function(e){return(0,generator_1.getCodeSample)((0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{lang:t,options:(0,tslib_1.__assign)((0,tslib_1.__assign)({},n),{skipOptionalParameters:r,withOAuth2Call:o,spec:i.parser.definition,generatedPayloadSamplesMaxDepth:i.options.generatedPayloadSamplesMaxDepth})}))}}}))}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"ready",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeMimeName",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeExampleName",void 0),(0,tslib_1.__decorate)([mobx_1.observable.ref],e.prototype,"activeServer",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"requestValues",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggle",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activateMimeName",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activateExampleName",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"requestBody",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"payload",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"hasSamples",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"definitionSamples",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"allCodeSamples",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"parameters",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"responses",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"callbacks",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"hideTryItPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveServer",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setRequestValues",null),e}();exports.OperationModel=OperationModel;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperationModel=exports.isPayloadSample=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),utils_1=require("../../utils"),generator_1=require("../../../../services/code-samples/generator"),utils_2=require("../../../../components/console/utils"),Callback_1=require("./Callback"),Field_1=require("./Field"),RequestBody_1=require("./RequestBody"),Response_1=require("./Response"),SecurityRequirement_1=require("./SecurityRequirement");function isPayloadSample(e){return"payload"===e.lang&&"requestBodyContent"in e}exports.isPayloadSample=isPayloadSample;var isCodeSamplesWarningPrinted=!1,OperationModel=function(){function e(e,t,i,r,o){var a,n;void 0===o&&(o=!1),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"operationDefinition",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),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,"href",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"operation"}),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,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ready",{enumerable:!0,configurable:!0,writable:!0,value:!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,"activeMimeName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeServer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultMimeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"operationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deprecated",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"path",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"servers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"security",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isWebhook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.pointer=t.pointer,this.description=t.description,this.parent=i,this.externalDocs=t.externalDocs,this.deprecated=!!t.deprecated,this.httpVerb=t.httpVerb,this.deprecated=!!t.deprecated,this.operationId=t.operationId,this.path=t.pathName,this.isCallback=o,this.isWebhook=t.isWebhook,this.isEvent=this.isCallback||this.isWebhook,this.name=(0,utils_1.getOperationSummary)(t),this.defaultExampleName=t.defaultSampleName;var l=null===(n=null===(a=this.requestBody)||void 0===a?void 0:a.content)||void 0===n?void 0:n.mediaTypes,s=(l||[])[0],u=Object.keys((null==s?void 0:s.examples)||[])[0];this.activeExampleName=!1!==t.defaultSampleName&&(t.defaultSampleName||u),this.defaultMimeType=t.defaultMimeType;var p=null==l?void 0:l.find((function(e){return e.name===t.defaultMimeType}));if(this.activeMimeName=(null==p?void 0:p.name)||(null==s?void 0:s.name),this.isCallback)this.security=(t.security||[]).map((function(t){return new SecurityRequirement_1.SecurityRequirementModel(t,e)})),this.servers=(0,utils_1.normalizeServers)("",t.servers||t.pathServers||[]);else{this.id=(0,utils_1.sanitizeItemId)(void 0!==t.operationId?"operation/"+t.operationId:void 0!==i?i.id+this.pointer:this.pointer),this.security=(t.security||e.definition.security||[]).map((function(t){return new SecurityRequirement_1.SecurityRequirementModel(t,e)}));var b=this.mergeInMockServer(t.servers||t.pathServers||e.definition.servers||[],r.mockServer);this.servers=(0,utils_1.normalizeServers)(e.definitionUrl,b)}r.showExtensions&&(this.extensions=(0,utils_1.extractExtensions)(t,r.showExtensions)),this.activeServer=(0,utils_2.getInitialServerWithVariables)(this.servers)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),Object.defineProperty(e.prototype,"toggle",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!this.expanded}}),Object.defineProperty(e.prototype,"activateMimeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeMimeName=e}}),Object.defineProperty(e.prototype,"activateExampleName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeExampleName=e}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(e.prototype,"requestBody",{get:function(){return this.operationDefinition.requestBody&&new RequestBody_1.RequestBodyModel({parser:this.parser,infoOrRef:this.operationDefinition.requestBody,options:this.options,operation:this,isEvent:this.isEvent})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){var e,t=null===(e=this.requestBody)||void 0===e?void 0:e.content;return(null==t?void 0:t.hasSample)?{lang:"payload",label:"Payload",source:"",requestBodyContent:t}:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSamples",{get:function(){var e,t;return(null===(t=null===(e=this.requestBody)||void 0===e?void 0:e.content)||void 0===t?void 0:t.hasSample)||this.definitionSamples.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definitionSamples",{get:function(){var e=this.operationDefinition["x-codeSamples"]||this.operationDefinition["x-code-samples"]||[];return this.operationDefinition["x-code-samples"]&&!isCodeSamplesWarningPrinted&&(isCodeSamplesWarningPrinted=!0,console.warn('"x-code-samples" is deprecated. Use "x-codeSamples" instead')),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allCodeSamples",{get:function(){var e,t=this.options,i=t.payloadSampleIdx,r=t.hideRequestPayloadSample,o=[];if(!this.isWebhook){var a=this.options.generateCodeSamples||{},n=new Set(this.definitionSamples.map((function(e){return e.lang.toLowerCase()}))),l=(null===(e=a.languages)||void 0===e?void 0:e.filter((function(e){var t=e.lang;return!n.has(t.toLowerCase())})))||[];o=this.generateCodeSamples(l,a)}var s=this.definitionSamples.concat(o),u=Math.min(s.length,i);return this.payload&&!r&&s.splice(u,0,this.payload),s},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parameters",{get:function(){var e=this,t=(0,utils_1.mergeParams)(this.parser,this.operationDefinition.pathParameters,this.operationDefinition.parameters).map((function(t){return new Field_1.FieldModel(e.parser,t,e.pointer,e.options,void 0,{operation:e,type:"request"})}));return this.options.sortPropsAlphabetically?(0,utils_1.sortByField)(t,"name"):this.options.requiredPropsFirst?(0,utils_1.sortByRequired)(t):t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responses",{get:function(){var e=this,t=!1;return Object.keys(this.operationDefinition.responses||[]).filter((function(e){return"default"===e||("success"===(0,utils_1.getStatusCodeType)(e)&&(t=!0),(0,utils_1.isStatusCode)(e))})).map((function(i){return new Response_1.ResponseModel({parser:e.parser,code:i,defaultAsError:t,infoOrRef:e.operationDefinition.responses[i],options:e.options,isEvent:e.isEvent,operation:e})}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"callbacks",{get:function(){var e=this;return Object.keys(this.operationDefinition.callbacks||[]).map((function(t){var i;return new Callback_1.CallbackModel(e.parser,t,null===(i=e.operationDefinition.callbacks)||void 0===i?void 0:i[t],e.pointer,e.options)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hideTryItPanel",{get:function(){return!0===this.operationDefinition["x-hideTryItPanel"]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"setActiveServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeServer=e}}),Object.defineProperty(e.prototype,"setRequestValues",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.requestValues=e}}),Object.defineProperty(e.prototype,"mergeInMockServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!t)return e;var i={url:t.url,description:t.description};switch(t.position){case"first":return(0,tslib_1.__spreadArray)([i],e,!0);case"last":return(0,tslib_1.__spreadArray)((0,tslib_1.__spreadArray)([],e,!0),[i],!1);case"replace":return[i];default:return e}}}),Object.defineProperty(e.prototype,"generateCodeSamples",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=t.skipOptionalParameters,o=t.withOAuth2Call;return e.map((function(e){var t=e.lang,a=e.label,n=e.options;return{lang:t,label:a,get:function(e){return(0,generator_1.getCodeSample)((0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{lang:t,options:(0,tslib_1.__assign)((0,tslib_1.__assign)({},n),{skipOptionalParameters:r,withOAuth2Call:o,spec:i.parser.definition,generatedPayloadSamplesMaxDepth:i.options.generatedPayloadSamplesMaxDepth})}))}}}))}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"ready",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeMimeName",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeExampleName",void 0),(0,tslib_1.__decorate)([mobx_1.observable.ref],e.prototype,"activeServer",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"requestValues",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggle",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activateMimeName",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activateExampleName",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"requestBody",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"payload",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"hasSamples",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"definitionSamples",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"allCodeSamples",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"parameters",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"responses",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"callbacks",null),(0,tslib_1.__decorate)([utils_1.memoize],e.prototype,"hideTryItPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveServer",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setRequestValues",null),e}();exports.OperationModel=OperationModel;
2
2
  //# sourceMappingURL=Operation.js.map
@@ -182,6 +182,11 @@ export interface RedocRawOptions {
182
182
  label: string;
183
183
  link: string;
184
184
  };
185
+ mockServer?: {
186
+ url?: string;
187
+ position?: 'first' | 'last' | 'replace' | 'off';
188
+ description?: string;
189
+ };
185
190
  allowedMdComponents?: Record<string, MDXComponentMeta>;
186
191
  labels?: LabelsConfigRaw;
187
192
  enumSkipQuotes?: boolean | string;
@@ -1,2 +1,2 @@
1
- "use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),decko_1=require("decko"),redoc_lib_1=require("../redoc-lib"),pluggable_1=require("../components/pluggable"),utils_1=require("../utils"),SecurityDefs_1=require("../redoc-lib/src/components/SecurityRequirement/SecurityDefs"),types_1=require("../types"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_2=require("./utils"),store_types_1=require("./store-types"),types_2=require("./types"),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}),(0,mobx_1.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}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();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)}))}exports.NestingGroup=NestingGroup;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 redoc_lib_1.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:store_types_1.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}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(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="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r):new history_1.ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),(0,utils_1.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=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel: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||store_types_1.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||types_2.SideNavStyle.SummaryOnly,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||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.REQUEST_INTERCEPTOR)||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=void 0!==this.rawOptions.routingStrategy?this.rawOptions.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&&(0,utils_2.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||SearchStore_1.DEFAULT_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 SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.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_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.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)})),redoc_lib_1.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=(0,utils_1.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_1.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_1.fromSessionStorage)("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,(0,utils_1.toSessionStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_1.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,(0,utils_1.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(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){var t,i,o,n;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var r,a,s,l,p,u,c,d;return(0,tslib_1.__generator)(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(a)),{components:a.components,paths:(c={},c[e.path]=(d={},d[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],d.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,d),c)}),l=new openapi_core_1.Config({}),p=(0,redoc_lib_1.createParsedDocument)(s),u={config:l,doc:p,dereference:!0},[4,(0,openapi_core_1.bundle)(u)];case 1:return h.sent(),[2,a]}}))}))}}),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];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.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);(0,utils_1.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.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(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore_1.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=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([decko_1.bind,(0,decko_1.debounce)(500)],e.prototype,"activateSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_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
+ "use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),decko_1=require("decko"),redoc_lib_1=require("../redoc-lib"),pluggable_1=require("../components/pluggable"),utils_1=require("../utils"),SecurityDefs_1=require("../redoc-lib/src/components/SecurityRequirement/SecurityDefs"),types_1=require("../types"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_2=require("./utils"),store_types_1=require("./store-types"),types_2=require("./types"),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}),(0,mobx_1.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}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();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)}))}exports.NestingGroup=NestingGroup;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 redoc_lib_1.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:store_types_1.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}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(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="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r):new history_1.ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),(0,utils_1.setGlobalStore)(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r,a;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel: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||store_types_1.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||types_2.SideNavStyle.SummaryOnly,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.mockServer=(null===(r=this.rawOptions.mockServer)||void 0===r?void 0:r.url)?{url:this.rawOptions.mockServer.url,position:this.rawOptions.mockServer.position||"first",description:this.rawOptions.mockServer.description||"Mock server"}:null,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||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.REQUEST_INTERCEPTOR)||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var s="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(a=this.rawOptions)||void 0===a?void 0:a.pagination)&&(null==s?void 0:s.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==s?void 0:s.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&&(0,utils_2.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||SearchStore_1.DEFAULT_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 SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.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_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.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)})),redoc_lib_1.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=(0,utils_1.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_1.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_1.fromSessionStorage)("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,(0,utils_1.toSessionStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_1.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,(0,utils_1.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(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){var t,i,o,n;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var r,a,s,l,p,u,c,d;return(0,tslib_1.__generator)(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(a)),{components:a.components,paths:(c={},c[e.path]=(d={},d[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],d.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,d),c)}),l=new openapi_core_1.Config({}),p=(0,redoc_lib_1.createParsedDocument)(s),u={config:l,doc:p,dereference:!0},[4,(0,openapi_core_1.bundle)(u)];case 1:return h.sent(),[2,a]}}))}))}}),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];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.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);(0,utils_1.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.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(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore_1.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=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([decko_1.bind,(0,decko_1.debounce)(500)],e.prototype,"activateSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_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
@@ -46,6 +46,11 @@ export declare class RedocNormalizedOptions {
46
46
  expandSingleSchemaField: boolean;
47
47
  schemaExpansionLevel: number;
48
48
  samplesTabsMaxCount: number;
49
+ mockServer: {
50
+ url: string;
51
+ position: 'first' | 'last' | 'replace' | 'off';
52
+ description: string;
53
+ } | null;
49
54
  unstable_tryItButtonOverride?: {
50
55
  label: string;
51
56
  link?: string;
@@ -1,2 +1,2 @@
1
- import{__assign,__decorate}from"tslib";import{observable,makeObservable}from"mobx";import defaultTheme,{resolveTheme}from"../theme";import{argValueToBoolean,argValueToExpandLevel,argValueToNumber,argValueToInt,isNumeric,mergeObjects,querySelector}from"../utils";import{getWindowReferenceOptions}from"../../../utils";import{WindowReferenceOptions}from"../../../types";import{setRedocLabels}from"./Labels";var RedocNormalizedOptions=function(){function e(a,i){var r,t,o,l,n,s;void 0===i&&(i={}),Object.defineProperty(this,"theme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scrollYOffset",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideHostname",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInfoDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandResponses",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requiredPropsFirst",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortPropsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortEnumValuesAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortOperationsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortTagsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativeScrollbars",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathInMiddlePanel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"untrustedDefinition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideDownloadButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"downloadDefinitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showChangeLayoutButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onlyRequiredInSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showConsole",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendXUserAgentInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generatedPayloadSamplesMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showExtensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preserveOriginalExtensionsName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSingleRequestSampleTab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideRequestPayloadSample",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menuToggle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"jsonSampleExpandLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enumSkipQuotes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaTitles",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSecuritySection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showSecuritySchemeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simpleOneOfTypeLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"payloadSampleIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandSingleSchemaField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaExpansionLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"samplesTabsMaxCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_tryItButtonOverride",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowedMdComponents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultServerVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxDisplayedEnumValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreNamedSchemas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_ignoreMimeParameters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_externalCodeSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaPattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOneOfDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideFab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"markdownHeadingsAnchorLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaDefinitionsTagName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minCharacterLengthToInitSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxResponseHeadersToShowInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showWebhookVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showObjectSchemaExamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showAccessMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableTryItRequestUrlEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this);var u=null===(r=(a=__assign(__assign({},i),a)).theme)||void 0===r?void 0:r.extensionsHook;(null===(t=a.theme)||void 0===t?void 0:t.menu)&&!(null===(o=a.theme)||void 0===o?void 0:o.sidebar)&&(console.warn('Theme setting "menu" is deprecated. Rename to "sidebar"'),a.theme.sidebar=a.theme.menu),(null===(l=a.theme)||void 0===l?void 0:l.codeSample)&&!(null===(n=a.theme)||void 0===n?void 0:n.codeBlock)&&(console.warn('Theme setting "codeSample" is deprecated. Rename to "codeBlock"'),a.theme.codeBlock=a.theme.codeSample),this.theme=resolveTheme(mergeObjects({},defaultTheme,__assign(__assign({},a.theme),{extensionsHook:void 0}))),this.theme.mediaQueries={print:"@media print"};for(var b=0,d=Object.entries(this.theme.breakpoints);b<d.length;b++){var c=d[b],h=c[0],m=c[1];this.theme.mediaQueries[h]="@media screen and (min-width: "+m+")"}this.theme.extensionsHook=u,setRedocLabels(a.labels),this.scrollYOffset=e.normalizeScrollYOffset(a.scrollYOffset),this.hideHostname=e.normalizeHideHostname(a.hideHostname),this.expandResponses=e.normalizeExpandResponses(a.expandResponses),this.requiredPropsFirst=argValueToBoolean(a.requiredPropsFirst),this.sortPropsAlphabetically=argValueToBoolean(a.sortPropsAlphabetically),this.sortEnumValuesAlphabetically=argValueToBoolean(a.sortEnumValuesAlphabetically),this.sortOperationsAlphabetically=argValueToBoolean(a.sortOperationsAlphabetically),this.sortTagsAlphabetically=argValueToBoolean(a.sortTagsAlphabetically),this.nativeScrollbars=argValueToBoolean(a.nativeScrollbars),this.pathInMiddlePanel=argValueToBoolean(a.pathInMiddlePanel),this.untrustedDefinition=argValueToBoolean(a.untrustedDefinition),this.hideDownloadButton=void 0===a.hideDownloadButton?null:argValueToBoolean(a.hideDownloadButton),this.downloadDefinitionUrl=a.downloadDefinitionUrl,this.hideInfoDescription=argValueToBoolean(a.hideInfoDescription),this.disableSearch=argValueToBoolean(a.disableSearch),this.onlyRequiredInSamples=argValueToBoolean(a.onlyRequiredInSamples),this.generatedPayloadSamplesMaxDepth=argValueToInt(a.generatedPayloadSamplesMaxDepth)||8,this.sendXUserAgentInTryIt=argValueToBoolean(a.sendXUserAgentInTryIt),this.showExtensions=e.normalizeShowExtensions(a.showExtensions),this.preserveOriginalExtensionsName=argValueToBoolean(a.preserveOriginalExtensionsName,!1),this.hideSingleRequestSampleTab=argValueToBoolean(a.hideSingleRequestSampleTab),this.hideRequestPayloadSample=argValueToBoolean(a.hideRequestPayloadSample),this.menuToggle=argValueToBoolean(a.menuToggle,!0),this.jsonSampleExpandLevel=argValueToExpandLevel(a.jsonSampleExpandLevel,2),this.enumSkipQuotes=argValueToBoolean(a.enumSkipQuotes),this.hideSchemaTitles=argValueToBoolean(a.hideSchemaTitles),this.hideSecuritySection=argValueToBoolean(a.hideSecuritySection),this.showSecuritySchemeType=argValueToBoolean(a.showSecuritySchemeType),this.simpleOneOfTypeLabel=argValueToBoolean(a.simpleOneOfTypeLabel),this.payloadSampleIdx=e.normalizePayloadSampleIdx(a.payloadSampleIdx),this.expandSingleSchemaField=argValueToBoolean(a.expandSingleSchemaField),this.schemaExpansionLevel=argValueToExpandLevel(a.schemaExpansionLevel),this.samplesTabsMaxCount=argValueToInt(a.samplesTabsMaxCount)||5,this.unstable_tryItButtonOverride=a.unstable_tryItButtonOverride||null,this.unstable_ignoreMimeParameters=argValueToBoolean(a.unstable_ignoreMimeParameters),this.allowedMdComponents=a.allowedMdComponents||{},this.expandDefaultServerVariables=argValueToBoolean(a.expandDefaultServerVariables),this.expandDefaultRequest=argValueToBoolean(a.expandDefaultRequest,!0),this.expandDefaultResponse=argValueToBoolean(a.expandDefaultResponse,!0),this.maxDisplayedEnumValues=argValueToNumber(a.maxDisplayedEnumValues);var p=Array.isArray(a.ignoreNamedSchemas)?a.ignoreNamedSchemas:null===(s=a.ignoreNamedSchemas)||void 0===s?void 0:s.split(",").map((function(e){return e.trim()}));this.ignoreNamedSchemas=new Set(p),this.unstable_externalCodeSamples=a.unstable_externalCodeSamples||[],this.hooks=a.hooks||getWindowReferenceOptions(WindowReferenceOptions.HOOKS)||{},this.hooks.ReplaceTryItAuthPanel&&!this.hooks.ReplaceTryItSecurityPanel&&(console.warn("[warn] ReplaceTryItAuthPanel is deprecated, use ReplaceTryItSecurityPanel instead"),this.hooks.ReplaceTryItSecurityPanel=this.hooks.ReplaceTryItAuthPanel),this.hideSchemaPattern=argValueToBoolean(a.hideSchemaPattern),this.hideOneOfDescription=argValueToBoolean(a.hideOneOfDescription),this.hideFab=argValueToBoolean(a.hideFab),this.markdownHeadingsAnchorLevel=argValueToNumber(a.markdownHeadingsAnchorLevel,2),this.schemaDefinitionsTagName=a.schemaDefinitionsTagName,this.minCharacterLengthToInitSearch=argValueToNumber(a.minCharacterLengthToInitSearch,3),this.maxResponseHeadersToShowInTryIt=argValueToNumber(a.maxResponseHeadersToShowInTryIt),this.showWebhookVerb=argValueToBoolean(a.showWebhookVerb),this.showObjectSchemaExamples=argValueToBoolean(a.showObjectSchemaExamples),this.showAccessMode=argValueToBoolean(a.showAccessMode),this.disableTryItRequestUrlEncoding=argValueToBoolean(a.disableTryItRequestUrlEncoding,!1)}return Object.defineProperty(e,"normalizeExpandResponses",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("all"===e)return"all";if("string"==typeof e){var a={};return e.split(",").forEach((function(e){a[e.trim()]=!0})),a}return void 0!==e&&console.warn('expandResponses must be a string but received value "'+e+'" of type '+typeof e),{}}}),Object.defineProperty(e,"normalizeHideHostname",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e}}),Object.defineProperty(e,"normalizeScrollYOffset",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("string"==typeof e&&!isNumeric(e)){var a=querySelector(e);a||console.warn("scrollYOffset value is a selector to non-existing element. Using offset 0 by default");var i=a&&a.getBoundingClientRect().bottom||0;return function(){return i}}return"number"==typeof e||isNumeric(e)?function(){return"number"==typeof e?e:parseFloat(e)}:"function"==typeof e?function(){var a=e();return"number"!=typeof a&&console.warn('scrollYOffset should return number but returned value "'+a+'" of type '+typeof a),a}:(void 0!==e&&console.warn("Wrong value for scrollYOffset ReDoc option: should be string, number or function"),function(){return 0})}}),Object.defineProperty(e,"normalizeShowExtensions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e)return!1;if(""===e)return!0;if("string"!=typeof e)return e;switch(e){case"true":return!0;case"false":return!1;default:return e.split(",").map((function(e){return e.trim()}))}}}),Object.defineProperty(e,"normalizePayloadSampleIdx",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"number"==typeof e?Math.max(0,e):"string"==typeof e&&isFinite(e)?parseInt(e,10):0}}),__decorate([observable],e.prototype,"showConsole",void 0),e}();export{RedocNormalizedOptions};
1
+ import{__assign,__decorate}from"tslib";import{observable,makeObservable}from"mobx";import defaultTheme,{resolveTheme}from"../theme";import{argValueToBoolean,argValueToExpandLevel,argValueToNumber,argValueToInt,isNumeric,mergeObjects,querySelector}from"../utils";import{getWindowReferenceOptions}from"../../../utils";import{WindowReferenceOptions}from"../../../types";import{setRedocLabels}from"./Labels";var RedocNormalizedOptions=function(){function e(a,i){var r,t,o,l,n,s;void 0===i&&(i={}),Object.defineProperty(this,"theme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scrollYOffset",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideHostname",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInfoDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandResponses",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requiredPropsFirst",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortPropsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortEnumValuesAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortOperationsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sortTagsAlphabetically",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativeScrollbars",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathInMiddlePanel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"untrustedDefinition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideDownloadButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"downloadDefinitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showChangeLayoutButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onlyRequiredInSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showConsole",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendXUserAgentInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generatedPayloadSamplesMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showExtensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preserveOriginalExtensionsName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSingleRequestSampleTab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideRequestPayloadSample",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menuToggle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"jsonSampleExpandLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enumSkipQuotes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaTitles",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSecuritySection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showSecuritySchemeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simpleOneOfTypeLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"payloadSampleIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandSingleSchemaField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaExpansionLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"samplesTabsMaxCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mockServer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_tryItButtonOverride",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowedMdComponents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultServerVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expandDefaultResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxDisplayedEnumValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreNamedSchemas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_ignoreMimeParameters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"unstable_externalCodeSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideSchemaPattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOneOfDescription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideFab",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"markdownHeadingsAnchorLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schemaDefinitionsTagName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minCharacterLengthToInitSearch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxResponseHeadersToShowInTryIt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showWebhookVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showObjectSchemaExamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showAccessMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disableTryItRequestUrlEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this);var u=null===(r=(a=__assign(__assign({},i),a)).theme)||void 0===r?void 0:r.extensionsHook;(null===(t=a.theme)||void 0===t?void 0:t.menu)&&!(null===(o=a.theme)||void 0===o?void 0:o.sidebar)&&(console.warn('Theme setting "menu" is deprecated. Rename to "sidebar"'),a.theme.sidebar=a.theme.menu),(null===(l=a.theme)||void 0===l?void 0:l.codeSample)&&!(null===(n=a.theme)||void 0===n?void 0:n.codeBlock)&&(console.warn('Theme setting "codeSample" is deprecated. Rename to "codeBlock"'),a.theme.codeBlock=a.theme.codeSample),this.theme=resolveTheme(mergeObjects({},defaultTheme,__assign(__assign({},a.theme),{extensionsHook:void 0}))),this.theme.mediaQueries={print:"@media print"};for(var b=0,d=Object.entries(this.theme.breakpoints);b<d.length;b++){var c=d[b],h=c[0],m=c[1];this.theme.mediaQueries[h]="@media screen and (min-width: "+m+")"}this.theme.extensionsHook=u,setRedocLabels(a.labels),this.scrollYOffset=e.normalizeScrollYOffset(a.scrollYOffset),this.hideHostname=e.normalizeHideHostname(a.hideHostname),this.expandResponses=e.normalizeExpandResponses(a.expandResponses),this.requiredPropsFirst=argValueToBoolean(a.requiredPropsFirst),this.sortPropsAlphabetically=argValueToBoolean(a.sortPropsAlphabetically),this.sortEnumValuesAlphabetically=argValueToBoolean(a.sortEnumValuesAlphabetically),this.sortOperationsAlphabetically=argValueToBoolean(a.sortOperationsAlphabetically),this.sortTagsAlphabetically=argValueToBoolean(a.sortTagsAlphabetically),this.nativeScrollbars=argValueToBoolean(a.nativeScrollbars),this.pathInMiddlePanel=argValueToBoolean(a.pathInMiddlePanel),this.untrustedDefinition=argValueToBoolean(a.untrustedDefinition),this.hideDownloadButton=void 0===a.hideDownloadButton?null:argValueToBoolean(a.hideDownloadButton),this.downloadDefinitionUrl=a.downloadDefinitionUrl,this.hideInfoDescription=argValueToBoolean(a.hideInfoDescription),this.disableSearch=argValueToBoolean(a.disableSearch),this.onlyRequiredInSamples=argValueToBoolean(a.onlyRequiredInSamples),this.generatedPayloadSamplesMaxDepth=argValueToInt(a.generatedPayloadSamplesMaxDepth)||8,this.sendXUserAgentInTryIt=argValueToBoolean(a.sendXUserAgentInTryIt),this.showExtensions=e.normalizeShowExtensions(a.showExtensions),this.preserveOriginalExtensionsName=argValueToBoolean(a.preserveOriginalExtensionsName,!1),this.hideSingleRequestSampleTab=argValueToBoolean(a.hideSingleRequestSampleTab),this.hideRequestPayloadSample=argValueToBoolean(a.hideRequestPayloadSample),this.menuToggle=argValueToBoolean(a.menuToggle,!0),this.jsonSampleExpandLevel=argValueToExpandLevel(a.jsonSampleExpandLevel,2),this.enumSkipQuotes=argValueToBoolean(a.enumSkipQuotes),this.hideSchemaTitles=argValueToBoolean(a.hideSchemaTitles),this.hideSecuritySection=argValueToBoolean(a.hideSecuritySection),this.showSecuritySchemeType=argValueToBoolean(a.showSecuritySchemeType),this.simpleOneOfTypeLabel=argValueToBoolean(a.simpleOneOfTypeLabel),this.payloadSampleIdx=e.normalizePayloadSampleIdx(a.payloadSampleIdx),this.expandSingleSchemaField=argValueToBoolean(a.expandSingleSchemaField),this.schemaExpansionLevel=argValueToExpandLevel(a.schemaExpansionLevel),this.samplesTabsMaxCount=argValueToInt(a.samplesTabsMaxCount)||5,this.unstable_tryItButtonOverride=a.unstable_tryItButtonOverride||null,this.unstable_ignoreMimeParameters=argValueToBoolean(a.unstable_ignoreMimeParameters),this.allowedMdComponents=a.allowedMdComponents||{},this.expandDefaultServerVariables=argValueToBoolean(a.expandDefaultServerVariables),this.expandDefaultRequest=argValueToBoolean(a.expandDefaultRequest,!0),this.expandDefaultResponse=argValueToBoolean(a.expandDefaultResponse,!0),this.maxDisplayedEnumValues=argValueToNumber(a.maxDisplayedEnumValues);var p=Array.isArray(a.ignoreNamedSchemas)?a.ignoreNamedSchemas:null===(s=a.ignoreNamedSchemas)||void 0===s?void 0:s.split(",").map((function(e){return e.trim()}));this.ignoreNamedSchemas=new Set(p),this.unstable_externalCodeSamples=a.unstable_externalCodeSamples||[],this.hooks=a.hooks||getWindowReferenceOptions(WindowReferenceOptions.HOOKS)||{},this.hooks.ReplaceTryItAuthPanel&&!this.hooks.ReplaceTryItSecurityPanel&&(console.warn("[warn] ReplaceTryItAuthPanel is deprecated, use ReplaceTryItSecurityPanel instead"),this.hooks.ReplaceTryItSecurityPanel=this.hooks.ReplaceTryItAuthPanel),this.hideSchemaPattern=argValueToBoolean(a.hideSchemaPattern),this.hideOneOfDescription=argValueToBoolean(a.hideOneOfDescription),this.hideFab=argValueToBoolean(a.hideFab),this.markdownHeadingsAnchorLevel=argValueToNumber(a.markdownHeadingsAnchorLevel,2),this.schemaDefinitionsTagName=a.schemaDefinitionsTagName,this.minCharacterLengthToInitSearch=argValueToNumber(a.minCharacterLengthToInitSearch,3),this.maxResponseHeadersToShowInTryIt=argValueToNumber(a.maxResponseHeadersToShowInTryIt),this.showWebhookVerb=argValueToBoolean(a.showWebhookVerb),this.showObjectSchemaExamples=argValueToBoolean(a.showObjectSchemaExamples),this.showAccessMode=argValueToBoolean(a.showAccessMode),this.disableTryItRequestUrlEncoding=argValueToBoolean(a.disableTryItRequestUrlEncoding,!1)}return Object.defineProperty(e,"normalizeExpandResponses",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("all"===e)return"all";if("string"==typeof e){var a={};return e.split(",").forEach((function(e){a[e.trim()]=!0})),a}return void 0!==e&&console.warn('expandResponses must be a string but received value "'+e+'" of type '+typeof e),{}}}),Object.defineProperty(e,"normalizeHideHostname",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e}}),Object.defineProperty(e,"normalizeScrollYOffset",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("string"==typeof e&&!isNumeric(e)){var a=querySelector(e);a||console.warn("scrollYOffset value is a selector to non-existing element. Using offset 0 by default");var i=a&&a.getBoundingClientRect().bottom||0;return function(){return i}}return"number"==typeof e||isNumeric(e)?function(){return"number"==typeof e?e:parseFloat(e)}:"function"==typeof e?function(){var a=e();return"number"!=typeof a&&console.warn('scrollYOffset should return number but returned value "'+a+'" of type '+typeof a),a}:(void 0!==e&&console.warn("Wrong value for scrollYOffset ReDoc option: should be string, number or function"),function(){return 0})}}),Object.defineProperty(e,"normalizeShowExtensions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e)return!1;if(""===e)return!0;if("string"!=typeof e)return e;switch(e){case"true":return!0;case"false":return!1;default:return e.split(",").map((function(e){return e.trim()}))}}}),Object.defineProperty(e,"normalizePayloadSampleIdx",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"number"==typeof e?Math.max(0,e):"string"==typeof e&&isFinite(e)?parseInt(e,10):0}}),__decorate([observable],e.prototype,"showConsole",void 0),e}();export{RedocNormalizedOptions};
2
2
  //# sourceMappingURL=RedocNormalizedOptions.js.map
@@ -88,5 +88,6 @@ export declare class OperationModel implements IMenuItem {
88
88
  setRequestValues(values: {
89
89
  [field: string]: any;
90
90
  }): void;
91
+ private mergeInMockServer;
91
92
  private generateCodeSamples;
92
93
  }
@@ -1,2 +1,2 @@
1
- import{__assign,__decorate}from"tslib";import{action,makeObservable,observable}from"mobx";import{extractExtensions,getOperationSummary,getStatusCodeType,isStatusCode,memoize,mergeParams,normalizeServers,sanitizeItemId,sortByField,sortByRequired}from"../../utils";import{getCodeSample}from"../../../../services/code-samples/generator";import{getInitialServerWithVariables}from"../../../../components/console/utils";import{CallbackModel}from"./Callback";import{FieldModel}from"./Field";import{RequestBodyModel}from"./RequestBody";import{ResponseModel}from"./Response";import{SecurityRequirementModel}from"./SecurityRequirement";export function isPayloadSample(e){return"payload"===e.lang&&"requestBodyContent"in e}var isCodeSamplesWarningPrinted=!1,OperationModel=function(){function e(e,t,i,r,o){var a,n;void 0===o&&(o=!1),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"operationDefinition",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),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,"href",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"operation"}),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,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ready",{enumerable:!0,configurable:!0,writable:!0,value:!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,"activeMimeName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeServer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultMimeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"operationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deprecated",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"path",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"servers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"security",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isWebhook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.pointer=t.pointer,this.description=t.description,this.parent=i,this.externalDocs=t.externalDocs,this.deprecated=!!t.deprecated,this.httpVerb=t.httpVerb,this.deprecated=!!t.deprecated,this.operationId=t.operationId,this.path=t.pathName,this.isCallback=o,this.isWebhook=t.isWebhook,this.isEvent=this.isCallback||this.isWebhook,this.name=getOperationSummary(t),this.defaultExampleName=t.defaultSampleName;var l=null===(n=null===(a=this.requestBody)||void 0===a?void 0:a.content)||void 0===n?void 0:n.mediaTypes,s=(l||[])[0],p=Object.keys((null==s?void 0:s.examples)||[])[0];this.activeExampleName=!1!==t.defaultSampleName&&(t.defaultSampleName||p),this.defaultMimeType=t.defaultMimeType;var u=null==l?void 0:l.find((function(e){return e.name===t.defaultMimeType}));this.activeMimeName=(null==u?void 0:u.name)||(null==s?void 0:s.name),this.isCallback?(this.security=(t.security||[]).map((function(t){return new SecurityRequirementModel(t,e)})),this.servers=normalizeServers("",t.servers||t.pathServers||[])):(this.id=sanitizeItemId(void 0!==t.operationId?"operation/"+t.operationId:void 0!==i?i.id+this.pointer:this.pointer),this.security=(t.security||e.definition.security||[]).map((function(t){return new SecurityRequirementModel(t,e)})),this.servers=normalizeServers(e.definitionUrl,t.servers||t.pathServers||e.definition.servers||[])),r.showExtensions&&(this.extensions=extractExtensions(t,r.showExtensions)),this.activeServer=getInitialServerWithVariables(this.servers)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),Object.defineProperty(e.prototype,"toggle",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!this.expanded}}),Object.defineProperty(e.prototype,"activateMimeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeMimeName=e}}),Object.defineProperty(e.prototype,"activateExampleName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeExampleName=e}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(e.prototype,"requestBody",{get:function(){return this.operationDefinition.requestBody&&new RequestBodyModel({parser:this.parser,infoOrRef:this.operationDefinition.requestBody,options:this.options,operation:this,isEvent:this.isEvent})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){var e,t=null===(e=this.requestBody)||void 0===e?void 0:e.content;return(null==t?void 0:t.hasSample)?{lang:"payload",label:"Payload",source:"",requestBodyContent:t}:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSamples",{get:function(){var e,t;return(null===(t=null===(e=this.requestBody)||void 0===e?void 0:e.content)||void 0===t?void 0:t.hasSample)||this.definitionSamples.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definitionSamples",{get:function(){var e=this.operationDefinition["x-codeSamples"]||this.operationDefinition["x-code-samples"]||[];return this.operationDefinition["x-code-samples"]&&!isCodeSamplesWarningPrinted&&(isCodeSamplesWarningPrinted=!0,console.warn('"x-code-samples" is deprecated. Use "x-codeSamples" instead')),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allCodeSamples",{get:function(){var e,t=this.options,i=t.payloadSampleIdx,r=t.hideRequestPayloadSample,o=[];if(!this.isWebhook){var a=this.options.generateCodeSamples||{},n=new Set(this.definitionSamples.map((function(e){return e.lang.toLowerCase()}))),l=(null===(e=a.languages)||void 0===e?void 0:e.filter((function(e){var t=e.lang;return!n.has(t.toLowerCase())})))||[];o=this.generateCodeSamples(l,a)}var s=this.definitionSamples.concat(o),p=Math.min(s.length,i);return this.payload&&!r&&s.splice(p,0,this.payload),s},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parameters",{get:function(){var e=this,t=mergeParams(this.parser,this.operationDefinition.pathParameters,this.operationDefinition.parameters).map((function(t){return new FieldModel(e.parser,t,e.pointer,e.options,void 0,{operation:e,type:"request"})}));return this.options.sortPropsAlphabetically?sortByField(t,"name"):this.options.requiredPropsFirst?sortByRequired(t):t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responses",{get:function(){var e=this,t=!1;return Object.keys(this.operationDefinition.responses||[]).filter((function(e){return"default"===e||("success"===getStatusCodeType(e)&&(t=!0),isStatusCode(e))})).map((function(i){return new ResponseModel({parser:e.parser,code:i,defaultAsError:t,infoOrRef:e.operationDefinition.responses[i],options:e.options,isEvent:e.isEvent,operation:e})}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"callbacks",{get:function(){var e=this;return Object.keys(this.operationDefinition.callbacks||[]).map((function(t){var i;return new CallbackModel(e.parser,t,null===(i=e.operationDefinition.callbacks)||void 0===i?void 0:i[t],e.pointer,e.options)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hideTryItPanel",{get:function(){return!0===this.operationDefinition["x-hideTryItPanel"]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"setActiveServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeServer=e}}),Object.defineProperty(e.prototype,"setRequestValues",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.requestValues=e}}),Object.defineProperty(e.prototype,"generateCodeSamples",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=t.skipOptionalParameters,o=t.withOAuth2Call;return e.map((function(e){var t=e.lang,a=e.label,n=e.options;return{lang:t,label:a,get:function(e){return getCodeSample(__assign(__assign({},e),{lang:t,options:__assign(__assign({},n),{skipOptionalParameters:r,withOAuth2Call:o,spec:i.parser.definition,generatedPayloadSamplesMaxDepth:i.options.generatedPayloadSamplesMaxDepth})}))}}}))}}),__decorate([observable],e.prototype,"ready",void 0),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([observable],e.prototype,"activeMimeName",void 0),__decorate([observable],e.prototype,"activeExampleName",void 0),__decorate([observable.ref],e.prototype,"activeServer",void 0),__decorate([observable],e.prototype,"requestValues",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"deactivate",null),__decorate([action],e.prototype,"toggle",null),__decorate([action],e.prototype,"activateMimeName",null),__decorate([action],e.prototype,"activateExampleName",null),__decorate([memoize],e.prototype,"requestBody",null),__decorate([memoize],e.prototype,"payload",null),__decorate([memoize],e.prototype,"hasSamples",null),__decorate([memoize],e.prototype,"definitionSamples",null),__decorate([memoize],e.prototype,"allCodeSamples",null),__decorate([memoize],e.prototype,"parameters",null),__decorate([memoize],e.prototype,"responses",null),__decorate([memoize],e.prototype,"callbacks",null),__decorate([memoize],e.prototype,"hideTryItPanel",null),__decorate([action],e.prototype,"setActiveServer",null),__decorate([action],e.prototype,"setRequestValues",null),e}();export{OperationModel};
1
+ import{__assign,__decorate,__spreadArray}from"tslib";import{action,makeObservable,observable}from"mobx";import{extractExtensions,getOperationSummary,getStatusCodeType,isStatusCode,memoize,mergeParams,normalizeServers,sanitizeItemId,sortByField,sortByRequired}from"../../utils";import{getCodeSample}from"../../../../services/code-samples/generator";import{getInitialServerWithVariables}from"../../../../components/console/utils";import{CallbackModel}from"./Callback";import{FieldModel}from"./Field";import{RequestBodyModel}from"./RequestBody";import{ResponseModel}from"./Response";import{SecurityRequirementModel}from"./SecurityRequirement";export function isPayloadSample(e){return"payload"===e.lang&&"requestBodyContent"in e}var isCodeSamplesWarningPrinted=!1,OperationModel=function(){function e(e,t,r,i,o){var a,n;void 0===o&&(o=!1),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"operationDefinition",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),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,"href",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"operation"}),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,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ready",{enumerable:!0,configurable:!0,writable:!0,value:!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,"activeMimeName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeServer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestValues",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultExampleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultMimeType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"operationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpVerb",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deprecated",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"path",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"servers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"security",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isWebhook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.pointer=t.pointer,this.description=t.description,this.parent=r,this.externalDocs=t.externalDocs,this.deprecated=!!t.deprecated,this.httpVerb=t.httpVerb,this.deprecated=!!t.deprecated,this.operationId=t.operationId,this.path=t.pathName,this.isCallback=o,this.isWebhook=t.isWebhook,this.isEvent=this.isCallback||this.isWebhook,this.name=getOperationSummary(t),this.defaultExampleName=t.defaultSampleName;var l=null===(n=null===(a=this.requestBody)||void 0===a?void 0:a.content)||void 0===n?void 0:n.mediaTypes,s=(l||[])[0],p=Object.keys((null==s?void 0:s.examples)||[])[0];this.activeExampleName=!1!==t.defaultSampleName&&(t.defaultSampleName||p),this.defaultMimeType=t.defaultMimeType;var u=null==l?void 0:l.find((function(e){return e.name===t.defaultMimeType}));if(this.activeMimeName=(null==u?void 0:u.name)||(null==s?void 0:s.name),this.isCallback)this.security=(t.security||[]).map((function(t){return new SecurityRequirementModel(t,e)})),this.servers=normalizeServers("",t.servers||t.pathServers||[]);else{this.id=sanitizeItemId(void 0!==t.operationId?"operation/"+t.operationId:void 0!==r?r.id+this.pointer:this.pointer),this.security=(t.security||e.definition.security||[]).map((function(t){return new SecurityRequirementModel(t,e)}));var d=this.mergeInMockServer(t.servers||t.pathServers||e.definition.servers||[],i.mockServer);this.servers=normalizeServers(e.definitionUrl,d)}i.showExtensions&&(this.extensions=extractExtensions(t,i.showExtensions)),this.activeServer=getInitialServerWithVariables(this.servers)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),Object.defineProperty(e.prototype,"toggle",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!this.expanded}}),Object.defineProperty(e.prototype,"activateMimeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeMimeName=e}}),Object.defineProperty(e.prototype,"activateExampleName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeExampleName=e}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(e.prototype,"requestBody",{get:function(){return this.operationDefinition.requestBody&&new RequestBodyModel({parser:this.parser,infoOrRef:this.operationDefinition.requestBody,options:this.options,operation:this,isEvent:this.isEvent})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){var e,t=null===(e=this.requestBody)||void 0===e?void 0:e.content;return(null==t?void 0:t.hasSample)?{lang:"payload",label:"Payload",source:"",requestBodyContent:t}:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSamples",{get:function(){var e,t;return(null===(t=null===(e=this.requestBody)||void 0===e?void 0:e.content)||void 0===t?void 0:t.hasSample)||this.definitionSamples.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definitionSamples",{get:function(){var e=this.operationDefinition["x-codeSamples"]||this.operationDefinition["x-code-samples"]||[];return this.operationDefinition["x-code-samples"]&&!isCodeSamplesWarningPrinted&&(isCodeSamplesWarningPrinted=!0,console.warn('"x-code-samples" is deprecated. Use "x-codeSamples" instead')),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allCodeSamples",{get:function(){var e,t=this.options,r=t.payloadSampleIdx,i=t.hideRequestPayloadSample,o=[];if(!this.isWebhook){var a=this.options.generateCodeSamples||{},n=new Set(this.definitionSamples.map((function(e){return e.lang.toLowerCase()}))),l=(null===(e=a.languages)||void 0===e?void 0:e.filter((function(e){var t=e.lang;return!n.has(t.toLowerCase())})))||[];o=this.generateCodeSamples(l,a)}var s=this.definitionSamples.concat(o),p=Math.min(s.length,r);return this.payload&&!i&&s.splice(p,0,this.payload),s},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parameters",{get:function(){var e=this,t=mergeParams(this.parser,this.operationDefinition.pathParameters,this.operationDefinition.parameters).map((function(t){return new FieldModel(e.parser,t,e.pointer,e.options,void 0,{operation:e,type:"request"})}));return this.options.sortPropsAlphabetically?sortByField(t,"name"):this.options.requiredPropsFirst?sortByRequired(t):t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responses",{get:function(){var e=this,t=!1;return Object.keys(this.operationDefinition.responses||[]).filter((function(e){return"default"===e||("success"===getStatusCodeType(e)&&(t=!0),isStatusCode(e))})).map((function(r){return new ResponseModel({parser:e.parser,code:r,defaultAsError:t,infoOrRef:e.operationDefinition.responses[r],options:e.options,isEvent:e.isEvent,operation:e})}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"callbacks",{get:function(){var e=this;return Object.keys(this.operationDefinition.callbacks||[]).map((function(t){var r;return new CallbackModel(e.parser,t,null===(r=e.operationDefinition.callbacks)||void 0===r?void 0:r[t],e.pointer,e.options)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hideTryItPanel",{get:function(){return!0===this.operationDefinition["x-hideTryItPanel"]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"setActiveServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeServer=e}}),Object.defineProperty(e.prototype,"setRequestValues",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.requestValues=e}}),Object.defineProperty(e.prototype,"mergeInMockServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!t)return e;var r={url:t.url,description:t.description};switch(t.position){case"first":return __spreadArray([r],e,!0);case"last":return __spreadArray(__spreadArray([],e,!0),[r],!1);case"replace":return[r];default:return e}}}),Object.defineProperty(e.prototype,"generateCodeSamples",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=t.skipOptionalParameters,o=t.withOAuth2Call;return e.map((function(e){var t=e.lang,a=e.label,n=e.options;return{lang:t,label:a,get:function(e){return getCodeSample(__assign(__assign({},e),{lang:t,options:__assign(__assign({},n),{skipOptionalParameters:i,withOAuth2Call:o,spec:r.parser.definition,generatedPayloadSamplesMaxDepth:r.options.generatedPayloadSamplesMaxDepth})}))}}}))}}),__decorate([observable],e.prototype,"ready",void 0),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([observable],e.prototype,"activeMimeName",void 0),__decorate([observable],e.prototype,"activeExampleName",void 0),__decorate([observable.ref],e.prototype,"activeServer",void 0),__decorate([observable],e.prototype,"requestValues",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"deactivate",null),__decorate([action],e.prototype,"toggle",null),__decorate([action],e.prototype,"activateMimeName",null),__decorate([action],e.prototype,"activateExampleName",null),__decorate([memoize],e.prototype,"requestBody",null),__decorate([memoize],e.prototype,"payload",null),__decorate([memoize],e.prototype,"hasSamples",null),__decorate([memoize],e.prototype,"definitionSamples",null),__decorate([memoize],e.prototype,"allCodeSamples",null),__decorate([memoize],e.prototype,"parameters",null),__decorate([memoize],e.prototype,"responses",null),__decorate([memoize],e.prototype,"callbacks",null),__decorate([memoize],e.prototype,"hideTryItPanel",null),__decorate([action],e.prototype,"setActiveServer",null),__decorate([action],e.prototype,"setRequestValues",null),e}();export{OperationModel};
2
2
  //# sourceMappingURL=Operation.js.map
@@ -182,6 +182,11 @@ export interface RedocRawOptions {
182
182
  label: string;
183
183
  link: string;
184
184
  };
185
+ mockServer?: {
186
+ url?: string;
187
+ position?: 'first' | 'last' | 'replace' | 'off';
188
+ description?: string;
189
+ };
185
190
  allowedMdComponents?: Record<string, MDXComponentMeta>;
186
191
  labels?: LabelsConfigRaw;
187
192
  enumSkipQuotes?: boolean | string;
@@ -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{bind,debounce}from"decko";import{createParsedDocument,IS_BROWSER,MarkerService,RedocNormalizedOptions,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,ScrollService,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SpecStore}from"../redoc-lib";import{PullRight,RedocResponse}from"../components/pluggable";import{fromLocalStorage,fromSessionStorage,getWindowReferenceOptions,setGlobalStore,toLocalStorage,toSessionStorage}from"../utils";import{SecurityDefs}from"../redoc-lib/src/components/SecurityRequirement/SecurityDefs";import{WindowReferenceOptions}from"../types";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,DEFAULT_SEARCH_MAX_DEPTH,RemoteSearch}from"./SearchStore";import{extendTheme}from"./extendTheme";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{LayoutVariant}from"./store-types";import{SideNavStyle}from"./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}),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="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),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),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel: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||SideNavStyle.SummaryOnly,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||getWindowReferenceOptions(WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||getWindowReferenceOptions(WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||getWindowReferenceOptions(WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||getWindowReferenceOptions(WindowReferenceOptions.REQUEST_INTERCEPTOR)||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=void 0!==this.rawOptions.routingStrategy?this.rawOptions.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||DEFAULT_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=fromSessionStorage("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,toSessionStorage("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,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(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){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),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 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=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),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([bind,debounce(500)],e.prototype,"activateSampleLanguage",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[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_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)};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{bind,debounce}from"decko";import{createParsedDocument,IS_BROWSER,MarkerService,RedocNormalizedOptions,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,ScrollService,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SpecStore}from"../redoc-lib";import{PullRight,RedocResponse}from"../components/pluggable";import{fromLocalStorage,fromSessionStorage,getWindowReferenceOptions,setGlobalStore,toLocalStorage,toSessionStorage}from"../utils";import{SecurityDefs}from"../redoc-lib/src/components/SecurityRequirement/SecurityDefs";import{WindowReferenceOptions}from"../types";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,DEFAULT_SEARCH_MAX_DEPTH,RemoteSearch}from"./SearchStore";import{extendTheme}from"./extendTheme";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{LayoutVariant}from"./store-types";import{SideNavStyle}from"./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}),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="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),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,a;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel: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||SideNavStyle.SummaryOnly,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.mockServer=(null===(r=this.rawOptions.mockServer)||void 0===r?void 0:r.url)?{url:this.rawOptions.mockServer.url,position:this.rawOptions.mockServer.position||"first",description:this.rawOptions.mockServer.description||"Mock server"}:null,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||getWindowReferenceOptions(WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||getWindowReferenceOptions(WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||getWindowReferenceOptions(WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||getWindowReferenceOptions(WindowReferenceOptions.REQUEST_INTERCEPTOR)||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var s="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(a=this.rawOptions)||void 0===a?void 0:a.pagination)&&(null==s?void 0:s.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==s?void 0:s.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||DEFAULT_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=fromSessionStorage("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,toSessionStorage("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,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(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){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),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 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=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),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([bind,debounce(500)],e.prototype,"activateSampleLanguage",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[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_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)};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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reference-docs",
3
- "version": "2.34.0",
3
+ "version": "2.35.0",
4
4
  "description": "Redocly Reference Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",