@redocly/openapi-docs 0.0.0-beta-20240418154932 → 0.0.0-beta-20240419154705
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 +1245 -1295
- package/lib/components/Callbacks/CallbackSummary.js +1 -1
- package/lib/components/Download/DownloadSpecification.js +11 -10
- package/lib/components/Download/types.d.ts +10 -12
- package/lib/components/Download/useDownloadInfo.d.ts +1 -1
- package/lib/components/Download/useDownloadInfo.js +1 -1
- package/lib/components/Language/styled.d.ts +15 -2
- package/lib/components/Markdown/index.d.ts +0 -1
- package/lib/components/Markdown/index.js +1 -1
- package/lib/components/Panel/ResponsePanel.js +1 -8
- package/lib/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
- package/lib/components/RedoclyOpenAPIDocs/types.d.ts +1 -0
- package/lib/components/RequestSamples/CodeSample.js +1 -1
- package/lib/components/Samples/ExampleSwitch.js +1 -1
- package/lib/components/Schema/ArraySchema.js +1 -1
- package/lib/components/Schema/ObjectSchema.js +1 -1
- package/lib/components/Schema/helpers.d.ts +4 -0
- package/lib/components/Schema/helpers.js +1 -1
- package/lib/components/ServerListDropdown/ServerListDropdown.js +1 -1
- package/lib/components/SideMenu/SideMenu.d.ts +1 -0
- package/lib/components/SideMenu/SideMenu.js +3 -1
- package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
- package/lib/components/SideMenu/index.d.ts +0 -1
- package/lib/components/SideMenu/index.js +1 -1
- package/lib/components/SideMenu/types.d.ts +1 -15
- package/lib/components/StickySidebar/SidebarActions.d.ts +1 -0
- package/lib/components/StickySidebar/SidebarActions.js +6 -0
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +2 -2
- package/lib/components/TagItem/OperationsNavigation.js +1 -1
- package/lib/components/common/index.d.ts +1 -1
- package/lib/components/common/index.js +1 -1
- package/lib/components/common/styled.d.ts +3 -0
- package/lib/components/common/styled.js +22 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +1 -1
- package/lib/services/code-samples/generator.js +1 -1
- package/lib/services/config-options/normalizeOptions.js +1 -1
- package/lib/services/config-options/types.d.ts +5 -20
- package/lib/services/menu/builder.js +1 -1
- package/lib/utils/argValuesHelpers.d.ts +1 -1
- package/lib/utils/argValuesHelpers.js +1 -1
- package/lib-esm/components/Callbacks/CallbackSummary.js +1 -1
- package/lib-esm/components/Download/DownloadSpecification.js +11 -10
- package/lib-esm/components/Download/types.d.ts +10 -12
- package/lib-esm/components/Download/useDownloadInfo.d.ts +1 -1
- package/lib-esm/components/Download/useDownloadInfo.js +1 -1
- package/lib-esm/components/Language/styled.d.ts +15 -2
- package/lib-esm/components/Markdown/index.d.ts +0 -1
- package/lib-esm/components/Markdown/index.js +1 -1
- package/lib-esm/components/Panel/ResponsePanel.js +1 -8
- package/lib-esm/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -1
- package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
- package/lib-esm/components/RedoclyOpenAPIDocs/types.d.ts +1 -0
- package/lib-esm/components/RequestSamples/CodeSample.js +1 -1
- package/lib-esm/components/Samples/ExampleSwitch.js +1 -1
- package/lib-esm/components/Schema/ArraySchema.js +1 -1
- package/lib-esm/components/Schema/ObjectSchema.js +1 -1
- package/lib-esm/components/Schema/helpers.d.ts +4 -0
- package/lib-esm/components/Schema/helpers.js +1 -1
- package/lib-esm/components/ServerListDropdown/ServerListDropdown.js +1 -1
- package/lib-esm/components/SideMenu/SideMenu.d.ts +1 -0
- package/lib-esm/components/SideMenu/SideMenu.js +3 -1
- package/lib-esm/components/SideMenu/hooks/useMenuItems.js +1 -1
- package/lib-esm/components/SideMenu/index.d.ts +0 -1
- package/lib-esm/components/SideMenu/index.js +1 -1
- package/lib-esm/components/SideMenu/types.d.ts +1 -15
- package/lib-esm/components/StickySidebar/SidebarActions.d.ts +1 -0
- package/lib-esm/components/StickySidebar/SidebarActions.js +6 -0
- package/lib-esm/components/StickySidebar/StickyResponsiveSidebar.js +2 -2
- package/lib-esm/components/TagItem/OperationsNavigation.js +1 -1
- package/lib-esm/components/common/index.d.ts +1 -1
- package/lib-esm/components/common/index.js +1 -1
- package/lib-esm/components/common/styled.d.ts +3 -0
- package/lib-esm/components/common/styled.js +22 -1
- package/lib-esm/components/index.d.ts +0 -1
- package/lib-esm/components/index.js +1 -1
- package/lib-esm/services/code-samples/generator.js +1 -1
- package/lib-esm/services/config-options/normalizeOptions.js +1 -1
- package/lib-esm/services/config-options/types.d.ts +5 -20
- package/lib-esm/services/menu/builder.js +1 -1
- package/lib-esm/utils/argValuesHelpers.d.ts +1 -1
- package/lib-esm/utils/argValuesHelpers.js +1 -1
- package/package.json +4 -4
- package/lib/components/ExpandAllButton/_tests_/getAllNestedSchema.test.d.ts +0 -1
- package/lib/components/ExpandAllButton/_tests_/getAllNestedSchema.test.js +0 -2
- package/lib/components/ExpandAllButton/_tests_/schemas.d.ts +0 -4
- package/lib/components/ExpandAllButton/_tests_/schemas.js +0 -2
- package/lib/components/Markdown/styled.d.ts +0 -5
- package/lib/components/Markdown/styled.js +0 -2
- package/lib/components/SecuritySchemes/OAuthFlow.d.ts +0 -3
- package/lib/components/SecuritySchemes/OAuthFlow.js +0 -2
- package/lib/components/SecuritySchemes/helpers.d.ts +0 -34
- package/lib/components/SecuritySchemes/helpers.js +0 -2
- package/lib/components/SecuritySchemes/index.d.ts +0 -2
- package/lib/components/SecuritySchemes/index.js +0 -2
- package/lib/components/SecuritySchemes/styled.d.ts +0 -5
- package/lib/components/SecuritySchemes/styled.js +0 -26
- package/lib/components/SecuritySchemes/types.d.ts +0 -5
- package/lib/components/SecuritySchemes/types.js +0 -2
- package/lib/components/SeeMore/SeeMore.d.ts +0 -7
- package/lib/components/SeeMore/SeeMore.js +0 -10
- package/lib/components/SeeMore/index.d.ts +0 -1
- package/lib/components/SeeMore/index.js +0 -2
- package/lib/components/SideMenu/Actions.d.ts +0 -1
- package/lib/components/SideMenu/Actions.js +0 -6
- package/lib/components/SideMenu/MenuItemEternalLink.d.ts +0 -5
- package/lib/components/SideMenu/MenuItemEternalLink.js +0 -2
- package/lib/components/SideMenu/hooks/index.d.ts +0 -2
- package/lib/components/SideMenu/hooks/index.js +0 -2
- package/lib/components/SideMenu/hooks/useMenuItemExpanded.d.ts +0 -3
- package/lib/components/SideMenu/hooks/useMenuItemExpanded.js +0 -2
- package/lib/components/SideMenu/styled.d.ts +0 -24
- package/lib/components/SideMenu/styled.js +0 -63
- package/lib/components/shared/HttpVerb.d.ts +0 -2
- package/lib/components/shared/HttpVerb.js +0 -13
- package/lib/components/shared/MimeLabel.d.ts +0 -1
- package/lib/components/shared/MimeLabel.js +0 -12
- package/lib/components/shared/index.d.ts +0 -2
- package/lib/components/shared/index.js +0 -2
- package/lib-esm/components/ExpandAllButton/_tests_/getAllNestedSchema.test.d.ts +0 -1
- package/lib-esm/components/ExpandAllButton/_tests_/getAllNestedSchema.test.js +0 -2
- package/lib-esm/components/ExpandAllButton/_tests_/schemas.d.ts +0 -4
- package/lib-esm/components/ExpandAllButton/_tests_/schemas.js +0 -2
- package/lib-esm/components/Markdown/styled.d.ts +0 -5
- package/lib-esm/components/Markdown/styled.js +0 -2
- package/lib-esm/components/SecuritySchemes/OAuthFlow.d.ts +0 -3
- package/lib-esm/components/SecuritySchemes/OAuthFlow.js +0 -2
- package/lib-esm/components/SecuritySchemes/helpers.d.ts +0 -34
- package/lib-esm/components/SecuritySchemes/helpers.js +0 -2
- package/lib-esm/components/SecuritySchemes/index.d.ts +0 -2
- package/lib-esm/components/SecuritySchemes/index.js +0 -2
- package/lib-esm/components/SecuritySchemes/styled.d.ts +0 -5
- package/lib-esm/components/SecuritySchemes/styled.js +0 -26
- package/lib-esm/components/SecuritySchemes/types.d.ts +0 -5
- package/lib-esm/components/SecuritySchemes/types.js +0 -2
- package/lib-esm/components/SeeMore/SeeMore.d.ts +0 -7
- package/lib-esm/components/SeeMore/SeeMore.js +0 -10
- package/lib-esm/components/SeeMore/index.d.ts +0 -1
- package/lib-esm/components/SeeMore/index.js +0 -2
- package/lib-esm/components/SideMenu/Actions.d.ts +0 -1
- package/lib-esm/components/SideMenu/Actions.js +0 -6
- package/lib-esm/components/SideMenu/MenuItemEternalLink.d.ts +0 -5
- package/lib-esm/components/SideMenu/MenuItemEternalLink.js +0 -2
- package/lib-esm/components/SideMenu/hooks/index.d.ts +0 -2
- package/lib-esm/components/SideMenu/hooks/index.js +0 -2
- package/lib-esm/components/SideMenu/hooks/useMenuItemExpanded.d.ts +0 -3
- package/lib-esm/components/SideMenu/hooks/useMenuItemExpanded.js +0 -2
- package/lib-esm/components/SideMenu/styled.d.ts +0 -24
- package/lib-esm/components/SideMenu/styled.js +0 -63
- package/lib-esm/components/shared/HttpVerb.d.ts +0 -2
- package/lib-esm/components/shared/HttpVerb.js +0 -13
- package/lib-esm/components/shared/MimeLabel.d.ts +0 -1
- package/lib-esm/components/shared/MimeLabel.js +0 -12
- package/lib-esm/components/shared/index.d.ts +0 -2
- package/lib-esm/components/shared/index.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var s=Object.getOwnPropertyDescriptor(t,a);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,s)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&__createBinding(t,e,a);return __setModuleDefault(t,e),t},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.capitalizeFirst=exports.isDefined=exports.getCodeSample=void 0;const Sampler=__importStar(require("openapi-sampler")),deepmerge_1=__importDefault(require("deepmerge")),utils_1=require("../../utils"),utils_2=require("../utils"),constants_1=require("../../constants"),httpsnippet_1=require("./httpsnippet"),mediaContent_1=require("../../models/mediaContent");function mapOperationToHAR(e,{exampleName:t="",skipOptionalParameters:a=!1,withOAuth2Call:r=!1,spec:s,generatedPayloadSamplesMaxDepth:i=8,pathParams:n={},properties:o={}},{environment:l,requestValues:u}){var p,c,d;const m=l.server,f=e.servers.find((e=>e.url===m))||e.servers[0],{securityHeaders:h,securityCookies:_,securityQueries:O,securityOAuth2ExtraCalls:g,basicAuth:v}=getSecurityData(null===(p=e.security)||void 0===p?void 0:p[0],r,l),y=(null===(c=null==e?void 0:e.requestBody)||void 0===c?void 0:c.content)&&(0,mediaContent_1.getActiveMediaType)(e.requestBody.content),T={skipNonRequired:a,skipReadOnly:!0,maxSampleDepth:i},S=u;let C=!1;const b=e.parameters.filter((e=>"header"===e.in)).filter((e=>!(a&&!e.required))).map((e=>{var t;return{name:e.name,value:(null===(t=S.header)||void 0===t?void 0:t[e.name])||(0,utils_1.getParameterValue)("header",e.name)||(0,utils_1.serializeParameterValue)(e,Sampler.sample(e.schema.rawSchema,T,s))}})).map((e=>((null==y?void 0:y.name)&&"content-type"===e.name.toLowerCase()&&(C=!0,e.value=y.name),e))).concat(h);!C&&(null==y?void 0:y.name)&&b.unshift({name:"Content-Type",value:null==y?void 0:y.name});const D=e.parameters.filter((e=>"cookie"===e.in)).filter((e=>!(a&&!e.required))).map((e=>utils_1.queryString.parse((0,utils_1.serializeParameterValue)(e,Sampler.sample(e.schema.rawSchema,T,s))))).reduce(((e,t)=>{var a;for(const[r,s]of Object.entries(t))e.push({name:r,value:String((null===(a=S.cookie)||void 0===a?void 0:a[r])||s)});return e}),[]).concat(_),E=e.parameters.filter((e=>"query"===e.in)).filter((e=>!(a&&!e.required))).map((e=>utils_1.queryString.parse((0,utils_1.serializeParameterValue)(e,Sampler.sample(e.schema.rawSchema,T,s))))).reduce(((e,t)=>{var a,r,s;for(const[i,n]of Object.entries(t))e.push({name:i,value:(0,utils_1.isArrayOfObjects)(null===(a=S.query)||void 0===a?void 0:a[i])&&JSON.stringify((0,utils_1.deleteEmptyArrayItem)(null===(r=S.query)||void 0===r?void 0:r[i]))||String((null===(s=S.query)||void 0===s?void 0:s[i])||n)});return e}),[]).concat(O),j=`${null==f?void 0:f.url.replace(/\/$/,"")}/${e.path.replace(/^\//,"")}`,P=e.parameters.filter((e=>"path"===e.in)).reduce(((e,t)=>{var a;const{in:r,name:s}=t;return e[s]=(null===(a=S.path)||void 0===a?void 0:a[s])||n[s]||(0,utils_1.getParameterValue)(r,s),e}),{}),w=null===(d=null==y?void 0:y.examples)||void 0===d?void 0:d[t],A=(null==y?void 0:y.examples)||{},[q]=Object.values(A),R=S.body||(null==w?void 0:w.value)||(null==q?void 0:q.value)||(null==y?void 0:y.schema)&&Sampler.sample(null==y?void 0:y.schema.rawSchema,T,s),M=null==y?void 0:y.name.toLowerCase();let k="",x=[];switch((0,utils_2.normalizeMimeType)(M)){case constants_1.MediaTypes.JSON:case constants_1.MediaTypes.XML:k=JSON.stringify(getDataRequest(R,o));break;case constants_1.MediaTypes.URL_ENCODED:case constants_1.MediaTypes.MULTIPART:k=utils_1.queryString.stringify(getDataRequest(R,o)),x=objectToHarParams(getDataRequest(R,o));break;default:k=String(R||"")}const N=k?{mimeType:(null==y?void 0:y.name)||constants_1.MediaTypes.OCTET_STREAM,text:k,params:x}:void 0,H=e.responses.map((e=>e.code));return{method:e.httpVerb,url:j,httpVersion:"HTTP/1.1",cookies:D,headers:b,queryString:E,postData:N,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:g,basicAuth:v,pathParameters:P,serverVariables:l,allResponseCodes:H}}const defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:Object.assign(Object.assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:Object.assign(Object.assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:Object.assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:Object.assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:Object.assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#+Newtonsoft":{code:"csharpNewtonsoft",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:Object.assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:Object.assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:Object.assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:Object.assign({},defaultOptions)}};function getCodeSample({lang:e,operation:t,exampleName:a,pathParams:r,properties:s,options:i={},environment:n}){try{const{skipOptionalParameters:o,withOAuth2Call:l,spec:u,generatedPayloadSamplesMaxDepth:p,store:c}=i,d=mapOperationToHAR(t,{exampleName:a,pathParams:r,properties:s,skipOptionalParameters:o,withOAuth2Call:l,spec:u,generatedPayloadSamplesMaxDepth:p},{environment:n,requestValues:c.requestValues}),m=new httpsnippet_1.HTTPSnippet(d);return langToSnippetConfig[e]?m.convert(langToSnippetConfig[e].code,langToSnippetConfig[e].defaultTarget,Object.assign(Object.assign({},langToSnippetConfig[e].defaultOptions),i)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t,a){var r,s,i,n;const o={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0};for(const l of(null==e?void 0:e.schemes)||[]){const e=(0,utils_1.getSecurityDetails)(l.id,a);switch(l.type){case"openIdConnect":null===(r=o.securityHeaders)||void 0===r||r.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const a=e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";l.flows.clientCredentials&&t?o.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(l.flows.clientCredentials,l.scopes,e)):l.flows.password&&t&&o.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(l.flows.password,l.scopes,e)),null===(s=o.securityHeaders)||void 0===s||s.push({name:"Authorization",value:a});break}case"apiKey":{const t=e.raw||"YOUR_API_KEY_HERE";"header"===l.in&&(null===(i=o.securityHeaders)||void 0===i||i.push({name:l.name,value:t})),"cookie"===l.in&&o.securityCookies.push({name:l.name,value:t}),"query"===l.in&&o.securityQueries.push({name:l.name,value:t});break}case"http":"basic"===l.scheme?o.basicAuth={username:String(e.username),password:String(e.password)}:null===(n=o.securityHeaders)||void 0===n||n.push({name:"Authorization",value:`${capitalizeFirst(l.scheme||"bearer")} <YOUR_${l.bearerFormat||"TOKEN"}_HERE>`})}}return o}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:constants_1.MediaTypes.URL_ENCODED},{name:"Accept",value:constants_1.MediaTypes.JSON}],queryString:[],postData:{mimeType:constants_1.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:constants_1.MediaTypes.URL_ENCODED},{name:"Accept",value:constants_1.MediaTypes.JSON}],queryString:[],postData:{mimeType:constants_1.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(0,deepmerge_1.default)(e,t,{arrayMerge:utils_2.arrayMergeStrategy});try{return(0,deepmerge_1.default)(JSON.parse(e),t,{arrayMerge:utils_2.arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e,t=""){const a=[];for(const[r,s]of Object.entries(e)){const e=t?`${t}[${r}]`:r;"object"==typeof s&&null!==s?a.push(...objectToHarParams(s,e)):a.push({name:e,value:String(s)})}return a}function isDefined(e){return void 0!==e}function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}exports.getCodeSample=getCodeSample,exports.isDefined=isDefined,exports.capitalizeFirst=capitalizeFirst;
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var s=Object.getOwnPropertyDescriptor(t,a);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,s)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&__createBinding(t,e,a);return __setModuleDefault(t,e),t},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.capitalizeFirst=exports.isDefined=exports.getCodeSample=void 0;const Sampler=__importStar(require("openapi-sampler")),deepmerge_1=__importDefault(require("deepmerge")),utils_1=require("../../utils"),utils_2=require("../utils"),constants_1=require("../../constants"),httpsnippet_1=require("./httpsnippet"),mediaContent_1=require("../../models/mediaContent");function mapOperationToHAR(e,{exampleName:t="",skipOptionalParameters:a=!1,withOAuth2Call:r=!1,spec:s,generatedPayloadSamplesMaxDepth:i=8,pathParams:n={},properties:o={}},{environment:l,requestValues:u}){var p,c,d;const m=l.server,f=e.servers.find((e=>e.url===m))||e.servers[0],{securityHeaders:h,securityCookies:_,securityQueries:O,securityOAuth2ExtraCalls:g,basicAuth:v}=getSecurityData(null===(p=e.security)||void 0===p?void 0:p[0],r,l),y=(null===(c=null==e?void 0:e.requestBody)||void 0===c?void 0:c.content)&&(0,mediaContent_1.getActiveMediaType)(e.requestBody.content),T={skipNonRequired:a,skipReadOnly:!0,maxSampleDepth:i},S=u;let C=!1;const b=e.parameters.filter((e=>"header"===e.in)).filter((e=>!(a&&!e.required))).map((e=>{var t;return{name:e.name,value:(null===(t=S.header)||void 0===t?void 0:t[e.name])||(0,utils_1.getParameterValue)("header",e.name)||(0,utils_1.serializeParameterValue)(e,Sampler.sample(e.schema.rawSchema,T,s))}})).map((e=>((null==y?void 0:y.name)&&"content-type"===e.name.toLowerCase()&&(C=!0,e.value=y.name),e))).concat(h);!C&&(null==y?void 0:y.name)&&b.unshift({name:"Content-Type",value:null==y?void 0:y.name});const D=e.parameters.filter((e=>"cookie"===e.in)).filter((e=>!(a&&!e.required))).map((e=>utils_1.queryString.parse((0,utils_1.serializeParameterValue)(e,Sampler.sample(e.schema.rawSchema,T,s))))).reduce(((e,t)=>{var a;for(const[r,s]of Object.entries(t))e.push({name:r,value:String((null===(a=S.cookie)||void 0===a?void 0:a[r])||s)});return e}),[]).concat(_),E=e.parameters.filter((e=>"query"===e.in)).filter((e=>!(a&&!e.required))).map((e=>utils_1.queryString.parse((0,utils_1.serializeParameterValue)(e,Sampler.sample(e.schema.rawSchema,T,s))))).reduce(((e,t)=>{var a,r,s;for(const[i,n]of Object.entries(t))e.push({name:i,value:(0,utils_1.isArrayOfObjects)(null===(a=S.query)||void 0===a?void 0:a[i])&&JSON.stringify((0,utils_1.deleteEmptyArrayItem)(null===(r=S.query)||void 0===r?void 0:r[i]))||String((null===(s=S.query)||void 0===s?void 0:s[i])||n)});return e}),[]).concat(O),j=`${null==f?void 0:f.url.replace(/\/$/,"")}/${e.path.replace(/^\//,"")}`,P=e.parameters.filter((e=>"path"===e.in)).reduce(((e,t)=>{var a;const{in:r,name:s}=t;return e[s]=(null===(a=S.path)||void 0===a?void 0:a[s])||n[s]||(0,utils_1.getParameterValue)(r,s),e}),{}),w=null===(d=null==y?void 0:y.examples)||void 0===d?void 0:d[t],A=(null==y?void 0:y.examples)||{},[q]=Object.values(A),R=(null==S?void 0:S.body)||(null==w?void 0:w.value)||(null==q?void 0:q.value)||(null==y?void 0:y.schema)&&Sampler.sample(null==y?void 0:y.schema.rawSchema,T,s),M=null==y?void 0:y.name.toLowerCase();let k="",x=[];switch((0,utils_2.normalizeMimeType)(M)){case constants_1.MediaTypes.JSON:case constants_1.MediaTypes.XML:k=JSON.stringify(getDataRequest(R,o));break;case constants_1.MediaTypes.URL_ENCODED:case constants_1.MediaTypes.MULTIPART:k=utils_1.queryString.stringify(getDataRequest(R,o)),x=objectToHarParams(getDataRequest(R,o));break;default:k=String(R||"")}const N=k?{mimeType:(null==y?void 0:y.name)||constants_1.MediaTypes.OCTET_STREAM,text:k,params:x}:void 0,H=e.responses.map((e=>e.code));return{method:e.httpVerb,url:j,httpVersion:"HTTP/1.1",cookies:D,headers:b,queryString:E,postData:N,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:g,basicAuth:v,pathParameters:P,serverVariables:l,allResponseCodes:H}}const defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:Object.assign(Object.assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:Object.assign(Object.assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:Object.assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:Object.assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:Object.assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#+Newtonsoft":{code:"csharpNewtonsoft",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:Object.assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:Object.assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:Object.assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:Object.assign({},defaultOptions)}};function getCodeSample({lang:e,operation:t,exampleName:a,pathParams:r,properties:s,options:i={},environment:n}){try{const{skipOptionalParameters:o,withOAuth2Call:l,spec:u,generatedPayloadSamplesMaxDepth:p,store:c}=i,d=mapOperationToHAR(t,{exampleName:a,pathParams:r,properties:s,skipOptionalParameters:o,withOAuth2Call:l,spec:u,generatedPayloadSamplesMaxDepth:p},{environment:n,requestValues:c.requestValues}),m=new httpsnippet_1.HTTPSnippet(d);return langToSnippetConfig[e]?m.convert(langToSnippetConfig[e].code,langToSnippetConfig[e].defaultTarget,Object.assign(Object.assign({},langToSnippetConfig[e].defaultOptions),i)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t,a){var r,s,i,n;const o={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0};for(const l of(null==e?void 0:e.schemes)||[]){const e=(0,utils_1.getSecurityDetails)(l.id,a);switch(l.type){case"openIdConnect":null===(r=o.securityHeaders)||void 0===r||r.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const a=e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";l.flows.clientCredentials&&t?o.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(l.flows.clientCredentials,l.scopes,e)):l.flows.password&&t&&o.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(l.flows.password,l.scopes,e)),null===(s=o.securityHeaders)||void 0===s||s.push({name:"Authorization",value:a});break}case"apiKey":{const t=e.raw||"YOUR_API_KEY_HERE";"header"===l.in&&(null===(i=o.securityHeaders)||void 0===i||i.push({name:l.name,value:t})),"cookie"===l.in&&o.securityCookies.push({name:l.name,value:t}),"query"===l.in&&o.securityQueries.push({name:l.name,value:t});break}case"http":"basic"===l.scheme?o.basicAuth={username:String(e.username),password:String(e.password)}:null===(n=o.securityHeaders)||void 0===n||n.push({name:"Authorization",value:`${capitalizeFirst(l.scheme||"bearer")} <YOUR_${l.bearerFormat||"TOKEN"}_HERE>`})}}return o}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:constants_1.MediaTypes.URL_ENCODED},{name:"Accept",value:constants_1.MediaTypes.JSON}],queryString:[],postData:{mimeType:constants_1.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:constants_1.MediaTypes.URL_ENCODED},{name:"Accept",value:constants_1.MediaTypes.JSON}],queryString:[],postData:{mimeType:constants_1.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(0,deepmerge_1.default)(e,t,{arrayMerge:utils_2.arrayMergeStrategy});try{return(0,deepmerge_1.default)(JSON.parse(e),t,{arrayMerge:utils_2.arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e,t=""){const a=[];for(const[r,s]of Object.entries(e)){const e=t?`${t}[${r}]`:r;"object"==typeof s&&null!==s?a.push(...objectToHarParams(s,e)):a.push({name:e,value:String(s)})}return a}function isDefined(e){return void 0!==e}function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}exports.getCodeSample=getCodeSample,exports.isDefined=isDefined,exports.capitalizeFirst=capitalizeFirst;
|
|
2
2
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeOptions=void 0;const theme_1=require("@redocly/theme"),constants_1=require("../../constants"),utils_1=require("../../utils"),helpers_1=require("./helpers"),constants_2=require("../code-samples/constants");function normalizeOptions(e,o){var n,s,i,a,l,t,r,d,u,c,p;e=Object.assign(Object.assign(Object.assign({},o),e),{markdocOptions:Object.assign(Object.assign({},null==e?void 0:e.markdocOptions),{components:Object.assign(Object.assign({},null===(n=null==o?void 0:o.markdocOptions)||void 0===n?void 0:n.components),null===(s=null==e?void 0:e.markdocOptions)||void 0===s?void 0:s.components),tags:Object.assign(Object.assign({},null===(i=null==o?void 0:o.markdocOptions)||void 0===i?void 0:i.tags),null===(a=null==e?void 0:e.markdocOptions)||void 0===a?void 0:a.tags),nodes:Object.assign(Object.assign(Object.assign({},null===(l=null==o?void 0:o.markdocOptions)||void 0===l?void 0:l.nodes),null===(t=null==e?void 0:e.markdocOptions)||void 0===t?void 0:t.nodes),{heading:(null===(d=null===(r=null==o?void 0:o.markdocOptions)||void 0===r?void 0:r.nodes)||void 0===d?void 0:d.heading)||(null===(u=null==e?void 0:e.markdocOptions)||void 0===u?void 0:u.nodes.heading)})})});const m=Array.isArray(e.ignoreNamedSchemas)?e.ignoreNamedSchemas:null===(c=e.ignoreNamedSchemas)||void 0===c?void 0:c.split(",").map((e=>e.trim()));return{downloadUrls:e.downloadUrls,schemaDefinitionsTagName:e.schemaDefinitionsTagName,corsProxyUrl:e.corsProxyUrl&&(0,theme_1.addTrailingSlash)(e.corsProxyUrl),hideSidebar:(0,utils_1.argValueToBoolean)(e.hideSidebar,!1),jsonSamplesExpandLevel:(0,utils_1.argValueToExpandLevel)(e.jsonSamplesExpandLevel,2),generatedSamplesMaxDepth:(0,utils_1.argValueToInt)(e.generatedSamplesMaxDepth,8),hideDownloadButtons:(0,utils_1.argValueToBoolean)(e.hideDownloadButtons,!1),hideInfoMetadata:(0,utils_1.argValueToBoolean)(e.hideInfoMetadata,!1),hideLoading:(0,utils_1.argValueToBoolean)(e.hideLoading,!1),hideSchemaTitles:(0,utils_1.argValueToBoolean)(e.hideSchemaTitles,!1),maxDisplayedEnumValues:(0,utils_1.argValueToNumber)(e.maxDisplayedEnumValues),mockServer:(null===(p=e.mockServer)||void 0===p?void 0:p.url)?{url:e.mockServer.url,position:e.mockServer.position||"first",description:e.mockServer.description||"Mock server"}:void 0,oAuth2RedirectURI:e.oAuth2RedirectURI||null,onlyRequiredInSamples:(0,utils_1.argValueToBoolean)(e.onlyRequiredInSamples,!1),onDeepLinkClick:e.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK),requestInterceptor:e.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.REQUEST_INTERCEPTOR),routingBasePath:(0,theme_1.isUndefined)(e.disableRouter)?"":e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",schemasExpansionLevel:(0,utils_1.argValueToExpandLevel)(e.schemasExpansionLevel),feedback:e.feedback||{hide:!1},sortRequiredPropsFirst:(0,utils_1.argValueToBoolean)(e.sortRequiredPropsFirst,!1),scrollYOffset:(0,helpers_1.normalizeScrollYOffset)(e.scrollYOffset),showExtensions:(0,helpers_1.normalizeShowExtensions)(e.showExtensions),sanitize:(0,utils_1.argValueToBoolean)(e.sanitize,!1),skipBundle:(0,utils_1.argValueToBoolean)(e.skipBundle,!1),ignoreNamedSchemas:new Set(m),markdocOptions:null==e?void 0:e.markdocOptions,codeSamples:e.codeSamples||{languages:Object.values(constants_2.Languages).map((e=>({lang:e})))},layout:e.layout||theme_1.LayoutVariant.THREE_PANEL,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeOptions=void 0;const theme_1=require("@redocly/theme"),constants_1=require("../../constants"),utils_1=require("../../utils"),helpers_1=require("./helpers"),constants_2=require("../code-samples/constants");function normalizeOptions(e,o){var n,s,i,a,l,t,r,d,u,c,p;e=Object.assign(Object.assign(Object.assign({},o),e),{markdocOptions:Object.assign(Object.assign({},null==e?void 0:e.markdocOptions),{components:Object.assign(Object.assign({},null===(n=null==o?void 0:o.markdocOptions)||void 0===n?void 0:n.components),null===(s=null==e?void 0:e.markdocOptions)||void 0===s?void 0:s.components),tags:Object.assign(Object.assign({},null===(i=null==o?void 0:o.markdocOptions)||void 0===i?void 0:i.tags),null===(a=null==e?void 0:e.markdocOptions)||void 0===a?void 0:a.tags),nodes:Object.assign(Object.assign(Object.assign({},null===(l=null==o?void 0:o.markdocOptions)||void 0===l?void 0:l.nodes),null===(t=null==e?void 0:e.markdocOptions)||void 0===t?void 0:t.nodes),{heading:(null===(d=null===(r=null==o?void 0:o.markdocOptions)||void 0===r?void 0:r.nodes)||void 0===d?void 0:d.heading)||(null===(u=null==e?void 0:e.markdocOptions)||void 0===u?void 0:u.nodes.heading)})})});const m=Array.isArray(e.ignoreNamedSchemas)?e.ignoreNamedSchemas:null===(c=e.ignoreNamedSchemas)||void 0===c?void 0:c.split(",").map((e=>e.trim()));return{downloadUrls:e.downloadUrls,schemaDefinitionsTagName:e.schemaDefinitionsTagName,corsProxyUrl:e.corsProxyUrl&&(0,theme_1.addTrailingSlash)(e.corsProxyUrl),hideSidebar:(0,utils_1.argValueToBoolean)(e.hideSidebar,!1),jsonSamplesExpandLevel:(0,utils_1.argValueToExpandLevel)(e.jsonSamplesExpandLevel,2),generatedSamplesMaxDepth:(0,utils_1.argValueToInt)(e.generatedSamplesMaxDepth,8),hideDownloadButtons:(0,utils_1.argValueToBoolean)(e.hideDownloadButtons,!1),hideInfoMetadata:(0,utils_1.argValueToBoolean)(e.hideInfoMetadata,!1),hideLoading:(0,utils_1.argValueToBoolean)(e.hideLoading,!1),hideSchemaTitles:(0,utils_1.argValueToBoolean)(e.hideSchemaTitles,!1),maxDisplayedEnumValues:(0,utils_1.argValueToNumber)(e.maxDisplayedEnumValues),mockServer:(null===(p=e.mockServer)||void 0===p?void 0:p.url)?{url:e.mockServer.url,position:e.mockServer.position||"first",description:e.mockServer.description||"Mock server"}:void 0,oAuth2RedirectURI:e.oAuth2RedirectURI||null,onlyRequiredInSamples:(0,utils_1.argValueToBoolean)(e.onlyRequiredInSamples,!1),onDeepLinkClick:e.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK),requestInterceptor:e.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.REQUEST_INTERCEPTOR),routingBasePath:(0,theme_1.isUndefined)(e.disableRouter)?"":e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",schemasExpansionLevel:(0,utils_1.argValueToExpandLevel)(e.schemasExpansionLevel),feedback:e.feedback||{hide:!1},sortRequiredPropsFirst:(0,utils_1.argValueToBoolean)(e.sortRequiredPropsFirst,!1),scrollYOffset:(0,helpers_1.normalizeScrollYOffset)(e.scrollYOffset),showExtensions:(0,helpers_1.normalizeShowExtensions)(e.showExtensions),sanitize:(0,utils_1.argValueToBoolean)(e.sanitize,!1),skipBundle:(0,utils_1.argValueToBoolean)(e.skipBundle,!1),ignoreNamedSchemas:new Set(m),markdocOptions:null==e?void 0:e.markdocOptions,codeSamples:e.codeSamples||{languages:Object.values(constants_2.Languages).map((e=>({lang:e})))},layout:e.layout||theme_1.LayoutVariant.THREE_PANEL,events:e.events||{},unstable_hooks:e.unstable_hooks||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.HOOKS)||{},unstable_externalCodeSamples:e.unstable_externalCodeSamples||[],hidePropertiesPrefix:(0,utils_1.argValueToBoolean)(null==e?void 0:e.hidePropertiesPrefix,!1)}}exports.normalizeOptions=normalizeOptions;
|
|
2
2
|
//# sourceMappingURL=normalizeOptions.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { Schema, ConfigFunction } from '@markdoc/markdoc/dist/src/types';
|
|
3
3
|
import type { CodeSamplesConfig } from '../code-samples';
|
|
4
|
-
import type {
|
|
4
|
+
import type { HooksConfig, Unstable_ExternalCodeSample } from '../types';
|
|
5
5
|
import type { Events } from '../../events';
|
|
6
6
|
import type { LayoutVariant } from '@redocly/theme';
|
|
7
7
|
import type { OperationModel } from '../../models/types';
|
|
8
|
+
import type { DownloadUrlsConfig } from '../../components/Download/types';
|
|
8
9
|
export interface RawOptions {
|
|
9
10
|
licenseKey?: string;
|
|
10
11
|
scrollYOffset?: number | string | (() => number);
|
|
@@ -27,10 +28,7 @@ export interface RawOptions {
|
|
|
27
28
|
sortRequiredPropsFirst?: boolean | string;
|
|
28
29
|
sanitize?: boolean | string;
|
|
29
30
|
hideDownloadButtons?: boolean | string;
|
|
30
|
-
downloadUrls?:
|
|
31
|
-
json?: string;
|
|
32
|
-
yaml?: string;
|
|
33
|
-
};
|
|
31
|
+
downloadUrls?: DownloadUrlsConfig;
|
|
34
32
|
onlyRequiredInSamples?: boolean | string;
|
|
35
33
|
generatedSamplesMaxDepth?: number | string;
|
|
36
34
|
showExtensions?: boolean | string | string[];
|
|
@@ -49,15 +47,10 @@ export interface RawOptions {
|
|
|
49
47
|
hideInfoMetadata?: boolean;
|
|
50
48
|
events?: Events;
|
|
51
49
|
onDeepLinkClick?: ((link: string) => void) | undefined | null;
|
|
52
|
-
sidebarLinks?: {
|
|
53
|
-
beforeInfo?: Array<ExternalLink>;
|
|
54
|
-
end?: Array<ExternalLink>;
|
|
55
|
-
};
|
|
56
50
|
skipBundle?: boolean;
|
|
57
51
|
routingBasePath?: string;
|
|
58
52
|
codeSamples?: CodeSamplesConfig;
|
|
59
53
|
ignoreNamedSchemas?: string[] | string;
|
|
60
|
-
infoLabel?: string;
|
|
61
54
|
hidePropertiesPrefix?: boolean;
|
|
62
55
|
}
|
|
63
56
|
export interface Options {
|
|
@@ -80,16 +73,13 @@ export interface Options {
|
|
|
80
73
|
sortRequiredPropsFirst: boolean;
|
|
81
74
|
sanitize: boolean;
|
|
82
75
|
hideDownloadButtons: boolean | null;
|
|
83
|
-
downloadUrls?:
|
|
84
|
-
json?: string;
|
|
85
|
-
yaml?: string;
|
|
86
|
-
};
|
|
76
|
+
downloadUrls?: DownloadUrlsConfig;
|
|
87
77
|
onlyRequiredInSamples: boolean;
|
|
88
78
|
generatedSamplesMaxDepth: number;
|
|
89
79
|
showExtensions: string[] | boolean;
|
|
90
80
|
hideSchemaTitles: boolean;
|
|
91
81
|
jsonSamplesExpandLevel: number;
|
|
92
|
-
schemasExpansionLevel: number;
|
|
82
|
+
schemasExpansionLevel: number | undefined;
|
|
93
83
|
mockServer?: {
|
|
94
84
|
url: string;
|
|
95
85
|
position: 'first' | 'last' | 'replace' | 'off';
|
|
@@ -103,13 +93,8 @@ export interface Options {
|
|
|
103
93
|
hideInfoMetadata: boolean;
|
|
104
94
|
events: Events;
|
|
105
95
|
onDeepLinkClick: ((link: string) => void) | undefined | null;
|
|
106
|
-
sidebarLinks?: {
|
|
107
|
-
beforeInfo?: Array<ExternalLink>;
|
|
108
|
-
end?: Array<ExternalLink>;
|
|
109
|
-
};
|
|
110
96
|
skipBundle: boolean;
|
|
111
97
|
routingBasePath: string;
|
|
112
98
|
codeSamples: CodeSamplesConfig;
|
|
113
|
-
infoLabel?: string;
|
|
114
99
|
hidePropertiesPrefix: boolean;
|
|
115
100
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildContentItems=exports.buildMenuStructure=void 0;const tags_1=require("./tags"),markdown_1=require("./markdown"),utils_1=require("../../utils");function buildMenuStructure(t,e){var i,n,o;const{definition:u}=t,{schemaDefinitionsTagName:s
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildContentItems=exports.buildMenuStructure=void 0;const tags_1=require("./tags"),markdown_1=require("./markdown"),utils_1=require("../../utils");function buildMenuStructure(t,e){var i,n,o;const{definition:u}=t,{schemaDefinitionsTagName:s}=e,r=[{id:"",name:(null===(n=null===(i=null==u?void 0:u.info)||void 0===i?void 0:i["x-seo"])||void 0===n?void 0:n.title)||(null===(o=null==u?void 0:u.info)||void 0===o?void 0:o.title)||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:u.info,items:[]}],d=[...u.tags||[]];!d.find((t=>(null==t?void 0:t.name)===s))&&s&&d.push({name:s});const l=(0,tags_1.getTagsWithOperations)(t,d),a=u["x-tagGroups"];return r.push(...(0,markdown_1.addMarkdownItems)((0,utils_1.getValueFromMdParsedExtension)(u.info,"description")||"",void 0,1)),a&&a.length>0?r.push(...(0,tags_1.getTagGroupsItems)(t,void 0,a,l,e)):r.push(...(0,tags_1.getTagsItems)(t,l,void 0,void 0,e)),r}function buildContentItems(t,e){const i=buildMenuStructure(t,e);return{contentItems:i,flatItems:(0,utils_1.flattenByProp)(i||[],"items")}}exports.buildMenuStructure=buildMenuStructure,exports.buildContentItems=buildContentItems;
|
|
2
2
|
//# sourceMappingURL=builder.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function argValueToBoolean(val?: string | boolean, defaultValue?: boolean): boolean;
|
|
2
2
|
export declare function argValueToNumber(value: number | string | undefined, defaultValue?: number): number;
|
|
3
3
|
export declare function argValueToInt(value: number | string | undefined, defaultValue?: number): number;
|
|
4
|
-
export declare function argValueToExpandLevel(value?: number | string | undefined, defaultValue?: number): number;
|
|
4
|
+
export declare function argValueToExpandLevel(value?: number | string | undefined, defaultValue?: number): number | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function argValueToBoolean(e,a){return void 0===e?a||!1:"string"==typeof e?"false"!==e:e}function argValueToNumber(e,a=0){return"string"==typeof e?parseInt(e,10):"number"==typeof e?e:a}function argValueToInt(e,a=0){return"string"==typeof e?parseInt(e,10):"number"==typeof e?Math.ceil(e):a}function argValueToExpandLevel(e,a
|
|
1
|
+
"use strict";function argValueToBoolean(e,a){return void 0===e?a||!1:"string"==typeof e?"false"!==e:e}function argValueToNumber(e,a=0){return"string"==typeof e?parseInt(e,10):"number"==typeof e?e:a}function argValueToInt(e,a=0){return"string"==typeof e?parseInt(e,10):"number"==typeof e?Math.ceil(e):a}function argValueToExpandLevel(e,a){return void 0===e?a:"all"===e?1/0:argValueToInt(e,a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.argValueToExpandLevel=exports.argValueToInt=exports.argValueToNumber=exports.argValueToBoolean=void 0,exports.argValueToBoolean=argValueToBoolean,exports.argValueToNumber=argValueToNumber,exports.argValueToInt=argValueToInt,exports.argValueToExpandLevel=argValueToExpandLevel;
|
|
2
2
|
//# sourceMappingURL=argValuesHelpers.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{PanelHeader,Badge}from"@redocly/theme";import styled from"styled-components";import{Trigger}from"../Panel";import{HttpVerb}from"../
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{PanelHeader,Badge}from"@redocly/theme";import styled from"styled-components";import{Trigger}from"../Panel";import{HttpVerb}from"../common";import{makeDeepLink}from"../../services";import{shortenHTTPVerb}from"../../utils";import{CallbackTitle}from"./styled";import{CircleIcon}from"../PropertyDetails/PlusCircleIcon";import{LinkToField}from"../common/LinkToField";export function CallbackSummary({expanded:e=!1,toggle:r,callback:{name:a,httpVerb:i,deprecated:o,callbackId:n,id:l}}){return _jsxs(CallbackHeader,{expanded:e,onClick:r,children:[_jsx(LinkToField,{to:makeDeepLink(l,`callbacks/${n}`)}),_jsxs(Trigger,{children:[_jsx(CircleIconWrap,{children:_jsx(CircleIcon,{sign:e?"-":"+"})}),_jsx(CallbackTitle,{deprecated:o,children:a}),_jsx(HttpVerb,{color:i,children:shortenHTTPVerb(i)}),o?_jsx(Badge,{deprecated:!0,children:"Deprecated"}):null]})]})}const CallbackHeader=styled(PanelHeader)`
|
|
2
2
|
padding: var(--spacing-sm) 0 var(--spacing-sm) calc(var(--spacing-unit) / 2);
|
|
3
3
|
margin: 0;
|
|
4
4
|
line-height: var(--line-height-base);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import{useAtomValue}from"jotai";import styled from"styled-components";import{DownloadIcon,DocumentIcon,JsonIcon,
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useCallback}from"react";import{useAtomValue}from"jotai";import styled from"styled-components";import{DownloadIcon,DocumentIcon,JsonIcon,Button,FileIcon}from"@redocly/theme";import{useDownloadInfo}from"./useDownloadInfo";import{globalStoreAtom}from"../../jotai/store";function DownloadSpecificationComponent(){const{parser:o,options:e}=useAtomValue(globalStoreAtom),{definition:t}=o,n=useDownloadInfo({definition:t,downloadUrls:e.downloadUrls}),r=useCallback((o=>{switch(o){case"yaml":return _jsx(DocumentIcon,{});case"json":return _jsx(JsonIcon,{});default:return _jsx(FileIcon,{})}}),[]);return n?_jsx(Wrapper,{children:(n||[]).map((({title:o,url:e,iconType:t})=>_jsxs(Card,{children:[_jsxs(FileName,{children:[r(t),_jsx("a",{href:e,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),_jsx("a",{href:e,target:"_blank",download:!0,rel:"noreferrer",children:_jsx(Button,{variant:"text",size:"small",icon:_jsx(DownloadIcon,{})})})]},o)))}):_jsx(_Fragment,{})}export const DownloadSpecification=memo(DownloadSpecificationComponent);const Card=styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: baseline;
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
width: 100%;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
8
|
+
padding-bottom: var(--spacing-sm);
|
|
9
|
+
:last-of-type {
|
|
10
|
+
padding-bottom: 0px;
|
|
11
|
+
border-bottom: none;
|
|
12
12
|
}
|
|
13
13
|
`,FileName=styled.span`
|
|
14
14
|
display: flex;
|
|
15
|
+
width: calc(100% - 25px);
|
|
15
16
|
gap: var(--spacing-xs);
|
|
16
17
|
align-items: center;
|
|
17
18
|
|
|
@@ -19,9 +20,13 @@ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react"
|
|
|
19
20
|
flex-shrink: 0;
|
|
20
21
|
}
|
|
21
22
|
a {
|
|
23
|
+
width: 100%;
|
|
22
24
|
color: var(--text-color-primary);
|
|
23
25
|
word-break: break-word;
|
|
24
26
|
text-decoration: none;
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
white-space: nowrap;
|
|
25
30
|
}
|
|
26
31
|
`,Wrapper=styled.div`
|
|
27
32
|
display: flex;
|
|
@@ -31,9 +36,5 @@ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react"
|
|
|
31
36
|
flex-direction: column;
|
|
32
37
|
gap: var(--spacing-sm);
|
|
33
38
|
font-size: var(--font-size-base);
|
|
34
|
-
|
|
35
|
-
@media screen and (min-width: ${breakpoints.large}) {
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
}
|
|
38
39
|
`;
|
|
39
40
|
//# sourceMappingURL=DownloadSpecification.js.map
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import type { OpenAPIDefinition } from '../../types';
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export type
|
|
2
|
+
export type DownloadUrlsConfig = {
|
|
3
|
+
title?: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}[];
|
|
6
|
+
export type DownloadIconType = 'yaml' | 'json' | 'file';
|
|
7
7
|
export type UseDownloadInfoProps = {
|
|
8
8
|
definition?: OpenAPIDefinition;
|
|
9
9
|
definitionUrl?: string;
|
|
10
|
-
downloadUrls?:
|
|
11
|
-
[K in FileExtension]?: string;
|
|
12
|
-
};
|
|
10
|
+
downloadUrls?: DownloadUrlsConfig;
|
|
13
11
|
};
|
|
14
12
|
export type UseDownloadInfoReturnType = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
title: string;
|
|
14
|
+
url: string;
|
|
15
|
+
iconType: DownloadIconType;
|
|
16
|
+
}[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { UseDownloadInfoProps, UseDownloadInfoReturnType } from './types';
|
|
2
|
-
export declare const useDownloadInfo: ({ definition, downloadUrls, }: UseDownloadInfoProps) => UseDownloadInfoReturnType;
|
|
2
|
+
export declare const useDownloadInfo: ({ definition, downloadUrls, }: UseDownloadInfoProps) => UseDownloadInfoReturnType | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useMemo}from"react";import{IS_BROWSER}from"@redocly/theme";import*as yaml from"js-yaml";import{MediaTypes}from"../../constants";export const useDownloadInfo=({definition:e,downloadUrls:o})=>useMemo((()=>{if(o)return o.map((({title:e,url:o})=>({url:o,title:e||getFileNameFromUrl(o,"openapi.yaml"),iconType:getIconTypeFromUrl(o)})));if(IS_BROWSER&&window.Blob&&window.URL&&window.URL.createObjectURL){return[{title:"openapi.json",url:window.URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:MediaTypes.JSON})),iconType:"json"},{title:"openapi.yaml",url:window.URL.createObjectURL(new Blob([yaml.dump(e)],{type:"text/yaml"})),iconType:"yaml"}]}}),[e,o]);function getFileNameFromUrl(e,o){const t=e.split("?")[0].split(/[\\\/]/).pop();return t&&(t.includes("yaml")||t.includes("json"))?t:o}function getIconTypeFromUrl(e,o){const t=o||e.split("?")[0].split(/[\\\/]/).pop();return t?t.includes("yaml")?"yaml":t.includes("json")?"json":"file":"file"}
|
|
2
2
|
//# sourceMappingURL=useDownloadInfo.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownMenuItem } from '@redocly/theme';
|
|
3
|
-
import type { DropdownMenuItemProps } from '@redocly/theme';
|
|
4
3
|
export declare const Container: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
5
4
|
export declare const LanguageTitle: import("styled-components").StyledComponent<"span", any, {
|
|
6
5
|
active?: boolean | undefined;
|
|
@@ -11,7 +10,21 @@ export declare const LanguageListContainer: import("styled-components").StyledCo
|
|
|
11
10
|
export declare const LanguageListItem: import("styled-components").StyledComponent<"button", any, {
|
|
12
11
|
active: boolean;
|
|
13
12
|
}, never>;
|
|
14
|
-
export declare const StyledDropdownMenuItem: import("styled-components").StyledComponent<typeof DropdownMenuItem, any,
|
|
13
|
+
export declare const StyledDropdownMenuItem: import("styled-components").StyledComponent<typeof DropdownMenuItem, any, Partial<Pick<import("@redocly/theme").LinkProps, "target" | "to" | "external">> & {
|
|
14
|
+
prefix?: import("react").ReactNode;
|
|
15
|
+
suffix?: import("react").ReactNode;
|
|
16
|
+
content?: import("react").ReactNode;
|
|
17
|
+
separatorLine?: boolean | undefined;
|
|
18
|
+
dataAttributes?: Record<string, string> | undefined;
|
|
19
|
+
className?: string | undefined;
|
|
20
|
+
style?: import("react").CSSProperties | undefined;
|
|
21
|
+
role?: string | undefined;
|
|
22
|
+
separator?: boolean | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
dangerous?: boolean | undefined;
|
|
25
|
+
onAction?: (() => void) | undefined;
|
|
26
|
+
active?: boolean | undefined;
|
|
27
|
+
} & {
|
|
15
28
|
$width?: number | undefined;
|
|
16
29
|
}, never>;
|
|
17
30
|
export declare const DropdownTriggerButton: import("styled-components").StyledComponent<import("react").FC<import("@redocly/theme").ButtonProps>, any, import("@redocly/theme").ButtonProps, never>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{Markdown}from"./Markdown";export*from"./
|
|
1
|
+
export{Markdown}from"./Markdown";export*from"./types";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from"styled-components";import{Panel
|
|
1
|
+
import styled from"styled-components";import{Panel}from"@redocly/theme";import{FieldsGroupHeader}from"../common/headers";import{Trigger}from"./Trigger";export const StyledResponsePanel=styled(Panel)`
|
|
2
2
|
${FieldsGroupHeader} {
|
|
3
3
|
&:first-child {
|
|
4
4
|
margin-top: 0;
|
|
@@ -10,13 +10,6 @@ import styled from"styled-components";import{Panel,PanelHeaderTitle}from"@redocl
|
|
|
10
10
|
max-width: 100%;
|
|
11
11
|
justify-content: space-between;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
${PanelHeaderTitle} {
|
|
15
|
-
${StyledMarkdownSpan} > p:first-child {
|
|
16
|
-
margin-left: 4px;
|
|
17
|
-
display: inline;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
13
|
`;export const CallbackPanel=styled(StyledResponsePanel)`
|
|
21
14
|
border-bottom: 1px solid var(--border-color-primary);
|
|
22
15
|
&:not(:last-child) {
|
|
@@ -1,2 +1,2 @@
|
|
|
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
|
|
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}from"../../hooks";function PayloadSamplesComponent(e){var{onlyDefaultMimeType:t,content:o}=e,a=__rest(e,["onlyDefaultMimeType","content"]);const r=useActivateExample(o),l=useAtomValue(activeMimeNameAtom),m=t&&l,i=useCallback((e=>m?null:_jsx(SelectWrapper,{children:_jsx(SelectOrLabel,Object.assign({Label:MimeLabel,Select:Select,variant:"dark",fullWidth:!0},e))})),[m]),p=e=>r(e);return o?_jsx(MediaTypesSwitch,{content:o,renderSelect:i,children:e=>_jsx(MediaTypeSamples,Object.assign({mediaType:e},a,{onChange:p}),"samples")}):_jsx(StyledCodeBlock,{lang:"text",source:"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 { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import type { RedoclyOpenAPIDocsProps, RedoclyOpenAPIDocsStandaloneProps } from './types';
|
|
3
|
-
export declare function RedoclyOpenAPIDocs({ onLoaded, children, store, }: PropsWithChildren<Partial<RedoclyOpenAPIDocsProps>>): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export declare function RedoclyOpenAPIDocs({ onLoaded, children, store, withCommonStyles, }: PropsWithChildren<Partial<RedoclyOpenAPIDocsProps>>): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
export declare function RedoclyOpenAPIDocsStandalone({ definition, definitionUrl, options, activeItemId, activeSampleLanguage, activeDeepLink, }: RedoclyOpenAPIDocsStandaloneProps): ReactElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useRef,memo}from"react";import{SidebarLogo,GlobalStyle,useMount,LayoutVariant,ThreePanelLayout}from"@redocly/theme";import{UnsupportedFeatureScreen}from"../UnsupportedFeatureScreen";import{AppProvider,StoreProvider}from"./Providers";import{Overlay}from"../Overlay";import{RedocWrapStyled,CssFixes}from"./styled";import{StickyResponsiveSidebar}from"../StickySidebar";import{SideMenu}from"../SideMenu";import{Content}from"../Content";import{useContentItems}from"../../hooks";import{withRouter}from"../../hoc/withRouter";import{withStore}from"../../hoc/withStore";import{compose}from"../../utils";import{useLicense}from"../../hooks/useLicense";const RedoclyOpenAPIDocsComponent=compose(withRouter,withStore,memo)((({licenseKey:e,onLoaded:o,children:
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useRef,memo}from"react";import{SidebarLogo,GlobalStyle as ThemeCommonStyle,useMount,LayoutVariant,ThreePanelLayout}from"@redocly/theme";import{UnsupportedFeatureScreen}from"../UnsupportedFeatureScreen";import{AppProvider,StoreProvider}from"./Providers";import{Overlay}from"../Overlay";import{RedocWrapStyled,CssFixes}from"./styled";import{StickyResponsiveSidebar}from"../StickySidebar";import{SideMenu}from"../SideMenu";import{Content}from"../Content";import{useContentItems}from"../../hooks";import{withRouter}from"../../hoc/withRouter";import{withStore}from"../../hoc/withStore";import{compose}from"../../utils";import{useLicense}from"../../hooks/useLicense";const RedoclyOpenAPIDocsComponent=compose(withRouter,withStore,memo)((({licenseKey:e,onLoaded:o,children:t,options:i,layout:n,collapsedSidebar:r,parser:s,withCommonStyles:l})=>{var a,d,c,m,u;const p=useRef(null),{isValid:v,licenseInfo:f}=useLicense(e);useMount((()=>{null==o||o()}));const{hideSidebar:S,scrollYOffset:h}=i||{},{contentItems:y}=useContentItems({parser:s,options:i}),x=null===(d=null===(a=s.definition)||void 0===a?void 0:a.info)||void 0===d?void 0:d["x-logo"];return _jsxs(_Fragment,{children:[l&&_jsx(ThemeCommonStyle,{}),_jsxs(RedocWrapStyled,{className:"redoc-wrap",ref:p,children:[_jsx(UnsupportedFeatureScreen,{}),!v&&_jsx(Overlay,{licenseInfo:f}),_jsx(CssFixes,{layout:n}),!S&&_jsxs(StickyResponsiveSidebar,{scrollYOffset:h,className:"menu-content",collapsedSidebar:!r,children:[_jsx(SidebarLogo,{imageUrl:null==x?void 0:x.url,href:(null==x?void 0:x.href)||(null===(u=null===(m=null===(c=s.definition)||void 0===c?void 0:c.info)||void 0===m?void 0:m.contact)||void 0===u?void 0:u.url),altText:null==x?void 0:x.altText,backgroundColor:null==x?void 0:x.backgroundColor}),_jsx(SideMenu,{items:v?y:[]})]}),_jsxs(ThreePanelLayout,{className:"api-content",id:"api-content",layout:n===LayoutVariant.THREE_PANEL?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED,collapsedSidebar:r,children:[_jsx(Content,{items:v?y:[],routingBasePath:i.routingBasePath}),t]})]})]})}));export function RedoclyOpenAPIDocs({onLoaded:e,children:o,store:t,withCommonStyles:i}){var n,r,s;return(null==t?void 0:t.definition)?_jsx(StoreProvider,Object.assign({},t,{children:_jsx(RedoclyOpenAPIDocsComponent,{onLoaded:e,basePath:null===(n=t.options)||void 0===n?void 0:n.routingBasePath,licenseKey:null===(r=t.options)||void 0===r?void 0:r.licenseKey,disableRouter:null===(s=t.options)||void 0===s?void 0:s.disableRouter,withCommonStyles:i,children:o})})):null}export function RedoclyOpenAPIDocsStandalone({definition:e,definitionUrl:o,options:t={},activeItemId:i,activeSampleLanguage:n,activeDeepLink:r}){return _jsx(AppProvider,{definition:e,definitionUrl:o,options:t,activeItemId:i,activeSampleLanguage:n,activeDeepLink:r,children:_jsx(RedoclyOpenAPIDocs,{withCommonStyles:!0})})}
|
|
2
2
|
//# sourceMappingURL=RedoclyOpenAPIDocs.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __rest=this&&this.__rest||function(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(t=Object.getOwnPropertySymbols(e);l<t.length;l++)o.indexOf(t[l])<0&&Object.prototype.propertyIsEnumerable.call(e,t[l])&&(r[t[l]]=e[t[l]])}return r};import{jsx as _jsx}from"react/jsx-runtime";import{memo,useCallback}from"react";import{CodeBlock}from"@redocly/theme";import styled from"styled-components";import{SelectOrLabel}from"../SelectOrLabel";import{MediaTypesSwitch}from"../MediaTypeSwitch";import{SelectWrapper}from"../PayloadSamples";import{Example}from"./Example";import{MimeLabel
|
|
1
|
+
var __rest=this&&this.__rest||function(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(t=Object.getOwnPropertySymbols(e);l<t.length;l++)o.indexOf(t[l])<0&&Object.prototype.propertyIsEnumerable.call(e,t[l])&&(r[t[l]]=e[t[l]])}return r};import{jsx as _jsx}from"react/jsx-runtime";import{memo,useCallback}from"react";import{CodeBlock}from"@redocly/theme";import styled from"styled-components";import{SelectOrLabel}from"../SelectOrLabel";import{MediaTypesSwitch}from"../MediaTypeSwitch";import{SelectWrapper}from"../PayloadSamples";import{Example}from"./Example";import{MimeLabel,Select}from"../common";function CodeSampleComponent(e){var o,{onCopyClick:r}=e,t=__rest(e,["onCopyClick"]);const l=null===(o=t.operation.requestBody)||void 0===o?void 0:o.content,a=useCallback((e=>{var o,r;return(null!==(r=null===(o=null==l?void 0:l.mediaTypes)||void 0===o?void 0:o.length)&&void 0!==r?r:0)>1?_jsx(SelectWrapper,{children:_jsx(SelectOrLabel,Object.assign({Label:MimeLabel,Select:Select,variant:"dark",fullWidth:!0},e))}):null}),[l]),n=e=>t.source?_jsx(StyledCodeBlock,{lang:t.lang,source:t.source,header:{className:"code-block-header",controls:{copy:{onClick:r}}}}):_jsx(StyledCodeBlock,{lang:t.lang,externalSource:{sample:t.externalSample,exampleName:e,operation:t.operation,pathParams:t.pathParams,properties:t.properties},header:{className:"code-block-header",controls:{copy:{onClick:r}}}});return void 0===l||null!=t.source?n():_jsx(MediaTypesSwitch,{content:l,renderSelect:a,children:e=>_jsx(Example,{mediaType:e,mediaContent:l,renderSample:n})})}export const CodeSample=memo(CodeSampleComponent);const StyledCodeBlock=styled(CodeBlock)`
|
|
2
2
|
border: none;
|
|
3
3
|
margin: 0;
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect}from"react";import{MimeLabel
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect}from"react";import{MimeLabel,Container,Select}from"../common";import{SelectOrLabel}from"../SelectOrLabel";import{normalizeText}from"../../utils";export const ExampleSwitch=({exampleKey:e,examples:t,onChange:a})=>{var l;const r=Object.keys(t),o=e?r.indexOf(e):0,[i,m]=useState(o>-1?o:0);useEffect((()=>m(o>-1?o:0)),[e,o]);const n=r.map(((e,a)=>({value:normalizeText(t[e].summary)||e,idx:a})));return n.length<2?null:_jsx(Container,{"data-cy":"example-switch",children:_jsx(SelectOrLabel,{Select:Select,Label:MimeLabel,variant:"dark",fullWidth:!0,options:n,value:null===(l=n[i])||void 0===l?void 0:l.value,onChange:({idx:e})=>{m(e),a(r[e])}})})};
|
|
2
2
|
//# sourceMappingURL=ExampleSwitch.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __rest=this&&this.__rest||function(e,r){var a={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(a[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(o=Object.getOwnPropertySymbols(e);t<o.length;t++)r.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t])&&(a[o[t]]=e[o[t]])}return a};import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useCallback}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{TypeName}from"../common";import{Schema}from"./Schema";import{ObjectSchema}from"./ObjectSchema";import{humanizeConstraints}from"../../utils";import{SubSchema}from"./SubSchema";import{globalOptionsAtom}from"../../jotai/store";function ArraySchemaComponent(e){var r,a,{schema:o,schema:{minItems:t,maxItems:l,items:n},fieldParentsName:s}=e,i=__rest(e,["schema","schema","fieldParentsName"]);const{schemasExpansionLevel:m}=useAtomValue(globalOptionsAtom),c=void 0===t&&void 0===l?"":`(${humanizeConstraints(o)})`;let
|
|
1
|
+
var __rest=this&&this.__rest||function(e,r){var a={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(a[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(o=Object.getOwnPropertySymbols(e);t<o.length;t++)r.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t])&&(a[o[t]]=e[o[t]])}return a};import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo,useCallback}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{TypeName}from"../common";import{Schema}from"./Schema";import{ObjectSchema}from"./ObjectSchema";import{humanizeConstraints}from"../../utils";import{SubSchema}from"./SubSchema";import{globalOptionsAtom}from"../../jotai/store";import{getExpandByDefault}from"./helpers";function ArraySchemaComponent(e){var r,a,{schema:o,schema:{minItems:t,maxItems:l,items:n},fieldParentsName:s}=e,i=__rest(e,["schema","schema","fieldParentsName"]);const{schemasExpansionLevel:m}=useAtomValue(globalOptionsAtom),c=void 0===t&&void 0===l?"":`(${humanizeConstraints(o)})`;let p=s?[...s.slice(0,-1),s[s.length-1]+"[]"]:s;const d=useCallback((e=>i.skipReadOnly||i.skipWriteOnly?null==e?void 0:e.filter((e=>!(i.skipReadOnly&&e.schema.readOnly||i.skipWriteOnly&&e.schema.writeOnly))):e),[i.skipReadOnly,i.skipWriteOnly]);if(null==o?void 0:o.fields)return _jsx(ObjectSchema,Object.assign({},i,{level:(null==i?void 0:i.level)||1,schema:o,fieldParentsName:p}));if(o.displayType&&!n&&!c.length)return _jsx("div",{children:_jsx(TypeName,{children:o.displayType})});const y=d(null==n?void 0:n.fields),h=d(null===(a=null===(r=null==n?void 0:n.oneOf)||void 0===r?void 0:r[0])||void 0===a?void 0:a.fields),u=(null==y?void 0:y.length)||(null==h?void 0:h.length),b=1===i.level,f=getExpandByDefault({level:i.level,required:i.required,schemasExpansionLevel:m});return _jsx(SubSchema,Object.assign({},i,{propertyLength:u,isArray:!0,expandable:!b,expandByDefault:f,operationPointer:o.operationPointer,children:_jsxs(_Fragment,{children:[b&&_jsx(ArrayLabel,{children:_jsx(LabelValue,{children:"Array ["})}),_jsx(Schema,Object.assign({},i,{schema:n,fieldParentsName:p,expandable:!1})),b&&_jsx(ArrayClosingLabel,{className:"array-closing-label",children:_jsx(LabelValue,{children:"]"})})]})}))}const ArrayLabel=styled.span`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--spacing-xs);
|
|
@@ -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";function ObjectSchemaComponent({schema:e,showTitle:i,discriminator:t,level:r,skipWriteOnly:a,skipReadOnly:o,fieldParentsName:n,expandable:m,deepLink:s,required:l,disableDeepLinks:p}){const{fields:c=[],title:d}=e,{schemasExpansionLevel:h}=useAtomValue(globalOptionsAtom),f=o||a?c.filter((e=>!(o&&e.schema.readOnly||a&&e.schema.writeOnly))):c,
|
|
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:i,discriminator:t,level:r,skipWriteOnly:a,skipReadOnly:o,fieldParentsName:n,expandable:m,deepLink:s,required:l,disableDeepLinks:p}){const{fields:c=[],title:d}=e,{schemasExpansionLevel:h}=useAtomValue(globalOptionsAtom),f=o||a?c.filter((e=>!(o&&e.schema.readOnly||a&&e.schema.writeOnly))):c,x=getExpandByDefault({required:l,level:r,schemasExpansionLevel:h});return _jsx(SubSchema,{expandable:m,expandByDefault:x,level:r,propertyLength:f.length,deepLink:s,operationPointer:e.operationPointer,children:_jsxs(_Fragment,{children:[i&&_jsx(PropertiesTableCaption,{children:d}),f.map(((e,m)=>_jsx(PropertyDetails,{isFirst:0===m,field:e,fieldParentsName:Number(r)>1?n:[],renderDiscriminatorSwitch:(null==t?void 0:t.fieldName)===e.name&&(null==t?void 0:t.parentSchema)?()=>_jsx(Discriminator,{parent:t.parentSchema,onChange:null==t?void 0:t.onChange,activeOneOfIdx:t.activeOneOfIdx}):void 0,skipReadOnly:o,skipWriteOnly:a,showTitle:i,level:r,disableDeepLinks:p},e.name)))]})})}export const ObjectSchema=memo(ObjectSchemaComponent);
|
|
2
2
|
//# sourceMappingURL=ObjectSchema.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const extractTypeFromDeepLink=e=>{if(!e)return"";const
|
|
1
|
+
export const extractTypeFromDeepLink=e=>{if(!e)return"";const r=e.match(/t=(request|response)/);return r?r[1]:""};export function getExpandByDefault(e){return void 0!==e.schemasExpansionLevel?e.schemasExpansionLevel>=Number(e.level)-1:!!e.required}
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useMemo,useCallback}from"react";import{Dropdown,DropdownMenu}from"@redocly/theme";import{useAtom}from"jotai";import{HttpVerb}from"../
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useMemo,useCallback}from"react";import{Dropdown,DropdownMenu}from"@redocly/theme";import{useAtom}from"jotai";import{HttpVerb}from"../common";import{PathWrapper,Path,StyledCopyButton,StyledDropdownMenuItem}from"./styled";import{PanelItem}from"../PanelItem";import{joinWithSeparator}from"../../services";import{replaceVariables}from"../../utils";import{environmentAtom}from"../../jotai/app";import{useActiveWithFallback}from"../../hooks";import{getServerEnvName}from"../../utils/environments";export const ServerListDropdown=({operation:e,className:r})=>{const[[t],o]=useAtom(environmentAtom),a=useActiveWithFallback(e.servers.map((e=>Object.assign(Object.assign({},e),{key:e.url}))),t.server),s=useCallback((e=>{e.stopPropagation()}),[]),n=useCallback((r=>()=>{1!==e.servers.length&&o({environment:getServerEnvName(r)})}),[e.servers.length,o]),i=useMemo((()=>e.servers.map((r=>{const t=replaceVariables(r),o=joinWithSeparator(t,e.path);return _jsx(StyledDropdownMenuItem,{onAction:n(r),children:_jsx(PanelItem,{header:r.description,title:replaceVariables(r),actions:[_jsx(StyledCopyButton,{data:o,toasterPlacement:"left",onCopyClick:s},o)],active:r.url===a,withCheckmark:!0})},o)}))),[e.servers,e.path,n,s,a]);return _jsx(Dropdown,{className:r,trigger:_jsxs(PathWrapper,{variant:"ghost",children:[_jsx(HttpVerb,{color:e.httpVerb,children:e.httpVerb}),_jsx(Path,{children:e.path})]}),withArrow:!0,children:_jsx(DropdownMenu,{children:i})})};
|
|
2
2
|
//# sourceMappingURL=ServerListDropdown.js.map
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{memo}from"react";import{Menu}from"@redocly/theme";import styled from"styled-components";import{useMenuItems}from"./hooks/useMenuItems";const SideMenuComponent=({items:e,className:o})=>{const t=useMenuItems({items:e});return _jsx(MenuWrapper,{className:o,children:_jsx(Menu,{items:t})})};export const SideMenu=memo(SideMenuComponent);export const MenuWrapper=styled.div`
|
|
2
|
+
overflow: auto;
|
|
3
|
+
`;
|
|
2
4
|
//# sourceMappingURL=SideMenu.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useActiveSectionId}from"@redocly/theme";import{useMemo}from"react";import{useLocation}from"react-router-dom";import{pathMatchedLink}from"../../../utils";export function useMenuItems({items:e}){const t=useLocation(),
|
|
1
|
+
import{useActiveSectionId}from"@redocly/theme";import{useMemo}from"react";import{useLocation}from"react-router-dom";import{pathMatchedLink}from"../../../utils";export function useMenuItems({items:e}){const t=useLocation(),i=useActiveSectionId(t,!1,!1);return useMemo((()=>mapAndSetActiveItems(e,i,t)),[i,e,t])}function mapAndSetActiveItems(e,t="",i){const s=[];return convertOpenAPIDocs2Sidebar({contentItems:e,sidebarItems:s,activeItemId:t,location:i}),s}function isItemActive(e,t="",i){return!!e.href&&(t?e.id===t:pathMatchedLink(i,e.href))}function isSubItemActive(e,t="",i){return(e.items||[]).some((e=>isItemActive(e,t,i)||isSubItemActive(e,t,i)))}function convertOpenAPIDocs2Sidebar(e){const{contentItems:t,sidebarItems:i,activeItemId:s,location:c}=e;let o=!0;for(const n of t){const t=isItemActive(n,s,c),a=isSubItemActive(n,s,c);switch(n.type){case"group":i.push({type:"separator",label:n.name,active:t,hasActiveSubItem:a}),convertOpenAPIDocs2Sidebar(Object.assign(Object.assign({},e),{contentItems:n.items,sidebarItems:i}));break;case"tag":const m={type:"group",label:n.name,items:[],link:n.href,active:t,hasActiveSubItem:a,modified:!0};i.push(m),convertOpenAPIDocs2Sidebar({contentItems:n.items,sidebarItems:m.items||[],activeItemId:s,location:c});break;case"operation":case"schema":n.isWebhook&&o&&(i.push({type:"separator",label:"Webhooks",variant:"secondary"}),o=!1),i.push({type:"link",label:n.name,httpVerb:"schema"===n.type?"schema":n.httpVerb,link:n.href,badges:n.badges,active:t,hasActiveSubItem:a,modified:!0});break;case"section":if(-1===n.depth)continue;const r={type:n.items.length?"group":"link",label:n.name,link:n.href,items:[],active:t,hasActiveSubItem:a,modified:!0};i.push(r),n.items.length&&convertOpenAPIDocs2Sidebar({contentItems:n.items,sidebarItems:r.items,activeItemId:s,location:c})}}}
|
|
2
2
|
//# sourceMappingURL=useMenuItems.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{SideMenu}from"./SideMenu";
|
|
1
|
+
export{SideMenu}from"./SideMenu";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ExternalLink, IMenuItem } from '../../services';
|
|
1
|
+
import type { IMenuItem } from '../../services';
|
|
3
2
|
export interface MenuItemLinkProps {
|
|
4
3
|
depth: number;
|
|
5
4
|
active: boolean;
|
|
@@ -10,19 +9,6 @@ export interface MenuItemLinkProps {
|
|
|
10
9
|
href?: string;
|
|
11
10
|
onClick?: () => void;
|
|
12
11
|
}
|
|
13
|
-
export interface MenuItemsProps {
|
|
14
|
-
items: ExtendedMenuItem[];
|
|
15
|
-
expanded?: boolean;
|
|
16
|
-
style?: CSSProperties;
|
|
17
|
-
root?: boolean;
|
|
18
|
-
className?: string;
|
|
19
|
-
linksBefore?: ExternalLink[];
|
|
20
|
-
linksAfter?: ExternalLink[];
|
|
21
|
-
}
|
|
22
|
-
export type StyledMenuItemLinkProps = Omit<MenuItemLinkProps, 'active' | 'hasChildren'> & {
|
|
23
|
-
$active: MenuItemLinkProps['active'];
|
|
24
|
-
$hasChildren: MenuItemLinkProps['hasChildren'];
|
|
25
|
-
};
|
|
26
12
|
export type ExtendedMenuItem = IMenuItem & {
|
|
27
13
|
active: boolean;
|
|
28
14
|
hasActiveSubItem: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SidebarActions: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useAtom}from"jotai";import{LayoutVariant,SidebarActions as ThemeSidebarActions}from"@redocly/theme";import styled from"styled-components";import{collapsedSidebarAtom,layoutAtom}from"../../jotai/app";export const SidebarActions=()=>{const[a,o]=useAtom(layoutAtom),[t,e]=useAtom(collapsedSidebarAtom);return _jsx(_Fragment,{children:_jsx(Wrapper,{children:_jsx(ThemeSidebarActions,{layout:a,onChangeViewClick:()=>o(a===LayoutVariant.STACKED?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED),collapsedSidebar:t,onChangeCollapseSidebarClick:()=>e(!t),isOpenapiDocs:!0})})})};const Wrapper=styled.div`
|
|
2
|
+
position: sticky;
|
|
3
|
+
top: calc(100vh);
|
|
4
|
+
padding: var(--spacing-sm) var(--spacing-md);
|
|
5
|
+
`;
|
|
6
|
+
//# sourceMappingURL=SidebarActions.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useEffect,useRef,useState}from"react";import styled from"styled-components";import{useMount,useUnmount,IS_BROWSER,breakpoints}from"@redocly/theme";import{useAtom}from"jotai";import{useLocation}from"react-router-dom";import{isSidebarOpenedAtom}from"../../jotai/app";import{
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{memo,useEffect,useRef,useState}from"react";import styled from"styled-components";import{useMount,useUnmount,IS_BROWSER,breakpoints}from"@redocly/theme";import{useAtom}from"jotai";import{useLocation}from"react-router-dom";import{isSidebarOpenedAtom}from"../../jotai/app";import{SidebarActions}from"./SidebarActions";let Stickyfill;IS_BROWSER&&(Stickyfill=require("stickyfill"));const stickyfill=Stickyfill&&Stickyfill(),StyledStickySidebar=styled.div`
|
|
2
2
|
overflow: hidden;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
backface-visibility: hidden;
|
|
@@ -21,5 +21,5 @@ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";i
|
|
|
21
21
|
@media print {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
|
-
`;function StickyResponsiveSidebarComponent({scrollYOffset:e,className:i,children:t,collapsedSidebar:o}){const[s,r]=useState("0px"),a=useRef(null),l=useLocation(),[n,d]=useAtom(isSidebarOpenedAtom);return useEffect((()=>{l.hash&&d(!1)}),[l.pathname,l.hash,d]),useMount((()=>{stickyfill&&stickyfill.add(a.current);const i=e();r(`${i}px`)})),useUnmount((()=>{stickyfill&&stickyfill.remove(a.current)})),_jsx(_Fragment,{children:_jsxs(StyledStickySidebar,{open:n,className:i,offsetTop:s,style:{top:s},ref:a,collapsedSidebar:o,children:[o||n?t:null,_jsx(
|
|
24
|
+
`;function StickyResponsiveSidebarComponent({scrollYOffset:e,className:i,children:t,collapsedSidebar:o}){const[s,r]=useState("0px"),a=useRef(null),l=useLocation(),[n,d]=useAtom(isSidebarOpenedAtom);return useEffect((()=>{l.hash&&d(!1)}),[l.pathname,l.hash,d]),useMount((()=>{stickyfill&&stickyfill.add(a.current);const i=e();r(`${i}px`)})),useUnmount((()=>{stickyfill&&stickyfill.remove(a.current)})),_jsx(_Fragment,{children:_jsxs(StyledStickySidebar,{open:n,className:i,offsetTop:s,style:{top:s},ref:a,collapsedSidebar:o,children:[o||n?t:null,_jsx(SidebarActions,{})]})})}export const StickyResponsiveSidebar=memo(StickyResponsiveSidebarComponent);
|
|
25
25
|
//# sourceMappingURL=StickyResponsiveSidebar.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useMemo,memo,useState}from"react";import{useNavigate}from"react-router-dom";import{Button,LayoutVariant}from"@redocly/theme";import styled from"styled-components";import{useAtomValue}from"jotai/index";import{HttpVerb
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useMemo,memo,useState}from"react";import{useNavigate}from"react-router-dom";import{Button,LayoutVariant}from"@redocly/theme";import styled from"styled-components";import{useAtomValue}from"jotai/index";import{HttpVerb,SamplesPanel}from"../common";import{encodeBackSlashes}from"../../utils";import{joinWithSeparator}from"../../services";import{layoutAtom}from"../../jotai/app";const MAX_OPERATIONS=8;export function OperationsNavigationComponent({items:e,routingBasePath:t}){const[o,a]=useState(!1),r=useNavigate(),n=useAtomValue(layoutAtom)===LayoutVariant.STACKED,{operations:i,webhooks:s,count:l}=useMemo((()=>{const t=e.filter((e=>"operation"===e.type)),a=o?t:t.slice(0,MAX_OPERATIONS),{operations:r,webhooks:n}=a.reduce(((e,t)=>t.isWebhook?Object.assign(Object.assign({},e),{webhooks:[...e.webhooks,t]}):Object.assign(Object.assign({},e),{operations:[...e.operations,t]})),{operations:[],webhooks:[]});return{operations:r,webhooks:n,count:!o&&t.length>MAX_OPERATIONS?t.length-MAX_OPERATIONS:0}}),[o,e]);if(!i.length&&!s.length)return null;const p=e=>{r(e)};return _jsxs(Wrapper,{isStacked:n,"data-cy":"operation-navigation-list",children:[i.length>0&&_jsxs(_Fragment,{children:[_jsx(Heading,{children:"Operations"}),i.map((({id:e,href:o,httpVerb:a,path:r})=>_jsx(Item,{variant:"outlined",size:"large",onClick:()=>p(joinWithSeparator(t,encodeBackSlashes(o))),children:_jsxs("span",{children:[_jsx(HttpVerb,{color:a,children:a}),_jsx(Path,{children:r})]})},e)))]}),s.length>0&&_jsxs(_Fragment,{children:[_jsx(Heading,{children:"Webhooks"}),s.map((({id:e,href:o,httpVerb:a,path:r})=>_jsx(Item,{variant:"outlined",size:"large",onClick:()=>p(joinWithSeparator(t,encodeBackSlashes(o))),children:_jsxs("span",{children:[_jsx(HttpVerb,{color:a,children:a}),_jsx(Path,{children:r})]})},e)))]}),!o&&Boolean(l)&&_jsxs(StyledButton,{variant:"link",size:"large","data-cy":"show-more-operations",fullWidth:!0,onClick:()=>a(!0),children:["Show ",l," more..."]})]})}export const OperationsNavigation=memo(OperationsNavigationComponent);const Wrapper=styled(SamplesPanel)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: var(--spacing-xxs);
|