@redocly/cli 2.56.0 → 2.56.1

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 (132) hide show
  1. package/THIRD_PARTY_NOTICES +14 -30
  2. package/lib/chunks/{7MISZQY2.js → 25UBBA3J.js} +1 -1
  3. package/lib/chunks/{LGQZK7NR.js → 2KLHD2U7.js} +1 -1
  4. package/lib/chunks/{N2D5LLBV.js → 2M6C5LHI.js} +1 -1
  5. package/lib/chunks/{P43DKA2E.js → 2UTQDU6B.js} +1 -1
  6. package/lib/chunks/{BDCNFVGZ.js → 35XUUJLG.js} +1 -1
  7. package/lib/chunks/{DXEOF3IX.js → 3W3OLLTF.js} +1 -1
  8. package/lib/chunks/4PTNG4EI.js +7 -0
  9. package/lib/chunks/{3L35HFJG.js → 5CEXCXYZ.js} +1 -1
  10. package/lib/chunks/{MWNK3IKD.js → 5TJ3WQMW.js} +1 -1
  11. package/lib/chunks/64G5RPLP.js +7 -0
  12. package/lib/chunks/{YJ2CV2FV.js → 6BC7FVBU.js} +1 -1
  13. package/lib/chunks/{RDLDTF4L.js → 7ARFLNUA.js} +1 -1
  14. package/lib/chunks/{5KSMVZSO.js → 7QLACFLT.js} +1 -1
  15. package/lib/chunks/{XKNG65W6.js → A5VZWAMI.js} +1 -1
  16. package/lib/chunks/{ZQHPJPJ2.js → ALAAZCRE.js} +1 -1
  17. package/lib/chunks/{BH4SKQ6M.js → BNT5BXON.js} +1 -1
  18. package/lib/chunks/CXUJFJ3V.js +11 -0
  19. package/lib/chunks/{UQHIGGP6.js → D7OG7544.js} +1 -1
  20. package/lib/chunks/{E2KKD73B.js → DCVTFQBO.js} +1 -1
  21. package/lib/chunks/{LPB2X45H.js → DJ2P263F.js} +1 -1
  22. package/lib/chunks/DLPIGJ4V.js +14 -0
  23. package/lib/chunks/{N2FNYVCN.js → E5XZY3Q2.js} +1 -1
  24. package/lib/chunks/{EJXJAU3Z.js → FUETBXGV.js} +1 -1
  25. package/lib/chunks/{QKT4AI5U.js → FX2A3GCS.js} +1 -1
  26. package/lib/chunks/{FTARAJQN.js → G47ZYA3C.js} +1 -1
  27. package/lib/chunks/GHSNC2OX.js +9 -0
  28. package/lib/chunks/HBUZKWXC.js +7 -0
  29. package/lib/chunks/HDOITPQ3.js +20 -0
  30. package/lib/chunks/{3R32Y5ZJ.js → HJZMPHXS.js} +1 -1
  31. package/lib/chunks/{AOFLS3JM.js → HSBHQBL2.js} +2 -2
  32. package/lib/chunks/I6CD22RU.js +10 -0
  33. package/lib/chunks/{DSD57XD4.js → I7GIWE3P.js} +1 -1
  34. package/lib/chunks/IGD6TJGQ.js +34 -0
  35. package/lib/chunks/{UTZVN6YA.js → IRZBI5PN.js} +1 -1
  36. package/lib/chunks/ISV7E3WY.js +29 -0
  37. package/lib/chunks/IXUAYOCK.js +18 -0
  38. package/lib/chunks/{6WNK6ZW5.js → JO2R43LS.js} +1 -1
  39. package/lib/chunks/{O64VVDHW.js → M3P4YXWZ.js} +1 -1
  40. package/lib/chunks/{NPBKCM7B.js → MB5P3K2R.js} +1 -1
  41. package/lib/chunks/MGBZEDQJ.js +45 -0
  42. package/lib/chunks/{FKC3B2RN.js → MRVYTOFX.js} +1 -1
  43. package/lib/chunks/{RZ6XOBIA.js → MS356BQ6.js} +1 -1
  44. package/lib/chunks/{NHMYQF3F.js → MTHNGTMB.js} +1 -1
  45. package/lib/chunks/{MGMNYFOR.js → MU74CSJJ.js} +2 -2
  46. package/lib/chunks/{VM6OOWSF.js → NV7DJMMF.js} +1 -1
  47. package/lib/chunks/{JADJJP6R.js → OGD5QBKV.js} +1 -1
  48. package/lib/chunks/{SH75MWAC.js → OKP4XLDY.js} +1 -1
  49. package/lib/chunks/{ARIBTVNO.js → P6LCRZC4.js} +1 -1
  50. package/lib/chunks/PIMM4UUT.js +9 -0
  51. package/lib/chunks/{TC3EIKUK.js → PJRRECUU.js} +1 -1
  52. package/lib/chunks/QAC4XUNG.js +14 -0
  53. package/lib/chunks/{7BAI3GZ5.js → R5EOHC5A.js} +4 -4
  54. package/lib/chunks/{QXIVVOOR.js → RAZQQ2DW.js} +1 -1
  55. package/lib/chunks/SJHPKWSD.js +9 -0
  56. package/lib/chunks/{JDBGRKTP.js → SRIYNICE.js} +1 -1
  57. package/lib/chunks/{HOUAVEH6.js → T3LLCSAJ.js} +1 -1
  58. package/lib/chunks/TWIJOWYT.js +7 -0
  59. package/lib/chunks/U5DIFWGH.js +7 -0
  60. package/lib/chunks/{7IULUVWX.js → UF2ZCH7W.js} +1 -1
  61. package/lib/chunks/{UNHSYVDZ.js → UVP374Z3.js} +1 -1
  62. package/lib/chunks/{DOJW7C4M.js → VCODEISK.js} +2 -2
  63. package/lib/chunks/VD6XNXNY.js +7 -0
  64. package/lib/chunks/VMGZLFL4.js +11 -0
  65. package/lib/chunks/{ZHK7GAOT.js → VTGQPPGI.js} +1 -1
  66. package/lib/chunks/VUKQLVFA.js +10 -0
  67. package/lib/chunks/W5WXQVTO.js +13 -0
  68. package/lib/chunks/{TVL6DMBV.js → XACYMDME.js} +3 -3
  69. package/lib/chunks/{WUXDP2A3.js → XJ7LVK2B.js} +1 -1
  70. package/lib/chunks/XJSNA6VQ.js +119 -0
  71. package/lib/chunks/{ICOYFJR4.js → XXP75TZV.js} +1 -1
  72. package/lib/chunks/YW2GBLJX.js +7 -0
  73. package/lib/chunks/{GORWWTSA.js → Z22TFV6U.js} +1 -1
  74. package/lib/chunks/{ISBVQBNS.js → ZCIVIBWW.js} +1 -1
  75. package/lib/chunks/ZOVYQ36P.js +193 -0
  76. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  77. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  78. package/lib/eject-assets/generators/cli/index.ts +2 -2
  79. package/lib/eject-assets/generators/cli/render.ts +1 -1
  80. package/lib/eject-assets/generators/go/client.ts +1 -1
  81. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  82. package/lib/eject-assets/generators/go/index.ts +2 -2
  83. package/lib/eject-assets/generators/go/models.ts +1 -1
  84. package/lib/eject-assets/generators/go/naming.ts +1 -1
  85. package/lib/eject-assets/generators/go/operations.ts +1 -1
  86. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  87. package/lib/eject-assets/generators/go/types.ts +1 -1
  88. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  89. package/lib/eject-assets/generators/mock/index.ts +2 -2
  90. package/lib/eject-assets/generators/mock/render.ts +1 -1
  91. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  92. package/lib/eject-assets/generators/mock/values.ts +1 -1
  93. package/lib/eject-assets/generators/php/client.ts +1 -1
  94. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  95. package/lib/eject-assets/generators/php/index.ts +2 -2
  96. package/lib/eject-assets/generators/php/models.ts +1 -1
  97. package/lib/eject-assets/generators/php/naming.ts +1 -1
  98. package/lib/eject-assets/generators/php/operations.ts +1 -1
  99. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  100. package/lib/eject-assets/generators/php/types.ts +1 -1
  101. package/lib/eject-assets/generators/python/client.ts +1 -1
  102. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  103. package/lib/eject-assets/generators/python/index.ts +2 -2
  104. package/lib/eject-assets/generators/python/models.ts +1 -1
  105. package/lib/eject-assets/generators/python/naming.ts +1 -1
  106. package/lib/eject-assets/generators/python/operations.ts +1 -1
  107. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  108. package/lib/eject-assets/generators/python/types.ts +1 -1
  109. package/lib/eject-assets/generators/swr/index.ts +2 -2
  110. package/lib/eject-assets/generators/swr/render.ts +1 -1
  111. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  112. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  113. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  114. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  115. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  116. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  117. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  118. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  119. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  120. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  121. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  122. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  123. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  124. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  125. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  126. package/lib/eject-assets/generators/zod/index.ts +2 -2
  127. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  128. package/lib/index.js +78 -293
  129. package/package.json +1 -1
  130. package/lib/chunks/EVTLV6L3.js +0 -13
  131. package/lib/chunks/M4FV4I2Z.js +0 -47
  132. package/lib/chunks/UVKEIQXW.js +0 -193
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as a,c as b,d as c}from"./UQHIGGP6.js";import"./2U6O26CV.js";import"./TC3EIKUK.js";import"./FKC3B2RN.js";import"./VM6OOWSF.js";import"./MGMNYFOR.js";import"./WZXA5XPB.js";import"./UVKEIQXW.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as cliDocs,a as cliGenerator,c as cliSample};
7
+ import{b as a,c as b,d as c}from"./D7OG7544.js";import"./2U6O26CV.js";import"./PJRRECUU.js";import"./MRVYTOFX.js";import"./NV7DJMMF.js";import"./MU74CSJJ.js";import"./WZXA5XPB.js";import"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as cliDocs,a as cliGenerator,c as cliSample};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c}from"./UVKEIQXW.js";import{open as U,readdir as H,stat as J}from"node:fs/promises";import x from"node:path";var L=new Set([".yaml",".yml",".json"]);async function K(e){let n=[];async function t(r){let o=await H(r,{withFileTypes:!0});for(let s of o){if(s.name.startsWith("."))continue;let i=x.join(r,s.name);if(s.isDirectory()){await t(i);continue}s.isFile()&&L.has(x.extname(s.name).toLowerCase())&&n.push(i)}}return await t(e),n.sort(),n}async function G(e,n=4096){let t=await U(e,"r");try{let r=Buffer.allocUnsafe(n),{bytesRead:o}=await t.read(r,0,n,0);return r.toString("utf8",0,o)}finally{await t.close()}}function X(e){return x.resolve(process.cwd(),e)}async function Y(e){let n=await J(e);if(n.isFile())return[e];if(!n.isDirectory())return[];let t=[];async function r(o){let s=await H(o,{withFileTypes:!0});for(let i of s){if(i.name.startsWith("."))continue;let a=x.join(o,i.name);if(i.isDirectory()){await r(a);continue}i.isFile()&&t.push(a)}}return await r(e),t.sort(),t}var z="drift.local",B=`http://${z}`;function l(e){return e===z}var I=new Set(["accept","accept-charset","accept-encoding","accept-language","authorization","baggage","cache-control","cdn-loop","cookie","connection","content-length","content-type","dpr","dnt","downlink","ect","forwarded","host","if-match","if-modified-since","if-none-match","if-range","if-unmodified-since","origin","pragma","priority","range","referer","sec-fetch-dest","sec-fetch-mode","sec-fetch-site","sec-fetch-user","sec-gpc","sentry-trace","te","traceparent","tracestate","upgrade","upgrade-insecure-requests","user-agent","via","x-client-trace-id","x-cloud-trace-context","x-correlation-id","x-http-method-override","x-hub-signature","x-hub-signature-256","x-method-override","x-real-ip","x-request-id","x-forwarded-for","x-forwarded-host","x-forwarded-port","x-forwarded-proto"]),q=["cf-","sec-ch-","sec-fetch-","x-amz-","x-amzn-","x-b3-","x-envoy-","x-forwarded-","x-github-"],T=`
7
+ import{c}from"./ZOVYQ36P.js";import{open as U,readdir as H,stat as J}from"node:fs/promises";import x from"node:path";var L=new Set([".yaml",".yml",".json"]);async function K(e){let n=[];async function t(r){let o=await H(r,{withFileTypes:!0});for(let s of o){if(s.name.startsWith("."))continue;let i=x.join(r,s.name);if(s.isDirectory()){await t(i);continue}s.isFile()&&L.has(x.extname(s.name).toLowerCase())&&n.push(i)}}return await t(e),n.sort(),n}async function G(e,n=4096){let t=await U(e,"r");try{let r=Buffer.allocUnsafe(n),{bytesRead:o}=await t.read(r,0,n,0);return r.toString("utf8",0,o)}finally{await t.close()}}function X(e){return x.resolve(process.cwd(),e)}async function Y(e){let n=await J(e);if(n.isFile())return[e];if(!n.isDirectory())return[];let t=[];async function r(o){let s=await H(o,{withFileTypes:!0});for(let i of s){if(i.name.startsWith("."))continue;let a=x.join(o,i.name);if(i.isDirectory()){await r(a);continue}i.isFile()&&t.push(a)}}return await r(e),t.sort(),t}var z="drift.local",B=`http://${z}`;function l(e){return e===z}var I=new Set(["accept","accept-charset","accept-encoding","accept-language","authorization","baggage","cache-control","cdn-loop","cookie","connection","content-length","content-type","dpr","dnt","downlink","ect","forwarded","host","if-match","if-modified-since","if-none-match","if-range","if-unmodified-since","origin","pragma","priority","range","referer","sec-fetch-dest","sec-fetch-mode","sec-fetch-site","sec-fetch-user","sec-gpc","sentry-trace","te","traceparent","tracestate","upgrade","upgrade-insecure-requests","user-agent","via","x-client-trace-id","x-cloud-trace-context","x-correlation-id","x-http-method-override","x-hub-signature","x-hub-signature-256","x-method-override","x-real-ip","x-request-id","x-forwarded-for","x-forwarded-host","x-forwarded-port","x-forwarded-proto"]),q=["cf-","sec-ch-","sec-fetch-","x-amz-","x-amzn-","x-b3-","x-envoy-","x-forwarded-","x-github-"],T=`
8
8
  `;function Z(e){return e.split(T)}function S(e,n,t){let r=n.toLowerCase(),o=e[r];if(o===void 0){e[r]=t;return}e[r]=r==="set-cookie"?`${o}${T}${t}`:`${o},${t}`}function w(e){if(!c(e)&&!Array.isArray(e))return{};let n={};if(Array.isArray(e)){for(let t of e){if(!c(t))continue;let{name:r,value:o}=t;typeof r=="string"&&o!==void 0&&S(n,r,String(o))}return n}for(let[t,r]of Object.entries(e))if(r!=null){if(Array.isArray(r)){for(let o of r)S(n,t,String(o));continue}S(n,t,String(r))}return n}function m(e){try{return new URL(e)}catch{return new URL(e,B)}}function N(e){return e.length>1&&e.endsWith("/")?e.slice(0,-1):e}function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v(e){let n=[],t=0,r=e.startsWith("/")?e:`/${e}`,s=N(r).split("/").map(i=>{if(!i)return"";let a=[...i.matchAll(/\{([^}]+)\}/g)],h=n.length,u="",p=0,f=0;for(let[y,d]of a.entries()){let R=i.slice(f,d.index);u+=b(R),p+=R.length,n.push(d[1]),f=d.index+d[0].length;let E=a[y+1];if(!E){u+="([^/]+)";continue}let A=i.slice(f,E.index);u+=A?`((?:(?!${b(A)})[^/])+)`:"([^/])"}let g=i.slice(f);return u+=b(g),p+=g.length,n.length===h?t+=2:p>0&&(t+=1),u}).join("/");return{regex:new RegExp(`^${s||"/"}$`),params:n,score:t}}function k(e,n){if(n&&P(e))try{return JSON.parse(n)}catch{return}}function C(e){return e?e.split(";")[0]?.trim().toLowerCase()??"":""}function P(e){let n=C(e);return n==="application/json"||n.endsWith("+json")}function ee(e,n){let t=C(n);if(!t)return e["application/json"]??e["*/*"];if(e[t]!==void 0)return e[t];let[r,o]=t.split("/");if(r&&o){let s=`${r}/*`;if(e[s]!==void 0)return e[s]}return e["*/*"]}function ne(e){let n=new Set,t=[];for(let r of e){let o=r.trim().toLowerCase();o.length!==0&&(o.endsWith("*")?t.push(o.slice(0,-1)):n.add(o))}return{names:n,prefixes:t}}function te(e,n){let t=e.toLowerCase();return t.startsWith(":")||I.has(t)||q.some(r=>t.startsWith(r))?!0:n?n.names.has(t)||n.prefixes.some(r=>t.startsWith(r)):!1}import{createReadStream as F}from"node:fs";import{readFile as j}from"node:fs/promises";import{createInterface as W}from"node:readline";function D(e){if(e!=null){if(typeof e=="string")return e;if(Buffer.isBuffer(e))return e.toString("utf8");if(c(e)||Array.isArray(e))try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}function ue(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){let n=Number(e);if(Number.isFinite(n))return n}}function $(e,n){if(e!=null){if(n==="base64"&&typeof e=="string")try{return Buffer.from(e,"base64").toString("utf8")}catch{return e}return D(e)}}function fe(e,n,t){let r=e.method?.toUpperCase(),o=e.url;if(!r||!o)return null;let s=w(e.requestHeaders),i=m(o);if(l(i.host)&&s.host)try{i=new URL(`${i.protocol}//${s.host}${i.pathname}${i.search}`)}catch{i=m(o)}let a=e.requestContentType??s["content-type"],h=$(e.requestBody),u={method:r,url:i.toString(),path:i.pathname,query:i.searchParams,protocol:i.protocol,protocolKnown:e.schemeKnown??/^https?:\/\//i.test(o),host:l(i.host)?void 0:i.host||void 0,headers:s,contentType:a,bodyText:h,bodyJson:k(a,h)},p,f=e.responseStatus;if(f!==void 0){let g=w(e.responseHeaders),y=e.responseContentType??g["content-type"],d=$(e.responseBody);p={status:f,statusText:e.responseStatusText,headers:g,contentType:y,bodyText:d,bodyJson:k(y,d)}}return{index:n,source:t,startedAt:e.startedAt,request:u,response:p,raw:e.raw}}async function*de(e){let n=F(e,{encoding:"utf8"}),t=W({input:n,crlfDelay:1/0});for await(let r of t){let o=r.trim();if(o)try{let s=JSON.parse(o);c(s)&&(yield s)}catch{}}}async function*pe(e,n){let t=await j(e,"utf8"),r=JSON.parse(t);if(n)for(let o of n.split("."))r=c(r)?r[o]:void 0;if(Array.isArray(r))for(let o of r)c(o)&&(yield o)}function ge(e){return w(e)["content-type"]}function he(e){return e?.replace(/\/+$/,"")||void 0}function O(e,n){if(!n||n==="/")return e||"/";if(e===n)return"/";if(e.startsWith(`${n}/`))return e.slice(n.length)||"/"}function ye(e,n){if(n.startsWith("/"))return O(e.path,n);let t=m(n.includes("://")?n:`http://${n}`);if(!(l(t.host)||e.host!==void 0&&e.host.toLowerCase()!==t.host))return O(e.path,N(t.pathname))}export{K as a,G as b,X as c,Y as d,l as e,Z as f,m as g,N as h,v as i,C as j,P as k,ee as l,ne as m,te as n,D as o,ue as p,$ as q,fe as r,de as s,pe as t,ge as u,he as v,ye as w};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c as a,d as b}from"./MWNK3IKD.js";import"./MGMNYFOR.js";import"./WZXA5XPB.js";import"./UVKEIQXW.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
7
+ import{c as a,d as b}from"./5TJ3WQMW.js";import"./MU74CSJJ.js";import"./WZXA5XPB.js";import"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{l as t}from"./FTARAJQN.js";import"./LRUXN6H5.js";import{X as o}from"./UVKEIQXW.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
7
+ import{l as t}from"./G47ZYA3C.js";import"./LRUXN6H5.js";import{X as o}from"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
8
8
  `)}export{i as handleLogout};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b,c,d,e}from"./JADJJP6R.js";import"./2U6O26CV.js";import"./VM6OOWSF.js";import"./MGMNYFOR.js";import"./WZXA5XPB.js";import"./UVKEIQXW.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as phpDocs,c as phpGenerator,d as phpSample,a as phpType,b as renderPhpModels};
7
+ import{a,b,c,d,e}from"./OGD5QBKV.js";import"./2U6O26CV.js";import"./NV7DJMMF.js";import"./MU74CSJJ.js";import"./WZXA5XPB.js";import"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as phpDocs,c as phpGenerator,d as phpSample,a as phpType,b as renderPhpModels};
@@ -0,0 +1,11 @@
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 F,b as ae,c as me,d as pe,e as K}from"./VD6XNXNY.js";import{a as ce,b as fe}from"./64G5RPLP.js";import{h as oe,i as x,j as ie,k as se,n as T,o as h,p as re}from"./MGBZEDQJ.js";import{G as Z,O as ee,P as te,R as u,X as N,Z as ne,b as U,c as I,ca as b,d as O,h as L,o as d,r as S}from"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import*as Me from"node:fs";import{performance as We}from"perf_hooks";import*as ve from"node:fs";import*as G from"node:path";import*as le from"node:path";function A(e,t,n={}){pe(e,i=>{if(S(i)&&K(i.$ref))o(i,"$ref");else if(I(i.discriminator)&&I(i.discriminator.mapping)){let{mapping:s}=i.discriminator;for(let m of Object.keys(s)){let a=s[m];typeof a=="string"&&K(a)&&o(i.discriminator.mapping,m)}}});function o(i,s){let m=i[s].split("/"),a=m.pop(),p=m[2],r=n[p];if(!r||!r[a])return;let c=d(le.relative(t,r[a].filename));c.startsWith(".")||(c="./"+c),i[s]=c}}import*as Q from"node:path";import*as ye from"node:path";function E(e,t,n){return ye.join(e,t)+`.${n}`}var he=["schemas","messages","securitySchemes","parameters","correlationIds","messageTraits","operationTraits","serverBindings","channelBindings","operationBindings","messageBindings"];var Ae=["schemas","messages","securitySchemes","servers","serverVariables","parameters","replies","replyAddresses","correlationIds","messageTraits","operationTraits","tags","externalDocs","serverBindings","channelBindings","operationBindings","messageBindings"];function Y(e,t){return(t==="async2"?he:Ae).filter(o=>o in e)}function de({asyncapi:e,asyncapiDir:t,componentsFiles:n,ext:o,specVersion:i}){let s=e.components;if(!s)return;let m=Q.join(t,F),a=Y(s,i);for(let p of a){let r=Q.join(m,p);for(let c of Object.keys(s[p]||{})){let y=E(r,c,o),f=[];p==="schemas"&&(f=(s[p]?.[c]?.allOf||[]).map(({$ref:l})=>l).filter(L)),n[p]=n[p]||{},n[p][c]={inherits:f,filename:y}}}}import*as ue from"node:fs";import*as w from"node:path";import*as M from"node:path";function g(e,t,n){let o=M.resolve(e),i=M.resolve(t);if(i!==o&&!i.startsWith(o+M.sep))throw new b(`Refusing to write "${n}" outside the output directory.`)}import*as P from"node:fs";import*as ge from"node:path";function v(e,t,n){if(!P.existsSync(e)||!P.statSync(e).isDirectory())return;let o=P.readdirSync(e);for(let i of o){let s=ge.join(e,i);P.statSync(s).isDirectory()?v(s,t,n):t(s,e,n)}}function $(e,t,n){if(!Z(e))return;let o=T(e);A(o,t,n),h(o,e)}function Ce({channels:e,asyncapiDir:t,outDir:n,componentsFiles:o,pathSeparator:i,ext:s}){let m={};if(!e)return m;ue.mkdirSync(n,{recursive:!0});for(let a of Object.keys(e)){let p=`${w.join(n,x(a,i))}.${s}`,r=e[a];S(r)||(g(t,p,a),m[a]=p,A(r,w.dirname(p),o),h(r,p),e[a]={$ref:d(w.relative(t,p))},v(n,$,o))}return m}import*as De from"node:fs";import*as R from"node:path";import*as Oe from"node:fs";function j(e){return e!=="securitySchemes"}function V(e,t){j(t)&&Oe.mkdirSync(e,{recursive:!0})}import*as Se from"node:fs";function H(e,t){return Se.existsSync(e)&&!U(T(e),t)}import*as Ne from"node:path";function k(e,t,n){if(!(!I(e)&&!Array.isArray(e))){if(Array.isArray(e)){for(let o of e)k(o,t,n);return}for(let o of Object.keys(e)){let i=e[o];if(o==="$ref"&&typeof i=="string"&&i.startsWith("#/channels/")){let s=i.slice(11),m=s.indexOf("/"),a=m===-1?s:s.slice(0,m),p=m===-1?"":s.slice(m),r=n[a];if(r){let c=d(Ne.relative(t,r));e[o]=p?`${c}#${p}`:c}}else k(i,t,n)}}}function Fe(e,t){let n=e.components;n&&(O(n[t])&&delete n[t],O(n)&&delete e.components)}function xe({asyncapi:e,asyncapiDir:t,componentsFiles:n,channelsFiles:o,ext:i,specVersion:s}){let m=e.components;if(m){let r=function(c){let y=R.join(a,c);V(y,c);for(let f of Object.keys(m?.[c]||{})){let l=E(y,f,i);g(t,l,f);let C=m?.[c]?.[f];A(C,R.dirname(l),n),k(C,R.dirname(l),o),H(l,C)?N.warn(`warning: conflict for ${f} - file already exists with different content: ${u(l)} ... Skip.
8
+ `):h(C,l),delete m?.[c]?.[f]}Fe(e,c)},a=R.join(t,F);De.mkdirSync(a,{recursive:!0}),Y(m,s).forEach(r)}}import*as Ee from"node:fs";import*as _ from"node:path";function Pe({operations:e,asyncapiDir:t,outDir:n,componentsFiles:o,channelsFiles:i,pathSeparator:s,ext:m}){if(e){Ee.mkdirSync(n,{recursive:!0});for(let a of Object.keys(e)){let p=`${_.join(n,x(a,s))}.${m}`,r=e[a];S(r)||(g(t,p,a),A(r,_.dirname(p),o),k(r,_.dirname(p),i),h(r,p),e[a]={$ref:d(_.relative(t,p))},v(n,$,o))}}}function _e({asyncapi:e,asyncapiDir:t,pathSeparator:n,ext:o,specVersion:i}){ve.mkdirSync(t,{recursive:!0});let s={};de({asyncapi:e,asyncapiDir:t,componentsFiles:s,ext:o,specVersion:i});let m=e.channels,a=m?Ce({channels:m,asyncapiDir:t,outDir:G.join(t,ae),componentsFiles:s,pathSeparator:n,ext:o}):{};xe({asyncapi:e,asyncapiDir:t,componentsFiles:s,channelsFiles:a,ext:o,specVersion:i}),i==="async3"&&e.operations&&Pe({operations:e.operations,asyncapiDir:t,outDir:G.join(t,me),componentsFiles:s,channelsFiles:a,pathSeparator:n,ext:o}),A(e,t,s),h(e,G.join(t,`asyncapi.${o}`))}import*as Be from"node:fs";import*as J from"node:path";import*as ke from"node:fs";import*as B from"node:path";import*as q from"node:path";function be(e){return q.basename(e,q.extname(e))}function Te(e){return e?fe.filter(t=>j(t)&&Object.keys(e).includes(t)):[]}function $e(e,t,n,o,i){let s=[];n==="schemas"&&(s=(e?.[n]?.[o]?.allOf||[]).map(({$ref:m})=>m).filter(L)),t[n]=t[n]||{},t[n][o]={inherits:s,filename:i}}import*as X from"node:path";function we(e,t,n,o){if(!e.discriminator)return;let i=`#/${F}/schemas/${t}`,s={};for(let[r,{inherits:c,filename:y}]of Object.entries(o))if(c.indexOf(i)>-1){let f=d(X.relative(X.dirname(n),y));s[r]=f.startsWith(".")?f:"./"+f}if(O(s))return;let m=e.properties[e.discriminator.propertyName],a=m&&m.enum,p=e.discriminator.mapping=e.discriminator.mapping||{};for(let r of Object.keys(s))a&&!a.includes(r)||(p[r]&&p[r]!==s[r]&&N.warn(`warning: explicit mapping overlaps with local mapping entry ${ee(r)} at ${u(n)}. Please check it.`),p[r]=s[r])}function je(e,t){e.components&&O(e.components[t])&&delete e.components[t],O(e.components)&&delete e.components}function Re(e,t,n,o){let{components:i}=e;if(i){let a=function(r){let c=B.join(s,r);for(let y of Object.keys(i?.[r]||{})){let f=E(c,y,o);g(t,f,y),$e(i,n,r,y,f)}},p=function(r){let c=B.join(s,r);V(c,r);for(let y of Object.keys(i?.[r]||{})){let f=E(c,y,o),l=i?.[r]?.[y];A(l,B.dirname(f),n),we(l,be(f),f,n.schemas||{}),H(f,l)?N.warn(`warning: conflict for ${y} - file already exists with different content: ${u(f)} ... Skip.
9
+ `):h(l,f),j(r)&&delete e.components?.[r]?.[y]}je(e,r)},s=B.join(t,F);ke.mkdirSync(s,{recursive:!0});let m=Te(i);m.forEach(a),m.forEach(p)}}import*as W from"node:fs";import*as D from"node:path";function z(e,t,n,o,i,s="",m){if(e){W.mkdirSync(n,{recursive:!0});for(let a of Object.keys(e)){let p=`${D.join(n,x(a,i))}.${m}`,r=e[a];if(!S(r)){g(t,p,a);for(let c of ce){let y=r[c],f=y?.["x-code-samples"]||y?.["x-codeSamples"];if(!(!f||!Array.isArray(f)))for(let l of f){if(l.source&&l.source.$ref)continue;let C=D.join(t,"code_samples",ie(l.lang),s+x(a,i),c+se(l.lang));g(t,C,l.lang),W.mkdirSync(D.dirname(C),{recursive:!0}),W.writeFileSync(C,l.source),l.source={$ref:d(D.relative(n,C))}}}h(r,p),e[a]={$ref:d(D.relative(t,p))},v(n,$,o)}}}}function Ie(e,t,n,o){Be.mkdirSync(t,{recursive:!0});let i={};Re(e,t,i,o),z(e.paths,t,J.join(t,"paths"),i,n,void 0,o);let s=e.webhooks||e["x-webhooks"];z(s,t,J.join(t,"webhooks"),i,n,"webhook_",o),A(e,t,i),h(e,J.join(t,`openapi.${o}`))}async function Vn({argv:e,collectSpecData:t}){let n=We.now(),{api:o,outDir:i,separator:s}=e,m=re(o);if(!Me.existsSync(o))throw new b(`File ${u(o)} does not exist.`);let a=T(o);t?.({parsed:a});let p=ne(a);switch(p){case"async2":case"async3":_e({asyncapi:a,asyncapiDir:i,pathSeparator:s,ext:m,specVersion:p});break;case"oas3_0":case"oas3_1":case"oas3_2":Ie(a,i,s,m);break;case"oas2":throw new b("OpenAPI 2 is not supported by this command.");default:throw new b("File does not conform to the OpenAPI or AsyncAPI Specification. Version is not specified.")}N.info(`\u{1FA93} Document: ${u(o)} ${te("is successfully split")}
10
+ and all related files are saved to the directory: ${u(i)}
11
+ `),oe("split",n,o)}export{Vn as handleSplit,z as iteratePathItems};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{h as g}from"./FKC3B2RN.js";import{e as C,l as u,m as p}from"./VM6OOWSF.js";import{c as j,d as v}from"./MGMNYFOR.js";import{X as b}from"./UVKEIQXW.js";import{a as S,b as k}from"./UW4UC7ZI.js";import{join as $}from"node:path";function h(r){return(r??"").replace(/\s+/g," ").trim().replace(/\\/g,"\\\\").replace(/\|/g,"\\|")}function w(r){return[r.group===void 0?void 0:u(r.group),r.name].filter(Boolean).join(" ")}function T(r,e){return[r,w(e),...e.positionals.map(o=>`<${o.name}>`),...e.flags.filter(o=>o.required).map(o=>`--${o.name} <${o.type}>`),...e.body?[e.body.required?"--json '<json>'":"[--json '<json>']"]:[]].filter(o=>o!=="").join(" ")}function B(r,e){r.line("| Flag | Type | Required | Description |"),r.line("| ---- | ---- | -------- | ----------- |");for(let n of e){let o=[h(n.description),n.enum===void 0?"":`One of ${n.enum.map(t=>`\`${t}\``).join(", ")}.`,n.type==="array"?"Repeat the flag for multiple values.":""].filter(t=>t!=="").join(" ");r.line(`| \`--${n.name}\` | ${n.type} | ${n.required?"yes":"no"} | ${o} |`)}r.blank()}function D(r,e,n){if(r.line(`### \`${w(e)}\``),r.blank(),e.summary!==void 0&&(r.line(h(e.summary)),r.blank()),r.line(`\`${e.method} ${e.path}\``),r.blank(),r.line("```sh"),r.line(T(n.name,e)),r.line("```"),r.blank(),e.positionals.length>0){r.line("| Argument | Description |"),r.line("| -------- | ----------- |");for(let t of e.positionals)r.line(`| \`<${t.name}>\` | ${h(t.description)} |`);r.blank()}e.flags.length>0&&B(r,e.flags);let o=[e.body===void 0?"":`Takes a JSON body${e.body.required?" (required)":""}: \`--json '<json>'\`, \`--json @file.json\`, or \`--json @-\` for stdin.`,e.unsupportedBody===void 0?"":`Takes a \`${e.unsupportedBody}\` body, which the CLI cannot build \u2014 call this operation through the generated client instead.`,e.paginated===!0?"Paginated: `--page-all` follows every page, printing one JSON page per line.":"",e.sse===!0?"Streams server-sent events as one JSON object per line.":"",e.blob===!0?"Returns binary content, so `--output <path>` is required.":""].filter(t=>t!=="");for(let t of o)r.line(t);o.length>0&&r.blank()}function R(r,e){let n=new S;e.frontmatter&&(n.line("---"),n.line(`title: ${e.title}`),n.line("---"),n.blank()),n.line(`# ${e.title}`),n.blank(),n.line(`Generated command-line reference for \`${e.name}\`, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line("## Usage"),n.blank(),n.line("```sh"),n.line(`${e.name} <command> [flags]`),n.line(`${e.name} --help`),n.line(`${e.name} schema <command> # request/response schemas`),n.line("```"),n.blank(),n.line("Install the file under any `bin` name: the command takes that name, and the credential variables below do not change."),n.blank(),n.line("## Global flags"),n.blank(),n.line("| Flag | Description |"),n.line("| ---- | ----------- |");let o=e.schemes.some(i=>i.kind==="bearer");for(let[i,s]of[["--server-url <url>","Override the server URL included in the client."],["--format <json\\|ndjson>","Output format."],["--dry-run","Print the prepared request, credentials redacted, without sending it."],["--page-all","Follow pagination, printing one JSON page per line."],["--output <path>","Write the response body to a file. Required for binary responses."],...o?[["--token <token>","Bearer token, overriding the environment."]]:[],["--json <json\\|@file\\|@->","Request body, inline or from a file or stdin."]])n.line(`| \`${i}\` | ${s} |`);n.blank();let t=p(e.name);if(n.line("## Credentials"),n.blank(),e.schemes.length===0)n.line("The description declares no security schemes, so no credentials are read.");else{n.line("Credentials come from the environment:"),n.blank(),n.line("| Scheme | Variable |"),n.line("| ------ | -------- |");for(let i of e.schemes){let s=i.kind==="bearer"?`\`${t}_TOKEN\` (or \`--token\`)`:i.kind==="basic"?`\`${t}_USERNAME\` and \`${t}_PASSWORD\``:`\`${t}_API_KEY_${p(i.key)}\``;n.line(`| ${i.kind} (\`${i.key}\`) | ${s} |`)}}n.blank(),n.line("## Exit codes"),n.blank(),n.line("| Code | Meaning |"),n.line("| ---- | ------- |");for(let[i,s]of[[0,"success"],[1,"API error (status other than 401 or 403)"],[2,"auth error (401 or 403)"],[3,"validation error"],[4,"usage error (unknown command or flag, bad `--json`)"]])n.line(`| ${i} | ${s} |`);n.blank(),n.line("Errors print one JSON object to stderr, so stdout stays clean for piping."),n.blank();let a=[...new Set(r.map(i=>i.group))];for(let i of a){let s=r.filter(l=>l.group===i);i===void 0?(n.line("## Commands"),n.blank()):(n.line(`## ${i}`),n.blank(),n.line(`Addressed as \`${e.name} ${u(i)} <command>\`.`),n.blank());for(let l of s)D(n,l,e)}return n.toString().replace(/\n{3,}/g,`
7
+ import{h as g}from"./MRVYTOFX.js";import{e as C,l as u,m as p}from"./NV7DJMMF.js";import{c as j,d as v}from"./MU74CSJJ.js";import{X as b}from"./ZOVYQ36P.js";import{a as S,b as k}from"./UW4UC7ZI.js";import{join as $}from"node:path";function h(r){return(r??"").replace(/\s+/g," ").trim().replace(/\\/g,"\\\\").replace(/\|/g,"\\|")}function w(r){return[r.group===void 0?void 0:u(r.group),r.name].filter(Boolean).join(" ")}function T(r,e){return[r,w(e),...e.positionals.map(o=>`<${o.name}>`),...e.flags.filter(o=>o.required).map(o=>`--${o.name} <${o.type}>`),...e.body?[e.body.required?"--json '<json>'":"[--json '<json>']"]:[]].filter(o=>o!=="").join(" ")}function B(r,e){r.line("| Flag | Type | Required | Description |"),r.line("| ---- | ---- | -------- | ----------- |");for(let n of e){let o=[h(n.description),n.enum===void 0?"":`One of ${n.enum.map(t=>`\`${t}\``).join(", ")}.`,n.type==="array"?"Repeat the flag for multiple values.":""].filter(t=>t!=="").join(" ");r.line(`| \`--${n.name}\` | ${n.type} | ${n.required?"yes":"no"} | ${o} |`)}r.blank()}function D(r,e,n){if(r.line(`### \`${w(e)}\``),r.blank(),e.summary!==void 0&&(r.line(h(e.summary)),r.blank()),r.line(`\`${e.method} ${e.path}\``),r.blank(),r.line("```sh"),r.line(T(n.name,e)),r.line("```"),r.blank(),e.positionals.length>0){r.line("| Argument | Description |"),r.line("| -------- | ----------- |");for(let t of e.positionals)r.line(`| \`<${t.name}>\` | ${h(t.description)} |`);r.blank()}e.flags.length>0&&B(r,e.flags);let o=[e.body===void 0?"":`Takes a JSON body${e.body.required?" (required)":""}: \`--json '<json>'\`, \`--json @file.json\`, or \`--json @-\` for stdin.`,e.unsupportedBody===void 0?"":`Takes a \`${e.unsupportedBody}\` body, which the CLI cannot build \u2014 call this operation through the generated client instead.`,e.paginated===!0?"Paginated: `--page-all` follows every page, printing one JSON page per line.":"",e.sse===!0?"Streams server-sent events as one JSON object per line.":"",e.blob===!0?"Returns binary content, so `--output <path>` is required.":""].filter(t=>t!=="");for(let t of o)r.line(t);o.length>0&&r.blank()}function R(r,e){let n=new S;e.frontmatter&&(n.line("---"),n.line(`title: ${e.title}`),n.line("---"),n.blank()),n.line(`# ${e.title}`),n.blank(),n.line(`Generated command-line reference for \`${e.name}\`, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line("## Usage"),n.blank(),n.line("```sh"),n.line(`${e.name} <command> [flags]`),n.line(`${e.name} --help`),n.line(`${e.name} schema <command> # request/response schemas`),n.line("```"),n.blank(),n.line("Install the file under any `bin` name: the command takes that name, and the credential variables below do not change."),n.blank(),n.line("## Global flags"),n.blank(),n.line("| Flag | Description |"),n.line("| ---- | ----------- |");let o=e.schemes.some(i=>i.kind==="bearer");for(let[i,s]of[["--server-url <url>","Override the server URL included in the client."],["--format <json\\|ndjson>","Output format."],["--dry-run","Print the prepared request, credentials redacted, without sending it."],["--page-all","Follow pagination, printing one JSON page per line."],["--output <path>","Write the response body to a file. Required for binary responses."],...o?[["--token <token>","Bearer token, overriding the environment."]]:[],["--json <json\\|@file\\|@->","Request body, inline or from a file or stdin."]])n.line(`| \`${i}\` | ${s} |`);n.blank();let t=p(e.name);if(n.line("## Credentials"),n.blank(),e.schemes.length===0)n.line("The description declares no security schemes, so no credentials are read.");else{n.line("Credentials come from the environment:"),n.blank(),n.line("| Scheme | Variable |"),n.line("| ------ | -------- |");for(let i of e.schemes){let s=i.kind==="bearer"?`\`${t}_TOKEN\` (or \`--token\`)`:i.kind==="basic"?`\`${t}_USERNAME\` and \`${t}_PASSWORD\``:`\`${t}_API_KEY_${p(i.key)}\``;n.line(`| ${i.kind} (\`${i.key}\`) | ${s} |`)}}n.blank(),n.line("## Exit codes"),n.blank(),n.line("| Code | Meaning |"),n.line("| ---- | ------- |");for(let[i,s]of[[0,"success"],[1,"API error (status other than 401 or 403)"],[2,"auth error (401 or 403)"],[3,"validation error"],[4,"usage error (unknown command or flag, bad `--json`)"]])n.line(`| ${i} | ${s} |`);n.blank(),n.line("Errors print one JSON object to stderr, so stdout stays clean for piping."),n.blank();let a=[...new Set(r.map(i=>i.group))];for(let i of a){let s=r.filter(l=>l.group===i);i===void 0?(n.line("## Commands"),n.blank()):(n.line(`## ${i}`),n.blank(),n.line(`Addressed as \`${e.name} ${u(i)} <command>\`.`),n.blank());for(let l of s)D(n,l,e)}return n.toString().replace(/\n{3,}/g,`
8
8
 
9
9
  `).trimEnd()+`
10
10
  `}function x(){return v["cli.ts"]}function E(){return j["cli.ts"]}var q="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function P(r){return k.snake(r).replace(/_/g,"-")}function O(r){let e=r.schema,n=e.kind==="array"?"array":e.kind==="scalar"&&(e.scalar==="integer"||e.scalar==="number")?"number":e.kind==="scalar"&&e.scalar==="boolean"?"boolean":"string";return{name:P(r.name),param:r.name,type:n,required:r.required,...e.kind==="enum"?{enum:e.values.map(String)}:{},...r.description!==void 0?{description:r.description}:{}}}function F(r){let e=r.successResponses;return e.some(n=>n.contentType.toLowerCase().includes("json"))?!1:e.some(n=>C(n.contentType))}function M(r){return r.successResponses.find(e=>e.contentType.toLowerCase().includes("json"))?.schema}function U(r,e,n){if(n!=="flat")return{};let o=g(r,e.schemas);return"mergeBody"in o&&o.mergeBody?{merged:!0}:{}}function _(r,e,n){return n!=="flat"?{}:"collisions"in g(r,e.schemas)?{argsStyle:"grouped"}:{}}function f(r,e){let n=[];for(let o of r.services)for(let t of o.operations){let a=t.requestBody?.contentType.toLowerCase().includes("json")?t.requestBody:void 0,i=M(t);n.push({...t.tags.length>0?{group:t.tags[0]}:{},name:t.name,...t.summary!==void 0?{summary:t.summary}:{},method:t.method.toUpperCase(),path:t.path,positionals:t.pathParams.map(s=>({name:s.name,type:O(s).type,...s.description!==void 0?{description:s.description}:{}})),flags:t.queryParams.map(O),...a?{body:{required:a.required,...U(t,r,e.argsStyle)}}:{},...a===void 0&&t.requestBody!==void 0?{unsupportedBody:t.requestBody.contentType}:{},...e.pagination?.has(t.name)===!0?{paginated:!0}:{},..._(t,r,e.argsStyle),...t.sse!==void 0?{sse:!0}:{},...F(t)?{blob:!0}:{},...a!==void 0||i!==void 0?{schemas:{...a?{request:a.schema}:{},...i!==void 0?{response:i}:{}}}:{}})}return n}var A=`function isProcessEntry(): boolean {
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as O}from"./2U6O26CV.js";import{b as j,c as N,d as J,f as V,g as Q,h as Z,i as Y}from"./VM6OOWSF.js";import{a as H}from"./WZXA5XPB.js";import{a as F,b as T,c as C,d as P,e as W,g as B,h as M,i as _,j as A,k as z,l as U,n as K}from"./UW4UC7ZI.js";var G=C.go,S=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return P(t,{style:"camel",reserved:G})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let s=d(o),a=s;for(let i=2;r.has(a);i++)a=`${s}${i}`;return r.add(a),a})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
7
+ import{a as O}from"./2U6O26CV.js";import{b as j,c as N,d as J,f as V,g as Q,h as Z,i as Y}from"./NV7DJMMF.js";import{a as H}from"./WZXA5XPB.js";import{a as F,b as T,c as C,d as P,e as W,g as B,h as M,i as _,j as A,k as z,l as U,n as K}from"./UW4UC7ZI.js";var G=C.go,S=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return P(t,{style:"camel",reserved:G})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let s=d(o),a=s;for(let i=2;r.has(a);i++)a=`${s}${i}`;return r.add(a),a})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
8
8
  `?n+="\\n":r==="\r"?n+="\\r":r===" "?n+="\\t":o<32||o===127?n+=`\\x${o.toString(16).padStart(2,"0")}`:o>=55296&&o<=57343?n+="\\uFFFD":n+=r}return n+'"'}literal(t){return t==null?"nil":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?this.string(t):Array.isArray(t)?`[]any{${t.map(r=>this.literal(r)).join(", ")}}`:`map[string]any{${Object.entries(t).map(([r,o])=>`${this.string(r)}: ${this.literal(o)}`).join(", ")}}`}comment(t){for(let n of U(t))this.line(n===""?"//":`// ${n}`);return this}doc(t,n){let r=U(n);if(r.length===0)return this;this.line(`// ${t} \u2014 ${r[0]}`);let o=!1;for(let s of r.slice(1)){if(s===""){o||this.line("//"),o=!0;continue}this.line(`// ${s}`),o=!1}return this}layout(t){return ie(le(t))}toString(){return this.layout(super.toString())}};function d(e){let t=P(e,{style:"pascal",reserved:G});return t.startsWith("_")?`N${t.slice(1)}`:t}function ie(e){return`${e.replace(/\n{3,}/g,`
9
9
 
10
10
  `).trimEnd()}
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
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"./5KSMVZSO.js";import{I as X,L as Je,M as Z,N as g,O,P as ee,Q as $,R as C,T as S,V as y,X as w,Y as te,Z as ne,_ as re,aa as se,c as l,fa as ie,q as Y,v as Q,y as We}from"./UVKEIQXW.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=>Z(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(`
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"./7QLACFLT.js";import{I as X,L as Je,M as Z,N as g,O,P as ee,Q as $,R as C,T as S,V as y,X as w,Y as te,Z as ne,_ as re,aa as se,c as l,fa as ie,q as Y,v as Q,y as We}from"./ZOVYQ36P.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=>Z(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
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
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
10
  `)}
@@ -0,0 +1,14 @@
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{d as D}from"./MGBZEDQJ.js";import{I as C,J as j,X as $,Z as k,_ as M,aa as S,ca as b,q as F,t as R,v as x}from"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{relative as I,resolve as U}from"node:path";var A=20;async function B({argv:o,config:t,collectSpecData:r}){let[{path:s}]=await D([o.api],t),n=new C(t.resolve),e=await n.resolveDocument(null,s,!0);r?.(e);let i=k(e.parsed),d=F(t.extendTypes(x(i),i),t),p=new Map,u=({source:l,pointer:c},f,N)=>{let v=`${l.absoluteRef}${c}`,y=p.get(v);if(!y){p.set(v,{absoluteRef:l.absoluteRef,pointer:c,types:[f],resolvesTo:N});return}y.types.includes(f)||y.types.push(f),y.resolvesTo||(y.resolvesTo=N)},m={any:{enter(l,{location:c,type:f}){u(c,f.name)}},ref(l,{location:c,type:f},N){u(c,f.name,N.location)}},h={problems:[],specVersion:i,config:t,visitorsData:{}},a=await j({rootDocument:e,rootType:d.Root,externalRefResolver:n});if(S({document:e,rootType:d.Root,normalizedVisitors:M([{severity:"warn",ruleId:"inspect-node-types",visitor:m}],d),resolvedRefMap:a,ctx:h}),o.pointer){let l=W(p,o.pointer,e.source.absoluteRef);o.parents?L(w(p,l,e.source.absoluteRef)):$.output(`${l.types.join(`
8
+ `)}
9
+ `);return}let g=[...p.values()];if(o.summary)V(g);else if(o.type){let l=o.type,c=g.filter(({types:f})=>f.includes(l));if(c.length===0)throw new b(`No nodes of type '${l}'. Run the command with --summary to see the types used in this description.`);o.parents?L(c.flatMap(f=>w(p,f,e.source.absoluteRef)),l):E(c)}else E(g)}function w(o,t,r,s=new Set){let n=`${t.absoluteRef}${t.pointer}`;if(s.has(n))return[[t]];s.add(n);let e=[],i=t.pointer.split("/");for(let p=1;p<i.length;p++){let u=p===1?"#/":i.slice(0,p).join("/");if(u===t.pointer)continue;let m=o.get(`${t.absoluteRef}${u}`);m&&e.push(m)}e.push(t);let d=[];e[0].absoluteRef===r&&e[0].pointer==="#/"&&d.push(e);for(let[p,u]of e.entries()){let m=[...o.values()].filter(a=>a.resolvesTo?.source.absoluteRef===u.absoluteRef&&a.resolvesTo.pointer===u.pointer),h=e.slice(p+1);for(let a of m)d.push(...w(o,a,r,s).map(g=>[...g,...h]))}return d.length?d:[e]}function L(o,t){let r=new Set(o.map(s=>s.map(({types:n})=>t&&n.includes(t)?t:n.join(", ")).join(" \u2192 ")));for(let s of r)$.output(`${s}
10
+ `)}function W(o,t,r){let[s,n]=t.split("#"),e=s?R(s)?s:U(process.cwd(),s):r,i=o.get(`${e}#${n||"/"}`);if(!i)throw new b(`No node at ${t}. ${z(o,e,`#${n||"/"}`,s)??`Check the pointer, and make sure the file is referenced from ${T(r)}.`}`);return i}function z(o,t,r,s){let n=r.split("/");for(let e=n.length-1;e>=1;e--){let i=e===1?"#/":n.slice(0,e).join("/"),d=o.get(`${t}${i}`);if(!d)continue;let p=n[e].toLowerCase(),u=e===1?"#/":`${i}/`,m=[...o.values()].filter(c=>c.absoluteRef===t&&c.pointer.startsWith(u)&&!c.pointer.slice(u.length).includes("/")),h=m.filter(c=>c.pointer.slice(u.length).toLowerCase().includes(p)),a=(h.length?h:m).map(c=>` ${s}${c.pointer}`),g=a.length-A;g>0&&(a.length=A,a.push(` \u2026and ${g} more`));let l=`The closest node is ${d.types.join(", ")} at ${s}${i}.`;return a.length?`${l} Did you mean:
11
+ ${a.join(`
12
+ `)}`:l}}function V(o){let t=new Map;for(let{types:n,resolvesTo:e}of o)if(!e)for(let i of n)t.set(i,(t.get(i)??0)+1);let r=[...t.keys()].sort(),s=Math.max(...r.map(n=>n.length))+2;for(let n of r)$.output(`${n.padEnd(s)}${t.get(n)}
13
+ `)}function T(o){return R(o)?o:I(process.cwd(),o)}function E(o){let t=Math.max(...o.map(({types:r})=>r.join(", ").length))+2;for(let{absoluteRef:r,pointer:s,types:n,resolvesTo:e}of o){let i=e?` \u2192 ${T(e.source.absoluteRef)}${e.pointer==="#/"?"":e.pointer}`:"";$.output(`${n.join(", ").padEnd(t)}${T(r)}${s}${i}
14
+ `)}}export{B as handleInspectNodeTypes};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as h}from"./MGMNYFOR.js";import{e as g,h as p,k as $}from"./LD5MEXEL.js";import{join as R}from"node:path";var a=" ";function m(e){return`${$(e)}Schema`}var y=new Map;function u(e,r=y,t=""){return j(w(e,r,t),e)}function w(e,r,t){switch(e.kind){case"scalar":return z(e.scalar,e.metadata);case"object":return b(e.properties,r,t);case"array":return`z.array(${u(e.items,r,t)})`;case"record":return`z.record(z.string(), ${u(e.value,r,t)})`;case"ref":return`z.lazy(() => ${m(e.name)})`;case"literal":return`z.literal(${p(e.value)})`;case"enum":return q(e.values);case"union":return k(e.members,r,t);case"intersection":return e.members.map(n=>u(n,r,t)).reduce((n,o)=>`${n}.and(${o})`);case"null":return"z.null()";case"unknown":return"z.unknown()";case"omit":return E(e.base,e.keys,r,t)}}function z(e,r){switch(e){case"string":return r?.format==="binary"?"z.instanceof(Blob)":"z.string()";case"integer":return"z.number().int()";case"number":return"z.number()";case"boolean":return"z.boolean()"}}function c(e){return g(e)===e?e:JSON.stringify(e)}function b(e,r,t){if(e.length===0)return"z.object({})";let n=t+a;return`z.object({
7
+ import{a as h}from"./MU74CSJJ.js";import{e as g,h as p,k as $}from"./LD5MEXEL.js";import{join as R}from"node:path";var a=" ";function m(e){return`${$(e)}Schema`}var y=new Map;function u(e,r=y,t=""){return j(w(e,r,t),e)}function w(e,r,t){switch(e.kind){case"scalar":return z(e.scalar,e.metadata);case"object":return b(e.properties,r,t);case"array":return`z.array(${u(e.items,r,t)})`;case"record":return`z.record(z.string(), ${u(e.value,r,t)})`;case"ref":return`z.lazy(() => ${m(e.name)})`;case"literal":return`z.literal(${p(e.value)})`;case"enum":return q(e.values);case"union":return k(e.members,r,t);case"intersection":return e.members.map(n=>u(n,r,t)).reduce((n,o)=>`${n}.and(${o})`);case"null":return"z.null()";case"unknown":return"z.unknown()";case"omit":return E(e.base,e.keys,r,t)}}function z(e,r){switch(e){case"string":return r?.format==="binary"?"z.instanceof(Blob)":"z.string()";case"integer":return"z.number().int()";case"number":return"z.number()";case"boolean":return"z.boolean()"}}function c(e){return g(e)===e?e:JSON.stringify(e)}function b(e,r,t){if(e.length===0)return"z.object({})";let n=t+a;return`z.object({
8
8
  ${e.map((s,i)=>{let d=u(s.schema,r,n),l=s.required?d:`${d}.optional()`,x=i===e.length-1?"":",";return`${n}${c(s.name)}: ${l}${x}`}).join(`
9
9
  `)}
10
10
  ${t}})`}function q(e){return e.every(r=>typeof r=="string")?`z.enum([${e.map(r=>JSON.stringify(r)).join(", ")}])`:`z.union([${e.map(r=>`z.literal(${p(r)})`).join(", ")}])`}function k(e,r,t){let n=e.map(o=>u(o,r,t));return n.length===1?n[0]:`z.union([${n.join(", ")}])`}function E(e,r,t,n){let o=t.get(e);if(o&&o.kind!=="object")return u(f(o,r,t,new Set([e])),t,n);let s=r.map(i=>`${c(i)}: true`).join(", ");return`${m(e)}.omit({ ${s} })`}function f(e,r,t,n){switch(e.kind){case"object":return{...e,properties:e.properties.filter(o=>!r.includes(o.name))};case"union":case"intersection":return{...e,members:e.members.map(o=>f(o,r,t,n))};case"ref":{if(n.has(e.name))return e;let o=t.get(e.name);if(!o)return e;if(o.kind==="object"){let s=r.filter(i=>o.properties.some(d=>d.name===i));return s.length>0?{kind:"omit",base:e.name,keys:s}:e}return f(o,r,t,new Set([...n,e.name]))}default:return e}}function j(e,r){let t=r.metadata;if(!t)return e;let n=e;return r.kind==="scalar"&&r.scalar==="string"&&(t.minLength!==void 0&&(n=`${n}.min(${t.minLength})`),t.maxLength!==void 0&&(n=`${n}.max(${t.maxLength})`),t.pattern!==void 0&&(n=`${n}.regex(new RegExp(${JSON.stringify(t.pattern)}))`)),r.kind==="scalar"&&(r.scalar==="number"||r.scalar==="integer")&&(t.minimum!==void 0&&(n=`${n}.min(${t.minimum})`),t.maximum!==void 0&&(n=`${n}.max(${t.maximum})`),t.exclusiveMinimum!==void 0&&(n=`${n}.gt(${t.exclusiveMinimum})`),t.exclusiveMaximum!==void 0&&(n=`${n}.lt(${t.exclusiveMaximum})`)),r.kind==="array"&&(t.minItems!==void 0&&(n=`${n}.min(${t.minItems})`),t.maxItems!==void 0&&(n=`${n}.max(${t.maxItems})`)),n}function Z(e,r){let t=[];for(let n of h(e.services)){if(n.sse!==void 0)continue;let o=n.requestBody,s=o&&o.contentType.toLowerCase().includes("json")?u(o.schema,r,a):void 0,i=n.successResponses.find(l=>l.contentType.toLowerCase().includes("json")),d=i?u(i.schema,r,a):void 0;!s&&!d||t.push({name:n.specName??n.name,request:s,response:d})}return t}function I(e){let r=e.flatMap(n=>[`${a}${c(n.name)}: {`,...n.request?[`${a}${a}request: z.ZodType;`]:[],...n.response?[`${a}${a}response: z.ZodType;`]:[],`${a}};`]),t=e.map((n,o)=>{let s=[...n.request?[`request: ${n.request}`]:[],...n.response?[`response: ${n.response}`]:[]].join(", "),i=o===e.length-1?"":",";return`${a}${c(n.name)}: { ${s} }${i}`});return["/**"," * Request/response validators by operationId \u2014 powers `zodValidation`, or import one directly."," */","export const operationSchemas: {",...r,"} = {",...t,"};"].join(`
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as R,b as u,c as f,d}from"./UQHIGGP6.js";import{d as y,e as G,f as x}from"./N2D5LLBV.js";import{c as g,d as S,e as h}from"./E2KKD73B.js";import{c as k,d as v,e as b}from"./JADJJP6R.js";import{a as D,b as E,c as q,d as z}from"./MWNK3IKD.js";import{a as o}from"./JDBGRKTP.js";import{a,b as p,c as s}from"./ISBVQBNS.js";import"./2U6O26CV.js";import{a as m}from"./N2FNYVCN.js";import{a as i}from"./JM7BMZLD.js";import{a as c}from"./LGQZK7NR.js";import"./TC3EIKUK.js";import{a as I,d as M,e as N}from"./FKC3B2RN.js";import{a as l}from"./UTZVN6YA.js";import{a as H,b as er,c as tr,d as or,e as nr,f as ar,g as pr,h as sr,i as mr,j as ir}from"./VM6OOWSF.js";import"./MGMNYFOR.js";import{a as U}from"./WZXA5XPB.js";import"./UVKEIQXW.js";import"./NEWT5A6S.js";import{e as T,h as j,k as w}from"./LD5MEXEL.js";import{a as _,b as B,c as F,d as J,e as Q,f as K,g as P,h as V,i as W,j as X,k as Y,l as Z,m as $,n as rr}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";var A={typescript:{run:a,sample:s,docs:p},zod:{run:m},transformers:{run:i},"tanstack-query":{run:o("react")},"tanstack-query-vue":{run:o("vue")},"tanstack-query-svelte":{run:o("svelte")},"tanstack-query-solid":{run:o("solid")},swr:{run:c},mock:{run:l},cli:{run:u,sample:d,docs:f},python:{run:y,sample:G,docs:x},go:{run:g,sample:S,docs:h},php:{run:k,sample:v,docs:b}},L=Object.fromEntries(Object.entries(D).map(([e,{load:r,...t}])=>[e,{...t,...A[e]}]));function n(){return new Map(Object.entries(L))}function C(e,r,t=n(),O){E(e,r,t,O)}function Dr(e,r){let t=r.registry??n();return C(r.generators,r.emit,t,r.outputMode),q(e,{...r,registry:t})}export{ir as AUTHORING_HELPER_NAMES,U as NotSupportedError,_ as Printer,F as RESERVED_WORDS,B as casing,j as codeLiteral,Dr as collectGeneratedFiles,K as deref,V as discriminatorCases,Z as docText,Y as enumValues,P as flattenAllOf,z as generateClient,rr as headerCoerceType,J as identifierFor,nr as isBinaryContentType,or as isMultipartBody,W as isNullable,er as jsonSuccessSchema,I as operationSignature,sr as paginationItemSchema,H as paginationRuleFor,w as pascalCase,R as renderComposedCliEntry,mr as renderReferencePage,T as safeIdent,$ as schemaAtPointer,pr as securityRequirements,ar as serverUrlParts,tr as sseResponse,M as tsJsdoc,N as tsType,Q as uniqueIdentifiers,X as unwrapNullable};
7
+ import{a as R,b as u,c as f,d}from"./D7OG7544.js";import{d as y,e as G,f as x}from"./2M6C5LHI.js";import{c as g,d as S,e as h}from"./DCVTFQBO.js";import{c as k,d as v,e as b}from"./OGD5QBKV.js";import{a as D,b as E,c as q,d as z}from"./5TJ3WQMW.js";import{a as o}from"./SRIYNICE.js";import{a,b as p,c as s}from"./ZCIVIBWW.js";import"./2U6O26CV.js";import{a as m}from"./E5XZY3Q2.js";import{a as i}from"./JM7BMZLD.js";import{a as c}from"./2KLHD2U7.js";import"./PJRRECUU.js";import{a as I,d as M,e as N}from"./MRVYTOFX.js";import{a as l}from"./IRZBI5PN.js";import{a as H,b as er,c as tr,d as or,e as nr,f as ar,g as pr,h as sr,i as mr,j as ir}from"./NV7DJMMF.js";import"./MU74CSJJ.js";import{a as U}from"./WZXA5XPB.js";import"./ZOVYQ36P.js";import"./NEWT5A6S.js";import{e as T,h as j,k as w}from"./LD5MEXEL.js";import{a as _,b as B,c as F,d as J,e as Q,f as K,g as P,h as V,i as W,j as X,k as Y,l as Z,m as $,n as rr}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";var A={typescript:{run:a,sample:s,docs:p},zod:{run:m},transformers:{run:i},"tanstack-query":{run:o("react")},"tanstack-query-vue":{run:o("vue")},"tanstack-query-svelte":{run:o("svelte")},"tanstack-query-solid":{run:o("solid")},swr:{run:c},mock:{run:l},cli:{run:u,sample:d,docs:f},python:{run:y,sample:G,docs:x},go:{run:g,sample:S,docs:h},php:{run:k,sample:v,docs:b}},L=Object.fromEntries(Object.entries(D).map(([e,{load:r,...t}])=>[e,{...t,...A[e]}]));function n(){return new Map(Object.entries(L))}function C(e,r,t=n(),O){E(e,r,t,O)}function Dr(e,r){let t=r.registry??n();return C(r.generators,r.emit,t,r.outputMode),q(e,{...r,registry:t})}export{ir as AUTHORING_HELPER_NAMES,U as NotSupportedError,_ as Printer,F as RESERVED_WORDS,B as casing,j as codeLiteral,Dr as collectGeneratedFiles,K as deref,V as discriminatorCases,Z as docText,Y as enumValues,P as flattenAllOf,z as generateClient,rr as headerCoerceType,J as identifierFor,nr as isBinaryContentType,or as isMultipartBody,W as isNullable,er as jsonSuccessSchema,I as operationSignature,sr as paginationItemSchema,H as paginationRuleFor,w as pascalCase,R as renderComposedCliEntry,mr as renderReferencePage,T as safeIdent,$ as schemaAtPointer,pr as securityRequirements,ar as serverUrlParts,tr as sseResponse,M as tsJsdoc,N as tsType,Q as uniqueIdentifiers,X as unwrapNullable};
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
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"./5KSMVZSO.js";import{c as g}from"./UVKEIQXW.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(`
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"./7QLACFLT.js";import{c as g}from"./ZOVYQ36P.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
8
  `),i=(t===-1?o:o.slice(0,t)).split(`
9
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};
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as oe}from"./LRUXN6H5.js";import{ca as d,ha as W,j,l as U,o as B,oa as b,p as M}from"./UVKEIQXW.js";import{e as se}from"./RFWIIJFG.js";var S=se(oe(),1);function H(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function q(o){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Y=async(o,{timeout:t,...e}={})=>{let r=H(),s=r&&!q(o),n,i=t?{connect:{timeout:t}}:{};return s?n=new S.ProxyAgent({uri:r,...i}):t&&(n=new S.Agent(i)),await fetch(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})};var ie=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function V(){let o=process.env.REDOCLY_ENVIRONMENT?.trim();return o&&ie.test(o)?o:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},v=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=V(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let n=await Y(t,{...e,headers:s});return this.collectSunsetWarning(n),n}catch(n){let i="Failed to fetch.";throw n.cause&&(i+=` Caused by ${n.cause.message||n.cause.name}.`),(n.code||n.cause?.code)&&(i+=` Code: ${n.code||n.cause?.code}`),new Error(i)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},N=class{client;domain;apiKey;constructor(t,e,r){this.client=t,this.domain=e,this.apiKey=r}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/source`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new globalThis.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await ae(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true"),r.replace&&n.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:n});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},p=class{apiClient;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new v(r,s),this.remotes=new N(this.apiClient,t,e)}getSunsetWarning(){return z(this.apiClient.sunsetWarnings)}};function z(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function ae(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function ce(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var x={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ue(){return process.env.REDOCLY_DOMAIN||x.us}var K=le((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return he(e)?x[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:x.us}catch{throw new C}});function I(o){try{K(void 0,o)}catch{return!1}return!0}function le(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://"))throw new C;return e}}var C=class extends Error{constructor(){super("Invalid Reunite URL")}};function he(o){return typeof o=="string"&&o in x}import{Buffer as D}from"node:buffer";import _ from"node:crypto";import{mkdirSync as de,existsSync as X,writeFileSync as pe,readFileSync as me,rmSync as fe}from"node:fs";import{homedir as ge}from"node:os";import J from"node:path";import*as G from"node:child_process";var m=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new v("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];G.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var we="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",Z="aes-256-cbc",O=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=ge();this.credentialsFolderPath=J.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=J.join(this.credentialsFolderPath,this.credentialsFileName),this.key=_.createHash("sha256").update(`${this.credentialsFolderPath}${we}`).digest(),this.iv=_.createHash("md5").update(this.credentialsFolderPath).digest(),de(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new m(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new m(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new m(t,this.version),r=await this.readCredentials();if(!r||!I(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);pe(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!X(this.credentialsFilePath))return null;try{let t=me(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){X(this.credentialsFilePath)&&fe(this.credentialsFilePath)}encryptCredentials(t){let e=_.createCipheriv(Z,this.key,this.iv);return D.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=_.createDecipheriv(Z,this.key,this.iv),r=D.concat([e.update(D.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};import*as f from"node:fs";import*as h from"node:path";async function ye({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,replace:P,onUploadStart:E,onSunsetWarning:g}){let w=new p({domain:o,apiKey:t,command:"push",version:c});try{let y=await w.remotes.getDefaultBranch(e,r),T=await w.remotes.upsert(e,r,{mountBranchName:y,mountPath:s});E?.(T);let{id:l}=await w.remotes.push(e,r,{remoteId:T.id,commit:a,isMainBranch:i===a.branchName,replace:P},n.map(F=>({path:B(F.name),stream:f.createReadStream(F.path)})));return{pushId:l}}finally{let y=w.getSunsetWarning();y&&g?.(y)}}function ve(o,t){let e={};for(let s of o)if(f.statSync(s).isDirectory()){let n=s;Q(n,[]).forEach(a=>r(a,n))}else r(s,h.dirname(s));function r(s,n){let i=h.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:h.resolve(n)}))}function Q(o,t){let e=f.readdirSync(o);for(let r of e){let s=h.join(o,r);f.statSync(s).isDirectory()?t=Q(s,t):t.push(s)}return t}async function ee({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await j(n),i()}return i()}var Te=1200,xe=5e3,Ce=["pending","running"];async function Pe(o){let t=te(o);try{return await ne(t,o)}finally{re(t,o)}}async function Ee({buildType:o,maxExecutionTime:t=Te,retryIntervalMs:e=xe,startTime:r=Date.now(),onRetry:s,...n}){let i=te(n);try{return await ee({operation:()=>ne(i,n),condition:a=>!Ce.includes(a.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{re(i,n)}}function te({domain:o,apiKey:t,version:e}){return new p({domain:o,apiKey:t,command:"push-status",version:e})}function re(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function ne(o,{organization:t,project:e,pushId:r}){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Re({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=Se(o);if(!s)throw new d(`Invalid project URL format: ${o}`);try{let n=await _e({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Fe(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new d(n instanceof Error?n.message:String(n))}}function Se(o){let t=new URL(o),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function _e({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:$e(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return n?.("Successfully received project configuration."),a.json()}async function Fe(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function $e(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function k(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await W({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function L(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Ue(s,n,t)))return e}}function Ue(o,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return M(t).test(e[o])}catch{throw new d(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Ae}from"node:url";async function Ne(o,t){if(!o)return[];let e=Ae(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ie=".redocly.com";function De(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ie)}catch{return!1}}async function Oe({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let P=[],E=new Map,g=r.levels||[];if(i&&!g.some(l=>l.name===i))throw new d(`Target level "${i}" not found in the scorecard configuration levels.
7
+ import{a as oe}from"./LRUXN6H5.js";import{ca as d,ha as W,j,l as U,o as B,oa as b,p as M}from"./ZOVYQ36P.js";import{e as se}from"./RFWIIJFG.js";var S=se(oe(),1);function H(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function q(o){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Y=async(o,{timeout:t,...e}={})=>{let r=H(),s=r&&!q(o),n,i=t?{connect:{timeout:t}}:{};return s?n=new S.ProxyAgent({uri:r,...i}):t&&(n=new S.Agent(i)),await fetch(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})};var ie=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function V(){let o=process.env.REDOCLY_ENVIRONMENT?.trim();return o&&ie.test(o)?o:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},v=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=V(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let n=await Y(t,{...e,headers:s});return this.collectSunsetWarning(n),n}catch(n){let i="Failed to fetch.";throw n.cause&&(i+=` Caused by ${n.cause.message||n.cause.name}.`),(n.code||n.cause?.code)&&(i+=` Code: ${n.code||n.cause?.code}`),new Error(i)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},N=class{client;domain;apiKey;constructor(t,e,r){this.client=t,this.domain=e,this.apiKey=r}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/source`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new globalThis.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await ae(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true"),r.replace&&n.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:n});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},p=class{apiClient;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new v(r,s),this.remotes=new N(this.apiClient,t,e)}getSunsetWarning(){return z(this.apiClient.sunsetWarnings)}};function z(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function ae(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function ce(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var x={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ue(){return process.env.REDOCLY_DOMAIN||x.us}var K=le((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return he(e)?x[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:x.us}catch{throw new C}});function I(o){try{K(void 0,o)}catch{return!1}return!0}function le(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://"))throw new C;return e}}var C=class extends Error{constructor(){super("Invalid Reunite URL")}};function he(o){return typeof o=="string"&&o in x}import{Buffer as D}from"node:buffer";import _ from"node:crypto";import{mkdirSync as de,existsSync as X,writeFileSync as pe,readFileSync as me,rmSync as fe}from"node:fs";import{homedir as ge}from"node:os";import J from"node:path";import*as G from"node:child_process";var m=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new v("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];G.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var we="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",Z="aes-256-cbc",O=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=ge();this.credentialsFolderPath=J.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=J.join(this.credentialsFolderPath,this.credentialsFileName),this.key=_.createHash("sha256").update(`${this.credentialsFolderPath}${we}`).digest(),this.iv=_.createHash("md5").update(this.credentialsFolderPath).digest(),de(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new m(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new m(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new m(t,this.version),r=await this.readCredentials();if(!r||!I(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);pe(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!X(this.credentialsFilePath))return null;try{let t=me(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){X(this.credentialsFilePath)&&fe(this.credentialsFilePath)}encryptCredentials(t){let e=_.createCipheriv(Z,this.key,this.iv);return D.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=_.createDecipheriv(Z,this.key,this.iv),r=D.concat([e.update(D.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};import*as f from"node:fs";import*as h from"node:path";async function ye({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,replace:P,onUploadStart:E,onSunsetWarning:g}){let w=new p({domain:o,apiKey:t,command:"push",version:c});try{let y=await w.remotes.getDefaultBranch(e,r),T=await w.remotes.upsert(e,r,{mountBranchName:y,mountPath:s});E?.(T);let{id:l}=await w.remotes.push(e,r,{remoteId:T.id,commit:a,isMainBranch:i===a.branchName,replace:P},n.map(F=>({path:B(F.name),stream:f.createReadStream(F.path)})));return{pushId:l}}finally{let y=w.getSunsetWarning();y&&g?.(y)}}function ve(o,t){let e={};for(let s of o)if(f.statSync(s).isDirectory()){let n=s;Q(n,[]).forEach(a=>r(a,n))}else r(s,h.dirname(s));function r(s,n){let i=h.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:h.resolve(n)}))}function Q(o,t){let e=f.readdirSync(o);for(let r of e){let s=h.join(o,r);f.statSync(s).isDirectory()?t=Q(s,t):t.push(s)}return t}async function ee({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await j(n),i()}return i()}var Te=1200,xe=5e3,Ce=["pending","running"];async function Pe(o){let t=te(o);try{return await ne(t,o)}finally{re(t,o)}}async function Ee({buildType:o,maxExecutionTime:t=Te,retryIntervalMs:e=xe,startTime:r=Date.now(),onRetry:s,...n}){let i=te(n);try{return await ee({operation:()=>ne(i,n),condition:a=>!Ce.includes(a.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{re(i,n)}}function te({domain:o,apiKey:t,version:e}){return new p({domain:o,apiKey:t,command:"push-status",version:e})}function re(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function ne(o,{organization:t,project:e,pushId:r}){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Re({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=Se(o);if(!s)throw new d(`Invalid project URL format: ${o}`);try{let n=await _e({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Fe(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new d(n instanceof Error?n.message:String(n))}}function Se(o){let t=new URL(o),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function _e({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:$e(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return n?.("Successfully received project configuration."),a.json()}async function Fe(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function $e(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function k(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await W({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function L(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Ue(s,n,t)))return e}}function Ue(o,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return M(t).test(e[o])}catch{throw new d(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Ae}from"node:url";async function Ne(o,t){if(!o)return[];let e=Ae(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ie=".redocly.com";function De(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ie)}catch{return!1}}async function Oe({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let P=[],E=new Map,g=r.levels||[];if(i&&!g.some(l=>l.name===i))throw new d(`Target level "${i}" not found in the scorecard configuration levels.
8
8
  `);let w=L(r.targets,a)?.rules,y=await k(o,w,g,n,s||"");for(let l of g){c?.(`
9
9
  Validating level: "${l.name}"`),n.length>0&&c?.(`Using ${n.length} ${U("plugin",n.length)} for this level.`),c?.("Linting document against level rules...");let R=(await b({document:t,externalRefResolver:e,config:y[l.name]})).filter(({ignored:$})=>!$).map($=>({...$,scorecardLevel:l.name}));c?.(`Found ${R.length} ${U("problem",R.length)} for level "${l.name}".`),E.set(l.name,R),P.push(...R)}let T=ke(E,g,i);return{problems:P,achievedLevel:T,targetLevelAchieved:i?T===i:!0}}function ke(o,t,e){let r=null;for(let s of t){if((o.get(s.name)||[]).some(a=>a.severity==="error"))return r||"Non Conformant";if(r=s.name,e&&s.name===e)return s.name}return r||"Non Conformant"}export{u as a,v as b,p as c,z as d,ce as e,x as f,ue as g,K as h,I as i,C as j,m as k,O as l,ye as m,ve as n,Pe as o,Ee as p,Re as q,k as r,L as s,Ne as t,De as u,Oe as v};
@@ -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{a as d,c as _}from"./RFWIIJFG.js";var m=_((U,b)=>{b.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var P=_((S,u)=>{var g=d("fs"),h=d("path"),V=d("os"),w=d("crypto"),O=m(),E=O.version,T=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function I(e){let r={},n=e.toString();n=n.replace(/\r\n?/mg,`
8
+ `);let a;for(;(a=T.exec(n))!=null;){let o=a[1],t=a[2]||"";t=t.trim();let s=t[0];t=t.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(t=t.replace(/\\n/g,`
9
+ `),t=t.replace(/\\r/g,"\r")),r[o]=t}return r}function x(e){let r=N(e),n=i.configDotenv({path:r});if(!n.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw s.code="MISSING_DATA",s}let a=D(e).split(","),o=a.length,t;for(let s=0;s<o;s++)try{let c=a[s].trim(),l=Y(n,c);t=i.decrypt(l.ciphertext,l.key);break}catch(c){if(s+1>=o)throw c}return i.parse(t)}function A(e){console.log(`[dotenv@${E}][INFO] ${e}`)}function k(e){console.log(`[dotenv@${E}][WARN] ${e}`)}function v(e){console.log(`[dotenv@${E}][DEBUG] ${e}`)}function D(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Y(e,r){let n;try{n=new URL(r)}catch(c){if(c.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw c}let a=n.password;if(!a){let c=new Error("INVALID_DOTENV_KEY: Missing key part");throw c.code="INVALID_DOTENV_KEY",c}let o=n.searchParams.get("environment");if(!o){let c=new Error("INVALID_DOTENV_KEY: Missing environment part");throw c.code="INVALID_DOTENV_KEY",c}let t=`DOTENV_VAULT_${o.toUpperCase()}`,s=e.parsed[t];if(!s){let c=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${t} in your .env.vault file.`);throw c.code="NOT_FOUND_DOTENV_ENVIRONMENT",c}return{ciphertext:s,key:a}}function N(e){let r=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let n of e.path)g.existsSync(n)&&(r=n.endsWith(".vault")?n:`${n}.vault`);else r=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else r=h.resolve(process.cwd(),".env.vault");return g.existsSync(r)?r:null}function y(e){return e[0]==="~"?h.join(V.homedir(),e.slice(1)):e}function $(e){A("Loading env from encrypted .env.vault");let r=i._parseVault(e),n=process.env;return e&&e.processEnv!=null&&(n=e.processEnv),i.populate(n,r,e),{parsed:r}}function j(e){let r=h.resolve(process.cwd(),".env"),n="utf8",a=!!(e&&e.debug);e&&e.encoding?n=e.encoding:a&&v("No encoding is specified. UTF-8 is used by default");let o=[r];if(e&&e.path)if(!Array.isArray(e.path))o=[y(e.path)];else{o=[];for(let l of e.path)o.push(y(l))}let t,s={};for(let l of o)try{let f=i.parse(g.readFileSync(l,{encoding:n}));i.populate(s,f,e)}catch(f){a&&v(`Failed to load ${l} ${f.message}`),t=f}let c=process.env;return e&&e.processEnv!=null&&(c=e.processEnv),i.populate(c,s,e),t?{parsed:s,error:t}:{parsed:s}}function L(e){if(D(e).length===0)return i.configDotenv(e);let r=N(e);return r?i._configVault(e):(k(`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`),i.configDotenv(e))}function R(e,r){let n=Buffer.from(r.slice(-64),"hex"),a=Buffer.from(e,"base64"),o=a.subarray(0,12),t=a.subarray(-16);a=a.subarray(12,-16);try{let s=w.createDecipheriv("aes-256-gcm",n,o);return s.setAuthTag(t),`${s.update(a)}${s.final()}`}catch(s){let c=s instanceof RangeError,l=s.message==="Invalid key length",f=s.message==="Unsupported state or unable to authenticate data";if(c||l){let p=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw p.code="INVALID_DOTENV_KEY",p}else if(f){let p=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw p.code="DECRYPTION_FAILED",p}else throw s}}function K(e,r,n={}){let a=!!(n&&n.debug),o=!!(n&&n.override);if(typeof r!="object"){let t=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw t.code="OBJECT_REQUIRED",t}for(let t of Object.keys(r))Object.prototype.hasOwnProperty.call(e,t)?(o===!0&&(e[t]=r[t]),a&&v(o===!0?`"${t}" is already defined and WAS overwritten`:`"${t}" is already defined and was NOT overwritten`)):e[t]=r[t]}var i={configDotenv:j,_configVault:$,_parseVault:x,config:L,decrypt:R,parse:I,populate:K};u.exports.configDotenv=i.configDotenv;u.exports._configVault=i._configVault;u.exports._parseVault=i._parseVault;u.exports.config=i.config;u.exports.decrypt=i.decrypt;u.exports.parse=i.parse;u.exports.populate=i.populate;u.exports=i});function B(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function C(e){let r=process.env.NO_PROXY||process.env.no_proxy;if(!r)return!1;let n=r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!1;let a;try{a=new URL(e).hostname.toLowerCase()}catch{return!1}return n.some(o=>!!(o==="*"||a===o||o.startsWith(".")&&a.endsWith(o)||!o.startsWith(".")&&a.endsWith("."+o)))}export{P as a,B as b,C as c};
@@ -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*as e from"node:process";var a=n=>n.replace(/[^a-zA-Z0-9 ._\-:\\/@]/g,""),o=n=>n.replace(/[^a-zA-Z0-9@._-]/g,"");function c(){let n=e.platform==="win32";return{npxExecutableName:n?"npx.cmd":"npx",sanitize:(t,r)=>n&&t?r(t):t||"",shell:n}}export{a,o as b,c};
@@ -0,0 +1,20 @@
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{d as k,h as v}from"./MGBZEDQJ.js";import{A as S,B as y,I as f,J as w,S as d,W as l,X as n,Z as x,_ as h,aa as O,ca as g,fa as b,q as u,v as p,z as A}from"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as F}from"perf_hooks";function I(o){let t=Object.fromEntries(Object.entries(o).map(([s,{metric:e,total:r,counts:a}])=>[s,{metric:e,total:r,counts:a}]));n.output(JSON.stringify(t,null,2))}function P(o){let t=`| Feature | Count |
8
+ | --- | --- |
9
+ `,s=[];for(let{metric:e,total:r,counts:a}of Object.values(o)){t+=`| ${e} | ${r} |
10
+ `;let c=Object.entries(a??{});c.length&&s.push(`
11
+ #### ${e}
12
+ | Extension | Count |
13
+ | --- | --- |
14
+ `+c.map(([m,i])=>`| ${m} | ${i} |`).join(`
15
+ `)+`
16
+ `)}n.output(t+s.join(""))}function E(o){for(let{metric:t,total:s,color:e,counts:r}of Object.values(o)){let a=l[e];n.output(a(`${t}: ${s}
17
+ `));for(let[c,m]of Object.entries(r??{}))n.output(a(` - ${c}: ${m}
18
+ `))}}function j(o,t,s,e){switch(n.info(`Document: ${d(t)} stats:
19
+
20
+ `),e){case"stylish":E(o);break;case"json":I(o);break;case"markdown":P(o);break}v("stats",s,t)}function V(o){let t={refs:{metric:"\u{1F697} References",total:0,color:"red",items:new Set},externalDocs:{metric:"\u{1F4E6} External Documents",total:0,color:"magenta"},schemas:{metric:"\u{1F4C8} Schemas",total:0,color:"white"},parameters:{metric:"\u{1F449} Parameters",total:0,color:"yellow",items:new Set},links:{metric:"\u{1F517} Links",total:0,color:"cyan",items:new Set},pathItems:{metric:"\u{1F500} Path Items",total:0,color:"green"},webhooks:{metric:"\u{1F3A3} Webhooks",total:0,color:"green"},operations:{metric:"\u{1F477} Operations",total:0,color:"yellow"},tags:{metric:"\u{1F516} Tags",total:0,color:"white",items:new Set},xExtensions:{metric:"\u{1F9E9} Vendor Extensions",total:0,color:"cyan",counts:{}}},s={refs:{metric:"\u{1F697} References",total:0,color:"red",items:new Set},externalDocs:{metric:"\u{1F4E6} External Documents",total:0,color:"magenta"},schemas:{metric:"\u{1F4C8} Schemas",total:0,color:"white"},parameters:{metric:"\u{1F449} Parameters",total:0,color:"yellow",items:new Set},channels:{metric:"\u{1F4E1} Channels",total:0,color:"green"},operations:{metric:"\u{1F477} Operations",total:0,color:"yellow"},tags:{metric:"\u{1F516} Tags",total:0,color:"white",items:new Set},xExtensions:{metric:"\u{1F9E9} Vendor Extensions",total:0,color:"cyan",counts:{}}},e,r;switch(o){case"async2":r=s,e=S(r);break;case"async3":r=s,e=y(r);break;case"oas2":case"oas3_0":case"oas3_1":case"oas3_2":r=t,e=A(r);break;default:throw new g(`Unsupported spec version: ${o}.`)}return{statsVisitor:e,statsAccumulator:r}}async function et({argv:o,config:t,collectSpecData:s}){let[{path:e}]=await k(o.api?[o.api]:[],t),r=new f(t.resolve),{bundle:a}=await b({config:t,ref:e});s?.(a);let c=x(a.parsed),m=u(t.extendTypes(p(c),c),t),{statsVisitor:i,statsAccumulator:$}=V(c),D=F.now(),R={problems:[],specVersion:c,config:t,visitorsData:{}},T=await w({rootDocument:a,rootType:m.Root,externalRefResolver:r}),C=h([{severity:"warn",ruleId:"stats",visitor:i}],m);O({document:a,rootType:m.Root,normalizedVisitors:C,resolvedRefMap:T,ctx:R}),j($,e,D,o.format)}export{et as handleStats};