@redocly/openapi-docs 3.16.0-next.0 → 3.16.0-next.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as J,memo as K,Suspense as W,useCallback as m,useRef as w,useState as H}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=J(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/
|
|
1
|
+
import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as J,memo as K,Suspense as W,useCallback as m,useRef as w,useState as H}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=J(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/use-configure-replay";import{globalOptionsAtom as ne,globalStoreAtom as ae}from"../../jotai/store.js";import{allOperationsAtom as se,replayStateAtom as ie}from"../../jotai/replay.js";import{allOperations as le,getDefaultOperationStore as me}from"../../jotai/operation.js";import{LOADING_STATE as n}from"../../constants.js";import{environmentAtom as pe,userClaimsAtom as ce}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as fe}from"./utils.js";import{useTranslate as ue,useTelemetry as de}from"../../hooks/index.js";import{JsonPointer as ye}from"../../utils/index.js";import{getDefaultCollectorUrl as he}from"../../utils/telemetry.js";import{createTryItOpenEvent as Oe,createTryItSentEvent as Ie}from"../../events/index.js";import{joinWithSeparator as Re}from"../../services/history/helpers.js";function ge({operation:e,corsProxyUrl:L,fullOpenApi:d}){const y=ue(),P=de(),h=w(null),{mockServer:q,oAuth2RedirectURI:E,routingBasePath:c}=p(ne),O=p(se),{parser:I,options:{events:a}}=p(ae),R=p(ce),[s,N]=H(!1),[l,g]=u(ie),[v,A]=u(le),[[,V],S]=u(pe),{config:j,refresh:T}=re({userClaims:R,info:I?.definition.info,operation:{name:e.name,path:e.path,operationId:e.operationId||"",href:e.href,method:e.httpVerb},servers:e.servers},s);Z(h),$(s);const x=m(()=>T(),[T]),k=m(({operations:t,environment:i,environments:f})=>{const _=t.reduce((C,r)=>{r.requestValues.body=r.requestValues.body instanceof URLSearchParams?Object.fromEntries(r.requestValues.body.entries()):r.requestValues.body;const{path:F,method:B}=r.apiPath,b=ye.compile(["paths",F,B]);return C[b]=Q(me(b),r),C},{});A({...v,..._}),S({environment:i,environments:f})},[v,A,S]),D=()=>{if(l!==n.LOADING){if(!s&&(P.sendTryItOpenedMessage(),a?.tryItOpen&&e)){const t=Oe({operation:e});a.tryItOpen(t)}N(!s)}l===n.NOT_LOADED&&g(n.LOADING)},G=m(t=>{if(a?.tryItSent&&e){const i=Ie({operation:e,isSuccess:t});a.tryItSent(i)}},[a,e]),U=m(t=>{if(!t)return;const i=O.find(f=>f.operationId===t);return Re(c,i?.href)},[O,c]);return d?z(M,{children:[o(Y,{onClick:D,variant:"primary",iconPosition:"left",icon:l===n.LOADING?o(te,{}):o(ee,{}),children:l===n.LOADING?y("openapi.loading","Loading..."):y("openapi.tryIt","Try it")}),s&&o(W,{children:o(oe,{mountId:"api-content",children:o("div",{ref:h,children:o(X,{activeOperationId:e.operationId||e.pointer,api:d,onRequestChange:k,onClose:D,onLoad:()=>g(n.LOADED),settings:{corsProxyUrl:L,mockServer:q,selectedEnvironment:V,apiId:I?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:E,disableCollectionsTab:!0,storageKey:c,telemetry:{tracerName:"try-it",collectorUrl:he()},convertOperationToReplayValue:fe(R,j),getOperationUrl:U,onRequestReset:x},onRequestSent:G})})})})]}):null}const Me=K(ge);export{Me as Replay};
|
|
@@ -3,10 +3,10 @@ import type { ConfigureRequestValues, ConfigureServerRequestValues, SecurityDeta
|
|
|
3
3
|
export declare function updateOperationWithRequestValues(operation: OperationModel, userDefinedRequestValues: ConfigureRequestValues | ConfigureServerRequestValues): void;
|
|
4
4
|
export declare function updateParametersWithUserValues(param: FieldModel, userDefinedRequestValues?: ConfigureRequestValues | ConfigureServerRequestValues): void;
|
|
5
5
|
export declare function updateRequestBodyWithUserValues(operation: OperationModel, userDefinedRequestValues: ConfigureRequestValues, serverUrl?: string): OperationModel | undefined;
|
|
6
|
-
export declare function updateSecurityWithUserValues(operation: OperationModel, securityValues?:
|
|
6
|
+
export declare function updateSecurityWithUserValues(operation: OperationModel, securityValues?: Record<string, SecurityDetails>, serverUrl?: string): void;
|
|
7
7
|
export declare function updateOperationWithServerUserValues(operation: OperationModel, serverRequestValues: ConfigureServerRequestValues): void;
|
|
8
8
|
export declare function updateEnvVariablesWithUserValues(operation: OperationModel, environmentValues?: Record<string, string>, serverUrl?: string): void;
|
|
9
9
|
export declare function updateServerVariablesWithUserValues(operation: OperationModel, serverVariables?: Record<string, string>, serverUrl?: string): void;
|
|
10
10
|
export declare function isDirectRequestValues(value: any): value is ConfigureRequestValues;
|
|
11
11
|
export declare function updateObjectProperties(original: any, updates: any): any;
|
|
12
|
-
export declare function createSecurityUpdates(scheme: any, securityValues: SecurityDetails): SecurityCredentials;
|
|
12
|
+
export declare function createSecurityUpdates(scheme: any, securityValues: Record<string, SecurityDetails>): SecurityCredentials;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as
|
|
1
|
+
import{isObject as k}from"@redocly/theme/core/openapi";function p(e,r){Object.keys(r).length!==0&&(h(r)?(b(e,r),y(e,r.security),d(e,r.envVariables),v(e,r.serverVariables)):j(e,r))}function O(e,r){if(!r)return;const{in:s,name:t}=e;if(h(r)){const a=r,c={header:a.headers,query:a.query,path:a.path,cookie:a.cookie};s&&c[s]?.[t]&&(e.example=c[s][t])}else Object.entries(r).forEach(([a,c])=>{const f=c;if(!f)return;const n={header:f.headers,query:f.query,path:f.path,cookie:f.cookie};s&&n[s]?.[t]&&(e.serverValues||(e.serverValues={}),e.serverValues[a]={example:n[s][t]})})}function b(e,r,s){if(!e.requestBody||!r?.body)return;const t=e.requestBody.content;if(!t?.mediaTypes)return;const a=(c,f)=>{c[f]&&Object.keys(c[f]).forEach(n=>{const o=c[f]?.[n]?.value;let l;if(k(o)?l=u(o,r.body):l=r.body,!!l)if(s){const i=c[f][n];i.serverValues||(i.serverValues={}),i.serverValues[s]={value:l,rawValue:l},c[f][n]={...i,mime:c.name}}else c[f][n]={value:l,rawValue:l,mime:c.name}})};for(const c of t.mediaTypes)a(c,"examples"),a(c,"formExamples");return e}function y(e,r,s){!r||!e.security.length||e.security.forEach(t=>{s?t.schemes.forEach(a=>{a.serverValues||(a.serverValues={});const c=V(a,r);a.serverValues[s]=c}):t.schemes.forEach(a=>{const c=V(a,r);Object.assign(a,c)})})}function j(e,r){e.servers.forEach(s=>{if(r[s.url]){const t=r[s.url];t&&(b(e,t,s.url),y(e,t.security,s.url),d(e,t.envVariables,s.url),v(e,t.serverVariables,s.url))}})}function d(e,r,s){!r||Object.keys(r).length===0||(e.envVariables||(e.envVariables={}),s?(e.envVariables.serverValues||(e.envVariables.serverValues={}),e.envVariables.serverValues[s]={...e.envVariables.serverValues[s],...r}):e.envVariables.values={...e.envVariables.values,...r})}function v(e,r,s){if(!(!r||Object.keys(r).length===0))if(s){const t=e.servers.find(a=>a.url===s);if(t){t.variables||(t.variables={});for(const[a,c]of Object.entries(r))t.variables[a]&&(t.variables[a].default=c)}}else e.servers.forEach(t=>{t.variables||(t.variables={});for(const[a,c]of Object.entries(r))t.variables[a]&&(t.variables[a].default=c)})}function h(e){return!e||typeof e!="object"?!1:"headers"in e||"body"in e||"query"in e||"path"in e||"cookie"in e||"security"in e||"envVariables"in e||"serverVariables"in e}function u(e,r){if(!e||typeof e!="object")return r;if(Array.isArray(e)&&Array.isArray(r)){if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const t=Object.keys(e[0]),a=r.filter(c=>typeof c!="object"||c===null?!1:t.some(f=>f in c)&&Object.keys(c).every(f=>t.includes(f)));return a.length>0?a:e}return r}const s=Array.isArray(e)?[...e]:{...e};for(const[t,a]of Object.entries(r))t in e&&(Array.isArray(e[t])||typeof a=="object"&&a!==null&&typeof e[t]=="object"?s[t]=u(e[t],a):s[t]=a);return s}function V(e,r){const s=r?.[e.id]||r?.default||{},t={"x-defaultAccessToken":s.token?.access_token,"x-defaultTokenType":s.token?.token_type||"Bearer","x-defaultClientId":s.client_id,"x-defaultClientSecret":s.client_secret,scopes:s.scopes||e.scopes};return e.type==="http"&&e.scheme==="basic"?(t["x-defaultUsername"]=s.username,t["x-defaultPassword"]=s.password,delete t["x-defaultAccessToken"],delete t["x-defaultTokenType"]):e.type==="oauth2"&&!s.token?.access_token&&(delete t["x-defaultAccessToken"],delete t["x-defaultTokenType"]),t}export{V as createSecurityUpdates,h as isDirectRequestValues,d as updateEnvVariablesWithUserValues,u as updateObjectProperties,p as updateOperationWithRequestValues,j as updateOperationWithServerUserValues,O as updateParametersWithUserValues,b as updateRequestBodyWithUserValues,y as updateSecurityWithUserValues,v as updateServerVariablesWithUserValues};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.16.0-next.
|
|
3
|
+
"version": "3.16.0-next.2",
|
|
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.
|
|
24
|
+
"@redocly/openapi-core": "2.11.1",
|
|
25
25
|
"deepmerge": "^4.2.2",
|
|
26
26
|
"dompurify": "3.2.7",
|
|
27
27
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.38.0",
|
|
40
|
-
"@redocly/replay": "0.19.0-next.
|
|
40
|
+
"@redocly/replay": "0.19.0-next.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "5.9.3",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
77
|
"vite": "7.1.9",
|
|
78
|
-
"@redocly/theme": "0.60.0-next.
|
|
78
|
+
"@redocly/theme": "0.60.0-next.1"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"start": "npm run copy-highlight-hook && vite",
|