@redocly/openapi-docs 3.12.0-next.6 → 3.12.0-next.7
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 +1430 -1430
- package/lib/components/Replay/EmbeddedReplay.js +2 -2
- package/lib/components/Replay/Replay.js +1 -1
- package/lib/services/code-samples/httpsnippet/index.js +1 -1
- package/lib/types/open-api.d.ts +3 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -1
- package/lib/utils/telemetry.d.ts +1 -0
- package/lib/utils/telemetry.js +1 -0
- package/package.json +4 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{Suspense as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Suspense as b,lazy as h,memo as S,useEffect as x,useState as E}from"react";import{useAtomValue as o}from"jotai";import{globalOptionsAtom as O}from"../../jotai/store.js";import{operationStore as R}from"../../jotai/operation.js";import{appStore as C,environmentsAtom as L}from"../../jotai/app.js";import{useTranslate as T}from"../../hooks/index.js";import{convertOperationToReplayValue as V}from"./utils.js";import{getDefaultCollectorUrl as j}from"../../utils/telemetry.js";import{styled as i}from"../../styled-components.js";const A=h(async()=>import("@redocly/replay").then(r=>({default:r.EmbeddedReplay})));function k({activeOperationId:r,corsProxyUrl:d,fullOpenApi:l,pointer:t}){const n=T(),{mockServer:m}=o(O),s=o(R(t)),a=o(C),c=o(L),[f,u]=E(!1);return x(()=>{u(!0)},[]),e(U,{children:f?e(b,{fallback:e(p,{children:n("openapi.loading","Loading...")}),children:e(A,{activeOperationId:r,activeOperationPointer:t,api:l,settings:{environment:a.environment,predefinedEnvValues:c,corsProxyUrl:d,mockServer:m,disableCollectionsTab:!0,telemetry:{tracerName:"replay-openapi",collectorUrl:j()},convertOperationToReplayValue:(v,y,g)=>V(v,y,g,void 0,s,a)}})}):e(p,{children:n("openapi.loading","Loading...")})})}const F=S(k),p=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
align-items: center;
|
|
5
5
|
min-height: 100px;
|
|
6
|
-
`,
|
|
6
|
+
`,U=i.div`
|
|
7
7
|
border: 1px solid var(--border-color-primary);
|
|
8
8
|
border-radius: var(--border-radius-lg);
|
|
9
9
|
padding: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,Fragment as U,jsxs as F}from"react/jsx-runtime";import{lazy as B,memo as z,Suspense as J,useCallback as u,useRef as K,useState as M}from"react";import{Button as w,CircleDashIcon as H,Portal as Q,RocketIcon as W,useFocusTrap as X,useModalScrollLock as Y}from"@redocly/theme";import{useAtom as d,useAtomValue as c}from"jotai";import Z from"deepmerge";const $=B(async()=>import("@redocly/replay").then(t=>({default:t.ReplayOverlay})));import{globalOptionsAtom as ee,globalStoreAtom as te}from"../../jotai/store.js";import{allOperationsAtom as oe,replayStateAtom as re}from"../../jotai/replay.js";import{allOperations as ne,getDefaultOperationStore as ae}from"../../jotai/operation.js";import{LOADING_STATE as a}from"../../constants.js";import{environmentAtom as se,userClaimsAtom as ie}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as le}from"./utils.js";import{useTranslate as me,useTelemetry as ce}from"../../hooks/index.js";import{JsonPointer as pe}from"../../utils/index.js";import{getDefaultCollectorUrl as ue}from"../../utils/telemetry.js";import{createTryItOpenEvent as de,createTryItSentEvent as ye}from"../../events/index.js";function fe({operation:t,corsProxyUrl:D,fullOpenApi:y}){const f=me(),C=ce(),O=K(null),{mockServer:L,oAuth2RedirectURI:b,routingBasePath:p}=c(ee),I=c(oe),{parser:P,options:{events:s}}=c(te),N=c(ie),[l,E]=M(!1),[m,h]=d(re),[g,v]=d(ne),[[,V],A]=d(se);X(O),Y(l);const _=u(({operations:e,environment:o,environments:i})=>{const j=e.reduce((S,n)=>{n.requestValues.body=n.requestValues.body instanceof URLSearchParams?Object.fromEntries(n.requestValues.body.entries()):n.requestValues.body;const{path:k,method:G}=n.apiPath,T=pe.compile(["paths",k,G]);return S[T]=Z(ae(T),n),S},{});v({...g,...j}),A({environment:o,environments:i})},[g,v,A]),R=()=>{if(m!==a.LOADING){if(!l&&(C.send({type:"openapi_docs.try_it.opened"}),s?.tryItOpen&&t)){const e=de({operation:t});s.tryItOpen(e)}E(!l)}m===a.NOT_LOADED&&h(a.LOADING)},q=u(e=>{if(s?.tryItSent&&t){const o=ye({operation:t,isSuccess:e});s.tryItSent(o)}},[s,t]),x=u(e=>{if(!e)return;const o=I.find(i=>i.operationId===e);return p+o?.href},[I,p]);return y?F(U,{children:[r(w,{onClick:R,variant:"primary",iconPosition:"left",icon:m===a.LOADING?r(H,{}):r(W,{}),children:m===a.LOADING?f("openapi.loading","Loading..."):f("openapi.tryIt","Try it")}),l&&r(J,{children:r(Q,{mountId:"api-content",children:r("div",{ref:O,children:r($,{activeOperationId:t.operationId||t.pointer,api:y,onRequestChange:_,onClose:R,onLoad:()=>h(a.LOADED),settings:{corsProxyUrl:D,mockServer:L,environment:V,apiId:P?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:b,disableCollectionsTab:!0,storageKey:p,telemetry:{tracerName:"try-it",collectorUrl:ue()},convertOperationToReplayValue:(e,o,i)=>le(N)(e,o,i),getOperationUrl:x},onRequestSent:q})})})})]}):null}const Ee=z(fe);export{Ee as Replay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizeMimeType as
|
|
1
|
+
import{normalizeMimeType as b,unescapeServerVariables as p}from"../../utils.js";import{MediaTypes as s}from"../../../constants.js";import e from"./targets/index.js";import m from"./helpers/reducer.js";import{queryString as h}from"../../../utils/index.js";import{urlParse as j}from"../../../utils/url.js";class D{request;constructor(a){const r={...a};this.request=this.prepare({...r,httpVersion:r.httpVersion||"HTTP/1.1",queryString:r.queryString||[],headers:r.headers||[],cookies:r.cookies||[],postData:r.postData?{...r.postData,jsonObj:void 0,paramsObj:void 0}:void 0,bodySize:0,headersSize:0,queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{},uriObj:{},fullUrl:"",pathParameters:r.pathParameters||{},serverVariables:r.serverVariables||{}})}prepare(a){if(a.queryString&&a.queryString.length&&(a.queryObj=a.queryString.reduce(m,{})),a.headers&&a.headers.length){const i=/^HTTP\/2/;a.headersObj=a.headers.reduce(function(t,c){let n=c.name;return a.httpVersion.match(i)&&(n=n.toLowerCase()),t[n]=c.value,t},{})}a.cookies&&a.cookies.length&&(a.cookiesObj=a.cookies.reduceRight(function(i,t){return i[t.name]=t.value,i},{}));const r=a.cookies.map(function(i){return encodeURIComponent(i.name)+"="+encodeURIComponent(i.value)});if(r.length&&(a.allHeaders.cookie=r.join("; ")),a.postData)switch(b(a.postData.mimeType)){case"multipart/mixed":case"multipart/related":case s.MULTIPART:case"multipart/alternative":break;case s.URL_ENCODED:a.postData?.params?(a.postData.paramsObj=a.postData.params.reduce(m,{}),a.postData.text=h.stringify(a.postData.paramsObj)):a.postData.text="";break;case"text/json":case"text/x-json":case s.JSON:case"application/x-json":if(a.postData.text)try{a.postData.jsonObj=JSON.parse(a.postData.text)}catch{a.postData.mimeType="text/plain"}break}if(a.allHeaders=Object.assign(a.allHeaders,a.headersObj),a.uriObj=j(a.url,!0),!a.uriObj)return{...a,uriObj:{protocol:"",path:"",queryObj:{},query:{}}};if(a.queryObj)for(const[i,t]of Object.entries(a.queryObj))a.uriObj.searchParams.has(i,t)||a.uriObj.searchParams.set(i,t);a.uriObj.query=Object.fromEntries(a.uriObj.searchParams.entries()),a.queryObj=a.uriObj.query,a.uriObj.path=a.uriObj.pathname=p(a.uriObj.pathname);const o=new URL(a.uriObj.toString());return o.search="",a.url=p(o.toString()),a.uriObj.search&&(a.uriObj.path=a.uriObj.pathname+"?"+a.uriObj.search),a.fullUrl=p(a.uriObj.toString()),a}convert(a,r,o){!o&&r&&(o=r);const i=this._matchTarget(a,r);if(i){const t=i(this.request,o,{target:a,client:r});return t.length===1?t[0]:t}throw new Error("Cannot match target")}_matchTarget(a,r){return Object.prototype.hasOwnProperty.call(e,a)?typeof r=="string"&&typeof e[a][r]=="function"?e[a][r]:e[a][e[a].info.default]:!1}}export{D as HTTPSnippet};
|
package/lib/types/open-api.d.ts
CHANGED
|
@@ -222,9 +222,10 @@ export interface OpenAPIEncoding {
|
|
|
222
222
|
export type OpenAPIParameterLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
223
223
|
export type OpenAPIParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
|
|
224
224
|
export interface OpenAPIRequestBody extends ParsedDescription {
|
|
225
|
+
$ref?: string;
|
|
225
226
|
description?: string;
|
|
226
227
|
required?: boolean;
|
|
227
|
-
content
|
|
228
|
+
content?: {
|
|
228
229
|
[mime: string]: OpenAPIMediaType;
|
|
229
230
|
};
|
|
230
231
|
'x-examples'?: {
|
|
@@ -250,6 +251,7 @@ export interface OpenAPIResponse extends ParsedDescription {
|
|
|
250
251
|
links?: {
|
|
251
252
|
[name: string]: Referenced<OpenAPILink>;
|
|
252
253
|
};
|
|
254
|
+
$ref?: string;
|
|
253
255
|
'x-examples'?: {
|
|
254
256
|
[mime: string]: {
|
|
255
257
|
[name: string]: Referenced<OpenAPIExample>;
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./JsonPointer.js";export*from"./openapi.js";export*from"./helpers.js";export*from"./dom.js";export*from"./debug.js";export*from"./sort.js";export*from"./argValuesHelpers.js";export*from"./theme-helpers.js";export*from"./debounce.js";export*from"./security-details.js";export*from"./session-storage.js";export*from"./local-storage.js";export*from"./parameters.js";export*from"./string.js";export*from"./test-utils.js";export*from"./compose.js";export*from"./saveTextBeforeHeading.js";export*from"./path.js";export*from"./queryString.js";export*from"./isMobile.js";export*from"./replaceVariables.js";export*from"./areArraysEqual.js";export*from"./configure-helpers.js";
|
|
1
|
+
export*from"./JsonPointer.js";export*from"./openapi.js";export*from"./helpers.js";export*from"./dom.js";export*from"./debug.js";export*from"./sort.js";export*from"./argValuesHelpers.js";export*from"./theme-helpers.js";export*from"./debounce.js";export*from"./security-details.js";export*from"./session-storage.js";export*from"./local-storage.js";export*from"./parameters.js";export*from"./string.js";export*from"./test-utils.js";export*from"./compose.js";export*from"./saveTextBeforeHeading.js";export*from"./path.js";export*from"./queryString.js";export*from"./isMobile.js";export*from"./replaceVariables.js";export*from"./areArraysEqual.js";export*from"./configure-helpers.js";export*from"./telemetry.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDefaultCollectorUrl(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withPathPrefix as o}from"@redocly/theme";import{TELEMETRY_URLS as t}from"@redocly/shared";function i(){return process.env.NODE_ENV==="development"?t.OTEL_COLLECTOR_LOCAL:window.location.origin+o("/_otel")}export{i as getDefaultCollectorUrl};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.12.0-next.
|
|
3
|
+
"version": "3.12.0-next.7",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@markdoc/markdoc": "0.5.2",
|
|
24
|
-
"@redocly/openapi-core": "2.0.0-next.
|
|
24
|
+
"@redocly/openapi-core": "2.0.0-next.4",
|
|
25
25
|
"deepmerge": "^4.2.2",
|
|
26
26
|
"dompurify": "3.2.6",
|
|
27
27
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.26.3",
|
|
40
|
-
"@redocly/replay": "0.15.0-next.3"
|
|
40
|
+
"@redocly/replay": "0.15.0-next.3",
|
|
41
|
+
"@redocly/shared": "1.3.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@jest/globals": "29.5.0",
|