@redocly/reference-docs 2.1.15 → 2.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli/commands/redocly-docs-cli.min.js +28 -28
- package/dist/console.redocly-reference-docs.min.js +3 -3
- package/dist/oauth2-redirect.js +2 -2
- package/dist/redocly-reference-docs.min.js +11 -11
- package/lib/components/Endpoint/Endpoint.d.ts +2 -2
- package/lib/components/Endpoint/Endpoint.js +1 -1
- package/lib/components/Endpoint/ServerList.d.ts +2 -2
- package/lib/components/Endpoint/ServerList.js +1 -1
- package/lib/components/Endpoint/Summary.d.ts +2 -2
- package/lib/components/Endpoint/Summary.js +1 -1
- package/lib/components/NextSectionButton.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/Panel/Accordion.js +1 -1
- package/lib/components/Panel/PanelBody.d.ts +1 -1
- package/lib/components/Panel/PanelBody.js +1 -1
- package/lib/components/Panel/PanelComponent.d.ts +2 -3
- package/lib/components/Panel/PanelComponent.js +1 -1
- package/lib/components/Panel/ResponsePanel.js +1 -1
- package/lib/components/ProProviders.js +1 -1
- package/lib/components/RedoclyReferenceDocs.d.ts +3 -3
- package/lib/components/RedoclyReferenceDocs.js +1 -1
- package/lib/components/Samples/ExampleSwitch.d.ts +1 -1
- package/lib/components/Samples/ExampleSwitch.js +1 -1
- package/lib/components/Samples/SamplesTabs.js +1 -1
- package/lib/components/Search/MenuItemProSearch.d.ts +4 -4
- package/lib/components/Search/ProSearchBox.d.ts +6 -6
- package/lib/components/Search/ProSearchBox.js +1 -1
- package/lib/components/Search/SearchField.js +1 -1
- package/lib/components/Search/styled.d.ts +3 -3
- package/lib/components/StoreProvider.d.ts +4 -4
- package/lib/components/StoreProvider.js +1 -1
- package/lib/components/Tabs/CollapsingTabs/CollapsingTabs.js +1 -1
- package/lib/components/Tabs/CollapsingTabs/CollapsingTabsBase.js +1 -1
- package/lib/components/common/Checkbox.js +1 -1
- package/lib/components/common/FileUpload/helper.d.ts +1 -1
- package/lib/components/common/FileUpload/helper.js +1 -1
- package/lib/components/common/TextField.d.ts +3 -3
- package/lib/components/common/TextField.js +1 -1
- package/lib/components/console/OperationParameters.d.ts +1 -1
- package/lib/components/console/OperationParameters.js +1 -1
- package/lib/components/console/RequestBody.js +1 -1
- package/lib/components/console/ResponsePanel.d.ts +1 -1
- package/lib/components/console/ResponsePanel.js +1 -1
- package/lib/components/console/ServerDropdown.d.ts +1 -1
- package/lib/components/console/ServerDropdown.js +1 -1
- package/lib/redoc-lib/src/common-elements/LinkToField.d.ts +3 -2
- package/lib/redoc-lib/src/common-elements/LinkToField.js +1 -1
- package/lib/redoc-lib/src/components/ApiLogo/ApiLogo.js +1 -1
- package/lib/redoc-lib/src/components/ApiLogo/styled.elements.d.ts +5 -2
- package/lib/redoc-lib/src/components/ApiLogo/styled.elements.js +1 -1
- package/lib/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
- package/lib/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib/redoc-lib/src/components/SideMenu/MenuItem.js +1 -1
- package/lib/redoc-lib/src/services/RedocNormalizedOptions.js +1 -1
- package/lib/redoc-lib/src/services/models/Example.js +1 -1
- package/lib/redoc-lib/src/services/models/Field.d.ts +1 -1
- package/lib/redoc-lib/src/services/models/Operation.d.ts +1 -1
- package/lib/redoc-lib/src/services/models/Operation.js +1 -1
- package/lib/redoc-lib/src/services/models/Schema.d.ts +1 -1
- package/lib/redoc-lib/src/services/models/Schema.js +1 -1
- package/lib/redoc-lib/src/theme.d.ts +1 -0
- package/lib/redoc-lib/src/utils/JsonPointer.d.ts +5 -5
- package/lib/redoc-lib/src/utils/JsonPointer.js +1 -1
- package/lib/redoc-lib/src/utils/loadAndBundleSpec.js +1 -1
- package/lib/redoc-lib/src/utils/memoize.js +1 -1
- package/lib/redoc-lib/src/utils/openapi.d.ts +0 -2
- package/lib/services/ProMenu.d.ts +2 -5
- package/lib/services/ProStore.d.ts +3 -2
- package/lib/services/ProStore.js +1 -1
- package/lib/services/code-samples/generator.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/reducer.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +1 -1
- package/lib/services/code-samples/httpsnippet/targets/php/utils.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/targets/php/utils.js +1 -1
- package/lib/services/extendTheme.d.ts +4 -4
- package/lib/services/extendTheme.js +1 -1
- package/lib/services/history/ProHashHistoryService.d.ts +1 -1
- package/lib/services/history/PushStateHistoryService.d.ts +1 -1
- package/lib/services/utils.d.ts +1 -1
- package/lib/standalone.d.ts +4 -3
- package/lib/standalone.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib-esm/components/Endpoint/Endpoint.d.ts +2 -2
- package/lib-esm/components/Endpoint/Endpoint.js +1 -1
- package/lib-esm/components/Endpoint/ServerList.d.ts +2 -2
- package/lib-esm/components/Endpoint/ServerList.js +1 -1
- package/lib-esm/components/Endpoint/Summary.d.ts +2 -2
- package/lib-esm/components/Endpoint/Summary.js +1 -1
- package/lib-esm/components/NextSectionButton.js +1 -1
- package/lib-esm/components/Overlay.js +1 -1
- package/lib-esm/components/Panel/Accordion.js +1 -1
- package/lib-esm/components/Panel/PanelBody.d.ts +1 -1
- package/lib-esm/components/Panel/PanelBody.js +1 -1
- package/lib-esm/components/Panel/PanelComponent.d.ts +2 -3
- package/lib-esm/components/Panel/PanelComponent.js +1 -1
- package/lib-esm/components/Panel/ResponsePanel.js +1 -1
- package/lib-esm/components/ProProviders.js +1 -1
- package/lib-esm/components/RedoclyReferenceDocs.d.ts +3 -3
- package/lib-esm/components/RedoclyReferenceDocs.js +1 -1
- package/lib-esm/components/Samples/ExampleSwitch.d.ts +1 -1
- package/lib-esm/components/Samples/ExampleSwitch.js +1 -1
- package/lib-esm/components/Samples/SamplesTabs.js +1 -1
- package/lib-esm/components/Search/MenuItemProSearch.d.ts +4 -4
- package/lib-esm/components/Search/ProSearchBox.d.ts +6 -6
- package/lib-esm/components/Search/ProSearchBox.js +1 -1
- package/lib-esm/components/Search/SearchField.js +1 -1
- package/lib-esm/components/Search/styled.d.ts +3 -3
- package/lib-esm/components/StoreProvider.d.ts +4 -4
- package/lib-esm/components/StoreProvider.js +1 -1
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTabs.js +1 -1
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTabsBase.js +1 -1
- package/lib-esm/components/common/Checkbox.js +1 -1
- package/lib-esm/components/common/FileUpload/helper.d.ts +1 -1
- package/lib-esm/components/common/FileUpload/helper.js +1 -1
- package/lib-esm/components/common/TextField.d.ts +3 -3
- package/lib-esm/components/common/TextField.js +1 -1
- package/lib-esm/components/console/OperationParameters.d.ts +1 -1
- package/lib-esm/components/console/OperationParameters.js +1 -1
- package/lib-esm/components/console/RequestBody.js +1 -1
- package/lib-esm/components/console/ResponsePanel.d.ts +1 -1
- package/lib-esm/components/console/ResponsePanel.js +1 -1
- package/lib-esm/components/console/ServerDropdown.d.ts +1 -1
- package/lib-esm/components/console/ServerDropdown.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/LinkToField.d.ts +3 -2
- package/lib-esm/redoc-lib/src/common-elements/LinkToField.js +1 -1
- package/lib-esm/redoc-lib/src/components/ApiLogo/ApiLogo.js +1 -1
- package/lib-esm/redoc-lib/src/components/ApiLogo/styled.elements.d.ts +5 -2
- package/lib-esm/redoc-lib/src/components/ApiLogo/styled.elements.js +1 -1
- package/lib-esm/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/SideMenu/MenuItem.js +1 -1
- package/lib-esm/redoc-lib/src/services/RedocNormalizedOptions.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/Example.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/Field.d.ts +1 -1
- package/lib-esm/redoc-lib/src/services/models/Operation.d.ts +1 -1
- package/lib-esm/redoc-lib/src/services/models/Operation.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/Schema.d.ts +1 -1
- package/lib-esm/redoc-lib/src/services/models/Schema.js +1 -1
- package/lib-esm/redoc-lib/src/theme.d.ts +1 -0
- package/lib-esm/redoc-lib/src/utils/JsonPointer.d.ts +5 -5
- package/lib-esm/redoc-lib/src/utils/JsonPointer.js +1 -1
- package/lib-esm/redoc-lib/src/utils/loadAndBundleSpec.js +1 -1
- package/lib-esm/redoc-lib/src/utils/memoize.js +1 -1
- package/lib-esm/redoc-lib/src/utils/openapi.d.ts +0 -2
- package/lib-esm/services/ProMenu.d.ts +2 -5
- package/lib-esm/services/ProStore.d.ts +3 -2
- package/lib-esm/services/ProStore.js +1 -1
- package/lib-esm/services/code-samples/generator.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/reducer.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/java8/apachehttp.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/java8/apachehttp.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/php/utils.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/php/utils.js +1 -1
- package/lib-esm/services/extendTheme.d.ts +4 -4
- package/lib-esm/services/extendTheme.js +1 -1
- package/lib-esm/services/history/ProHashHistoryService.d.ts +1 -1
- package/lib-esm/services/history/PushStateHistoryService.d.ts +1 -1
- package/lib-esm/services/utils.d.ts +1 -1
- package/lib-esm/standalone.d.ts +4 -3
- package/lib-esm/standalone.js +1 -1
- package/lib-esm/utils.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__makeTemplateObject}from"tslib";import{observer}from"mobx-react";import*as React from"react";import{ShelfIcon}from"../../common-elements/icons";import{shortenHTTPVerb}from"../../utils/openapi";import{MenuItems}from"./MenuItems";import{MenuItemLabel,MenuItemLi,MenuItemTitle,OperationBadge}from"./styled.elements";import{OptionsContext}from"../OptionsProvider";import styled from"../../styled-components";import{l}from"../../services/Labels";var MenuItemLink=MenuItemLabel.withComponent("a");export var MenuExternalLink=observer((function(e){var t=e.link;return React.createElement(MenuItemLi,{depth:1},React.createElement(MenuItemLink,{href:t.link,target:t.target,active:!1,depth:1},React.createElement(MenuItemTitle,{title:t.label},t.label)))}));export var MenuItem=observer((function(e){var t=e.item,n=e.withoutChildren,a=React.createRef(),r=React.useState(!1),i=r[0],
|
|
1
|
+
import{__assign,__makeTemplateObject}from"tslib";import{observer}from"mobx-react";import*as React from"react";import{ShelfIcon}from"../../common-elements/icons";import{shortenHTTPVerb}from"../../utils/openapi";import{MenuItems}from"./MenuItems";import{MenuItemLabel,MenuItemLi,MenuItemTitle,OperationBadge}from"./styled.elements";import{OptionsContext}from"../OptionsProvider";import styled from"../../styled-components";import{l}from"../../services/Labels";var MenuItemLink=MenuItemLabel.withComponent("a");export var MenuExternalLink=observer((function(e){var t=e.link;return React.createElement(MenuItemLi,{depth:1},React.createElement(MenuItemLink,{href:t.link,target:t.target,active:!1,depth:1},React.createElement(MenuItemTitle,{title:t.label},t.label)))}));export var MenuItem=observer((function(e){var t=e.item,n=e.withoutChildren,a=React.createRef(),r=React.useState(!1),i=r[0],o=r[1],m=React.useState("group"===t.type&&t.expanded),l=m[0],c=m[1];React.useEffect((function(){o(t.active)}),[t.active]),React.useEffect((function(){c(t.expanded)}),[t.expanded]);var p=React.useCallback((function(t){var n;null===(n=e.onActivate)||void 0===n||n.call(e,e.item,t),t.stopPropagation()}),[e.onActivate,e.item]);return React.useEffect((function(){e.item.active&&a.current&&a.current.scrollIntoViewIfNeeded()}),[e.item,e.item.active,a]),React.createElement(MenuItemLi,{onClick:p,depth:t.depth,"data-item-id":t.id},"operation"===t.type?React.createElement(ProOperationMenuItemContent,__assign({},e,{item:t,ref:a})):React.createElement(MenuItemLabel,{depth:t.depth,active:i,type:t.type,ref:a,hasChildren:t.items&&t.items.length>0},t.depth>0&&t.items.length>0&&React.createElement(ShelfIcon,{direction:l?"down":"right"})||null,React.createElement(MenuItemTitle,{title:t.name},t.name,e.children)),!n&&t.items&&t.items.length>0&&React.createElement(MenuItems,{expanded:l,items:t.items,onActivate:e.onActivate}))}));function ProOperationMenuItemContentC(e,t){var n,a,r=e.item;return"path-first"!==React.useContext(OptionsContext).sideNavStyle&&!r.search||"operation"!==r.type?(n=r.name,a=null):(n=React.createElement(MenuItemPath,{title:r.path}," ",r.path," "),a=React.createElement(MenuItemDescription,null," ",r.name," ")),React.createElement(ProMenuItemLabel,{depth:r.depth,active:r.active,deprecated:r.deprecated,ref:t},r.isWebhook?React.createElement(OperationBadge,{type:"hook"},l("webhook")):React.createElement(OperationBadge,{type:r.httpVerb},shortenHTTPVerb(r.httpVerb)),React.createElement(MenuItemTitle,{width:"calc(100% - 42px)"},n,e.children),a)}export var ProOperationMenuItemContent=observer(React.forwardRef(ProOperationMenuItemContentC));var ProMenuItemLabel=styled(MenuItemLabel)(templateObject_1||(templateObject_1=__makeTemplateObject(["\n flex-wrap: wrap;\n"],["\n flex-wrap: wrap;\n"])));export var MenuItemPath=styled.code(templateObject_2||(templateObject_2=__makeTemplateObject(["\n line-height: 1.4;\n display: inline-block;\n margin-bottom: 5px;\n ","\n"],["\n line-height: 1.4;\n display: inline-block;\n margin-bottom: 5px;\n ","\n"])),(function(e){var t;return(null===(t=e.theme.sidebar)||void 0===t?void 0:t.breakPath)?"word-break: break-all":""}));var templateObject_1,templateObject_2,templateObject_3,MenuItemDescription=styled.small(templateObject_3||(templateObject_3=__makeTemplateObject(["\n display: block;\n font-size: 0.87em;\n line-height: 1.2;\n"],["\n display: block;\n font-size: 0.87em;\n line-height: 1.2;\n"])));
|
|
2
2
|
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate}from"tslib";import{observable,makeObservable}from"mobx";import defaultTheme,{resolveTheme}from"../theme";import{isNumeric,mergeObjects,querySelector}from"../utils";import{setRedocLabels}from"./Labels";export function argValueToBoolean(e,a){return void 0===e?a||!1:"string"==typeof e?"false"!==e:e}function argValueToNumber(e){return"string"==typeof e?parseInt(e,10):"number"==typeof e?e:void 0}function argValueToInt(e){return"string"==typeof e?parseInt(e,10):"number"==typeof e?Math.ceil(e):void 0}function argValueToExpandLevel(e,a){return void 0===a&&(a=0),"all"===e?1/0:argValueToInt(e)||a}var RedocNormalizedOptions=function(){function e(a,t){var r,i,o,l,n;void 0===t&&(t={}),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,"noAutoAuth",{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,"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,"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,"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,"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,"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}),makeObservable(this);var s=(a=__assign(__assign({},t),a)).theme&&a.theme.extensionsHook;(null===(r=a.theme)||void 0===r?void 0:r.menu)&&!(null===(i=a.theme)||void 0===i?void 0:i.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===(l=a.theme)||void 0===l?void 0:l.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 u=0,b=Object.entries(this.theme.breakpoints);u<b.length;u++){var d=b[u],m=d[0],c=d[1];this.theme.mediaQueries[m]="@media screen and (min-width: "+c+")"}this.theme.extensionsHook=s,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.noAutoAuth=argValueToBoolean(a.noAutoAuth),this.nativeScrollbars=argValueToBoolean(a.nativeScrollbars),this.pathInMiddlePanel=argValueToBoolean(a.pathInMiddlePanel),this.untrustedDefinition=argValueToBoolean(a.untrustedDefinition),this.hideDownloadButton=argValueToBoolean(a.hideDownloadButton),this.hideInfoDescription=argValueToBoolean(a.hideInfoDescription),this.disableSearch=argValueToBoolean(a.disableSearch),this.onlyRequiredInSamples=argValueToBoolean(a.onlyRequiredInSamples),this.generatedPayloadSamplesMaxDepth=argValueToInt(a.generatedPayloadSamplesMaxDepth)||8,this.showExtensions=e.normalizeShowExtensions(a.showExtensions),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.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.maxDisplayedEnumValues=argValueToNumber(a.maxDisplayedEnumValues);var p=Array.isArray(a.ignoreNamedSchemas)?a.ignoreNamedSchemas:null===(n=a.ignoreNamedSchemas)||void 0===n?void 0:n.split(",").map((function(e){return e.trim()}));this.ignoreNamedSchemas=new Set(p),this.unstable_externalCodeSamples=a.unstable_externalCodeSamples||[],this.hooks=a.hooks||{},this.hideSchemaPattern=argValueToBoolean(a.hideSchemaPattern)}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 t=a&&a.getBoundingClientRect().bottom||0;return function(){return t}}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{isNumeric,mergeObjects,querySelector}from"../utils";import{setRedocLabels}from"./Labels";export function argValueToBoolean(e,a){return void 0===e?a||!1:"string"==typeof e?"false"!==e:e}function argValueToNumber(e){return"string"==typeof e?parseInt(e,10):"number"==typeof e?e:void 0}function argValueToInt(e){return"string"==typeof e?parseInt(e,10):"number"==typeof e?Math.ceil(e):void 0}function argValueToExpandLevel(e,a){return void 0===a&&(a=0),"all"===e?1/0:argValueToInt(e)||a}var RedocNormalizedOptions=function(){function e(a,t){var r,i,o,l,n,s;void 0===t&&(t={}),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,"noAutoAuth",{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,"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,"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,"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,"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,"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}),makeObservable(this);var u=null===(r=(a=__assign(__assign({},t),a)).theme)||void 0===r?void 0:r.extensionsHook;(null===(i=a.theme)||void 0===i?void 0:i.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 m=d[b],c=m[0],p=m[1];this.theme.mediaQueries[c]="@media screen and (min-width: "+p+")"}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.noAutoAuth=argValueToBoolean(a.noAutoAuth),this.nativeScrollbars=argValueToBoolean(a.nativeScrollbars),this.pathInMiddlePanel=argValueToBoolean(a.pathInMiddlePanel),this.untrustedDefinition=argValueToBoolean(a.untrustedDefinition),this.hideDownloadButton=argValueToBoolean(a.hideDownloadButton),this.hideInfoDescription=argValueToBoolean(a.hideInfoDescription),this.disableSearch=argValueToBoolean(a.disableSearch),this.onlyRequiredInSamples=argValueToBoolean(a.onlyRequiredInSamples),this.generatedPayloadSamplesMaxDepth=argValueToInt(a.generatedPayloadSamplesMaxDepth)||8,this.showExtensions=e.normalizeShowExtensions(a.showExtensions),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.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.maxDisplayedEnumValues=argValueToNumber(a.maxDisplayedEnumValues);var h=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(h),this.unstable_externalCodeSamples=a.unstable_externalCodeSamples||[],this.hooks=a.hooks||{},this.hideSchemaPattern=argValueToBoolean(a.hideSchemaPattern)}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 t=a&&a.getBoundingClientRect().bottom||0;return function(){return t}}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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{resolve as urlResolve}from"url";import{isFormUrlEncoded,isJsonLike,urlFormEncodePayload}from"../../utils
|
|
1
|
+
import{resolve as urlResolve}from"url";import{isFormUrlEncoded,isJsonLike,urlFormEncodePayload}from"../../utils";var externalExamplesCache={},ExampleModel=function(){function e(e,r,l,t){Object.defineProperty(this,"mime",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"summary",{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,"externalValueUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0});var a=e.deref(r);this.value=a.value,this.summary=a.summary,this.description=a.description,a.externalValue&&(this.externalValueUrl=urlResolve(e.definitionUrl||"",a.externalValue)),e.exitRef(r),isFormUrlEncoded(l)&&this.value&&"object"==typeof this.value&&(this.value=urlFormEncodePayload(this.value,t))}return Object.defineProperty(e.prototype,"getExternalValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.externalValueUrl?(this.externalValueUrl in externalExamplesCache||(externalExamplesCache[this.externalValueUrl]=fetch(this.externalValueUrl).then((function(r){return r.text().then((function(l){if(!r.ok)return Promise.reject(new Error(l));if(!isJsonLike(e))return l;try{return JSON.parse(l)}catch(e){return l}}))}))),externalExamplesCache[this.externalValueUrl]):Promise.resolve(void 0)}}),e}();export{ExampleModel};
|
|
2
2
|
//# sourceMappingURL=Example.js.map
|
|
@@ -50,7 +50,7 @@ export declare class OperationModel implements IMenuItem {
|
|
|
50
50
|
path: string;
|
|
51
51
|
servers: OpenAPIServer[];
|
|
52
52
|
security: SecurityRequirementModel[];
|
|
53
|
-
extensions:
|
|
53
|
+
extensions: GenericObject;
|
|
54
54
|
isCallback: boolean;
|
|
55
55
|
isWebhook: boolean;
|
|
56
56
|
isEvent: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate}from"tslib";import{action,makeObservable,observable}from"mobx";import{SecurityRequirementModel}from"./SecurityRequirement";import{extractExtensions,getOperationSummary,getStatusCodeType,isStatusCode,memoize,mergeParams,normalizeServers,sanitizeItemId,sortByField,sortByRequired}from"../../utils";import{CallbackModel}from"./Callback";import{FieldModel}from"./Field";import{RequestBodyModel}from"./RequestBody";import{ResponseModel}from"./Response";import{getCodeSample}from"../../../../services/code-samples/generator";export function isPayloadSample(e){return"payload"===e.lang&&e.requestBodyContent}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,"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,"defaultExampleName",{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)||[])[0],s=Object.keys((null==l?void 0:l.examples)||[])[0];this.activeExampleName=t.defaultSampleName||s,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))}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.generateCodeSamples,r=void 0===i?{}:i,o=t.payloadSampleIdx,a=t.hideRequestPayloadSample,n=new Set(this.definitionSamples.map((function(e){return e.lang.toLowerCase()}))),l=(null===(e=r.languages)||void 0===e?void 0:e.filter((function(e){var t=e.lang;return!n.has(t.toLowerCase())})))||[],s=this.generateCodeSamples(l,r),p=this.definitionSamples.concat(s),u=Math.min(p.length,o);return this.payload&&!a&&p.splice(u,0,this.payload),p},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){return new CallbackModel(e.parser,t,e.operationDefinition.callbacks[t],e.pointer,e.options)}))},enumerable:!1,configurable:!0}),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([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),e}();export{OperationModel};
|
|
1
|
+
import{__assign,__decorate}from"tslib";import{action,makeObservable,observable}from"mobx";import{SecurityRequirementModel}from"./SecurityRequirement";import{extractExtensions,getOperationSummary,getStatusCodeType,isStatusCode,memoize,mergeParams,normalizeServers,sanitizeItemId,sortByField,sortByRequired}from"../../utils";import{CallbackModel}from"./Callback";import{FieldModel}from"./Field";import{RequestBodyModel}from"./RequestBody";import{ResponseModel}from"./Response";import{getCodeSample}from"../../../../services/code-samples/generator";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,"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,"defaultExampleName",{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)||[])[0],s=Object.keys((null==l?void 0:l.examples)||[])[0];this.activeExampleName=t.defaultSampleName||s,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))}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.generateCodeSamples,r=void 0===i?{}:i,o=t.payloadSampleIdx,a=t.hideRequestPayloadSample,n=new Set(this.definitionSamples.map((function(e){return e.lang.toLowerCase()}))),l=(null===(e=r.languages)||void 0===e?void 0:e.filter((function(e){var t=e.lang;return!n.has(t.toLowerCase())})))||[],s=this.generateCodeSamples(l,r),p=this.definitionSamples.concat(s),u=Math.min(p.length,o);return this.payload&&!a&&p.splice(u,0,this.payload),p},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,"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([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),e}();export{OperationModel};
|
|
2
2
|
//# sourceMappingURL=Operation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate,__spreadArray}from"tslib";import{action,observable,makeObservable}from"mobx";import{FieldModel}from"./Field";import{detectType,extractExtensions,humanizeConstraints,isNamedDefinition,isPrimitiveType,JsonPointer,pluralizeType,sortByField,sortByRequired}from"../../utils/";import{l}from"../Labels";var SchemaModel=function(){function e(e,i,t,r,n,a,s){void 0===n&&(n=!1),void 0===s&&(s={}),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"deps",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"pointer",{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,"displayType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typePrefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"title",{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,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isPrimitive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCircular",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nullable",{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,"pattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"example",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enum",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"default",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writeOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"constraints",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"discriminatorProp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeOneOf",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"rawSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{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,"x-enumDescriptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"const",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.pointer=i.$ref||t||"",this.rawSchema=e.shallowDeref(i),this.schema=e.mergeAllOf(this.rawSchema,this.pointer,n),this.init(e,n),e.exitParents(this.schema),r.showExtensions&&(this.extensions=extractExtensions(this.schema,r.showExtensions))}return Object.defineProperty(e.prototype,"activateOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeOneOf=e}}),Object.defineProperty(e.prototype,"hasType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type===e||Array.isArray(this.type)&&this.type.includes(e)}}),Object.defineProperty(e.prototype,"fields",{get:function(){if(!this.isCircular)return!this._fields&&this.hasType("object")&&(this._fields=buildFields(this.parser,this.schema,this.pointer,this.options,this,this.deps)),this._fields},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasCircularParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var i=this;if(this.parent){if(e.some((function(e){var t,r;if(!e)return!1;var n=i.parent;return n.pointer===e||(!!(null===(r=null===(t=n.schema.parentRefs)||void 0===t?void 0:t.some)||void 0===r?void 0:r.call(t,(function(i){return i===e})))||void 0)})))return!0;if(this.parent.hasCircularParent(e))return!0}return!1}}),Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=this.schema;if(this.isCircular=n["x-circular-ref"]||this.hasCircularParent(__spreadArray([this.pointer],this.schema.parentRefs||[],!0)),this.title=n.title||isNamedDefinition(this.pointer)&&JsonPointer.baseName(this.pointer)||"",this.description=n.description||"",this.type=n.type||detectType(n),this.format=n.format,this.enum=n.enum||[],this["x-enumDescriptions"]=n["x-enumDescriptions"],this.example=n.example,this.deprecated=!!n.deprecated,this.pattern=n.pattern,this.externalDocs=n.externalDocs,this.constraints=humanizeConstraints(n),this.displayFormat=this.format,this.isPrimitive=isPrimitiveType(n,this.type),this.default=n.default,this.readOnly=!!n.readOnly,this.writeOnly=!!n.writeOnly,this.const=n.const||"",this.contentEncoding=n.contentEncoding,this.contentMediaType=n.contentMediaType,(n.nullable||n["x-nullable"])&&(Array.isArray(this.type)&&!this.type.some((function(e){return null===e||"null"===e}))?this.type=__spreadArray(__spreadArray([],this.type,!0),["null"],!1):Array.isArray(this.type)||null===this.type&&"null"===this.type||(this.type=[this.type,"null"])),this.displayType=Array.isArray(this.type)?this.type.map((function(e){return null===e?"null":e})).join(" or "):this.type,!this.isCircular)if(t||void 0===getDiscriminator(n)){if(t&&Array.isArray(n.oneOf)&&n.oneOf.find((function(e){return e.$ref===r.pointer}))&&delete n.oneOf,void 0!==n.oneOf)return this.initOneOf(n.oneOf,i),this.oneOfType="One of",void(void 0!==n.anyOf&&console.warn("oneOf and anyOf are not supported on the same level. Skipping anyOf at "+this.pointer));if(void 0!==n.anyOf)return this.initOneOf(n.anyOf,i),void(this.oneOfType="Any of");if(this.hasType("array")&&n.items&&(this.items=new e(i,n.items,this.pointer+"/items",this.options,!1,this,this.deps),this.displayType=pluralizeType(this.items.displayType),this.displayFormat=this.items.format,this.typePrefix=this.items.typePrefix+l("arrayOf"),this.title=this.title||this.items.title,this.isPrimitive=this.items.isPrimitive,void 0===this.example&&void 0!==this.items.example&&(this.example=[this.items.example]),this.items.isPrimitive&&(this.enum=this.items.enum,this["x-enumDescriptions"]=this.items["x-enumDescriptions"]),Array.isArray(this.type))){var a=this.type.filter((function(e){return"array"!==e}));a.length&&(this.displayType+=" or "+a.join(" or "))}this.enum.length&&this.options.sortEnumValuesAlphabetically&&this.enum.sort()}else this.initDiscriminator(n,i)}}),Object.defineProperty(e.prototype,"initOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this;if(this.oneOf=i.map((function(i,n){var a=t.deref(i,!1,!0),s=t.mergeAllOf(a,r.pointer+"/oneOf/"+n),o=isNamedDefinition(i.$ref)&&!s.title?JsonPointer.baseName(i.$ref):""+(s.title||"")+(s.const&&JSON.stringify(s.const)||""),l=new e(t,__assign(__assign({},s),{title:o,allOf:[__assign(__assign({},r.schema),{oneOf:void 0,anyOf:void 0})]}),r.pointer+"/oneOf/"+n,r.options,!1,r.parent,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}));return t.exitRef(i),t.exitParents(s),l})),this.options.simpleOneOfTypeLabel){var n=collectUniqueOneOfTypesDeep(this);this.displayType=n.join(" or ")}else this.displayType=this.oneOf.map((function(e){var i=e.typePrefix+(e.title?e.title+" ("+e.displayType+")":e.displayType);return i.indexOf(" or ")>-1&&(i="("+i+")"),i})).join(" or ")}}),Object.defineProperty(e.prototype,"initDiscriminator",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=getDiscriminator(i);this.discriminatorProp=n.propertyName;var a=t.findDerived(__spreadArray(__spreadArray([],i.parentRefs||[],!0),[this.pointer],!1));if(i.oneOf)for(var s=0,o=i.oneOf;s<o.length;s++){var l=o[s];if(void 0!==l.$ref){var p=JsonPointer.baseName(l.$ref);a[l.$ref]=p}}var u=n.mapping||{},f=n["x-explicitMappingOnly"]||!1;0===Object.keys(u).length&&(f=!1);var d={};for(var c in u){var b=u[c];Array.isArray(d[b])?d[b].push(c):d[b]=[c]}for(var h=__assign(f?{}:__assign({},a),d),y=[],m=0,v=Object.keys(h);m<v.length;m++){var O=h[b=v[m]];if(Array.isArray(O))for(var g=0,P=O;g<P.length;g++){var w=P[g];y.push({$ref:b,name:w})}else y.push({$ref:b,name:O})}var j=Object.keys(u);0!==j.length&&(y=y.sort((function(e,i){var t=j.indexOf(e.name),r=j.indexOf(i.name);return t<0&&r<0?e.name.localeCompare(i.name):t<0?1:r<0?-1:t-r}))),this.oneOf=y.map((function(i,n){var a=i.$ref,s=i.name,o=new e(t,t.byRef(a),a,r.options,!0,r.parent,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}));return o.title=s,o}))}}),__decorate([observable],e.prototype,"activeOneOf",void 0),__decorate([action],e.prototype,"activateOneOf",null),e}();export{SchemaModel};function buildFields(e,i,t,r,n,a){var s=i.properties||{},o=i.additionalProperties,l=i.default||{},p=Object.keys(s||[]).map((function(o){var p=s[o];p||(console.warn('Field "'+o+'" is invalid, skipping.\n Field must be an object but got '+typeof p+' at "'+t+'"'),p={});var u=void 0!==i.required&&i.required.indexOf(o)>-1;return new FieldModel(e,{name:o,required:u,schema:__assign(__assign({},p),{default:void 0===p.default?l[o]:p.default})},t+"/properties/"+o,r,n,a)}));return r.sortPropsAlphabetically&&(p=sortByField(p,"name")),r.requiredPropsFirst&&(p=sortByRequired(p,r.sortPropsAlphabetically?void 0:i.required)),"object"!=typeof o&&!0!==o||p.push(new FieldModel(e,{name:("object"==typeof o&&o["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===o?{}:o,kind:"additionalProperties"},t+"/additionalProperties",r,n,a)),p}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function collectUniqueOneOfTypesDeep(e){var i=new Set;return function e(t){for(var r=0,n=t.oneOf||[];r<n.length;r++){var a=n[r];a.oneOf?e(a):a.type&&i.add(a.type)}}(e),Array.from(i.values())}
|
|
1
|
+
import{__assign,__decorate,__spreadArray}from"tslib";import{action,observable,makeObservable}from"mobx";import{FieldModel}from"./Field";import{detectType,extractExtensions,humanizeConstraints,isNamedDefinition,isPrimitiveType,JsonPointer,pluralizeType,sortByField,sortByRequired}from"../../utils/";import{l}from"../Labels";var SchemaModel=function(){function e(e,i,t,r,n,a,s){void 0===n&&(n=!1),void 0===s&&(s={}),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"deps",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"pointer",{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,"displayType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typePrefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"title",{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,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isPrimitive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCircular",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nullable",{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,"pattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"example",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enum",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"default",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writeOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"constraints",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"discriminatorProp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeOneOf",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"rawSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{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,"x-enumDescriptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"const",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.pointer=i.$ref||t||"",this.rawSchema=e.shallowDeref(i),this.schema=e.mergeAllOf(this.rawSchema,this.pointer,n),this.init(e,n),e.exitParents(this.schema),r.showExtensions&&(this.extensions=extractExtensions(this.schema,r.showExtensions))}return Object.defineProperty(e.prototype,"activateOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeOneOf=e}}),Object.defineProperty(e.prototype,"hasType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type===e||Array.isArray(this.type)&&this.type.includes(e)}}),Object.defineProperty(e.prototype,"fields",{get:function(){if(!this.isCircular)return!this._fields&&this.hasType("object")&&(this._fields=buildFields(this.parser,this.schema,this.pointer,this.options,this,this.deps)),this._fields},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasCircularParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var i=this;if(this.parent){if(e.some((function(e){var t,r;if(!e)return!1;var n=i.parent;return(null==n?void 0:n.pointer)===e||(!!(null===(r=null===(t=null==n?void 0:n.schema.parentRefs)||void 0===t?void 0:t.some)||void 0===r?void 0:r.call(t,(function(i){return i===e})))||void 0)})))return!0;if(this.parent.hasCircularParent(e))return!0}return!1}}),Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=this.schema;if(this.isCircular=n["x-circular-ref"]||this.hasCircularParent(__spreadArray([this.pointer],this.schema.parentRefs||[],!0)),this.title=n.title||isNamedDefinition(this.pointer)&&JsonPointer.baseName(this.pointer)||"",this.description=n.description||"",this.type=n.type||detectType(n),this.format=n.format,this.enum=n.enum||[],this["x-enumDescriptions"]=n["x-enumDescriptions"],this.example=n.example,this.deprecated=!!n.deprecated,this.pattern=n.pattern,this.externalDocs=n.externalDocs,this.constraints=humanizeConstraints(n),this.displayFormat=this.format,this.isPrimitive=isPrimitiveType(n,this.type),this.default=n.default,this.readOnly=!!n.readOnly,this.writeOnly=!!n.writeOnly,this.const=n.const||"",this.contentEncoding=n.contentEncoding,this.contentMediaType=n.contentMediaType,(n.nullable||n["x-nullable"])&&(Array.isArray(this.type)&&!this.type.some((function(e){return null===e||"null"===e}))?this.type=__spreadArray(__spreadArray([],this.type,!0),["null"],!1):Array.isArray(this.type)||null===this.type&&"null"===this.type||(this.type=[this.type,"null"])),this.displayType=Array.isArray(this.type)?this.type.map((function(e){return null===e?"null":e})).join(" or "):this.type,!this.isCircular)if(t||void 0===getDiscriminator(n)){if(t&&Array.isArray(n.oneOf)&&n.oneOf.find((function(e){return e.$ref===r.pointer}))&&delete n.oneOf,void 0!==n.oneOf)return this.initOneOf(n.oneOf,i),this.oneOfType="One of",void(void 0!==n.anyOf&&console.warn("oneOf and anyOf are not supported on the same level. Skipping anyOf at "+this.pointer));if(void 0!==n.anyOf)return this.initOneOf(n.anyOf,i),void(this.oneOfType="Any of");if(this.hasType("array")&&n.items&&(this.items=new e(i,n.items,this.pointer+"/items",this.options,!1,this,this.deps),this.displayType=pluralizeType(this.items.displayType),this.displayFormat=this.items.format,this.typePrefix=this.items.typePrefix+l("arrayOf"),this.title=this.title||this.items.title,this.isPrimitive=this.items.isPrimitive,void 0===this.example&&void 0!==this.items.example&&(this.example=[this.items.example]),this.items.isPrimitive&&(this.enum=this.items.enum,this["x-enumDescriptions"]=this.items["x-enumDescriptions"]),Array.isArray(this.type))){var a=this.type.filter((function(e){return"array"!==e}));a.length&&(this.displayType+=" or "+a.join(" or "))}this.enum.length&&this.options.sortEnumValuesAlphabetically&&this.enum.sort()}else this.initDiscriminator(n,i)}}),Object.defineProperty(e.prototype,"initOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this;if(this.oneOf=i.map((function(i,n){var a=t.deref(i,!1,!0),s=t.mergeAllOf(a,r.pointer+"/oneOf/"+n),o=isNamedDefinition(i.$ref)&&!s.title?JsonPointer.baseName(i.$ref):""+(s.title||"")+(s.const&&JSON.stringify(s.const)||""),l=new e(t,__assign(__assign({},s),{title:o,allOf:[__assign(__assign({},r.schema),{oneOf:void 0,anyOf:void 0})]}),r.pointer+"/oneOf/"+n,r.options,!1,r.parent,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}));return t.exitRef(i),t.exitParents(s),l})),this.options.simpleOneOfTypeLabel){var n=collectUniqueOneOfTypesDeep(this);this.displayType=n.join(" or ")}else this.displayType=this.oneOf.map((function(e){var i=e.typePrefix+(e.title?e.title+" ("+e.displayType+")":e.displayType);return i.indexOf(" or ")>-1&&(i="("+i+")"),i})).join(" or ")}}),Object.defineProperty(e.prototype,"initDiscriminator",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=getDiscriminator(i);this.discriminatorProp=null==n?void 0:n.propertyName;var a=t.findDerived(__spreadArray(__spreadArray([],i.parentRefs||[],!0),[this.pointer],!1));if(i.oneOf)for(var s=0,o=i.oneOf;s<o.length;s++){var l=o[s];if(void 0!==l.$ref){var p=JsonPointer.baseName(l.$ref);a[l.$ref]=p}}var u=(null==n?void 0:n.mapping)||{},f=(null==n?void 0:n["x-explicitMappingOnly"])||!1;0===Object.keys(u).length&&(f=!1);var d={};for(var c in u){var b=u[c];Array.isArray(d[b])?d[b].push(c):d[b]=[c]}for(var h=__assign(f?{}:__assign({},a),d),y=[],m=0,v=Object.keys(h);m<v.length;m++){var O=h[b=v[m]];if(Array.isArray(O))for(var g=0,P=O;g<P.length;g++){var w=P[g];y.push({$ref:b,name:w})}else y.push({$ref:b,name:O})}var j=Object.keys(u);0!==j.length&&(y=y.sort((function(e,i){var t=j.indexOf(e.name),r=j.indexOf(i.name);return t<0&&r<0?e.name.localeCompare(i.name):t<0?1:r<0?-1:t-r}))),this.oneOf=y.map((function(i,n){var a=i.$ref,s=i.name,o=new e(t,t.byRef(a),a,r.options,!0,r.parent,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}));return o.title=s,o}))}}),__decorate([observable],e.prototype,"activeOneOf",void 0),__decorate([action],e.prototype,"activateOneOf",null),e}();export{SchemaModel};function buildFields(e,i,t,r,n,a){var s=i.properties||{},o=i.additionalProperties,l=i.default||{},p=Object.keys(s||[]).map((function(o){var p=s[o];p||(console.warn('Field "'+o+'" is invalid, skipping.\n Field must be an object but got '+typeof p+' at "'+t+'"'),p={});var u=void 0!==i.required&&i.required.indexOf(o)>-1;return new FieldModel(e,{name:o,required:u,schema:__assign(__assign({},p),{default:void 0===p.default?l[o]:p.default})},t+"/properties/"+o,r,n,a)}));return r.sortPropsAlphabetically&&(p=sortByField(p,"name")),r.requiredPropsFirst&&(p=sortByRequired(p,r.sortPropsAlphabetically?void 0:i.required)),"object"!=typeof o&&!0!==o||p.push(new FieldModel(e,{name:("object"==typeof o&&o["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===o?{}:o,kind:"additionalProperties"},t+"/additionalProperties",r,n,a)),p}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function collectUniqueOneOfTypesDeep(e){var i=new Set;return function e(t){for(var r=0,n=t.oneOf||[];r<n.length;r++){var a=n[r];a.oneOf?e(a):a.type&&i.add(a.type)}}(e),Array.from(i.values())}
|
|
2
2
|
//# sourceMappingURL=Schema.js.map
|
|
@@ -11,7 +11,7 @@ export declare class JsonPointer {
|
|
|
11
11
|
* // returns foo
|
|
12
12
|
* JsonPointerHelper.baseName('/path/foo/subpath', 2)
|
|
13
13
|
*/
|
|
14
|
-
static baseName(pointer
|
|
14
|
+
static baseName(pointer?: string, level?: number): string;
|
|
15
15
|
/**
|
|
16
16
|
* returns dirname of pointer
|
|
17
17
|
* if level > 1 returns corresponding dirname in the hierarchy
|
|
@@ -21,7 +21,7 @@ export declare class JsonPointer {
|
|
|
21
21
|
* // returns /path
|
|
22
22
|
* JsonPointerHelper.dirName('/path/foo/subpath', 2)
|
|
23
23
|
*/
|
|
24
|
-
static dirName(pointer:
|
|
24
|
+
static dirName(pointer: string, level?: number): string;
|
|
25
25
|
/**
|
|
26
26
|
* returns relative path tokens
|
|
27
27
|
* @example
|
|
@@ -30,12 +30,12 @@ export declare class JsonPointer {
|
|
|
30
30
|
* // returns ['foo', 'subpath']
|
|
31
31
|
* JsonPointerHelper.relative('/path', '/path/foo/subpath')
|
|
32
32
|
*/
|
|
33
|
-
static relative(from:
|
|
33
|
+
static relative(from: string, to: string): string[];
|
|
34
34
|
/**
|
|
35
35
|
* overridden JsonPointer original parse to take care of prefixing '#' symbol
|
|
36
36
|
* that is not valid JsonPointer
|
|
37
37
|
*/
|
|
38
|
-
static parse(pointer
|
|
38
|
+
static parse(pointer?: string): string[];
|
|
39
39
|
/**
|
|
40
40
|
* Creates a JSON pointer path, by joining one or more tokens to a base path.
|
|
41
41
|
*
|
|
@@ -43,7 +43,7 @@ export declare class JsonPointer {
|
|
|
43
43
|
* @param {string|string[]} tokens - The token(s) to append (e.g. ["name", "first"])
|
|
44
44
|
* @returns {string}
|
|
45
45
|
*/
|
|
46
|
-
static join(base:
|
|
46
|
+
static join(base: string, tokens: string | string[]): string;
|
|
47
47
|
static get<T>(object: GenericObject, pointer: string): T;
|
|
48
48
|
static compile(tokens: string[]): string;
|
|
49
49
|
static escape(pointer: string): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import JsonPointerLib from"json-pointer";var origParse=JsonPointerLib.parse,JsonPointer=function(){function e(){}return Object.defineProperty(e,"baseName",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){void 0===n&&(n=1);var i=e.parse(r);return i[i.length-n]}}),Object.defineProperty(e,"dirName",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){void 0===n&&(n=1);var i=e.parse(r);return JsonPointerLib.compile(i.slice(0,i.length-n))}}),Object.defineProperty(e,"relative",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=e.parse(r);return e.parse(n).slice(i.length)}}),Object.defineProperty(e,"parse",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e;return"#"===r.charAt(0)&&(r=r.substring(1)),origParse(r)}}),Object.defineProperty(e,"join",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=e.parse(r).concat(n);return JsonPointerLib.compile(i)}}),Object.defineProperty(e,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return JsonPointerLib.get(e,r)}}),Object.defineProperty(e,"compile",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return JsonPointerLib.compile(e)}}),Object.defineProperty(e,"escape",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return JsonPointerLib.escape(e)}}),e}();export{JsonPointer};JsonPointerLib.parse=JsonPointer.parse,Object.assign(JsonPointer,JsonPointerLib);export default JsonPointer;
|
|
1
|
+
"use strict";import JsonPointerLib from"json-pointer";var origParse=JsonPointerLib.parse,JsonPointer=function(){function e(){}return Object.defineProperty(e,"baseName",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){void 0===r&&(r=""),void 0===n&&(n=1);var i=e.parse(r);return i[i.length-n]}}),Object.defineProperty(e,"dirName",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){void 0===n&&(n=1);var i=e.parse(r);return JsonPointerLib.compile(i.slice(0,i.length-n))}}),Object.defineProperty(e,"relative",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=e.parse(r);return e.parse(n).slice(i.length)}}),Object.defineProperty(e,"parse",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e="");var r=e;return"#"===r.charAt(0)&&(r=r.substring(1)),origParse(r)}}),Object.defineProperty(e,"join",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=e.parse(r).concat(n);return JsonPointerLib.compile(i)}}),Object.defineProperty(e,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return JsonPointerLib.get(e,r)}}),Object.defineProperty(e,"compile",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return JsonPointerLib.compile(e)}}),Object.defineProperty(e,"escape",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return JsonPointerLib.escape(e)}}),e}();export{JsonPointer};JsonPointerLib.parse=JsonPointer.parse,Object.assign(JsonPointer,JsonPointerLib);export default JsonPointer;
|
|
2
2
|
//# sourceMappingURL=JsonPointer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter,__generator}from"tslib";import{bundle}from"@redocly/openapi-core/lib/bundle";import{Config}from"@redocly/openapi-core/lib/config/config";import{convertObj}from"swagger2openapi";import{IS_BROWSER}from"./dom";export function loadAndBundleDefinition(e){return __awaiter(this,void 0,void 0,(function(){var o,n,r;return __generator(this,(function(t){switch(t.label){case 0:return o=new Config({}),n={config:o,base:IS_BROWSER?window.location.href:process.cwd()},IS_BROWSER&&(o.resolve.http.customFetch=global.fetch),"object"==typeof e&&null!==e?n.doc=createParsedDocument(e):n.ref=e,[4,bundle(n)];case 1:return[2,void 0!==(r=t.sent().bundle.parsed).swagger?convertSwagger2OpenAPI(r):r]}}))}))}export function createParsedDocument(e){return{source:{absoluteRef:""},parsed:e}}export function convertSwagger2OpenAPI(e){return console.warn("[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0"),e.paths||(e.paths={}),new Promise((function(o,n){return convertObj(e,{patch:!0,warnOnly:!0,text:"{}",anchors:!0},(function(e,r){if(e)return n(e);o(r
|
|
1
|
+
import{__awaiter,__generator}from"tslib";import{bundle}from"@redocly/openapi-core/lib/bundle";import{Config}from"@redocly/openapi-core/lib/config/config";import{convertObj}from"swagger2openapi";import{IS_BROWSER}from"./dom";export function loadAndBundleDefinition(e){return __awaiter(this,void 0,void 0,(function(){var o,n,r;return __generator(this,(function(t){switch(t.label){case 0:return o=new Config({}),n={config:o,base:IS_BROWSER?window.location.href:process.cwd()},IS_BROWSER&&(o.resolve.http.customFetch=global.fetch),"object"==typeof e&&null!==e?n.doc=createParsedDocument(e):n.ref=e,[4,bundle(n)];case 1:return[2,void 0!==(r=t.sent().bundle.parsed).swagger?convertSwagger2OpenAPI(r):r]}}))}))}export function createParsedDocument(e){return{source:{absoluteRef:""},parsed:e}}export function convertSwagger2OpenAPI(e){return console.warn("[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0"),e.paths||(e.paths={}),new Promise((function(o,n){return convertObj(e,{patch:!0,warnOnly:!0,text:"{}",anchors:!0},(function(e,r){if(e)return n(e);o(null==r?void 0:r.openapi)}))}))}
|
|
2
2
|
//# sourceMappingURL=loadAndBundleSpec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign}from"tslib";var SENTINEL={};export function memoize(e,t,o){if("function"==typeof o.value)return _memoizeMethod(e,t,o);if("function"==typeof o.get)return _memoizeGetter(e,t,o);throw new Error("@memoize decorator can be applied to methods or getters, got "+String(o.value)+" instead")}function _memoizeGetter(e,t,o){var i="_memoized_"+t,r=o.get;return e[i]=SENTINEL,__assign(__assign({},o),{get:function(){return this[i]===SENTINEL&&(this[i]=r.call(this)),this[i]}})}function _memoizeMethod(e,t,o){if(!o.value||o.value.length>0)throw new Error("@memoize decorator can only be applied to methods of zero arguments");var i="_memoized_"+t,r=o.value;return e[i]=SENTINEL,__assign(__assign({},o),{value:function(){return this[i]===SENTINEL&&(this[i]=r.call(this)),this[i]}})}
|
|
1
|
+
import{__assign}from"tslib";var SENTINEL={};export function memoize(e,t,o){if("function"==typeof o.value)return _memoizeMethod(e,t,o);if("function"==typeof o.get)return _memoizeGetter(e,t,o);throw new Error("@memoize decorator can be applied to methods or getters, got "+String(o.value)+" instead")}function _memoizeGetter(e,t,o){var i="_memoized_"+t,r=o.get;return e[i]=SENTINEL,__assign(__assign({},o),{get:function(){return this[i]===SENTINEL&&(this[i]=null==r?void 0:r.call(this)),this[i]}})}function _memoizeMethod(e,t,o){if(!o.value||o.value.length>0)throw new Error("@memoize decorator can only be applied to methods of zero arguments");var i="_memoized_"+t,r=o.value;return e[i]=SENTINEL,__assign(__assign({},o),{value:function(){return this[i]===SENTINEL&&(this[i]=r.call(this)),this[i]}})}
|
|
2
2
|
//# sourceMappingURL=memoize.js.map
|
|
@@ -38,6 +38,4 @@ export declare function extractExtensions(obj: GenericObject, showExtensions: st
|
|
|
38
38
|
export declare function pluralizeType(displayType: string): string;
|
|
39
39
|
export declare function getContentWithLegacyExamples(info: OpenAPIRequestBody | OpenAPIResponse): {
|
|
40
40
|
[mime: string]: OpenAPIMediaType;
|
|
41
|
-
} | {
|
|
42
|
-
[mime: string]: OpenAPIMediaType;
|
|
43
41
|
} | undefined;
|
|
@@ -56,10 +56,7 @@ export declare class ProMenu {
|
|
|
56
56
|
* current active item
|
|
57
57
|
*/
|
|
58
58
|
get activeItem(): IMenuItem;
|
|
59
|
-
getItemById: (id: string) => (
|
|
60
|
-
type: "spec" | MenuItemType;
|
|
61
|
-
linkable?: boolean | undefined;
|
|
62
|
-
} & IMenuItem) | undefined;
|
|
59
|
+
getItemById: (id: string) => (ExtendedMenuItem & IMenuItem) | undefined;
|
|
63
60
|
/**
|
|
64
61
|
* update active items on initial page load
|
|
65
62
|
* @param currentId
|
|
@@ -97,7 +94,7 @@ export declare class ProMenu {
|
|
|
97
94
|
* activate menu item and scroll to it
|
|
98
95
|
* @see MenuStore.activate
|
|
99
96
|
*/
|
|
100
|
-
activateAndScroll(item?: IMenuItem, updateLocation?: boolean, rewriteHistory?: boolean, currentId?: string): void;
|
|
97
|
+
activateAndScroll(item?: IMenuItem | ExtendedMenuItem, updateLocation?: boolean, rewriteHistory?: boolean, currentId?: string): void;
|
|
101
98
|
/**
|
|
102
99
|
* scrolls to active section
|
|
103
100
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IValueDidChange } from 'mobx';
|
|
1
2
|
import { ContentItemModel, IMenuItem, MarkerService, OperationModel, RedocNormalizedOptions, RedocRawOptions, SearchStore, SpecStore, OpenAPIExternalDocumentation } from '../redoc-lib';
|
|
2
3
|
import { ProMenu } from './ProMenu';
|
|
3
4
|
import { SearchResultMeta } from './SearchStore';
|
|
@@ -137,9 +138,9 @@ export declare class ProStore {
|
|
|
137
138
|
activateSampleLanguage: import("lodash").DebouncedFunc<(language: string) => void>;
|
|
138
139
|
startLoader(): void;
|
|
139
140
|
stopLoader(): void;
|
|
140
|
-
dereferenceSpecForTryIt(idx: number, op: OperationModel): Promise<
|
|
141
|
+
dereferenceSpecForTryIt(idx: number, op: OperationModel): Promise<GenericObject>;
|
|
141
142
|
observeAllAndRemark(): void;
|
|
142
|
-
remark(change:
|
|
143
|
+
remark(change: IValueDidChange): void;
|
|
143
144
|
/**
|
|
144
145
|
* deserialize store
|
|
145
146
|
* **SUPER HACKY AND NOT OPTIMAL IMPLEMENTATION**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{debounce}from"lodash";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{MultipleSpecsStore}from"./MultipleSpecsStore";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromStorage,toStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dereferencedRawSpec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prevDerefKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e){return n.setActiveSampleLanguage(e)}),500)}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r||a):new ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore(e,this.options):a?new VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadSpecUrl&&(this.definition.info.downloadLink=i.downloadSpecUrl,this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.options.disableSidebar||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser";break;default:this.options.pagination="none",this.options.routingStrategy="hash"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]}}}),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(){return i.search.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return __awaiter(this,void 0,void 0,(function(){var a,s,l,p,u,c,h,d;return __generator(this,(function(b){switch(b.label){case 0:return(a=e+"/"+t.path+"/"+t.httpVerb)===this.prevDerefKey&&this.dereferencedRawSpec?[2,this.dereferencedRawSpec]:(this.dereferencedRawSpec=void 0,this.prevDerefKey=a,s=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,l=JSON.parse(JSON.stringify(s)),p=__assign(__assign({},getSpecVersionObj(l)),{components:l.components,paths:(h={},h[t.path]=(d={},d[t.httpVerb]=null===(o=null===(i=l.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],d.parameters=null===(r=null===(n=l.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,d),h)}),u=new Config({}),c=createParsedDocument(p),[4,bundle({config:u,doc:c,dereference:!0})]);case 1:return b.sent(),this.dereferencedRawSpec=l,[2,l]}}))}))}}),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=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(i),i.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,i.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(i.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var o=i.menu.flatItems[i.menu.activeItemIdx];if(o&&i.menu.activate(o,!1),!i.options.disableSearch){var n=new URL(window.location.href);n.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:n.pathname+(n.pathname.endsWith("/")?"":"/")+t.searchIndexPath,i.search.fromExternalJS(n.toString(),t.searchIndexExport)}return t.tryItOperationId&&(i.tryItOperation=i.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return i.observeAllAndRemark()}),0),i}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:return t={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore||this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return e=i.sent(),[3,3];case 2:e=void 0,i.label=3;case 3:return[2,(t.searchIndex=e,t.options=this.rawOptions,t.tryItOperationId=this.tryItOperation&&this.tryItOperation.id||void 0,t)]}}))}))}}),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++){var r;(r=this.menu.getElementAt(n))&&(r&&o.push(r))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(r=this.menu.getElementAt(this.menu.flatItems[e].parent.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([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){var t,i,o;if("object"!=typeof e||null===e)return e;for(o in t=Array.isArray(e)?[]:{},e)i=e[o],t[o]=deepClone(i);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{debounce}from"lodash";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{MultipleSpecsStore}from"./MultipleSpecsStore";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromStorage,toStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dereferencedRawSpec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prevDerefKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e){return n.setActiveSampleLanguage(e)}),500)}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r||a):new ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore(e,this.options):a?new VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadSpecUrl&&(this.definition.info.downloadLink=i.downloadSpecUrl,this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.options.disableSidebar||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser";break;default:this.options.pagination="none",this.options.routingStrategy="hash"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]}}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return __awaiter(this,void 0,void 0,(function(){var a,s,l,p,u,c,h,d;return __generator(this,(function(b){switch(b.label){case 0:return(a=e+"/"+t.path+"/"+t.httpVerb)===this.prevDerefKey&&this.dereferencedRawSpec?[2,this.dereferencedRawSpec]:(this.dereferencedRawSpec=void 0,this.prevDerefKey=a,s=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,l=JSON.parse(JSON.stringify(s)),p=__assign(__assign({},getSpecVersionObj(l)),{components:l.components,paths:(h={},h[t.path]=(d={},d[t.httpVerb]=null===(o=null===(i=l.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],d.parameters=null===(r=null===(n=l.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,d),h)}),u=new Config({}),c=createParsedDocument(p),[4,bundle({config:u,doc:c,dereference:!0})]);case 1:return b.sent(),this.dereferencedRawSpec=l,[2,l]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore||this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
2
2
|
//# sourceMappingURL=ProStore.js.map
|
|
@@ -16,7 +16,7 @@ export declare function getCodeSample({ lang, operation, exampleName, pathParams
|
|
|
16
16
|
operation: OperationModel;
|
|
17
17
|
exampleName?: string;
|
|
18
18
|
pathParams?: GenericObject;
|
|
19
|
-
properties?:
|
|
19
|
+
properties?: GenericObject;
|
|
20
20
|
options?: GenericObject;
|
|
21
21
|
}): string;
|
|
22
22
|
export declare function isDefined<T>(arg?: T): arg is T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function getPreserveTransformer({ body, authorizationHeader, }: {
|
|
2
2
|
body?: boolean;
|
|
3
3
|
authorizationHeader?: boolean;
|
|
4
|
-
}): (input: any, prop:
|
|
4
|
+
}): (input: any, prop: string, originalResult: string) => string;
|
|
5
5
|
export declare function addIndentation(str: string, { level, indent, firstLine }?: {
|
|
6
6
|
level?: number | undefined;
|
|
7
7
|
indent?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (obj:
|
|
1
|
+
export default function (obj: GenericObject, pair: GenericObject): GenericObject;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign}from"tslib";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{normalizeMimeType}from"../../../../utils";import{capitalizeFirst}from"../../../generator";import{Lang,VariableType}from"../../helpers/constants";import{parseUrlIntoOperands}from"../../helpers/code-helpers";var printPathVariablesCodeLines=function(t,e){return Object.keys(t).forEach((function(a){var r=t[a]||"YOUR_"+a+"_PARAMETER";e.push(2,"String "+e.var(a,VariableType.PATH)+' = "%s";',r)}))};function getUrl(t,e){var a=t.fullUrl,r=void 0===a?"":a,s=t.pathParameters;return parseUrlIntoOperands(r,void 0===s?{}:s).map((function(t){return"variable"===t.type?e.var(t.name,VariableType.PATH):'"'+t.value+'"'})).join(" + ")}var handler=function(t,e,a){var r,s,i=a.target,p=a.client,n=Object.assign({indent:" ",withWrapper:!0},e),o=new CodeBuilder({indentation:n.indent,variablesPrefix:n.variablesPrefix,capitalize:!0,lang:Lang.JAVA8}),u=formatHttpMethod(t.method);if(n.withComments&&addComments(o),n.withImports&&addImports(o,t),n.withWrapper&&(o.push("public class App {"),o.push(1,"public static void main(String[] args ) throws java.io.IOException {"),o.push(2,"HttpClient httpClient = HttpClientBuilder.create().build();"),o.blank()),null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){var h=new HTTPSnippet(null===(s=t.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0]).convert(i,p,__assign(__assign({},n),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));o.push(h),o.push(2,"JSONObject %s = new JSONObject(EntityUtils.toString(httpClient.execute(%s).getEntity()));","oauth2Response","oauth2Request"),o.push(2,'String accessToken = %s.getString("access_token");',"oauth2Response"),o.blank()}printPathVariablesCodeLines(t.pathParameters,o),o.push(2,"%s "+o.var("request")+" = new %s(%s);",u,u,getUrl(t,o));var l=Object.keys(t.allHeaders);if(!l.length||t.postData&&"multipart/form-data"==t.postData.mimeType||l.forEach((function(e){var a;o.push(2,'%s.setHeader("%s", %s);',o.var("request"),e,(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?'"Bearer " + accessToken':'"'+t.allHeaders[e]+'"')})),t.basicAuth&&(o.push(2,'String encodedString = Base64.getEncoder().encodeToString("<username>:<password>".getBytes());'),o.push(2,'%s.setHeader("%s", "%s"+encodedString);',o.var("request"),"Authorization","Basic ")),t.postData)switch(normalizeMimeType(t.postData.mimeType)){case"application/x-www-form-urlencoded":t.postData.params&&(o.blank(),o.push(2,"List<NameValuePair> params = new ArrayList<NameValuePair>();"),t.postData.params.forEach((function(t){o.push(2,'params.add(new BasicNameValuePair("%s", "%s"));',t.name,t.value)})),o.push(2,"%s.setEntity(new UrlEncodedFormEntity(params));",o.var("request")),o.blank());break;case"multipart/form-data":t.postData.params&&(o.push(2,"MultipartEntity reqEntity = new MultipartEntity();"),t.postData.params.forEach((function(t){o.push(2,'reqEntity.addPart("%s", %s);',t.name,isString(t.value)?'new StringBody("'+t.value+'")':t.value)})),o.push(2,"%s.setEntity(reqEntity);",o.var("request")));break;case"application/json":if(t.postData.jsonObj){o.push(2,"JSONObject payload = new JSONObject();");for(var c=0,m=Object.entries(t.postData.jsonObj);c<m.length;c++){var d=m[c],g=d[0],y=d[1];Array.isArray(y)?(o.push(2,'payload.put("%s", new JSONArray()',g),y.forEach((function(t){isObject(t)?(o.push(3,".put(new JSONObject()"),f(t,4),o.push(3,")")):o.push(3,".put(%s)",formatValue(t))})),o.push(2,");")):isObject(y)?(o.push(2,'payload.put("%s", new JSONObject()%s',g,isEmptyObject(y)?");":""),f(y,3),isEmptyObject(y)||o.push(2,");")):o.push(2,'payload.put("%s", %s);',g,formatValue(y))}o.push(2,"%s.setEntity(new StringEntity(payload.toString()));",o.var("request"))}break;case"application/xml":t.postData.text&&(o.push(2,'String payload = String.join("\\n"'),t.postData.text.trim().split("\n").forEach((function(t){var e=t.replace(/"/g,'\\"');o.push(3,', "'+e+'"')})),o.push(2,");"),o.push(2,"%s.setEntity(new StringEntity(payload));",o.var("request")))}return n.withWrapper&&(o.push(2,"String "+o.var("response")+" = EntityUtils.toString(httpClient.execute(request).getEntity());"),o.blank(),o.push(2,"System.out.println(response);"),o.push(1,"}"),o.push("}")),o.join();function f(t,e){for(var a=0,r=Object.entries(t);a<r.length;a++){var s=r[a],i=s[0],p=s[1];isObject(p)?(o.push(e,'.put("%s", new JSONObject()',i),f(p,e+1),o.push(e,")")):o.push(e,'.put("%s", %s)',i,formatValue(p))}}};export var info={key:"apachehttp",title:"Apache http",link:"https://hc.apache.org/httpcomponents-client-4.5.x/",description:"Apache HttpClient"};export default handler;function addComments(t){t.push("/**"),t.push(" * Requires JDK >= 8"),t.push(" *"),t.push(" * Requires Apache HttpComponents Client >= 4.3.5"),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.apache.httpcomponents/httpcomponents-client"),t.push(" *"),t.push(' * Requires package "junit4"'),t.push(" * See here for installation details:"),t.push(" * https://junit.org/junit4"),t.push(" *"),t.push(' * Requires package "org.json" >= 20180130'),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.json/json"),t.push(" */"),t.blank()}function addImports(t,e){var a;t.push("import org.apache.http.util.EntityUtils;"),t.push("import org.apache.http.NameValuePair;"),t.push("import org.apache.http.client.HttpClient;"),t.push("import org.apache.http.client.entity.UrlEncodedFormEntity;"),e.method&&addHttpMethodImport(t,e.method),(null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)&&e.securityOAuth2ExtraCalls[0].method.toLowerCase()!==e.method.toLowerCase()&&addHttpMethodImport(t,e.securityOAuth2ExtraCalls[0].method),t.push("import org.apache.http.impl.client.HttpClientBuilder;"),t.push("import org.apache.http.message.BasicNameValuePair;"),t.push("import org.apache.http.entity.StringEntity;"),t.push("import org.json.JSONObject;"),t.push("import org.json.JSONArray;"),t.push("import java.util.ArrayList;"),t.push("import java.util.List;"),t.push("import org.apache.http.entity.mime.MultipartEntity;"),t.push("import org.apache.http.entity.mime.content.StringBody;"),e.basicAuth&&t.push("import java.util.Base64;"),t.blank()}function addHttpMethodImport(t,e){var a=formatHttpMethod(e);t.push("import org.apache.http.client.methods."+a+";")}function formatHttpMethod(t){return"Http"+capitalizeFirst(t.toLowerCase())}function isString(t){return"[object String]"===Object.prototype.toString.call(t)}function isObject(t){var e=typeof t;return"function"===e||"object"===e&&!!t}export function isEmptyObject(t){return!!t&&0===Object.keys(t).length}function formatValue(t){return isString(t)?JSON.stringify(t):null==t?"JSONObject.NULL":t}
|
|
1
|
+
import{__assign}from"tslib";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{normalizeMimeType}from"../../../../utils";import{capitalizeFirst}from"../../../generator";import{Lang,VariableType}from"../../helpers/constants";import{parseUrlIntoOperands}from"../../helpers/code-helpers";var printPathVariablesCodeLines=function(t,e){return Object.keys(t).forEach((function(a){var r=t[a]||"YOUR_"+a+"_PARAMETER";e.push(2,"String "+e.var(a,VariableType.PATH)+' = "%s";',r)}))};function getUrl(t,e){var a=t.fullUrl,r=void 0===a?"":a,s=t.pathParameters;return parseUrlIntoOperands(r,void 0===s?{}:s).map((function(t){return"variable"===t.type?e.var(t.name,VariableType.PATH):'"'+t.value+'"'})).join(" + ")}var handler=function(t,e,a){var r,s,i=a.target,p=a.client,n=Object.assign({indent:" ",withWrapper:!0},e),o=new CodeBuilder({indentation:n.indent,variablesPrefix:n.variablesPrefix,capitalize:!0,lang:Lang.JAVA8}),u=formatHttpMethod(t.method);if(n.withComments&&addComments(o),n.withImports&&addImports(o,t),n.withWrapper&&(o.push("public class App {"),o.push(1,"public static void main(String[] args ) throws java.io.IOException {"),o.push(2,"HttpClient httpClient = HttpClientBuilder.create().build();"),o.blank()),null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){var h=new HTTPSnippet(null===(s=t.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0]).convert(i,p,__assign(__assign({},n),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));o.push(h),o.push(2,"JSONObject %s = new JSONObject(EntityUtils.toString(httpClient.execute(%s).getEntity()));","oauth2Response","oauth2Request"),o.push(2,'String accessToken = %s.getString("access_token");',"oauth2Response"),o.blank()}printPathVariablesCodeLines(t.pathParameters,o),o.push(2,"%s "+o.var("request")+" = new %s(%s);",u,u,getUrl(t,o));var l=Object.keys(t.allHeaders);if(!l.length||t.postData&&"multipart/form-data"==t.postData.mimeType||l.forEach((function(e){var a;o.push(2,'%s.setHeader("%s", %s);',o.var("request"),e,(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?'"Bearer " + accessToken':'"'+t.allHeaders[e]+'"')})),t.basicAuth&&(o.push(2,'String encodedString = Base64.getEncoder().encodeToString("<username>:<password>".getBytes());'),o.push(2,'%s.setHeader("%s", "%s"+encodedString);',o.var("request"),"Authorization","Basic ")),t.postData)switch(normalizeMimeType(t.postData.mimeType)){case"application/x-www-form-urlencoded":t.postData.params&&(o.blank(),o.push(2,"List<NameValuePair> params = new ArrayList<NameValuePair>();"),t.postData.params.forEach((function(t){o.push(2,'params.add(new BasicNameValuePair("%s", "%s"));',t.name,t.value)})),o.push(2,"%s.setEntity(new UrlEncodedFormEntity(params));",o.var("request")),o.blank());break;case"multipart/form-data":t.postData.params&&(o.push(2,"MultipartEntity reqEntity = new MultipartEntity();"),t.postData.params.forEach((function(t){o.push(2,'reqEntity.addPart("%s", %s);',t.name,isString(t.value)?'new StringBody("'+t.value+'")':t.value)})),o.push(2,"%s.setEntity(reqEntity);",o.var("request")));break;case"application/json":if(t.postData.jsonObj){o.push(2,"JSONObject payload = new JSONObject();");for(var c=0,m=Object.entries(t.postData.jsonObj);c<m.length;c++){var d=m[c],g=d[0],y=d[1];Array.isArray(y)?(o.push(2,'payload.put("%s", new JSONArray()',g),y.forEach((function(t){isObject(t)?(o.push(3,".put(new JSONObject()"),f(t,4),o.push(3,")")):o.push(3,".put(%s)",formatValue(t))})),o.push(2,");")):isObject(y)?(o.push(2,'payload.put("%s", new JSONObject()%s',g,isEmptyObject(y)?");":""),f(y,3),isEmptyObject(y)||o.push(2,");")):o.push(2,'payload.put("%s", %s);',g,formatValue(y))}o.push(2,"%s.setEntity(new StringEntity(payload.toString()));",o.var("request"))}break;case"application/xml":t.postData.text&&(o.push(2,'String payload = String.join("\\n"'),t.postData.text.trim().split("\n").forEach((function(t){var e=t.replace(/"/g,'\\"');o.push(3,', "'+e+'"')})),o.push(2,");"),o.push(2,"%s.setEntity(new StringEntity(payload));",o.var("request")))}return n.withWrapper&&(o.push(2,"String "+o.var("response")+" = EntityUtils.toString(httpClient.execute(request).getEntity());"),o.blank(),o.push(2,"System.out.println(response);"),o.push(1,"}"),o.push("}")),o.join();function f(t,e){for(var a=0,r=Object.entries(t);a<r.length;a++){var s=r[a],i=s[0],p=s[1];isObject(p)?(o.push(e,'.put("%s", new JSONObject()',i),f(p,e+1),o.push(e,")")):o.push(e,'.put("%s", %s)',i,formatValue(p))}}};export var info={key:"apachehttp",title:"Apache http",link:"https://hc.apache.org/httpcomponents-client-4.5.x/",description:"Apache HttpClient"};export default handler;function addComments(t){t.push("/**"),t.push(" * Requires JDK >= 8"),t.push(" *"),t.push(" * Requires Apache HttpComponents Client >= 4.3.5"),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.apache.httpcomponents/httpcomponents-client"),t.push(" *"),t.push(' * Requires package "junit4"'),t.push(" * See here for installation details:"),t.push(" * https://junit.org/junit4"),t.push(" *"),t.push(' * Requires package "org.json" >= 20180130'),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.json/json"),t.push(" */"),t.blank()}function addImports(t,e){var a,r,s;t.push("import org.apache.http.util.EntityUtils;"),t.push("import org.apache.http.NameValuePair;"),t.push("import org.apache.http.client.HttpClient;"),t.push("import org.apache.http.client.entity.UrlEncodedFormEntity;"),e.method&&addHttpMethodImport(t,e.method),(null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)&&(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0].method.toLowerCase())!==e.method.toLowerCase()&&addHttpMethodImport(t,null===(s=e.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0].method),t.push("import org.apache.http.impl.client.HttpClientBuilder;"),t.push("import org.apache.http.message.BasicNameValuePair;"),t.push("import org.apache.http.entity.StringEntity;"),t.push("import org.json.JSONObject;"),t.push("import org.json.JSONArray;"),t.push("import java.util.ArrayList;"),t.push("import java.util.List;"),t.push("import org.apache.http.entity.mime.MultipartEntity;"),t.push("import org.apache.http.entity.mime.content.StringBody;"),e.basicAuth&&t.push("import java.util.Base64;"),t.blank()}function addHttpMethodImport(t,e){var a=formatHttpMethod(e);t.push("import org.apache.http.client.methods."+a+";")}function formatHttpMethod(t){return"Http"+capitalizeFirst(t.toLowerCase())}function isString(t){return"[object String]"===Object.prototype.toString.call(t)}function isObject(t){var e=typeof t;return"function"===e||"object"===e&&!!t}export function isEmptyObject(t){return!!t&&0===Object.keys(t).length}function formatValue(t){return isString(t)?JSON.stringify(t):null==t?"JSONObject.NULL":t}
|
|
2
2
|
//# sourceMappingURL=apachehttp.js.map
|
|
@@ -6,7 +6,7 @@ declare type objectToPhpArrayOptions = {
|
|
|
6
6
|
inlineCharacterLimit?: number;
|
|
7
7
|
transform?: (input: any, i: number | string, result: string) => string;
|
|
8
8
|
singleQuotes?: boolean;
|
|
9
|
-
filter?: (obj:
|
|
9
|
+
filter?: (obj: GenericObject, el: string) => boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare function objectToPhpArray(input: any, options: objectToPhpArrayOptions, pad?: string): string;
|
|
12
12
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var simpleTypes=["number","boolean","function","symbol"];function isRegexp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function isObject(e){var n=typeof e;return null!==e&&("object"===n||"function"===n)}export function objectToPhpArray(e,n,r){void 0===r&&(r="");var t=[];return function e(n,r,i){void 0===r&&(r={}),void 0===i&&(i=""),r.indent=r.indent||"\t";var a={newLine:"\n",newLineOrSpace:"\n",pad:i,indent:i+r.indent},p=function(e){if(void 0===r.inlineCharacterLimit)return e;var n=e.replace(new RegExp(a.newLine,"g"),"").replace(new RegExp(a.newLineOrSpace,"g")," ").replace(new RegExp(a.pad+"|"+a.indent,"g"),"");return n.length<=r.inlineCharacterLimit?n:e.replace(new RegExp(a.newLine+"|"+a.newLineOrSpace,"g"),"\n").replace(new RegExp(a.pad,"g"),i).replace(new RegExp(a.indent,"g"),i+r.indent)};if(-1!==t.indexOf(n))return'"Circular"';if(null===n)return"NULL";if(void 0===n||simpleTypes.includes(typeof n)||isRegexp(n))return String(n);if(n instanceof Date)return"date('"+n.toISOString()+"')";if(Array.isArray(n)){if(0===n.length)return"array()";t.push(n);var o="array("+a.newLine+n.map((function(t,p){var o=n.length-1===p?a.newLine:","+a.newLineOrSpace,c=e(t,r,i+r.indent);return r.transform&&(c=r.transform(n,p,c)),a.indent+c+o})).join("")+a.pad+")";return t.pop(),p(o)}if(isObject(n)){var c=Object.keys(n);if(r.filter&&(c=c.filter((function(e){return r.filter(n,e)}))),0===c.length)return Array.isArray(n)?"array()":"(object)[]";t.push(n);o="array("+a.newLine+c.map((function(t,p){var o=c.length-1===p?a.newLine:","+a.newLineOrSpace,u="symbol"==typeof t,l=!u&&/^[a-z$_][a-z$_0-9]*$/i.test(t),f=u||l?t:e(t,r),g=e(n[t],r,i+r.indent);return r.transform&&(g=r.transform(n,t,g)),a.indent+'"'+String(f)+'" => '+g+o})).join("")+a.pad+")";return t.pop(),p(o)}return n=String(n).replace(/[\r\n]/g,(function(e){return"\n"===e?"\\n":"\\r"})),!1===r.singleQuotes?'"'+(n=n.replace(/"/g,'\\"'))+'"':'"'+(n=n.replace(/\\?'/g,"\\'"))+'"'}(e,n,r)}
|
|
1
|
+
var simpleTypes=["number","boolean","function","symbol"];function isRegexp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function isObject(e){var n=typeof e;return null!==e&&("object"===n||"function"===n)}export function objectToPhpArray(e,n,r){void 0===r&&(r="");var t=[];return function e(n,r,i){void 0===r&&(r={}),void 0===i&&(i=""),r.indent=r.indent||"\t";var a={newLine:"\n",newLineOrSpace:"\n",pad:i,indent:i+r.indent},p=function(e){if(void 0===r.inlineCharacterLimit)return e;var n=e.replace(new RegExp(a.newLine,"g"),"").replace(new RegExp(a.newLineOrSpace,"g")," ").replace(new RegExp(a.pad+"|"+a.indent,"g"),"");return n.length<=r.inlineCharacterLimit?n:e.replace(new RegExp(a.newLine+"|"+a.newLineOrSpace,"g"),"\n").replace(new RegExp(a.pad,"g"),i).replace(new RegExp(a.indent,"g"),i+r.indent)};if(-1!==t.indexOf(n))return'"Circular"';if(null===n)return"NULL";if(void 0===n||simpleTypes.includes(typeof n)||isRegexp(n))return String(n);if(n instanceof Date)return"date('"+n.toISOString()+"')";if(Array.isArray(n)){if(0===n.length)return"array()";t.push(n);var o="array("+a.newLine+n.map((function(t,p){var o=n.length-1===p?a.newLine:","+a.newLineOrSpace,c=e(t,r,i+r.indent);return r.transform&&(c=r.transform(n,p,c)),a.indent+c+o})).join("")+a.pad+")";return t.pop(),p(o)}if(isObject(n)){var c=Object.keys(n);if(r.filter&&(c=c.filter((function(e){var t;return null===(t=r.filter)||void 0===t?void 0:t.call(r,n,e)}))),0===c.length)return Array.isArray(n)?"array()":"(object)[]";t.push(n);o="array("+a.newLine+c.map((function(t,p){var o=c.length-1===p?a.newLine:","+a.newLineOrSpace,u="symbol"==typeof t,l=!u&&/^[a-z$_][a-z$_0-9]*$/i.test(t),f=u||l?t:e(t,r),g=e(n[t],r,i+r.indent);return r.transform&&(g=r.transform(n,t,g)),a.indent+'"'+String(f)+'" => '+g+o})).join("")+a.pad+")";return t.pop(),p(o)}return n=String(n).replace(/[\r\n]/g,(function(e){return"\n"===e?"\\n":"\\r"})),!1===r.singleQuotes?'"'+(n=n.replace(/"/g,'\\"'))+'"':'"'+(n=n.replace(/\\?'/g,"\\'"))+'"'}(e,n,r)}
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -4,7 +4,7 @@ export declare function extendTheme(options: RedocProRawOptions): RedocProRawOpt
|
|
|
4
4
|
interface Typography {
|
|
5
5
|
fontSize?: MediaValue;
|
|
6
6
|
fontWeight?: string | number;
|
|
7
|
-
fontFamily?: MediaValue | ((theme:
|
|
7
|
+
fontFamily?: MediaValue | ((theme: ProTheme) => string);
|
|
8
8
|
lineHeight?: MediaValue;
|
|
9
9
|
color?: string;
|
|
10
10
|
transform?: string;
|
|
@@ -56,9 +56,9 @@ export interface ThemeExtension {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
tryItOutButton?: {
|
|
59
|
-
backgroundColor?: string | ((theme:
|
|
60
|
-
textColor?: string | ((theme:
|
|
61
|
-
borderRadius?: string | ((theme:
|
|
59
|
+
backgroundColor?: string | ((theme: ProTheme) => string);
|
|
60
|
+
textColor?: string | ((theme: ProTheme) => string);
|
|
61
|
+
borderRadius?: string | ((theme: ProTheme) => string);
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
export declare type ProTheme = ResolvedThemeInterface & ThemeExtension;
|