@redocly/cli 2.41.2 → 2.43.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.
Files changed (73) hide show
  1. package/README.md +15 -0
  2. package/THIRD_PARTY_NOTICES +3 -2
  3. package/lib/chunks/32XCOMOR.js +7 -0
  4. package/lib/chunks/3BCHPW6T.js +22 -0
  5. package/lib/chunks/3VZLNQK3.js +47 -0
  6. package/lib/chunks/4VF6MPJJ.js +11 -0
  7. package/lib/chunks/55GMSQDD.js +7 -0
  8. package/lib/chunks/5E3VKU5T.js +7 -0
  9. package/lib/chunks/AE6JGTY4.js +7 -0
  10. package/lib/chunks/C35TOMVY.js +8 -0
  11. package/lib/chunks/D5T6ETPZ.js +8 -0
  12. package/lib/chunks/DNOXLF53.js +8 -0
  13. package/lib/chunks/E36IFTLX.js +59 -0
  14. package/lib/chunks/ECZUPR2N.js +7 -0
  15. package/lib/chunks/EU6GURJZ.js +7 -0
  16. package/lib/chunks/HXYO6QS2.js +3132 -0
  17. package/lib/chunks/IW4HG6VD.js +19 -0
  18. package/lib/chunks/KIVPQZDC.js +31 -0
  19. package/lib/chunks/KLY5RV3W.js +7 -0
  20. package/lib/chunks/KM7RL6C4.js +2317 -0
  21. package/lib/chunks/L3YH7RCT.js +8 -0
  22. package/lib/chunks/NEWT5A6S.js +159 -0
  23. package/lib/chunks/NGPG6D6W.js +7 -0
  24. package/lib/chunks/O6MCQRCP.js +59 -0
  25. package/lib/chunks/O6PRCLSV.js +13 -0
  26. package/lib/chunks/OFAMJNQ6.js +7 -0
  27. package/lib/chunks/P26PQ2RU.js +7 -0
  28. package/lib/chunks/PFD7KGH7.js +93 -0
  29. package/lib/chunks/QFG7TTKG.js +22 -0
  30. package/lib/chunks/RFWIIJFG.js +7 -0
  31. package/lib/chunks/RS5PUOTT.js +18 -0
  32. package/lib/chunks/TMQJQANP.js +7 -0
  33. package/lib/chunks/UPPWQBGX.js +7 -0
  34. package/lib/chunks/UXH3ZSSV.js +9 -0
  35. package/lib/chunks/UYZXI3NO.js +7 -0
  36. package/lib/chunks/WNTLDT6L.js +184 -0
  37. package/lib/chunks/WZXA5XPB.js +7 -0
  38. package/lib/chunks/X6IKW6K4.js +7 -0
  39. package/lib/index.js +226 -13885
  40. package/package.json +1 -1
  41. package/lib/chunks/3CX2Z7JI.js +0 -496
  42. package/lib/chunks/3UUTQVCJ.js +0 -3614
  43. package/lib/chunks/4FB5ZIPP.js +0 -1133
  44. package/lib/chunks/5ILQMFXK.js +0 -59
  45. package/lib/chunks/7F5O43EU.js +0 -1756
  46. package/lib/chunks/7IX44JLO.js +0 -16
  47. package/lib/chunks/7MOL2QVN.js +0 -92635
  48. package/lib/chunks/A3VFVVHD.js +0 -25
  49. package/lib/chunks/A6JSOHCP.js +0 -41
  50. package/lib/chunks/AIT3U3JT.js +0 -22
  51. package/lib/chunks/ASYQPOQY.js +0 -681
  52. package/lib/chunks/BVP23YP7.js +0 -13374
  53. package/lib/chunks/FO6BDVGE.js +0 -25
  54. package/lib/chunks/GFU5KGSW.js +0 -92
  55. package/lib/chunks/ICPYP2LP.js +0 -401
  56. package/lib/chunks/KPMZLKQG.js +0 -79
  57. package/lib/chunks/KRMBH6JF.js +0 -17902
  58. package/lib/chunks/NLIKC7UP.js +0 -528
  59. package/lib/chunks/NW3XJZXQ.js +0 -175
  60. package/lib/chunks/P6UGG7F6.js +0 -414
  61. package/lib/chunks/RRC5IDC3.js +0 -2416
  62. package/lib/chunks/T6UZU3XM.js +0 -17
  63. package/lib/chunks/TS33ZDKX.js +0 -35
  64. package/lib/chunks/UUU33DK3.js +0 -125
  65. package/lib/chunks/VUDTNFRL.js +0 -42
  66. package/lib/chunks/VXIQEZPR.js +0 -2564
  67. package/lib/chunks/W7G5WVPB.js +0 -44
  68. package/lib/chunks/XB6C62FW.js +0 -18497
  69. package/lib/chunks/XHPY6UJF.js +0 -1638
  70. package/lib/chunks/Y6DTFCLS.js +0 -15
  71. package/lib/chunks/Z2664VV5.js +0 -39331
  72. package/lib/chunks/Z2I5YXYN.js +0 -20272
  73. package/lib/chunks/ZK3QRKL5.js +0 -129
@@ -0,0 +1,22 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a as oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./L3YH7RCT.js";import{D as X,E as g,F as O,G as Z,H as $,I as C,K as S,M as y,O as w,Q as ee,R as te,S as Je,W as ne,Y as re,_ as se,aa as ie,c as l,p as Y,u as Q,x as We}from"./WNTLDT6L.js";import{e as J}from"./RFWIIJFG.js";import fe from"node:path";function R(t){return t?t.trim():""}function T(t){let e=R(t.operationId)||R(t.path);return[R(t.ruleId),R(t.severity),R(t.message),e,R(t.target),R(t.schemaPath)].join("")}var F=t=>X(S(t));function Ye(t){return t==="error"?"error":t==="warning"?"warning":"note"}function Qe(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
8
+ `)?e:`"${e.replace(/"/g,'""')}"`}function Xe(t){return fe.isAbsolute(t)?fe.relative(process.cwd(),t)||".":t}function Ze(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function et(t){return Object.entries(t).sort((e,r)=>{let n=r[1]-e[1];return n!==0?n:e[0].localeCompare(r[0])})}function tt(t){let e=[],r=new Map;for(let n of t){let s=T({ruleId:n.ruleId,severity:n.severity,message:n.message,operationId:n.operationId,path:n.path,target:n.target,schemaPath:n.schemaPath}),i=r.get(s);if(i!==void 0){e[i].occurrences+=1;continue}r.set(s,e.length),e.push({finding:n,occurrences:1})}return e}function nt(t){let e=tt(t.findings).map(n=>({occurrences:n.occurrences,exchangeIndex:n.finding.exchangeIndex,ruleId:n.finding.ruleId,severity:n.finding.severity,category:n.finding.category,message:n.finding.message,operationId:n.finding.operationId,specSource:n.finding.specSource,target:n.finding.target,schemaPath:n.finding.schemaPath,dataPath:n.finding.dataPath,details:n.finding.details,method:n.finding.method,url:n.finding.url,path:n.finding.path,status:n.finding.status})),r={run:{id:t.runId,specSource:t.meta.specSource,trafficPath:t.meta.trafficPath,format:t.meta.format,matchMode:t.meta.matchMode,server:t.meta.server,totalExchanges:t.summary.totalExchanges,documentedExchanges:t.summary.documentedExchanges,undocumentedExchanges:t.summary.undocumentedExchanges,skippedExchanges:t.summary.skippedExchanges,findingsBySeverity:t.summary.findingsBySeverity,findingsByRule:t.summary.findingsByRule,totalProblems:t.summary.totalProblemGroups,durationMs:t.summary.durationMs},problems:e};return`${JSON.stringify(r,null,2)}
9
+ `}function rt(t){let e=["run_id","finding_id","exchange_index","severity","category","rule_id","message","method","path","url","status","operation_id","spec_source","target","schema_path","data_path"],r=t.findings.map(s=>[t.runId,s.id,s.exchangeIndex,s.severity,s.category,s.ruleId,s.message,s.method,s.path,s.url,s.status,s.operationId,s.specSource,s.target,s.schemaPath,s.dataPath]);return`${[e,...r].map(s=>s.map(Qe).join(",")).join(`
10
+ `)}
11
+ `}function st(t){let e=new Map;for(let s of t.findings)e.has(s.ruleId)||e.set(s.ruleId,{id:s.ruleId,name:s.ruleId,shortDescription:{text:`${s.category} detection`}});let r=t.findings.map(s=>{let i=s.specSource??s.url??void 0;return{ruleId:s.ruleId,level:Ye(s.severity),message:{text:s.message},locations:i?[{physicalLocation:{artifactLocation:{uri:i}}}]:void 0,properties:{runId:t.runId,exchangeIndex:s.exchangeIndex,method:s.method,path:s.path,status:s.status,operationId:s.operationId,target:s.target,schemaPath:s.schemaPath,dataPath:s.dataPath}}}),n={$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"drift",rules:Array.from(e.values())}},results:r}]};return`${JSON.stringify(n,null,2)}
12
+ `}function it(t){return t.findingsBySeverity.error+t.findingsBySeverity.warning+t.findingsBySeverity.info}function ot(t){return t>=500?O:t>=400?$:t>=300?C:t>=200?Z:y}function at(t,e,r){let n=(h,f)=>e?f(h):h,s=h=>h==="error"?n("\u2716",O):h==="warning"?n("\u25B2",$):n("\u25CF",C),i=h=>h==="error"?n("ERROR",O):h==="warning"?n("WARN",$):n("INFO",C),{summary:o,meta:a}=t,c=it(o),p=o.previewFindings.slice(0,r),u=[];if(u.push(n("\u250F\u2501 Drift Report",F)),u.push(`\u2503 Run: ${t.runId}`),u.push(`\u2503 Spec: ${a.specSource}`),u.push(`\u2503 Traffic: ${a.trafficPath}`),u.push(a.server?`\u2503 Server: ${a.server} (overrides description servers)`:`\u2503 Match mode: ${a.matchMode}`),u.push(`\u2503 Traffic format: ${a.format}${a.format==="auto"?" (auto-detect)":""}`),u.push(`\u2503 Exchanges: total=${o.totalExchanges} documented=${o.documentedExchanges} undocumented=${o.undocumentedExchanges}${o.skippedExchanges>0?` skipped=${o.skippedExchanges}`:""}`),u.push(`\u2503 Findings: total=${c} ${n(`error=${o.findingsBySeverity.error}`,O)} ${n(`warning=${o.findingsBySeverity.warning}`,$)} ${n(`info=${o.findingsBySeverity.info}`,C)}`),u.push(`\u2503 Problems: total=${o.totalProblemGroups}`),u.push(`\u2517 Duration: ${o.durationMs}ms`),c===0)return u.push(""),u.push(n("\u2714 No findings.",S)),`${u.join(`
13
+ `)}
14
+ `;u.push(""),u.push(n(`Types (${Object.keys(o.problemGroupsByRule).length})`,F));for(let[h,f]of et(o.problemGroupsByRule)){let v=o.findingsByRule[h]??f;u.push(` ${n("\u2022",y)} ${h}: ${f} problems / ${v} findings`)}let m=new Map;for(let h of p)m.has(h.ruleId)||m.set(h.ruleId,[]),m.get(h.ruleId).push(h);let x=Array.from(m.keys()).sort((h,f)=>{let v=(o.problemGroupsByRule[f]??0)-(o.problemGroupsByRule[h]??0);return v!==0?v:h.localeCompare(f)});u.push(""),u.push(n(`Problems by type (showing first ${p.length} of ${o.totalProblemGroups})`,F));let q=0;for(let h of x){let f=m.get(h);if(!f||f.length===0)continue;let v=o.problemGroupsByRule[h]??f.length,ze=o.findingsByRule[h]??v;u.push(""),u.push(`${n("\u25C9",S)} ${n(h,F)} ${n(`(${f.length} problems shown / ${v} total, ${ze} findings)`,y)}`);for(let d of f){q+=1;let U=d.occurrences,De=d.status!==void 0?n(String(d.status),ot(d.status)):n("-",y),Ke=Ze(d.details)??d.path,Ue=d.operationId?` ${n(d.operationId,g)}`:"";if(u.push(`${s(d.severity)} ${i(d.severity)} #${q}${U>1?` ${n(`\xD7${U}`,y)}`:""} ${n("\u2192",y)} ${d.message}`),u.push(` \u21B3 sample exchange=${d.exchangeIndex} ${n(d.method,S)} ${Ke} (${De})${Ue}`),u.push(""),u.push(` ${n(d.url,y)}`),(d.specSource||d.schemaPath||d.dataPath)&&(u.push(""),d.specSource&&u.push(` ${n("spec:",g)} ${n(Xe(d.specSource),S)}`),d.schemaPath&&u.push(` ${n("schemaPath=",g)} ${n(d.schemaPath,g)}`),d.dataPath&&u.push(` ${n("dataPath=",g)} ${n(d.dataPath,S)}`)),d.details)if(u.push(""),d.ruleId==="security-baseline"&&typeof d.details.summary=="string")u.push(` ${n("security:",g)} ${d.details.summary}`);else if(d.ruleId==="owasp-api-top10"&&typeof d.details.summary=="string"){let k=typeof d.details.issueId=="string"?d.details.issueId:null,A=typeof d.details.issueTitle=="string"?d.details.issueTitle:null;u.push(` ${n("owasp:",g)} ${d.details.summary}`),(k||A)&&u.push(` ${n("issue:",g)} ${[k,A].filter(Boolean).join(" - ")}`)}else if(d.ruleId==="schema-consistency"&&typeof d.details.summary=="string"){let k=typeof d.details.path=="string"?d.details.path:null,A=typeof d.details.expected=="string"?d.details.expected:null,G=typeof d.details.actual=="string"?d.details.actual:null,W=typeof d.details.suggestion=="string"?d.details.suggestion:null;if(u.push(` ${n("schema:",g)} ${d.details.summary}`),k&&u.push(` ${n("path:",g)} ${n(k,S)}`),A&&u.push(` ${n("expected:",g)} ${A}`),G&&u.push(` ${n("actual:",g)} ${G}`),W){u.push(` ${n("hint:",g)}`);for(let Ge of W.split(`
15
+ `))u.push(` ${Ge}`)}}else u.push(` ${n("details:",g)} ${JSON.stringify(d.details)}`);u.push("")}}let P=o.totalProblemGroups-p.length;return P>0?(u[u.length-1]!==""&&u.push(""),u.push(n(`\u2026 ${P} problems omitted from terminal output. Use --format json/csv/sarif for the complete export.`,y))):u[u.length-1]===""&&u.pop(),`${u.join(`
16
+ `)}
17
+ `}function Hn(t,e){let r=e.maxFindings??10;switch(e.format){case"json":return nt(t);case"csv":return rt(t);case"sarif":return st(t);case"pretty":return at(t,e.color??!1,r);default:throw new Error(`Unsupported report format: ${e.format}`)}}import{randomUUID as Be}from"node:crypto";function ut(t,e){let r=b(t||"/")||"/",n=b(e.basePath||"/")||"/";return n==="/"?r:r===n?"/":r.startsWith(`${n}/`)?r.slice(n.length)||"/":null}function ct(t,e){return!t.host||!e?!0:t.host===e.toLowerCase()}function dt(t){try{return decodeURIComponent(t)}catch{return t}}function pt(t,e,r){let n=r==="strict-host"?e.host?20:5:0;return t.pathScore*10+n}function ge(t,e){let r={};for(let n=0;n<t.pathParams.length;n+=1){let s=t.pathParams[n],i=e[n+1];s&&i!==void 0&&(r[s]=dt(i))}return r}function lt(t,e){let r=b(e)||"/";for(let n of t){let s=n.pathRegex.exec(r);if(s)return{operation:n,pathParams:ge(n,s)}}return null}function ye(t,e,r,n){let s=e.request.method.toLowerCase(),i=t.operationsByMethod.get(s);if(!i||i.length===0)return null;if(n!==void 0)return lt(i,n);let o=null;for(let a of i)for(let c of a.servers){if(r==="strict-host"&&!ct(c,e.request.host))continue;let p=ut(e.request.path,c);if(!p)continue;let u=a.pathRegex.exec(p);if(!u)continue;let m={score:pt(a,c,r),matched:{operation:a,pathParams:ge(a,u)}};(!o||m.score>o.score)&&(o=m)}return o?.matched??null}var Se=6,ht=2e3,mt=50,ft=5,gt=1e6,yt=/(?:token|api[_-]?key|apikey|password|passwd|secret|authorization|jwt)/i,St=/(?:password|passwd|secret|api[_-]?key|access[_-]?token|refresh[_-]?token|private[_-]?key|ssn|credit[_-]?card|card[_-]?number|cvv)/i,vt=new Set(["page","limit","offset","cursor","per_page","perpage","size","start","after","before"]),ve=4,wt=ve*2;function Rt(t){return t.length<=wt?"***":`${t.slice(0,ve)}\u2026`}function It(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Pt(t){return typeof t=="string"||typeof t=="number"}function bt(t){let e=t.toLowerCase();return e.includes("secret")||e.includes("token")||e.includes("key")?e.startsWith("is")||e.startsWith("has")||e.startsWith("can")||e.startsWith("should")||e.startsWith("enable")||e.startsWith("allow"):!1}function xt(t){if(typeof t=="number")return t===0||t===1;let e=t.trim().toLowerCase();return e==="true"||e==="false"||e==="0"||e==="1"}function kt(t){if(!l(t)&&!Array.isArray(t))return[];let e=[],r=[{value:t,path:""}],n=0;for(;r.length>0&&n<ht&&e.length<Se;){let s=r.pop();if(!s)break;if(n+=1,Array.isArray(s.value)){let i=Math.min(s.value.length,mt);for(let o=0;o<i;o+=1){let a=s.value[o];(l(a)||Array.isArray(a))&&r.push({value:a,path:`${s.path}/${o}`})}continue}if(l(s.value))for(let[i,o]of Object.entries(s.value)){let a=`${s.path}/${It(i)}`;if(St.test(i)&&Pt(o)){let c=String(o);if(bt(i)&&xt(o))continue;if(c.length>0&&(e.push(a||"/"),e.length>=Se))break}(l(o)||Array.isArray(o))&&r.push({value:o,path:a})}}return e}function At(t){for(let e of t.keys())if(vt.has(e.toLowerCase()))return!0;return!1}function I(t,e,r,n,s){return{ruleId:"owasp-api-top10",severity:n,category:"security",message:e,exchangeIndex:t.exchange.index,operationId:t.matchedOperation?.operation.operationId,specSource:t.matchedOperation?.operation.specSource,target:r,details:s}}function Ot(t){let e=[];for(let[r,n]of t.exchange.request.query.entries())if(yt.test(r)&&(e.push({key:r,valuePreview:Rt(n)}),e.length>=ft))break;return e.length===0?[]:[I(t,"Sensitive credential-like query parameters detected","request","warning",{issueId:"API2:2023",issueTitle:"Broken Authentication",summary:"Authentication data should not be passed via query parameters because it can leak via logs, browser history, and referrers.",sensitiveQueryParams:e})]}function $t(t){let e=t.exchange.response;if(!e)return[];let r=e.headers["access-control-allow-origin"]?.trim(),n=e.headers["access-control-allow-credentials"]?.trim().toLowerCase();return r!=="*"||n!=="true"?[]:[I(t,"Insecure CORS policy: wildcard origin with credentials enabled","response","error",{issueId:"API8:2023",issueTitle:"Security Misconfiguration",summary:'Access-Control-Allow-Origin is "*" while Access-Control-Allow-Credentials is true. Browsers may expose authenticated API responses to untrusted origins.',headers:{accessControlAllowOrigin:r,accessControlAllowCredentials:n}})]}function Ct(t){let e=t.exchange.response;if(!e)return[];let r=e.headers["set-cookie"];if(!r)return[];let n=[];for(let s of ue(r)){let i=new Set(s.split(";").slice(1).map(o=>o.split("=")[0].trim().toLowerCase()));t.exchange.request.protocol==="https:"&&!i.has("secure")&&n.push(I(t,'Set-Cookie header is missing "Secure" attribute',"response","warning",{issueId:"API2:2023",issueTitle:"Broken Authentication",summary:'Session cookies over HTTPS should include "Secure" to prevent transmission over plain HTTP.',setCookiePreview:s.slice(0,200)})),i.has("httponly")||n.push(I(t,'Set-Cookie header is missing "HttpOnly" attribute',"response","warning",{issueId:"API2:2023",issueTitle:"Broken Authentication",summary:'Session cookies should include "HttpOnly" to reduce risk of token theft via client-side script access.',setCookiePreview:s.slice(0,200)})),i.has("samesite")||n.push(I(t,'Set-Cookie header is missing "SameSite" attribute',"response","info",{issueId:"API8:2023",issueTitle:"Security Misconfiguration",summary:'Set "SameSite" on session cookies to reduce CSRF risk for state-changing requests.',setCookiePreview:s.slice(0,200)}))}return n}function Et(t){let e=t.exchange.response;if(!e||e.bodyJson===void 0)return[];let r=kt(e.bodyJson);return r.length===0?[]:[I(t,"Potential sensitive data exposure in response payload","response","warning",{issueId:"API3:2019",issueTitle:"Excessive Data Exposure",summary:`Sensitive-looking fields detected in response payload: ${r.join(", ")}`,exposedPaths:r})]}function qt(t){let e=t.exchange.response;return!e||e.status>=400||t.exchange.request.method!=="GET"?[]:!e.bodyText||e.bodyText.length<gt?[]:At(t.exchange.request.query)?[]:[I(t,"Large response without pagination parameters (possible resource-consumption risk)","response","info",{issueId:"API4:2023",issueTitle:"Unrestricted Resource Consumption",summary:"A large response was returned without common pagination query parameters. Consider explicit page/limit controls for large collections.",responseBytes:e.bodyText.length})]}var M=class{id="owasp-api-top10";analyze(e){return e.matchedOperation?[...Ot(e),...$t(e),...Ct(e),...Et(e),...qt(e)]:[]}};var we=200;function Re(t){return t!==void 0&&t!==""}function Tt(t){if(!t)return{};let e={};for(let r of t.split(";")){let[n,...s]=r.trim().split("=");if(!n)continue;let i=s.join("=").trim();e[n]=i}return e}function Ft(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Mt(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function jt(t){return!t||t==="#"?"":t.startsWith("#")?t.slice(1):t}function N(t){let e=jt(t);return!e||e==="/"?[]:e.split("/").slice(1).map(r=>Ft(r))}function Ie(t,e){return`/${[...N(t),Mt(e)].join("/")}`}function Bt(t,e){let r=N(e),n=t;for(let s of r){if(Array.isArray(n)){let i=Number.parseInt(s,10);if(!Number.isInteger(i)||i<0||i>=n.length)return;n=n[i];continue}if(!l(n))return;n=n[s]}return n}function z(t){let e=t.instancePath??"",r=t.params??{};return t.keyword==="required"&&typeof r.missingProperty=="string"?Ie(e,r.missingProperty):t.keyword==="additionalProperties"&&typeof r.additionalProperty=="string"?Ie(e,r.additionalProperty):e}function Lt(t){let e=N(t);if(e.length===0)return"root";let r=[];for(let n of e)/^\d+$/.test(n)?r.push(`[${n}]`):r.length===0?r.push(n):r.push(`.${n}`);return r.join("")}function _t(t){if(t===void 0)return"[missing]";let e=JSON.stringify(t);return e?e.length>we?`${e.slice(0,we)}\u2026`:e:String(t)}function Ht(t){let e=t.params??{};if(t.keyword==="required"&&typeof e.missingProperty=="string")return`required field "${e.missingProperty}"`;if(t.keyword==="type"&&typeof e.type=="string")return`type "${e.type}"`;if(t.keyword==="additionalProperties")return"no additional undocumented properties";if(t.keyword==="format"&&typeof e.format=="string")return`format "${e.format}"`}function Vt(t,e,r){let n=t==="request"?"Request":"Response",s=e.params??{},i=Lt(r);return e.keyword==="required"&&typeof s.missingProperty=="string"?`${n} is missing required field "${i}".`:e.keyword==="additionalProperties"&&typeof s.additionalProperty=="string"?`${n} has undocumented field "${i}".`:e.keyword==="type"&&typeof s.type=="string"?`${n} field "${i}" must be ${s.type}.`:e.keyword==="enum"?`${n} field "${i}" has a value outside allowed enum values.`:e.keyword==="format"&&typeof s.format=="string"?`${n} field "${i}" does not match format "${s.format}".`:`${n} schema mismatch at "${i}": ${e.message??"validation error"}`}function be(t,e,r){let n=z(e),s=Bt(t,n);return{summary:Vt(r,e,n),keyword:e.keyword??null,path:n||"/",expected:Ht(e)??null,actual:_t(s),suggestion:null,params:e.params??{},ajvMessage:e.message??"validation error"}}function Nt(t,e,r,n){if(e==null||!t.schema)return;let s=r.validateSchema(t.schema,e,{coerce:!0});if(!s.valid)for(let i of s.errors){let o=be(e,i,"request");n.push({ruleId:"schema-consistency",severity:"error",category:"schema",message:`Invalid ${t.in} parameter "${t.name}": ${typeof o.summary=="string"?o.summary:i.message??"schema mismatch"}`,exchangeIndex:r.exchange.index,operationId:r.matchedOperation?.operation.operationId,specSource:r.matchedOperation?.operation.specSource,target:"request",schemaPath:i.schemaPath,dataPath:z(i),details:{...o,parameter:{name:t.name,in:t.in}}})}}var zt=/^([^[\]]+)\[([^[\]]+)\]$/;function xe(t){let e=t.match(zt);return e?{parameterName:e[1],property:e[2]}:void 0}function Dt(t,e){let r;for(let[n,s]of e){let i=xe(n);i?.parameterName===t&&(r??={},r[i.property]=s)}return r}function Kt(t,e,r){switch(t.in){case"path":return e.matchedOperation?.pathParams[t.name];case"query":{if(t.style==="deepObject")return Dt(t.name,e.exchange.request.query);let n=e.exchange.request.query.getAll(t.name);return n.length===0?void 0:(l(t.schema)?t.schema.type:void 0)==="array"||n.length>1?n:n[0]}case"header":return e.exchange.request.headers[t.name.toLowerCase()];case"cookie":return r[t.name];default:return}}function Ut(t,e){let r=[],n={query:new Set,header:new Set,cookie:new Set},s=new Set;for(let i of e.operation.requestParameters)i.in==="header"?n.header.add(i.name.toLowerCase()):(i.in==="query"||i.in==="cookie")&&(n[i.in].add(i.name),i.in==="query"&&i.style==="deepObject"&&s.add(i.name));for(let i of new Set(t.exchange.request.query.keys())){if(n.query.has(i))continue;let o=xe(i);o&&s.has(o.parameterName)||r.push({ruleId:"schema-consistency",severity:"warning",category:"documentation",message:`Undocumented query parameter in traffic: "${i}"`,exchangeIndex:t.exchange.index,operationId:e.operation.operationId,specSource:e.operation.specSource,target:"request"})}for(let i of Object.keys(t.exchange.request.headers))le(i,t.ignoreHeaders)||n.header.has(i.toLowerCase())||r.push({ruleId:"schema-consistency",severity:"info",category:"documentation",message:`Undocumented header in traffic: "${i}"`,exchangeIndex:t.exchange.index,operationId:e.operation.operationId,specSource:e.operation.specSource,target:"request"});return r}function Gt(t){let e=t.exchange.response;return e!==void 0&&e.status>=400&&e.status<500}function Wt(t,e){let r=t.exchange.response;if(!r)return;let n=String(r.status),s=`${Math.floor(r.status/100)}XX`,i=e.operation.responseBodyContent[n]??e.operation.responseBodyContent[s]??e.operation.responseBodyContent[s.toLowerCase()]??e.operation.responseBodyContent.default;if(i)return V(i,r.contentType)}function Pe(t,e,r,n){let s=r.validateSchema(t,e,{target:n});return s.valid?[]:s.errors.map(i=>{let o=be(e,i,n);return{ruleId:"schema-consistency",severity:"error",category:"schema",message:typeof o.summary=="string"?o.summary:`Schema mismatch (${n}): ${i.message??"validation error"}`,exchangeIndex:r.exchange.index,operationId:r.matchedOperation?.operation.operationId,specSource:r.matchedOperation?.operation.specSource,target:n,schemaPath:i.schemaPath,dataPath:z(i),details:o}})}var j=class{id="schema-consistency";analyze(e){let r=e.matchedOperation;if(!r)return[];let n=[],s=Tt(e.exchange.request.headers.cookie);if(n.push(...Ut(e,r)),!Gt(e)){for(let p of r.operation.requestParameters){if(e.ignoreCookies&&p.in==="cookie")continue;let u=Kt(p,e,s);if(p.required&&u==null){n.push({ruleId:this.id,severity:"error",category:"documentation",message:`Missing required ${p.in} parameter: "${p.name}"`,exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"request"});continue}Nt(p,u,e,n)}let o=e.exchange.request.contentType,a=V(r.operation.requestBodyContent,o),c=Re(e.exchange.request.bodyText);r.operation.requestBodyRequired&&!c&&n.push({ruleId:this.id,severity:"error",category:"documentation",message:"Missing required request body",exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"request"}),a&&c&&H(o)&&(e.exchange.request.bodyJson===void 0?n.push({ruleId:this.id,severity:"error",category:"schema",message:"Request body is not valid JSON for JSON content-type",exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"request"}):n.push(...Pe(a,e.exchange.request.bodyJson,e,"request")))}let i=Wt(e,r);if(i&&e.exchange.response&&Re(e.exchange.response.bodyText)){let o=e.exchange.response.contentType;H(o)&&(e.exchange.response.bodyJson===void 0?n.push({ruleId:this.id,severity:"error",category:"schema",message:"Response body is not valid JSON for JSON content-type",exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"response"}):n.push(...Pe(i,e.exchange.response.bodyJson,e,"response")))}return n}};function D(t){if(!t)return null;let[e]=t.trim().split(/\s+/,1);return e?e.toLowerCase():null}function Ae(t){return!!t.exchange.request.headers.authorization}function Jt(t,e){return t?t.split(";").map(r=>r.trim()).some(r=>r.startsWith(`${e}=`)):!1}function Yt(t,e){let r=t.matchedOperation?.operation;if(!r)return{schemeName:e,schemeType:"unknown",satisfied:!0,reason:"No matched OpenAPI operation."};let n=r.securitySchemes[e];if(!n)return{schemeName:e,schemeType:"missing",satisfied:!1,reason:"Security scheme is referenced but not defined in components.securitySchemes."};let s=String(n.type??"unknown");if(n.type==="apiKey"){let i=String(n.name??""),o=String(n.in??"header");if(!i)return{schemeName:e,schemeType:s,satisfied:!1,reason:'apiKey scheme is missing the "name" field in the OpenAPI spec.'};if(o==="header"){let a=!!t.exchange.request.headers[i.toLowerCase()];return{schemeName:e,schemeType:s,satisfied:a,reason:a?`Found required apiKey header "${i}".`:`Missing required apiKey header "${i}".`}}if(o==="query"){let a=t.exchange.request.query.has(i);return{schemeName:e,schemeType:s,satisfied:a,reason:a?`Found required apiKey query parameter "${i}".`:`Missing required apiKey query parameter "${i}".`}}if(o==="cookie"){if(t.ignoreCookies)return{schemeName:e,schemeType:s,satisfied:!0,skipped:!0,reason:`Skipped apiKey cookie "${i}" validation because --ignore-cookies is enabled.`};let a=Jt(t.exchange.request.headers.cookie,i);return{schemeName:e,schemeType:s,satisfied:a,reason:a?`Found required apiKey cookie "${i}".`:`Missing required apiKey cookie "${i}".`}}return{schemeName:e,schemeType:s,satisfied:!1,reason:`Unsupported apiKey location "${o}" in OpenAPI security scheme.`}}if(n.type==="http"){let i=t.exchange.request.headers.authorization;if(!i)return{schemeName:e,schemeType:s,satisfied:!1,reason:"Missing Authorization header."};let o=String(n.scheme??"").toLowerCase(),a=D(i);if(!o)return{schemeName:e,schemeType:s,satisfied:!0,reason:"Authorization header is present and no specific HTTP auth scheme is documented."};if(!a)return{schemeName:e,schemeType:s,satisfied:!1,reason:"Authorization header is malformed and does not include an auth scheme."};let c=a===o;return{schemeName:e,schemeType:s,satisfied:c,reason:c?`Authorization uses expected "${o}" scheme.`:`Authorization uses "${a}" but "${o}" is required.`}}if(n.type==="oauth2"||n.type==="openIdConnect"){let i=t.exchange.request.headers.authorization;if(!i)return{schemeName:e,schemeType:s,satisfied:!1,reason:"Missing Authorization header for OAuth2/OpenID Connect scheme."};let o=D(i),a=o==="bearer";return{schemeName:e,schemeType:s,satisfied:a,reason:a?"Authorization uses bearer token as expected for OAuth2/OpenID Connect.":`Authorization scheme "${o??"unknown"}" does not satisfy OAuth2/OpenID Connect (expected bearer).`}}return n.type==="mutualTLS"?{schemeName:e,schemeType:s,satisfied:!0,reason:"mutualTLS cannot be validated from HTTP traffic logs alone."}:{schemeName:e,schemeType:s,satisfied:!1,reason:`Unsupported security scheme type "${s}".`}}function Qt(t){let e=t.matchedOperation?.operation.security;if(!e)return{satisfied:!0,requirements:[]};if(e.length===0)return{satisfied:!0,requirements:[]};let r=e.map((n,s)=>{let i=Object.keys(n);if(i.length===0)return{requirementIndex:s,satisfied:!0,schemeResults:[]};let o=i.map(a=>Yt(t,a));return{requirementIndex:s,satisfied:o.every(a=>a.satisfied),schemeResults:o}});return{satisfied:r.some(n=>n.satisfied),requirements:r}}function Xt(t){let e=[];for(let r of t.requirements)for(let n of r.schemeResults)n.satisfied||e.push({requirement:r.requirementIndex+1,schemeName:n.schemeName,reason:n.reason});return e}function ke(t){let e=[];for(let r of t.requirements)for(let n of r.schemeResults)n.skipped&&e.push({requirement:r.requirementIndex+1,schemeName:n.schemeName,reason:n.reason});return e}function Zt(t){if(t.length===0)return"All documented security requirements are satisfied.";let e=new Map;for(let n of t){let s=e.get(n.requirement);s?s.push(n):e.set(n.requirement,[n])}let r=Array.from(e.entries()).sort((n,s)=>n[0]-s[0]).map(([n,s])=>{let i=s.map(a=>a.schemeName).join(" + "),o=s.map(a=>a.reason).join(" ");return`Option ${n} (${i}): ${o}`});return r.length===1?`Authentication check failed. ${r[0]}`:`None of the documented authentication options matched. Any one of these options would satisfy the OpenAPI security requirements: ${r.join(" | ")}`}function en(t){return Array.from(t.exchange.request.query.keys()).filter(e=>{let r=e.toLowerCase();return r.includes("token")||r.includes("apikey")||r.includes("api_key")||r.includes("access_key")})}var tn=/^(?:(?:.+\.)?localhost|127(?:\.\d{1,3}){3}|::1)$/i;function nn(t){let e;try{e=new URL(t.url).hostname}catch{e=t.host?.replace(/:\d+$/,"")}return e?tn.test(e.replace(/^\[|\]$/g,"")):!1}function rn(t){if(t.exchange.request.protocol!=="http:"||!t.exchange.request.protocolKnown||nn(t.exchange.request))return{flag:!1,hasAuthHeader:!1,sensitiveQueryKeys:[]};let e=Ae(t),r=en(t);return{flag:e||r.length>0,hasAuthHeader:e,sensitiveQueryKeys:r}}var B=class{id="security-baseline";analyze(e){if(!e.matchedOperation)return[];let r=[],n=Qt(e);if(n.satisfied){let i=ke(n);i.length>0&&r.push({ruleId:this.id,severity:"info",category:"security",message:"Some documented cookie-based security checks were skipped",exchangeIndex:e.exchange.index,operationId:e.matchedOperation.operation.operationId,specSource:e.matchedOperation.operation.specSource,target:"request",details:{summary:i.map(o=>`Skipped option ${o.requirement} (${o.schemeName}): ${o.reason}`).join(" "),skippedChecks:i}})}else{let i=Xt(n);r.push({ruleId:this.id,severity:"error",category:"security",message:"Request does not satisfy documented OpenAPI security requirements",exchangeIndex:e.exchange.index,operationId:e.matchedOperation.operation.operationId,specSource:e.matchedOperation.operation.specSource,target:"request",details:{summary:Zt(i),failedChecks:i,skippedChecks:ke(n),authorizationScheme:D(e.exchange.request.headers.authorization),hasAuthorizationHeader:Ae(e)}})}let s=rn(e);return s.flag&&r.push({ruleId:this.id,severity:"warning",category:"security",message:"Potential credential exposure over insecure HTTP transport",exchangeIndex:e.exchange.index,operationId:e.matchedOperation.operation.operationId,specSource:e.matchedOperation.operation.specSource,target:"request",details:{protocol:e.exchange.request.protocol,hasAuthorizationHeader:s.hasAuthHeader,sensitiveQueryKeys:s.sensitiveQueryKeys}}),r}};var L=class{id="undocumented-endpoint";analyze(e){if(e.matchedOperation)return[];let{method:r,path:n,host:s}=e.exchange.request,o=e.matchMode==="strict-host"&&!e.hostCompatibleWithSpecServers?`Undocumented server: ${r} ${n} was sent to "${s}", which does not match any server in the description`:`Undocumented endpoint: ${r} ${n}`;return[{ruleId:this.id,severity:"error",category:"documentation",message:o,exchangeIndex:e.exchange.index,target:"request"}]}};var K={"undocumented-endpoint":()=>new L,"schema-consistency":()=>new j,"security-baseline":()=>new B,"owasp-api-top10":()=>new M},sn=Object.keys(K),on=["undocumented-endpoint","schema-consistency","security-baseline"];function Oe(t){return!t||t.length===0?on.map(e=>K[e]()):[...new Set(t)].map(e=>{let r=K[e];if(!r)throw new Error(`Unknown rule id: "${e}". Available rules: ${sn.join(", ")}`);return r()})}var Ee=J(We(),1);var qe=J(Je(),1),$e=Ee.default,Ce=qe.default;function an(t,e){return l(t)?e==="request"?t.readOnly===!0:t.writeOnly===!0:!1}function Te(t,e,r,n=new WeakSet){if(!l(t)||n.has(t))return!1;n.add(t);let s=t.properties;return l(s)&&an(s[e],r)?!0:[t.allOf,t.oneOf,t.anyOf].some(i=>Array.isArray(i)&&i.some(o=>Te(o,e,r,n)))}var un=new Set(["items","additionalItems","additionalProperties","unevaluatedItems","unevaluatedProperties","contains","propertyNames","not","if","then","else"]),cn=new Set(["allOf","anyOf","oneOf","prefixItems"]),dn=new Set(["properties","patternProperties","dependentSchemas","$defs","definitions"]);function Fe(t,e,r=new WeakSet){if(!l(t))return t;if(r.has(t))return!0;r.add(t);let n=i=>Fe(i,e,r),s={};for(let[i,o]of Object.entries(t))un.has(i)?s[i]=Array.isArray(o)?o.map(n):n(o):cn.has(i)&&Array.isArray(o)?s[i]=o.map(n):dn.has(i)&&l(o)?s[i]=Object.fromEntries(Object.entries(o).map(([a,c])=>[a,n(c)])):s[i]=o;return Array.isArray(t.required)&&(s.required=t.required.filter(i=>typeof i!="string"||!Te(t,i,e))),r.delete(t),s}var E=class{ajv;fallbackAjv;objectSchemaCaches={none:new WeakMap,request:new WeakMap,response:new WeakMap};scalarSchemaCache=new Map;constructor(e){let r={strict:!1,allErrors:!0,allowUnionTypes:!0,discriminator:!0,coerceTypes:e?.coerceTypes?"array":!1,validateFormats:!0,verbose:!0,formats:{enum:!0}};this.ajv=new $e(r),this.fallbackAjv=new $e({...r,discriminator:!1}),Ce(this.ajv),Ce(this.fallbackAjv)}validate(e,r,n){if(e===void 0)return{valid:!0,errors:[]};let s;try{s=this.getOrCompileValidator(e,n)}catch(a){return{valid:!1,errors:[{message:`Schema compilation failed: ${a.message}`}]}}let i=!!s(r),o=s.errors??[];return{valid:i,errors:o}}getOrCompileValidator(e,r){if(l(e)){let o=this.objectSchemaCaches[r??"none"],a=o.get(e);if(a)return a;let c=r?Fe(e,r):e,p=this.compileSchema(c);return o.set(e,p),p}let n=`${r??"none"}:${JSON.stringify(e)}`,s=this.scalarSchemaCache.get(n);if(s)return s;let i=this.compileSchema(e);return this.scalarSchemaCache.set(n,i),i}compileSchema(e){try{return this.ajv.compile(e)}catch{return this.fallbackAjv.compile(e)}}};var pn=10,Me={info:0,warning:1,error:2};function ln(){return{totalExchanges:0,documentedExchanges:0,undocumentedExchanges:0,skippedExchanges:0,hostCompatibleExchanges:0,findingsBySeverity:{info:0,warning:0,error:0},findingsByRule:{}}}function hn(t,e){t.findingsBySeverity[e.severity]+=1,t.findingsByRule[e.ruleId]=(t.findingsByRule[e.ruleId]??0)+1}function mn(t,e){return{...t,id:Be(),method:e.request.method,url:e.request.url,path:e.request.path,status:e.response?.status}}function fn(t,e){return{exchangeIndex:t.exchangeIndex,ruleId:t.ruleId,severity:t.severity,category:t.category,message:t.message,occurrences:1,operationId:t.operationId,specSource:t.specSource,target:t.target,schemaPath:t.schemaPath,dataPath:t.dataPath,details:t.details,method:e.request.method,url:e.request.url,path:e.request.path,status:e.response?.status}}function gn(t,e){if(!e)return;t.operationId||(t.operationId=e.operation.operationId),t.specSource||(t.specSource=e.operation.specSource);let r=t.details??{};if(!l(r)){t.details={operationPathTemplate:e.operation.pathTemplate};return}typeof r.operationPathTemplate!="string"&&(r.operationPathTemplate=e.operation.pathTemplate),t.details=r}function yn(t){let e=new Set,r=!1;for(let n of t.operationsByMethod.values())for(let s of n)for(let i of s.servers)i.host?e.add(i.host):r=!0;return{specServerHosts:e,hasHostlessSpecServer:r}}async function Sn(t,e){let r=[];for(let n of t)try{let s=await n.analyze(e);s.length>0&&r.push(...s)}catch(s){w.warn(`Rule "${n.id}" failed to execute: ${s.message}
18
+ `)}return r}var je=class t{startedAt=Date.now();runId=Be();previewLimit;rules;schemaValidator=new E;coercingSchemaValidator=new E({coerceTypes:!0});options;counters=ln();findings=[];previewFindings=[];problemGroupsByRule={};problemKeyStats=new Map;totalProblemGroups=0;server;ignoreHeaders;minSeverityRank;specServerHosts;hasHostlessSpecServer;constructor(e,r){this.options=e,this.rules=r,this.server=he(e.server),this.ignoreHeaders=e.ignoreHeaders?pe(e.ignoreHeaders):void 0;let{specServerHosts:n,hasHostlessSpecServer:s}=yn(e.openApiIndex);this.specServerHosts=n,this.hasHostlessSpecServer=s,this.minSeverityRank=Me[e.minSeverity??"info"],this.previewLimit=e.previewFindingsLimit&&e.previewFindingsLimit>0?e.previewFindingsLimit:pn}static create(e){if(e.openApiIndex.loadedOperations===0)throw new Error("No OpenAPI operations available to validate traffic against.");return new t(e,Oe(e.activeRules))}async process(e){this.counters.totalExchanges+=1;let r;if(this.server!==void 0&&(r=me(e.request,this.server),r===void 0))return this.counters.skippedExchanges+=1,[];let n=this.isHostCompatible(e.request.host);n&&(this.counters.hostCompatibleExchanges+=1);let s=ye(this.options.openApiIndex,e,this.options.matchMode,r);s?this.counters.documentedExchanges+=1:this.counters.undocumentedExchanges+=1;let i=await Sn(this.rules,{exchange:e,matchedOperation:s,matchMode:this.options.matchMode,hostCompatibleWithSpecServers:r!==void 0||n,ignoreCookies:this.options.ignoreCookies??!1,ignoreHeaders:this.ignoreHeaders,validateSchema:(a,c,p)=>p?.coerce?this.coercingSchemaValidator.validate(a,c,p?.target):this.schemaValidator.validate(a,c,p?.target)}),o=[];for(let a of i){if(Me[a.severity]<this.minSeverityRank)continue;gn(a,s);let c=mn(a,e);this.findings.push(c),o.push(c),hn(this.counters,a);let p=T({ruleId:a.ruleId,severity:a.severity,message:a.message,operationId:a.operationId,path:e.request.path,target:a.target,schemaPath:a.schemaPath}),u=this.problemKeyStats.get(p);if(u){u.occurrences+=1,u.previewIndex!==null&&(this.previewFindings[u.previewIndex].occurrences=u.occurrences);continue}if(this.totalProblemGroups+=1,this.problemGroupsByRule[a.ruleId]=(this.problemGroupsByRule[a.ruleId]??0)+1,this.previewFindings.length<this.previewLimit){let m=this.previewFindings.length;this.previewFindings.push(fn(a,e)),this.problemKeyStats.set(p,{occurrences:1,previewIndex:m});continue}this.problemKeyStats.set(p,{occurrences:1,previewIndex:null})}return o}isHostCompatible(e){return!e||this.hasHostlessSpecServer||this.specServerHosts.has(e.toLowerCase())}finalize(){let e={runId:this.runId,totalExchanges:this.counters.totalExchanges,documentedExchanges:this.counters.documentedExchanges,undocumentedExchanges:this.counters.undocumentedExchanges,skippedExchanges:this.counters.skippedExchanges,hostCompatibleExchanges:this.counters.hostCompatibleExchanges,findingsBySeverity:this.counters.findingsBySeverity,findingsByRule:this.counters.findingsByRule,problemGroupsByRule:this.problemGroupsByRule,totalProblemGroups:this.totalProblemGroups,durationMs:Date.now()-this.startedAt,previewFindings:this.previewFindings,previewLimit:this.previewLimit,previewTruncated:this.totalProblemGroups>this.previewFindings.length};return{runId:this.runId,summary:e,findings:this.findings}}};import{stat as vn}from"node:fs/promises";function _(t,e){let r=t.replace(/\{([^}]+)\}/g,(i,o)=>{let a=e?.[o];return a?.default!==void 0?String(a.default):Array.isArray(a?.enum)&&a.enum.length>0?String(a.enum[0]):""}),n=ce(r),s=!!(n.host&&!ae(n.host));return{rawUrl:t,protocol:s?n.protocol:void 0,host:s?n.host.toLowerCase():void 0,basePath:b(n.pathname||"/")}}function Le(t){return t?t.startsWith("/")?t:`/${t}`:"/"}var wn=["get","put","post","delete","patch","head","options","trace"],Rn=new Set(["query","header","path","cookie"]);function In(t){return wn.includes(t)}function Pn(t){return Rn.has(t)}function _e(t){if(!Array.isArray(t))return[];let e=[];for(let r of t){if(!l(r))continue;let n=r.in;typeof n!="string"||!Pn(n)||e.push({name:String(r.name??""),in:n,required:!!r.required||n==="path",style:typeof r.style=="string"?r.style:void 0,schema:r.schema})}return e}function He(t){let e=t.in==="header";return`${t.in}:${e?t.name.toLowerCase():t.name}`}function bn(t,e){let r=new Map;for(let n of t)r.set(He(n),n);for(let n of e)r.set(He(n),n);return Array.from(r.values())}function Ne(t){let e={};if(!l(t))return e;for(let[r,n]of Object.entries(t))l(n)&&"schema"in n&&(e[r.toLowerCase()]=n.schema);return e}function xn(t){return l(t)?Ne(t.content):{}}function kn(t){if(!l(t))return{};let e={};for(let[r,n]of Object.entries(t))!l(n)||!("content"in n)||(e[r]=Ne(n.content));return e}function An(t,e,r){let n=t??e??r;return!Array.isArray(n)||n.length===0?[_("/")]:n.map(s=>{if(!l(s))return _("/");let i=typeof s.url=="string"?s.url:"/",o=l(s.variables)?s.variables:void 0;return _(i,o)})}function On(t,e,r){return r||`${t.toUpperCase()} ${e}`}function $n(t){try{let e=te(t.parsed);return ee(e)==="oas3"?e:null}catch{return null}}function Ve(t){return Array.isArray(t)?t:void 0}function Cn(t,e){let r,n,s={},i="/",o=[],a;return{Root:{enter(c){r=c.servers,n=c.security;let p=l(c.components)?c.components.securitySchemes:void 0;s=l(p)?p:{}}},Paths:{PathItem:{enter(c,p){i=Le(String(p.key)),o=_e(c.parameters),a=c.servers},Operation:{enter(c,p){let u=String(p.key);if(!In(u))return;let m=bn(o,_e(c.parameters)),x=de(i),q=An(c.servers,a,r),P=c.requestBody,h={operationId:On(u,i,typeof c.operationId=="string"?c.operationId:void 0),method:u,pathTemplate:i,pathRegex:x.regex,pathParams:x.params,pathScore:x.score,servers:q,requestParameters:m,requestBodyContent:xn(P),requestBodyRequired:l(P)&&!!P.required,responseBodyContent:kn(c.responses),security:Ve(c.security)??Ve(n),securitySchemes:s,specSource:t},f=e.get(u)??[];f.push(h),e.set(u,f)}}}}}}function En(t,e,r,n,s){let i=Y(r.extendTypes(Q(e),e),r),o=new Map,a={problems:[],specVersion:e,config:r,visitorsData:{}},c=re([{severity:"warn",ruleId:"drift-index",visitor:Cn(n,s)}],i);se({document:t,rootType:i.Root,normalizedVisitors:c,resolvedRefMap:o,ctx:a})}function qn(t){return`${t.host??""}|${t.basePath}`}function Tn(t){for(let e of t.values()){let r=new Map;for(let n of e){let s=r.get(n.pathRegex.source)??[];s.push(n),r.set(n.pathRegex.source,s)}for(let n of r.values()){let s=new Map;for(let i of n)for(let o of i.servers){let a=qn(o),c=s.get(a)??new Set;c.add(i.specSource),s.set(a,c)}for(let i of s.values())if(i.size>1){let[o]=n;w.warn(`"${o.method.toUpperCase()} ${o.pathTemplate}" is documented for the same server in multiple descriptions (${Array.from(i).join(", ")}). Matching traffic is validated against only one of them.
19
+ `);break}}}}function Fn(t,e){for(let n of t.values())n.sort((s,i)=>i.pathScore-s.pathScore);let r=Array.from(t.values()).reduce((n,s)=>n+s.length,0);return{operationsByMethod:t,loadedSpecs:e,loadedOperations:r}}async function Mn(t){return(await vn(t)).isDirectory()?{specFiles:await oe(t),fromDirectory:!0}:{specFiles:[t],fromDirectory:!1}}async function Rr(t,e){let{specFiles:r,fromDirectory:n}=await Mn(t),s=new Map,i=new ne(e.resolve),o=0;for(let a of r){let c=await i.resolveDocument(null,a,!0);if(c instanceof Error){w.warn(`Failed to load OpenAPI description ${a}: ${c.message}
20
+ `);continue}let p=$n(c);if(!p){n||w.warn(`Skipping ${a}: not an OpenAPI 3.x description.
21
+ `);continue}let u;try{let{bundle:m}=await ie({config:e,doc:c,externalRefResolver:i,dereference:!0});u=m}catch(m){w.warn(`Failed to bundle OpenAPI description ${a}: ${m.message}
22
+ `);continue}o+=1,En(u,p,e,a,s)}return o>1&&Tn(s),Fn(s,o)}function Pr(t){return t.split(",").map(e=>e.trim()).filter(Boolean)}export{Hn as a,je as b,Rr as c,Pr as d};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ var h=Object.create;var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b,c)=>()=>{if(c)throw c[0];try{return a&&(b=a(a=0)),b}catch(d){throw c=[d],d}};var o=(a,b)=>()=>{try{return b||a((b={exports:{}}).exports,b),b.exports}catch(c){throw b=0,c}},p=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0})},g=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of j(b))!l.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=i(b,e))||d.enumerable});return a};var q=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a)),r=a=>g(f({},"__esModule",{value:!0}),a);export{m as a,n as b,o as c,p as d,q as e,r as f};
@@ -0,0 +1,18 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a as ye}from"./32XCOMOR.js";import{a as m,c as O}from"./RFWIIJFG.js";var V=O((ot,Q)=>{var M=1e3,N=M*60,q=N*60,A=q*24,ge=A*7,be=A*365.25;Q.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return me(e);if(t==="number"&&isFinite(e))return r.long?_e(e):ve(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function me(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*be;case"weeks":case"week":case"w":return t*ge;case"days":case"day":case"d":return t*A;case"hours":case"hour":case"hrs":case"hr":case"h":return t*q;case"minutes":case"minute":case"mins":case"min":case"m":return t*N;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function ve(e){var r=Math.abs(e);return r>=A?Math.round(e/A)+"d":r>=q?Math.round(e/q)+"h":r>=N?Math.round(e/N)+"m":r>=M?Math.round(e/M)+"s":e+"ms"}function _e(e){var r=Math.abs(e);return r>=A?$(e,r,A,"day"):r>=q?$(e,r,q,"hour"):r>=N?$(e,r,N,"minute"):r>=M?$(e,r,M,"second"):e+" ms"}function $(e,r,t,n){var s=r>=t*1.5;return Math.round(e/t)+" "+n+(s?"s":"")}});var G=O((it,X)=>{function we(e){t.debug=t,t.default=t,t.coerce=S,t.disable=C,t.enable=s,t.enabled=y,t.humanize=V(),t.destroy=x,Object.keys(e).forEach(o=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let i=0;for(let c=0;c<o.length;c++)i=(i<<5)-i+o.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(o){let i,c=null,a,v;function l(...d){if(!l.enabled)return;let F=l,_=Number(new Date),j=_-(i||_);F.diff=j,F.prev=i,F.curr=_,i=_,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let P=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(E,I)=>{if(E==="%%")return"%";P++;let K=t.formatters[I];if(typeof K=="function"){let Ce=d[P];E=K.call(F,Ce),d.splice(P,1),P--}return E}),t.formatArgs.call(F,d),(F.log||t.log).apply(F,d)}return l.namespace=o,l.useColors=t.useColors(),l.color=t.selectColor(o),l.extend=n,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(a!==t.namespaces&&(a=t.namespaces,v=t.enabled(o)),v),set:d=>{c=d}}),typeof t.init=="function"&&t.init(l),l}function n(o,i){let c=t(this.namespace+(typeof i>"u"?":":i)+o);return c.log=this.log,c}function s(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let i=(typeof o=="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let c of i)c[0]==="-"?t.skips.push(c.slice(1)):t.names.push(c)}function u(o,i){let c=0,a=0,v=-1,l=0;for(;c<o.length;)if(a<i.length&&(i[a]===o[c]||i[a]==="*"))i[a]==="*"?(v=a,l=c,a++):(c++,a++);else if(v!==-1)a=v+1,l++,c=l;else return!1;for(;a<i.length&&i[a]==="*";)a++;return a===i.length}function C(){let o=[...t.names,...t.skips.map(i=>"-"+i)].join(",");return t.enable(""),o}function y(o){for(let i of t.skips)if(u(o,i))return!1;for(let i of t.names)if(u(o,i))return!0;return!1}function S(o){return o instanceof Error?o.stack||o.message:o}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=we});var Y=O((p,L)=>{p.formatArgs=Oe;p.save=Se;p.load=Pe;p.useColors=Fe;p.storage=xe();p.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();p.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fe(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Oe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),e.splice(n,0,r)}p.log=console.debug||console.log||(()=>{});function Se(e){try{e?p.storage.setItem("debug",e):p.storage.removeItem("debug")}catch{}}function Pe(){let e;try{e=p.storage.getItem("debug")||p.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function xe(){try{return localStorage}catch{}}L.exports=G()(p);var{formatters:je}=L.exports;je.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var te=O((f,H)=>{var Ee=m("tty"),T=m("util");f.init=De;f.log=Ne;f.formatArgs=Ie;f.save=qe;f.load=Be;f.useColors=Ae;f.destroy=T.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");f.colors=[6,2,3,4,5,1];try{let e=ye();e&&(e.stderr||e).level>=2&&(f.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}f.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,u)=>u.toUpperCase()),n=process.env[r];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[t]=n,e},{});function Ae(){return"colors"in f.inspectOpts?!!f.inspectOpts.colors:Ee.isatty(process.stderr.fd)}function Ie(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${s};1m${r} \x1B[0m`;e[0]=u+e[0].split(`
8
+ `).join(`
9
+ `+u),e.push(s+"m+"+H.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Me()+r+" "+e[0]}function Me(){return f.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ne(...e){return process.stderr.write(T.formatWithOptions(f.inspectOpts,...e)+`
10
+ `)}function qe(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Be(){return process.env.DEBUG}function De(e){e.inspectOpts={};let r=Object.keys(f.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=f.inspectOpts[r[t]]}H.exports=G()(f);var{formatters:ee}=H.exports;ee.o=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts).split(`
11
+ `).map(r=>r.trim()).join(" ")};ee.O=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts)}});var W=O((ct,J)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?J.exports=Y():J.exports=te()});var se=O(h=>{"use strict";var ke=h&&h.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),$e=h&&h.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),re=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&ke(r,e,t);return $e(r,e),r};Object.defineProperty(h,"__esModule",{value:!0});h.req=h.json=h.toBuffer=void 0;var Le=re(m("http")),Te=re(m("https"));async function ne(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}h.toBuffer=ne;async function He(e){let t=(await ne(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let s=n;throw s.message+=` (input: ${t})`,s}}h.json=He;function Re(e,r={}){let n=((typeof e=="string"?e:e.href).startsWith("https:")?Te:Le).request(e,r),s=new Promise((u,C)=>{n.once("response",u).once("error",C).end()});return n.then=s.then.bind(s),n}h.req=Re});var ue=O(g=>{"use strict";var ie=g&&g.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),Ue=g&&g.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),ce=g&&g.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&ie(r,e,t);return Ue(r,e),r},ze=g&&g.__exportStar||function(e,r){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&ie(r,e,t)};Object.defineProperty(g,"__esModule",{value:!0});g.Agent=void 0;var Ge=ce(m("net")),oe=ce(m("http")),Je=m("https");ze(se(),g);var w=Symbol("AgentBaseInternalState"),Z=class extends oe.Agent{constructor(r){super(r),this[w]={}}isSecureEndpoint(r){if(r){if(typeof r.secureEndpoint=="boolean")return r.secureEndpoint;if(typeof r.protocol=="string")return r.protocol==="https:"}let{stack:t}=new Error;return typeof t!="string"?!1:t.split(`
12
+ `).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}incrementSockets(r){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[r]||(this.sockets[r]=[]);let t=new Ge.Socket({writable:!1});return this.sockets[r].push(t),this.totalSocketCount++,t}decrementSockets(r,t){if(!this.sockets[r]||t===null)return;let n=this.sockets[r],s=n.indexOf(t);s!==-1&&(n.splice(s,1),this.totalSocketCount--,n.length===0&&delete this.sockets[r])}getName(r){return this.isSecureEndpoint(r)?Je.Agent.prototype.getName.call(this,r):super.getName(r)}createSocket(r,t,n){let s={...t,secureEndpoint:this.isSecureEndpoint(t)},u=this.getName(s),C=this.incrementSockets(u);Promise.resolve().then(()=>this.connect(r,s)).then(y=>{if(this.decrementSockets(u,C),y instanceof oe.Agent)try{return y.addRequest(r,s)}catch(S){return n(S)}this[w].currentSocket=y,super.createSocket(r,t,n)},y=>{this.decrementSockets(u,C),n(y)})}createConnection(){let r=this[w].currentSocket;if(this[w].currentSocket=void 0,!r)throw new Error("No socket was returned in the `connect()` function");return r}get defaultPort(){return this[w].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(r){this[w]&&(this[w].defaultPort=r)}get protocol(){return this[w].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(r){this[w]&&(this[w].protocol=r)}};g.Agent=Z});var ae=O(B=>{"use strict";var We=B&&B.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(B,"__esModule",{value:!0});B.parseProxyResponse=void 0;var Ze=We(W()),R=(0,Ze.default)("https-proxy-agent:parse-proxy-response");function Ke(e){return new Promise((r,t)=>{let n=0,s=[];function u(){let o=e.read();o?x(o):e.once("readable",u)}function C(){e.removeListener("end",y),e.removeListener("error",S),e.removeListener("readable",u)}function y(){C(),R("onend"),t(new Error("Proxy connection ended before receiving CONNECT response"))}function S(o){C(),R("onerror %o",o),t(o)}function x(o){s.push(o),n+=o.length;let i=Buffer.concat(s,n),c=i.indexOf(`\r
13
+ \r
14
+ `);if(c===-1){R("have not received end of HTTP headers yet..."),u();return}let a=i.slice(0,c).toString("ascii").split(`\r
15
+ `),v=a.shift();if(!v)return e.destroy(),t(new Error("No header received from proxy CONNECT response"));let l=v.split(" "),d=+l[1],F=l.slice(2).join(" "),_={};for(let j of a){if(!j)continue;let P=j.indexOf(":");if(P===-1)return e.destroy(),t(new Error(`Invalid header from proxy CONNECT response: "${j}"`));let k=j.slice(0,P).toLowerCase(),E=j.slice(P+1).trimStart(),I=_[k];typeof I=="string"?_[k]=[I,E]:Array.isArray(I)?I.push(E):_[k]=E}R("got proxy server response: %o %o",v,_),C(),r({connect:{statusCode:d,statusText:F,headers:_},buffered:i})}e.on("error",S),e.on("end",y),u()})}B.parseProxyResponse=Ke});var st=O(b=>{"use strict";var Qe=b&&b.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),Ve=b&&b.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),pe=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&Qe(r,e,t);return Ve(r,e),r},he=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(b,"__esModule",{value:!0});b.HttpsProxyAgent=void 0;var U=pe(m("net")),fe=pe(m("tls")),Xe=he(m("assert")),Ye=he(W()),et=ue(),tt=m("url"),rt=ae(),D=(0,Ye.default)("https-proxy-agent"),le=e=>e.servername===void 0&&e.host&&!U.isIP(e.host)?{...e,servername:e.host}:e,z=class extends et.Agent{constructor(r,t){super(t),this.options={path:void 0},this.proxy=typeof r=="string"?new tt.URL(r):r,this.proxyHeaders=t?.headers??{},D("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),s=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?de(t,"headers"):null,host:n,port:s}}async connect(r,t){let{proxy:n}=this;if(!t.host)throw new TypeError('No "host" provided');let s;n.protocol==="https:"?(D("Creating `tls.Socket`: %o",this.connectOpts),s=fe.connect(le(this.connectOpts))):(D("Creating `net.Socket`: %o",this.connectOpts),s=U.connect(this.connectOpts));let u=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},C=U.isIPv6(t.host)?`[${t.host}]`:t.host,y=`CONNECT ${C}:${t.port} HTTP/1.1\r
16
+ `;if(n.username||n.password){let c=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;u["Proxy-Authorization"]=`Basic ${Buffer.from(c).toString("base64")}`}u.Host=`${C}:${t.port}`,u["Proxy-Connection"]||(u["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let c of Object.keys(u))y+=`${c}: ${u[c]}\r
17
+ `;let S=(0,rt.parseProxyResponse)(s);s.write(`${y}\r
18
+ `);let{connect:x,buffered:o}=await S;if(r.emit("proxyConnect",x),this.emit("proxyConnect",x,r),x.statusCode===200)return r.once("socket",nt),t.secureEndpoint?(D("Upgrading socket connection to TLS"),fe.connect({...de(le(t),"host","path","port"),socket:s})):s;s.destroy();let i=new U.Socket({writable:!1});return i.readable=!0,r.once("socket",c=>{D("Replaying proxy buffer for failed request"),(0,Xe.default)(c.listenerCount("data")>0),c.push(o),c.push(null)}),i}};z.protocols=["http","https"];b.HttpsProxyAgent=z;function nt(e){e.resume()}function de(e,...r){let t={},n;for(n in e)r.includes(n)||(t[n]=e[n]);return t}});export{st as a};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{h as a}from"./3BCHPW6T.js";import"./P26PQ2RU.js";import"./RS5PUOTT.js";import"./NGPG6D6W.js";import"./O6MCQRCP.js";import"./32XCOMOR.js";import"./WNTLDT6L.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as RedoclyOAuthClient};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a as d}from"./AE6JGTY4.js";import{b as s,c as u}from"./KLY5RV3W.js";import{a as i,c as n,f as c}from"./RFWIIJFG.js";var h=n(t=>{Object.defineProperty(t,"__esModule",{value:!0});t.getMachineId=void 0;var a=i("fs"),o=d(),r=(u(),c(s));async function g(){try{return(await a.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){r.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,o.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){r.diag.debug(`error reading machine id: ${e}`)}}t.getMachineId=g});export default h();
@@ -0,0 +1,9 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./L3YH7RCT.js";import{c as g}from"./WNTLDT6L.js";import A from"node:path";function L(e,n){if(C(e)!=="application/x-www-form-urlencoded"||!Array.isArray(n))return;let o=new URLSearchParams;for(let s of n){if(!g(s))continue;let t=a(s.name);t!==void 0&&o.append(t,a(s.value)??"")}return o.size>0?o.toString():void 0}function K(e,n,o){let s=e?.request,t=e?.response;if(!s)return null;let r=s?.postData,i=a(r?.mimeType),u=r?.text??L(i,r?.params),c=a(r?.encoding),y=t?.content?.text,S=a(t?.content?.encoding),q=p(t?.status);return l({method:a(s?.method),url:a(s?.url),requestHeaders:s?.headers,requestBody:T(u,c),requestContentType:i,responseStatus:q===0?void 0:q,responseStatusText:a(t?.statusText),responseHeaders:t?.headers,responseBody:T(y,S),responseContentType:a(t?.content?.mimeType),startedAt:a(e?.startedDateTime),raw:e},n,o)}var b=class{id="har";canParse(n,o){if(A.extname(n).toLowerCase()===".har")return!0;let t=o.toLowerCase();return t.includes('"log"')&&t.includes('"entries"')}async*parse(n){let o=0;for await(let s of f(n,"log.entries")){let t=K(s,o,n);t&&(yield t),o+=1}}};import $ from"node:path";function H(e){let n=a(e.url??e.uri);if(n)return{url:n};let o=a(e.host??e.headers?.host),s=a(e.path??e.request_uri),t=a(e.scheme??e.forwarded_proto);return o&&s?{url:`${t??"http"}://${o}${s}`,schemeKnown:!!t}:{url:s,schemeKnown:!!t}}function z(e,n,o){let s=e?.request??e?.req??e?.http?.request;if(!s)return null;let t=e?.response??e?.res??e?.http?.response,r=t?.body??t?.raw_body??t?.payload??t?.data,i=s?.body??s?.raw_body??s?.payload??s?.data,{url:u,schemeKnown:c}=H(s);return l({method:a(s?.method??s?.http_method),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:i,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode),responseHeaders:t?.headers,responseBody:r,responseContentType:d(t?.headers),startedAt:a(e?.started_at??e?.startedAt??e?.timestamp),raw:e},n,o)}var x=class{id="kong";canParse(n,o){if($.extname(n).toLowerCase()===".kong")return!0;let t=o.toLowerCase();return t.includes('"latencies"')||t.includes('"request"')&&t.includes('"response"')&&t.includes('"route"')}async*parse(n){let o=(await m(n,16)).trim().slice(0,1),s=0;if(o==="["){for await(let t of f(n)){let r=z(t,s,n);r&&(yield r),s+=1}return}for await(let t of h(n)){let r=z(t,s,n);r&&(yield r),s+=1}}};import R from"node:path";function U(e){return e?.request??e?.req??e?.httpRequest??e?.http?.request??e}function I(e){return e?.response??e?.res??e?.httpResponse??e?.http?.response}function O(e,n){let o=a(n?.url??n?.uri??n?.requestUrl??e?.url);if(o)return{url:o};let s=a(n?.host??n?.headers?.host??e?.host),t=a(n?.path??e?.path??n?.pathname),r=a(n?.scheme??e?.scheme);return s&&t?{url:`${r??"http"}://${s}${t}`,schemeKnown:!!r}:{url:t,schemeKnown:!!r}}function k(e,n,o){let s=U(e),t=I(e),r=s?.body??s?.bodyText??s?.payload??s?.data??s?.rawBody,i=t?.body??t?.bodyText??t?.payload??t?.data??t?.rawBody,{url:u,schemeKnown:c}=O(e,s);return l({method:a(s?.method??s?.httpMethod??e?.method??e?.httpMethod),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:r,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode??e?.status??e?.statusCode),responseHeaders:t?.headers,responseBody:i,responseContentType:d(t?.headers),startedAt:a(e?.startedAt??e?.timestamp??e?.time),raw:e},n,o)}var w=class{id="ndjson";canParse(n,o){let s=R.extname(n).toLowerCase();if(s===".ndjson"||s===".jsonl"||s===".jsonlines")return!0;let t=o.lastIndexOf(`
8
+ `),i=(t===-1?o:o.slice(0,t)).split(`
9
+ `).map(u=>u.trim()).find(Boolean);if(!i?.startsWith("{")||!i.endsWith("}"))return!1;try{return JSON.parse(i),!0}catch{return!1}}async*parse(n){let o=0;for await(let s of h(n)){let t=k(s,o,n);t&&(yield t),o+=1}}};import J from"node:path";function P(e){if(!e)return{};let n=e.trim().split(/\s+/);return n.length<2?{}:{method:n[0],path:n[1],protocol:n[2]}}function W(e,n){let o=a(n?.url??n?.request_uri??n?.uri??e?.url??e?.request_url??e?.absolute_uri),s=P(a(e?.request??n?.request_line)),t=a(n?.request_uri??n?.uri??n?.path??e?.request_uri??e?.uri)??s.path;if(o?.startsWith("http://")||o?.startsWith("https://"))return{url:o};let r=a(n?.host??n?.headers?.host??e?.host??e?.http_host??e?.server_name??e?.vhost),i=a(e?.scheme??n?.scheme??e?.request_scheme),u=!!i;if(r&&(o||t)){let c=i??"http",y=o??t;return y?.startsWith("/")?{url:`${c}://${r}${y}`,schemeKnown:u}:{url:`${c}://${r}/${y}`,schemeKnown:u}}return{url:o??t,schemeKnown:u}}function E(e,n,o){let s=g(e?.request)?e.request:e,t=g(e?.response)?e.response:void 0,r=P(a(e?.request)),i=a(s?.method??s?.request_method??e?.request_method??e?.method)??r.method,{url:u,schemeKnown:c}=W(e,s);return l({method:i,url:u,schemeKnown:c,requestHeaders:s?.headers??s?.request_headers??e?.request_headers??e?.headers,requestBody:s?.body??s?.request_body??e?.request_body??e?.body,requestContentType:d(s?.headers??s?.request_headers??e?.request_headers),responseStatus:p(t?.status??t?.status_code??e?.status??e?.status_code??e?.response_status),responseHeaders:t?.headers??t?.response_headers??e?.response_headers??e?.headers_out,responseBody:t?.body??t?.response_body??e?.response_body,responseContentType:d(t?.headers??t?.response_headers??e?.response_headers),startedAt:a(e?.time_iso8601??e?.timestamp??e?.time??e?.time_local??e?.["@timestamp"]),raw:e},n,o)}async function*j(e){if((await m(e,16)).trim().slice(0,1)==="["){yield*f(e);return}for await(let o of h(e))yield o}var N=class{id="nginx-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("nginx"))return!0;let r=o.toLowerCase();return r.includes('"request_uri"')||r.includes('"time_iso8601"')||r.includes('"upstream_response_time"')||r.includes('"remote_addr"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}},_=class{id="apache-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("apache"))return!0;let r=o.toLowerCase();return r.includes('"request_method"')||r.includes('"request_uri"')||r.includes('"vhost"')||r.includes('"response_status"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}};var B=[new b,new x,new N,new _,new w];async function le(e,n){if(n!=="auto"){let s=B.find(t=>t.id===n);if(!s)throw new Error(`Unsupported parser format: ${n}`);return s}let o=await m(e);return B.find(s=>s.canParse(e,o))}export{le as a};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{b as g,c as y}from"./NEWT5A6S.js";import{e as m}from"./RFWIIJFG.js";var l=m(y(),1);var p=m(y(),1);function v(t,o){let e={};for(let n of Object.keys(t)){let r=t[n];if(!r)continue;let c=typeof r=="function"?r:r.enter,s=typeof r=="function"?void 0:r.leave;e[n]={...c?{enter:h(c,o)}:{},...s?{leave:h(s,o)}:{}}}return e}function h(t,o){return(e,n,r,c,s)=>{t(e,q(e,o,s))}}function q(t,o,e=[]){let{ruleId:n,severity:r,message:c,source:s,config:a,problems:u}=o,f=e.filter(i=>!Array.isArray(i));return{source:s,config:a,ancestors:f,report(i){let I=i.node??t,d=i.loc??G(I),x={source:s,pointer:void 0,start:d?.start??{line:1,col:1},end:d?.end};u.push({ruleId:i.ruleId??n,severity:i.severity??r,message:c?c.replace("{{message}}",i.message):i.message,suggest:i.suggest??[],location:[x]})}}}function G(t){if(!t?.loc)return;let o=(0,p.getLocation)(t.loc.source,t.loc.start),e=(0,p.getLocation)(t.loc.source,t.loc.end);return{start:{line:o.line,col:o.column},end:{line:e.line,col:e.column}}}function R(t){let{document:o,config:e}=t,n=o.source;if(n.body.trim()==="")return[{ruleId:"struct",severity:"error",message:"The GraphQL document is empty. Expected at least one type definition.",suggest:[],location:[{source:n,pointer:void 0,start:{line:1,col:1}}]}];let r;try{r=(0,l.parse)(new l.Source(n.body,n.absoluteRef))}catch(u){if(u instanceof l.GraphQLError)return[V(u,n)];throw u}let c=e.getRulesForSpecVersion("graphql")??[],s=g(c,e,"rules","graphql");return b({ast:r,source:n,config:e,rules:s}).map(u=>e.addProblemToIgnore(u))}function V(t,o){let e=t.locations?.[0];return{ruleId:"struct",severity:"error",message:t.message,suggest:[],location:[{source:o,pointer:void 0,start:e?{line:e.line,col:e.column}:{line:1,col:1}}]}}function b(t){let{ast:o,source:e,config:n,rules:r}=t,c=[],s=r.map(({ruleId:a,severity:u,message:f,visitor:i})=>v(i,{ruleId:a,severity:u,message:f,source:e,config:n,problems:c}));return s.length>0&&(0,l.visit)(o,(0,l.visitInParallel)(s)),c}export{R as lintGraphqlDocument};