@redocly/reference-docs 2.11.0 → 2.11.1
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 +34 -36
- package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +1 -1
- package/dist/console.redocly-reference-docs.min.js +112 -113
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-reference-docs.min.js +557 -558
- package/lib/components/Endpoint/CopyLink.d.ts +1 -1
- package/lib/components/Endpoint/Path.d.ts +2 -2
- package/lib/components/Endpoint/ServerItem.d.ts +1 -1
- package/lib/components/Endpoint/ServerUrl.d.ts +1 -1
- package/lib/components/NextSectionButton.d.ts +2 -2
- package/lib/components/Panel/CallbackPanel.d.ts +1 -1
- package/lib/components/Panel/CodeHeader.d.ts +1 -1
- package/lib/components/Panel/CodePanel.d.ts +1 -1
- package/lib/components/Panel/ContentPanel.d.ts +1 -1
- package/lib/components/Panel/DarkHeader.d.ts +1 -1
- package/lib/components/Panel/Header.d.ts +1 -1
- package/lib/components/Panel/Panel.d.ts +1 -1
- package/lib/components/Panel/PanelBody.d.ts +1 -1
- package/lib/components/Panel/ResponsePanel.d.ts +1 -1
- package/lib/components/Panel/ScrollableContentPanel.d.ts +1 -1
- package/lib/components/Panel/Title.d.ts +1 -1
- package/lib/components/Panel/Trigger.d.ts +1 -1
- package/lib/components/RedoclyReferenceDocs.d.ts +1 -1
- package/lib/components/Samples/LoadingWrapper.d.ts +1 -1
- package/lib/components/Search/styled.d.ts +10 -10
- package/lib/components/Tabs/CollapsingTabs/CollapsingDropdown.d.ts +1 -1
- package/lib/components/Tabs/CollapsingTabs/CollapsingTab.d.ts +1 -1
- package/lib/components/Tabs/CollapsingTabs/CollapsingTabList.d.ts +1 -1
- package/lib/components/Tabs/SmallTab.d.ts +1 -1
- package/lib/components/Tabs/Tab.d.ts +1 -1
- package/lib/components/Tabs/TabList.d.ts +1 -1
- package/lib/components/Tabs/TabPanel.d.ts +1 -1
- package/lib/components/common/Checkbox.d.ts +1 -1
- package/lib/components/common/CheckboxList.d.ts +2 -2
- package/lib/components/common/CheckboxList.js +1 -1
- package/lib/components/common/LinearProgress.js +1 -1
- package/lib/components/common/TextField.d.ts +2 -2
- package/lib/components/common/form.d.ts +12 -12
- package/lib/components/console/ActionPanel.d.ts +6 -4
- package/lib/components/console/ActionPanel.js +1 -1
- package/lib/components/console/AuthPanel.d.ts +6 -5
- package/lib/components/console/CodemirrorInput.d.ts +4 -1
- package/lib/components/console/Console.d.ts +10 -12
- package/lib/components/console/Console.js +1 -1
- package/lib/components/console/OAuth2Flow.d.ts +1 -1
- package/lib/components/console/OAuth2TokenInput.d.ts +2 -2
- package/lib/components/console/OAuth2TokenInput.js +1 -1
- package/lib/components/console/ParameterDropdown.js +1 -1
- package/lib/components/console/RequestMimeLabel.d.ts +1 -1
- package/lib/components/console/ResponsePanel.d.ts +3 -3
- package/lib/components/console/ResponsePanel.js +1 -1
- package/lib/components/console/ServerDropdown.d.ts +8 -6
- package/lib/components/console/ServerDropdown.js +1 -1
- package/lib/components/console/styled.components.d.ts +4 -4
- package/lib/components/console/utils.d.ts +5 -19
- package/lib/components/console/utils.js +1 -1
- package/lib/components/pluggable/RedocResponse.js +1 -1
- package/lib/components/pluggable/styled.components.d.ts +4 -3
- package/lib/components/shared/Button.d.ts +3 -4
- package/lib/components/shared/CopyButton.js +1 -1
- package/lib/components/shared/HttpVerb.d.ts +1 -1
- package/lib/components/shared/MimeLabel.d.ts +1 -1
- package/lib/components/shared/NoSampleLabel.d.ts +2 -2
- package/lib/components/styled.elements.d.ts +10 -9
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/useMount.d.ts +1 -0
- package/lib/hooks/useMount.js +2 -0
- package/lib/hooks/useUnmount.d.ts +1 -0
- package/lib/hooks/useUnmount.js +2 -0
- package/lib/redoc-lib/src/common-elements/CopyButtonWrapper.d.ts +5 -5
- package/lib/redoc-lib/src/common-elements/LinkToField.d.ts +3 -4
- package/lib/redoc-lib/src/common-elements/LinkToField.js +1 -1
- package/lib/redoc-lib/src/common-elements/PrismDiv.d.ts +1 -1
- package/lib/redoc-lib/src/common-elements/Tooltip.d.ts +2 -2
- package/lib/redoc-lib/src/common-elements/Tooltip.js +1 -1
- package/lib/redoc-lib/src/common-elements/dropdown.d.ts +4 -4
- package/lib/redoc-lib/src/common-elements/fields-layout.d.ts +9 -9
- package/lib/redoc-lib/src/common-elements/fields.d.ts +13 -13
- package/lib/redoc-lib/src/common-elements/headers.d.ts +6 -6
- package/lib/redoc-lib/src/common-elements/icons.d.ts +5 -5
- package/lib/redoc-lib/src/common-elements/linkify.d.ts +5 -5
- package/lib/redoc-lib/src/common-elements/linkify.js +1 -1
- package/lib/redoc-lib/src/common-elements/panels.d.ts +5 -5
- package/lib/redoc-lib/src/common-elements/perfect-scrollbar.d.ts +3 -5
- package/lib/redoc-lib/src/common-elements/perfect-scrollbar.js +1 -1
- package/lib/redoc-lib/src/common-elements/samples.d.ts +4 -4
- package/lib/redoc-lib/src/common-elements/schema.d.ts +5 -5
- package/lib/redoc-lib/src/common-elements/shelfs.d.ts +1 -1
- package/lib/redoc-lib/src/components/ApiInfo/styled.elements.d.ts +5 -5
- package/lib/redoc-lib/src/components/ApiLogo/styled.elements.d.ts +2 -2
- package/lib/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.d.ts +1 -1
- package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +1 -1
- package/lib/redoc-lib/src/components/Callbacks/CallbackTitle.d.ts +1 -1
- package/lib/redoc-lib/src/components/DownloadButton/DownloadButton.d.ts +1 -1
- package/lib/redoc-lib/src/components/DownloadButton/DownloadButton.js +1 -1
- package/lib/redoc-lib/src/components/ErrorBoundary.d.ts +4 -4
- package/lib/redoc-lib/src/components/ErrorBoundary.js +1 -1
- package/lib/redoc-lib/src/components/Fields/EnumValues.d.ts +1 -1
- package/lib/redoc-lib/src/components/Fields/Field.d.ts +1 -1
- package/lib/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.d.ts +2 -4
- package/lib/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.js +1 -1
- package/lib/redoc-lib/src/components/JsonViewer/JsonViewer.d.ts +2 -2
- package/lib/redoc-lib/src/components/JsonViewer/JsonViewer.js +1 -1
- package/lib/redoc-lib/src/components/JsonViewer/style.d.ts +1 -1
- package/lib/redoc-lib/src/components/Loading/Spinner.svg.d.ts +1 -1
- package/lib/redoc-lib/src/components/Markdown/AdvancedMarkdown.d.ts +3 -1
- package/lib/redoc-lib/src/components/Markdown/styled.elements.d.ts +4 -5
- package/lib/redoc-lib/src/components/Parameters/ParametersGroup.d.ts +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.d.ts +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/styled.elements.d.ts +3 -3
- package/lib/redoc-lib/src/components/RequestSamples/useCodeSamples.d.ts +7 -3
- package/lib/redoc-lib/src/components/ResponseSamples/ResponseSamples.d.ts +1 -1
- package/lib/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -1
- package/lib/redoc-lib/src/components/Responses/styled.elements.d.ts +1 -1
- package/lib/redoc-lib/src/components/Schema/ObjectSchema.d.ts +3 -2
- package/lib/redoc-lib/src/components/Schema/ObjectSchema.js +1 -1
- package/lib/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
- package/lib/redoc-lib/src/components/SearchBox/SearchBox.js +1 -1
- package/lib/redoc-lib/src/components/SearchBox/styled.elements.d.ts +5 -5
- package/lib/redoc-lib/src/components/SecuritySchemes/SecuritySchemes.js +1 -1
- package/lib/redoc-lib/src/components/SideMenu/MenuItem.d.ts +3 -5
- package/lib/redoc-lib/src/components/SideMenu/styled.elements.d.ts +7 -7
- package/lib/redoc-lib/src/services/OpenAPIParser.d.ts +3 -3
- package/lib/redoc-lib/src/services/OpenAPIParser.js +1 -1
- package/lib/redoc-lib/src/services/SearchWorker.worker.d.ts +1 -1
- package/lib/redoc-lib/src/services/models/Operation.d.ts +2 -2
- package/lib/redoc-lib/src/styled-components.d.ts +3 -2
- package/lib/redoc-lib/src/utils/decorators.d.ts +1 -1
- package/lib/redoc-lib/src/utils/helpers.d.ts +2 -2
- package/lib/redoc-lib/src/utils/loadAndBundleSpec.d.ts +1 -1
- package/lib/redoc-lib/src/utils/media-css.d.ts +1 -1
- package/lib/redoc-lib/src/utils/openapi.d.ts +3 -3
- package/lib/services/ProMenu.d.ts +4 -3
- package/lib/services/ProMenu.js +1 -1
- package/lib/services/ProStore.d.ts +7 -7
- package/lib/services/ProStore.js +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/index.d.ts +9 -3
- package/lib/services/code-samples/httpsnippet/targets/index.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
- package/lib/services/code-samples/httpsnippet/targets/php/curl.js +1 -1
- package/lib/services/code-samples/httpsnippet/targets/php/types.d.ts +11 -0
- package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
- package/lib/services/code-samples/httpsnippet/targets/php/utils.d.ts +2 -12
- package/lib/services/extendTheme.d.ts +1 -1
- package/lib/services/extendTheme.js +1 -1
- package/lib/standalone.d.ts +3 -1
- package/lib/standalone.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib-esm/components/Endpoint/CopyLink.d.ts +1 -1
- package/lib-esm/components/Endpoint/Path.d.ts +2 -2
- package/lib-esm/components/Endpoint/ServerItem.d.ts +1 -1
- package/lib-esm/components/Endpoint/ServerUrl.d.ts +1 -1
- package/lib-esm/components/NextSectionButton.d.ts +2 -2
- package/lib-esm/components/Panel/CallbackPanel.d.ts +1 -1
- package/lib-esm/components/Panel/CodeHeader.d.ts +1 -1
- package/lib-esm/components/Panel/CodePanel.d.ts +1 -1
- package/lib-esm/components/Panel/ContentPanel.d.ts +1 -1
- package/lib-esm/components/Panel/DarkHeader.d.ts +1 -1
- package/lib-esm/components/Panel/Header.d.ts +1 -1
- package/lib-esm/components/Panel/Panel.d.ts +1 -1
- package/lib-esm/components/Panel/PanelBody.d.ts +1 -1
- package/lib-esm/components/Panel/ResponsePanel.d.ts +1 -1
- package/lib-esm/components/Panel/ScrollableContentPanel.d.ts +1 -1
- package/lib-esm/components/Panel/Title.d.ts +1 -1
- package/lib-esm/components/Panel/Trigger.d.ts +1 -1
- package/lib-esm/components/RedoclyReferenceDocs.d.ts +1 -1
- package/lib-esm/components/Samples/LoadingWrapper.d.ts +1 -1
- package/lib-esm/components/Search/styled.d.ts +10 -10
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingDropdown.d.ts +1 -1
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTab.d.ts +1 -1
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTabList.d.ts +1 -1
- package/lib-esm/components/Tabs/SmallTab.d.ts +1 -1
- package/lib-esm/components/Tabs/Tab.d.ts +1 -1
- package/lib-esm/components/Tabs/TabList.d.ts +1 -1
- package/lib-esm/components/Tabs/TabPanel.d.ts +1 -1
- package/lib-esm/components/common/Checkbox.d.ts +1 -1
- package/lib-esm/components/common/CheckboxList.d.ts +2 -2
- package/lib-esm/components/common/CheckboxList.js +1 -1
- package/lib-esm/components/common/LinearProgress.js +1 -1
- package/lib-esm/components/common/TextField.d.ts +2 -2
- package/lib-esm/components/common/form.d.ts +12 -12
- package/lib-esm/components/console/ActionPanel.d.ts +6 -4
- package/lib-esm/components/console/ActionPanel.js +1 -1
- package/lib-esm/components/console/AuthPanel.d.ts +6 -5
- package/lib-esm/components/console/CodemirrorInput.d.ts +4 -1
- package/lib-esm/components/console/Console.d.ts +10 -12
- package/lib-esm/components/console/Console.js +1 -1
- package/lib-esm/components/console/OAuth2Flow.d.ts +1 -1
- package/lib-esm/components/console/OAuth2TokenInput.d.ts +2 -2
- package/lib-esm/components/console/OAuth2TokenInput.js +1 -1
- package/lib-esm/components/console/ParameterDropdown.js +1 -1
- package/lib-esm/components/console/RequestMimeLabel.d.ts +1 -1
- package/lib-esm/components/console/ResponsePanel.d.ts +3 -3
- package/lib-esm/components/console/ResponsePanel.js +1 -1
- package/lib-esm/components/console/ServerDropdown.d.ts +8 -6
- package/lib-esm/components/console/ServerDropdown.js +1 -1
- package/lib-esm/components/console/styled.components.d.ts +4 -4
- package/lib-esm/components/console/utils.d.ts +5 -19
- package/lib-esm/components/console/utils.js +1 -1
- package/lib-esm/components/pluggable/RedocResponse.js +1 -1
- package/lib-esm/components/pluggable/styled.components.d.ts +4 -3
- package/lib-esm/components/shared/Button.d.ts +3 -4
- package/lib-esm/components/shared/CopyButton.js +1 -1
- package/lib-esm/components/shared/HttpVerb.d.ts +1 -1
- package/lib-esm/components/shared/MimeLabel.d.ts +1 -1
- package/lib-esm/components/shared/NoSampleLabel.d.ts +2 -2
- package/lib-esm/components/styled.elements.d.ts +10 -9
- package/lib-esm/hooks/index.d.ts +2 -0
- package/lib-esm/hooks/index.js +2 -0
- package/lib-esm/hooks/useMount.d.ts +1 -0
- package/lib-esm/hooks/useMount.js +2 -0
- package/lib-esm/hooks/useUnmount.d.ts +1 -0
- package/lib-esm/hooks/useUnmount.js +2 -0
- package/lib-esm/redoc-lib/src/common-elements/CopyButtonWrapper.d.ts +5 -5
- package/lib-esm/redoc-lib/src/common-elements/LinkToField.d.ts +3 -4
- package/lib-esm/redoc-lib/src/common-elements/LinkToField.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/PrismDiv.d.ts +1 -1
- package/lib-esm/redoc-lib/src/common-elements/Tooltip.d.ts +2 -2
- package/lib-esm/redoc-lib/src/common-elements/Tooltip.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/dropdown.d.ts +4 -4
- package/lib-esm/redoc-lib/src/common-elements/fields-layout.d.ts +9 -9
- package/lib-esm/redoc-lib/src/common-elements/fields.d.ts +13 -13
- package/lib-esm/redoc-lib/src/common-elements/headers.d.ts +6 -6
- package/lib-esm/redoc-lib/src/common-elements/icons.d.ts +5 -5
- package/lib-esm/redoc-lib/src/common-elements/linkify.d.ts +5 -5
- package/lib-esm/redoc-lib/src/common-elements/linkify.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/panels.d.ts +5 -5
- package/lib-esm/redoc-lib/src/common-elements/perfect-scrollbar.d.ts +3 -5
- package/lib-esm/redoc-lib/src/common-elements/perfect-scrollbar.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/samples.d.ts +4 -4
- package/lib-esm/redoc-lib/src/common-elements/schema.d.ts +5 -5
- package/lib-esm/redoc-lib/src/common-elements/shelfs.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/ApiInfo/styled.elements.d.ts +5 -5
- package/lib-esm/redoc-lib/src/components/ApiLogo/styled.elements.d.ts +2 -2
- package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Callbacks/CallbackTitle.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/DownloadButton/DownloadButton.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/DownloadButton/DownloadButton.js +1 -1
- package/lib-esm/redoc-lib/src/components/ErrorBoundary.d.ts +4 -4
- package/lib-esm/redoc-lib/src/components/ErrorBoundary.js +1 -1
- package/lib-esm/redoc-lib/src/components/Fields/EnumValues.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Fields/Field.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.d.ts +2 -4
- package/lib-esm/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.js +1 -1
- package/lib-esm/redoc-lib/src/components/JsonViewer/JsonViewer.d.ts +2 -2
- package/lib-esm/redoc-lib/src/components/JsonViewer/JsonViewer.js +1 -1
- package/lib-esm/redoc-lib/src/components/JsonViewer/style.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Loading/Spinner.svg.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Markdown/AdvancedMarkdown.d.ts +3 -1
- package/lib-esm/redoc-lib/src/components/Markdown/styled.elements.d.ts +4 -5
- package/lib-esm/redoc-lib/src/components/Parameters/ParametersGroup.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/styled.elements.d.ts +3 -3
- package/lib-esm/redoc-lib/src/components/RequestSamples/useCodeSamples.d.ts +7 -3
- package/lib-esm/redoc-lib/src/components/ResponseSamples/ResponseSamples.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/styled.elements.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Schema/ObjectSchema.d.ts +3 -2
- package/lib-esm/redoc-lib/src/components/Schema/ObjectSchema.js +1 -1
- package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.js +1 -1
- package/lib-esm/redoc-lib/src/components/SearchBox/styled.elements.d.ts +5 -5
- package/lib-esm/redoc-lib/src/components/SecuritySchemes/SecuritySchemes.js +1 -1
- package/lib-esm/redoc-lib/src/components/SideMenu/MenuItem.d.ts +3 -5
- package/lib-esm/redoc-lib/src/components/SideMenu/styled.elements.d.ts +7 -7
- package/lib-esm/redoc-lib/src/services/OpenAPIParser.d.ts +3 -3
- package/lib-esm/redoc-lib/src/services/OpenAPIParser.js +1 -1
- package/lib-esm/redoc-lib/src/services/SearchWorker.worker.d.ts +1 -1
- package/lib-esm/redoc-lib/src/services/models/Operation.d.ts +2 -2
- package/lib-esm/redoc-lib/src/styled-components.d.ts +3 -2
- package/lib-esm/redoc-lib/src/utils/decorators.d.ts +1 -1
- package/lib-esm/redoc-lib/src/utils/helpers.d.ts +2 -2
- package/lib-esm/redoc-lib/src/utils/loadAndBundleSpec.d.ts +1 -1
- package/lib-esm/redoc-lib/src/utils/media-css.d.ts +1 -1
- package/lib-esm/redoc-lib/src/utils/openapi.d.ts +3 -3
- package/lib-esm/services/ProMenu.d.ts +4 -3
- package/lib-esm/services/ProMenu.js +1 -1
- package/lib-esm/services/ProStore.d.ts +7 -7
- package/lib-esm/services/ProStore.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/index.d.ts +9 -3
- package/lib-esm/services/code-samples/httpsnippet/targets/index.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/php/curl.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/php/types.d.ts +11 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/php/types.js +2 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/php/utils.d.ts +2 -12
- package/lib-esm/services/extendTheme.d.ts +1 -1
- package/lib-esm/services/extendTheme.js +1 -1
- package/lib-esm/standalone.d.ts +3 -1
- package/lib-esm/standalone.js +1 -1
- package/lib-esm/utils.d.ts +1 -1
- package/package.json +3 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__decorate,__extends}from"tslib";import*as React from"react";import{MenuItem}from"../SideMenu/MenuItem";import{bind,debounce}from"decko";import{PerfectScrollbarWrap}from"../../common-elements/perfect-scrollbar";import{ClearIcon,SearchIcon,SearchInput,SearchResultsBox,SearchWrap}from"./styled.elements";var SearchBox=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"activeItemRef",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"clear",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.setState({results:[],term:"",activeItemIdx:-1}),r.props.marker.unmark()}}),Object.defineProperty(r,"handleKeyDown",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(27===e.keyCode&&r.clear(),40===e.keyCode&&(r.setState({activeItemIdx:Math.min(r.state.activeItemIdx+1,r.state.results.length-1)}),e.preventDefault()),38===e.keyCode&&(r.setState({activeItemIdx:Math.max(0,r.state.activeItemIdx-1)}),e.preventDefault()),13===e.keyCode){var t=r.state.results[r.state.activeItemIdx];if(t){var a=r.props.getItemById(t.meta);a&&r.props.onActivate(a)}}}}),Object.defineProperty(r,"search",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.target.value;t.length<3?r.clearResults(t):r.setState({term:t},(function(){return r.searchCallback(r.state.term)}))}}),r.state={results:[],term:"",activeItemIdx:-1},r}return __extends(t,e),Object.defineProperty(t.prototype,"clearResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setState({results:[],term:e}),this.props.marker.unmark()}}),Object.defineProperty(t.prototype,"setResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.setState({results:e}),this.props.marker.mark(t)}}),Object.defineProperty(t.prototype,"searchCallback",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.props.search.search(e).then((function(r){t.setResults(r,e)}))}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.state.activeItemIdx,r=this.state.results.map((function(t){return{item:e.props.getItemById(t.meta),score:t.score}}));return r.sort((function(e,t){return t.score-e.score})),React.createElement(SearchWrap,{role:"search"},this.state.term&&React.createElement(ClearIcon,{onClick:this.clear},"×"),React.createElement(SearchIcon,null),React.createElement(SearchInput,{value:this.state.term,onKeyDown:this.handleKeyDown,placeholder:"Search...","aria-label":"Search",type:"text",onChange:this.search}),r.length>0&&React.createElement(PerfectScrollbarWrap,{options:{wheelPropagation:!1}},React.createElement(SearchResultsBox,{"data-role":"search:results"},r.map((function(r,a){return React.createElement(MenuItem,{item:Object.create(
|
|
1
|
+
import{__decorate,__extends}from"tslib";import*as React from"react";import{MenuItem}from"../SideMenu/MenuItem";import{bind,debounce}from"decko";import{PerfectScrollbarWrap}from"../../common-elements/perfect-scrollbar";import{ClearIcon,SearchIcon,SearchInput,SearchResultsBox,SearchWrap}from"./styled.elements";var SearchBox=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"activeItemRef",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"clear",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.setState({results:[],term:"",activeItemIdx:-1}),r.props.marker.unmark()}}),Object.defineProperty(r,"handleKeyDown",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(27===e.keyCode&&r.clear(),40===e.keyCode&&(r.setState({activeItemIdx:Math.min(r.state.activeItemIdx+1,r.state.results.length-1)}),e.preventDefault()),38===e.keyCode&&(r.setState({activeItemIdx:Math.max(0,r.state.activeItemIdx-1)}),e.preventDefault()),13===e.keyCode){var t=r.state.results[r.state.activeItemIdx];if(t){var a=r.props.getItemById(t.meta);a&&r.props.onActivate(a)}}}}),Object.defineProperty(r,"search",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.target.value;t.length<3?r.clearResults(t):r.setState({term:t},(function(){return r.searchCallback(r.state.term)}))}}),r.state={results:[],term:"",activeItemIdx:-1},r}return __extends(t,e),Object.defineProperty(t.prototype,"clearResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setState({results:[],term:e}),this.props.marker.unmark()}}),Object.defineProperty(t.prototype,"setResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.setState({results:e}),this.props.marker.mark(t)}}),Object.defineProperty(t.prototype,"searchCallback",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.props.search.search(e).then((function(r){t.setResults(r,e)}))}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.state.activeItemIdx,r=this.state.results.map((function(t){return{item:e.props.getItemById(t.meta),score:t.score}}));return r.sort((function(e,t){return t.score-e.score})),React.createElement(SearchWrap,{role:"search"},this.state.term&&React.createElement(ClearIcon,{onClick:this.clear},"×"),React.createElement(SearchIcon,null),React.createElement(SearchInput,{value:this.state.term,onKeyDown:this.handleKeyDown,placeholder:"Search...","aria-label":"Search",type:"text",onChange:this.search}),r.length>0&&React.createElement(PerfectScrollbarWrap,{options:{wheelPropagation:!1}},React.createElement(SearchResultsBox,{"data-role":"search:results"},r.map((function(r,a){var n=r.item;return React.createElement(MenuItem,{item:Object.create(n||{},{active:{value:a===t}}),onActivate:e.props.onActivate,withoutChildren:!0,key:null==n?void 0:n.id,"data-role":"search:result"})})))))}}),__decorate([bind,debounce(400)],t.prototype,"searchCallback",null),t}(React.PureComponent);export{SearchBox};
|
|
2
2
|
//# sourceMappingURL=SearchBox.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const SearchWrap: import("styled-components").StyledComponent<"div", import("
|
|
3
|
-
export declare const SearchInput: import("styled-components").StyledComponent<"input", import("
|
|
2
|
+
export declare const SearchWrap: import("styled-components").StyledComponent<"div", import("../../../../services/extendTheme").ProTheme, {}, never>;
|
|
3
|
+
export declare const SearchInput: import("styled-components").StyledComponent<"input", import("../../../../services/extendTheme").ProTheme, {
|
|
4
4
|
className: "search-input";
|
|
5
5
|
}, "className">;
|
|
6
6
|
export declare const SearchIcon: import("styled-components").StyledComponent<(props: {
|
|
7
7
|
className?: string;
|
|
8
|
-
}) => JSX.Element, import("
|
|
8
|
+
}) => JSX.Element, import("../../../../services/extendTheme").ProTheme, {
|
|
9
9
|
className: "search-icon";
|
|
10
10
|
}, "className">;
|
|
11
|
-
export declare const SearchResultsBox: import("styled-components").StyledComponent<"div", import("
|
|
12
|
-
export declare const ClearIcon: import("styled-components").StyledComponent<"i", import("
|
|
11
|
+
export declare const SearchResultsBox: import("styled-components").StyledComponent<"div", import("../../../../services/extendTheme").ProTheme, {}, never>;
|
|
12
|
+
export declare const ClearIcon: import("styled-components").StyledComponent<"i", import("../../../../services/extendTheme").ProTheme, {}, never>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__extends}from"tslib";import*as React from"react";import{H2,MiddlePanel,Row,Section,ShareLink}from"../../common-elements";import{titleize}from"../../utils/helpers";import{Markdown}from"../Markdown/Markdown";import{StyledMarkdownBlock}from"../Markdown/styled.elements";var AUTH_TYPES={oauth2:"OAuth2",apiKey:"API Key",http:"HTTP",openIdConnect:"OpenID Connect"},OAuthFlow=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props,t=e.type,n=e.flow;return React.createElement("tr",null,React.createElement("th",null," ",t," OAuth Flow "),React.createElement("td",null,"implicit"===t||"authorizationCode"===t?React.createElement("div",null,React.createElement("strong",null," Authorization URL: "),n.authorizationUrl):null,"password"===t||"clientCredentials"===t||"authorizationCode"===t?React.createElement("div",null,React.createElement("strong",null," Token URL: "),n.tokenUrl):null,n.refreshUrl&&React.createElement("div",null,React.createElement("strong",null," Refresh URL: "),n.refreshUrl),React.createElement("div",null,React.createElement("strong",null," Scopes: ")),React.createElement("ul",null,Object.keys(n.scopes||{}).map((function(e){return React.createElement("li",{key:e},React.createElement("code",null,e)," - ",React.createElement(Markdown,{inline:!0,source:n.scopes[e]||""}))})))))}}),t}(React.PureComponent);export{OAuthFlow};var SecurityDefs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.props.securitySchemes.schemes.map((function(e){return React.createElement(Section,{id:e.sectionId,key:e.id},React.createElement(Row,null,React.createElement(MiddlePanel,null,React.createElement(H2,null,React.createElement(ShareLink,{to:e.sectionId}),e.id),React.createElement(Markdown,{source:e.description||""}),React.createElement(StyledMarkdownBlock,null,React.createElement("table",{className:"security-details"},React.createElement("tbody",null,React.createElement("tr",null,React.createElement("th",null," Security Scheme Type "),React.createElement("td",null," ",AUTH_TYPES[e.type]||e.type," ")),e.apiKey?React.createElement("tr",null,React.createElement("th",null," ",titleize(e.apiKey.in||"")," parameter name:"),React.createElement("td",null," ",e.apiKey.name," ")):e.http?[React.createElement("tr",{key:"scheme"},React.createElement("th",null," HTTP Authorization Scheme "),React.createElement("td",null," ",e.http.scheme," ")),"bearer"===e.http.scheme&&e.http.bearerFormat&&React.createElement("tr",{key:"bearer"},React.createElement("th",null," Bearer format "),React.createElement("td",null,' "',e.http.bearerFormat,'" '))]:e.openId?React.createElement("tr",null,React.createElement("th",null," Connect URL "),React.createElement("td",null,React.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:e.openId.connectUrl},e.openId.connectUrl))):e.flows?Object.keys(e.flows).map((function(t){return React.createElement(OAuthFlow,{key:t,type:t,flow:e.flows[t]})})):null))))))}))}}),t}(React.PureComponent);export{SecurityDefs};
|
|
1
|
+
import{__extends}from"tslib";import*as React from"react";import{H2,MiddlePanel,Row,Section,ShareLink}from"../../common-elements";import{titleize}from"../../utils/helpers";import{Markdown}from"../Markdown/Markdown";import{StyledMarkdownBlock}from"../Markdown/styled.elements";var AUTH_TYPES={oauth2:"OAuth2",apiKey:"API Key",http:"HTTP",openIdConnect:"OpenID Connect"},OAuthFlow=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props,t=e.type,n=e.flow;return React.createElement("tr",null,React.createElement("th",null," ",t," OAuth Flow "),React.createElement("td",null,"implicit"===t||"authorizationCode"===t?React.createElement("div",null,React.createElement("strong",null," Authorization URL: "),n.authorizationUrl):null,"password"===t||"clientCredentials"===t||"authorizationCode"===t?React.createElement("div",null,React.createElement("strong",null," Token URL: "),n.tokenUrl):null,(null==n?void 0:n.refreshUrl)&&React.createElement("div",null,React.createElement("strong",null," Refresh URL: "),null==n?void 0:n.refreshUrl),React.createElement("div",null,React.createElement("strong",null," Scopes: ")),React.createElement("ul",null,Object.keys((null==n?void 0:n.scopes)||{}).map((function(e){return React.createElement("li",{key:e},React.createElement("code",null,e)," - ",React.createElement(Markdown,{inline:!0,source:(null==n?void 0:n.scopes[e])||""}))})))))}}),t}(React.PureComponent);export{OAuthFlow};var SecurityDefs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.props.securitySchemes.schemes.map((function(e){return React.createElement(Section,{id:e.sectionId,key:e.id},React.createElement(Row,null,React.createElement(MiddlePanel,null,React.createElement(H2,null,React.createElement(ShareLink,{to:e.sectionId}),e.id),React.createElement(Markdown,{source:e.description||""}),React.createElement(StyledMarkdownBlock,null,React.createElement("table",{className:"security-details"},React.createElement("tbody",null,React.createElement("tr",null,React.createElement("th",null," Security Scheme Type "),React.createElement("td",null," ",AUTH_TYPES[e.type]||e.type," ")),e.apiKey?React.createElement("tr",null,React.createElement("th",null," ",titleize(e.apiKey.in||"")," parameter name:"),React.createElement("td",null," ",e.apiKey.name," ")):e.http?[React.createElement("tr",{key:"scheme"},React.createElement("th",null," HTTP Authorization Scheme "),React.createElement("td",null," ",e.http.scheme," ")),"bearer"===e.http.scheme&&e.http.bearerFormat&&React.createElement("tr",{key:"bearer"},React.createElement("th",null," Bearer format "),React.createElement("td",null,' "',e.http.bearerFormat,'" '))]:e.openId?React.createElement("tr",null,React.createElement("th",null," Connect URL "),React.createElement("td",null,React.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:e.openId.connectUrl},e.openId.connectUrl))):e.flows?Object.keys(e.flows).map((function(t){return React.createElement(OAuthFlow,{key:t,type:t,flow:e.flows[t]})})):null))))))}))}}),t}(React.PureComponent);export{SecurityDefs};
|
|
2
2
|
//# sourceMappingURL=SecuritySchemes.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IMenuItem, OperationModel } from '../../services';
|
|
3
|
-
import { ExternalLink
|
|
3
|
+
import { ExternalLink } from '../../../../services/ProStore';
|
|
4
4
|
export interface MenuItemProps {
|
|
5
5
|
item: IMenuItem;
|
|
6
6
|
onActivate?: (item: IMenuItem, evt: React.MouseEvent<HTMLElement>) => void;
|
|
@@ -13,7 +13,5 @@ export declare const MenuItem: (props: React.PropsWithChildren<MenuItemProps>) =
|
|
|
13
13
|
export interface OperationMenuItemContentProps {
|
|
14
14
|
item: OperationModel;
|
|
15
15
|
}
|
|
16
|
-
export declare const MenuItemPath: import("styled-components").StyledComponent<"code", import("
|
|
17
|
-
|
|
18
|
-
}, never>;
|
|
19
|
-
export declare const SeparatorLine: import("styled-components").StyledComponent<"span", import("../../theme").ResolvedThemeInterface, {}, never>;
|
|
16
|
+
export declare const MenuItemPath: import("styled-components").StyledComponent<"code", import("../../../../services/extendTheme").ProTheme, {}, never>;
|
|
17
|
+
export declare const SeparatorLine: import("styled-components").StyledComponent<"span", import("../../../../services/extendTheme").ProTheme, {}, never>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare const OperationBadge: import("styled-components").StyledComponent<"span", import("
|
|
1
|
+
export declare const OperationBadge: import("styled-components").StyledComponent<"span", import("../../../../services/extendTheme").ProTheme, {
|
|
2
2
|
className: `operation-type ${string}`;
|
|
3
3
|
} & {
|
|
4
4
|
type: string;
|
|
5
5
|
}, "className">;
|
|
6
|
-
export declare const MenuItemUl: import("styled-components").StyledComponent<"ul", import("
|
|
6
|
+
export declare const MenuItemUl: import("styled-components").StyledComponent<"ul", import("../../../../services/extendTheme").ProTheme, {
|
|
7
7
|
expanded: boolean;
|
|
8
8
|
}, never>;
|
|
9
|
-
export declare const MenuItemLi: import("styled-components").StyledComponent<"li", import("
|
|
9
|
+
export declare const MenuItemLi: import("styled-components").StyledComponent<"li", import("../../../../services/extendTheme").ProTheme, {
|
|
10
10
|
depth: number;
|
|
11
11
|
}, never>;
|
|
12
12
|
export interface MenuItemLabelType {
|
|
@@ -16,15 +16,15 @@ export interface MenuItemLabelType {
|
|
|
16
16
|
type?: string;
|
|
17
17
|
hasChildren?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare const MenuItemLabel: import("styled-components").StyledComponent<"label", import("
|
|
19
|
+
export declare const MenuItemLabel: import("styled-components").StyledComponent<"label", import("../../../../services/extendTheme").ProTheme, {
|
|
20
20
|
role: "menuitem";
|
|
21
21
|
className: string;
|
|
22
22
|
} & MenuItemLabelType, "className" | "role">;
|
|
23
|
-
export declare const MenuItemLink: import("styled-components").StyledComponent<"a", import("
|
|
23
|
+
export declare const MenuItemLink: import("styled-components").StyledComponent<"a", import("../../../../services/extendTheme").ProTheme, {
|
|
24
24
|
role: "menuitem";
|
|
25
25
|
className: string;
|
|
26
26
|
} & MenuItemLabelType, "className" | "role">;
|
|
27
|
-
export declare const MenuItemTitle: import("styled-components").StyledComponent<"span", import("
|
|
27
|
+
export declare const MenuItemTitle: import("styled-components").StyledComponent<"span", import("../../../../services/extendTheme").ProTheme, {
|
|
28
28
|
width?: string | undefined;
|
|
29
29
|
}, never>;
|
|
30
|
-
export declare const RedocAttribution: import("styled-components").StyledComponent<"div", import("
|
|
30
|
+
export declare const RedocAttribution: import("styled-components").StyledComponent<"div", import("../../../../services/extendTheme").ProTheme, {}, never>;
|
|
@@ -14,7 +14,7 @@ export declare class OpenAPIParser {
|
|
|
14
14
|
private _refCounter;
|
|
15
15
|
private allowMergeRefs;
|
|
16
16
|
constructor(definition: OpenAPIDefinition, definitionUrl?: string, options?: RedocNormalizedOptions);
|
|
17
|
-
validate(spec:
|
|
17
|
+
validate(spec: GenericObject): void;
|
|
18
18
|
private containsSecurity;
|
|
19
19
|
preprocess(spec: OpenAPIDefinition): void;
|
|
20
20
|
/**
|
|
@@ -24,7 +24,7 @@ export declare class OpenAPIParser {
|
|
|
24
24
|
/**
|
|
25
25
|
* checks if the object is OpenAPI reference (contains $ref property)
|
|
26
26
|
*/
|
|
27
|
-
isRef(obj:
|
|
27
|
+
isRef<T extends unknown>(obj: OpenAPIRef | T): obj is OpenAPIRef;
|
|
28
28
|
/**
|
|
29
29
|
* resets visited endpoints. should be run after
|
|
30
30
|
*/
|
|
@@ -37,7 +37,7 @@ export declare class OpenAPIParser {
|
|
|
37
37
|
* @param mergeAsAllOf
|
|
38
38
|
*/
|
|
39
39
|
deref<T extends unknown>(obj: OpenAPIRef | T, forceCircular?: boolean, mergeAsAllOf?: boolean): T;
|
|
40
|
-
mergeRefs(ref:
|
|
40
|
+
mergeRefs<T extends unknown>(ref: OpenAPIRef, resolved: T, mergeAsAllOf: boolean): T;
|
|
41
41
|
shallowDeref<T extends unknown>(obj: OpenAPIRef | T): T;
|
|
42
42
|
/**
|
|
43
43
|
* Merge allOf constraints.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__rest,__spreadArray}from"tslib";import{resolve as urlResolve}from"url";import{appendToMdHeading,IS_BROWSER}from"../utils/";import{JsonPointer}from"../utils/JsonPointer";import{getDefinitionName,isNamedDefinition,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME}from"../utils";import{buildComponentComment,MarkdownRenderer}from"./MarkdownRenderer";import{RedocNormalizedOptions}from"./RedocNormalizedOptions";var RefCounter=function(){function e(){Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._counter={}}}),Object.defineProperty(e.prototype,"visit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]?this._counter[e]+1:1}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]&&this._counter[e]-1}}),Object.defineProperty(e.prototype,"visited",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._counter[e]}}),e}(),OpenAPIParser=function(){function e(e,r,t){var i=this;void 0===t&&(t=new RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"definitionUrl",{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,"hasSecurityDefinitions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_refCounter",{enumerable:!0,configurable:!0,writable:!0,value:new RefCounter}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(i.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer.get(i.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.hasSecurityDefinitions=this.containsSecurity(e),this.allowMergeRefs=e.openapi.startsWith("3.1");var n=IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=urlResolve(n,r))}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"containsSecurity",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.info&&e.info.description||"";return MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_COMPONENT_NAME)||MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_JSX_NAME)}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.info&&this.options.hideInfoDescription)e.info.description="";else if(!this.options.noAutoAuth&&e.info&&e.components&&e.components.securitySchemes){var r=e.info.description||"";if(!this.containsSecurity(e)){var t=buildComponentComment(SECURITY_DEFINITIONS_COMPONENT_NAME);e.info.description=appendToMdHeading(r,"Authentication",t)}}}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==e.$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"resetVisited",{enumerable:!1,configurable:!0,writable:!0,value:function(){if("production"!==process.env.NODE_ENV)for(var e in this._refCounter._counter)this._refCounter._counter[e]>0&&console.warn("Not exited reference: "+e);this._refCounter=new RefCounter}}),Object.defineProperty(e.prototype,"exitRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRef(e)&&this._refCounter.exit(e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=!1),this.isRef(e)){var i=getDefinitionName(e.$ref);if(i&&this.options.ignoreNamedSchemas.has(i))return{type:"object",title:i};var n=this.byRef(e.$ref),o=this._refCounter.visited(e.$ref);if(this._refCounter.visit(e.$ref),o&&!r)return Object.assign({},n,{"x-circular-ref":!0});var a=n;return this.isRef(n)&&(a=this.deref(n,!1,t),this.exitRef(n)),this.allowMergeRefs?this.mergeRefs(e,n,t):a}return e}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){e.$ref;var i=__rest(e,["$ref"]),n=Object.keys(i);return 0===n.length?r:t&&n.some((function(e){return"description"!==e&&"title"!==e&&"externalDocs"!==e}))?{allOf:[i,r]}:__assign(__assign({},r),i)}}),Object.defineProperty(e.prototype,"shallowDeref",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.isRef(e)){var r=getDefinitionName(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{type:"object",title:r};var t=this.byRef(e.$ref);return this.allowMergeRefs?this.mergeRefs(e,t,!1):t}return e}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t,i){var n,o=this;if(void 0===t&&(t=!1),void 0===i&&(i=new Set),r&&i.add(r),void 0===(e=this.hoistOneOfs(e)).allOf)return e;var a=__assign(__assign({},e),{allOf:void 0,parentRefs:[],title:e.title||getDefinitionName(r)});void 0!==a.properties&&"object"==typeof a.properties&&(a.properties=__assign({},a.properties)),void 0!==a.items&&"object"==typeof a.items&&(a.items=__assign({},a.items));for(var f=e.allOf.map((function(e){var r;if(e&&e.$ref&&i.has(e.$ref))
|
|
1
|
+
import{__assign,__rest,__spreadArray}from"tslib";import{resolve as urlResolve}from"url";import{appendToMdHeading,IS_BROWSER}from"../utils/";import{JsonPointer}from"../utils/JsonPointer";import{getDefinitionName,isNamedDefinition,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME}from"../utils";import{buildComponentComment,MarkdownRenderer}from"./MarkdownRenderer";import{RedocNormalizedOptions}from"./RedocNormalizedOptions";var RefCounter=function(){function e(){Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._counter={}}}),Object.defineProperty(e.prototype,"visit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]?this._counter[e]+1:1}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]&&this._counter[e]-1}}),Object.defineProperty(e.prototype,"visited",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._counter[e]}}),e}(),OpenAPIParser=function(){function e(e,r,t){var i=this;void 0===t&&(t=new RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"definitionUrl",{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,"hasSecurityDefinitions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_refCounter",{enumerable:!0,configurable:!0,writable:!0,value:new RefCounter}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(i.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer.get(i.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.hasSecurityDefinitions=this.containsSecurity(e),this.allowMergeRefs=e.openapi.startsWith("3.1");var n=IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=urlResolve(n,r))}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"containsSecurity",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.info&&e.info.description||"";return MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_COMPONENT_NAME)||MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_JSX_NAME)}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.info&&this.options.hideInfoDescription)e.info.description="";else if(!this.options.noAutoAuth&&e.info&&e.components&&e.components.securitySchemes){var r=e.info.description||"";if(!this.containsSecurity(e)){var t=buildComponentComment(SECURITY_DEFINITIONS_COMPONENT_NAME);e.info.description=appendToMdHeading(r,"Authentication",t)}}}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==(e=e).$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"resetVisited",{enumerable:!1,configurable:!0,writable:!0,value:function(){if("production"!==process.env.NODE_ENV)for(var e in this._refCounter._counter)this._refCounter._counter[e]>0&&console.warn("Not exited reference: "+e);this._refCounter=new RefCounter}}),Object.defineProperty(e.prototype,"exitRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRef(e)&&this._refCounter.exit(e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=!1),this.isRef(e)){var i=getDefinitionName(e.$ref);if(i&&this.options.ignoreNamedSchemas.has(i))return{type:"object",title:i};var n=this.byRef(e.$ref),o=this._refCounter.visited(e.$ref);if(this._refCounter.visit(e.$ref),o&&!r)return Object.assign({},n,{"x-circular-ref":!0});var a=n;return this.isRef(n)&&(a=this.deref(n,!1,t),this.exitRef(n)),this.allowMergeRefs?this.mergeRefs(e,n,t):a}return e}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){e.$ref;var i=__rest(e,["$ref"]),n=Object.keys(i);return 0===n.length?r:t&&n.some((function(e){return"description"!==e&&"title"!==e&&"externalDocs"!==e}))?{allOf:[i,r]}:__assign(__assign({},r),i)}}),Object.defineProperty(e.prototype,"shallowDeref",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.isRef(e)){var r=getDefinitionName(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{type:"object",title:r};var t=this.byRef(e.$ref);return this.allowMergeRefs?this.mergeRefs(e,t,!1):t}return e}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t,i){var n,o=this;if(void 0===t&&(t=!1),void 0===i&&(i=new Set),r&&i.add(r),void 0===(e=this.hoistOneOfs(e)).allOf)return e;var a=__assign(__assign({},e),{allOf:void 0,parentRefs:[],title:e.title||getDefinitionName(r)});void 0!==a.properties&&"object"==typeof a.properties&&(a.properties=__assign({},a.properties)),void 0!==a.items&&"object"==typeof a.items&&(a.items=__assign({},a.items));for(var f=e.allOf.map((function(e){var r;if(!(e&&e.$ref&&i.has(e.$ref))){var n=o.deref(e,t,!0),f=e.$ref||void 0,s=o.mergeAllOf(n,f,t,i);return null===(r=a.parentRefs)||void 0===r||r.push.apply(r,s.parentRefs||[]),{$ref:f,schema:s}}})).filter((function(e){return void 0!==e})),s=0,l=f;s<l.length;s++){var u=l[s],p=u.$ref,c=u.schema;if(a.type!==c.type&&void 0!==a.type&&void 0!==c.type&&console.warn('Incompatible types in allOf at "'+r+'": "'+a.type+'" and "'+c.type+'"'),void 0!==c.type&&(a.type=c.type),void 0!==c.properties)for(var d in a.properties=a.properties||{},c.properties)if(a.properties[d]){var b=this.mergeAllOf({allOf:[a.properties[d],c.properties[d]]},r+"/properties/"+d);a.properties[d]=b,this.exitParents(b)}else a.properties[d]=c.properties[d];void 0!==c.items&&(a.items=a.items||{},a.items=this.mergeAllOf({allOf:[a.items,c.items]},r+"/items",!1,i)),void 0!==c.required&&(a.required=(a.required||[]).concat(c.required)),a=__assign(__assign({},c),a),p&&(null===(n=a.parentRefs)||void 0===n||n.push(p),void 0===a.title&&isNamedDefinition(p))}return a}}),Object.defineProperty(e.prototype,"findDerived",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r={},t=this.definition.components&&this.definition.components.schemas||{};for(var i in t){var n=this.deref(t[i]);void 0!==n.allOf&&n.allOf.find((function(r){return void 0!==r.$ref&&e.indexOf(r.$ref)>-1}))&&(r["#/components/schemas/"+i]=[n["x-discriminator-value"]||i])}return r}}),Object.defineProperty(e.prototype,"exitParents",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=0,t=e.parentRefs||[];r<t.length;r++){var i=t[r];this.exitRef({$ref:i})}}}),Object.defineProperty(e.prototype,"hoistOneOfs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;if(void 0===e.allOf)return e;for(var t=e.allOf,i=function(e){var i=t[e];if(Array.isArray(i.oneOf)){var n=t.slice(0,e),o=t.slice(e+1);return{value:{oneOf:i.oneOf.map((function(e){var t=r.mergeAllOf({allOf:__spreadArray(__spreadArray(__spreadArray([],n,!0),[e],!1),o,!0)});return r.exitParents(t),t}))}}}},n=0;n<t.length;n++){var o=i(n);if("object"==typeof o)return o.value}return e}}),e}();export{OpenAPIParser};
|
|
2
2
|
//# sourceMappingURL=OpenAPIParser.js.map
|
|
@@ -20,6 +20,6 @@ export declare function add<T>(title: string, description: string, meta?: T): vo
|
|
|
20
20
|
export declare function done(): Promise<void>;
|
|
21
21
|
export declare function toJS(): Promise<any>;
|
|
22
22
|
export declare function fromExternalJS(path: string, exportName: string): Promise<void>;
|
|
23
|
-
export declare function load(state:
|
|
23
|
+
export declare function load(state: GenericObject): Promise<void>;
|
|
24
24
|
export declare function dispose(): Promise<void>;
|
|
25
25
|
export declare function search<Meta = string>(q: string, limit?: number): Promise<Array<SearchResult<Meta>>>;
|
|
@@ -77,8 +77,8 @@ export declare class OperationModel implements IMenuItem {
|
|
|
77
77
|
get requestBody(): RequestBodyModel | undefined;
|
|
78
78
|
get payload(): XPayloadSample | undefined;
|
|
79
79
|
get hasSamples(): boolean;
|
|
80
|
-
get definitionSamples():
|
|
81
|
-
get allCodeSamples():
|
|
80
|
+
get definitionSamples(): Array<OpenAPIXCodeSample | Unstable_ExternalCodeSample>;
|
|
81
|
+
get allCodeSamples(): Array<Unstable_ExternalCodeSample | OpenAPIXCodeSample>;
|
|
82
82
|
get parameters(): FieldModel[];
|
|
83
83
|
get responses(): ResponseModel[];
|
|
84
84
|
get callbacks(): CallbackModel[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as styledComponents from 'styled-components';
|
|
2
2
|
import { ResolvedThemeInterface, MediaValue } from './theme';
|
|
3
|
+
import { ProTheme } from '../../services/extendTheme';
|
|
3
4
|
export type { ResolvedThemeInterface, MediaValue };
|
|
4
|
-
declare const styled: styledComponents.ThemedStyledInterface<
|
|
5
|
+
declare const styled: styledComponents.ThemedStyledInterface<ProTheme>, css: styledComponents.ThemedCssFunction<ProTheme>, createGlobalStyle: <P extends object = {}>(first: TemplateStringsArray | styledComponents.CSSObject | styledComponents.InterpolationFunction<styledComponents.ThemedStyledProps<P, ProTheme>>, ...interpolations: styledComponents.Interpolation<styledComponents.ThemedStyledProps<P, ProTheme>>[]) => styledComponents.GlobalStyleComponent<P, ProTheme>, keyframes: (strings: TemplateStringsArray | styledComponents.CSSKeyframes, ...interpolations: styledComponents.SimpleInterpolation[]) => styledComponents.Keyframes, ThemeProvider: styledComponents.ThemeProviderComponent<ProTheme, ProTheme>;
|
|
5
6
|
export { css, createGlobalStyle, keyframes, ThemeProvider };
|
|
6
7
|
export default styled;
|
|
7
|
-
export declare function extensionsHook(styledName: string):
|
|
8
|
+
export declare function extensionsHook(styledName: string): any;
|
|
8
9
|
export { mediaCSS, mediaMap, ZERO_BREAKPOINT } from './utils/media-css';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Throttle(delay: number): (_:
|
|
1
|
+
export declare function Throttle(delay: number): (_: unknown, _2: unknown, desc: PropertyDescriptor) => void;
|
|
@@ -18,9 +18,9 @@ export declare function mapValues<T, P>(object: Record<string, T>, iteratee: (va
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function flattenByProp<T extends GenericObject, P extends keyof T>(collectionItems: T[], prop: P): T[];
|
|
20
20
|
export declare function stripTrailingSlash(path: string): string;
|
|
21
|
-
export declare function isNumeric(
|
|
21
|
+
export declare function isNumeric(value: unknown): value is number;
|
|
22
22
|
export declare function appendToMdHeading(md: string, heading: string, content: string): string;
|
|
23
|
-
export declare const mergeObjects: (target:
|
|
23
|
+
export declare const mergeObjects: (target: GenericObject, ...sources: GenericObject[]) => any;
|
|
24
24
|
/**
|
|
25
25
|
* slugify() returns empty string when failed to slugify.
|
|
26
26
|
* so try to return minimum slugified-string with failed one which keeps original value
|
|
@@ -2,4 +2,4 @@ import { Document } from '@redocly/openapi-core';
|
|
|
2
2
|
import type { OpenAPIDefinition } from '../types';
|
|
3
3
|
export declare function loadAndBundleDefinition(specUrlOrObject: GenericObject | string): Promise<OpenAPIDefinition>;
|
|
4
4
|
export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
|
|
5
|
-
export declare function convertSwagger2OpenAPI(spec:
|
|
5
|
+
export declare function convertSwagger2OpenAPI(spec: GenericObject): Promise<OpenAPIDefinition>;
|
|
@@ -3,4 +3,4 @@ export declare const ZERO_BREAKPOINT = "_";
|
|
|
3
3
|
export declare function mediaMap<T extends string | number>(breakpoints: {
|
|
4
4
|
[size: string]: string;
|
|
5
5
|
}, values: MediaValue<T>[], mediaMapper: MediaValue<(...values: T[]) => T>): MediaValue<T>;
|
|
6
|
-
export declare const mediaCSS: (args:
|
|
6
|
+
export declare const mediaCSS: (args: GenericObject) => (props?: GenericObject) => GenericObject;
|
|
@@ -12,11 +12,11 @@ export declare function isFormUrlEncoded(contentType: string): boolean;
|
|
|
12
12
|
export declare function urlFormEncodePayload(payload: GenericObject, encoding?: {
|
|
13
13
|
[field: string]: OpenAPIEncoding;
|
|
14
14
|
}): string;
|
|
15
|
-
export declare function serializeQueryParameter(name: string, style: OpenAPIParameterStyle | undefined, explode: boolean, value:
|
|
16
|
-
export declare function serializeParameterValueWithMime(value:
|
|
15
|
+
export declare function serializeQueryParameter(name: string, style: OpenAPIParameterStyle | undefined, explode: boolean, value: unknown): string;
|
|
16
|
+
export declare function serializeParameterValueWithMime(value: unknown, mime: string): string;
|
|
17
17
|
export declare function serializeParameterValue(parameter: OpenAPIParameter & {
|
|
18
18
|
serializationMime?: string;
|
|
19
|
-
}, value:
|
|
19
|
+
}, value: unknown): string;
|
|
20
20
|
export declare function langFromMime(contentType: string): string;
|
|
21
21
|
export declare function isNamedDefinition(pointer?: string): boolean;
|
|
22
22
|
export declare function getDefinitionName(pointer?: string): string | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IMenuItem, ScrollService, HistoryService, MenuItemType, SchemaModel } from '../redoc-lib';
|
|
1
|
+
import { IMenuItem, ScrollService, HistoryService, MenuItemType, SchemaModel, SpecStore } from '../redoc-lib';
|
|
2
2
|
import { RedocProNormalizedOptions } from './ProStore';
|
|
3
|
+
import { VersionedSpecStore } from './VersionedSpecStore';
|
|
3
4
|
export declare type ExtendedMenuItem = Omit<IMenuItem, 'type'> & {
|
|
4
5
|
type: MenuItemType | 'spec';
|
|
5
6
|
linkable?: boolean;
|
|
@@ -9,7 +10,7 @@ export declare type ExtendedMenuItem = Omit<IMenuItem, 'type'> & {
|
|
|
9
10
|
* Stores all side-menu related information
|
|
10
11
|
*/
|
|
11
12
|
export declare class ProMenu {
|
|
12
|
-
definition:
|
|
13
|
+
definition: SpecStore | VersionedSpecStore;
|
|
13
14
|
scroll: ScrollService;
|
|
14
15
|
options: RedocProNormalizedOptions;
|
|
15
16
|
history: HistoryService;
|
|
@@ -39,7 +40,7 @@ export declare class ProMenu {
|
|
|
39
40
|
* @param options normalized options
|
|
40
41
|
* @param history
|
|
41
42
|
*/
|
|
42
|
-
constructor(definition:
|
|
43
|
+
constructor(definition: SpecStore | VersionedSpecStore, scroll: ScrollService, options: RedocProNormalizedOptions, history: HistoryService);
|
|
43
44
|
subscribe(): void;
|
|
44
45
|
toggleSidebar(): void;
|
|
45
46
|
closeSidebar(): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate}from"tslib";import{flattenByProp,SECURITY_SCHEMES_SECTION_PREFIX,querySelector,GROUP_DEPTH}from"../redoc-lib";import{action,observable,makeObservable}from"mobx";import{VersionedSpecStore}from"./VersionedSpecStore";import{SECTION_ATTR}from"../redoc-lib/src/services/constants";import{history as historyInst}from"../redoc-lib/src/services/HistoryService";var ProMenu=function(){function e(e,t,i,r){var n=this;Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"history",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"flatItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeRenderItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"renderItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"activeItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"sideBarOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_unsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hashUnsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getItemById",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.flatItems.find((function(t){return t.id===e}))}}),Object.defineProperty(this,"initOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];i&&((t=n.flatItems.find((function(e){return e.id===i})))?(n.activate(t,!1,!1,!1,e),t.active=!1):i.startsWith(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t,!1,!1,!1,e),t&&(t.active=!1)))}}),Object.defineProperty(this,"updateOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t=e.split(n.options.deepLinkPrefix)[0];if(t){var i=n.flatItems.find(t.includes(SECURITY_SCHEMES_SECTION_PREFIX)?function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)}:function(e){return e.id===t});i?n.activateAndScroll(i,!1,void 0,e):(n.scroll.prevOffsetY=0,n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+t+'"]'))}}}),Object.defineProperty(this,"updateVersionOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.split("/")[0],i=n.definition.versionsInfo.findIndex((function(e){return e.id===t}));i<0&&(i=n.definition.versionsInfo.findIndex((function(e){return e.isDefault}))),n.definition.activeVersionIdx!==i&&(n.definition.changeVersion(i<0?0:i),n.updateItemsByVersionChange(!1,e));var r=t+"/"+SECURITY_SCHEMES_SECTION_PREFIX;if(e.startsWith(r)){var o=n.flatItems.find((function(e){return r.startsWith(e.id)}));n.activate(o,!1,!0),setTimeout((function(){return n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0)}}}),Object.defineProperty(this,"updateOnScroll",{enumerable:!0,configurable:!0,writable:!0,value:function(e){for(var t=e?1:-1,i=n.activeItemIdx;(-1!==i||e)&&!(i>=n.flatItems.length-1&&e);){if(e){var r=!1,o=n.flatItems[i+1];switch(n.options.pagination){case"section":r=o&&("spec"===o.type||"group"===o.type||"tag"===o.type);break;case"item":r="section"!==(null==o?void 0:o.type)}var a=n.getElementAt(i+1);if(-1===i&&"tag"===n.flatItems[0].type&&(r=!1),n.scroll.isElementBellow(a)||r)break}else{var s=n.flatItems[i]&&n.flatItems[i].type;r="section"===n.options.pagination&&("spec"===s||"group"===s||"tag"===s)||"item"===n.options.pagination&&"section"!==s,a=n.getElementAt(i);if(n.scroll.isElementAbove(a)||r)break}i+=t}var l=n.flatItems[i];"none"===n.options.pagination||"section"===n.options.pagination?l&&l.active||n.activate(l,!0,!0,!1):l&&"section"===l.type&&(l.active||n.activate(l,!0,!0,!1))}}),makeObservable(this),this.items=e.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return e.absoluteIdx=t})),i.disableSidebar||this.subscribe(),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.pagination,n.definition instanceof VersionedSpecStore,n.history)})),this.renderItems=this.buildRenderItems(0),this.activeItemIdx=-1,this.activeRenderItemIdx=-1,this.definition instanceof VersionedSpecStore&&this.history.subscribe(this.updateVersionOnHistory)}return Object.defineProperty(e,"updateOnHistory",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e=historyInst.currentId),e&&t.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._unsubscribe=this.scroll.subscribe(this.updateOnScroll),this._hashUnsubscribe=this.history.subscribe(this.updateOnHistory)}}),Object.defineProperty(e.prototype,"toggleSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!this.sideBarOpened}}),Object.defineProperty(e.prototype,"closeSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!1}}),Object.defineProperty(e.prototype,"getElementAt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"getElementAtOrFirstChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&"group"===t.type&&(t=t.items[0]),t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this.flatItems[this.activeItemIdx]||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateItemsByVersionChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=this.activeItem&&this.activeItem.active?this.activeItem.absoluteIdx:-1;t=t&&withoutVersion(t)||this.activeItem&&this.activeItem.active&&withoutVersion(this.activeItem.id)||"",this.deactivate(this.activeItem),this.items=this.definition.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.options.pagination,i.definition instanceof VersionedSpecStore,i.history)}));var n=t?(this.flatItems.find((function(e){return withoutVersion(e.id)===t}))||{absoluteIdx:-1}).absoluteIdx:-1;if(-1!==n&&"none"!==this.options.pagination||(this.renderItems=this.buildRenderItems(0)),this.activeItemIdx=-1,-1!==n)this.activate(this.flatItems[n],e);else if(-1!==r)this.activateAndScroll(this.flatItems[0],e);else if(e){var o=this.definition.versionsInfo[this.definition.activeVersionIdx];if(!this.history.currentId&&o.isDefault)return;this.history.replace(o.id)}}}),Object.defineProperty(e.prototype,"buildRenderItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("none"===this.options.pagination)return this.items;var t=this.flatItems[e];if(t||(t=this.flatItems[0]),"spec"===t.type)return this.buildRenderItems(e+1);if("section"===t.type){var i=[],r=getParentOfType(t,"tag");if("section"===this.options.pagination&&r)return[r];if("item"===this.options.pagination&&r)return[__assign(__assign({},r),{items:getLeadingSectionItems(r)})];for(var n=getParentSpecItem(t),o=(null==n?void 0:n.items)||this.items,a=0;a<o.length&&"section"===o[a].type;a++)i.push(o[a]);return i}switch(this.options.pagination){case"section":if("operation"===t.type&&t.parent)return[t.parent];if("group"!==t.type)return[t];case"item":return"operation"===t.type?[t]:[__assign(__assign({},t),{items:getLeadingSectionItems(t)})];default:return[]}}}),Object.defineProperty(e.prototype,"activateBase",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){var n,o,a,s,l,c=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),(null===(n=this.activeItem)||void 0===n?void 0:n.id)===(null==e?void 0:e.id)&&!r)return t&&e&&this.history.replace(e.id,i),void(e&&!e.active&&e.activate());if(!e||"group"!==e.type)if(this.deactivate(this.activeItem),e){if(!(e.depth<=GROUP_DEPTH)){this.activeItemIdx=e.absoluteIdx,t&&this.history.replace(e.id,i),e.activate(),e.expand();var u=new URLSearchParams(r),d="request"===u.get("t"),f="response"===u.get("t"),p=u.get("c"),v=u.get("ct"),b=u.get("in"),h=u.get("path"),m=(null==h?void 0:h.split(this.options.deepLinkSeparator))||[],I=e;if(b)for(var y=I.parameters,g=function(e){var t=null==y?void 0:y.find((function(t){return t.name===e}));null==t||t.expand(),y=null===(o=null==t?void 0:t.schema)||void 0===o?void 0:o.fields},O=0,S=m;O<S.length;O++){g(S[O])}else if(d){var _=null===(a=I.requestBody)||void 0===a?void 0:a.content;null===(s=I.activateMimeName)||void 0===s||s.call(I,v||I.activeMimeName),setTimeout((function(){var e;return c.activateField(m,null===(e=null==_?void 0:_.active)||void 0===e?void 0:e.schema)}),0)}else if(f){var P=I.responses.find((function(e){return e.code===p}));(null==P?void 0:P.expanded)||null==P||P.expand(),null===(l=I.activateMimeName)||void 0===l||l.call(I,v||I.activeMimeName),setTimeout((function(){var e,t;return c.activateField(m,null===(t=null===(e=null==P?void 0:P.content)||void 0===e?void 0:e.active)||void 0===t?void 0:t.schema)}),0)}}}else this.history.replace("",i)}}),Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r,n){var o=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===r&&(r=!0),"none"===this.options.pagination)return this.activateBase(e,t,i,n),void(!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0));if("group"!==(null==e?void 0:e.type)){if(e&&"item"===this.options.pagination&&"tag"===e.type&&!e.description){if(e.expanded)return void e.collapse();e.expand(),e=this.flatItems[e.absoluteIdx+1]}if(this.activateBase(e,e&&t,i,n),this.activeRenderItemIdx=e?e.absoluteIdx:this.activeRenderItemIdx,this.activeRenderItemIdx>=0){var a=this.buildRenderItems(this.activeRenderItemIdx);a.some((function(e,t){return e.id!==o.renderItems[t].id}))&&(this.renderItems=a),this.renderItems[0]&&(this.activeRenderItemIdx=this.renderItems[0].absoluteIdx)}r&&setTimeout((function(){return o.scrollToActive()})),!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0)}}}),Object.defineProperty(e.prototype,"activateField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var i,r=function(r){var n=e[r],o=r===e.length-1;if((null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items),null==t?void 0:t.oneOf){var a=Number(n);return null==t||t.activateOneOf(a),t=null==t?void 0:t.oneOf[a],"continue"}(null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items);var s=null===(i=null==t?void 0:t.fields)||void 0===i?void 0:i.find((function(e){return e.name===n}));o||null==s||s.expand(),t=null==s?void 0:s.schema},n=0;n<e.length-1;n++)r(n)}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0!==e)for(e.deactivate();void 0!==e;)e.collapse(),e=e.parent}}),Object.defineProperty(e.prototype,"activateAndScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){void 0===r&&(r="");var n=r.split(this.options.deepLinkPrefix)[1],o=e&&this.getItemById(e.id)||e;this.activate(o,t,i,!1,n),this.scrollToActive(n?r:""),o&&o.items.length||this.closeSidebar()}}),Object.defineProperty(e.prototype,"scrollToActive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e?setTimeout((function(){return t.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0):this.scroll.scrollIntoView(this.getElementAt(this.activeItemIdx))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;null===(e=this._unsubscribe)||void 0===e||e.call(this),null===(t=this._hashUnsubscribe)||void 0===t||t.call(this)}}),__decorate([observable],e.prototype,"flatItems",void 0),__decorate([observable],e.prototype,"items",void 0),__decorate([observable],e.prototype,"activeRenderItemIdx",void 0),__decorate([observable.ref],e.prototype,"renderItems",void 0),__decorate([observable],e.prototype,"activeItemIdx",void 0),__decorate([observable],e.prototype,"sideBarOpened",void 0),__decorate([action],e.prototype,"toggleSidebar",null),__decorate([action],e.prototype,"closeSidebar",null),__decorate([action],e.prototype,"activateBase",null),__decorate([action],e.prototype,"activate",null),__decorate([action.bound],e.prototype,"activateAndScroll",null),e}();export{ProMenu};function withoutVersion(e){return e.split("/").slice(1).join("/")}function getParentSpecItem(e){for(;e;){if("spec"===e.type)return e;e=e.parent}}function getParentOfType(e,t){if(e&&e.parent)return e.parent.type===t?e.parent:getParentOfType(e.parent,t)}function getLeadingSectionItems(e){for(var t=[],i=0,r=e.items;i<r.length;i++){var n=r[i];if("section"!==n.type)break;t.push(n)}return t}function normalizeItem(e,t,i,r,n){if(e.absoluteIdx=t,"none"!==i){var o=getParentOfType(e,"tag");if(e.parent&&o&&!("_id_normalized"in e)){if(r){var a=e.id.split("/"),s=a[0],l=a[1],c=withoutVersion(e.id);if("operation"===e.type&&!l.startsWith("operation"))return;e.id=s+"/"+withoutVersion(o.id)+"/"+c}else{if("operation"===e.type&&!e.id.startsWith("operation"))return;e.id=o.id+"/"+e.id}e._id_normalized=!0}}"group"!==e.type&&(e.href=n.linkForId(e.id))}
|
|
1
|
+
import{__assign,__decorate}from"tslib";import{flattenByProp,SECURITY_SCHEMES_SECTION_PREFIX,querySelector,GROUP_DEPTH}from"../redoc-lib";import{action,observable,makeObservable}from"mobx";import{VersionedSpecStore}from"./VersionedSpecStore";import{SECTION_ATTR}from"../redoc-lib/src/services/constants";import{history as historyInst}from"../redoc-lib/src/services/HistoryService";var ProMenu=function(){function e(e,t,i,r){var n=this;Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"history",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"flatItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeRenderItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"renderItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"activeItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"sideBarOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_unsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hashUnsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getItemById",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.flatItems.find((function(t){return t.id===e}))}}),Object.defineProperty(this,"initOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];i&&((t=n.flatItems.find((function(e){return e.id===i})))?(n.activate(t,!1,!1,!1,e),t.active=!1):i.startsWith(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t,!1,!1,!1,e),t&&(t.active=!1)))}}),Object.defineProperty(this,"updateOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t=e.split(n.options.deepLinkPrefix)[0];if(t){var i=n.flatItems.find(t.includes(SECURITY_SCHEMES_SECTION_PREFIX)?function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)}:function(e){return e.id===t});i?n.activateAndScroll(i,!1,void 0,e):(n.scroll.prevOffsetY=0,n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+t+'"]'))}}}),Object.defineProperty(this,"updateVersionOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if("versionsInfo"in n.definition){var t=e.split("/")[0],i=n.definition.versionsInfo.findIndex((function(e){return e.id===t}));i<0&&(i=n.definition.versionsInfo.findIndex((function(e){return e.isDefault}))),n.definition.activeVersionIdx!==i&&(n.definition.changeVersion(i<0?0:i),n.updateItemsByVersionChange(!1,e));var r=t+"/"+SECURITY_SCHEMES_SECTION_PREFIX;if(e.startsWith(r)){var o=n.flatItems.find((function(e){return r.startsWith(e.id)}));n.activate(o,!1,!0),setTimeout((function(){return n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0)}}}}),Object.defineProperty(this,"updateOnScroll",{enumerable:!0,configurable:!0,writable:!0,value:function(e){for(var t=e?1:-1,i=n.activeItemIdx;(-1!==i||e)&&!(i>=n.flatItems.length-1&&e);){if(e){var r=!1,o=n.flatItems[i+1];switch(n.options.pagination){case"section":r=o&&("spec"===o.type||"group"===o.type||"tag"===o.type);break;case"item":r="section"!==(null==o?void 0:o.type)}var a=n.getElementAt(i+1);if(-1===i&&"tag"===n.flatItems[0].type&&(r=!1),n.scroll.isElementBellow(a)||r)break}else{var s=n.flatItems[i]&&n.flatItems[i].type;r="section"===n.options.pagination&&("spec"===s||"group"===s||"tag"===s)||"item"===n.options.pagination&&"section"!==s,a=n.getElementAt(i);if(n.scroll.isElementAbove(a)||r)break}i+=t}var l=n.flatItems[i];"none"===n.options.pagination||"section"===n.options.pagination?l&&l.active||n.activate(l,!0,!0,!1):l&&"section"===l.type&&(l.active||n.activate(l,!0,!0,!1))}}),makeObservable(this),this.items=e.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return e.absoluteIdx=t})),i.disableSidebar||this.subscribe(),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.pagination,n.definition instanceof VersionedSpecStore,n.history)})),this.renderItems=this.buildRenderItems(0),this.activeItemIdx=-1,this.activeRenderItemIdx=-1,this.definition instanceof VersionedSpecStore&&this.history.subscribe(this.updateVersionOnHistory)}return Object.defineProperty(e,"updateOnHistory",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e=historyInst.currentId),e&&t.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._unsubscribe=this.scroll.subscribe(this.updateOnScroll),this._hashUnsubscribe=this.history.subscribe(this.updateOnHistory)}}),Object.defineProperty(e.prototype,"toggleSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!this.sideBarOpened}}),Object.defineProperty(e.prototype,"closeSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!1}}),Object.defineProperty(e.prototype,"getElementAt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"getElementAtOrFirstChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&"group"===t.type&&(t=t.items[0]),t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this.flatItems[this.activeItemIdx]||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateItemsByVersionChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;if("versionsInfo"in this.definition){var r=this.activeItem&&this.activeItem.active?this.activeItem.absoluteIdx:-1;t=t&&withoutVersion(t)||this.activeItem&&this.activeItem.active&&withoutVersion(this.activeItem.id)||"",this.deactivate(this.activeItem),this.items=this.definition.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.options.pagination,i.definition instanceof VersionedSpecStore,i.history)}));var n=t?(this.flatItems.find((function(e){return withoutVersion(e.id)===t}))||{absoluteIdx:-1}).absoluteIdx:-1;if(-1!==n&&"none"!==this.options.pagination||(this.renderItems=this.buildRenderItems(0)),this.activeItemIdx=-1,-1!==n)this.activate(this.flatItems[n],e);else if(-1!==r)this.activateAndScroll(this.flatItems[0],e);else if(e){var o=this.definition.versionsInfo[this.definition.activeVersionIdx];if(!this.history.currentId&&o.isDefault)return;this.history.replace(o.id)}}}}),Object.defineProperty(e.prototype,"buildRenderItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("none"===this.options.pagination)return this.items;var t=this.flatItems[e];if(t||(t=this.flatItems[0]),"spec"===t.type)return this.buildRenderItems(e+1);if("section"===t.type){var i=[],r=getParentOfType(t,"tag");if("section"===this.options.pagination&&r)return[r];if("item"===this.options.pagination&&r)return[__assign(__assign({},r),{items:getLeadingSectionItems(r)})];for(var n=getParentSpecItem(t),o=(null==n?void 0:n.items)||this.items,a=0;a<o.length&&"section"===o[a].type;a++)i.push(o[a]);return i}switch(this.options.pagination){case"section":if("operation"===t.type&&t.parent)return[t.parent];if("group"!==t.type)return[t];case"item":return"operation"===t.type?[t]:[__assign(__assign({},t),{items:getLeadingSectionItems(t)})];default:return[]}}}),Object.defineProperty(e.prototype,"activateBase",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){var n,o,a,s,l,c=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),(null===(n=this.activeItem)||void 0===n?void 0:n.id)===(null==e?void 0:e.id)&&!r)return t&&e&&this.history.replace(e.id,i),void(e&&!e.active&&e.activate());if(!e||"group"!==e.type)if(this.deactivate(this.activeItem),e){if(!(e.depth<=GROUP_DEPTH)){this.activeItemIdx=e.absoluteIdx,t&&this.history.replace(e.id,i),e.activate(),e.expand();var u=new URLSearchParams(r),d="request"===u.get("t"),f="response"===u.get("t"),p=u.get("c"),v=u.get("ct"),b=u.get("in"),h=u.get("path"),m=(null==h?void 0:h.split(this.options.deepLinkSeparator))||[],I=e;if(b)for(var y=I.parameters,g=function(e){var t=null==y?void 0:y.find((function(t){return t.name===e}));null==t||t.expand(),y=null===(o=null==t?void 0:t.schema)||void 0===o?void 0:o.fields},O=0,S=m;O<S.length;O++){g(S[O])}else if(d){var _=null===(a=I.requestBody)||void 0===a?void 0:a.content;null===(s=I.activateMimeName)||void 0===s||s.call(I,v||I.activeMimeName),setTimeout((function(){var e;return c.activateField(m,null===(e=null==_?void 0:_.active)||void 0===e?void 0:e.schema)}),0)}else if(f){var P=I.responses.find((function(e){return e.code===p}));(null==P?void 0:P.expanded)||null==P||P.expand(),null===(l=I.activateMimeName)||void 0===l||l.call(I,v||I.activeMimeName),setTimeout((function(){var e,t;return c.activateField(m,null===(t=null===(e=null==P?void 0:P.content)||void 0===e?void 0:e.active)||void 0===t?void 0:t.schema)}),0)}}}else this.history.replace("",i)}}),Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r,n){var o=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===r&&(r=!0),"none"===this.options.pagination)return this.activateBase(e,t,i,n),void(!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0));if("group"!==(null==e?void 0:e.type)){if(e&&"item"===this.options.pagination&&"tag"===e.type&&!e.description){if(e.expanded)return void e.collapse();e.expand(),e=this.flatItems[e.absoluteIdx+1]}if(this.activateBase(e,e&&t,i,n),this.activeRenderItemIdx=e?e.absoluteIdx:this.activeRenderItemIdx,this.activeRenderItemIdx>=0){var a=this.buildRenderItems(this.activeRenderItemIdx);a.some((function(e,t){return e.id!==o.renderItems[t].id}))&&(this.renderItems=a),this.renderItems[0]&&(this.activeRenderItemIdx=this.renderItems[0].absoluteIdx)}r&&setTimeout((function(){return o.scrollToActive()})),!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0)}}}),Object.defineProperty(e.prototype,"activateField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var i,r=function(r){var n=e[r],o=r===e.length-1;if((null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items),null==t?void 0:t.oneOf){var a=Number(n);return null==t||t.activateOneOf(a),t=null==t?void 0:t.oneOf[a],"continue"}(null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items);var s=null===(i=null==t?void 0:t.fields)||void 0===i?void 0:i.find((function(e){return e.name===n}));o||null==s||s.expand(),t=null==s?void 0:s.schema},n=0;n<e.length-1;n++)r(n)}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0!==e)for(e.deactivate();void 0!==e;)e.collapse(),e=e.parent}}),Object.defineProperty(e.prototype,"activateAndScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){void 0===r&&(r="");var n=r.split(this.options.deepLinkPrefix)[1],o=e&&this.getItemById(e.id)||e;this.activate(o,t,i,!1,n),this.scrollToActive(n?r:""),o&&o.items.length||this.closeSidebar()}}),Object.defineProperty(e.prototype,"scrollToActive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e?setTimeout((function(){return t.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0):this.scroll.scrollIntoView(this.getElementAt(this.activeItemIdx))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;null===(e=this._unsubscribe)||void 0===e||e.call(this),null===(t=this._hashUnsubscribe)||void 0===t||t.call(this)}}),__decorate([observable],e.prototype,"flatItems",void 0),__decorate([observable],e.prototype,"items",void 0),__decorate([observable],e.prototype,"activeRenderItemIdx",void 0),__decorate([observable.ref],e.prototype,"renderItems",void 0),__decorate([observable],e.prototype,"activeItemIdx",void 0),__decorate([observable],e.prototype,"sideBarOpened",void 0),__decorate([action],e.prototype,"toggleSidebar",null),__decorate([action],e.prototype,"closeSidebar",null),__decorate([action],e.prototype,"activateBase",null),__decorate([action],e.prototype,"activate",null),__decorate([action.bound],e.prototype,"activateAndScroll",null),e}();export{ProMenu};function withoutVersion(e){return e.split("/").slice(1).join("/")}function getParentSpecItem(e){for(;e;){if("spec"===e.type)return e;e=e.parent}}function getParentOfType(e,t){if(e&&e.parent)return e.parent.type===t?e.parent:getParentOfType(e.parent,t)}function getLeadingSectionItems(e){for(var t=[],i=0,r=e.items;i<r.length;i++){var n=r[i];if("section"!==n.type)break;t.push(n)}return t}function normalizeItem(e,t,i,r,n){if(e.absoluteIdx=t,"none"!==i){var o=getParentOfType(e,"tag");if(e.parent&&o&&!("_id_normalized"in e)){if(r){var a=e.id.split("/"),s=a[0],l=a[1],c=withoutVersion(e.id);if("operation"===e.type&&!l.startsWith("operation"))return;e.id=s+"/"+withoutVersion(o.id)+"/"+c}else{if("operation"===e.type&&!e.id.startsWith("operation"))return;e.id=o.id+"/"+e.id}e._id_normalized=!0}}"group"!==e.type&&(e.href=n.linkForId(e.id))}
|
|
2
2
|
//# sourceMappingURL=ProMenu.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IValueDidChange } from 'mobx';
|
|
2
|
-
import { ContentItemModel, IMenuItem, MarkerService, OperationModel, RedocNormalizedOptions, RedocRawOptions, SearchStore, SpecStore, OpenAPIExternalDocumentation } from '../redoc-lib';
|
|
2
|
+
import { ContentItemModel, IMenuItem, MarkerService, OperationModel, RedocNormalizedOptions, RedocRawOptions, SearchStore, SpecStore, OpenAPIExternalDocumentation, OpenAPIDefinition } from '../redoc-lib';
|
|
3
3
|
import { ProMenu } from './ProMenu';
|
|
4
4
|
import { SearchResultMeta } from './SearchStore';
|
|
5
5
|
import { ThemeExtension } from './extendTheme';
|
|
6
|
-
import { VersionedSpecStore } from './VersionedSpecStore';
|
|
6
|
+
import { SpecVersions, VersionedSpecStore } from './VersionedSpecStore';
|
|
7
7
|
import { LicenseInfo } from './check';
|
|
8
8
|
import { CodeSamplesConfig, Languages } from './code-samples/';
|
|
9
9
|
import { Events, LayoutVariant } from './store-types';
|
|
@@ -51,7 +51,7 @@ export declare type RedocProUserOptionsExt = {
|
|
|
51
51
|
linkForId?: ((id: string) => string) | null;
|
|
52
52
|
generateDeepLink?: ((fieldFragment: string, operationLink: any) => string) | undefined | null;
|
|
53
53
|
onDeepLinkClick?: ((link: string) => void) | undefined | null;
|
|
54
|
-
requestInterceptor?: ((req:
|
|
54
|
+
requestInterceptor?: ((req: Request, operation: OperationModel) => void) | undefined | null;
|
|
55
55
|
oAuth2RedirectURI?: string | null;
|
|
56
56
|
corsProxyUrl?: string | null;
|
|
57
57
|
authCorsProxyUrl?: string | null;
|
|
@@ -83,10 +83,10 @@ export interface ProStoreState {
|
|
|
83
83
|
};
|
|
84
84
|
definition: {
|
|
85
85
|
url?: string;
|
|
86
|
-
data:
|
|
86
|
+
data: GenericObject;
|
|
87
87
|
activeVersionIdx?: number;
|
|
88
88
|
};
|
|
89
|
-
searchIndex
|
|
89
|
+
searchIndex?: number;
|
|
90
90
|
tryItOperationId?: string;
|
|
91
91
|
options: RedocProRawOptions;
|
|
92
92
|
searchIndexPath?: string;
|
|
@@ -127,10 +127,10 @@ export declare class ProStore {
|
|
|
127
127
|
activeSampleLanguage: string;
|
|
128
128
|
isLoading: boolean;
|
|
129
129
|
l: Promise<LicenseInfo>;
|
|
130
|
-
constructor(spec:
|
|
130
|
+
constructor(spec: OpenAPIDefinition | SpecVersions | Array<{
|
|
131
131
|
title: string;
|
|
132
132
|
url: string;
|
|
133
|
-
}
|
|
133
|
+
}> | string, specUrl?: string, options?: RedocProRawOptions, createIndex?: boolean);
|
|
134
134
|
initProOptions(options: RedocProRawOptions): void;
|
|
135
135
|
initSearch(options: RedocProNormalizedOptions, createIndex: boolean): void;
|
|
136
136
|
onDidMount(): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{bind,debounce}from"decko";import{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,DEFAULT_SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromSessionStorage,toSessionStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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=e&&Array.isArray(e.versions),a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromSessionStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toSessionStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([bind,debounce(500)],e.prototype,"activateSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
1
|
+
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{bind,debounce}from"decko";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,DEFAULT_SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromSessionStorage,toSessionStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromSessionStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toSessionStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([bind,debounce(500)],e.prototype,"activateSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[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
|
|
@@ -3,7 +3,7 @@ import { CodeBuilder } from './code-builder';
|
|
|
3
3
|
export declare function getPreserveTransformer({ body, authorizationHeader, }: {
|
|
4
4
|
body?: boolean;
|
|
5
5
|
authorizationHeader?: boolean;
|
|
6
|
-
}): (input:
|
|
6
|
+
}): (input: GenericObject, prop: string, originalResult: string) => string;
|
|
7
7
|
export declare function addIndentation(str: string, { level, indent, firstLine }?: {
|
|
8
8
|
level?: number | undefined;
|
|
9
9
|
indent?: string | undefined;
|
|
@@ -23,14 +23,20 @@ export interface SnippetRequest extends CustomHAR {
|
|
|
23
23
|
fullUrl?: string;
|
|
24
24
|
}
|
|
25
25
|
export declare class HTTPSnippet {
|
|
26
|
-
private request;
|
|
26
|
+
private readonly request;
|
|
27
27
|
constructor(data: CustomHAR);
|
|
28
28
|
prepare(request: SnippetRequest): SnippetRequest;
|
|
29
|
-
convert(target:
|
|
30
|
-
_matchTarget(target:
|
|
29
|
+
convert(target: string, client: string, opts: PrivateOptions): string;
|
|
30
|
+
_matchTarget<T>(target: string, client: Maybe<string>): T | false;
|
|
31
31
|
}
|
|
32
32
|
export interface PrivateOptions {
|
|
33
33
|
variablesPrefix?: string;
|
|
34
|
+
showBoilerplate?: boolean;
|
|
35
|
+
withImports?: boolean;
|
|
36
|
+
withComments?: boolean;
|
|
37
|
+
withWrapper?: boolean;
|
|
38
|
+
printBody?: boolean;
|
|
39
|
+
level?: number;
|
|
34
40
|
}
|
|
35
41
|
export interface LanguageHandler<LanguageOptions> {
|
|
36
42
|
(request: SnippetRequest, opts: LanguageOptions & PrivateOptions, { target, client }: {
|
|
@@ -7,7 +7,7 @@ declare const targets: {
|
|
|
7
7
|
default: string;
|
|
8
8
|
};
|
|
9
9
|
fetch: import("..").LanguageHandler<(import("../..").BasicLanguageOptions & {
|
|
10
|
-
credentials?: "
|
|
10
|
+
credentials?: "omit" | "same-origin" | "include" | undefined;
|
|
11
11
|
}) | undefined>;
|
|
12
12
|
};
|
|
13
13
|
node: {
|
|
@@ -6,7 +6,7 @@ declare const _default: {
|
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
fetch: import("../..").LanguageHandler<(import("../../..").BasicLanguageOptions & {
|
|
9
|
-
credentials?: "
|
|
9
|
+
credentials?: "omit" | "same-origin" | "include" | undefined;
|
|
10
10
|
}) | undefined>;
|
|
11
11
|
};
|
|
12
12
|
export default _default;
|