@redocly/replay 0.19.0-next.7 → 0.19.0-next.9
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/{replay-index-WUg86m8i.js → replay-index-BL7YkMvp.js} +1 -1
- package/dist/{replay-index-C8pDALOS.js → replay-index-C4udHrKY.js} +1264 -1166
- package/dist/{replay-index-BuI2GskO.js → replay-index-CG3REXUe.js} +1 -1
- package/dist/{replay-index-NDNpLiOw.js → replay-index-CWARLuea.js} +1 -1
- package/dist/{replay-index-SvUWC5Fb.js → replay-index-CvSP3dOF.js} +33035 -32266
- package/dist/{replay-index-D8v0TtYF.js → replay-index-DR9w1MHi.js} +1 -1
- package/dist/{replay-index-oZG-NaDd.js → replay-index-GKgIEQV4.js} +1 -1
- package/dist/{replay-index-BmZCebju.js → replay-index-sC53pbc4.js} +1 -1
- package/dist/{replay-tauri-path-1GOkp6vY.js → replay-tauri-path-C3qER3cW.js} +1 -1
- package/dist/{replay-tauri-path-BvrSp-Sl.js → replay-tauri-path-CxnhUZxU.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./replay-index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./replay-index-C4udHrKY.js");async function ho(r){const{descriptionPath:t,externalRefResolver:e,base:n}=r,a=await d.bundle({base:n,ref:t,config:r.config,dereference:!0,externalRefResolver:e});if(!a)throw new Error(`Could not find source description file '${t}'.`);return a.bundle.parsed}function Nt(r){if(typeof r!="object")return;const t=Object.keys(r)[0];return t?r[t]?.value:void 0}const go=r=>/\{.*?\}/.test(r);function oe({value:r,ctx:t,logger:e}){if(!r)return r;if(typeof r=="object"){for(const n in r)r[n]=oe({value:r[n],ctx:t,logger:e});return r}return typeof r=="number"||typeof r=="boolean"?r:r.toString().startsWith("$faker.")?De({pointer:r.slice(1),ctx:t,logger:e}):go(r)?$o(r,t,e):vo(r,t,e)}function mo(r,t,e){const n=r.indexOf("{");if(n!==-1){const c=r.substring(n+1).slice(0,-1),f=De({pointer:c.slice(1),ctx:t,logger:e});return f&&r.replace(/{(.*)}/,f)}else return r}function yo(r,t){const e=Object.keys(t),n=Object.values(t);return new Function(...e,`return ${r}`)(...n)}function $o(r,t,e){const n=/\{\$(\{[^{}]*\}|[^{}])*\}/g;let a=r;return a=a.replace(n,(c,f)=>wo(c,t,e)),a}function wo(r,t,e){if(!r.includes("$"))return r;if(r.includes("$faker."))return mo(r,t,e);const n=Fe(t)(Eo(r));return n!==void 0?n:""}const vo=(r,t,e)=>{if(!r)return r;const n=r.toString();if(!n.includes("$"))return r;if(n.startsWith("$file(")&&n.endsWith(")"))return n.slice(7,-2);if(n.startsWith("$sourceDescriptions.")&&n.includes(".workflows.")){const a=n.split("."),c=a[1],f=a[3];if(!c||!f)return;const l=Fe(t)("$sourceDescriptions");return l[c]?l[c].workflows.find(g=>g.workflowId===f):void 0}return n&&n.trim().startsWith("faker.")?De({pointer:n,ctx:t,logger:e}):n?Fe(t)(kt(n)):n.replace(/\$\{([^}]+)}/g,(a,c)=>Fe(t)(kt(c)))};function Eo(r){return r.replace(/\{(.*)\}/,"$1")}function kt(r){return r.replace(/\['(.*?)'\]/g,".$1")}const Fe=(r,t="")=>e=>{if(t||(t=e),!e)return r;const[n,...a]=e.split(".");if(!r)throw Error(`Cannot get ${d.red(n)} from ${d.red(t)}`);if(r?.[n]===void 0){const c=` Undefined ${d.red(n)} at ${d.red(t)}.`,f=Object.keys(r).length?`Did you mean to use another key? Available keys:
|
|
2
2
|
${Object.keys(r).join(", ")}.
|
|
3
3
|
`:"",l=`${c} ${f}`;throw Error(l)}return Fe(r[n],t)(a.join("."))};function De({pointer:r,ctx:t,logger:e}){const n=r.split("."),a={ctx:{faker:t.$faker}};try{const c=n.map(f=>f.trim()).map((f,l)=>f.endsWith(")")?`${l==0?"":"."}${f}`:`["${f}"]`).join("");return yo(`ctx${c}`,a)}catch(c){e.error(d.red(c.toString()));return}}function jt(r,t,e){if(typeof r=="string"&&r)return oe({value:r,ctx:t,logger:e});if(!(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r>"u"||r instanceof Blob||r===null))for(const n in r)typeof r[n]=="string"?r[n]&&(r[n]=oe({value:r[n],ctx:t,logger:e})):jt(r[n],t,e)}function St(r,t,e){return jt(r,t,e)||r}function Ct(r,t){if(!r)return;const e={};for(const n in t)e[`{${n}}`]=String(t[n]);return r.split(/(\{[a-zA-Z0-9_.-]+\}+)/g).map(n=>e[n]?e[n]:n).join("")}function ko(r){return typeof r=="object"&&r!==null&&"name"in r&&"value"in r&&!("in"in r)}function Ir(r){return typeof r=="object"&&r!==null&&"in"in r&&["header","query","path","cookie"].includes(r.in)}const So=/^image\/(png|jpeg|gif|bmp|webp|svg\+xml)|application\/pdf$/;function Wt(r){return r.startsWith("$file(")&&r.endsWith(")")?r.substring(7,r.length-2):r}const bt=async(r,t,e,n,a)=>{const c=d.pathBrowserifyExports.dirname(n),f=d.pathBrowserifyExports.resolve(c,Wt(e));r.append(t,await a.options.requestFileLoader.getFileBody(f))},qt=(r,t,e,n,a,c)=>{Object.entries(e).forEach(([f,l])=>{const g=c?`${c}[${f}]`:f;typeof l=="string"&&l.startsWith("$file(")&&l.endsWith(")")?r.push(bt(t,g,l,n,a)):Array.isArray(l)?l.forEach(h=>{typeof h=="string"&&h.startsWith("$file(")&&h.endsWith(")")?r.push(bt(t,g,h,n,a)):t.append(g,h.toString())}):typeof l=="object"&&l!==null?qt(r,t,l,n,a,g):(typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&t.append(g,l.toString())})},Co=async(r,t,e,n)=>{if(r&&typeof r=="object"&&!Array.isArray(r)){const a=[];qt(a,t,r,e,n),await Promise.all(a)}},bo=async(r,t)=>{if(typeof r=="string"&&r.startsWith("$file(")&&r.endsWith(")")){const e=d.pathBrowserifyExports.resolve(d.pathBrowserifyExports.dirname(t.options.filePath),Wt(r));return t.options.requestFileLoader.getFileBody(e)}else return r};async function Ao(r,t){if(!r)return{payload:void 0,contentType:void 0,encoding:void 0,replacements:void 0};const{payload:e,contentType:n}=r;if(n==="multipart/form-data"){const a=new FormData,c=d.pathBrowserifyExports.resolve(t.options.filePath);return await Co(e,a,c,t),{...r,payload:a}}else{if(n==="application/octet-stream"||typeof n=="string"&&So.test(n))return{...r,payload:await bo(e,t),contentType:"application/octet-stream"};if(n==="application/x-www-form-urlencoded"&&typeof e=="string")return{...r,payload:Object.fromEntries(new URLSearchParams(e).entries()),contentType:"application/x-www-form-urlencoded"}}return r}function Ro(r){try{return d.parseRuntimeExpression(r)}catch{throw new Error(`Runtime expression is not valid: ${r}`)}}function Oo(r,t){const e=[{pattern:/\$response\.body#\/([\w/]+)/g,ctxFunction:(a,c)=>Te(t.$response?.body,c,a)},{pattern:/\$request\.body#\/([\w/]+)/g,ctxFunction:(a,c)=>Te(t.$request?.body,c,a)},{pattern:/\$outputs\.([\w-]+)#\/([\w/]+)/g,ctxFunction:(a,c,f)=>Te(t.$outputs?.[c],f,a)},{pattern:/\$workflows\.([\w-]+)\.outputs\.([\w-]+)#\/([\w/]+)/g,ctxFunction:(a,c,f,l)=>Te(t.$workflows?.[c]?.outputs?.[f],l,a)},{pattern:/\$steps\.([\w-]+)\.outputs\.([\w-]+)#\/([\w/]+)/g,ctxFunction:(a,c,f,l)=>Te(t.$steps?.[c]?.outputs?.[f],l,a)}];let n=r;for(const{pattern:a,ctxFunction:c}of e)n=n.replaceAll(a,c);return n}function Te(r,t,e){if(r)try{const n=d.pointer.get(r,`/${t}`);return typeof n=="string"||Array.isArray(n)||typeof n=="object"?JSON.stringify(n):n!==void 0?n:e}catch{return e}return e}function re({payload:r,context:t,contentType:e,logger:n}){if(e?.includes("application/octet-stream"))return St(r,t,n);if(e?.includes("multipart/form-data")){if(r instanceof FormData){const a=new FormData;for(const[c,f]of r.entries())if(f instanceof File)a.append(c,f);else{const l=re({payload:f,context:t,logger:n});a.append(c,l)}return a}return St(r,t,n)}return typeof r=="string"?No(r)?ye(r,t,n):Lo(r,t,n):d.isPlainObject(r)?Object.entries(r).reduce((a,[c,f])=>(a[c]=re({payload:f,context:t,logger:n}),a),{}):Array.isArray(r)?r.map(a=>re({payload:a,context:t,logger:n})):r}function ye(r,t,e){return typeof r=="string"?To(r,t,e):d.isPlainObject(r)?Object.entries(r).reduce((n,[a,c])=>(n[a]=c&&ye(c,t,e),n),{}):Array.isArray(r)?r.map(n=>ye(n,t,e)):r}function To(r,t,e){if(/^\$faker\.[a-zA-Z0-9._-]+(\([^\\)]*\))?$/.test(r))return De({pointer:r.slice(1),ctx:t,logger:e});if(r.includes("$faker.")){const c=/\$faker\.[a-zA-Z0-9._-]+(\([^\\)]*\))?/g;r=r.replace(c,f=>De({pointer:f.slice(1),ctx:t,logger:e})).replace(/{(.*?)}/g,"$1")}if(!r.includes("$")&&!/[=<>]/.test(r))return r;Ro(r);const n=_o(r,t),a=Fo(t);try{return new Function(...Object.keys(a),`return ${n};`)(...Object.values(a))}catch{throw new Error(`Error in resolving runtime expression '${r}'.
|
|
4
4
|
This could be because the expression references a value from a previous failed step, or is trying to reference a variable that hasn't been set.`)}}function Po(r){return r.replace(/\$([a-zA-Z0-9._-]+)/g,(t,e)=>`$${e.replace(/-/g,"_")}`)}function _o(r,t){const e=Oo(r,t),a=Po(e).replace(/{(.*?)}/g,"$1"),c=Do(a),f=/\.header\.([a-zA-Z0-9._-]+)/g;return c.replace(f,(g,h)=>`.header.${h.toLowerCase()}`)}function Fo(r){const t={};for(const[e,n]of Object.entries(r)){const a=e.replace(/-/g,"_");t[a]=Ut(n)}return t}function Ut(r){return Array.isArray(r)?r:typeof r=="object"&&r!==null?Io(r):r}function Io(r){return Object.keys(r).reduce((t,e)=>{const n=e.replace(/-/g,"_");return t[n]=Ut(r[e]),t},{})}function Do(r){return r.replace(/\.(\d+)/g,(t,e,n,a)=>{const c=a[n-1];return/\d/.test(c)?t:`[${e}]`})}function Lo(r,t,e){const n=/\{(?:[^{}]|\{[^{}]*\})*\}|\$[^\s{}]+(?:\([^()]*\))*/g;return r.replace(n,a=>{const c=a.trim(),f=ye(c,t,e);return f!==void 0?f:a})}function No(r){return/^\$[^\s{}]+(\([^)]*\))?$|^\{[^{}]*\}$/.test(r.trim())}function jo({payload:r,replacements:t,expressionContext:e,logger:n}){for(const a of t){const{target:c,value:f}=a;if(typeof c!="string")throw new Error(`Invalid JSON Pointer: ${c}`);try{const l=d.pointer.get(r,c),g=re({payload:f,context:e,logger:n});l!==void 0&&d.pointer.set(r,c,g)}catch{throw new Error(`Invalid JSON Pointer: ${c}`)}}}const Wo=["parameters","failureActions","successActions"];function qo(r,t){const{reference:e,value:n}=r;if(!Wo.some(c=>e.includes(`$components.${c}`)))throw new Error("Invalid reference: available components are $components.parameters, $components.failureActions, or $components.successActions");const a=oe({value:e,ctx:t,logger:t.options.logger});return"value"in a&&n?{...a,value:n}:a}function _e(r,t){return"reference"in r?qo(r,t):r}function Uo(r,t){const e=r?.requestBody?.content||{},[n,a]=Object.entries(e)[0]||[],c=a?.example||Nt(a?.examples)||zt(a?.schema,t),f=zo(r);return{parameters:Bo([...At(r.pathParameters,t),...At(r.parameters,t)]).filter(({value:g})=>g),contentTypeParameters:[...n?[{name:"content-type",in:"header",value:n}]:[],...f?[{name:"accept",in:"header",value:f}]:[]],requestBody:c,contentType:n}}function zo(r){return r?.responses?Array.from(new Set(Object.values(r.responses).flatMap(t=>d.isPlainObject(t)&&"content"in t?Object.keys(t.content||{}):[]))).join(", "):void 0}function At(r,t){return(r||[]).filter(e=>e?.required===!0).map(e=>{if(Ir(e))return{name:e.name,in:e.in,value:Xo(e,t)}}).filter(e=>e!==void 0)}function Bo(r){const t={};for(const e of r)Ir(e)&&(t[(e.name+":"+e.in).toLowerCase()]=e);return Object.values(t)}function xo(r,t){let e,n;if(r.includes("$sourceDescriptions.")){const[,g,h]=r.split(".");e=g,n=h}else r.includes(".")?[e,n]=r.split("."):(n=r,e=Object.keys(t)[0]);const a=Object.keys(t);if(!t[e])throw new Error(`Unknown description name ${d.red(e)} at ${d.red(r)}. Available descriptions: ${a.join(", ")}.`);const c=t[e],f=c?.components?.securitySchemes,l=c.servers;for(const[g,h]of Object.entries(t[e].paths)){if(!h)return;for(const[y,w]of Object.entries(h))if(w.operationId===n)return{servers:h.servers||l,...w,pathParameters:w.parameters||[],path:g,method:y,descriptionName:e,securitySchemes:f}}throw new Error(`Unknown operationId ${d.red(n)} at ${d.red(r)}.`)}function Mo(r,t){const{$sourceDescriptions:e,sourceDescriptions:n}=t,[a,c]=r.split("#");if(!n)throw new Error("Missing described sourceDescriptions");const f=n.find(P=>{if(["openapi","arazzo"].includes(P.type)){if(a.includes("$sourceDescriptions.")){const[,N]=a.split(".");return P.name===N}return"url"in P&&P.url===a}return!1})?.name;if(!f)throw new Error(`Unknown operationPath ${d.red(r)}. API description ${d.red(a)} is not listed in 'sourceDescriptions' workflow section.`);const l=e[f]||{},g=l?.components?.securitySchemes,[h,y,w]=d.pointer.parse(c);if(h!=="paths")throw new Error(`Invalid fragment identifier: ${c} at operationPath ${d.red(r)}.`);const{servers:k}=l,C=d.pointer.get(l,c)||{},j=d.pointer.get(l,d.pointer.compile(["paths",y]))||{};return{servers:j.servers||k,...C,pathParameters:j.parameters||[],path:y,method:w,descriptionName:f,securitySchemes:g}}function Vo(r,t){if(!r.operationId&&!r.operationPath)return;const{$sourceDescriptions:e,sourceDescriptions:n}=t,{operationId:a,operationPath:c}=r;return a?xo(a,e):c?Mo(c,{$sourceDescriptions:e,sourceDescriptions:n}):void 0}function Ko({statusCode:r,contentType:t,descriptionResponses:e}){return e?(e[r]||e.default)?.content?.[t]?.schema:void 0}function Ho(r,t){if(!t)return;const n=t.requestBody?.content;return n&&n[r]?.schema||void 0}const Jo={title:"[REPLACE WITH API title]",version:"[REPLACE WITH API version]"};function zt(r,t){if(r)try{return d.sample(r,{skipReadOnly:!0,skipNonRequired:!1,quiet:!0})}catch(e){t.error(d.bgRed(" Error while generating test data from JSON Schema ")+`
|