@redocly/reference-docs 1.5.12 → 1.6.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 +27 -27
- package/dist/console.redocly-reference-docs.min.js +7 -7
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-reference-docs.min.js +6 -6
- package/lib/components/console/AuthPanel.js +1 -1
- package/lib/components/console/Console.js +1 -1
- package/lib/components/console/OAuth2Implicit.d.ts +1 -0
- package/lib/components/console/OAuth2Implicit.js +1 -1
- package/lib/components/console/OAuth2TokenInput.d.ts +1 -0
- package/lib/components/console/OAuth2TokenInput.js +1 -1
- package/lib/components/console/OpenIDConnect.d.ts +1 -0
- package/lib/components/console/OpenIDConnect.js +1 -1
- package/lib/components/console/OperationParameters.js +1 -1
- package/lib/redoc-lib/src/services/RedocNormalizedOptions.d.ts +2 -0
- package/lib/redoc-lib/src/services/RedocNormalizedOptions.js +1 -1
- package/lib/redoc-lib/src/services/models/MediaType.d.ts +1 -0
- package/lib/redoc-lib/src/services/models/MediaType.js +1 -1
- package/lib/redoc-lib/src/services/models/SecurityRequirement.d.ts +1 -0
- package/lib/redoc-lib/src/types/open-api.d.ts +5 -0
- package/lib/redoc-lib/src/utils/openapi.js +1 -1
- package/lib/services/ProStore.js +1 -1
- package/lib/services/check.d.ts +1 -0
- package/lib/services/check.js +1 -1
- package/lib/services/code-samples/generator.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +1 -1
- package/lib-esm/components/console/AuthPanel.js +1 -1
- package/lib-esm/components/console/Console.js +1 -1
- package/lib-esm/components/console/OAuth2Implicit.d.ts +1 -0
- package/lib-esm/components/console/OAuth2Implicit.js +1 -1
- package/lib-esm/components/console/OAuth2TokenInput.d.ts +1 -0
- package/lib-esm/components/console/OAuth2TokenInput.js +1 -1
- package/lib-esm/components/console/OpenIDConnect.d.ts +1 -0
- package/lib-esm/components/console/OpenIDConnect.js +1 -1
- package/lib-esm/components/console/OperationParameters.js +1 -1
- package/lib-esm/redoc-lib/src/services/RedocNormalizedOptions.d.ts +2 -0
- package/lib-esm/redoc-lib/src/services/RedocNormalizedOptions.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/MediaType.d.ts +1 -0
- package/lib-esm/redoc-lib/src/services/models/MediaType.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/SecurityRequirement.d.ts +1 -0
- package/lib-esm/redoc-lib/src/types/open-api.d.ts +5 -0
- package/lib-esm/redoc-lib/src/utils/openapi.js +1 -1
- package/lib-esm/services/ProStore.js +1 -1
- package/lib-esm/services/check.d.ts +1 -0
- package/lib-esm/services/check.js +1 -1
- package/lib-esm/services/code-samples/generator.js +1 -1
- package/lib-esm/utils.d.ts +1 -1
- package/lib-esm/utils.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter,__generator}from"tslib";var cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;function promisifyIECryptoRes(e){return e.then?e:new Promise((function(t){e.oncomplete=function(e){t(e.target.result)}}))}function str2ab(e){for(var t=new ArrayBuffer(e.length),
|
|
1
|
+
import{__awaiter,__generator}from"tslib";var cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;function promisifyIECryptoRes(e){return e.then?e:new Promise((function(t){e.oncomplete=function(e){t(e.target.result)}}))}function str2ab(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,o=e.length;r<o;r++)n[r]=e.charCodeAt(r);return t}var getKey=function(){var e=str2ab(atob("undefined"!=typeof REDOCLY_PUBLIC_KEY?REDOCLY_PUBLIC_KEY:"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMHjNir5fXx/ZXoaEeXQ5XyxbNJ4YJYczoCRdSkL6NLzw1FHnng5Vfcgk5+bvox9QRYRbuk84mA4f2NhywDbXKECAwEAAQ=="));return promisifyIECryptoRes(cryptoLib.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"]))};function textEncode(e){if(window.TextEncoder)return(new TextEncoder).encode(e);for(var t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function verify(e,t){return __awaiter(this,void 0,void 0,(function(){var n,r,o,i;return __generator(this,(function(a){switch(a.label){case 0:return n=promisifyIECryptoRes,o=(r=cryptoLib.subtle).verify,i=[{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"}],[4,getKey()];case 1:return[2,n.apply(void 0,[o.apply(r,i.concat([a.sent(),str2ab(atob(t)),textEncode(e)]))])]}}))}))}export function isHostAllowed(e,t){return!0===t||!(!Array.isArray(t)||"undefined"==typeof window)&&(!("localhost"!==e&&"127.0.0.1"!==e&&!e.endsWith(".localhost")&&!t.find((function(t){return t===e||e.endsWith("."+t)})))||!!t.find((function(t){if(t.indexOf("*")===t.lastIndexOf("*")){var n=t.split("*"),r=n[0],o=n[1];return o&&e.startsWith(r)&&e.endsWith(o)&&o.split(".").length>2}})))}export default function parse(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i;return __generator(this,(function(a){switch(a.label){case 0:if("development"===process.env.NODE_ENV)return[2,{valid:!0,allowed:!0}];if(t=window.location.hostname,!e)return"localhost"===t||"127.0.0.1"===t||t.endsWith(".localhost")?[2,{local:!0}]:[2,{}];n=e.split("."),r=n[0],o=n[1],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,verify(atob(r),o)];case 2:return a.sent()?(i=JSON.parse(atob(r)),[3,4]):[2,{valid:!1}];case 3:return a.sent(),[2,{valid:!1,cryptoMissing:!0}];case 4:return i.valid=!0,(!i.e||Date.now()/1e3>i.e)&&(i.expired=!0),i.allowed=isHostAllowed(t,i.h),[2,i]}}))}))}
|
|
2
2
|
//# sourceMappingURL=check.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign}from"tslib";import{HTTPSnippet}from"./httpsnippet";import{serializeParameterValue}from"../../redoc-lib";import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import{getSecurityDetails,getPathParameter}from"../../utils";import{isSameMime,normalizeMimeType}from"../utils";function mapOperationToHAR(e,a){var t,r,i,n,s,o,l,u=a.exampleName,p=void 0===u?"":u,c=a.skipOptionalParameters,m=void 0!==c&&c,d=a.withOAuth2Call,h=void 0!==d&&d,
|
|
1
|
+
import{__assign}from"tslib";import{HTTPSnippet}from"./httpsnippet";import{serializeParameterValue}from"../../redoc-lib";import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import{getSecurityDetails,getPathParameter}from"../../utils";import{isSameMime,normalizeMimeType}from"../utils";function mapOperationToHAR(e,a){var t,r,i,n,s,o,l,u=a.exampleName,p=void 0===u?"":u,c=a.skipOptionalParameters,m=void 0!==c&&c,d=a.withOAuth2Call,h=void 0!==d&&d,v=a.spec,f=a.generatedPayloadSamplesMaxDepth,g=void 0===f?8:f,y=getSecurityData(null===(t=e.security)||void 0===t?void 0:t[0],h),O=y.securityHeaders,_=y.securityCookies,S=y.securityQueries,T=y.securityOAuth2ExtraCalls,w=y.basicAuth,C=null===(i=null===(r=e.requestBody)||void 0===r?void 0:r.content)||void 0===i?void 0:i.active,A={skipNonRequired:m,skipReadOnly:!0,maxSampleDepth:g},P=!1,x=e.parameters.filter((function(e){return"header"===e.in})).filter((function(e){return!(m&&!e.required)})).map((function(e){return{name:e.name,value:serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,A,v))}})).map((function(e){return(null==C?void 0:C.name)&&"content-type"===e.name.toLowerCase()&&(P=!0,e.value=C.name),e})).concat(O);!P&&(null==C?void 0:C.name)&&x.unshift({name:"Content-Type",value:null==C?void 0:C.name});var E=e.parameters.filter((function(e){return"cookie"===e.in})).filter((function(e){return!(m&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,A,v)))})).reduce((function(e,a){for(var t=0,r=Object.entries(a);t<r.length;t++){var i=r[t],n=i[0],s=i[1];e.push({name:n,value:String(s)})}return e}),[]).concat(_),k=e.parameters.filter((function(e){return"query"===e.in})).filter((function(e){return!(m&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,A,v)))})).reduce((function(e,a){for(var t=0,r=Object.entries(a);t<r.length;t++){var i=r[t],n=i[0],s=i[1];e.push({name:n,value:String(s)})}return e}),[]).concat(S),H=(null===(n=e.servers[0])||void 0===n?void 0:n.url.replace(/\/$/,""))+"/"+e.path.replace(/^\//,""),b=e.parameters.filter((function(e){return"path"===e.in})).reduce((function(e,a){var t=a.in,r=a.name;return e[r]=getPathParameter(t+"."+r),e}),{}),R=(null===(o=null===(s=null==C?void 0:C.examples)||void 0===s?void 0:s[p])||void 0===o?void 0:o.value)||(null===(l=Object.values((null==C?void 0:C.examples)||{})[0])||void 0===l?void 0:l.value),z=null==C?void 0:C.name.toLowerCase(),D=isSameMime(z,"application/x-www-form-urlencoded")||isSameMime(z,"multipart/form-data"),j="application/json"===normalizeMimeType(z)?JSON.stringify(R):String(R||"");!j&&D&&(j=(null==C?void 0:C.schema)?stringifyQueryString(Sampler.sample(C.schema.rawSchema,A,v)):"");var N=D?objectToHarParams(parseQueryString(j)):[],q=j?{mimeType:(null==C?void 0:C.name)||"",text:j,params:N}:void 0;return{method:e.httpVerb,url:H,httpVersion:"HTTP/1.1",cookies:E,headers:x,queryString:k,postData:q,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:T,basicAuth:w,pathParameters:b}}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)}};export function getCodeSample(e){var a=e.lang,t=e.operation,r=e.exampleName,i=e.options,n=void 0===i?{}:i;try{var s=n,o=mapOperationToHAR(t,{exampleName:r,skipOptionalParameters:s.skipOptionalParameters,withOAuth2Call:s.withOAuth2Call,spec:s.spec,generatedPayloadSamplesMaxDepth:s.generatedPayloadSamplesMaxDepth}),l=new HTTPSnippet(o);return langToSnippetConfig[a]?l.convert(langToSnippetConfig[a].code,langToSnippetConfig[a].defaultTarget,__assign(__assign({},langToSnippetConfig[a].defaultOptions),n)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,a){for(var t,r,i,n,s={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0},o=0,l=(null==e?void 0:e.schemes)||[];o<l.length;o++){var u=l[o],p=getSecurityDetails(u.id);switch(u.type){case"openIdConnect":null===(t=s.securityHeaders)||void 0===t||t.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":var c=p.token?(p.token.token_type||"Bearer")+" "+p.token.access_token:"Bearer <YOUR_TOKEN_HERE>";u.flows.clientCredentials&&a?s.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(u.flows.clientCredentials,u.scopes,p)):u.flows.password&&a&&s.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(u.flows.password,u.scopes,p)),null===(r=s.securityHeaders)||void 0===r||r.push({name:"Authorization",value:c});break;case"apiKey":var m=p.raw||"YOUR_API_KEY_HERE";"header"===u.in&&(null===(i=s.securityHeaders)||void 0===i||i.push({name:u.name,value:m})),"cookie"===u.in&&s.securityCookies.push({name:u.name,value:m}),"query"===u.in&&s.securityQueries.push({name:u.name,value:m});break;case"http":"basic"===u.scheme?s.basicAuth={username:p.username||"<username>",password:p.password||"<password>"}:null===(n=s.securityHeaders)||void 0===n||n.push({name:"Authorization",value:capitalizeFirst(u.scheme||"bearer")+" <YOUR_"+(u.bearerFormat||"TOKEN")+"_HERE>"})}}return s}function getOAuth2PasswordCallHar(e,a,t){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:t.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:t.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:t.username||"<username>"},{name:"password",value:t.password||"<password>"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,a,t){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:"application/x-www-form-urlencoded"},{name:"Accept",value:"application/json"}],queryString:[],postData:{mimeType:"application/x-www-form-urlencoded",text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:t.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:t.client_secret||"YOUR_CLIENT_SECRET"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function objectToHarParams(e){for(var a=[],t=0,r=Object.entries(e);t<r.length;t++){var i=r[t],n=i[0],s=i[1];a.push({name:n,value:String(s)})}return a}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
|
package/lib-esm/utils.d.ts
CHANGED
|
@@ -25,6 +25,6 @@ export declare function getSecurityDetails(name: any): {
|
|
|
25
25
|
};
|
|
26
26
|
export declare function setPathParameters(key: string, value: string): void;
|
|
27
27
|
export declare function getPathParameter(key: string): string;
|
|
28
|
-
export declare function get(object: any, path: any, defval?:
|
|
28
|
+
export declare function get<T>(object: any, path: any, defval?: T): any;
|
|
29
29
|
export declare function joinStringFactory(separator: string): (...args: (string | undefined)[]) => string;
|
|
30
30
|
export declare const dottedString: (...args: (string | undefined)[]) => string;
|
package/lib-esm/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as React from"react";import{IS_BROWSER}from"./redoc-lib";export function debounce(t,e,r){var o,n=0;return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];function u(){n>1&&t.apply(void 0,a),n=0,o=null}n++,o?clearTimeout(o):r&&t.apply(void 0,a),o=setTimeout(u,e)}}export function toStorage(t,e){window.sessionStorage.setItem("redoc."+t,e)}export function fromStorage(t){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+t)||""}export function useDimensions(t){var e=React.useState(null),r=e[0],o=e[1];return React.useLayoutEffect((function(){if(t){var e=function(){return window.requestAnimationFrame((function(){return o(t.getBoundingClientRect())}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}}),[t]),[r]}export function setSecurityDetails(t,e){"string"==typeof e?toStorage("auth."+t,e):e&&(toStorage("auth."+t+".password",e.password||""),toStorage("auth."+t+".username",e.username||""),toStorage("auth."+t+".token",e.token&&JSON.stringify(e.token)||""),toStorage("auth."+t+".client_id",e.client_id||""),toStorage("auth."+t+".client_secret",e.client_secret||""),toStorage("auth."+t+".scopes",e.scopes&&JSON.stringify(e.scopes)||""))}export function getSecurityDetails(t){var e=fromStorage("auth."+t),r=fromStorage("auth."+t+".token");return{raw:e,password:fromStorage("auth."+t+".password"),username:fromStorage("auth."+t+".username"),token:r&&JSON.parse(r)||null,client_id:fromStorage("auth."+t+".client_id"),client_secret:fromStorage("auth."+t+".client_secret"),scopes:fromStorage("auth."+t+".scopes")}}export function setPathParameters(t,e){toStorage(t,e)}export function getPathParameter(t){return fromStorage(t)}export function get(t,e,r){return
|
|
1
|
+
import*as React from"react";import{IS_BROWSER}from"./redoc-lib";export function debounce(t,e,r){var o,n=0;return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];function u(){n>1&&t.apply(void 0,a),n=0,o=null}n++,o?clearTimeout(o):r&&t.apply(void 0,a),o=setTimeout(u,e)}}export function toStorage(t,e){window.sessionStorage.setItem("redoc."+t,e)}export function fromStorage(t){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+t)||""}export function useDimensions(t){var e=React.useState(null),r=e[0],o=e[1];return React.useLayoutEffect((function(){if(t){var e=function(){return window.requestAnimationFrame((function(){return o(t.getBoundingClientRect())}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}}),[t]),[r]}export function setSecurityDetails(t,e){"string"==typeof e?toStorage("auth."+t,e):e&&(toStorage("auth."+t+".password",e.password||""),toStorage("auth."+t+".username",e.username||""),toStorage("auth."+t+".token",e.token&&JSON.stringify(e.token)||""),toStorage("auth."+t+".client_id",e.client_id||""),toStorage("auth."+t+".client_secret",e.client_secret||""),toStorage("auth."+t+".scopes",e.scopes&&JSON.stringify(e.scopes)||""))}export function getSecurityDetails(t){var e=fromStorage("auth."+t),r=fromStorage("auth."+t+".token");return{raw:e,password:fromStorage("auth."+t+".password"),username:fromStorage("auth."+t+".username"),token:r&&JSON.parse(r)||null,client_id:fromStorage("auth."+t+".client_id"),client_secret:fromStorage("auth."+t+".client_secret"),scopes:fromStorage("auth."+t+".scopes")}}export function setPathParameters(t,e){toStorage(t,e)}export function getPathParameter(t){return fromStorage(t)}export function get(t,e,r){return"string"==typeof e&&(e=e.split(".")),e.reduce((function(t,e){return t&&t[e]?t[e]:r}),t)}export function joinStringFactory(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter(Boolean).join(t)}}export var dottedString=joinStringFactory(".");
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|