@redocly/reference-docs 2.30.0 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli/commands/redocly-docs-cli.min.js +102 -89
- package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +1 -1
- package/dist/console.redocly-reference-docs.min.js +141 -141
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-reference-docs.min.js +677 -664
- package/lib/components/Endpoint/Endpoint.js +1 -1
- package/lib/components/Endpoint/ServerList.d.ts +1 -1
- package/lib/components/Endpoint/ServerList.js +1 -1
- package/lib/components/Endpoint/types.d.ts +1 -2
- package/lib/components/Panel/ContentPanel.js +1 -1
- package/lib/components/Panel/Description.d.ts +1 -0
- package/lib/components/Panel/Description.js +2 -0
- package/lib/components/Panel/PanelComponent.js +1 -1
- package/lib/components/Panel/index.d.ts +1 -0
- package/lib/components/Panel/index.js +1 -1
- package/lib/components/Samples/SamplesTabs.d.ts +3 -1
- package/lib/components/Samples/SamplesTabs.js +1 -1
- package/lib/components/console/AuthPanel.d.ts +1 -1
- package/lib/components/console/AuthPanel.js +1 -1
- package/lib/components/console/Console.d.ts +1 -1
- package/lib/components/console/Console.js +1 -1
- package/lib/components/console/ConsoleLazy.js +1 -1
- package/lib/components/console/OAuth2Flow.d.ts +2 -1
- package/lib/components/console/OAuth2Flow.js +1 -1
- package/lib/components/console/OAuth2TokenInput.d.ts +2 -1
- package/lib/components/console/OAuth2TokenInput.js +1 -1
- package/lib/components/console/OpenIDConnect.d.ts +1 -1
- package/lib/components/console/OpenIDConnect.js +1 -1
- package/lib/components/console/ServersDropdown/ServersDropdown.d.ts +3 -0
- package/lib/components/console/ServersDropdown/ServersDropdown.js +2 -0
- package/lib/components/console/ServersDropdown/index.d.ts +1 -0
- package/lib/components/console/ServersDropdown/index.js +2 -0
- package/lib/components/console/ServersDropdown/types.d.ts +5 -0
- package/lib/components/console/ServersDropdown/types.js +2 -0
- package/lib/components/console/utils.d.ts +6 -0
- package/lib/components/console/utils.js +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/useDimensions.d.ts +1 -0
- package/lib/hooks/useDimensions.js +2 -0
- package/lib/index.d.ts +1 -1
- package/lib/oauth2-redirect-page/handler/helpers.d.ts +1 -0
- package/lib/oauth2-redirect-page/handler/helpers.js +1 -1
- package/lib/redoc-lib/src/common-elements/samples.js +1 -1
- package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +0 -1
- package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.js +1 -1
- package/lib/redoc-lib/src/components/Callbacks/CallbackDetails.js +1 -1
- package/lib/redoc-lib/src/components/JsonViewer/style.js +1 -1
- package/lib/redoc-lib/src/components/Operation/Operation.js +1 -1
- package/lib/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
- package/lib/redoc-lib/src/components/Responses/Response.d.ts +2 -5
- package/lib/redoc-lib/src/components/Responses/Response.js +1 -1
- package/lib/redoc-lib/src/components/Responses/ResponseDetails.d.ts +3 -8
- package/lib/redoc-lib/src/components/Responses/ResponseDetails.js +1 -1
- package/lib/redoc-lib/src/components/Responses/ResponseHeaders.d.ts +3 -9
- package/lib/redoc-lib/src/components/Responses/ResponseHeaders.js +1 -1
- package/lib/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -5
- package/lib/redoc-lib/src/components/Responses/ResponsesList.d.ts +3 -8
- package/lib/redoc-lib/src/components/Responses/ResponsesList.js +1 -1
- package/lib/redoc-lib/src/components/Responses/index.d.ts +1 -0
- package/lib/redoc-lib/src/components/Responses/index.js +2 -0
- package/{lib-esm/redoc-lib/src/components/Responses/styled.elements.d.ts → lib/redoc-lib/src/components/Responses/styled.d.ts} +1 -0
- package/lib/redoc-lib/src/components/Responses/styled.js +2 -0
- package/lib/redoc-lib/src/components/Responses/types.d.ts +12 -0
- package/lib/redoc-lib/src/components/Responses/types.js +2 -0
- package/lib/redoc-lib/src/components/SecurityRequirement/SecurityRequirementPanelDescription.js +1 -1
- package/lib/redoc-lib/src/components/SecuritySchemes/helpers.d.ts +4 -0
- package/lib/redoc-lib/src/components/SourceCode/SourceCode.d.ts +3 -5
- package/lib/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
- package/lib/redoc-lib/src/services/models/Schema.js +1 -1
- package/lib/redoc-lib/src/theme.d.ts +9 -0
- package/lib/redoc-lib/src/theme.js +1 -1
- package/lib/redoc-lib/src/types/open-api.d.ts +3 -0
- package/lib/redoc-lib/src/utils/openapi.d.ts +3 -2
- package/lib/redoc-lib/src/utils/openapi.js +1 -1
- package/lib/services/OAuth2.d.ts +4 -2
- package/lib/services/OAuth2.js +1 -1
- package/lib/services/OpenIDConnect.d.ts +1 -1
- package/lib/services/code-samples/generator.js +1 -1
- package/lib/services/extendTheme.d.ts +1 -1
- package/lib/standalone.js +1 -1
- package/lib/types.d.ts +11 -0
- package/lib/utils.d.ts +2 -12
- package/lib/utils.js +1 -1
- package/lib-esm/components/Endpoint/Endpoint.js +1 -1
- package/lib-esm/components/Endpoint/ServerList.d.ts +1 -1
- package/lib-esm/components/Endpoint/ServerList.js +1 -1
- package/lib-esm/components/Endpoint/types.d.ts +1 -2
- package/lib-esm/components/Panel/ContentPanel.js +1 -1
- package/lib-esm/components/Panel/Description.d.ts +1 -0
- package/lib-esm/components/Panel/Description.js +2 -0
- package/lib-esm/components/Panel/PanelComponent.js +1 -1
- package/lib-esm/components/Panel/index.d.ts +1 -0
- package/lib-esm/components/Panel/index.js +1 -1
- package/lib-esm/components/Samples/SamplesTabs.d.ts +3 -1
- package/lib-esm/components/Samples/SamplesTabs.js +1 -1
- package/lib-esm/components/console/AuthPanel.d.ts +1 -1
- package/lib-esm/components/console/AuthPanel.js +1 -1
- package/lib-esm/components/console/Console.d.ts +1 -1
- package/lib-esm/components/console/Console.js +1 -1
- package/lib-esm/components/console/ConsoleLazy.js +1 -1
- package/lib-esm/components/console/OAuth2Flow.d.ts +2 -1
- package/lib-esm/components/console/OAuth2Flow.js +1 -1
- package/lib-esm/components/console/OAuth2TokenInput.d.ts +2 -1
- package/lib-esm/components/console/OAuth2TokenInput.js +1 -1
- package/lib-esm/components/console/OpenIDConnect.d.ts +1 -1
- package/lib-esm/components/console/OpenIDConnect.js +1 -1
- package/lib-esm/components/console/ServersDropdown/ServersDropdown.d.ts +3 -0
- package/lib-esm/components/console/ServersDropdown/ServersDropdown.js +2 -0
- package/lib-esm/components/console/ServersDropdown/index.d.ts +1 -0
- package/lib-esm/components/console/ServersDropdown/index.js +2 -0
- package/lib-esm/components/console/ServersDropdown/types.d.ts +5 -0
- package/lib-esm/components/console/ServersDropdown/types.js +2 -0
- package/lib-esm/components/console/utils.d.ts +6 -0
- package/lib-esm/components/console/utils.js +1 -1
- package/lib-esm/hooks/index.d.ts +1 -0
- package/lib-esm/hooks/index.js +1 -1
- package/lib-esm/hooks/useDimensions.d.ts +1 -0
- package/lib-esm/hooks/useDimensions.js +2 -0
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/oauth2-redirect-page/handler/helpers.d.ts +1 -0
- package/lib-esm/oauth2-redirect-page/handler/helpers.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/samples.js +1 -1
- package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +0 -1
- package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/Callbacks/CallbackDetails.js +1 -1
- package/lib-esm/redoc-lib/src/components/JsonViewer/style.js +1 -1
- package/lib-esm/redoc-lib/src/components/Operation/Operation.js +1 -1
- package/lib-esm/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/Response.d.ts +2 -5
- package/lib-esm/redoc-lib/src/components/Responses/Response.js +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/ResponseDetails.d.ts +3 -8
- package/lib-esm/redoc-lib/src/components/Responses/ResponseDetails.js +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/ResponseHeaders.d.ts +3 -9
- package/lib-esm/redoc-lib/src/components/Responses/ResponseHeaders.js +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -5
- package/lib-esm/redoc-lib/src/components/Responses/ResponsesList.d.ts +3 -8
- package/lib-esm/redoc-lib/src/components/Responses/ResponsesList.js +1 -1
- package/lib-esm/redoc-lib/src/components/Responses/index.d.ts +1 -0
- package/lib-esm/redoc-lib/src/components/Responses/index.js +2 -0
- package/{lib/redoc-lib/src/components/Responses/styled.elements.d.ts → lib-esm/redoc-lib/src/components/Responses/styled.d.ts} +1 -0
- package/lib-esm/redoc-lib/src/components/Responses/styled.js +2 -0
- package/lib-esm/redoc-lib/src/components/Responses/types.d.ts +12 -0
- package/lib-esm/redoc-lib/src/components/Responses/types.js +2 -0
- package/lib-esm/redoc-lib/src/components/SecurityRequirement/SecurityRequirementPanelDescription.js +1 -1
- package/lib-esm/redoc-lib/src/components/SecuritySchemes/helpers.d.ts +4 -0
- package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.d.ts +3 -5
- package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/Schema.js +1 -1
- package/lib-esm/redoc-lib/src/theme.d.ts +9 -0
- package/lib-esm/redoc-lib/src/theme.js +1 -1
- package/lib-esm/redoc-lib/src/types/open-api.d.ts +3 -0
- package/lib-esm/redoc-lib/src/utils/openapi.d.ts +3 -2
- package/lib-esm/redoc-lib/src/utils/openapi.js +1 -1
- package/lib-esm/services/OAuth2.d.ts +4 -2
- package/lib-esm/services/OAuth2.js +1 -1
- package/lib-esm/services/OpenIDConnect.d.ts +1 -1
- package/lib-esm/services/code-samples/generator.js +1 -1
- package/lib-esm/services/extendTheme.d.ts +1 -1
- package/lib-esm/standalone.js +1 -1
- package/lib-esm/types.d.ts +11 -0
- package/lib-esm/utils.d.ts +2 -12
- package/lib-esm/utils.js +1 -1
- package/package.json +2 -1
- package/lib/components/console/ServerDropdown.d.ts +0 -24
- package/lib/components/console/ServerDropdown.js +0 -2
- package/lib/redoc-lib/src/components/Responses/styled.elements.js +0 -2
- package/lib-esm/components/console/ServerDropdown.d.ts +0 -24
- package/lib-esm/components/console/ServerDropdown.js +0 -2
- package/lib-esm/redoc-lib/src/components/Responses/styled.elements.js +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Typography } from '../../services/extendTheme';
|
|
1
2
|
declare const defaultTheme: ThemeInterface;
|
|
2
3
|
export default defaultTheme;
|
|
3
4
|
export declare function resolveTheme(theme: ThemeInterface): ResolvedThemeInterface;
|
|
@@ -174,6 +175,13 @@ export interface ResolvedThemeInterface {
|
|
|
174
175
|
panels: {
|
|
175
176
|
borderRadius: string;
|
|
176
177
|
backgroundColor: string;
|
|
178
|
+
title: Typography & {
|
|
179
|
+
fontFamily: MediaValue;
|
|
180
|
+
};
|
|
181
|
+
subTitle: Typography & {
|
|
182
|
+
fontFamily: MediaValue;
|
|
183
|
+
};
|
|
184
|
+
iconColor: string;
|
|
177
185
|
};
|
|
178
186
|
layoutControls: {
|
|
179
187
|
top: string;
|
|
@@ -213,6 +221,7 @@ export interface ResolvedThemeInterface {
|
|
|
213
221
|
};
|
|
214
222
|
codeBlock: {
|
|
215
223
|
backgroundColor: string;
|
|
224
|
+
maxHeight: string;
|
|
216
225
|
};
|
|
217
226
|
layout: {
|
|
218
227
|
showDarkRightPanel?: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a,_b;import{darken,lighten,readableColor,transparentize}from"polished";import{ZERO_BREAKPOINT}from"./utils/media-css";var defaultTheme={spacing:{unit:5,sectionHorizontal:function(r){return 8*r.spacing.unit},sectionVertical:function(r){return 4*r.spacing.unit}},breakpoints:{small:"50rem",medium:"85rem",large:"105rem"},colors:{tonalOffset:.2,primary:{main:"#0065FB",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.primary.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.primary.main)},contrastText:function(r){var o=r.colors;return readableColor(o.primary.main)}},secondary:{main:"#E4E7EB",light:"#F5F7FA",dark:"#E4E7EB",contrastText:"#3E4C59"},accent:{main:"#59C3FF",light:"#b3dcf3",dark:"#033B73",contrastText:"#ffffff"},success:{main:"#41DE50",light:function(r){var o=r.colors;return lighten(2*o.tonalOffset,o.success.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.success.main)},contrastText:function(r){var o=r.colors;return readableColor(o.success.main)}},warning:{main:"#ffa500",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.warning.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.warning.main)},contrastText:"#ffffff"},error:{main:"#FF6161",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.error.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.error.main)},contrastText:"#ffffff"},text:{primary:"#1F2933",secondary:"#7b8794",light:"#F5F7FA"},border:{dark:"#616E7C",light:"#E4E7EB"},responses:{success:{borderColor:"#B1E996",backgroundColor:"#F6FFF4",tabTextColor:function(r){return r.colors.responses.success.borderColor}},error:{borderColor:"#FFC9C9",backgroundColor:"#FFF4F4",tabTextColor:function(r){return r.colors.responses.error.borderColor}},redirect:{borderColor:function(r){return r.colors.warning.main},backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.redirect.borderColor)},tabTextColor:function(r){return r.colors.responses.redirect.borderColor}},info:{borderColor:"#87ceeb",backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.info.borderColor)},tabTextColor:function(r){return r.colors.responses.info.borderColor}}},http:{get:"#3A9601",post:"#0065FB",put:"#93527B",options:"#947014",patch:"#bf581d",delete:"#C83637",basic:"#707070",link:"#07818F",head:"#A23DAD"}},schema:{linesColor:function(r){return r.colors.border.light},defaultDetailsWidth:"70%",typeNameColor:function(r){return r.colors.text.secondary},typeTitleColor:function(r){return r.schema.typeNameColor},requireLabelColor:"#FF0000",labelsTextSize:"0.9em",nestingSpacing:"1em",nestedBackground:function(r){return r.colors.secondary.light},nestedAlternativeBackground:"#ffffff",caretColor:function(r){return r.colors.text.primary},caretSize:"9px"},typography:{fontSize:"14px",lineHeight:"1.5em",fontWeightRegular:"400",fontWeightBold:"600",fontWeightLight:"300",fontFamily:"Source Sans Pro, sans-serif",smoothing:"antialiased",optimizeSpeed:!0,headings:{fontFamily:function(r){return r.typography.fontFamily},fontWeight:"700",lineHeight:"1.6em"},code:{fontSize:"13px",fontFamily:"Source Code Pro, monospace",lineHeight:function(r){return r.typography.lineHeight},fontWeight:function(r){return r.typography.fontWeightRegular},color:"#e53935",backgroundColor:"rgba(38, 50, 56, 0.05)",wrap:!1},links:{color:function(r){return r.colors.primary.main},visited:function(r){return r.typography.links.color},hover:function(r){var o=r.typography;return lighten(.2,o.links.color)},textDecoration:"auto",hoverTextDecoration:"auto"},fieldName:{fontSize:function(r){return r.typography.code.fontSize},fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.code.fontWeight}}},sidebar:{separatorLabelColor:function(r){return r.sidebar.textColor},separatorLineColor:"#DADADA",caretColor:function(r){return r.sidebar.textColor},caretSize:function(r){return r.sidebar.spacing.unit},spacing:{unit:8,paddingHorizontal:function(r){return r.sidebar.spacing.unit},paddingVertical:function(r){return r.sidebar.spacing.unit},offsetTop:function(r){return 2*r.sidebar.spacing.unit},offsetLeft:function(r){return 2*r.sidebar.spacing.unit},offsetNesting:function(r){return 2*r.sidebar.spacing.unit}},borderRadius:"4px",fontFamily:function(r){return r.typography.fontFamily},fontSize:function(r){return r.typography.fontSize},showAtBreakpoint:"small",width:"285px",backgroundColor:"#fff",rightLineColor:function(r){return r.colors.border.light},textColor:function(r){return r.colors.text.primary},activeTextColor:function(r){return r.sidebar.textColor},activeBgColor:function(r){return r.colors.border.light}},components:{buttons:{borderRadius:function(r){return r.shape.borderRadius},hoverStyle:"",fontWeight:function(r){return r.typography.fontWeightBold},boxShadow:"none",hoverBoxShadow:"0px 0px 12px 0px rgba(0, 0, 0, 0.1)",fontFamily:"inherit",sizes:{small:{fontSize:"12px",padding:"8px 10px",minWidth:"90px"},medium:{fontSize:"14px",padding:"8px 20px",minWidth:"120px"},large:{fontSize:"14px",padding:"12px 24px",minWidth:"150px"},xlarge:{fontSize:"16px",padding:"20px 24px",minWidth:"200px"}}},httpBadges:{borderRadius:"16px",fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.fontWeightBold},color:function(r){return r.colors.text.light},sizes:{medium:{fontSize:"12px",lineHeight:"20px"},small:{fontSize:"8px",lineHeight:"15px"}}},tryItButton:{fullWidth:!1},tryItSendButton:{fullWidth:!1},panels:{borderRadius:"8px",backgroundColor:"#fff"},layoutControls:{top:"20px",width:"36px",height:"36px"}},logo:{maxHeight:function(r){return r.sidebar.width},maxWidth:function(r){return r.sidebar.width},gutter:"2px"},fab:{backgroundColor:"#f2f2f2",color:"#0065FB"},rightPanel:{showAtBreakpoint:"medium",backgroundColor:"#1F2933",panelBackgroundColor:"#52606D",panelControlsBackgroundColor:"#323F4B",width:"37.5%",textColor:"#ffffff"},codeBlock:{backgroundColor:function(r){return r.rightPanel.panelControlsBackgroundColor}},shape:{borderRadius:"4px"},layout:{showDarkRightPanel:!1,stacked:{maxWidth:(_a={},_a[ZERO_BREAKPOINT]="",_a.small="90%",_a.medium="75%",_a.large="1200px",_a)},"three-panel":{middlePanelMaxWidth:"none",maxWidth:(_b={},_b[ZERO_BREAKPOINT]="100%",_b.small="100%",_b.medium="100%",_b.large="1800px",_b)}}};export default defaultTheme;export function resolveTheme(r){var o={},t=0,n=function(e,i){Object.keys(e).forEach((function(a){var l=(i?i+".":"")+a,
|
|
1
|
+
var _a,_b;import{darken,lighten,readableColor,transparentize}from"polished";import{ZERO_BREAKPOINT}from"./utils/media-css";var defaultTheme={spacing:{unit:5,sectionHorizontal:function(r){return 8*r.spacing.unit},sectionVertical:function(r){return 4*r.spacing.unit}},breakpoints:{small:"50rem",medium:"85rem",large:"105rem"},colors:{tonalOffset:.2,primary:{main:"#0065FB",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.primary.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.primary.main)},contrastText:function(r){var o=r.colors;return readableColor(o.primary.main)}},secondary:{main:"#E4E7EB",light:"#F5F7FA",dark:"#E4E7EB",contrastText:"#3E4C59"},accent:{main:"#59C3FF",light:"#b3dcf3",dark:"#033B73",contrastText:"#ffffff"},success:{main:"#41DE50",light:function(r){var o=r.colors;return lighten(2*o.tonalOffset,o.success.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.success.main)},contrastText:function(r){var o=r.colors;return readableColor(o.success.main)}},warning:{main:"#ffa500",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.warning.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.warning.main)},contrastText:"#ffffff"},error:{main:"#FF6161",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.error.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.error.main)},contrastText:"#ffffff"},text:{primary:"#1F2933",secondary:"#7b8794",light:"#F5F7FA"},border:{dark:"#616E7C",light:"#E4E7EB"},responses:{success:{borderColor:"#B1E996",backgroundColor:"#F6FFF4",tabTextColor:function(r){return r.colors.responses.success.borderColor}},error:{borderColor:"#FFC9C9",backgroundColor:"#FFF4F4",tabTextColor:function(r){return r.colors.responses.error.borderColor}},redirect:{borderColor:function(r){return r.colors.warning.main},backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.redirect.borderColor)},tabTextColor:function(r){return r.colors.responses.redirect.borderColor}},info:{borderColor:"#87ceeb",backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.info.borderColor)},tabTextColor:function(r){return r.colors.responses.info.borderColor}}},http:{get:"#3A9601",post:"#0065FB",put:"#93527B",options:"#947014",patch:"#bf581d",delete:"#C83637",basic:"#707070",link:"#07818F",head:"#A23DAD"}},schema:{linesColor:function(r){return r.colors.border.light},defaultDetailsWidth:"70%",typeNameColor:function(r){return r.colors.text.secondary},typeTitleColor:function(r){return r.schema.typeNameColor},requireLabelColor:"#FF0000",labelsTextSize:"0.9em",nestingSpacing:"1em",nestedBackground:function(r){return r.colors.secondary.light},nestedAlternativeBackground:"#ffffff",caretColor:function(r){return r.colors.text.primary},caretSize:"9px"},typography:{fontSize:"14px",lineHeight:"1.5em",fontWeightRegular:"400",fontWeightBold:"600",fontWeightLight:"300",fontFamily:"Source Sans Pro, sans-serif",smoothing:"antialiased",optimizeSpeed:!0,headings:{fontFamily:function(r){return r.typography.fontFamily},fontWeight:"700",lineHeight:"1.6em"},code:{fontSize:"13px",fontFamily:"Source Code Pro, monospace",lineHeight:function(r){return r.typography.lineHeight},fontWeight:function(r){return r.typography.fontWeightRegular},color:"#e53935",backgroundColor:"rgba(38, 50, 56, 0.05)",wrap:!1},links:{color:function(r){return r.colors.primary.main},visited:function(r){return r.typography.links.color},hover:function(r){var o=r.typography;return lighten(.2,o.links.color)},textDecoration:"auto",hoverTextDecoration:"auto"},fieldName:{fontSize:function(r){return r.typography.code.fontSize},fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.code.fontWeight}}},sidebar:{separatorLabelColor:function(r){return r.sidebar.textColor},separatorLineColor:"#DADADA",caretColor:function(r){return r.sidebar.textColor},caretSize:function(r){return r.sidebar.spacing.unit},spacing:{unit:8,paddingHorizontal:function(r){return r.sidebar.spacing.unit},paddingVertical:function(r){return r.sidebar.spacing.unit},offsetTop:function(r){return 2*r.sidebar.spacing.unit},offsetLeft:function(r){return 2*r.sidebar.spacing.unit},offsetNesting:function(r){return 2*r.sidebar.spacing.unit}},borderRadius:"4px",fontFamily:function(r){return r.typography.fontFamily},fontSize:function(r){return r.typography.fontSize},showAtBreakpoint:"small",width:"285px",backgroundColor:"#fff",rightLineColor:function(r){return r.colors.border.light},textColor:function(r){return r.colors.text.primary},activeTextColor:function(r){return r.sidebar.textColor},activeBgColor:function(r){return r.colors.border.light}},components:{buttons:{borderRadius:function(r){return r.shape.borderRadius},hoverStyle:"",fontWeight:function(r){return r.typography.fontWeightBold},boxShadow:"none",hoverBoxShadow:"0px 0px 12px 0px rgba(0, 0, 0, 0.1)",fontFamily:"inherit",sizes:{small:{fontSize:"12px",padding:"8px 10px",minWidth:"90px"},medium:{fontSize:"14px",padding:"8px 20px",minWidth:"120px"},large:{fontSize:"14px",padding:"12px 24px",minWidth:"150px"},xlarge:{fontSize:"16px",padding:"20px 24px",minWidth:"200px"}}},httpBadges:{borderRadius:"16px",fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.fontWeightBold},color:function(r){return r.colors.text.light},sizes:{medium:{fontSize:"12px",lineHeight:"20px"},small:{fontSize:"8px",lineHeight:"15px"}}},tryItButton:{fullWidth:!1},tryItSendButton:{fullWidth:!1},panels:{borderRadius:"8px",backgroundColor:"#fff",title:{fontSize:"18px",fontWeight:function(r){return r.typography.headings.fontWeight},fontFamily:function(r){return r.typography.fontFamily},lineHeight:"18px",color:"#1F2933",transform:""},subTitle:{fontSize:"0.9em",fontWeight:"normal",fontFamily:function(r){return r.typography.fontFamily},lineHeight:"18px",color:"#1F2933",transform:""},iconColor:"#1F2933"},layoutControls:{top:"20px",width:"36px",height:"36px"}},logo:{maxHeight:function(r){return r.sidebar.width},maxWidth:function(r){return r.sidebar.width},gutter:"2px"},fab:{backgroundColor:"#f2f2f2",color:"#0065FB"},rightPanel:{showAtBreakpoint:"medium",backgroundColor:"#1F2933",panelBackgroundColor:"#52606D",panelControlsBackgroundColor:"#323F4B",width:"37.5%",textColor:"#ffffff"},codeBlock:{backgroundColor:function(r){return r.rightPanel.panelControlsBackgroundColor},maxHeight:"auto"},shape:{borderRadius:"4px"},layout:{showDarkRightPanel:!1,stacked:{maxWidth:(_a={},_a[ZERO_BREAKPOINT]="",_a.small="90%",_a.medium="75%",_a.large="1200px",_a)},"three-panel":{middlePanelMaxWidth:"none",maxWidth:(_b={},_b[ZERO_BREAKPOINT]="100%",_b.small="100%",_b.medium="100%",_b.large="1800px",_b)}}};export default defaultTheme;export function resolveTheme(r){var o={},t=0,n=function(e,i){Object.keys(e).forEach((function(a){var l=(i?i+".":"")+a,f=e[a];"function"==typeof f?Object.defineProperty(e,a,{get:function(){if(!o[l]){if(++t>1e3)throw new Error("Theme probably contains circular dependency at "+l+": "+f.toString());o[l]=f(r)}return o[l]},enumerable:!0}):"object"==typeof f&&n(f,l)}))};return n(r,""),JSON.parse(JSON.stringify(r))}
|
|
2
2
|
//# sourceMappingURL=theme.js.map
|
|
@@ -280,6 +280,7 @@ export interface OpenAPISecurityScheme {
|
|
|
280
280
|
scopes: Record<string, string>;
|
|
281
281
|
authorizationUrl: string;
|
|
282
282
|
'x-defaultClientId'?: string;
|
|
283
|
+
'x-tokenEndpointAuthMethod'?: string;
|
|
283
284
|
};
|
|
284
285
|
password?: {
|
|
285
286
|
refreshUrl?: string;
|
|
@@ -292,6 +293,7 @@ export interface OpenAPISecurityScheme {
|
|
|
292
293
|
scopes: Record<string, string>;
|
|
293
294
|
tokenUrl: string;
|
|
294
295
|
'x-defaultClientId'?: string;
|
|
296
|
+
'x-tokenEndpointAuthMethod'?: string;
|
|
295
297
|
};
|
|
296
298
|
authorizationCode?: {
|
|
297
299
|
refreshUrl?: string;
|
|
@@ -299,6 +301,7 @@ export interface OpenAPISecurityScheme {
|
|
|
299
301
|
authorizationUrl: string;
|
|
300
302
|
tokenUrl: string;
|
|
301
303
|
'x-defaultClientId'?: string;
|
|
304
|
+
'x-tokenEndpointAuthMethod'?: string;
|
|
302
305
|
};
|
|
303
306
|
};
|
|
304
307
|
openIdConnectUrl?: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { ExtendedOpenAPIOperation } from '../services';
|
|
1
2
|
import type { FieldModel } from '../services/models';
|
|
2
3
|
import type { OpenAPIParser } from '../services/OpenAPIParser';
|
|
3
|
-
import type { OpenAPIEncoding, OpenAPIMediaType,
|
|
4
|
+
import type { OpenAPIEncoding, OpenAPIMediaType, OpenAPIParameter, OpenAPIParameterStyle, OpenAPISchema, OpenAPIServer, Referenced, OpenAPIResponse, OpenAPIRequestBody } from '../types';
|
|
4
5
|
export declare function isStatusCode(statusCode: string): boolean;
|
|
5
6
|
export declare function getStatusCodeType(statusCode: string | number, defaultAsError?: boolean): string;
|
|
6
7
|
export declare function isOperationName(key: string): boolean;
|
|
7
|
-
export declare function getOperationSummary(operation:
|
|
8
|
+
export declare function getOperationSummary(operation: ExtendedOpenAPIOperation): string;
|
|
8
9
|
export declare function detectType(schema: OpenAPISchema): string;
|
|
9
10
|
export declare function isPrimitiveType(schema: OpenAPISchema, type?: string | string[] | undefined): boolean;
|
|
10
11
|
export declare function isJsonLike(contentType: string): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__spreadArray}from"tslib";import{dirname}from"path";import UrlTemplate from"url-template";import{MediaTypes}from"../../../types";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl}from"./helpers";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r){if(void 0===r&&(r=!1),"default"===e)return r?"error":"success";var t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");var i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}var operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationSummary(e){return e.summary||e.operationId||e.description&&e.description.substring(0,50)||"<no summary>"}var schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;for(var r=0,t=Object.keys(schemaKeywordTypes);r<t.length;r++){var i=t[r],n=schemaKeywordTypes[i];if(void 0!==e[i])return n}return"any"}export function isPrimitiveType(e,r){if(void 0===r&&(r=e.type),e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;var t=!0,i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((function(e){return e.toString()})).join(t):"object"==typeof e?Object.keys(e).map((function(r){return""+r+t+e[r]})).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((function(t){return e[t]?r+"["+t+"]="+e[t]:void 0})).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){var i,n="__redoc_param_name__",a=r?"*":"";return UrlTemplate.parse("{?"+n+a+"}").expand((i={},i[n]=t,i)).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){var t,i=e?"*":"",n="__redoc_param_name__",a=UrlTemplate.parse("{"+n+i+"}");return decodeURIComponent(a.expand(((t={})[n]=r,t)))}export function urlFormEncodePayload(e,r){if(void 0===r&&(r={}),Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((function(t){var i=e[t],n=r[t]||{},a=n.style,o=void 0===a?"form":a,s=n.explode,u=void 0===s||s;switch(o){case"form":return serializeFormValue(t,u,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+o),""}})).join("&")}function serializePathParameter(e,r,t,i){var n,a=t?"*":"",o="";"label"===r?o=".":"matrix"===r&&(o=";");var s="__redoc_param_name__";return UrlTemplate.parse("{"+o+s+a+"}").expand((n={},n[s]=i,n)).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){var n=function(n){switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):e+"="+n.join("%20"):(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):e+"="+n.join("|"):(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((function(e){return n(e)}))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn("Parameter serialization as "+r+" is not supported"),"")}export function serializeParameterValue(e,r){var t=e.name,i=e.style,n=e.explode,a=void 0!==n&&n,o=e.serializationMime;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return t+"="+serializeParameterValueWithMime(r,o);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn("Missing style attribute or content for parameter "+t),"";switch(e.in){case"path":return serializePathParameter(t,i,a,r);case"query":return serializeQueryParameter(t,i,a,r);case"header":return serializeHeaderParameter(i,a,r);case"cookie":return serializeCookieParameter(t,i,a,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}var DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0!==e){var r=e.toString(10);return/^0\.0*1$/.test(r)?"decimal places <= "+r.split(".")[1].length:"multiple of "+r}}function humanizeRangeConstraint(e,r,t){var i;return void 0!==r&&void 0!==t?i=r===t?"= "+r+" "+e:"[ "+r+" .. "+t+" ] "+e:void 0!==t?i="<= "+t+" "+e:void 0!==r&&(i=1===r?"non-empty":">= "+r+" "+e),i}export function humanizeNumberRange(e){var r,t,i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,a="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,o="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?(a?"( ":"[ ")+i+" .. "+n+(o?" )":" ]"):void 0!==n?(o?"< ":"<= ")+n:void 0!==i?(a?"> ":">= ")+i:void 0}export function humanizeConstraints(e){var r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);var i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);var n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);var a=humanizeMultipleOfConstraint(e.multipleOf);void 0!==a&&r.push(a);var o=humanizeNumberRange(e);return void 0!==o&&r.push(o),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r){void 0===r&&(r=[]);var t=[],i=[],n=[];return e.forEach((function(e){e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort((function(e,t){return r.indexOf(e.name)-r.indexOf(t.name)})),__spreadArray(__spreadArray(__spreadArray([],i,!0),n,!0),t,!0)}export function sortByField(e,r){return __spreadArray([],e,!0).sort((function(e,t){return e[r].localeCompare(t[r])}))}export function mergeParams(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=[]);var i={};return t.forEach((function(r){r=e.deref(r).resolved,i[r.name+"_"+r.in]=!0})),(r=r.filter((function(r){return r=e.deref(r).resolved,!i[r.name+"_"+r.in]}))).concat(t)}export function mergeSimilarMediaTypes(e){var r={};return Object.keys(e).forEach((function(t){var i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=__assign(__assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(/(?:{)([\w-.]+)(?:})/g,(function(e,t){return r[t]&&r[t].default||e}))}export function normalizeServers(e,r){var t=void 0===e?removeQueryStringAndHash(function(){if(!IS_BROWSER)return"";var e=window.location.href;return e.endsWith(".html")?dirname(e):e}()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((function(e){return __assign(__assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export var SECURITY_DEFINITIONS_COMPONENT_NAME="security-definitions";export var SECURITY_DEFINITIONS_JSX_NAME="SecurityDefinitions";export var SCHEMA_DEFINITION_JSX_NAME="SchemaDefinition";export var shortenHTTPVerb=function(e){return{delete:"del",options:"opts"}[e]||e};export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0}}export function extractExtensions(e,r){return Object.keys(e).filter((function(e){return!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1})).reduce((function(r,t){return r[t]=e[t],r}),{})}export function pluralizeType(e){return e.split(" or ").map((function(e){return e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")})).join(" or ")}export function getContentWithLegacyExamples(e){var r=e.content,t=e["x-examples"],i=e["x-example"];if(t){r=__assign({},r);for(var n=0,a=Object.keys(t);n<a.length;n++){var o=t[m=a[n]];r[m]=__assign(__assign({},r[m]),{examples:o})}}else if(i){r=__assign({},r);for(var s=0,u=Object.keys(i);s<u.length;s++){var m,l=i[m=u[s]];r[m]=__assign(__assign({},r[m]),{example:l})}}return r}
|
|
1
|
+
import{__assign,__spreadArray}from"tslib";import{dirname}from"path";import UrlTemplate from"url-template";import{MediaTypes}from"../../../types";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl}from"./helpers";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r){if(void 0===r&&(r=!1),"default"===e)return r?"error":"success";var t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");var i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}var operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationSummary(e){return e.summary||e.operationId||e.description&&e.description.substring(0,50)||e.pathName||"<no summary>"}var schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;for(var r=0,t=Object.keys(schemaKeywordTypes);r<t.length;r++){var i=t[r],n=schemaKeywordTypes[i];if(void 0!==e[i])return n}return"any"}export function isPrimitiveType(e,r){if(void 0===r&&(r=e.type),e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;var t=!0,i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((function(e){return e.toString()})).join(t):"object"==typeof e?Object.keys(e).map((function(r){return""+r+t+e[r]})).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((function(t){return e[t]?r+"["+t+"]="+e[t]:void 0})).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){var i,n="__redoc_param_name__",a=r?"*":"";return UrlTemplate.parse("{?"+n+a+"}").expand((i={},i[n]=t,i)).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){var t,i=e?"*":"",n="__redoc_param_name__",a=UrlTemplate.parse("{"+n+i+"}");return decodeURIComponent(a.expand(((t={})[n]=r,t)))}export function urlFormEncodePayload(e,r){if(void 0===r&&(r={}),Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((function(t){var i=e[t],n=r[t]||{},a=n.style,o=void 0===a?"form":a,s=n.explode,u=void 0===s||s;switch(o){case"form":return serializeFormValue(t,u,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+o),""}})).join("&")}function serializePathParameter(e,r,t,i){var n,a=t?"*":"",o="";"label"===r?o=".":"matrix"===r&&(o=";");var s="__redoc_param_name__";return UrlTemplate.parse("{"+o+s+a+"}").expand((n={},n[s]=i,n)).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){var n=function(n){switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):e+"="+n.join("%20"):(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):e+"="+n.join("|"):(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((function(e){return n(e)}))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn("Parameter serialization as "+r+" is not supported"),"")}export function serializeParameterValue(e,r){var t=e.name,i=e.style,n=e.explode,a=void 0!==n&&n,o=e.serializationMime;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return t+"="+serializeParameterValueWithMime(r,o);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn("Missing style attribute or content for parameter "+t),"";switch(e.in){case"path":return serializePathParameter(t,i,a,r);case"query":return serializeQueryParameter(t,i,a,r);case"header":return serializeHeaderParameter(i,a,r);case"cookie":return serializeCookieParameter(t,i,a,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}var DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0!==e){var r=e.toString(10);return/^0\.0*1$/.test(r)?"decimal places <= "+r.split(".")[1].length:"multiple of "+r}}function humanizeRangeConstraint(e,r,t){var i;return void 0!==r&&void 0!==t?i=r===t?"= "+r+" "+e:"[ "+r+" .. "+t+" ] "+e:void 0!==t?i="<= "+t+" "+e:void 0!==r&&(i=1===r?"non-empty":">= "+r+" "+e),i}export function humanizeNumberRange(e){var r,t,i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,a="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,o="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?(a?"( ":"[ ")+i+" .. "+n+(o?" )":" ]"):void 0!==n?(o?"< ":"<= ")+n:void 0!==i?(a?"> ":">= ")+i:void 0}export function humanizeConstraints(e){var r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);var i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);var n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);var a=humanizeMultipleOfConstraint(e.multipleOf);void 0!==a&&r.push(a);var o=humanizeNumberRange(e);return void 0!==o&&r.push(o),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r){void 0===r&&(r=[]);var t=[],i=[],n=[];return e.forEach((function(e){e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort((function(e,t){return r.indexOf(e.name)-r.indexOf(t.name)})),__spreadArray(__spreadArray(__spreadArray([],i,!0),n,!0),t,!0)}export function sortByField(e,r){return __spreadArray([],e,!0).sort((function(e,t){return e[r].localeCompare(t[r])}))}export function mergeParams(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=[]);var i={};return t.forEach((function(r){r=e.deref(r).resolved,i[r.name+"_"+r.in]=!0})),(r=r.filter((function(r){return r=e.deref(r).resolved,!i[r.name+"_"+r.in]}))).concat(t)}export function mergeSimilarMediaTypes(e){var r={};return Object.keys(e).forEach((function(t){var i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=__assign(__assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(/(?:{)([\w-.]+)(?:})/g,(function(e,t){return r[t]&&r[t].default||e}))}export function normalizeServers(e,r){var t=void 0===e?removeQueryStringAndHash(function(){if(!IS_BROWSER)return"";var e=window.location.href;return e.endsWith(".html")?dirname(e):e}()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((function(e){return __assign(__assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export var SECURITY_DEFINITIONS_COMPONENT_NAME="security-definitions";export var SECURITY_DEFINITIONS_JSX_NAME="SecurityDefinitions";export var SCHEMA_DEFINITION_JSX_NAME="SchemaDefinition";export var shortenHTTPVerb=function(e){return{delete:"del",options:"opts"}[e]||e};export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0,"x-tokenEndpointAuthMethod":!0}}export function extractExtensions(e,r){return Object.keys(e).filter((function(e){return!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1})).reduce((function(r,t){return r[t]=e[t],r}),{})}export function pluralizeType(e){return e.split(" or ").map((function(e){return e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")})).join(" or ")}export function getContentWithLegacyExamples(e){var r=e.content,t=e["x-examples"],i=e["x-example"];if(t){r=__assign({},r);for(var n=0,a=Object.keys(t);n<a.length;n++){var o=t[m=a[n]];r[m]=__assign(__assign({},r[m]),{examples:o})}}else if(i){r=__assign({},r);for(var s=0,u=Object.keys(i);s<u.length;s++){var m,l=i[m=u[s]];r[m]=__assign(__assign({},r[m]),{example:l})}}return r}
|
|
2
2
|
//# sourceMappingURL=openapi.js.map
|
|
@@ -9,7 +9,7 @@ export declare class OAuth2 {
|
|
|
9
9
|
successCallback: OAuth2SuccessCallback;
|
|
10
10
|
errorCallback: OAuth2ErrorCallback;
|
|
11
11
|
}): void;
|
|
12
|
-
static authorizeAuthorizationCode({ authorizationUrl, tokenUrl, clientId, clientSecret, codeVerifier, codeChallenge, scopes, extraParams, routingBasePath, redirectUri, successCallback, errorCallback, }: {
|
|
12
|
+
static authorizeAuthorizationCode({ authorizationUrl, tokenUrl, clientId, clientSecret, codeVerifier, codeChallenge, scopes, extraParams, extraHeaders, routingBasePath, redirectUri, successCallback, errorCallback, }: {
|
|
13
13
|
authorizationUrl: string;
|
|
14
14
|
tokenUrl: string;
|
|
15
15
|
clientId: string;
|
|
@@ -20,16 +20,18 @@ export declare class OAuth2 {
|
|
|
20
20
|
redirectUri?: string | null;
|
|
21
21
|
routingBasePath?: string;
|
|
22
22
|
extraParams?: Record<string, string>;
|
|
23
|
+
extraHeaders?: Record<string, string>;
|
|
23
24
|
successCallback: OAuth2SuccessCallback;
|
|
24
25
|
errorCallback: OAuth2ErrorCallback;
|
|
25
26
|
}): void;
|
|
26
27
|
static clearRedirectData(flow: 'implicit' | 'authorizationCode'): void;
|
|
27
|
-
static authorizeClientCredentials({ tokenUrl, clientId, clientSecret, scopes, extraParams, successCallback, errorCallback, }: {
|
|
28
|
+
static authorizeClientCredentials({ tokenUrl, clientId, clientSecret, scopes, extraParams, extraHeaders, successCallback, errorCallback, }: {
|
|
28
29
|
tokenUrl: string;
|
|
29
30
|
clientId: string;
|
|
30
31
|
clientSecret: string;
|
|
31
32
|
scopes?: string[];
|
|
32
33
|
extraParams?: Record<string, string>;
|
|
34
|
+
extraHeaders?: Record<string, string>;
|
|
33
35
|
successCallback: OAuth2SuccessCallback;
|
|
34
36
|
errorCallback: OAuth2ErrorCallback;
|
|
35
37
|
}): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__awaiter,__generator}from"tslib";import*as qs from"querystring";import{base64UrlEncode,encodeState,sha256}from"./utils";var DEFAULT_OAUTH2_REDIRECT_PAGE="/oauth2-redirect.html",OAuth2=function(){function e(){}return Object.defineProperty(e,"authorizeImplicit",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var t=r.authorizationUrl,a=r.clientId,n=r.scopes,i=r.extraParams,s=void 0===i?{}:i,o=r.routingBasePath,c=r.redirectUri,l=r.successCallback,u=r.errorCallback,d=encodeState({date:(new Date).toString()}),h=new URL(t),_="/"===o?"":o,p=""+window.location.origin+_+DEFAULT_OAUTH2_REDIRECT_PAGE;for(var f in h.searchParams.set("client_id",a),h.searchParams.set("redirect_uri",c||p),h.searchParams.set("response_type","token"),h.searchParams.set("state",d),Array.isArray(n)&&h.searchParams.set("scope",n.join(" ")),s)h.searchParams.set(f,s[f]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:t,clientId:a,scopes:n},state:d,successCallback:function(r){l(r),e.clearRedirectData("implicit")},errorCallback:function(r){u(r),e.clearRedirectData("implicit")}},window.open(h.toString())}}),Object.defineProperty(e,"authorizeAuthorizationCode",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var t=this,a=r.authorizationUrl,n=r.tokenUrl,i=r.clientId,s=r.clientSecret,o=r.codeVerifier,c=r.codeChallenge,l=r.scopes,u=r.extraParams,d=void 0===u?{}:u,h=r.
|
|
1
|
+
import{__assign,__awaiter,__generator}from"tslib";import*as qs from"querystring";import{base64UrlEncode,encodeState,sha256}from"./utils";var DEFAULT_OAUTH2_REDIRECT_PAGE="/oauth2-redirect.html",OAuth2=function(){function e(){}return Object.defineProperty(e,"authorizeImplicit",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var t=r.authorizationUrl,a=r.clientId,n=r.scopes,i=r.extraParams,s=void 0===i?{}:i,o=r.routingBasePath,c=r.redirectUri,l=r.successCallback,u=r.errorCallback,d=encodeState({date:(new Date).toString()}),h=new URL(t),_="/"===o?"":o,p=""+window.location.origin+_+DEFAULT_OAUTH2_REDIRECT_PAGE;for(var f in h.searchParams.set("client_id",a),h.searchParams.set("redirect_uri",c||p),h.searchParams.set("response_type","token"),h.searchParams.set("state",d),Array.isArray(n)&&h.searchParams.set("scope",n.join(" ")),s)h.searchParams.set(f,s[f]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:t,clientId:a,scopes:n},state:d,successCallback:function(r){l(r),e.clearRedirectData("implicit")},errorCallback:function(r){u(r),e.clearRedirectData("implicit")}},window.open(h.toString())}}),Object.defineProperty(e,"authorizeAuthorizationCode",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var t=this,a=r.authorizationUrl,n=r.tokenUrl,i=r.clientId,s=r.clientSecret,o=r.codeVerifier,c=r.codeChallenge,l=r.scopes,u=r.extraParams,d=void 0===u?{}:u,h=r.extraHeaders,_=void 0===h?{}:h,p=r.routingBasePath,f=r.redirectUri,b=r.successCallback,w=r.errorCallback,m=new URL(a),v="/"===p?"":p,g=""+window.location.origin+v+DEFAULT_OAUTH2_REDIRECT_PAGE,C=encodeState({date:(new Date).toString()});for(var y in m.searchParams.set("client_id",i),m.searchParams.set("redirect_uri",f||g),m.searchParams.set("response_type","code"),m.searchParams.set("state",C),Array.isArray(l)&&m.searchParams.set("scope",l.join(" ")),c&&(m.searchParams.set("code_challenge",c),m.searchParams.set("code_challenge_method","S256")),d)m.searchParams.set(y,d[y]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:a,clientId:i,scopes:l},state:C,successCallback:function(r){var a=r.auth_code;return __awaiter(t,void 0,void 0,(function(){var r;return __generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,fetch(n,{method:"POST",headers:__assign({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},_),body:qs.stringify(__assign(__assign(__assign({client_id:i,client_secret:s},o&&{code_verifier:o}),{code:a,grant_type:"authorization_code",redirect_uri:f||g}),d))})];case 1:return[4,handleResponseCallback(t.sent(),b,w)];case 2:return t.sent(),[3,4];case 3:return r=t.sent(),w(r),[3,4];case 4:return e.clearRedirectData("authorizationCode"),[2]}}))}))},errorCallback:function(r){w(r),e.clearRedirectData("authorizationCode")}},window.open(m.toString())}}),Object.defineProperty(e,"clearRedirectData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:function(){},errorCallback:function(){}}}}),Object.defineProperty(e,"authorizeClientCredentials",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.tokenUrl,t=e.clientId,a=e.clientSecret,n=e.scopes,i=void 0===n?[]:n,s=e.extraParams,o=void 0===s?{}:s,c=e.extraHeaders,l=void 0===c?{}:c,u=e.successCallback,d=e.errorCallback;return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,fetch(r,{method:"POST",headers:__assign({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},l),body:qs.stringify(__assign({client_id:t,client_secret:a,grant_type:"client_credentials",scope:Array.isArray(i)?i.join(" "):void 0},o))})];case 1:return[4,handleResponseCallback(n.sent(),u,d)];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),d(e),[3,4];case 4:return[2]}}))}))}}),e}();export{OAuth2};export var oauth2Instance=new OAuth2;function handleResponseCallback(e,r,t){return __awaiter(this,void 0,void 0,(function(){var a,n,i,s,o,c;return __generator(this,(function(l){switch(l.label){case 0:return e.ok?[4,e.json()]:[3,2];case 1:return a=l.sent(),r(a),[3,7];case 2:return n=t,i=Error.bind,(e.headers.get("Content-Type")||"").indexOf("json")>-1?(c=(o=JSON).stringify,[4,e.json()]):[3,4];case 3:return s=c.apply(o,[l.sent()]),[3,6];case 4:return[4,e.text()];case 5:s=l.sent(),l.label=6;case 6:n.apply(void 0,[new(i.apply(Error,[void 0,s]))]),l.label=7;case 7:return[2]}}))}))}export function deriveCodeChallenge(e){return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(t){switch(t.label){case 0:return r=base64UrlEncode,[4,sha256(e)];case 1:return[2,r.apply(void 0,[t.sent()])]}}))}))}
|
|
2
2
|
//# sourceMappingURL=OAuth2.js.map
|
|
@@ -21,7 +21,7 @@ export interface ProviderMetadata {
|
|
|
21
21
|
request_object_signing_alg_values_supported?: string[];
|
|
22
22
|
request_object_encryption_alg_values_supported?: string[];
|
|
23
23
|
request_object_encryption_enc_values_supported?: string[];
|
|
24
|
-
token_endpoint_auth_methods_supported?: string[];
|
|
24
|
+
token_endpoint_auth_methods_supported?: string[] | string;
|
|
25
25
|
token_endpoint_auth_signing_alg_values_supported?: string[];
|
|
26
26
|
display_values_supported?: string[];
|
|
27
27
|
claim_types_supported?: string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign}from"tslib";import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{toJS}from"mobx";import{deleteEmptyArrayItem,isArrayOfObjects,serializeParameterValue}from"../../redoc-lib";import{getSecurityDetails,getParameterValue}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../types";import{HTTPSnippet}from"./httpsnippet";function mapOperationToHAR(e,
|
|
1
|
+
import{__assign}from"tslib";import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{toJS}from"mobx";import{deleteEmptyArrayItem,isArrayOfObjects,serializeParameterValue}from"../../redoc-lib";import{getSecurityDetails,getParameterValue}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../types";import{l}from"../../redoc-lib/src/services/Labels";import{HTTPSnippet}from"./httpsnippet";import StringUtility from"./httpsnippet/helpers/string-utility";function mapOperationToHAR(e,t){var a,r,i,n,s,o,l,u,p,d,c=t.exampleName,m=void 0===c?"":c,v=t.skipOptionalParameters,h=void 0!==v&&v,f=t.withOAuth2Call,y=void 0!==f&&f,g=t.spec,O=t.generatedPayloadSamplesMaxDepth,S=void 0===O?8:O,_=t.pathParams,T=void 0===_?{}:_,C=t.properties,E=void 0===C?{}:C,b=getSecurityData(null===(a=e.security)||void 0===a?void 0:a[0],y),A=b.securityHeaders,P=b.securityCookies,w=b.securityQueries,D=b.securityOAuth2ExtraCalls,R=b.basicAuth,k=null===(i=null===(r=e.requestBody)||void 0===r?void 0:r.content)||void 0===i?void 0:i.active,q={skipNonRequired:h,skipReadOnly:!0,maxSampleDepth:S},H={path:toJS(null===(n=null==e?void 0:e.requestValues)||void 0===n?void 0:n.path),cookie:toJS(null===(s=null==e?void 0:e.requestValues)||void 0===s?void 0:s.cookie),header:toJS(null===(o=null==e?void 0:e.requestValues)||void 0===o?void 0:o.header),query:toJS(null===(l=null==e?void 0:e.requestValues)||void 0===l?void 0:l.query),body:toJS(null===(u=null==e?void 0:e.requestValues)||void 0===u?void 0:u.body)},x=!1,M=e.parameters.filter((function(e){return"header"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){var t;return{name:e.name,value:(null===(t=H.header)||void 0===t?void 0:t[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g))}})).map((function(e){return(null==k?void 0:k.name)&&"content-type"===e.name.toLowerCase()&&(x=!0,e.value=k.name),e})).concat(A);!x&&(null==k?void 0:k.name)&&M.unshift({name:"Content-Type",value:null==k?void 0:k.name});var N=e.parameters.filter((function(e){return"cookie"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g)))})).reduce((function(e,t){for(var a,r=0,i=Object.entries(t);r<i.length;r++){var n=i[r],s=n[0],o=n[1];e.push({name:s,value:String((null===(a=H.cookie)||void 0===a?void 0:a[s])||o)})}return e}),[]).concat(P),U=e.parameters.filter((function(e){return"query"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g)))})).reduce((function(e,t){for(var a,r,i,n=0,s=Object.entries(t);n<s.length;n++){var o=s[n],l=o[0],u=o[1];e.push({name:l,value:isArrayOfObjects(null===(a=H.query)||void 0===a?void 0:a[l])&&JSON.stringify(deleteEmptyArrayItem(null===(r=H.query)||void 0===r?void 0:r[l]))||String((null===(i=H.query)||void 0===i?void 0:i[l])||u)})}return e}),[]).concat(w),z=(null===(p=e.activeServer)||void 0===p?void 0:p.url.replace(/\/$/,""))+"/"+e.path.replace(/^\//,""),V=e.parameters.filter((function(e){return"path"===e.in})).reduce((function(e,t){var a,r=t.in,i=t.name;return e[i]=(null===(a=H.path)||void 0===a?void 0:a[i])||T[i]||getParameterValue(r,i),e}),{}),j=null===(d=null==k?void 0:k.examples)||void 0===d?void 0:d[m],I=(null==k?void 0:k.examples)||{},J=Object.values(I)[0],L=H.body||(null==j?void 0:j.value)||(null==J?void 0:J.value)||(null==k?void 0:k.schema)&&Sampler.sample(null==k?void 0:k.schema.rawSchema,q,g),Y=null==k?void 0:k.name.toLowerCase(),Q="",B=[];switch(normalizeMimeType(Y)){case MediaTypes.JSON:Q=JSON.stringify(getDataRequest(L,E));break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:Q=stringifyQueryString(getDataRequest(L,E)),B=objectToHarParams(getDataRequest(L,E));break;default:Q=String(L||"")}var K=Q?{mimeType:(null==k?void 0:k.name)||MediaTypes.OCTET_STREAM,text:Q,params:B}:void 0;return{method:e.httpVerb,url:z,httpVersion:"HTTP/1.1",cookies:N,headers:M,queryString:U,postData:K,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:D,basicAuth:R,pathParameters:V,serverVariables:e.activeServer.variables}}var defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:__assign(__assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:__assign(__assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:__assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:__assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:__assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:__assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:__assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:__assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:__assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:__assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:__assign({},defaultOptions)}};export function getCodeSample(e){var t=e.lang,a=e.operation,r=e.exampleName,i=e.pathParams,n=e.properties,s=e.options,o=void 0===s?{}:s;try{var l=mapOperationToHAR(a,{exampleName:r,pathParams:i,properties:n,skipOptionalParameters:o.skipOptionalParameters,withOAuth2Call:o.withOAuth2Call,spec:o.spec,generatedPayloadSamplesMaxDepth:o.generatedPayloadSamplesMaxDepth}),u=new HTTPSnippet(l);return langToSnippetConfig[t]?u.convert(langToSnippetConfig[t].code,langToSnippetConfig[t].defaultTarget,__assign(__assign({},langToSnippetConfig[t].defaultOptions),o)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t){for(var a,r,i,n,s={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0},o=0,u=(null==e?void 0:e.schemes)||[];o<u.length;o++){var p=u[o],d=getSecurityDetails(p.id);switch(p.type){case"openIdConnect":null===(a=s.securityHeaders)||void 0===a||a.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":var c=d.token?(d.token.token_type||"Bearer")+" "+d.token.access_token:"Bearer <YOUR_TOKEN_HERE>";p.flows.clientCredentials&&t?s.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(p.flows.clientCredentials,p.scopes,d)):p.flows.password&&t&&s.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(p.flows.password,p.scopes,d)),null===(r=s.securityHeaders)||void 0===r||r.push({name:"Authorization",value:c});break;case"apiKey":var m=d.raw||"YOUR_API_KEY_HERE";"header"===p.in&&(null===(i=s.securityHeaders)||void 0===i||i.push({name:p.name,value:m})),"cookie"===p.in&&s.securityCookies.push({name:p.name,value:m}),"query"===p.in&&s.securityQueries.push({name:p.name,value:m});break;case"http":"basic"===p.scheme?s.basicAuth={username:d.username||"<"+StringUtility.toSnakeCase(l("tryItAuthBasicUsername"))+">",password:d.password||"<"+StringUtility.toSnakeCase(l("tryItAuthBasicPassword"))+">"}:null===(n=s.securityHeaders)||void 0===n||n.push({name:"Authorization",value:capitalizeFirst(p.scheme||"bearer")+" <YOUR_"+(p.bearerFormat||"TOKEN")+"_HERE>"})}}return s}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:a.username||"<username>"},{name:"password",value:a.password||"<password>"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,t){if(e){if("object"==typeof e)return merge(e,t,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),t,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e){for(var t=[],a=0,r=Object.entries(e);a<r.length;a++){var i=r[a],n=i[0],s=i[1];t.push({name:n,value:String(s)})}return t}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
|
|
2
2
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedThemeInterface, MediaValue } from '../redoc-lib';
|
|
2
2
|
import type { RedocProRawOptions } from './ProStore';
|
|
3
3
|
export declare function extendTheme(options: RedocProRawOptions): RedocProRawOptions;
|
|
4
|
-
interface Typography {
|
|
4
|
+
export interface Typography {
|
|
5
5
|
fontSize?: MediaValue;
|
|
6
6
|
fontWeight?: string | number;
|
|
7
7
|
fontFamily?: MediaValue | ((theme: ProTheme) => string);
|
package/lib-esm/standalone.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign}from"tslib";import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}
|
|
1
|
+
import{__assign}from"tslib";import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore,getJsUrl}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
|
|
2
2
|
//# sourceMappingURL=standalone.js.map
|
package/lib-esm/types.d.ts
CHANGED
|
@@ -12,3 +12,14 @@ export declare enum MediaTypes {
|
|
|
12
12
|
JSON = "application/json",
|
|
13
13
|
XML = "application/xml"
|
|
14
14
|
}
|
|
15
|
+
export declare type SecurityDetails = {
|
|
16
|
+
password?: string;
|
|
17
|
+
username?: string;
|
|
18
|
+
token?: {
|
|
19
|
+
token_type?: string;
|
|
20
|
+
access_token: string;
|
|
21
|
+
};
|
|
22
|
+
client_id?: string;
|
|
23
|
+
client_secret?: string;
|
|
24
|
+
scopes?: string;
|
|
25
|
+
};
|
package/lib-esm/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProStore } from './services/ProStore';
|
|
2
|
+
import type { SecurityDetails } from './types';
|
|
2
3
|
export declare const getGlobalStore: () => ProStore;
|
|
3
4
|
export declare const setGlobalStore: (store: ProStore) => ProStore;
|
|
4
5
|
export declare function debounce<T extends unknown>(fn: (...args: T[]) => void, threshold: number, leading?: boolean): (...args: T[]) => void;
|
|
@@ -8,18 +9,6 @@ export declare function setParameterValue(_in: string, name: string, value: Gene
|
|
|
8
9
|
export declare function getParameterValue(_in: string, name: string): string | null;
|
|
9
10
|
export declare function toLocalStorage(key: string, value: string): void;
|
|
10
11
|
export declare function fromLocalStorage<T extends string>(key: string): T;
|
|
11
|
-
export declare function useDimensions(node?: HTMLElement | null): [DOMRect | null];
|
|
12
|
-
export declare type SecurityDetails = {
|
|
13
|
-
password?: string;
|
|
14
|
-
username?: string;
|
|
15
|
-
token?: {
|
|
16
|
-
token_type?: string;
|
|
17
|
-
access_token: string;
|
|
18
|
-
};
|
|
19
|
-
client_id?: string;
|
|
20
|
-
client_secret?: string;
|
|
21
|
-
scopes?: string;
|
|
22
|
-
};
|
|
23
12
|
export declare function escapeFormId(id: string): string;
|
|
24
13
|
export declare function unescapeFormId(id: string): string;
|
|
25
14
|
export declare function setSecurityDetails(name: string, details: SecurityDetails | string): void;
|
|
@@ -38,3 +27,4 @@ export declare function get<T>(object: GenericObject, path: string | Array<strin
|
|
|
38
27
|
export declare function joinStringFactory(separator: string): (...args: (string | undefined)[]) => string;
|
|
39
28
|
export declare const dottedString: (...args: (string | undefined)[]) => string;
|
|
40
29
|
export declare function getWindowReferenceOptions<T>(option: string): T | null;
|
|
30
|
+
export declare function getJsUrl(): string;
|
package/lib-esm/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{IS_BROWSER}from"./redoc-lib/src/utils/";var _store;export var getGlobalStore=function(){return _store};export var setGlobalStore=function(e){return _store=e};export function debounce(e,t,r){var o,n=0;return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];function s(){n>1&&e.apply(void 0,i),n=0,o=null}n++,o?clearTimeout(o):r&&e.apply(void 0,i),o=setTimeout(s,t)}}export function toSessionStorage(e,t){IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}export function fromSessionStorage(e){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}export function setParameterValue(e,t,r){toSessionStorage(e+"."+t,JSON.stringify(r))}export function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}export function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}export function fromLocalStorage(e){return IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}export function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}export function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}export function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}export function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}export function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),r=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:r&&JSON.parse(r)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}export function getSecurityDetailsOptions(e,t){var r=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!r)return null;var o=JSON.parse(r);return o&&Array.isArray(o)?o.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}export function get(e,t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:r}),e)}export function joinStringFactory(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter(Boolean).join(e)}}export var dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";var t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+t+'"><\/script>'),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/reference-docs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "Redocly Reference Docs",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"@types/dompurify": "^2.0.2",
|
|
106
106
|
"@types/enzyme-to-json": "^1.5.3",
|
|
107
107
|
"@types/jest": "^25.1.4",
|
|
108
|
+
"@types/jest-when": "^3.5.2",
|
|
108
109
|
"@types/json-pointer": "^1.0.30",
|
|
109
110
|
"@types/mark.js": "^8.11.5",
|
|
110
111
|
"@types/marked": "^4.0.1",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { OperationModel, Server } from '../../redoc-lib';
|
|
3
|
-
import type { DropdownOption } from '../common/Dropdown';
|
|
4
|
-
export interface ServerDropdownProps {
|
|
5
|
-
operation: OperationModel;
|
|
6
|
-
onChange: (server: Server) => void;
|
|
7
|
-
}
|
|
8
|
-
export interface ServerDropdownState {
|
|
9
|
-
activeIdx: number;
|
|
10
|
-
variables?: {
|
|
11
|
-
[name: string]: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare class ServerChooser extends React.Component<ServerDropdownProps, ServerDropdownState> {
|
|
15
|
-
state: {
|
|
16
|
-
activeIdx: number;
|
|
17
|
-
variables: {};
|
|
18
|
-
};
|
|
19
|
-
static getDerivedStateFromProps(props: ServerDropdownProps): ServerDropdownState;
|
|
20
|
-
handleServerChange: (option: DropdownOption) => void;
|
|
21
|
-
handleVariableChange: (name: string, rawValue: string) => void;
|
|
22
|
-
componentDidMount(): void;
|
|
23
|
-
render(): JSX.Element;
|
|
24
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServerChooser=void 0;var tslib_1=require("tslib"),React=(0,tslib_1.__importStar)(require("react")),mobx_react_1=require("mobx-react"),redoc_lib_1=require("../../redoc-lib"),utils_1=require("../../utils"),form_1=require("../common/form"),Dropdown_1=require("../common/Dropdown"),utils_2=require("./utils"),ServerVariable_1=(0,tslib_1.__importDefault)(require("./ServerVariable")),ServerChooser=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(r,"state",{enumerable:!0,configurable:!0,writable:!0,value:{activeIdx:0,variables:{}}}),Object.defineProperty(r,"handleServerChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=r.props.operation.servers.find((function(r){return r.url===e.serverUrl})),a=(0,utils_2.getDefaultOrStoredVariables)(t);r.props.onChange({url:e.serverUrl||"",variables:a}),(0,utils_1.toSessionStorage)("serverUrl",e.serverUrl||""),r.setState({variables:a})}}),Object.defineProperty(r,"handleVariableChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t){var a,i=r.props.operation.servers[r.state.activeIdx],l=t||""===t?t:(0,utils_2.getDefaultOrStoredVariables)(i)[e],n=(0,tslib_1.__assign)((0,tslib_1.__assign)({},r.state.variables),((a={})[e]=l,a));r.setState({variables:n}),(0,utils_2.updateVariablesStorage)(e,l),r.props.onChange((0,tslib_1.__assign)((0,tslib_1.__assign)({},i),{variables:n}))}}),r}return(0,tslib_1.__extends)(r,e),Object.defineProperty(r,"getDerivedStateFromProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.operation,t=(0,utils_1.fromSessionStorage)("serverUrl"),a=r.servers.findIndex((function(e){return e.url===t}));return{activeIdx:a<0?0:a}}}),Object.defineProperty(r.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(0,utils_2.getServerWithVariables)(this.props.operation.servers,this.state.activeIdx);this.props.onChange(e),this.setState({variables:e.variables})}}),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,r=this.state.activeIdx,t=this.props.operation.servers.map((function(r,t){return{idx:t,serverUrl:r.url,value:"\n "+(0,utils_2.expandDefaultServerVariables)((0,utils_2.expandVariables)(r.url,e.state.variables),r.variables)+"\n - "+(r.description||"Default")+"\n "}})),a=Object.keys(this.state.variables);return React.createElement(ServerDropdownWrap,null,React.createElement(form_1.FormLabel,{htmlFor:"server"},"Target server: "),React.createElement(form_1.FormControl,null,React.createElement(Dropdown_1.Dropdown,{variant:"dark",value:t[r].value,options:t,fullWidth:!0,onChange:this.handleServerChange})),a.length?a.map((function(r){var t,a=null===(t=e.props.operation.servers[e.state.activeIdx].variables)||void 0===t?void 0:t[r];if(a)return React.createElement(ServerVariable_1.default,{key:r,name:r,value:e.state.variables[r],defaultValue:a.default,onChange:function(t){return e.handleVariableChange(r,t)},variableEnum:a.enum,description:a.description})})):null)}}),r=(0,tslib_1.__decorate)([mobx_react_1.observer],r)}(React.Component);exports.ServerChooser=ServerChooser;var templateObject_1,ServerDropdownWrap=redoc_lib_1.styled.div(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(["\n margin-top: 20px;\n"],["\n margin-top: 20px;\n"])));
|
|
2
|
-
//# sourceMappingURL=ServerDropdown.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wrapper=exports.HeadersCaption=void 0;var templateObject_1,templateObject_2,tslib_1=require("tslib"),common_elements_1=require("../../common-elements"),styled_components_1=(0,tslib_1.__importDefault)(require("../../styled-components"));exports.HeadersCaption=(0,styled_components_1.default)(common_elements_1.FieldsGroupHeader.withComponent("caption"))(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"],["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"]))),exports.Wrapper=styled_components_1.default.div(templateObject_2||(templateObject_2=(0,tslib_1.__makeTemplateObject)(["\n margin-bottom: 1em;\n"],["\n margin-bottom: 1em;\n"])));
|
|
2
|
-
//# sourceMappingURL=styled.elements.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { OperationModel, Server } from '../../redoc-lib';
|
|
3
|
-
import type { DropdownOption } from '../common/Dropdown';
|
|
4
|
-
export interface ServerDropdownProps {
|
|
5
|
-
operation: OperationModel;
|
|
6
|
-
onChange: (server: Server) => void;
|
|
7
|
-
}
|
|
8
|
-
export interface ServerDropdownState {
|
|
9
|
-
activeIdx: number;
|
|
10
|
-
variables?: {
|
|
11
|
-
[name: string]: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare class ServerChooser extends React.Component<ServerDropdownProps, ServerDropdownState> {
|
|
15
|
-
state: {
|
|
16
|
-
activeIdx: number;
|
|
17
|
-
variables: {};
|
|
18
|
-
};
|
|
19
|
-
static getDerivedStateFromProps(props: ServerDropdownProps): ServerDropdownState;
|
|
20
|
-
handleServerChange: (option: DropdownOption) => void;
|
|
21
|
-
handleVariableChange: (name: string, rawValue: string) => void;
|
|
22
|
-
componentDidMount(): void;
|
|
23
|
-
render(): JSX.Element;
|
|
24
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{observer}from"mobx-react";import{styled}from"../../redoc-lib";import{fromSessionStorage,toSessionStorage}from"../../utils";import{FormControl,FormLabel}from"../common/form";import{Dropdown}from"../common/Dropdown";import{expandDefaultServerVariables,expandVariables,getServerWithVariables,getDefaultOrStoredVariables,updateVariablesStorage}from"./utils";import ServerVariable from"./ServerVariable";var ServerChooser=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(r,"state",{enumerable:!0,configurable:!0,writable:!0,value:{activeIdx:0,variables:{}}}),Object.defineProperty(r,"handleServerChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var a=r.props.operation.servers.find((function(r){return r.url===e.serverUrl})),t=getDefaultOrStoredVariables(a);r.props.onChange({url:e.serverUrl||"",variables:t}),toSessionStorage("serverUrl",e.serverUrl||""),r.setState({variables:t})}}),Object.defineProperty(r,"handleVariableChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e,a){var t,o=r.props.operation.servers[r.state.activeIdx],n=a||""===a?a:getDefaultOrStoredVariables(o)[e],i=__assign(__assign({},r.state.variables),((t={})[e]=n,t));r.setState({variables:i}),updateVariablesStorage(e,n),r.props.onChange(__assign(__assign({},o),{variables:i}))}}),r}return __extends(r,e),Object.defineProperty(r,"getDerivedStateFromProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.operation,a=fromSessionStorage("serverUrl"),t=r.servers.findIndex((function(e){return e.url===a}));return{activeIdx:t<0?0:t}}}),Object.defineProperty(r.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=getServerWithVariables(this.props.operation.servers,this.state.activeIdx);this.props.onChange(e),this.setState({variables:e.variables})}}),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,r=this.state.activeIdx,a=this.props.operation.servers.map((function(r,a){return{idx:a,serverUrl:r.url,value:"\n "+expandDefaultServerVariables(expandVariables(r.url,e.state.variables),r.variables)+"\n - "+(r.description||"Default")+"\n "}})),t=Object.keys(this.state.variables);return React.createElement(ServerDropdownWrap,null,React.createElement(FormLabel,{htmlFor:"server"},"Target server: "),React.createElement(FormControl,null,React.createElement(Dropdown,{variant:"dark",value:a[r].value,options:a,fullWidth:!0,onChange:this.handleServerChange})),t.length?t.map((function(r){var a,t=null===(a=e.props.operation.servers[e.state.activeIdx].variables)||void 0===a?void 0:a[r];if(t)return React.createElement(ServerVariable,{key:r,name:r,value:e.state.variables[r],defaultValue:t.default,onChange:function(a){return e.handleVariableChange(r,a)},variableEnum:t.enum,description:t.description})})):null)}}),r=__decorate([observer],r)}(React.Component);export{ServerChooser};var templateObject_1,ServerDropdownWrap=styled.div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n margin-top: 20px;\n"],["\n margin-top: 20px;\n"])));
|
|
2
|
-
//# sourceMappingURL=ServerDropdown.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{__makeTemplateObject}from"tslib";import{FieldsGroupHeader}from"../../common-elements";import styled from"../../styled-components";export var HeadersCaption=styled(FieldsGroupHeader.withComponent("caption"))(templateObject_1||(templateObject_1=__makeTemplateObject(["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"],["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"])));export var Wrapper=styled.div(templateObject_2||(templateObject_2=__makeTemplateObject(["\n margin-bottom: 1em;\n"],["\n margin-bottom: 1em;\n"])));var templateObject_1,templateObject_2;
|
|
2
|
-
//# sourceMappingURL=styled.elements.js.map
|