@redocly/openapi-docs 3.3.18 → 3.3.20
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/dist/redocly-openapi-docs.min.js +1171 -934
- package/lib/components/ApiInfo/ApiInfo.js +1 -1
- package/lib/components/ApiInfo/Metadata.d.ts +3 -1
- package/lib/components/ApiInfo/Metadata.js +1 -1
- package/lib/components/CallbackSamples/CallbackSamples.d.ts +2 -0
- package/lib/components/CallbackSamples/CallbackSamples.js +1 -1
- package/lib/components/Callbacks/CallbackDetails.d.ts +2 -0
- package/lib/components/Callbacks/CallbackDetails.js +1 -1
- package/lib/components/Callbacks/CallbackOperation.js +1 -1
- package/lib/components/Callbacks/CallbackSummary.d.ts +3 -2
- package/lib/components/Callbacks/CallbackSummary.js +1 -1
- package/lib/components/Discriminator/Discriminator.d.ts +2 -0
- package/lib/components/Discriminator/Discriminator.js +1 -1
- package/lib/components/ExpandAllButton/ExpandAllButton.js +1 -1
- package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +1 -1
- package/lib/components/OperationItem/OperationItem.js +2 -2
- package/lib/components/Overview/Overview.d.ts +8 -3
- package/lib/components/Overview/Overview.js +1 -1
- package/lib/components/PayloadSamples/Example.js +1 -1
- package/lib/components/PayloadSamples/MediaTypeSamples.js +1 -1
- package/lib/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib/components/PropertyDetails/DescriptionEnums.d.ts +1 -1
- package/lib/components/PropertyDetails/DescriptionEnums.js +1 -1
- package/lib/components/PropertyDetails/EnumValues.js +1 -1
- package/lib/components/PropertyDetails/Examples.js +1 -1
- package/lib/components/PropertyDetails/FieldDetail.d.ts +1 -0
- package/lib/components/PropertyDetails/FieldDetail.js +1 -1
- package/lib/components/PropertyDetails/FieldDetails.js +1 -1
- package/lib/components/PropertyDetails/Pattern.js +1 -1
- package/lib/components/PropertyDetails/SimpleEnums.d.ts +1 -1
- package/lib/components/PropertyDetails/SimpleEnums.js +1 -1
- package/lib/components/PropertyDetails/types.d.ts +3 -0
- package/lib/components/Replay/EmbeddedReplay.js +1 -1
- package/lib/components/Replay/Replay.js +1 -1
- package/lib/components/Request/RequestDetails.js +1 -1
- package/lib/components/Request/types.d.ts +2 -0
- package/lib/components/RequestParameters/RequestParameters.js +1 -1
- package/lib/components/RequestSamples/useCodeSamples.js +1 -1
- package/lib/components/ResponseSamples/Summary.js +1 -1
- package/lib/components/Responses/OperationResponseList.js +1 -1
- package/lib/components/Responses/ResponseHeaders.js +1 -1
- package/lib/components/RightPanel/RightPanel.js +1 -1
- package/lib/components/Schema/ObjectSchema.js +1 -1
- package/lib/components/Schema/OneOfSchema.js +1 -1
- package/lib/components/Schema/RecursiveSchema.js +1 -1
- package/lib/components/Schema/SubSchema.js +1 -1
- package/lib/components/Schema/helpers.d.ts +1 -1
- package/lib/components/Schema/helpers.js +1 -1
- package/lib/components/Security/OAuthFlow.js +1 -1
- package/lib/components/Security/SecurityFlow.js +1 -1
- package/lib/components/Security/SecurityModal.js +1 -1
- package/lib/components/ServerList/ServerList.d.ts +1 -1
- package/lib/components/ServerList/ServerList.js +1 -1
- package/lib/components/ServerList/types.d.ts +4 -1
- package/lib/components/TagItem/OperationNavigationItems.d.ts +10 -0
- package/lib/components/TagItem/OperationNavigationItems.js +37 -0
- package/lib/components/TagItem/OperationsNavigation.d.ts +1 -6
- package/lib/components/TagItem/OperationsNavigation.js +1 -40
- package/lib/components/TagItem/TagItem.js +1 -1
- package/lib/components/TagItem/styled.d.ts +2 -0
- package/lib/components/TagItem/styled.js +6 -0
- package/lib/components/TagItem/types.d.ts +5 -0
- package/lib/components/TagItem/types.js +2 -0
- package/lib/components/common/BodyContent/BodyContent.js +1 -1
- package/lib/components/common/Dropdown/Dropdown.d.ts +1 -4
- package/lib/components/common/ExpandableExample/ExpandableExample.js +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/useTranslate.d.ts +2 -0
- package/lib/hooks/useTranslate.js +2 -0
- package/lib/services/code-samples/generator.d.ts +3 -1
- package/lib/services/code-samples/generator.js +1 -1
- package/lib-esm/components/ApiInfo/ApiInfo.js +1 -1
- package/lib-esm/components/ApiInfo/Metadata.d.ts +3 -1
- package/lib-esm/components/ApiInfo/Metadata.js +1 -1
- package/lib-esm/components/CallbackSamples/CallbackSamples.d.ts +2 -0
- package/lib-esm/components/CallbackSamples/CallbackSamples.js +1 -1
- package/lib-esm/components/Callbacks/CallbackDetails.d.ts +2 -0
- package/lib-esm/components/Callbacks/CallbackDetails.js +1 -1
- package/lib-esm/components/Callbacks/CallbackOperation.js +1 -1
- package/lib-esm/components/Callbacks/CallbackSummary.d.ts +3 -2
- package/lib-esm/components/Callbacks/CallbackSummary.js +1 -1
- package/lib-esm/components/Discriminator/Discriminator.d.ts +2 -0
- package/lib-esm/components/Discriminator/Discriminator.js +1 -1
- package/lib-esm/components/ExpandAllButton/ExpandAllButton.js +1 -1
- package/lib-esm/components/MediaTypeSwitch/MediaTypesSwitch.js +1 -1
- package/lib-esm/components/OperationItem/OperationItem.js +2 -2
- package/lib-esm/components/Overview/Overview.d.ts +8 -3
- package/lib-esm/components/Overview/Overview.js +1 -1
- package/lib-esm/components/PayloadSamples/Example.js +1 -1
- package/lib-esm/components/PayloadSamples/MediaTypeSamples.js +1 -1
- package/lib-esm/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib-esm/components/PropertyDetails/DescriptionEnums.d.ts +1 -1
- package/lib-esm/components/PropertyDetails/DescriptionEnums.js +1 -1
- package/lib-esm/components/PropertyDetails/EnumValues.js +1 -1
- package/lib-esm/components/PropertyDetails/Examples.js +1 -1
- package/lib-esm/components/PropertyDetails/FieldDetail.d.ts +1 -0
- package/lib-esm/components/PropertyDetails/FieldDetail.js +1 -1
- package/lib-esm/components/PropertyDetails/FieldDetails.js +1 -1
- package/lib-esm/components/PropertyDetails/Pattern.js +1 -1
- package/lib-esm/components/PropertyDetails/SimpleEnums.d.ts +1 -1
- package/lib-esm/components/PropertyDetails/SimpleEnums.js +1 -1
- package/lib-esm/components/PropertyDetails/types.d.ts +3 -0
- package/lib-esm/components/Replay/EmbeddedReplay.js +1 -1
- package/lib-esm/components/Replay/Replay.js +1 -1
- package/lib-esm/components/Request/RequestDetails.js +1 -1
- package/lib-esm/components/Request/types.d.ts +2 -0
- package/lib-esm/components/RequestParameters/RequestParameters.js +1 -1
- package/lib-esm/components/RequestSamples/useCodeSamples.js +1 -1
- package/lib-esm/components/ResponseSamples/Summary.js +1 -1
- package/lib-esm/components/Responses/OperationResponseList.js +1 -1
- package/lib-esm/components/Responses/ResponseHeaders.js +1 -1
- package/lib-esm/components/RightPanel/RightPanel.js +1 -1
- package/lib-esm/components/Schema/ObjectSchema.js +1 -1
- package/lib-esm/components/Schema/OneOfSchema.js +1 -1
- package/lib-esm/components/Schema/RecursiveSchema.js +1 -1
- package/lib-esm/components/Schema/SubSchema.js +1 -1
- package/lib-esm/components/Schema/helpers.d.ts +1 -1
- package/lib-esm/components/Schema/helpers.js +1 -1
- package/lib-esm/components/Security/OAuthFlow.js +1 -1
- package/lib-esm/components/Security/SecurityFlow.js +1 -1
- package/lib-esm/components/Security/SecurityModal.js +1 -1
- package/lib-esm/components/ServerList/ServerList.d.ts +1 -1
- package/lib-esm/components/ServerList/ServerList.js +1 -1
- package/lib-esm/components/ServerList/types.d.ts +4 -1
- package/lib-esm/components/TagItem/OperationNavigationItems.d.ts +10 -0
- package/lib-esm/components/TagItem/OperationNavigationItems.js +37 -0
- package/lib-esm/components/TagItem/OperationsNavigation.d.ts +1 -6
- package/lib-esm/components/TagItem/OperationsNavigation.js +1 -40
- package/lib-esm/components/TagItem/TagItem.js +2 -2
- package/lib-esm/components/TagItem/styled.d.ts +2 -0
- package/lib-esm/components/TagItem/styled.js +6 -0
- package/lib-esm/components/TagItem/types.d.ts +5 -0
- package/lib-esm/components/TagItem/types.js +2 -0
- package/lib-esm/components/common/BodyContent/BodyContent.js +1 -1
- package/lib-esm/components/common/Dropdown/Dropdown.d.ts +1 -4
- package/lib-esm/components/common/ExpandableExample/ExpandableExample.js +1 -1
- package/lib-esm/hooks/index.d.ts +1 -0
- package/lib-esm/hooks/index.js +1 -1
- package/lib-esm/hooks/useTranslate.d.ts +2 -0
- package/lib-esm/hooks/useTranslate.js +2 -0
- package/lib-esm/services/code-samples/generator.d.ts +3 -1
- package/lib-esm/services/code-samples/generator.js +1 -1
- package/package.json +7 -7
- package/lib/setupTests.d.ts +0 -2
- package/lib/setupTests.js +0 -2
- package/lib/testProviders.d.ts +0 -3
- package/lib/testProviders.js +0 -2
- package/lib-esm/setupTests.d.ts +0 -2
- package/lib-esm/setupTests.js +0 -2
- package/lib-esm/testProviders.d.ts +0 -3
- package/lib-esm/testProviders.js +0 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { TFunction } from '@redocly/theme';
|
|
2
3
|
import type { SchemaModel } from '../../models';
|
|
3
4
|
interface DiscriminatorDropdownProps {
|
|
4
5
|
activeOneOfIdx: number;
|
|
5
6
|
parent: SchemaModel;
|
|
6
7
|
onChange?: (idx: number) => void;
|
|
8
|
+
translate: TFunction;
|
|
7
9
|
}
|
|
8
10
|
export declare const Discriminator: import("react").NamedExoticComponent<DiscriminatorDropdownProps>;
|
|
9
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useMemo}from"react";import styled from"styled-components";import{strikethroughText}from"../../utils";import{SchemaSelection}from"../common/SchemaSelection";import{SelectionTitle}from"../common";function DiscriminatorDropdownComponent({activeOneOfIdx:e,parent:o,onChange:t}){const
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useMemo}from"react";import styled from"styled-components";import{strikethroughText}from"../../utils";import{SchemaSelection}from"../common/SchemaSelection";import{SelectionTitle}from"../common";function DiscriminatorDropdownComponent({activeOneOfIdx:e,parent:o,onChange:t,translate:i}){const r=useMemo((()=>(o.oneOf||[]).map(((e,o)=>({label:e.schema.deprecated?`${strikethroughText(e.title)} (${i("openapi.badges.deprecated","deprecated").toLowerCase()}`:e.title,value:o})))),[o.oneOf,i]);return void 0===o.oneOf?null:_jsxs(Wrapper,{children:[_jsx(SelectionTitle,{children:i("openapi.discriminator","Discriminator")}),_jsx(SchemaSelection,{options:r,pointer:o.operationPointer,onChange:t,schema:o,defaultOneOfIdx:e})]})}export const Discriminator=memo(DiscriminatorDropdownComponent);const Wrapper=styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: flex-start;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useMemo}from"react";import styled from"styled-components";import{Button,MaximizeIcon}from"@redocly/theme";import{useAtom}from"jotai/index";import{operationStore}from"../../jotai/operation";import{useTranslate}from"../../hooks";export const ExpandAllButton=({operationPointer:e,type:o})=>{const t=useTranslate(),[n,i]=useAtom(operationStore(e)),s=useMemo((()=>Object.values(n[o].expandedFields).includes(!1)),[n,o]);if(!Object.keys(n[o].expandedFields).length)return null;return _jsx(StyledButton,{icon:_jsx(MaximizeIcon,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:()=>{i((e=>{const t={};for(const n in e[o].expandedFields)t[n]=s;return Object.assign(Object.assign({},e),{[o]:{expandedFields:t}})}))},children:s?t("openapi.expandAll","Expand all"):t("openapi.collapseAll","Collapse all")})};const StyledButton=styled(Button)`
|
|
2
2
|
margin-left: auto;
|
|
3
3
|
`;
|
|
4
4
|
//# sourceMappingURL=ExpandAllButton.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useCallback,useRef}from"react";import{useAtom}from"jotai";import{SelectLabel,SelectWrapper}from"../PayloadSamples";import{Container}from"../common";import{activeMimeNameAtom}from"../../jotai/app";import{getActiveMediaType}from"../../models";function Wrapper({children:e,withLabel:t,innerRef:n}){return e?t?_jsxs(SelectWrapper,{ref:n,children:[_jsx(SelectLabel,{children:"Content type"}),e]}):_jsx(Container,{ref:n,children:e}):null}function MediaTypesSwitchComponent({content:e,withLabel:t,renderSelect:n,children:r}){const[i,
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useCallback,useRef}from"react";import{useAtom}from"jotai";import{SelectLabel,SelectWrapper}from"../PayloadSamples";import{Container}from"../common";import{activeMimeNameAtom}from"../../jotai/app";import{getActiveMediaType}from"../../models";import{useTranslate}from"../../hooks";function Wrapper({children:e,withLabel:t,innerRef:n,translate:r}){return e?t?_jsxs(SelectWrapper,{ref:n,children:[_jsx(SelectLabel,{children:r("openapi.contentType","Content type")}),e]}):_jsx(Container,{ref:n,children:e}):null}function MediaTypesSwitchComponent({content:e,withLabel:t,renderSelect:n,children:r}){const a=useTranslate(),[i,o]=useAtom(activeMimeNameAtom),l=useCallback((({value:t})=>{if(!e||!m.current)return null;const n=m.current.getBoundingClientRect().y;o(t),requestAnimationFrame((()=>{if(!m.current||null==n)return;const e=m.current.getBoundingClientRect().y;window.scrollBy(0,e-n)}))}),[e,o]),m=useRef(null);if(!e||!e.mediaTypes||!e.mediaTypes.length)return null;const s=e.mediaTypes.map(((e,t)=>({value:e.name,idx:t}))),c=getActiveMediaType(e,i);return _jsxs(_Fragment,{children:[_jsx(Wrapper,{innerRef:m,withLabel:t,translate:a,children:n({value:c.name,options:s,onChange:l,ariaLabel:"Content type"})}),r(c)]})}export const MediaTypesSwitch=memo(MediaTypesSwitchComponent);
|
|
2
2
|
//# sourceMappingURL=MediaTypesSwitch.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useState,useCallback,useMemo}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{Feedback,LayoutVariant,BeforeOpenApiOperation,AfterOpenApiOperation}from"@redocly/theme";import{SamplesMiddlePanel,SamplesPanel,ShareLink,Row,CustomBadges}from"../common";import{CallbacksList}from"../Callbacks";import{CallbackSamples}from"../CallbackSamples";import{RequestSamples}from"../RequestSamples";import{OperationResponseList}from"../Responses";import{ResponseSamples}from"../ResponseSamples";import{makeDeepLink,joinWithSeparator}from"../../services";import{layoutAtom}from"../../jotai/app";import{globalStoreAtom}from"../../jotai/store";import{getOperation}from"../../models/operation";import{RenderHook}from"../RenderHook";import{Heading,Title}from"../common/OperationItemTitle";import{LinkToField}from"../common/LinkToField";import{RequestDetails}from"../Request/RequestDetails";import{StyledBadge}from"../common/Badges";const OperationSamplesPanel=styled(SamplesPanel)`
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useState,useCallback,useMemo}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{Feedback,LayoutVariant,BeforeOpenApiOperation,AfterOpenApiOperation}from"@redocly/theme";import{SamplesMiddlePanel,SamplesPanel,ShareLink,Row,CustomBadges}from"../common";import{CallbacksList}from"../Callbacks";import{CallbackSamples}from"../CallbackSamples";import{RequestSamples}from"../RequestSamples";import{OperationResponseList}from"../Responses";import{ResponseSamples}from"../ResponseSamples";import{makeDeepLink,joinWithSeparator}from"../../services";import{layoutAtom}from"../../jotai/app";import{globalStoreAtom}from"../../jotai/store";import{getOperation}from"../../models/operation";import{RenderHook}from"../RenderHook";import{Heading,Title}from"../common/OperationItemTitle";import{LinkToField}from"../common/LinkToField";import{RequestDetails}from"../Request/RequestDetails";import{StyledBadge}from"../common/Badges";import{useTranslate}from"../../hooks";function OperationItemComponent({item:{operationDefinition:e,parent:a,href:o}}){var t,s;const l=useTranslate(),{parser:i,options:n}=useAtomValue(globalStoreAtom),r=useAtomValue(layoutAtom),[p,d]=useState(),{unstable_hooks:m,feedback:c}=n,u=useMemo((()=>getOperation(i,e,a,n,o)),[o,e,n,a,i]),{name:k,deprecated:S,isWebhook:b,badges:x}=u,h=r===LayoutVariant.STACKED,j=(null==c?void 0:c.type)||"sentiment",f=!0!==(null==c?void 0:c.hide),[g,_]=useState(null),y=useCallback((e=>{p!==e&&d(e)}),[p]);return _jsxs(OperationRow,{layout:r,children:[_jsx(OperationSubRowStyled,{layout:r,children:_jsxs(SamplesMiddlePanel,{isStacked:h,children:[_jsx(RenderHook,{Hook:BeforeOpenApiOperation||(null==m?void 0:m.BeforeOperation),props:{operation:u}}),_jsxs(Heading,{"data-testid":"operation-item-header",children:[_jsx(ShareLink,{to:o,"aria-label":`link to ${k}`}),_jsx(CustomBadges,{badges:x,children:k}),S&&_jsx(StyledBadge,{deprecated:!0,children:l("openapi.badges.deprecated","Deprecated")}),b&&_jsx(StyledBadge,{children:l("openapi.badges.webhook","Webhook")})]})]})}),_jsxs(OperationSubRowStyled,{layout:r,children:[_jsx(SamplesMiddlePanel,{isStacked:h,children:_jsx(RequestDetails,{operation:u,translate:l})}),_jsx(OperationSamplesPanel,{isStacked:h,"data-testid":"samples-block",className:"panel-container-request-samples",children:_jsx(RequestSamples,{operation:u})})]}),_jsxs(OperationSubRowStyled,{layout:r,children:[_jsx(SamplesMiddlePanel,{isStacked:h,children:(null===(t=u.responses)||void 0===t?void 0:t.length)?_jsx(OperationResponseList,{responses:u.responses,operationId:u.id,operationPointer:u.pointer,callbackId:u.callbackId,activeResponseTab:p,onTabChange:y}):null}),_jsx(OperationSamplesPanel,{isStacked:h,"data-testid":"samples-block",className:"panel-container-response-samples",children:_jsx(ResponseSamples,{operation:u,activeResponseTab:p,onTabChange:y})})]}),_jsxs(OperationSubRowStyled,{layout:r,children:[_jsxs(SamplesMiddlePanel,{isStacked:h,children:[(null===(s=u.callbacks)||void 0===s?void 0:s.length)?_jsxs(_Fragment,{children:[_jsxs(Title,{children:[_jsx(LinkToField,{to:makeDeepLink(u.id,"callbacks")}),l("openapi.callbacks","Callbacks")]}),_jsx(CallbacksList,{callbacks:u.callbacks,onExpand:_,selectedCallback:g})]}):null,_jsx(RenderHook,{Hook:AfterOpenApiOperation||(null==m?void 0:m.AfterOperation),props:{operation:u}})]}),g?_jsx(OperationSamplesPanel,{isStacked:h,"data-testid":"samples-block",children:_jsx(CallbackSamples,{callback:g,translate:l})}):null]}),_jsx(OperationSubRowStyled,{layout:r,children:_jsx(SamplesMiddlePanel,{isStacked:h,fullWidth:!0,children:f?_jsx(FeedbackWrapper,{children:_jsx(Feedback,{type:j,settings:c.settings,path:joinWithSeparator(n.routingBasePath,u.href)})}):null})})]})}export const OperationItem=memo(OperationItemComponent);const OperationSamplesPanel=styled(SamplesPanel)`
|
|
2
2
|
margin-left: auto;
|
|
3
3
|
--code-block-padding: var(--spacing-xs) 0 var(--spacing-xs) 20px;
|
|
4
|
-
|
|
4
|
+
`,FeedbackWrapper=styled.div`
|
|
5
5
|
& > div {
|
|
6
6
|
flex: 1 1 auto;
|
|
7
7
|
display: flex;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import type { TFunction } from '@redocly/theme';
|
|
1
2
|
import type { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { OpenAPIInfo } from '../../types';
|
|
4
|
+
type OverviewProps = {
|
|
5
|
+
info: OpenAPIInfo;
|
|
6
|
+
translate: TFunction;
|
|
7
|
+
};
|
|
8
|
+
export declare function Overview({ info, translate }: OverviewProps): ReactElement;
|
|
9
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{CopyButton,NewTabButton,EmailButton}from"@redocly/theme";import{PanelItem,PanelItemDescription,PanelItemsList}from"../PanelItem";export function Overview({info:e}){const
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{CopyButton,NewTabButton,EmailButton}from"@redocly/theme";import{PanelItem,PanelItemDescription,PanelItemsList}from"../PanelItem";export function Overview({info:e,translate:t}){const n=e.contact&&e.contact.url&&_jsx(PanelItem,{header:_jsx(PanelItemDescription,{children:t("openapi.info.contact.url","URL")}),title:_jsx("a",{href:e.contact.url,target:"_blank",rel:"noreferrer",children:e.contact.url}),actions:[_jsx(NewTabButton,{data:e.contact.url},"NewTabButton")]})||null,a=e.contact&&e.contact.email&&_jsx(PanelItem,{header:_jsx(PanelItemDescription,{children:e.contact.name||t("openapi.info.contact.name","E-mail")}),title:_jsx("a",{href:"mailto:"+e.contact.email,children:e.contact.email}),actions:[_jsx(CopyButton,{data:e.contact.email},"CopyButton"),_jsx(EmailButton,{data:e.contact.email},"EmailButton")]})||null,r=e.license&&_jsx(PanelItem,{header:_jsx(PanelItemDescription,{children:t("openapi.info.license","License")}),title:e.license.identifier?e.license.identifier:_jsx("a",{href:e.license.url,target:"_blank",rel:"noreferrer",children:e.license.name}),actions:[_jsx(NewTabButton,{data:e.license.url||""},"NewTabButton")]})||null,i=e.termsOfService&&_jsx(PanelItem,{title:_jsx("a",{href:e.termsOfService,target:"_blank",rel:"noreferrer",children:t("openapi.info.termsOfService","Terms of Service")}),actions:[_jsx(NewTabButton,{data:e.termsOfService},e.termsOfService)]})||null;return _jsx(_Fragment,{children:_jsxs(PanelItemsList,{children:[n,a,r,i]})})}
|
|
2
2
|
//# sourceMappingURL=Overview.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{ExampleValue}from"./ExampleValue";import{ExternalExample}from"./ExternalExample";export function Example({example:e,mimeType:l,onCopyClick:a}){return void 0===e.value&&e.externalValueUrl?e.externalValueUrl.endsWith(".pdf")?_jsx(ExampleValue,{value:"PDF file",mimeType:l,encoding:e.encoding,onCopyClick:a}):_jsx(ExternalExample,{example:e,mimeType:l,onCopyClick:a}):_jsx(ExampleValue,{value:e.value,mimeType:l,encoding:e.encoding,onCopyClick:a})}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{ExampleValue}from"./ExampleValue";import{ExternalExample}from"./ExternalExample";import{useTranslate}from"../../hooks";export function Example({example:e,mimeType:l,onCopyClick:a}){const m=useTranslate();return void 0===e.value&&e.externalValueUrl?e.externalValueUrl.endsWith(".pdf")?_jsx(ExampleValue,{value:m("openapi.pdfFileSample","PDF file"),mimeType:l,encoding:e.encoding,onCopyClick:a}):_jsx(ExternalExample,{example:e,mimeType:l,onCopyClick:a}):_jsx(ExampleValue,{value:e.value,mimeType:l,encoding:e.encoding,onCopyClick:a})}
|
|
2
2
|
//# sourceMappingURL=Example.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import merge from"deepmerge";import styled from"styled-components";import{Markdown}from"../Markdown";import{Example}from"./Example";import{ExampleSwitch,useExampleKey}from"../Samples";import{arrayMergeStrategy}from"../../services/utils";import{StyledCodeBlock}from"./styled";function MediaTypeSamplesComponent({mediaType:e,properties:r,onChange:a,onCopyClick:
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import merge from"deepmerge";import styled from"styled-components";import{Markdown}from"../Markdown";import{Example}from"./Example";import{ExampleSwitch,useExampleKey}from"../Samples";import{arrayMergeStrategy}from"../../services/utils";import{StyledCodeBlock}from"./styled";import{useTranslate}from"../../hooks";function MediaTypeSamplesComponent({mediaType:e,properties:r,onChange:a,onCopyClick:o}){const m=e.examples||e.formExamples||{},s=e.name,t=Object.keys(m),p=useTranslate(),{exampleKey:n}=useExampleKey(e.operation,m),l=1===t.length?Object.values(m)[0]:m[n];if(!t.length)return _jsx(StyledCodeBlock,{lang:"clike",source:p("openapi.noResponseExample","No response example"),header:{controls:!1}});const i=r?Object.assign(Object.assign({},l),{value:merge(l.value,r,{arrayMerge:arrayMergeStrategy})}):l,c=i.description;return _jsxs(_Fragment,{children:[_jsx(ExampleSwitch,{examples:m,exampleKey:n,onChange:a}),c&&_jsx(StyledMarkdown,{source:c}),_jsx(Example,{example:i,mimeType:s,onCopyClick:o})]})}const StyledMarkdown=styled(Markdown)`
|
|
2
2
|
margin: 0 var(--spacing-md) var(--spacing-sm);
|
|
3
3
|
`;export const MediaTypeSamples=memo(MediaTypeSamplesComponent);
|
|
4
4
|
//# sourceMappingURL=MediaTypeSamples.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __rest=this&&this.__rest||function(e,t){var o={};for(var
|
|
1
|
+
var __rest=this&&this.__rest||function(e,t){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(o[a[r]]=e[a[r]])}return o};import{jsx as _jsx}from"react/jsx-runtime";import{memo,useCallback}from"react";import{useAtomValue}from"jotai";import{SelectOrLabel}from"../SelectOrLabel";import{MediaTypesSwitch}from"../MediaTypeSwitch";import{MimeLabel,Select}from"../common";import{MediaTypeSamples}from"./MediaTypeSamples";import{SelectWrapper,StyledCodeBlock}from"./styled";import{activeMimeNameAtom}from"../../jotai/app";import{useActivateExample,useTranslate}from"../../hooks";import{convertExamplesFormat}from"../../utils/convertExamplesFormat";function PayloadSamplesComponent(e){var{onlyDefaultMimeType:t,content:o}=e,a=__rest(e,["onlyDefaultMimeType","content"]);const r=useActivateExample(o),l=useAtomValue(activeMimeNameAtom),m=t&&l,s=useTranslate(),p=useCallback((e=>m?null:_jsx(SelectWrapper,{children:_jsx(SelectOrLabel,Object.assign({Label:MimeLabel,Select:Select,variant:"dark",fullWidth:!0},e))})),[m]),n=e=>r(e);return o?_jsx(MediaTypesSwitch,{content:o,renderSelect:p,children:e=>{const t=convertExamplesFormat(e);return _jsx(MediaTypeSamples,Object.assign({mediaType:t},a,{onChange:n}),"samples")}}):_jsx(StyledCodeBlock,{lang:"text",source:s("openapi.noRequestPayload","No request payload"),header:{controls:!1}})}export const PayloadSamples=memo(PayloadSamplesComponent);
|
|
2
2
|
//# sourceMappingURL=PayloadSamples.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { DescriptionEnumsProps } from './types';
|
|
3
|
-
export declare function DescriptionEnumsComponent({ enums, toggle, showToggleButton, toggleButtonText, type, }: DescriptionEnumsProps): ReactElement;
|
|
3
|
+
export declare function DescriptionEnumsComponent({ enums, toggle, showToggleButton, toggleButtonText, type, translate, }: DescriptionEnumsProps): ReactElement;
|
|
4
4
|
export declare const DescriptionEnums: import("react").NamedExoticComponent<DescriptionEnumsProps>;
|
|
@@ -6,5 +6,5 @@ import{jsxs as _jsxs,jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";i
|
|
|
6
6
|
p:only-of-type {
|
|
7
7
|
margin: 0;
|
|
8
8
|
}
|
|
9
|
-
`;export function DescriptionEnumsComponent({enums:e,toggle:t,showToggleButton:n,toggleButtonText:o,type:r}){return _jsx(_Fragment,{children:_jsx(DescriptionEnumsBlock,{children:_jsxs("table",{className:"md",children:[_jsx("thead",{children:_jsxs("tr",{children:[_jsxs("th",{style:{width:"30%"},children:["array"===r
|
|
9
|
+
`;export function DescriptionEnumsComponent({enums:e,toggle:t,showToggleButton:n,toggleButtonText:o,type:s,translate:r}){return _jsx(_Fragment,{children:_jsx(DescriptionEnumsBlock,{children:_jsxs("table",{className:"md",children:[_jsx("thead",{children:_jsxs("tr",{children:[_jsxs("th",{style:{width:"30%"},children:["array"===s?r("openapi.items","Items"):""," ",1===e.length?r("openapi.value","Value"):`${r("openapi.enum","Enum")} ${r("openapi.value","Value")}`]}),_jsx("th",{children:r("openapi.description","Description")})]})}),_jsx("tbody",{children:e.map((({description:e,value:t})=>_jsxs("tr",{children:[_jsx(EnumValueStyled,{children:t}),_jsx(DescriptionValueStyled,{children:_jsx(Markdown,{source:e})})]},t)))}),n?_jsx("tfoot",{children:_jsx("tr",{children:_jsx("td",{colSpan:2,children:_jsx(ToggleButton,{onClick:t,children:o})})})}):null]})})})}export const DescriptionEnums=memo(DescriptionEnumsComponent);
|
|
10
10
|
//# sourceMappingURL=DescriptionEnums.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useState,memo,useCallback,useMemo}from"react";import{useAtomValue}from"jotai";import{SimpleEnums}from"./SimpleEnums";import{DescriptionEnums}from"./DescriptionEnums";import{globalOptionsAtom}from"../../jotai/store";function getEnums(e){return Array.isArray(e)&&e||Object.entries(e||{}).map((([e,t])=>({value:e,description:t})))}function EnumValuesComponent({values:e,type:t}){const
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useState,memo,useCallback,useMemo}from"react";import{useAtomValue}from"jotai";import{SimpleEnums}from"./SimpleEnums";import{DescriptionEnums}from"./DescriptionEnums";import{globalOptionsAtom}from"../../jotai/store";import{useTranslate}from"../../hooks";function getEnums(e){return Array.isArray(e)&&e||Object.entries(e||{}).map((([e,t])=>({value:e,description:t})))}function EnumValuesComponent({values:e,type:t}){const o=useTranslate(),[s,n]=useState(!0),{maxDisplayedEnumValues:m}=useAtomValue(globalOptionsAtom),r=useCallback((()=>{n(!s)}),[s]),a=!Array.isArray(e),u=getEnums(e),i=useMemo((()=>s&&m?u.slice(0,m):u),[u,s,m]);if(!u.length)return null;const l=!!m&&u.length>m,p=m?s?`+${u.length-m} ${o("openapi.actions.more","more")}`:o("openapi.actions.hide","Hide"):"";return _jsx(_Fragment,{children:a?_jsx(DescriptionEnums,{enums:i,toggle:r,showToggleButton:l,toggleButtonText:p,type:t,translate:o}):_jsx(SimpleEnums,{enums:i,type:t,toggle:r,toggleButtonText:p,showToggleButton:l,translate:o})})}export const EnumValues=memo(EnumValuesComponent);
|
|
2
2
|
//# sourceMappingURL=EnumValues.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsxs as _jsxs,jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{ExampleValue,FieldLabel}from"../common";import{normalizeText,serializeParameterValue}from"../../utils";import{ExampleWrap,ExamplesList,ExampleSummary,ExampleDescription}from"./styled";import{useTranslate}from"../../hooks";export function Examples({field:e}){const a=useTranslate();return e.examples?_jsxs(_Fragment,{children:[_jsxs(FieldLabel,{children:[" ",a("openapi.examples","Examples"),": "]}),_jsx(ExamplesList,{children:Object.entries(e.examples).map((([a,r])=>{const l=normalizeText(r.description);return _jsxs(ExampleWrap,{children:[_jsxs(ExampleSummary,{children:[normalizeText(r.summary)||a," "]}),l&&_jsxs(ExampleDescription,{children:[l," "]}),_jsx(ExampleValue,{children:getSerializedValue(e,r.value)})]},a)}))})]}):null}export function getSerializedValue(e,a){return e.in?decodeURIComponent(serializeParameterValue(e,a)):a}
|
|
2
2
|
//# sourceMappingURL=Examples.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{FieldLabel,DefaultValue,FieldValueLabel,ExpandableExample}from"../common";function FieldDetailComponent({value:e,label:l,raw:a}){if(void 0===e)return null;const
|
|
1
|
+
import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{FieldLabel,DefaultValue,FieldValueLabel,ExpandableExample}from"../common";function FieldDetailComponent({value:e,label:l,raw:a,type:i="other"}){if(void 0===e)return null;const r=a?String(e):JSON.stringify(e);return _jsxs(Wrapper,{children:[_jsxs(FieldLabel,{children:[" ",l," "]}),"default"===i?_jsx(DefaultValue,{children:r}):"example"===i?_jsx(ExpandableExample,{value:r}):_jsx(FieldValueLabel,{children:r})]})}export const FieldDetail=memo(FieldDetailComponent);const Wrapper=styled.div`
|
|
2
2
|
margin-top: var(--spacing-xxs);
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: baseline;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useMemo}from"react";import{useAtomValue}from"jotai";import styled from"styled-components";import{LinkIcon}from"@redocly/theme";import{RecursiveLabel,Tag,AccessLabel,RequiredLabel,StyledBadge}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown}from"../Markdown";import{FieldDetail}from"./FieldDetail";import{Extensions}from"./Extensions";import{EnumValues}from"./EnumValues";import{Examples,getSerializedValue}from"./Examples";import{globalOptionsAtom}from"../../jotai/store";import{SchemaTypeInfo}from"./SchemaTypeInfo";import{LinkToField}from"../common/LinkToField";import{Pattern}from"./Pattern";import{getAccessModeLabelText}from"../RenderHook";function FieldDetailsComponent({field:e,renderDiscriminatorSwitch:
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useMemo}from"react";import{useAtomValue}from"jotai";import styled from"styled-components";import{LinkIcon}from"@redocly/theme";import{RecursiveLabel,Tag,AccessLabel,RequiredLabel,StyledBadge}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown}from"../Markdown";import{FieldDetail}from"./FieldDetail";import{Extensions}from"./Extensions";import{EnumValues}from"./EnumValues";import{Examples,getSerializedValue}from"./Examples";import{globalOptionsAtom}from"../../jotai/store";import{SchemaTypeInfo}from"./SchemaTypeInfo";import{LinkToField}from"../common/LinkToField";import{Pattern}from"./Pattern";import{getAccessModeLabelText}from"../RenderHook";import{useTranslate}from"../../hooks";function FieldDetailsComponent({field:e,renderDiscriminatorSwitch:a,deepLink:t,fieldParentsName:i=[]}){var o;const r=useTranslate(),{hidePropertiesPrefix:s,hideSchemaTitles:n}=useAtomValue(globalOptionsAtom),{schema:l,description:p,example:m,deprecated:d,examples:c,kind:x,required:f,name:u}=e,h="header"===e.in,y=useMemo((()=>{if(void 0!==m||void 0!==c){if(void 0!==c)return _jsx(Examples,{field:e});{const a=!!e.in;return _jsx(FieldDetail,{label:`${r("openapi.example","Example")}:`,value:getSerializedValue(e,e.example),raw:a})}}return null}),[m,c,e,r]),v=getAccessModeLabelText(e.schema);return _jsxs(_Fragment,{children:[_jsxs(Row,{children:[u&&_jsxs(Name,{children:[t&&_jsx(LinkToField,{to:t}),!s&&i.map((e=>e+".")),_jsx(SchemaName,{className:"schema-name",children:u})]}),_jsx(SchemaTypeInfo,{type:l.typePrefix+l.displayType}),_jsx(SchemaTypeInfo,{type:l.displayFormat&&`(${l.displayFormat})`}),_jsx(SchemaTypeInfo,{type:l.contentEncoding}),_jsx(SchemaTypeInfo,{type:l.title&&!n?`(${l.title})`:""}),null===(o=l.constraints)||void 0===o?void 0:o.map((e=>_jsx(SchemaTypeInfo,{type:e},e))),d&&_jsx(StyledBadge,{deprecated:!0,children:r("openapi.badges.deprecated","Deprecated")}),_jsx(Pattern,{pattern:l.pattern}),"additionalProperties"===x&&_jsx(Tag,{children:r("openapi.additionalProperties","additional property")}),"patternProperties"===x&&_jsx(Tag,{children:r("openapi.patternProperties","pattern property")}),v&&_jsx(AccessLabel,{children:v}),f&&_jsx(RequiredLabel,{children:r("openapi.required","required")}),l.isCircular&&_jsx(RecursiveLabel,{children:r("openapi.recursive","Recursive")})]}),_jsx(StyledDescription,{source:p}),_jsx(FieldDetail,{raw:h,type:"default",label:r("openapi.default","Default"),value:l.default}),_jsx(EnumValues,{type:l.type,values:l["x-enumDescriptions"]||l.enum}),y,_jsx(Extensions,{extensions:Object.assign(Object.assign({},e.extensions),l.extensions)}),l.externalDocs&&_jsx(ExternalDocumentation,{externalDocs:l.externalDocs,compact:!0}),null==a?void 0:a(),_jsx(FieldDetail,{label:r("openapi.value","Value"),value:e.const||void 0})]})}export const FieldDetails=memo(FieldDetailsComponent);const Row=styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: calc(var(--spacing-xxs) / 4) var(--spacing-xxs);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{useState}from"react";import{Tag,ToggleButton}from"../common";const MAX_PATTERN_LENGTH=45;export function Pattern({pattern:t}){const
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{useState}from"react";import{Tag,ToggleButton}from"../common";import{useTranslate}from"../../hooks";const MAX_PATTERN_LENGTH=45;export function Pattern({pattern:t}){const e=useTranslate(),[n,r]=useState(!1);if(!t)return null;return _jsxs(_Fragment,{children:[_jsx(Tag,{children:n||t.length<MAX_PATTERN_LENGTH?t:`${t.slice(0,MAX_PATTERN_LENGTH)}...`}),t.length>MAX_PATTERN_LENGTH&&_jsx(ToggleButton,{onClick:()=>{r(!n)},children:n?e("openapi.hidePattern","Hide pattern"):e("openapi.showPattern","Show pattern")})]})}
|
|
2
2
|
//# sourceMappingURL=Pattern.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { SimpleEnumsProps } from './types';
|
|
3
|
-
export declare function SimpleEnumsComponent({ enums, type, toggle, showToggleButton, toggleButtonText, }: SimpleEnumsProps): ReactElement;
|
|
3
|
+
export declare function SimpleEnumsComponent({ enums, type, toggle, showToggleButton, toggleButtonText, translate, }: SimpleEnumsProps): ReactElement;
|
|
4
4
|
export declare const SimpleEnums: import("react").NamedExoticComponent<SimpleEnumsProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{FieldLabel,Tag,ToggleButton}from"../common";export function SimpleEnumsComponent({enums:e,type:
|
|
1
|
+
import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{FieldLabel,Tag,ToggleButton}from"../common";export function SimpleEnumsComponent({enums:e,type:n,toggle:o,showToggleButton:t,toggleButtonText:s,translate:m}){return _jsxs(Row,{children:[_jsxs(FieldLabel,{children:["array"===n?m("openapi.items","Items"):""," ",1===e.length?m("openapi.value","Value"):m("openapi.enum","Enum")]}),e.map(((e,n)=>_jsx(Tag,{children:JSON.stringify(e)},e+n))),t?_jsx(ToggleButton,{onClick:o,children:s}):null]})}export const SimpleEnums=memo(SimpleEnumsComponent);const Row=styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-wrap: wrap;
|
|
4
4
|
align-items: center;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TFunction } from '@redocly/theme';
|
|
1
2
|
import type { ReactElement } from 'react';
|
|
2
3
|
import type { SchemaOptions } from '../Schema';
|
|
3
4
|
import type { FieldModel } from '../../models';
|
|
@@ -13,6 +14,7 @@ export interface SimpleEnumsProps {
|
|
|
13
14
|
showToggleButton: boolean;
|
|
14
15
|
toggleButtonText: string;
|
|
15
16
|
type: string | string[];
|
|
17
|
+
translate: TFunction;
|
|
16
18
|
}
|
|
17
19
|
export type DescriptionEnumProp = Array<{
|
|
18
20
|
value: string;
|
|
@@ -24,6 +26,7 @@ export interface DescriptionEnumsProps {
|
|
|
24
26
|
showToggleButton: boolean;
|
|
25
27
|
toggleButtonText: string;
|
|
26
28
|
type: string | string[];
|
|
29
|
+
translate: TFunction;
|
|
27
30
|
}
|
|
28
31
|
export interface ExtensionsProps {
|
|
29
32
|
extensions: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,r,t){return new(r||(r=Promise))((function(n,a){function i(e){try{l(t.next(e))}catch(e){a(e)}}function p(e){try{l(t.throw(e))}catch(e){a(e)}}function l(e){var o;e.done?n(e.value):(o=e.value,o instanceof r?o:new r((function(e){e(o)}))).then(i,p)}l((t=t.apply(e,o||[])).next())}))};import{jsx as _jsx}from"react/jsx-runtime";import{Suspense,memo,useEffect,useState,lazy}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{convertOperationToReplayValue}from"./utils";import{globalOptionsAtom}from"../../jotai/store";import{operationStore}from"../../jotai/operation";import{appStore,environmentsAtom}from"../../jotai/app";const EmbeddedReplayOrig=lazy((()=>__awaiter(void 0,void 0,void 0,(function*(){return import("@redocly/replay").then((e=>({default:e.EmbeddedReplay})))}))));function EmbeddedReplayComponent({operation:e,corsProxyUrl:o,fullOpenApi:r}){const{routingBasePath:
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,r,t){return new(r||(r=Promise))((function(n,a){function i(e){try{l(t.next(e))}catch(e){a(e)}}function p(e){try{l(t.throw(e))}catch(e){a(e)}}function l(e){var o;e.done?n(e.value):(o=e.value,o instanceof r?o:new r((function(e){e(o)}))).then(i,p)}l((t=t.apply(e,o||[])).next())}))};import{jsx as _jsx}from"react/jsx-runtime";import{Suspense,memo,useEffect,useState,lazy}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{convertOperationToReplayValue}from"./utils";import{globalOptionsAtom}from"../../jotai/store";import{operationStore}from"../../jotai/operation";import{appStore,environmentsAtom}from"../../jotai/app";import{useTranslate}from"../../hooks";const EmbeddedReplayOrig=lazy((()=>__awaiter(void 0,void 0,void 0,(function*(){return import("@redocly/replay").then((e=>({default:e.EmbeddedReplay})))}))));function EmbeddedReplayComponent({operation:e,corsProxyUrl:o,fullOpenApi:r}){const t=useTranslate(),{routingBasePath:n,mockServer:a}=useAtomValue(globalOptionsAtom),i=useAtomValue(operationStore(e.pointer)),p=useAtomValue(appStore),l=useAtomValue(environmentsAtom),[s,d]=useState(!1);return useEffect((()=>{d(!0)}),[]),_jsx(CompactWrapper,{children:s?_jsx(Suspense,{fallback:_jsx(LoadingWrapper,{children:t("openapi.loading","Loading...")}),children:_jsx(EmbeddedReplayOrig,{value:convertOperationToReplayValue(e,r,i,p),environment:p.environment,predefinedEnvValues:l,corsProxyUrl:o,operationUrl:n+e.href,mockServer:a,disableCollectionsTab:!0})}):_jsx(LoadingWrapper,{children:t("openapi.loading","Loading...")})})}export const EmbeddedReplay=memo(EmbeddedReplayComponent);const LoadingWrapper=styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
align-items: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))((function(n
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))((function(a,n){function i(e){try{l(r.next(e))}catch(e){n(e)}}function s(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var o;e.done?a(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(i,s)}l((r=r.apply(e,o||[])).next())}))};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Suspense,memo,useCallback,useState,useRef,lazy}from"react";import{Button,RocketIcon,CircleDashIcon,Portal,useFocusTrap,useModalScrollLock}from"@redocly/theme";import styled from"styled-components";import{useAtom,useAtomValue,useSetAtom}from"jotai";const ReplayOverlay=lazy((()=>__awaiter(void 0,void 0,void 0,(function*(){return import("@redocly/replay").then((e=>({default:e.ReplayOverlay})))}))));import{globalOptionsAtom,globalStoreAtom}from"../../jotai/store";import{replayStateAtom}from"../../jotai/replay";import{operationStore}from"../../jotai/operation";import{LOADING_STATE}from"../../constants";import{activeMimeNameAtom,unsupportedFeatureScreenAtom,environmentAtom}from"../../jotai/app";import{isMobile}from"../../utils";import{convertOperationToReplayValue}from"./utils";import{useTranslate}from"../../hooks";function ReplayComponent({operation:e,corsProxyUrl:o,fullOpenApi:t}){var r,a;const n=useTranslate(),i=useRef(null),{routingBasePath:s,mockServer:l,oAuth2RedirectURI:m}=useAtomValue(globalOptionsAtom),{parser:c}=useAtomValue(globalStoreAtom),[p,u]=useState(!1),[d,A]=useAtom(replayStateAtom),[,v]=useAtom(unsupportedFeatureScreenAtom),f=useSetAtom(operationStore(e.pointer)),[y,S]=useAtom(activeMimeNameAtom),[[,O],_]=useAtom(environmentAtom);useFocusTrap(i),useModalScrollLock(p);const h=useCallback((({requestValues:e,activeExampleName:o,activeMimeName:t,environment:r,environments:a,activeSecuritySchemeIds:n})=>{f((t=>Object.assign(Object.assign({},t),{requestValues:e,activeExampleName:o,activeSecuritySchemeIds:n}))),S(t||y),_({environment:r,environments:a})}),[f,S,y,_]),x=()=>{isMobile({tablet:!0})?v(!0):(d!==LOADING_STATE.LOADING&&u(!p),d===LOADING_STATE.NOT_LOADED&&A(LOADING_STATE.LOADING))};return _jsxs(Wrapper,{children:[_jsx(Button,{onClick:x,variant:"primary",iconPosition:"left",icon:d===LOADING_STATE.LOADING?_jsx(CircleDashIcon,{}):_jsx(RocketIcon,{}),children:d===LOADING_STATE.LOADING?n("openapi.loading","Loading..."):n("openapi.tryIt","Try it")}),p&&_jsx(Suspense,{children:_jsx(Portal,{mountId:"api-content",children:_jsx("div",{ref:i,children:_jsx(ReplayOverlay,{value:convertOperationToReplayValue(e,t),onRequestChange:h,onClose:x,corsProxyUrl:o,operationUrl:s+e.href,onLoad:()=>A(LOADING_STATE.LOADED),mockServer:l,environment:O,apiId:null===(a=null===(r=null==c?void 0:c.definition.info)||void 0===r?void 0:r["x-metadata"])||void 0===a?void 0:a.apiId,oAuth2RedirectURI:m,definitionUrl:null==c?void 0:c.definitionUrl,disableCollectionsTab:!0})})})})]})}export const Replay=memo(ReplayComponent);const Wrapper=styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: flex-end;
|
|
4
4
|
border-top: var(--panel-border);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{Row}from"../common";import{Title}from"../common/OperationItemTitle";import{LinkToField}from"../common/LinkToField";import{makeDeepLink}from"../../services";import{Description}from"../OperationItem/Description";import{Security}from"../Security";import{ExpandAllButton,useUpdateExpandedFields}from"../ExpandAllButton";import{RequestParameters}from"../RequestParameters";function RequestDetailsComponent({operation:{id:e,description:t,externalDocs:o,parameters:r,requestBody:i,pointer:s,security:n,extensions:
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{Row}from"../common";import{Title}from"../common/OperationItemTitle";import{LinkToField}from"../common/LinkToField";import{makeDeepLink}from"../../services";import{Description}from"../OperationItem/Description";import{Security}from"../Security";import{ExpandAllButton,useUpdateExpandedFields}from"../ExpandAllButton";import{RequestParameters}from"../RequestParameters";function RequestDetailsComponent({operation:{id:e,description:t,externalDocs:o,parameters:r,requestBody:i,pointer:s,security:n,extensions:a,callbackId:m},title:p,translate:d}){return useUpdateExpandedFields("request",r,null==i?void 0:i.content,s),_jsxs(_Fragment,{children:[_jsx(Row,{children:_jsxs(HeadingWrapper,{children:[_jsxs(Title,{children:[e&&_jsx(LinkToField,{to:makeDeepLink(e,"request")}),p||(null==d?void 0:d("openapi.request","Request")),_jsx(ExpandAllButton,{operationPointer:s,type:"request"})]}),_jsx(Description,{description:t||o?t:void 0,externalDocs:o,extensions:a}),_jsx(Security,{securities:n})]})}),_jsx(RequestParameters,{parameters:r,body:i,operationId:e,callbackId:m})]})}const HeadingWrapper=styled.div`
|
|
2
2
|
width: 100%;
|
|
3
3
|
`;export const RequestDetails=memo(RequestDetailsComponent);
|
|
4
4
|
//# sourceMappingURL=RequestDetails.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { TFunction } from '@redocly/theme';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { OperationModel } from '../../models';
|
|
3
4
|
export interface RequestProps {
|
|
4
5
|
operation: Pick<OperationModel, 'security' | 'pointer' | 'description' | 'externalDocs' | 'extensions' | 'parameters' | 'requestBody' | 'id' | 'callbackId'>;
|
|
5
6
|
title?: string | ReactNode;
|
|
7
|
+
translate?: TFunction;
|
|
6
8
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{ParametersGroup}from"./ParametersGroup";import{Body}from"./Body";import{makeDeepLink}from"../../services";const PARAM_PLACES=["path","query","cookie","header"],
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{ParametersGroup}from"./ParametersGroup";import{Body}from"./Body";import{makeDeepLink}from"../../services";import{useTranslate}from"../../hooks";const PARAM_PLACES=["path","query","cookie","header"];export function RequestParameters({body:e,parameters:r=[],operationId:t,callbackId:n}){const a=useTranslate();if(!e&&!r.length)return null;const o={[PARAM_PLACES[0]]:a("openapi.path","Path"),[PARAM_PLACES[1]]:a("openapi.query","Query"),[PARAM_PLACES[2]]:a("openapi.cookie","Cookies"),[PARAM_PLACES[3]]:a("openapi.header","Headers")},s=(e=>{const r={};return e.forEach((e=>{safePush(r,e.in,e)})),r})(r),i=r.length>0?PARAM_PLACES:[],{content:p,description:u,required:m}=e||{};return _jsxs(_Fragment,{children:[i.map((e=>_jsx(ParametersGroup,{title:o[e],parameters:s[e],deepLink:generateDeepLink(t,n,e)},e))),p&&_jsx(Body,{content:p,description:u,required:m,deepLink:generateDeepLink(t,n)})]})}function safePush(e,r="",t){e[r]||(e[r]=[]),e[r].push(t)}function generateDeepLink(e,r,t="body"){return makeDeepLink(e,""+(r?`${r}/request/${t}`:`request/${t}`))}
|
|
2
2
|
//# sourceMappingURL=RequestParameters.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useAtomValue}from"jotai";import{getCodeSample}from"../../services";import{globalStoreAtom}from"../../jotai/store";import{operationStore}from"../../jotai/operation";import{environmentAtom,getLangKey,languageAtom}from"../../jotai/app";export function useCodeSamples({payload:e,isWebhook:a,definitionSamples:t,pointer:o}){var n;const{parser:r,options:{codeSamples:
|
|
1
|
+
import{useAtomValue}from"jotai";import{getCodeSample}from"../../services";import{globalStoreAtom}from"../../jotai/store";import{operationStore}from"../../jotai/operation";import{environmentAtom,getLangKey,languageAtom}from"../../jotai/app";import{useTranslate}from"../../hooks";export function useCodeSamples({payload:e,isWebhook:a,definitionSamples:t,pointer:o}){var n;const{parser:r,options:{codeSamples:s,generatedSamplesMaxDepth:l}}=useAtomValue(globalStoreAtom),i=useAtomValue(operationStore(o)),{languages:g}=useAtomValue(languageAtom),[m]=useAtomValue(environmentAtom),p=useTranslate(),u=new Map(null==g?void 0:g.map((({key:e,order:a})=>[e,a]))),d=t.filter((e=>u.has(getLangKey(e)))),c=new Set(d.map(getLangKey));let b=[];if(!a){b=createCodeSamples((null===(n=s.languages)||void 0===n?void 0:n.filter((({lang:e,label:a})=>"Payload"!==e&&!c.has(getLangKey({lang:e,label:a})))))||[],s,r.definition,l,i,m,p)}const f=[...d,...b];e&&u.has(e.lang.toLowerCase())&&f.push(Object.assign(Object.assign({},e),{order:u.get(e.lang.toLowerCase())}));const S=f.map((e=>{var a;const t=null!==(a=e.label)&&void 0!==a?a:e.lang;return Object.assign({key:getLangKey(e),title:t,order:"number"==typeof u.get(t.toLowerCase())?u.get(t.toLowerCase()):9999},e)})).sort(((e,a)=>e.order-a.order));return{samples:S}}function createCodeSamples(e,{skipOptionalParameters:a,withOAuth2Call:t},o,n,r,s,l){return e.map((({lang:e,label:i,options:g})=>({lang:e,label:i,get:i=>getCodeSample(Object.assign(Object.assign({},i),{lang:e,options:Object.assign(Object.assign({},g),{skipOptionalParameters:a,withOAuth2Call:t,spec:o,generatedPayloadSamplesMaxDepth:n,store:r}),environment:s,translate:l}))})))}
|
|
2
2
|
//# sourceMappingURL=useCodeSamples.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{PanelHeader,PanelHeaderTitle}from"@redocly/theme";export const Summary=({tabs:e})=>_jsxs(PanelHeader,{isExpandable:!1,children:[_jsx(PanelHeaderTitle,{"data-testid":"title",children:"Response"}),e]});
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{PanelHeader,PanelHeaderTitle}from"@redocly/theme";import{useTranslate}from"../../hooks";export const Summary=({tabs:e})=>{const s=useTranslate();return _jsxs(PanelHeader,{isExpandable:!1,children:[_jsx(PanelHeaderTitle,{"data-testid":"title",children:s("openapi.response","Response")}),e]})};
|
|
2
2
|
//# sourceMappingURL=Summary.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import{useLocation}from"react-router-dom";import styled from"styled-components";import{Tabs,useTabsState}from"../Tabs";import{ResponseDetails}from"./ResponseDetails";import{makeDeepLink}from"../../services";import{Row,StyledTitle}from"./styled";import{LinkToField}from"../common/LinkToField";import{pathIncludesLink}from"../../utils";import{ExpandAllButton}from"../ExpandAllButton";export const OperationResponseList=memo((({responses:e,renderTitle:o,operationId:
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo}from"react";import{useLocation}from"react-router-dom";import styled from"styled-components";import{Tabs,useTabsState}from"../Tabs";import{ResponseDetails}from"./ResponseDetails";import{makeDeepLink}from"../../services";import{Row,StyledTitle}from"./styled";import{LinkToField}from"../common/LinkToField";import{pathIncludesLink}from"../../utils";import{ExpandAllButton}from"../ExpandAllButton";import{useTranslate}from"../../hooks";export const OperationResponseList=memo((({responses:e,renderTitle:o,operationId:s,operationPointer:t,activeResponseTab:n,onTabChange:a,callbackId:r})=>{const i=useLocation(),p=useTranslate(),l=e.map((({code:e})=>({key:e,title:e}))),m=l.find((({key:e})=>e===n||pathIncludesLink(i,s)&&pathIncludesLink(i,`c=${e}`))),{activeTab:d,handleTabChange:c}=useTabsState({tabs:l,defaultTab:null==m?void 0:m.key,onChange:a}),u=l.find((e=>e.key===(n||d)));return u?_jsxs(_Fragment,{children:[_jsxs(TitleWrap,{children:[(null==o?void 0:o(u))||_jsxs(StyledTitle,{children:[_jsx(LinkToField,{to:makeDeepLink(s,`response&c=${u.key}`)}),p("openapi.responses","Responses")]}),_jsx(Tabs,{tabs:l,activeTab:u,onChange:c}),_jsx(ExpandAllButton,{type:"response",operationPointer:t})]}),e.map((e=>e.code===u.key?_jsx("div",{children:_jsx(ResponseDetails,{response:e,operationId:s,operationPointer:t,callbackId:r})},e.code):null))]}):null}));const TitleWrap=styled(Row)`
|
|
2
2
|
flex-wrap: wrap;
|
|
3
3
|
gap: var(--spacing-unit);
|
|
4
4
|
`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{HeadersCaption,StyledHeadersProperties}from"./styled";import{PropertyDetails}from"../PropertyDetails";import{LinkToField}from"../common/LinkToField";function ResponseHeadersComponent({headers:e,deepLink:s}){return void 0===e||0===e.length?null:_jsxs(StyledHeadersProperties,{children:[_jsxs(HeadersCaption,{children:[s&&_jsx(LinkToField,{to:s}),"Headers"]}),e.map(((e,r)=>_jsx(PropertyDetails,{isFirst:0===r,field:e,disableDeepLinks:!s},e.name)))]})}export const ResponseHeaders=memo(ResponseHeadersComponent);
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{HeadersCaption,StyledHeadersProperties}from"./styled";import{PropertyDetails}from"../PropertyDetails";import{LinkToField}from"../common/LinkToField";import{useTranslate}from"../../hooks";function ResponseHeadersComponent({headers:e,deepLink:s}){const r=useTranslate();return void 0===e||0===e.length?null:_jsxs(StyledHeadersProperties,{children:[_jsxs(HeadersCaption,{children:[s&&_jsx(LinkToField,{to:s}),r("openapi.header","Headers")]}),e.map(((e,r)=>_jsx(PropertyDetails,{isFirst:0===r,field:e,disableDeepLinks:!s},e.name)))]})}export const ResponseHeaders=memo(ResponseHeadersComponent);
|
|
2
2
|
//# sourceMappingURL=ResponseHeaders.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{Markdown as MarkdownWrapper,Panel}from"@redocly/theme";import{useAtomValue}from"jotai";import{DownloadSpecification}from"../Download";import{Overview}from"../Overview";import{LanguageList}from"../Language";import{ServerList}from"../ServerList";import{globalStoreAtom}from"../../jotai/store";import{normalizeServers}from"../../utils";import{mergeInMockServer}from"../../models/operation";import{languageAtom}from"../../jotai/app";export const RightPanel=({item:{infoDefinition:e}})=>{const{options:{hideDownloadButtons:r,mockServer:
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{Markdown as MarkdownWrapper,Panel}from"@redocly/theme";import{useAtomValue}from"jotai";import{DownloadSpecification}from"../Download";import{Overview}from"../Overview";import{LanguageList}from"../Language";import{ServerList}from"../ServerList";import{globalStoreAtom}from"../../jotai/store";import{normalizeServers}from"../../utils";import{mergeInMockServer}from"../../models/operation";import{languageAtom}from"../../jotai/app";import{useTranslate}from"../../hooks";export const RightPanel=({item:{infoDefinition:e}})=>{const a=useTranslate(),{options:{hideDownloadButtons:r,mockServer:o},parser:{definition:n,definitionUrl:i}}=useAtomValue(globalStoreAtom),{languages:s,activeLanguage:t}=useAtomValue(languageAtom),l=normalizeServers(i,mergeInMockServer(n.servers||[],o));return _jsxs(_Fragment,{children:[!r&&_jsx(Panel,{className:"panel-download",header:a("openapi.download.description.title","Download OpenAPI description"),isExpandable:!1,children:_jsx(DownloadSpecification,{})}),((null==e?void 0:e.license)||(null==e?void 0:e.contact)||(null==e?void 0:e.termsOfService))&&_jsx(Panel,{className:"panel-overview",header:a("openapi.info.title","Overview"),isExpandable:!1,children:_jsx(MarkdownWrapper,{children:_jsx(Overview,{info:e,translate:a})})}),!!(null==s?void 0:s.length)&&_jsx(Panel,{className:"panel-language-list",header:a("openapi.languages.title","Languages"),isExpandable:!1,children:_jsx(LanguageList,{languages:s,activeLanguage:t})}),!!l.length&&_jsx(Panel,{className:"panel-servers-list",header:a("openapi.servers.title","Servers"),isExpandable:!1,children:_jsx(ServerList,{servers:l,path:"/",translate:a})})]})};
|
|
2
2
|
//# sourceMappingURL=RightPanel.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{useAtomValue}from"jotai";import{PropertiesTableCaption}from"../common";import{Discriminator}from"../Discriminator";import{globalOptionsAtom}from"../../jotai/store";import{PropertyDetails}from"../PropertyDetails";import{SubSchema}from"./SubSchema";import{getExpandByDefault}from"./helpers";function ObjectSchemaComponent({schema:e,showTitle:
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{useAtomValue}from"jotai";import{PropertiesTableCaption}from"../common";import{Discriminator}from"../Discriminator";import{globalOptionsAtom}from"../../jotai/store";import{PropertyDetails}from"../PropertyDetails";import{SubSchema}from"./SubSchema";import{getExpandByDefault}from"./helpers";import{useTranslate}from"../../hooks";function ObjectSchemaComponent({schema:e,showTitle:t,discriminator:r,level:i,skipWriteOnly:a,skipReadOnly:o,fieldParentsName:n,expandable:s,deepLink:m,required:l,disableDeepLinks:p,oneOfLevel:c}){const{fields:d=[],title:h}=e,f=useTranslate(),{schemasExpansionLevel:u}=useAtomValue(globalOptionsAtom),x=o||a?d.filter((e=>!(o&&e.schema.readOnly||a&&e.schema.writeOnly))):d,O=getExpandByDefault({required:l,level:i,schemasExpansionLevel:u});return _jsx(SubSchema,{expandable:s,expandByDefault:O,level:i,propertyLength:x.length,deepLink:m,operationPointer:e.operationPointer,children:_jsxs(_Fragment,{children:[t&&_jsx(PropertiesTableCaption,{children:h}),x.map(((e,s)=>_jsx(PropertyDetails,{isFirst:0===s,field:e,fieldParentsName:Number(i)>1?n:[],renderDiscriminatorSwitch:(null==r?void 0:r.fieldName)===e.name&&(null==r?void 0:r.parentSchema)?()=>_jsx(Discriminator,{parent:r.parentSchema,onChange:null==r?void 0:r.onChange,activeOneOfIdx:r.activeOneOfIdx,translate:f}):void 0,skipReadOnly:o,skipWriteOnly:a,showTitle:t,level:i,disableDeepLinks:p,oneOfLevel:c},e.name)))]})})}export const ObjectSchema=memo(ObjectSchemaComponent);
|
|
2
2
|
//# sourceMappingURL=ObjectSchema.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __rest=this&&this.__rest||function(e,t){var o={};for(var
|
|
1
|
+
var __rest=this&&this.__rest||function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o};import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import{useAtom}from"jotai";import styled from"styled-components";import{StyledBadge,SelectionTitle}from"../common";import{Markdown}from"../Markdown";import{ConstraintsView}from"../common/ConstraintsView";import{Schema}from"./Schema";import{operationStore}from"../../jotai/operation";import{SchemaSelection}from"../common/SchemaSelection";import{useOneOfLocationIdx}from"./useOneOfLocationIdx";import{useTranslate}from"../../hooks";function OneOfSchemaComponent(e){var{schema:{oneOf:t},schema:o,oneOfLevel:r=1}=e,n=__rest(e,["schema","schema","oneOfLevel"]);const i=useTranslate(),[s]=useAtom(operationStore(o.operationPointer)),a=useOneOfLocationIdx(t,r),c=-1===a?0:a,m=t[void 0!==s.activeOneOf[o.pointer]?s.activeOneOf[o.pointer]:c];if(!m)return null;const p=t.map(((e,t)=>({label:e.title||e.typePrefix+e.displayType,value:t})));return _jsxs(Wrapper,{children:[_jsxs(SelectionTitle,{children:[o.oneOfType,":"]}),_jsx(SchemaSelection,{options:p,pointer:o.operationPointer,schema:o,defaultOneOfIdx:c}),m.deprecated&&_jsx(StyledBadge,{deprecated:!0,children:i("openapi.badges.deprecated","Deprecated")}),m.description&&_jsx(StyledDescription,{source:m.description}),_jsx(ConstraintsView,{constraints:m.constraints}),_jsx(Schema,Object.assign({},n,{schema:m,oneOfLevel:r+1}))]})}export const OneOfSchema=memo(OneOfSchemaComponent);const StyledDescription=styled(Markdown)`
|
|
2
2
|
margin-top: var(--spacing-xs);
|
|
3
3
|
font-size: var(--font-size-base);
|
|
4
4
|
line-height: var(--line-height-base);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{RecursiveLabel,TypeName,TypeTitle}from"../common";function RecursiveSchemaComponent({schema:e}){return _jsxs("div",{children:[_jsx(TypeName,{children:e.displayType}),e.title&&_jsxs(TypeTitle,{children:[" ",e.title," "]}),
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{RecursiveLabel,TypeName,TypeTitle}from"../common";import{useTranslate}from"../../hooks";function RecursiveSchemaComponent({schema:e}){const s=useTranslate();return _jsxs("div",{children:[_jsx(TypeName,{children:e.displayType}),e.title&&_jsxs(TypeTitle,{children:[" ",e.title," "]}),_jsxs(RecursiveLabel,{children:[" ",s("openapi.recursive","Recursive")," "]})]})}export const RecursiveSchema=memo(RecursiveSchemaComponent);
|
|
2
2
|
//# sourceMappingURL=RecursiveSchema.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import{useLocation}from"react-router-dom";import{useAtom}from"jotai/index";import{useMount}from"@redocly/theme";import{pathIncludesLink}from"../../utils";import{operationStore}from"../../jotai/operation";import{extractTypeFromDeepLink}from"./helpers";import{ViewNested}from"../ViewNested";function SubSchemaComponent({expandByDefault:e,deepLink:o,level:t,expandable:r=!1,isArray:n="",propertyLength:
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import{useLocation}from"react-router-dom";import{useAtom}from"jotai/index";import{useMount}from"@redocly/theme";import{pathIncludesLink}from"../../utils";import{operationStore}from"../../jotai/operation";import{extractTypeFromDeepLink}from"./helpers";import{ViewNested}from"../ViewNested";import{useTranslate}from"../../hooks";function SubSchemaComponent({expandByDefault:e,deepLink:o,level:t,expandable:r=!1,isArray:n="",propertyLength:a="",children:i,operationPointer:p}){var s;const m=useTranslate(),d=useLocation(),u=pathIncludesLink(d,o),c=extractTypeFromDeepLink(o),[l,x]=useAtom(operationStore(p)),h=null===(s=l[c])||void 0===s?void 0:s.expandedFields[o||""],f=e=>{c&&o&&x((t=>{var r;return Object.assign(Object.assign({},t),{[c]:{expandedFields:Object.assign(Object.assign({},(null===(r=t[c])||void 0===r?void 0:r.expandedFields)||{}),{[o]:e})}})}))};useMount((()=>{r&&(e||u)&&f(!0)}));const b=`${m("openapi.actions.show","Show")} ${1===Number(a)?"":a} ${n&&"array "}${1!==a?"properties":"property"}`;return _jsx(ViewNested,{expandByDefault:e||u,isExpandedFromParent:h,level:t,expandable:r,onChange:()=>{f(!h)},expandText:b,children:i})}export const SubSchema=memo(SubSchemaComponent);
|
|
2
2
|
//# sourceMappingURL=SubSchema.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SchemaProps } from './types';
|
|
2
2
|
export declare const extractTypeFromDeepLink: (str?: string) => string;
|
|
3
|
-
export declare function getExpandByDefault(
|
|
3
|
+
export declare function getExpandByDefault({ schemasExpansionLevel, level, required, }: Pick<SchemaProps, 'level' | 'required'> & {
|
|
4
4
|
schemasExpansionLevel?: number;
|
|
5
5
|
}): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const extractTypeFromDeepLink=e=>{if(!e)return"";const
|
|
1
|
+
import{isUndefined}from"@redocly/theme";export const extractTypeFromDeepLink=e=>{if(!e)return"";const n=e.match(/t=(request|response)/);return n?n[1]:""};const DEFAULT_REQUIRE_EXPAND_LEVEL=4;export function getExpandByDefault({schemasExpansionLevel:e,level:n,required:t}){const r=Number(n)-1;return isUndefined(e)?Boolean(t)&&DEFAULT_REQUIRE_EXPAND_LEVEL>=r:e>=r}
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{Markdown}from"../Markdown";import{SecuritySchemeItem}from"./SecuritySchemeItem";import{StyledLink,Tag}from"./styled";function OAuthFlowComponent({flow:e}){const
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import styled from"styled-components";import{Markdown}from"../Markdown";import{SecuritySchemeItem}from"./SecuritySchemeItem";import{StyledLink,Tag}from"./styled";import{useTranslate}from"../../hooks";function OAuthFlowComponent({flow:e}){const r=Object.keys((null==e?void 0:e.scopes)||{}),o=useTranslate();return _jsxs(_Fragment,{children:[_jsx(SecuritySchemeItem,{label:`${o("openapi.authorizationUrl","Authorization URL")}:`,value:(null==e?void 0:e.authorizationUrl)&&_jsx(StyledLink,{target:"_blank",rel:"noopener noreferrer",href:null==e?void 0:e.authorizationUrl,children:null==e?void 0:e.authorizationUrl})}),_jsx(SecuritySchemeItem,{label:`${o("openapi.tokenUrl","Token URL")}:`,value:null==e?void 0:e.tokenUrl}),_jsx(SecuritySchemeItem,{label:`${o("openapi.refreshUrl","Refresh URL")}:`,value:null==e?void 0:e.refreshUrl}),r.length&&_jsxs(_Fragment,{children:[_jsx(SecuritySchemeItem,{label:`${o("openapi.scopes","Scopes")}:`,value:" "}),r.map((r=>_jsx(SecuritySchemeItem,{label:_jsx(StyledTag,{className:"tag-grey",children:r}),value:_jsx(Markdown,{source:(null==e?void 0:e.scopes[r])||""})},r)))]})||null]})}const StyledTag=styled(Tag)`
|
|
2
2
|
margin-left: var(--spacing-xs);
|
|
3
3
|
`;export const OAuthFlow=memo(OAuthFlowComponent);
|
|
4
4
|
//# sourceMappingURL=OAuthFlow.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import styled from"styled-components";import{SecuritySchemeItem}from"./SecuritySchemeItem";import{titleize}from"../../utils";import{OAuthFlow}from"./OAuthFlow";import{StyledLink,Tag}from"./styled";import{Markdown}from"../Markdown";import{getRequiredScopes}from"./helper";export function SecurityFlow({type:e,bearerFormat:r,name:t,flows:a,openIdConnectUrl:
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import styled from"styled-components";import{SecuritySchemeItem}from"./SecuritySchemeItem";import{titleize}from"../../utils";import{OAuthFlow}from"./OAuthFlow";import{StyledLink,Tag}from"./styled";import{Markdown}from"../Markdown";import{getRequiredScopes}from"./helper";import{useTranslate}from"../../hooks";export function SecurityFlow({type:e,bearerFormat:r,name:t,flows:a,openIdConnectUrl:o,description:i,id:s,securities:n,in:l}){const m=useTranslate();if(!e||!s)return null;const c=getRequiredScopes(s,n),p={http:_jsxs(_Fragment,{children:[_jsx(SecuritySchemeItem,{label:m("openapi.httpAuthorizationScheme","HTTP Authorization Scheme"),value:e}),_jsx(SecuritySchemeItem,{label:m("openapi.bearerFormat","Bearer Format"),value:r})]}),apiKey:_jsx(SecuritySchemeItem,{label:`${titleize(l||"")} ${m("openapi.parameterName","parameter name")}:`,value:t}),oauth2:_jsxs(_Fragment,{children:[_jsx(SecuritySchemeItem,{label:m("openapi.flowType","Flow type"),value:e}),a&&Object.keys(a).map((e=>_jsx(OAuthFlow,{flow:a[e]},e)))]}),openIdConnect:_jsx(SecuritySchemeItem,{label:m("openapi.connectUrl","Connect URL"),value:o&&_jsx(StyledLink,{target:"_blank",rel:"noopener noreferrer",href:o,children:o})})};return _jsxs(Wrapper,{children:[_jsx(TitleSchema,{children:s}),_jsx(Markdown,{source:i}),_jsxs(List,{children:[p[e]||null,_jsx(SecuritySchemeItem,{label:m("openapi.requiredScopes","Required scopes"),value:c.length&&_jsx(Row,{children:c.map((e=>_jsx(Tag,{className:"tag-grey",children:e},e)))})})]})]})}const Wrapper=styled.div`
|
|
2
2
|
background: var(--layer-color);
|
|
3
3
|
padding: var(--spacing-base);
|
|
4
4
|
border-radius: var(--border-radius);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment,useState,useRef}from"react";import styled from"styled-components";import{useOutsideClick,Typography,CloseIcon,SecurityIcon,Segmented,Button,useFocusTrap}from"@redocly/theme";import{SecurityFlow}from"./SecurityFlow";import{Divider}from"./Divider";export function SecurityModal({securities:e,onClose:t}){const
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment,useState,useRef}from"react";import styled from"styled-components";import{useOutsideClick,Typography,CloseIcon,SecurityIcon,Segmented,Button,useFocusTrap}from"@redocly/theme";import{SecurityFlow}from"./SecurityFlow";import{Divider}from"./Divider";import{useTranslate}from"../../hooks";export function SecurityModal({securities:e,onClose:t}){const s=useTranslate(),[o,i]=useState(0),r=useRef(null),{schemes:a}=e[o]||{};useOutsideClick(r,t),useFocusTrap(r);const n=e.map((({schemes:e},t)=>({label:e.map((({id:e})=>e)).join(" and "),value:t})));return _jsx(StyledBackground,{children:_jsxs(Wrapper,{ref:r,tabIndex:0,children:[_jsx(Close,{onClick:t,"data-testid":"close",variant:"ghost",icon:_jsx(CloseIcon,{})}),_jsxs(Title,{children:[_jsx(SecurityIcon,{size:"24px"}),s("openapi.security","Security")]}),_jsx(Segmented,{value:o,onChange:({value:e})=>i(e),options:n}),a.map(((t,s)=>_jsxs(Fragment,{children:[_jsx(SecurityFlow,Object.assign({},t,{securities:e})),s!==a.length-1&&_jsx(Divider,{label:"and"})]},t.id)))]})})}const Wrapper=styled.div`
|
|
2
2
|
background: var(--bg-color);
|
|
3
3
|
box-shadow: var(--bg-raised-shadow);
|
|
4
4
|
border-radius: var(--border-radius-lg);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ServerListProps } from './types';
|
|
3
|
-
export declare const ServerList: ({ servers, path }: ServerListProps) => ReactElement;
|
|
3
|
+
export declare const ServerList: ({ servers, path, translate }: ServerListProps) => ReactElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{CopyButton}from"@redocly/theme";import styled from"styled-components";import{PanelItemDescription,Title}from"../PanelItem";import{ViewNested}from"../ViewNested";import{Tag}from"../common";import{Markdown}from"../Markdown";export const ServerList=({servers:e,path:r})=>_jsx(ItemsList,{children:e.map((e=>{const
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{CopyButton}from"@redocly/theme";import styled from"styled-components";import{PanelItemDescription,Title}from"../PanelItem";import{ViewNested}from"../ViewNested";import{Tag}from"../common";import{Markdown}from"../Markdown";export const ServerList=({servers:e,path:r,translate:i})=>_jsx(ItemsList,{children:e.map((e=>{const a=e.url+r,t=Object.keys(e.variables||{}).length,s=1===t?"variable":"variables",o=`${t||""} ${i(`openapi.${s}`,s)}`;return _jsxs("div",{children:[_jsx(PanelItemDescription,{children:e.description}),_jsxs(TitleWrap,{children:[_jsx(Title,{suppressHydrationWarning:!0,children:a}),_jsx(CopyButton,{data:a},a)]}),e.variables&&_jsx(ViewNested,{expandText:`${i("openapi.actions.show","Show")} ${o}`,hideText:`${i("openapi.actions.hide","Hide")} ${o}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:_jsx(ServerVariablesContainer,{children:Object.entries(e.variables||{}).map((([e,r])=>_jsxs(ServerVariableContainer,{children:[_jsx(ServerVariableName,{children:e}),_jsxs(Variable,{children:[i("openapi.default","Default")," ",_jsx(StyledTag,{children:r.default})]}),_jsx(Description,{source:r.description}),r.enum&&_jsxs(Variable,{children:[i("openapi.enum","Enum")," ",_jsx(TagWrapper,{children:r.enum.map((e=>_jsx(StyledTag,{children:e},e)))})]})]},e)))})})]},e.url)}))});const ItemsList=styled.div`
|
|
2
2
|
& > div {
|
|
3
3
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
4
4
|
margin-bottom: var(--spacing-xs);
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import type { TFunction } from '@redocly/theme';
|
|
1
2
|
import type { OperationModel } from '../../models';
|
|
2
|
-
export type ServerListProps = Pick<OperationModel, 'servers' | 'path'
|
|
3
|
+
export type ServerListProps = Pick<OperationModel, 'servers' | 'path'> & {
|
|
4
|
+
translate: TFunction;
|
|
5
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TFunction } from '@redocly/theme';
|
|
3
|
+
import type { OperationsNavigationProps } from './types';
|
|
4
|
+
type OperationNavigationItemsProps = OperationsNavigationProps & {
|
|
5
|
+
title: string;
|
|
6
|
+
onClick: (link: string) => void;
|
|
7
|
+
translate: TFunction;
|
|
8
|
+
};
|
|
9
|
+
export declare const OperationNavigationItems: import("react").NamedExoticComponent<OperationNavigationItemsProps>;
|
|
10
|
+
export {};
|