@redocly/cli 2.71.2 → 2.72.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 (159) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES +29 -7
  3. package/lib/chunks/{EHJ3FMW6.js → 2AW4F6ZZ.js} +1 -1
  4. package/lib/chunks/{3EQNI6CT.js → 2MF3MKAD.js} +1 -1
  5. package/lib/chunks/{UYZXI3NO.js → 2X2KHSF3.js} +1 -1
  6. package/lib/chunks/{YF4FMOTE.js → 3FA5W77S.js} +1 -1
  7. package/lib/chunks/{VPTYPV6P.js → 3FVHXIZN.js} +1 -1
  8. package/lib/chunks/{P5T6BIKW.js → 3N53VPSU.js} +1 -1
  9. package/lib/chunks/{KLGUZBJO.js → 3N73A66H.js} +1 -1
  10. package/lib/chunks/{JO76DPXR.js → 3WOXO2JS.js} +1 -1
  11. package/lib/chunks/{ORWIUECT.js → 4A5R4H5W.js} +1 -1
  12. package/lib/chunks/{NXREEI2S.js → 4LTPQZBP.js} +1 -1
  13. package/lib/chunks/{L325HIGK.js → 4QC7OVHI.js} +1 -1
  14. package/lib/chunks/{FDKY4PGX.js → 542GVIYM.js} +1 -1
  15. package/lib/chunks/5JF6EUWW.js +9 -0
  16. package/lib/chunks/{6X42UQ3O.js → 5MZU5MHZ.js} +1 -1
  17. package/lib/chunks/{DZT5NLUB.js → 5UPBGRBZ.js} +1 -1
  18. package/lib/chunks/{WO6IIVA3.js → 6LZX65VY.js} +8 -8
  19. package/lib/chunks/{NEWT5A6S.js → 6RTITFQA.js} +1 -1
  20. package/lib/chunks/{IQLQH23V.js → 6Y6B2SKE.js} +1 -1
  21. package/lib/chunks/765BYRQR.js +7 -0
  22. package/lib/chunks/{2TG3DP4I.js → 7NZS5HXU.js} +1 -1
  23. package/lib/chunks/{5CR6AOLY.js → A65OW7M7.js} +3 -3
  24. package/lib/chunks/ARUYNQHA.js +7 -0
  25. package/lib/chunks/BJ6Z66KZ.js +7 -0
  26. package/lib/chunks/{T77BOGYV.js → BWGBTYNU.js} +1 -1
  27. package/lib/chunks/{DM4EUYBB.js → BZTZIEWS.js} +2 -2
  28. package/lib/chunks/{4S6LRPCX.js → CBFNHKDJ.js} +1 -1
  29. package/lib/chunks/{OFIQ2EST.js → CYCPHJNX.js} +33 -33
  30. package/lib/chunks/DSBDKSRR.js +53 -0
  31. package/lib/chunks/E2CEKR6N.js +22 -0
  32. package/lib/chunks/{HRZLSSOF.js → EMWHLZB6.js} +1 -1
  33. package/lib/chunks/{DWXDCKZ7.js → ENIFTFYK.js} +1 -1
  34. package/lib/chunks/{BIS2ZFGS.js → ETJMQLWJ.js} +1 -1
  35. package/lib/chunks/{ADACRYTN.js → EU5WR2O3.js} +1 -1
  36. package/lib/chunks/{FAFMGLT6.js → FLQQ3VRQ.js} +1 -1
  37. package/lib/chunks/{BPJTNQBC.js → FZZACVYL.js} +1 -1
  38. package/lib/chunks/{N4GCIKY4.js → G7A4OE2M.js} +1 -1
  39. package/lib/chunks/{HP7UD4BA.js → GCAL2PYM.js} +1 -1
  40. package/lib/chunks/{MJ2NI6MR.js → GGHLD27S.js} +1 -1
  41. package/lib/chunks/{U4MI7HDM.js → GMPHU6KM.js} +1 -1
  42. package/lib/chunks/{HTFKP5HH.js → GWBLS542.js} +1 -1
  43. package/lib/chunks/{U2F3JOT2.js → GXILNSWK.js} +1 -1
  44. package/lib/chunks/{5AVTCY6F.js → HM7M6465.js} +1 -1
  45. package/lib/chunks/{5HPO77VR.js → I2JZXLJ6.js} +2 -2
  46. package/lib/chunks/I3YF3GEY.js +13 -0
  47. package/lib/chunks/{YWRFPTTI.js → IIQW437Z.js} +1 -1
  48. package/lib/chunks/{4H3DPQDW.js → IM4YIUUN.js} +1 -1
  49. package/lib/chunks/{LET2MPMU.js → JDMRVD45.js} +1 -1
  50. package/lib/chunks/{XVS7B4RZ.js → KIFXQTTL.js} +1 -1
  51. package/lib/chunks/{UVKUPD4U.js → L4VSY42B.js} +1 -1
  52. package/lib/chunks/LH3ONQEX.js +17 -0
  53. package/lib/chunks/{SSEMMWPY.js → LUNR7GV4.js} +1 -1
  54. package/lib/chunks/{LY6BDOEF.js → LY5MGNMA.js} +1 -1
  55. package/lib/chunks/{XQEXWC5L.js → MAACTVYP.js} +1 -1
  56. package/lib/chunks/{GFSMOHUE.js → MTKICX4T.js} +1 -1
  57. package/lib/chunks/{ZXOX7NF2.js → NMAWU5S4.js} +1 -1
  58. package/lib/chunks/{I4TK6NG7.js → PJHQKG7X.js} +1 -1
  59. package/lib/chunks/PTBPNZRZ.js +7 -0
  60. package/lib/chunks/{CZX7WE2R.js → PUZ5QSL3.js} +1 -1
  61. package/lib/chunks/{JRVXIEVC.js → PW2XFZOB.js} +1 -1
  62. package/lib/chunks/{TH44RKLO.js → QAT3DPT3.js} +1 -1
  63. package/lib/chunks/{QXXAC25O.js → R67IVFZH.js} +1 -1
  64. package/lib/chunks/RA4FAJM3.js +59 -0
  65. package/lib/chunks/{AZ5LIJEO.js → RF5LL2UZ.js} +1 -1
  66. package/lib/chunks/{JOUEVI3E.js → RQPH22PV.js} +1 -1
  67. package/lib/chunks/S3B562IT.js +7 -0
  68. package/lib/chunks/{3FR3456Q.js → S43EG4DB.js} +1 -1
  69. package/lib/chunks/{CER2D6ZD.js → S7VIXBKD.js} +7 -7
  70. package/lib/chunks/{VJZDR6KS.js → TFPMT2XD.js} +1529 -4
  71. package/lib/chunks/{AXGFQS75.js → U56BQ2BR.js} +2 -2
  72. package/lib/chunks/{KJNBOXDI.js → UOTHMCTM.js} +3 -3
  73. package/lib/chunks/{CR5TYFBN.js → VHZJNDWE.js} +2 -2
  74. package/lib/chunks/{BOTTA3HA.js → VOYPXV3Z.js} +1 -1
  75. package/lib/chunks/{UTEOWLD5.js → VS4MTPCM.js} +1 -1
  76. package/lib/chunks/{QTSECOQB.js → WEPGHS5R.js} +2 -2
  77. package/lib/chunks/{LKNL5LEV.js → WRKMMY3F.js} +1 -1
  78. package/lib/chunks/{7JS7JGWP.js → WTJ3S4D7.js} +1 -1
  79. package/lib/chunks/X22IMAJK.js +199 -0
  80. package/lib/chunks/{W7TN2XCW.js → X3FFOCXC.js} +1 -1
  81. package/lib/chunks/{CRJEY7P3.js → XTI7EXWX.js} +1 -1
  82. package/lib/chunks/{BH4FA7AH.js → YA5KTHFN.js} +1 -1
  83. package/lib/chunks/{Z6GFQV2Y.js → YA6D5EUI.js} +1 -1
  84. package/lib/chunks/{HMYFTLS7.js → ZFET6WME.js} +1 -1
  85. package/lib/chunks/{R32HBYOH.js → ZXB5O6JQ.js} +1 -1
  86. package/lib/eject-assets/AGENTS.md +1 -1
  87. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  88. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  89. package/lib/eject-assets/generators/cli/index.ts +2 -2
  90. package/lib/eject-assets/generators/cli/render.ts +1 -1
  91. package/lib/eject-assets/generators/go/client.ts +1 -1
  92. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  93. package/lib/eject-assets/generators/go/index.ts +2 -2
  94. package/lib/eject-assets/generators/go/models.ts +1 -1
  95. package/lib/eject-assets/generators/go/naming.ts +1 -1
  96. package/lib/eject-assets/generators/go/operations.ts +1 -1
  97. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  98. package/lib/eject-assets/generators/go/types.ts +1 -1
  99. package/lib/eject-assets/generators/java/client.ts +66 -0
  100. package/lib/eject-assets/generators/java/descriptor.ts +72 -0
  101. package/lib/eject-assets/generators/java/index.ts +245 -0
  102. package/lib/eject-assets/generators/java/models.ts +362 -0
  103. package/lib/eject-assets/generators/java/naming.ts +135 -0
  104. package/lib/eject-assets/generators/java/operations.ts +300 -0
  105. package/lib/eject-assets/generators/java/pagination.ts +94 -0
  106. package/lib/eject-assets/generators/java/types.ts +103 -0
  107. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  108. package/lib/eject-assets/generators/mock/index.ts +2 -2
  109. package/lib/eject-assets/generators/mock/render.ts +1 -1
  110. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  111. package/lib/eject-assets/generators/mock/values.ts +1 -1
  112. package/lib/eject-assets/generators/php/client.ts +1 -1
  113. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  114. package/lib/eject-assets/generators/php/index.ts +2 -2
  115. package/lib/eject-assets/generators/php/models.ts +1 -1
  116. package/lib/eject-assets/generators/php/naming.ts +1 -1
  117. package/lib/eject-assets/generators/php/operations.ts +1 -1
  118. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  119. package/lib/eject-assets/generators/php/types.ts +1 -1
  120. package/lib/eject-assets/generators/python/client.ts +1 -1
  121. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  122. package/lib/eject-assets/generators/python/index.ts +2 -2
  123. package/lib/eject-assets/generators/python/models.ts +1 -1
  124. package/lib/eject-assets/generators/python/naming.ts +1 -1
  125. package/lib/eject-assets/generators/python/operations.ts +1 -1
  126. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  127. package/lib/eject-assets/generators/python/types.ts +1 -1
  128. package/lib/eject-assets/generators/swr/index.ts +2 -2
  129. package/lib/eject-assets/generators/swr/render.ts +1 -1
  130. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  131. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  132. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  133. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  134. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  135. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  136. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  137. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  138. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  139. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  140. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  141. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  142. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  143. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  144. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  145. package/lib/eject-assets/generators/zod/index.ts +2 -2
  146. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  147. package/lib/eject-assets/skills/client-generators/SKILL.md +1 -1
  148. package/lib/eject-assets/skills/java-generator/SKILL.md +161 -0
  149. package/lib/index.js +91 -90
  150. package/lib/skills/redocly-cli/SKILL.md +3 -1
  151. package/package.json +1 -1
  152. package/lib/chunks/2ZEKFWJQ.js +0 -13
  153. package/lib/chunks/3VOQMXIZ.js +0 -7
  154. package/lib/chunks/7GADNOVY.js +0 -9
  155. package/lib/chunks/FRQHCFKP.js +0 -199
  156. package/lib/chunks/J2EPFEBO.js +0 -17
  157. package/lib/chunks/JZATGVUO.js +0 -53
  158. package/lib/chunks/KNMNSDHR.js +0 -7
  159. package/lib/chunks/U5DIFWGH.js +0 -7
@@ -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{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./BH4FA7AH.js";import{$ as w,da as l,fa as n,k as x,ma as h,sa as A,ta as g,va as k}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
7
+ import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./YA5KTHFN.js";import{Aa as k,ea as w,ia as l,k as x,ka as n,ra as h,xa as A,ya as g}from"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
8
8
 
9
9
  `),f===void 0?n.info(l(`validating ${m(o)}...
10
10
  `)):n.info(l(`validating ${m(o)} using lint rules for api '${f}'...
@@ -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"./L325HIGK.js";import{f as C,m as u,n as p}from"./DM4EUYBB.js";import{a as S,b as k,q as j,r as v}from"./5CR6AOLY.js";import{fa as b}from"./FRQHCFKP.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"./4QC7OVHI.js";import{f as C,m as u,n as p}from"./BZTZIEWS.js";import{a as S,b as k,q as j,r as v}from"./A65OW7M7.js";import{ka as b}from"./X22IMAJK.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 {
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a as ee,c as te,e as ne}from"./RFWIIJFG.js";var F=te((N,k)=>{(function(e,t){typeof N=="object"&&typeof k<"u"?t(N):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.ULID={}))})(N,(function(e){"use strict";function t(r){let c=new Error(r);return c.source="ulid",c}let n="0123456789ABCDEFGHJKMNPQRSTVWXYZ",o=n.length,i=Math.pow(2,48)-1,a=10,u=16;function m(r,c,s){return c>r.length-1?r:r.substr(0,c)+s+r.substr(c+1)}function p(r){let c,s=r.length,d,l,g=o-1;for(;!c&&s-->=0;){if(d=r[s],l=n.indexOf(d),l===-1)throw t("incorrectly encoded string");if(l===g){r=m(r,s,n[0]);continue}c=m(r,s,n[l+1])}if(typeof c=="string")return c;throw t("cannot increment this string")}function f(r){let c=Math.floor(r()*o);return c===o&&(c=o-1),n.charAt(c)}function v(r,c){if(isNaN(r))throw new Error(r+" must be a number");if(r>i)throw t("cannot encode time greater than "+i);if(r<0)throw t("time must be positive");if(Number.isInteger(Number(r))===!1)throw t("time must be an integer");let s,d="";for(;c>0;c--)s=r%o,d=n.charAt(s)+d,r=(r-s)/o;return d}function y(r,c){let s="";for(;r>0;r--)s=f(c)+s;return s}function E(r){if(r.length!==a+u)throw t("malformed ulid");var c=r.substr(0,a).split("").reverse().reduce((s,d,l)=>{let g=n.indexOf(d);if(g===-1)throw t("invalid character found: "+d);return s+=g*Math.pow(o,l)},0);if(c>i)throw t("malformed ulid, timestamp too large");return c}function I(r=!1,c){c||(c=typeof window<"u"?window:null);let s=c&&(c.crypto||c.msCrypto);if(s)return()=>{let d=new Uint8Array(1);return s.getRandomValues(d),d[0]/255};try{let d=ee("crypto");return()=>d.randomBytes(1).readUInt8()/255}catch{}if(r){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw t("secure crypto unusable, insecure Math.random not allowed")}function j(r){return r||(r=I()),function(s){return isNaN(s)&&(s=Date.now()),v(s,a)+y(u,r)}}function R(r){r||(r=I());let c=0,s;return function(l){if(isNaN(l)&&(l=Date.now()),l<=c){let A=s=p(s);return v(c,a)+A}c=l;let g=s=y(u,r);return v(l,a)+g}}let M=j();e.decodeTime=E,e.detectPrng=I,e.encodeRandom=y,e.encodeTime=v,e.factory=j,e.incrementBase32=p,e.monotonicFactory=R,e.randomChar=f,e.replaceCharAt=m,e.ulid=M}))});var $={name:"@redocly/cli",version:"2.72.1",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.32.1","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.8.1","@redocly/openapi-core":"2.72.1","@redocly/recheck":"2.72.1","@redocly/respect-core":"2.72.1","@redocly/reunite-integration":"2.72.1","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.10",react:"^18.3.0 || ^19.2.7","react-dom":"^18.3.0 || ^19.2.7","react-router":"^7.18.4",redoc:"3.0.1",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^7.30.0",yargs:"17.0.1"}};var{version:we,name:De,engines:Te}=$,Ue=$.devDependencies.redoc;var re="https://otel.cloud.redocly.com",Re=process.env.OTEL_TRACES_URL||`${re}/v1/traces`,Me=6e3,Oe="redocly-cli-anonymous-id";var Z=ne(F(),1),ie=Object.defineProperty,ce=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},se={};ce(se,{CLOUD_EVENT_STANDARD_KEYS:()=>X,mapToCloudEvent:()=>ae});var X=["id","specversion","object","datacontenttype","type","time","origin","env","category","signal","source","subject","subjects","data","actor","requestId","clientIp","organizationId","organizationSlug","projectId","projectSlug","osPlatform","userAgent","sessionId"];function ae(e){let{type:t,data:n,actor:o,requestId:i,clientIp:a,origin:u,env:m,source:p,organizationId:f,organizationSlug:v,projectId:y,projectSlug:E,category:I="product",signal:j="log",osPlatform:R,userAgent:M,sessionId:r}=e,c=!!(n&&Array.isArray(n)),s=o?{id:o.id??`ann_${(0,Z.ulid)()}`,object:o.object??"user",uri:o.uri??""}:null,d=`evt_${(0,Z.ulid)()}`.toLowerCase(),l=new Date,g=p??s?.uri??null,A={...f!==void 0&&{organizationId:f},...v!==void 0&&{organizationSlug:v},...y!==void 0&&{projectId:y},...E!==void 0&&{projectSlug:E}},O={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:u,env:m,category:I,signal:j,osPlatform:R,userAgent:M,clientIp:a,sessionId:r};if(c){let _=n,Y=_.map(S=>({id:S.id??"",object:S.object??"",uri:S.uri??""})),Q=_[0]?.id??null;Object.assign(O,{...A,id:d,type:t,time:l,source:g,actor:s,subject:Q,subjects:Y,data:_,requestId:i??""})}else{let _=(Array.isArray(n)?n[0]:n)?.id??null;Object.assign(O,{...A,id:d,type:t,time:l,source:g,actor:s,subject:_,requestId:i??"",data:n,...p!=null&&{request:{source:p}}})}return O}function T(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}function L(e){return e!=null}function x(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function G(e,t,n,o=!0,i){let a=i?.length?new Set(i):null;for(let[u,m]of Object.entries(e))if(!a?.has(u)&&m!==void 0){let p=o?T(u):u;n[`${t}${p}`]=m}}function w(e,t,n,o){let i=o?.currentDepth??0,a=o?.useSnakeCase??!0,u=o?.maxNestingLevels??3,m=t.endsWith(".")?t.slice(0,-1):t;for(let[p,f]of Object.entries(e)){if(!L(f))continue;let v=a?T(p):p,y=`${m}.${v}`;typeof f=="object"&&!Array.isArray(f)?i<u&&w(f,y,n,{currentDepth:i+1,useSnakeCase:a,maxNestingLevels:u}):x(f)&&(n[y]=f)}}var V="context",P=[V];function q(e){let t={updated:[],notUpdated:[]};for(let n of e){if(!n||typeof n!="object")continue;let o=n.object;if(typeof o!="string")continue;let i=n,a=t.notUpdated.find(u=>u.object===o);a?(t.updated=[a,i],t.notUpdated=t.notUpdated.filter(u=>u.object!==o)):t.updated.some(u=>u.object===o)||t.notUpdated.push(i)}return t}function D(e,t,n){let o=n?`${n}.`:"",i=t===""?"":`${T(t)}.`;return`${e}.${o}${i}`}function H(e,t){let n=e[V];return n==="before"||n==="after"?n:t===0?"after":"before"}function B(e){let{[V]:t,...n}=e;return n}function z(e){return e.endsWith(".")?e:`${e}.`}function ue(e,t,n){let o=t instanceof Date?t.toISOString():new Date(t).toISOString();return{"cloudevents.event_id":e.id,"cloudevents.event_type":e.type,"cloudevents.event_source":e.source??void 0,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype??"application/json; charset=utf-8","cloudevents.event_time":o,"cloudevents.event_subject":e.subject??"","cloudevents.event_version":n?.version,"cloudevents.event_origin":e.origin??n?.serviceName,"cloudevents.event_env":e.env,"cloudevents.event_client_ip":e.clientIp,"cloudevents.event_object":e.object||"event","cloudevents.event_category":e.category,"cloudevents.event_signal":e.signal,"cloudevents.event_actor.id":e.actor?.id??void 0,"cloudevents.event_actor.object":e.actor?.object??void 0,"cloudevents.event_actor.uri":e.actor?.uri??void 0,"cloudevents.event_organization_id":e.organizationId,"cloudevents.event_organization_slug":e.organizationSlug,"cloudevents.event_project_id":e.projectId,"cloudevents.event_project_slug":e.projectSlug,"cloudevents.event_request_id":e.requestId,"cloudevents.event_os_platform":e.osPlatform,"cloudevents.event_user_agent":e.userAgent,"cloudevents.event_session_id":e.sessionId}}function $e(e,t,n){let o=e.data,i={...ue(e,t,n)};return de(o,i),ve(e,i),ye(e,i),i}function de(e,t){!e||typeof e!="object"||(Array.isArray(e)?le(e,t):me(e,t))}function le(e,t){e.some(n=>n&&typeof n=="object"&&typeof n.object=="string")?fe(e,t):pe(e,t)}function fe(e,t){let n=q(e);n.updated.forEach((o,i)=>{let a=D("cloudevents.event_data",o.object,H(o,i));w(B(o),z(a),t)}),n.notUpdated.forEach(o=>{let i=D("cloudevents.event_data",o.object,void 0);w(B(o),z(i),t)})}function pe(e,t){for(let n of e)!n||typeof n!="object"||w(n,"cloudevents.event_data.",t)}function me(e,t){for(let[n,o]of Object.entries(e)){if(!L(o))continue;let i=T(n);if(typeof o=="object"&&!Array.isArray(o))for(let[a,u]of Object.entries(o))L(u)&&x(u)&&(t[`cloudevents.event_data.${i}.${a}`]=u);else x(o)&&(t[`cloudevents.event_data.${i}`]=o)}}function ve(e,t){if(!e.subjects||!Array.isArray(e.subjects))return;let n=q(e.subjects);n.updated.forEach((o,i)=>{let a=D("cloudevents.event_subjects",o.object,H(o,i));G(o,a,t,!1,P)}),n.notUpdated.forEach(o=>{let i=D("cloudevents.event_subjects",o.object,void 0);G(o,i,t,!1,P)})}function ye(e,t){for(let[n,o]of Object.entries(e))if(!(X.includes(n)||o===void 0))if(o instanceof Object)for(let[i,a]of Object.entries(o))a!==void 0&&(t[`cloudevents.${n}.${i}`]=a);else t[`cloudevents.${n}`]=o}import U from"node:crypto";var J="0123456789ABCDEFGHJKMNPQRSTVWXYZ",C=32;var ge=16,K=10,W=0xffffffffffff;var b;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(b||(b={}));var h=class extends Error{constructor(t,n){super(`${n} (${t})`),this.name="ULIDError",this.code=t}};function be(e){let t=Math.floor(e()*C)%C;return J.charAt(t)}function he(e){let t=Ie(),n=t&&(t.crypto||t.msCrypto)||(typeof U<"u"?U:null);if(typeof n?.getRandomValues=="function")return()=>{let o=new Uint8Array(1);return n.getRandomValues(o),o[0]/256};if(typeof n?.randomBytes=="function")return()=>n.randomBytes(1).readUInt8()/256;if(U?.randomBytes)return()=>U.randomBytes(1).readUInt8()/256;throw new h(b.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Ie(){return je()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function _e(e,t){let n="";for(;e>0;e--)n=be(t)+n;return n}function Ee(e,t=K){if(isNaN(e))throw new h(b.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>W)throw new h(b.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${W}: ${e}`);if(e<0)throw new h(b.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new h(b.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,o="";for(let i=t;i>0;i--)n=e%C,o=J.charAt(n)+o,e=(e-n)/C;return o}function je(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function xe(e,t){let n=t||he(),o=!e||isNaN(e)?Date.now():e;return Ee(o,K)+_e(ge,n)}export{we as a,De as b,Te as c,Ue as d,re as e,Re as f,Me as g,Oe as h,se as i,$e as j,xe as k};
@@ -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 p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./DM4EUYBB.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as B,s as C,u as G}from"./5CR6AOLY.js";import{a}from"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{z as AUTHORING_HELPER_NAMES,G as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,C as WIRING_NAMES,B as allOperations,c as casing,E as constantCase,A as defineClientSetup,H as defineGenerator,g as deref,i as discriminatorCases,m as docText,l as enumValues,h as flattenAllOf,I as generateClient,D as groupSlug,o as headerCoerceType,e as identifierFor,u as isBinaryContentType,s as isMultipartBody,j as isNullable,t as isUntypedMultipartBody,q as jsonSuccessSchema,F as mergeConfig,x as paginationItemSchema,p as paginationRuleFor,y as renderReferencePage,n as resolveSchemaPointer,n as schemaAtPointer,w as securityRequirements,v as serverUrlParts,r as sseResponse,f as uniqueIdentifiers,k as unwrapNullable};
7
+ import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./BZTZIEWS.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as B,s as C,u as G}from"./A65OW7M7.js";import{a}from"./WZXA5XPB.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{z as AUTHORING_HELPER_NAMES,G as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,C as WIRING_NAMES,B as allOperations,c as casing,E as constantCase,A as defineClientSetup,H as defineGenerator,g as deref,i as discriminatorCases,m as docText,l as enumValues,h as flattenAllOf,I as generateClient,D as groupSlug,o as headerCoerceType,e as identifierFor,u as isBinaryContentType,s as isMultipartBody,j as isNullable,t as isUntypedMultipartBody,q as jsonSuccessSchema,F as mergeConfig,x as paginationItemSchema,p as paginationRuleFor,y as renderReferencePage,n as resolveSchemaPointer,n as schemaAtPointer,w as securityRequirements,v as serverUrlParts,r as sseResponse,f as uniqueIdentifiers,k as unwrapNullable};
@@ -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{b as s}from"./CRJEY7P3.js";import{l as d,n as p,o as l,p as f}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{fa as c,la as o}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{readFile as E}from"node:fs/promises";var P={APPROVED:"approved",REQUESTED_CHANGES:"changes requested",REVIEW_REQUIRED:"review required"},C={PENDING:"pending",IN_PROGRESS:"pending",SUCCESS:"passed",FAILED:"failed",CANCELLED:"cancelled"};async function D({argv:t,version:e}){let{project:r,branch:n}=await w();if((await s(["rev-parse","--verify","--quiet",`refs/remotes/origin/${n}`],{capture:!0})).code!==0)throw new o(`Push the branch first: \`git push -u origin ${n}\`.`);let i=await l({...r,accessToken:await g(r.reuniteUrl,e),version:e,branch:n,title:t.title??(await s(["log","-1","--format=%s"],{capture:!0})).output,description:await y(t),base:t.base,draft:t.draft}).catch(m);c.output(`${h(r,i.number)}
7
+ import{b as s}from"./XTI7EXWX.js";import{l as d,n as p,o as l,p as f}from"./FLQQ3VRQ.js";import"./KFQC57GK.js";import{ka as c,qa as o}from"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{readFile as E}from"node:fs/promises";var P={APPROVED:"approved",REQUESTED_CHANGES:"changes requested",REVIEW_REQUIRED:"review required"},C={PENDING:"pending",IN_PROGRESS:"pending",SUCCESS:"passed",FAILED:"failed",CANCELLED:"cancelled"};async function D({argv:t,version:e}){let{project:r,branch:n}=await w();if((await s(["rev-parse","--verify","--quiet",`refs/remotes/origin/${n}`],{capture:!0})).code!==0)throw new o(`Push the branch first: \`git push -u origin ${n}\`.`);let i=await l({...r,accessToken:await g(r.reuniteUrl,e),version:e,branch:n,title:t.title??(await s(["log","-1","--format=%s"],{capture:!0})).output,description:await y(t),base:t.base,draft:t.draft}).catch(m);c.output(`${h(r,i.number)}
8
8
  `)}async function I({version:t}){let{project:e,branch:r}=await w(),n=await f({...e,accessToken:await g(e.reuniteUrl,t),version:t,branch:r}).catch(m);if(!n)throw new o(`No pull request for \`${r}\`. Open one with \`redocly project pr create\`.`);c.output($(n,h(e,n.pullRequest.number)))}function $({pullRequest:t,checks:e,previewUrl:r},n){let u=t.status==="OPEN"&&t.isDraft?"draft":t.status.toLowerCase(),i=t.reviewDecision?P[t.reviewDecision]:"none";return`${[`#${t.number} ${t.title}`,n,`State: ${u}`,`Review: ${i}`,e.length>0?"Checks:":"Checks: none",...e.map(a=>` ${C[a.state].padEnd(9)} ${a.context}`+(a.description?` - ${a.description}`:"")+(a.targetUrl?` ${a.targetUrl}`:"")),`Preview: ${r??"not ready"}`].join(`
9
9
  `)}
10
10
  `}async function y({body:t,"body-file":e}){if(e===void 0)return t;if(e==="-"){let r="";for await(let n of process.stdin)r+=n;return r}try{return await E(e,"utf8")}catch(r){throw new o(`Can't read the body file \`${e}\`: ${r.message}`)}}async function w(){let t=await s(["remote","get-url","origin"],{capture:!0}),e=p(t.output);if(!e)throw new o("Run this command in a clone of a Redocly-hosted project. Clone one with `redocly project clone`.");let{output:r}=await s(["branch","--show-current"],{capture:!0});if(!r)throw new o("Check out a branch first.");return{project:e,branch:r}}async function g(t,e){let r=await new d(e).getAccessToken(t);if(!r)throw new o(`You are not logged in to ${t}. Run \`redocly login --residency ${t}\`.`);return r}function h({reuniteUrl:t,organization:e,project:r},n){return`${t}/org/${encodeURIComponent(e)}/project/${encodeURIComponent(r)}/pull-requests/${n}`}function m(t){throw new o(t.message)}export{$ as formatPullRequestStatus,D as handleProjectPrCreate,I as handleProjectPrStatus,y as readBody};
@@ -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{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./BH4FA7AH.js";import{$ as i,Z as y,_ as $,da as u,fa as n,ma as k,oa as T,sa as B,t as O,ta as E}from"./FRQHCFKP.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
7
+ import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./YA5KTHFN.js";import{ca as y,da as $,ea as i,ia as u,ka as n,ra as k,ta as T,u as O,xa as B,ya as E}from"./X22IMAJK.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
8
8
  `)):n.info(u(`bundling ${s(o)} using configuration for api '${c}'...
9
9
  `));let{bundle:D,problems:w,...x}=await T({ref:o,config:p,dereference:e.dereferenced,removeUnusedComponents:e["remove-unused-components"],keepUrlRefs:e["keep-url-references"],componentRenamingConflicts:e["component-renaming-conflicts-severity"],componentNamesStrategy:e["component-names-strategy"],overlays:m,collectSpecData:G}),r=B(w),{outputFile:f,ext:K}=F({entrypoint:o,output:J,argvOutput:e.output,ext:e.ext,entries:e?.apis?.length||0});if(r.errors===0||e.force)if(f){let t=g(b(D.parsed),K,e.dereferenced);_(f,t)}else{let t=g(b(D.parsed),e.ext||"yaml",e.dereferenced);n.output(t)}a.errors+=r.errors,a.warnings+=r.warnings,a.ignored+=r.ignored,E(w,{format:"codeframe",totals:r,version:W,command:"bundle"}),e.metafile&&(A.length>1&&n.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),L(e.metafile,JSON.stringify(x),"utf-8"));let h=R(d);r.errors>0?e.force?n.info(`\u2753 Created a bundle for ${i(s(o))} at ${i(f||"stdout")} with errors ${y(h)}.
10
10
  ${$("Errors ignored because of --force")}.
@@ -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}from"./HMYFTLS7.js";import"./VJZDR6KS.js";import"./L325HIGK.js";import"./R32HBYOH.js";import"./DM4EUYBB.js";import"./5CR6AOLY.js";import"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{b as typescriptDocs,a as typescriptGenerator,c as typescriptSample};
7
+ import{a,b,c}from"./ZFET6WME.js";import"./TFPMT2XD.js";import"./4QC7OVHI.js";import"./BZTZIEWS.js";import"./ZXB5O6JQ.js";import"./A65OW7M7.js";import"./WZXA5XPB.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{b as typescriptDocs,a as typescriptGenerator,c as typescriptSample};
@@ -0,0 +1,59 @@
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 fe}from"./BJ6Z66KZ.js";import{b as B,f as U,v as m}from"./YA5KTHFN.js";import{$ as S,Ea as I,Fa as G,X as M,ba as V,ca as w,ea as _,ia as y,k as F,ka as l,qa as R,ra as q,t as T,w as g,wa as H,x as k,xa as A,y as x,ya as C,z as b}from"./X22IMAJK.js";import"./6RTITFQA.js";import{e as ae}from"./RFWIIJFG.js";import{writeFileSync as ye}from"node:fs";var P=ae(fe(),1);function E(e){let o=P.default.parse(e);return o?`${o.major}.${o.minor}.${o.patch}`:void 0}function Y(e,o){return P.default.major(e)===0&&o==="major"?"minor":o}function J(e,o){let n=E(e);return!n||o===void 0?n:P.default.inc(n,Y(n,o))}function Q(e){let{required:o}=e;if(o===void 0)return;let n=E(e.base),i=E(e.revision);if(!n||!i)return"\u274C info.version is not a semver string, so --check-version cannot compare it.";let r=Y(n,o),t=J(n,o);return P.default.gte(i,t)?void 0:`\u274C info.version ${n===i?`stayed ${n}`:`went ${n} \u2192 ${i}`}, but these changes require a ${r} bump (${t})${r===o?"":" while below 1.0"}.`}function W(e,o){if(o==="none")return;let n=[...x].reverse().filter(t=>b(t)>=b(o)&&e[t]>0);if(!n.length)return;let i=n.reduce((t,s)=>t+e[s],0);return`\u274C Diff failed with ${n.map(t=>`${e[t]} ${t}`).join(" and ")} ${F("change",i)}.`}var pe={major:"error"};function K(e){let o=e.changes.flatMap(n=>n.verdicts.flatMap(({ruleId:i,impact:r,message:t,location:s})=>{let a=pe[r];return a?[{message:t,ruleId:i,severity:a,location:[s],suggest:[]}]:[]}));C(o,{format:"github-actions",totals:A(o),maxProblems:o.length})}function $(e){let{start:o}=H(e);return{file:m(e.source.absoluteRef),line:o.line,col:o.col}}function Z(e){let{file:o,line:n,col:i}=$(e);return{file:o,pointer:e.pointer,line:n,col:i}}function X({location:e,value:o}){return{...Z(e),value:o}}function N(e){return{path:e.path,typeName:g(e.node),kind:e.kind,impact:e.impact,verdicts:e.verdicts.map(({location:o,...n})=>({...n,location:Z(o)})),property:e.kind==="modified"?e.property:void 0,base:"base"in e?X(e.base):void 0,revision:"revision"in e?X(e.revision):void 0}}function ee(e){let o={reportVersion:"1",files:{base:m(e.files.base),revision:m(e.files.revision)},specVersions:e.specVersions,infoVersions:e.infoVersions,summary:e.summary,bump:e.bump,changes:e.changes.map(N)};return JSON.stringify(o,null,2)}var L={oas2:"OpenAPI 2.0",oas3_0:"OpenAPI 3.0",oas3_1:"OpenAPI 3.1",oas3_2:"OpenAPI 3.2",async2:"AsyncAPI 2",async3:"AsyncAPI 3",arazzo1:"Arazzo 1.0",arazzo1_1:"Arazzo 1.1",overlay1:"Overlay 1",openrpc1:"OpenRPC 1",graphql:"GraphQL"};function c(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function me(e){let o=e.kind==="modified"?`${e.path} \xB7 ${e.property}`:e.path,{base:n,revision:i}=N(e);return`
8
+ <details class="change ${e.impact}">
9
+ <summary>
10
+ <span class="badge">${c(e.impact)}</span>
11
+ <code>${c(e.kind)}</code>
12
+ <code class="loc">${c(o)}</code>
13
+ ${e.verdicts.map(r=>`<span class="msg">${c(r.message)}</span> <span class="rules">${c(r.ruleId)}</span>`).join(" ")}
14
+ </summary>
15
+ <pre>${c(JSON.stringify({base:n,revision:i},null,2))}</pre>
16
+ </details>`}function oe(e){let{major:o,minor:n,patch:i}=e.summary,{base:r,revision:t}=e.specVersions,s=r===t?L[r]:`${L[r]} \u2192 ${L[t]}`,a=e.bump?`<span style="color:#9aa5b1">requires a ${c(e.bump)} bump</span>`:"";return`<!DOCTYPE html>
17
+ <html lang="en">
18
+ <head>
19
+ <meta charset="utf-8">
20
+ <title>API diff</title>
21
+ <style>
22
+ body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; margin: 2rem auto; max-width: 60rem; padding: 0 1rem; color: #1f2933; }
23
+ h1 { font-size: 1.4rem; }
24
+ .summary span { margin-right: 1rem; font-weight: 600; }
25
+ .change { border: 1px solid #e0e4e8; border-radius: 6px; margin: .5rem 0; padding: .25rem .75rem; }
26
+ .change summary { cursor: pointer; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
27
+ .badge { border-radius: 4px; padding: 0 .5rem; font-size: .8rem; color: #fff; }
28
+ .major .badge { background: #c0392b; }
29
+ .minor .badge { background: #1e8449; }
30
+ .patch .badge { background: #9aa5b1; }
31
+ .msg { color: #52606d; }
32
+ .rules { color: #9aa5b1; font-size: .85rem; }
33
+ pre { background: #f5f7fa; padding: .75rem; border-radius: 6px; overflow-x: auto; }
34
+ code.loc { word-break: break-all; }
35
+ </style>
36
+ </head>
37
+ <body>
38
+ <h1>API diff: ${c(m(e.files.base))} \u2192 ${c(m(e.files.revision))}</h1>
39
+ <p class="summary">
40
+ <span style="color:#c0392b">${o} major</span>
41
+ <span style="color:#1e8449">${n} minor</span>
42
+ <span style="color:#9aa5b1">${i} patch</span>
43
+ ${a}
44
+ <span style="color:#9aa5b1">${c(s)}</span>
45
+ </p>
46
+ ${e.changes.map(me).join(`
47
+ `)}
48
+ </body>
49
+ </html>`}var ce={major:"\u{1F534} major",minor:"\u{1F7E2} minor",patch:"\u26AA patch"};function ne(e){return e.replaceAll("|","\\|").replaceAll("`","\\`").split(`
50
+ `).map(o=>o.trim()).join(" ")}function de(e){let o=e.replaceAll("|","\\|").replaceAll(`
51
+ `," ");return o.includes("`")?`\`\` ${o} \`\``:`\`${o}\``}function te(e){let{major:o,minor:n,patch:i}=e.summary,r=e.bump?` \xB7 requires a **${e.bump}** bump`:"",t=[`## API diff: ${m(e.files.base)} \u2192 ${m(e.files.revision)}`,"",`**${o}** major \xB7 **${n}** minor \xB7 **${i}** patch${r}`,"","| Impact | Change | Pointer | Location | Details |","| --- | --- | --- | --- | --- |"];for(let s of e.changes){let a=s.kind==="modified"?`${s.path} \xB7 ${s.property}`:s.path,{file:p,line:u,col:v}=$(I(s).location),h=s.verdicts.map(f=>`${ne(f.message)} \`${f.ruleId}\``).join("<br>");t.push(`| ${ce[s.impact]} | ${s.kind} | ${de(a)} | ${ne(`${p}:${u}:${v}`)} | ${h} |`)}return t.join(`
52
+ `)}function re(e){let o=J(e.infoVersions.base,e.bump);if(o===void 0)throw new R("info.version of the base description is not a semver string, so the next version cannot be computed.");return o}var le={major:V,minor:w,patch:y},ue={major:V("\u2716 major"),minor:w("\u2714 minor"),patch:y("\xB7 patch")};function he(e){let[,...o]=T(e);return o}var ge={Paths:e=>e,WebhooksMap:e=>`${e} (webhook)`,NamedChannels:e=>`channel ${e}`,NamedOperations:e=>`operation ${e}`,ServerMap:e=>`server ${e}`};function ie(e){let o=[];for(let p=e.node;p;p=p.parent)o.unshift(p);let[,n,i,r]=o;if(!n)return{heading:"document",depth:0};let t=ge[g(n)];if(!i||!t)return{heading:k(n),depth:1};let s=t(k(i));return r&&g(r)==="Operation"&&g(i)==="PathItem"?{heading:`${k(r).toUpperCase()} ${s}`,depth:3}:{heading:s,depth:2}}function be(e){let o=he(e.path).slice(ie(e).depth).join("/");return e.kind!=="modified"?o:o?`${o} \xB7 ${e.property}`:e.property}function se(e){let o=new Map;for(let r of e.changes){let{heading:t}=ie(r),s=o.get(t)??[];s.push(r),o.set(t,s)}let n=[];for(let[r,t]of o){n.push(S(_(r)));let s=t.toSorted((a,p)=>b(p.impact)-b(a.impact));for(let a of s){let p=be(a),u=S(p?a.kind.padEnd(8):a.kind);n.push(` ${ue[a.impact]} ${u}${p?` ${p}`:""}`);for(let D of a.verdicts)n.push(y(` ${D.message} (${D.ruleId})`));let{file:v,line:h,col:f}=$(I(a).location);n.push(y(` at ${v}:${h}:${f}`))}n.push("")}let i=x.toReversed().map(r=>{let t=e.summary[r];return(t?le[r]:y)(`${t} ${r}`)});return n.push(`${i.join(", ")}.`),n.join(`
53
+ `)}var j={stylish:se,json:ee,markdown:te,html:oe,"next-version":re};async function so({argv:e,config:o,collectSpecData:n}){if(e.output&&e.format==="github-actions")throw new R(`The github-actions format prints to stdout only. To write a report to a file, use one of these formats: ${Object.keys(j).join(", ")}.`);let i=performance.now(),[{path:r},{path:t,alias:s}]=await B([e.base,e.revision],o),a=o.forAlias(s);a.skipDiffRules(e["skip-rule"]);let p=new M(o.resolve),u=async d=>{let O=await p.resolveDocument(null,d,!0);if(O instanceof Error)throw O;return O},[v,h]=await Promise.all([u(r),u(t)]);n?.(h);let f=await G({base:v,revision:h,config:a,externalRefResolver:p});f.problems.length&&(C(f.problems,{format:"codeframe",totals:A(f.problems),command:"diff"}),l.warn(`\u26A0\uFE0F The problems above leave parts of the descriptions unresolved, so the diff may miss changes there or judge them without knowing whether they are in a request or a response.
54
+ `));let D=a.diff[f.specVersions.revision];D&&Object.values(D).every(d=>d==="off")&&l.warn(`\u26A0\uFE0F No diff rules are on, so the command cannot find breaking changes. Add diff-recommended to extends in your configuration file.
55
+ `),f.changes.sort($e),e.format==="github-actions"?K(f):e.output?(ye(e.output,j[e.format](f)),l.info(`Diff report written to ${e.output}.
56
+ `)):l.output(j[e.format](f)+`
57
+ `),U("diff",i,`${r} vs ${t}`);let z=[A(f.problems).errors>0&&"\u274C The revision has errors, so the diff can miss breaking changes. Fix the problems above.",W(f.summary,e["fail-on"]),e["check-version"]&&Q({base:f.infoVersions.base,revision:f.infoVersions.revision,required:f.bump})].filter(d=>typeof d=="string");if(z.length){for(let d of z)l.error(`${d}
58
+ `);throw new q("Diff failed.")}l.info(w(`\u2705 Diff passed.
59
+ `))}function $e(e,o){if(e.path!==o.path)return e.path<o.path?-1:1;let n=e.kind==="modified"?e.property:"",i=o.kind==="modified"?o.property:"";return n!==i?n<i?-1:1:0}export{so as handleDiff};
@@ -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}from"./TH44RKLO.js";import"./BH4FA7AH.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as bundleTelemetry,b as handleBundle};
7
+ import{a,b}from"./QAT3DPT3.js";import"./YA5KTHFN.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{a as bundleTelemetry,b as handleBundle};
@@ -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 $,b as a,c,d as i,e as m,f}from"./5AVTCY6F.js";import{k as l}from"./R32HBYOH.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
7
+ import{a as $,b as a,c,d as i,e as m,f}from"./HM7M6465.js";import{k as l}from"./ZXB5O6JQ.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
8
8
 
9
9
  `)}function y(t,n,e){return`export function use${l(t.name)}(${n}) {
10
10
  return ${e};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ var l={},c=new Set(["typescript","zod","tanstack-query","tanstack-query-vue","tanstack-query-svelte","tanstack-query-solid","swr","transformers","mock","cli","python","go","php","java"]),s=/import\s*(?:type\s*)?\{([^}]*)\}\s*from\s*['"]@redocly\/client-generator(?:\/generate)?['"]/g;function _(e,t){let o=new Set(t),r=new Set;for(let i of e.matchAll(s))for(let a of i[1].split(",")){let n=a.trim().replace(/^type\s+/,"").split(/\s+as\s+/)[0].trim();o.has(n)&&r.add(n)}return[...r]}var g=/^\/\/ Ejected from @redocly\/client-generator@([\w.-]+) — the built-in "([a-z-]+)" generator\./;function u(e){let t=e.match(g);if(!(!t||!c.has(t[2])))return{name:t[2],version:t[1]}}function p(e){return e.includes("Invalid pagination configuration")?"pagination":e.includes("Could not load generator")?"generator-load":/^Generator "[^"]+" failed:/.test(e)?"generator-run":e.includes("Unknown generator")||e.includes("does not support")?"not-supported":"other"}var d={};export{l as a,c as b,_ as c,u as d,p as e,d as f};
@@ -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}from"./T77BOGYV.js";import"./R32HBYOH.js";import"./DM4EUYBB.js";import"./5CR6AOLY.js";import"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as transformersGenerator};
7
+ import{a}from"./BWGBTYNU.js";import"./BZTZIEWS.js";import"./ZXB5O6JQ.js";import"./A65OW7M7.js";import"./WZXA5XPB.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{a as transformersGenerator};
@@ -4,17 +4,17 @@ 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,c as D,k as U}from"./R32HBYOH.js";import{o as te,p as ne,t as re,u as R,v as oe}from"./5CR6AOLY.js";import{a as y}from"./WZXA5XPB.js";import{M as V,S as Q,c as x,fa as b,ha as Y,oa as Z,q as v,qa as G,r as J,t as W,xa as ee}from"./FRQHCFKP.js";import{mkdir as ct,readFile as ut,writeFile as pt}from"node:fs/promises";import{dirname as ve,parse as ft,resolve as E,sep as dt}from"node:path";function I(e){return{requires:["typescript"],errorModes:["throw"],load:()=>import("./VPTYPV6P.js").then(t=>({run:t.tanstackQueryGenerator(e)}))}}var C={outputMode:"it always emits one self-contained file",runtime:"the runtime is always embedded in the generated file",argsStyle:"inputs follow the target language's own idiom",importExt:"the generated file has no relative imports"},T={typescript:{load:()=>import("./QXXAC25O.js").then(e=>({run:e.typescriptGenerator,sample:e.typescriptSample,docs:e.typescriptDocs}))},zod:{load:()=>import("./BOTTA3HA.js").then(e=>({run:e.zodGenerator}))},transformers:{requires:["typescript"],dateTypes:["Date"],load:()=>import("./3FR3456Q.js").then(e=>({run:e.transformersGenerator}))},"tanstack-query":I("react"),"tanstack-query-vue":I("vue"),"tanstack-query-svelte":I("svelte"),"tanstack-query-solid":I("solid"),swr:{requires:["typescript"],errorModes:["throw"],load:()=>import("./HTFKP5HH.js").then(e=>({run:e.swrGenerator}))},mock:{requires:["typescript"],load:()=>import("./JO76DPXR.js").then(e=>({run:e.mockGenerator}))},cli:{requires:["typescript","zod"],errorModes:["throw"],load:()=>import("./SSEMMWPY.js").then(e=>({run:e.cliGenerator,sample:e.cliSample,docs:e.cliDocs}))},python:{notApplicable:C,load:()=>import("./ORWIUECT.js").then(e=>({run:e.pythonGenerator,sample:e.pythonSample,docs:e.pythonDocs,options:e.pythonOptions}))},go:{errorModes:["throw"],notApplicable:C,load:()=>import("./4H3DPQDW.js").then(e=>({run:e.goGenerator,sample:e.goSample,docs:e.goDocs}))},php:{errorModes:["throw"],notApplicable:C,load:()=>import("./UTEOWLD5.js").then(e=>({run:e.phpGenerator,sample:e.phpSample,docs:e.phpDocs}))}};function se(e,t,n,r){let o=new Set(e);t.goPackage!==void 0&&!o.has("go")&&b.warn(`generate-client: goPackage is ignored \u2014 it declares the Go package clause, and no selected generator uses it (add --generator go).
7
+ import{b as N,c as U,k as C}from"./ZXB5O6JQ.js";import{o as te,p as ne,t as re,u as D,v as oe}from"./A65OW7M7.js";import{a as y}from"./WZXA5XPB.js";import{Ca as ee,R as V,X as Q,c as x,ka as b,ma as Y,q as v,r as J,ta as Z,u as W,va as R}from"./X22IMAJK.js";import{mkdir as ct,readFile as ut,writeFile as pt}from"node:fs/promises";import{dirname as ve,parse as ft,resolve as E,sep as dt}from"node:path";function I(e){return{requires:["typescript"],errorModes:["throw"],load:()=>import("./3FVHXIZN.js").then(t=>({run:t.tanstackQueryGenerator(e)}))}}var T={outputMode:"it always emits one self-contained file",runtime:"the runtime is always embedded in the generated file",argsStyle:"inputs follow the target language's own idiom",importExt:"the generated file has no relative imports"},G={typescript:{load:()=>import("./R67IVFZH.js").then(e=>({run:e.typescriptGenerator,sample:e.typescriptSample,docs:e.typescriptDocs}))},zod:{load:()=>import("./VOYPXV3Z.js").then(e=>({run:e.zodGenerator}))},transformers:{requires:["typescript"],dateTypes:["Date"],load:()=>import("./S43EG4DB.js").then(e=>({run:e.transformersGenerator}))},"tanstack-query":I("react"),"tanstack-query-vue":I("vue"),"tanstack-query-svelte":I("svelte"),"tanstack-query-solid":I("solid"),swr:{requires:["typescript"],errorModes:["throw"],load:()=>import("./GWBLS542.js").then(e=>({run:e.swrGenerator}))},mock:{requires:["typescript"],load:()=>import("./3WOXO2JS.js").then(e=>({run:e.mockGenerator}))},cli:{requires:["typescript","zod"],errorModes:["throw"],load:()=>import("./LUNR7GV4.js").then(e=>({run:e.cliGenerator,sample:e.cliSample,docs:e.cliDocs}))},python:{notApplicable:T,load:()=>import("./4A5R4H5W.js").then(e=>({run:e.pythonGenerator,sample:e.pythonSample,docs:e.pythonDocs,options:e.pythonOptions}))},go:{errorModes:["throw"],notApplicable:T,load:()=>import("./IM4YIUUN.js").then(e=>({run:e.goGenerator,sample:e.goSample,docs:e.goDocs}))},php:{errorModes:["throw"],notApplicable:T,load:()=>import("./VS4MTPCM.js").then(e=>({run:e.phpGenerator,sample:e.phpSample,docs:e.phpDocs}))},java:{errorModes:["throw"],notApplicable:T,load:()=>import("./ARUYNQHA.js").then(e=>({run:e.javaGenerator,sample:e.javaSample,docs:e.javaDocs}))}};function se(e,t,n,r){let o=new Set(e);t.goPackage!==void 0&&!o.has("go")&&b.warn(`generate-client: goPackage is ignored \u2014 it declares the Go package clause, and no selected generator uses it (add --generator go).
8
8
  `),t.telemetry==="on"&&!o.has("typescript")&&b.warn(`generate-client: telemetry is ignored \u2014 the typescript generator writes the telemetry module, and it is not selected (add --generator typescript).
9
9
  `);let s=t.errorMode??"throw",a=t.dateType??"string";for(let i of e){let c=n.get(i);if(!c)throw new y(`Unknown generator: ${i}`);for(let p of c.requires??[])if(!o.has(p)){let f=[...new Set([p,...e])].map(m=>`--generator ${m}`).join(" ");throw new y(`The "${i}" generator requires the "${p}" generator. Add it, e.g. ${f}.`)}if(c.errorModes&&!c.errorModes.includes(s))throw new y(`The "${i}" generator does not support --error-mode "${s}" (supported: ${c.errorModes.join(", ")}).`);if(c.dateTypes&&!c.dateTypes.includes(a))throw new y(`The "${i}" generator requires --date-type ${c.dateTypes.join(" or ")} (got "${a}") so the runtime values match the generated types.`);let u={...t,outputMode:r};for(let[p,f]of Object.entries(c.notApplicable??{}))u[p]!==void 0&&b.warn(`generate-client: the "${i}" generator ignores ${p} \u2014 ${f}.
10
10
  `)}}function ie(e,t,n){let r=new Map;for(let o of e){let s=t.get(o)?.options,a=n?.[o];if(s===void 0){a!==void 0&&b.warn(`generate-client: the "${o}" generator declares no options, so client.options.${o} is ignored.
11
- `),r.set(o,{});continue}r.set(o,Se(o,s,a))}return r}function Se(e,t,n){if(n!==void 0&&!x(n))throw new y(`The "${e}" generator's options must be a map of option names to values.`);let r=n??{},o=Object.keys(t.properties);if(t.additionalProperties!==!0){for(let a of Object.keys(r))if(!o.includes(a))throw new y(`The "${e}" generator got an unknown option "${a}". Declared options: ${o.join(", ")||"(none)"}.`)}for(let a of t.required??[])if(r[a]===void 0)throw new y(`The "${e}" generator requires the "${a}" option.`);let s={...r};for(let[a,i]of Object.entries(t.properties)){if(s[a]===void 0){i.default!==void 0&&(s[a]=i.default);continue}let c=Oe(i,s[a]);if(c!==void 0)throw new y(`The "${e}" generator's "${a}" ${c}.`)}return s}function Oe(e,t){if("enum"in e)return e.enum.includes(t)?void 0:`must be one of: ${e.enum.join(", ")}`;if(e.type==="array"){let n=e.items.type;return Array.isArray(t)&&t.every(r=>typeof r===n)?void 0:`must be an array of ${n}`}return typeof t===e.type?void 0:`must be a ${e.type}`}import{isAbsolute as qe,resolve as Pe}from"node:path";import{pathToFileURL as je}from"node:url";var xe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,o,s,a){return r?t?".jsx":".js":o&&(!s||!a)?n:o+s+"."+a.toLowerCase()+"js"}):e};async function ce(e,t={}){let n=new Map;for(let i of t.customGenerators??[])ue(n,i);let r=[];for(let i of e)r.push(await ae(i,n,t.configDir));let o=[],s=new Set,a=async i=>{if(!(o.includes(i)||s.has(i))){s.add(i);for(let c of n.get(i).requires??[])(n.has(c)||c in T)&&await a(await ae(c,n,t.configDir));s.delete(i),o.push(i)}};for(let i of r)await a(i);return{selected:o,registry:n}}async function ae(e,t,n){if(t.has(e))return e;let r=T[e];if(r!==void 0){let{load:s,...a}=r;return t.set(e,{...a,...await s()}),e}if(e==="sdk")throw new y('The "sdk" generator is now named "typescript". Update the `generators` list or the --generator flag.');let o=await Ae(e,n??process.cwd());return ue(t,o),o.name}function ue(e,t){if(!x(t)||typeof t.name!="string"||t.name===""||typeof t.run!="function")throw new y("Invalid custom generator: expected an object with a non-empty string `name` and a `run` function (build one with `defineGenerator`).");if(e.has(t.name))throw new y(`Generator name "${t.name}" collides with an existing generator. Rename the custom generator.`);if(t.requiresGenerator!==void 0){let n=oe(R,t.requiresGenerator);if(n===void 0)throw new y(`Generator "${t.name}" declares requiresGenerator "${t.requiresGenerator}", which is not a range we read. Use ^1.2.0, ~1.2.0, >=1.2.0, or an exact version.`);if(!n)throw new y(`Generator "${t.name}" needs @redocly/client-generator ${t.requiresGenerator}; this CLI ships ${R}. Upgrade @redocly/cli if the generator is newer, or update the generator \u2014 \`redocly eject-generator <name> --update\` for an ejected file, or upgrade its package.`)}t.name in T&&b.warn(`generate-client: custom generator "${t.name}" takes over the built-in generator of the same name.
12
- `),e.set(t.name,{run:t.run,sample:t.sample,docs:t.docs,notApplicable:t.notApplicable,options:t.options,requires:t.requires,errorModes:t.errorModes,dateTypes:t.dateTypes})}async function Ae(e,t){if(W(e))throw new y(`Remote generator modules are not supported \u2014 use a local path or a package name. Got: ${e}`);let n=e.startsWith(".")||qe(e),r=n?je(Pe(t,e)).href:e;if(n&&e.endsWith(".ts")&&!process.features.typescript)throw new y(`Generator "${e}" is TypeScript, which this Node cannot run directly \u2014 use Node 22.18, 23.6, or newer.`);let o;try{o=await import(xe(r))}catch(a){throw new y(`Could not load generator "${e}": ${a.message}`)}let s=o.default??o.generator;if(s===void 0)throw new y(`Generator module "${e}" must export a generator (a default export or a \`generator\` export built with \`defineGenerator\`).`);return s}function de(e){let t=new Set,n=new Set,r=new Map;for(let l of e.securitySchemes){let h=B(l.key,t,n);h!==l.key&&(r.set(l.key,h),z("security scheme",l.key,h,fe(l.key,t)),l.key=h)}let o=new Set(re()),s=new Set(o),a=new Set,i=new Map;for(let l of e.schemas){let h=B(l.name,s,a);h!==l.name&&(i.set(l.name,h),z("schema",l.name,h,fe(l.name,o)),l.name=h)}let c=l=>i.get(l)??pe(l),u=l=>r.get(l)??pe(l);for(let l of e.schemas)$(l.schema,c);let p=new Set(s),f=new Set,m=new Set;for(let l of e.services)for(let h of l.operations){let d=m.has(h.name);m.add(h.name);let g=h.name,P=B(h.name,p,f);if(P!==h.name){let j=d?{kind:"duplicate-operation-id"}:o.has(g)?{kind:"reserved"}:s.has(g)?{kind:"schema-collision"}:{kind:"unusable"};z("operation",g,P,j),h.specName=h.name,h.name=P}Ne(h,c),h.security=h.security.map(j=>j.map(u))}}function B(e,t,n){let r=D(e),o=r,s=2;for(;t.has(o)||n.has(U(o));)o=`${r}_${s++}`;return t.add(o),n.add(U(o)),o}function le(e){for(let t of e.schemas)if(!M(t.name))throw L("schema",t.name);for(let t of e.securitySchemes)if(!M(t.key))throw L("security scheme",t.key);for(let t of e.services)for(let n of t.operations)if(!M(n.name))throw L("operation",n.name)}function L(e,t){return new Error(`Internal error: ${e} name ${JSON.stringify(t)} is not a safe identifier after sanitization.`)}function pe(e){return D(e)}function z(e,t,n,r){let o=JSON.stringify(t),s=JSON.stringify(n),a=r.kind==="duplicate-operation-id"?`two operations share the operationId ${o}; the second is emitted as ${s} \u2014 give each operation a unique operationId to control its method name`:r.kind==="schema-collision"?`${e} ${o} collides with the schema of the same name, so it is emitted as ${s} \u2014 rename the operation or the schema in the description to control its name`:r.kind==="reserved"?`${e} ${o} is a name a generated client already declares, so it is emitted as ${s} \u2014 the reserved set spans every target language, so one schema keeps one name across the SDKs you generate`:`${e} ${o} is not a usable identifier, so it is emitted as ${s}`;b.warn(`generate-client: ${a}.
13
- `)}function fe(e,t){return t.has(e)?{kind:"reserved"}:{kind:"unusable"}}function $(e,t){switch(e.kind){case"ref":e.name=t(e.name);break;case"omit":e.base=t(e.base);break;case"array":$(e.items,t);break;case"record":$(e.value,t);break;case"object":for(let n of e.properties)$(n.schema,t);break;case"union":for(let n of e.members)$(n,t);if(e.discriminator)for(let n of e.discriminator.mapping)n.schemaName=t(n.schemaName);break;case"intersection":for(let n of e.members)$(n,t);break}}function Ne(e,t){for(let n of e.pathParams)$(n.schema,t);for(let n of e.queryParams)$(n.schema,t);for(let n of e.headerParams)$(n.schema,t);for(let n of e.cookieParams)$(n.schema,t);e.requestBody&&$(e.requestBody.schema,t);for(let n of[...e.successResponses,...e.errorResponses])$(n.schema,t),n.itemSchema&&$(n.itemSchema,t)}var Me=["get","post","put","delete","patch","head","options"];function he(e,t){if(!t.startsWith("#/"))throw new y(`External $ref not supported: ${t}`);let n=t.slice(2).split("/").map(o=>o.replace(/~1/g,"/").replace(/~0/g,"~")),r=e;for(let o of n){if(!x(r)&&!Array.isArray(r))throw new y(`Cannot resolve $ref: ${t}`);r=r[o]}if(r===void 0)throw new y(`Cannot resolve $ref: ${t}`);return r}function S(e,t){return v(t)?he(e,t.$ref):t}function N(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Ie(e){let t=e,n={};return typeof t.minimum=="number"&&(n.minimum=t.minimum),typeof t.maximum=="number"&&(n.maximum=t.maximum),typeof t.exclusiveMinimum=="number"?n.exclusiveMinimum=t.exclusiveMinimum:t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n.exclusiveMinimum=t.minimum,delete n.minimum),typeof t.exclusiveMaximum=="number"?n.exclusiveMaximum=t.exclusiveMaximum:t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n.exclusiveMaximum=t.maximum,delete n.maximum),typeof t.multipleOf=="number"&&(n.multipleOf=t.multipleOf),typeof t.minLength=="number"&&(n.minLength=t.minLength),typeof t.maxLength=="number"&&(n.maxLength=t.maxLength),typeof t.pattern=="string"&&(n.pattern=t.pattern),typeof t.minItems=="number"&&(n.minItems=t.minItems),typeof t.maxItems=="number"&&(n.maxItems=t.maxItems),t.uniqueItems===!0&&(n.uniqueItems=!0),typeof t.format=="string"&&(n.format=t.format),t.deprecated===!0&&(n.deprecated=!0),t.example!==void 0?n.example=t.example:Array.isArray(t.examples)&&t.examples.length>0&&(n.example=t.examples[0]),t.default!==void 0&&(n.default=t.default),Object.keys(n).length>0?n:void 0}function Te(e,t){let n=e.discriminator;if(!n||typeof n.propertyName!="string")return;let r=[];if(n.mapping)for(let[o,s]of Object.entries(n.mapping))r.push({value:o,schemaName:N(s)});else for(let o of t)if(v(o)){let s=N(o.$ref);r.push({value:s,schemaName:s})}if(r.length!==0)return{propertyName:n.propertyName,mapping:r}}function k(e,t){return t?{...e,metadata:t}:e}function K(e,t){return e?t?{...e,...t}:e:t}function Ee(e){return e?e.url.replace(/\{([^{}]+)\}/g,(t,n)=>e.variables?.[n]?.default??t):""}function ye(e){let t=e.info?.title??"Api",n=e.info?.version??"0.0.0",r=e.info?.description,o=Ee(e.servers?.[0]),s=(e.servers??[]).map(p=>({url:p.url,description:p.description,variables:Object.entries(p.variables??{}).map(([f,m])=>({name:f,default:m.default,description:m.description}))})),a=Be(e),i=Ue(e),c=Le(e,i),u={title:t,version:n,description:r,serverUrl:o,servers:s,services:c,schemas:a,securitySchemes:i};return de(u),Ge(c,a),le(u),u}function Ge(e,t){let n=new Map(t.map(r=>[r.name,r.schema]));for(let r of e)for(let o of r.operations){o.requestBody&&(o.requestBody.schema=A(o.requestBody.schema,"readOnly",n));for(let s of o.successResponses)s.schema=A(s.schema,"writeOnly",n)}}function Re(e){let t=e.filter(n=>n.kind!=="unknown");return t.length>0?t:[{kind:"unknown"}]}function A(e,t,n){if(e.kind==="ref"){let r=De(e,t,n,new Set);return r.length>0?{kind:"omit",base:e.name,keys:r}:e}if(e.kind==="array")return{...e,items:A(e.items,t,n)};if(e.kind==="record")return{...e,value:A(e.value,t,n)};if(e.kind==="object"){let r=e.properties.filter(o=>!o[t]).map(o=>({...o,schema:A(o.schema,t,n)}));return{...e,properties:r}}return e}function De(e,t,n,r){let o=[],s=a=>{if(a.kind==="ref"){if(r.has(a.name))return;r.add(a.name);let i=n.get(a.name);i&&s(i)}else if(a.kind==="object")for(let i of a.properties)i[t]&&!o.includes(i.name)&&o.push(i.name);else if(a.kind==="intersection")for(let i of a.members)s(i)};return s(e),o}function Ue(e){let t=e.components?.securitySchemes;if(!t)return[];let n=[];for(let[r,o]of Object.entries(t)){let s=S(e,o),a=s.type;a==="oauth2"||a==="openIdConnect"?n.push({kind:"bearer",key:r}):a==="http"&&(s.scheme??"").toLowerCase()==="bearer"?n.push({kind:"bearer",key:r}):a==="http"&&(s.scheme??"").toLowerCase()==="basic"?n.push({kind:"basic",key:r}):a==="apiKey"&&s.in==="header"&&typeof s.name=="string"?n.push({kind:"apiKeyHeader",key:r,headerName:s.name}):a==="apiKey"&&s.in==="query"&&typeof s.name=="string"?n.push({kind:"apiKeyQuery",key:r,paramName:s.name}):a==="apiKey"&&s.in==="cookie"&&typeof s.name=="string"&&(b.warn(`generate-client: security scheme "${r}" sends its credential in the Cookie header, which browsers ignore \u2014 cookie auth works only in server-side clients.
14
- `),n.push({kind:"apiKeyCookie",key:r,cookieName:s.name}))}return n}function Ce(e,t,n){let r=e.security??t.security;if(!r)return[];let o=[];for(let s of r){let a=Object.keys(s);a.length!==0&&a.every(i=>n.has(i))&&o.push([...new Set(a)])}return o}function Be(e){let t=e.components?.schemas;return t?Object.entries(t).map(([n,r])=>{if(v(r)){let s=he(e,r.$ref);return{name:n,schema:q(s,`components.schemas.${n}`,e),description:s.description}}let o=q(r,`components.schemas.${n}`,e);return{name:n,schema:o,description:r.description}}):[]}function Le(e,t){let n=new Set(t.map(a=>a.key)),r=[],o=new Set;for(let[a,i]of Object.entries(e.paths??{})){if(!i)continue;let c=S(e,i),u=(c.parameters??[]).map(p=>ge(S(e,p),`paths.${a}.parameters`,e));for(let p of Me){let f=c[p];f&&(r.push({method:p,path:a,operation:f,pathLevelParams:u}),f.operationId&&o.add(f.operationId))}}return[{name:"Default",operations:r.map(a=>{let i=a.operation.operationId??_e(ze(a.method,a.path),o);return Fe(a.method,a.path,a.operation,i,a.pathLevelParams,e,n)})}]}function ze(e,t){let n=t.split("/").filter(Boolean).map(r=>Ke(r.replace(/[{}]/g,"")));return`${e}${n.join("")}`}function Ke(e){return e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function _e(e,t){let n=e,r=2;for(;t.has(n);)n=`${e}${r++}`;return t.add(n),n}function Fe(e,t,n,r,o,s,a){let i=(n.parameters??[]).map(w=>ge(S(s,w),`paths.${t}.${e}.parameters`,s)),c=new Set,u=[];for(let w of i)c.add(`${w.in}:${w.name}`),u.push(w);for(let w of o)c.has(`${w.in}:${w.name}`)||u.push(w);let p=u.filter(w=>w.in==="path"),f=u.filter(w=>w.in==="query"),m=u.filter(w=>w.in==="header"),l=u.filter(w=>w.in==="cookie"),h=n.requestBody?He(S(s,n.requestBody),`${e} ${t}`,s):void 0,{successResponses:d,successResponseHeaders:g}=Je(n,t,s),P=Ve(n,t,s),j=Ce(n,s,a),X=n["x-redoclyPagination"],H=Xe(d);return{name:r,method:e,path:t,summary:n.summary,description:n.description,pathParams:p,queryParams:f,headerParams:m,cookieParams:l,requestBody:h,successResponses:d,...g===void 0?{}:{successResponseHeaders:g},errorResponses:P,security:j,tags:Array.isArray(n.tags)?n.tags.filter(w=>typeof w=="string"):[],...X!==void 0?{paginationExtension:X}:{},...H===void 0?{}:{sse:H}}}function Xe(e){let t=e.find(o=>o.contentType.split(";")[0].trim().toLowerCase()==="text/event-stream");if(t===void 0)return;let n=t.itemSchema&&t.itemSchema.kind!=="unknown"?t.itemSchema:t.schema.kind!=="unknown"?t.schema:void 0;if(n===void 0)return{dataKind:"text"};let r=n.kind==="object"||n.kind==="ref"||n.kind==="array"||n.kind==="record"||n.kind==="union"||n.kind==="intersection";return{eventSchema:n,dataKind:r?"json":"text"}}function ge(e,t,n){if(!e.in)throw new y(`Parameter ${e.name} at ${t} is missing "in"`);if(!["path","query","header","cookie"].includes(e.in))throw new y(`Unsupported parameter location "${e.in}" for ${e.name} at ${t}`);let r=O(e.schema,`${t}.${e.name}`,n);e.deprecated===!0&&(r={...r,metadata:K(r.metadata,{deprecated:!0})});let o={name:e.name,in:e.in,schema:r,required:!!e.required,description:e.description};if(o.in==="query"){let s=e;(s.style==="form"||s.style==="spaceDelimited"||s.style==="pipeDelimited"||s.style==="deepObject")&&(o.style=s.style),typeof s.explode=="boolean"&&(o.explode=s.explode),typeof s.allowReserved=="boolean"&&(o.allowReserved=s.allowReserved)}return o}function He(e,t,n){let r=e.content??{},o=r["application/json"]??r["application/merge-patch+json"]??r["application/x-www-form-urlencoded"]??r["multipart/form-data"]??Object.values(r)[0];if(!o)return;let s=Object.keys(r).find(i=>r[i]===o),a=O(o.schema,`${t}.requestBody`,n);return{contentType:s,schema:a,required:!!e.required,description:e.description}}function Je(e,t,n){let r=e.responses??{},o=Object.keys(r).filter(m=>/^2\d\d$/.test(m));o.length===0&&(r["2XX"]?o.push("2XX"):r.default&&o.push("default"));let s=o[0];if(!s)return{successResponses:[]};let a=r[s];if(!a)return{successResponses:[]};let i=S(n,a),c=We(i.headers,`paths.${t}.response.${s}`,n),u=i.content;if(!u)return{successResponses:[],...c===void 0?{}:{successResponseHeaders:c}};let p=s==="default"||s==="2XX"?s:Number(s),f=[];for(let[m,l]of Object.entries(u)){let h=O(l.schema,`paths.${t}.response.${s}.${m}`,n),d=l.itemSchema,g=d!==void 0?O(d,`paths.${t}.response.${s}.${m}.itemSchema`,n):void 0;f.push({contentType:m,schema:h,status:p,...g===void 0?{}:{itemSchema:g}})}return{successResponses:f,...c===void 0?{}:{successResponseHeaders:c}}}function We(e,t,n){if(!e)return;let r=[];for(let[o,s]of Object.entries(e)){let a=S(n,s),i={name:o.toLowerCase(),schema:O(a.schema===void 0?void 0:S(n,a.schema),`${t}.headers.${o}`,n)};a.required===!0&&(i.required=!0),r.push(i)}return r.length>0?r:void 0}function Ve(e,t,n){let r=e.responses??{},o=Object.keys(r).filter(i=>/^([45]\d\d|4XX|5XX)$/.test(i));Object.keys(r).some(i=>/^(2\d\d|2XX)$/.test(i))&&r.default&&o.push("default");let a=[];for(let i of o){let c=r[i];if(!c)continue;let p=S(n,c).content;if(!p)continue;let f=i==="default"||i==="4XX"||i==="5XX"?i:Number(i);for(let[m,l]of Object.entries(p)){let h=O(l.schema,`paths.${t}.response.${i}.${m}`,n);a.push({contentType:m,schema:h,status:f})}}return a}function O(e,t,n){return e===void 0||typeof e=="boolean"?{kind:"unknown"}:v(e)?{kind:"ref",name:N(e.$ref)}:q(e,t,n)}function q(e,t,n){let r=Ie(e),o=e.oneOf??e.anyOf;if(o){let i=o.map((p,f)=>v(p)?{kind:"ref",name:N(p.$ref)}:q(p,`${t}.[${f}]`,n)),c=Re(i);if(c.length===1&&c.length<i.length){let p=c[0];return{...p,description:p.description??e.description,metadata:K(r,p.metadata)}}let u=Te(e,o);return k({kind:"union",members:c,discriminator:u,description:e.description},r)}if(e.allOf){let i=e.allOf.map((u,p)=>v(u)?{kind:"ref",name:N(u.$ref)}:q(u,`${t}.allOf[${p}]`,n)),c=me(e,t,n);if(c.length>0&&i.unshift({kind:"object",properties:c}),i.length===1){let u=i[0];return{...u,description:u.description??e.description,metadata:K(r,u.metadata)}}return k({kind:"intersection",members:i,description:e.description},r)}let s=e.type;if(Array.isArray(s)){let i=s.filter(p=>p!=="null"),c=s.includes("null"),u=i.map(p=>{let f={...e,type:p};if(Array.isArray(f.enum)){let m=f.enum.filter(l=>l!==null);f.enum=m.length>0?m:void 0}return q(f,t,n)});return c&&u.push({kind:"null"}),u.length===1?u[0]:k({kind:"union",members:u,description:e.description},r)}if(e.nullable)return{kind:"union",members:[q({...e,nullable:void 0},t,n),{kind:"null"}],description:e.description};if(e.const!==void 0){let i=e.const;if(typeof i!="string"&&typeof i!="number"&&typeof i!="boolean")throw new y(`Unsupported const value at ${t}: ${JSON.stringify(i)}`);return k({kind:"literal",value:i,description:e.description},r)}if(e.enum){let i=e.enum,c=i.filter(m=>m!==null),u=c.length!==i.length;if(c.length===0)return k({kind:"null",description:e.description},r);let p=Qe(c,t),f=p==="boolean"?{kind:"scalar",scalar:"boolean",description:e.description}:{kind:"enum",values:c,scalar:p,description:e.description};return k(u?{kind:"union",members:[f,{kind:"null"}],description:e.description}:f,r)}let a=s;if(a==="null")return k({kind:"null",description:e.description},r);if(a==="array"){let i=e.items,c=O(i,`${t}.items`,n);return k({kind:"array",items:c,description:e.description},r)}if(a==="object"||e.properties||e.additionalProperties){let i=me(e,t,n),c=e.additionalProperties;if(i.length===0&&c!==!1){let u=O(c,`${t}.additionalProperties`,n);return k({kind:"record",value:u,description:e.description},r)}return k({kind:"object",properties:i,description:e.description},r)}return k(a==="string"||a==="number"||a==="integer"||a==="boolean"?{kind:"scalar",scalar:a,description:e.description}:{kind:"unknown",description:e.description},r)}function Qe(e,t){let n=!1,r=!1,o=!1;for(let s of e)if(typeof s=="string")n=!0;else if(typeof s=="number")r=!0;else if(typeof s=="boolean")o=!0;else throw new y(`Unsupported enum value type at ${t}: ${JSON.stringify(s)}`);return n&&!r&&!o?"string":r&&!n&&!o?"number":o&&!n&&!r?"boolean":"string"}function Ye(e){return!(e.openapi??"").startsWith("3.0")}function me(e,t,n){let r=e.properties??{},o=new Set(e.required??[]),s=Ye(n);return Object.entries(r).map(([a,i])=>{let c=i,u=v(i)&&!s;return u&&c.readOnly===!0&&b.warn(`generate-client: "${a}" declares readOnly beside a $ref, which OpenAPI ${n.openapi} ignores \u2014 the property stays in request bodies. Inline the schema, wrap the $ref in allOf, or move the description to OpenAPI 3.1.
11
+ `),r.set(o,{});continue}r.set(o,Se(o,s,a))}return r}function Se(e,t,n){if(n!==void 0&&!x(n))throw new y(`The "${e}" generator's options must be a map of option names to values.`);let r=n??{},o=Object.keys(t.properties);if(t.additionalProperties!==!0){for(let a of Object.keys(r))if(!o.includes(a))throw new y(`The "${e}" generator got an unknown option "${a}". Declared options: ${o.join(", ")||"(none)"}.`)}for(let a of t.required??[])if(r[a]===void 0)throw new y(`The "${e}" generator requires the "${a}" option.`);let s={...r};for(let[a,i]of Object.entries(t.properties)){if(s[a]===void 0){i.default!==void 0&&(s[a]=i.default);continue}let c=Oe(i,s[a]);if(c!==void 0)throw new y(`The "${e}" generator's "${a}" ${c}.`)}return s}function Oe(e,t){if("enum"in e)return e.enum.includes(t)?void 0:`must be one of: ${e.enum.join(", ")}`;if(e.type==="array"){let n=e.items.type;return Array.isArray(t)&&t.every(r=>typeof r===n)?void 0:`must be an array of ${n}`}return typeof t===e.type?void 0:`must be a ${e.type}`}import{isAbsolute as qe,resolve as je}from"node:path";import{pathToFileURL as Pe}from"node:url";var xe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,o,s,a){return r?t?".jsx":".js":o&&(!s||!a)?n:o+s+"."+a.toLowerCase()+"js"}):e};async function ce(e,t={}){let n=new Map;for(let i of t.customGenerators??[])ue(n,i);let r=[];for(let i of e)r.push(await ae(i,n,t.configDir));let o=[],s=new Set,a=async i=>{if(!(o.includes(i)||s.has(i))){s.add(i);for(let c of n.get(i).requires??[])(n.has(c)||c in G)&&await a(await ae(c,n,t.configDir));s.delete(i),o.push(i)}};for(let i of r)await a(i);return{selected:o,registry:n}}async function ae(e,t,n){if(t.has(e))return e;let r=G[e];if(r!==void 0){let{load:s,...a}=r;return t.set(e,{...a,...await s()}),e}if(e==="sdk")throw new y('The "sdk" generator is now named "typescript". Update the `generators` list or the --generator flag.');let o=await Ae(e,n??process.cwd());return ue(t,o),o.name}function ue(e,t){if(!x(t)||typeof t.name!="string"||t.name===""||typeof t.run!="function")throw new y("Invalid custom generator: expected an object with a non-empty string `name` and a `run` function (build one with `defineGenerator`).");if(e.has(t.name))throw new y(`Generator name "${t.name}" collides with an existing generator. Rename the custom generator.`);if(t.requiresGenerator!==void 0){let n=oe(D,t.requiresGenerator);if(n===void 0)throw new y(`Generator "${t.name}" declares requiresGenerator "${t.requiresGenerator}", which is not a range we read. Use ^1.2.0, ~1.2.0, >=1.2.0, or an exact version.`);if(!n)throw new y(`Generator "${t.name}" needs @redocly/client-generator ${t.requiresGenerator}; this CLI ships ${D}. Upgrade @redocly/cli if the generator is newer, or update the generator \u2014 \`redocly eject-generator <name> --update\` for an ejected file, or upgrade its package.`)}t.name in G&&b.warn(`generate-client: custom generator "${t.name}" takes over the built-in generator of the same name.
12
+ `),e.set(t.name,{run:t.run,sample:t.sample,docs:t.docs,notApplicable:t.notApplicable,options:t.options,requires:t.requires,errorModes:t.errorModes,dateTypes:t.dateTypes})}async function Ae(e,t){if(W(e))throw new y(`Remote generator modules are not supported \u2014 use a local path or a package name. Got: ${e}`);let n=e.startsWith(".")||qe(e),r=n?Pe(je(t,e)).href:e;if(n&&e.endsWith(".ts")&&!process.features.typescript)throw new y(`Generator "${e}" is TypeScript, which this Node cannot run directly \u2014 use Node 22.18, 23.6, or newer.`);let o;try{o=await import(xe(r))}catch(a){throw new y(`Could not load generator "${e}": ${a.message}`)}let s=o.default??o.generator;if(s===void 0)throw new y(`Generator module "${e}" must export a generator (a default export or a \`generator\` export built with \`defineGenerator\`).`);return s}function de(e){let t=new Set,n=new Set,r=new Map;for(let l of e.securitySchemes){let h=B(l.key,t,n);h!==l.key&&(r.set(l.key,h),z("security scheme",l.key,h,fe(l.key,t)),l.key=h)}let o=new Set(re()),s=new Set(o),a=new Set,i=new Map;for(let l of e.schemas){let h=B(l.name,s,a);h!==l.name&&(i.set(l.name,h),z("schema",l.name,h,fe(l.name,o)),l.name=h)}let c=l=>i.get(l)??pe(l),u=l=>r.get(l)??pe(l);for(let l of e.schemas)$(l.schema,c);let p=new Set(s),f=new Set,m=new Set;for(let l of e.services)for(let h of l.operations){let d=m.has(h.name);m.add(h.name);let g=h.name,j=B(h.name,p,f);if(j!==h.name){let P=d?{kind:"duplicate-operation-id"}:o.has(g)?{kind:"reserved"}:s.has(g)?{kind:"schema-collision"}:{kind:"unusable"};z("operation",g,j,P),h.specName=h.name,h.name=j}Me(h,c),h.security=h.security.map(P=>P.map(u))}}function B(e,t,n){let r=U(e),o=r,s=2;for(;t.has(o)||n.has(C(o));)o=`${r}_${s++}`;return t.add(o),n.add(C(o)),o}function le(e){for(let t of e.schemas)if(!N(t.name))throw L("schema",t.name);for(let t of e.securitySchemes)if(!N(t.key))throw L("security scheme",t.key);for(let t of e.services)for(let n of t.operations)if(!N(n.name))throw L("operation",n.name)}function L(e,t){return new Error(`Internal error: ${e} name ${JSON.stringify(t)} is not a safe identifier after sanitization.`)}function pe(e){return U(e)}function z(e,t,n,r){let o=JSON.stringify(t),s=JSON.stringify(n),a=r.kind==="duplicate-operation-id"?`two operations share the operationId ${o}; the second is emitted as ${s} \u2014 give each operation a unique operationId to control its method name`:r.kind==="schema-collision"?`${e} ${o} collides with the schema of the same name, so it is emitted as ${s} \u2014 rename the operation or the schema in the description to control its name`:r.kind==="reserved"?`${e} ${o} is a name a generated client already declares, so it is emitted as ${s} \u2014 the reserved set spans every target language, so one schema keeps one name across the SDKs you generate`:`${e} ${o} is not a usable identifier, so it is emitted as ${s}`;b.warn(`generate-client: ${a}.
13
+ `)}function fe(e,t){return t.has(e)?{kind:"reserved"}:{kind:"unusable"}}function $(e,t){switch(e.kind){case"ref":e.name=t(e.name);break;case"omit":e.base=t(e.base);break;case"array":$(e.items,t);break;case"record":$(e.value,t);break;case"object":for(let n of e.properties)$(n.schema,t);break;case"union":for(let n of e.members)$(n,t);if(e.discriminator)for(let n of e.discriminator.mapping)n.schemaName=t(n.schemaName);break;case"intersection":for(let n of e.members)$(n,t);break}}function Me(e,t){for(let n of e.pathParams)$(n.schema,t);for(let n of e.queryParams)$(n.schema,t);for(let n of e.headerParams)$(n.schema,t);for(let n of e.cookieParams)$(n.schema,t);e.requestBody&&$(e.requestBody.schema,t);for(let n of[...e.successResponses,...e.errorResponses])$(n.schema,t),n.itemSchema&&$(n.itemSchema,t)}var Ne=["get","post","put","delete","patch","head","options"];function he(e,t){if(!t.startsWith("#/"))throw new y(`External $ref not supported: ${t}`);let n=t.slice(2).split("/").map(o=>o.replace(/~1/g,"/").replace(/~0/g,"~")),r=e;for(let o of n){if(!x(r)&&!Array.isArray(r))throw new y(`Cannot resolve $ref: ${t}`);r=r[o]}if(r===void 0)throw new y(`Cannot resolve $ref: ${t}`);return r}function S(e,t){return v(t)?he(e,t.$ref):t}function M(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Ie(e){let t=e,n={};return typeof t.minimum=="number"&&(n.minimum=t.minimum),typeof t.maximum=="number"&&(n.maximum=t.maximum),typeof t.exclusiveMinimum=="number"?n.exclusiveMinimum=t.exclusiveMinimum:t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n.exclusiveMinimum=t.minimum,delete n.minimum),typeof t.exclusiveMaximum=="number"?n.exclusiveMaximum=t.exclusiveMaximum:t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n.exclusiveMaximum=t.maximum,delete n.maximum),typeof t.multipleOf=="number"&&(n.multipleOf=t.multipleOf),typeof t.minLength=="number"&&(n.minLength=t.minLength),typeof t.maxLength=="number"&&(n.maxLength=t.maxLength),typeof t.pattern=="string"&&(n.pattern=t.pattern),typeof t.minItems=="number"&&(n.minItems=t.minItems),typeof t.maxItems=="number"&&(n.maxItems=t.maxItems),t.uniqueItems===!0&&(n.uniqueItems=!0),typeof t.format=="string"&&(n.format=t.format),t.deprecated===!0&&(n.deprecated=!0),t.example!==void 0?n.example=t.example:Array.isArray(t.examples)&&t.examples.length>0&&(n.example=t.examples[0]),t.default!==void 0&&(n.default=t.default),Object.keys(n).length>0?n:void 0}function Te(e,t){let n=e.discriminator;if(!n||typeof n.propertyName!="string")return;let r=[];if(n.mapping)for(let[o,s]of Object.entries(n.mapping))r.push({value:o,schemaName:M(s)});else for(let o of t)if(v(o)){let s=M(o.$ref);r.push({value:s,schemaName:s})}if(r.length!==0)return{propertyName:n.propertyName,mapping:r}}function k(e,t){return t?{...e,metadata:t}:e}function K(e,t){return e?t?{...e,...t}:e:t}function Ge(e){return e?e.url.replace(/\{([^{}]+)\}/g,(t,n)=>e.variables?.[n]?.default??t):""}function ye(e){let t=e.info?.title??"Api",n=e.info?.version??"0.0.0",r=e.info?.description,o=Ge(e.servers?.[0]),s=(e.servers??[]).map(p=>({url:p.url,description:p.description,variables:Object.entries(p.variables??{}).map(([f,m])=>({name:f,default:m.default,description:m.description}))})),a=Be(e),i=Ue(e),c=Le(e,i),u={title:t,version:n,description:r,serverUrl:o,servers:s,services:c,schemas:a,securitySchemes:i};return de(u),Ee(c,a),le(u),u}function Ee(e,t){let n=new Map(t.map(r=>[r.name,r.schema]));for(let r of e)for(let o of r.operations){o.requestBody&&(o.requestBody.schema=A(o.requestBody.schema,"readOnly",n));for(let s of o.successResponses)s.schema=A(s.schema,"writeOnly",n)}}function Re(e){let t=e.filter(n=>n.kind!=="unknown");return t.length>0?t:[{kind:"unknown"}]}function A(e,t,n){if(e.kind==="ref"){let r=De(e,t,n,new Set);return r.length>0?{kind:"omit",base:e.name,keys:r}:e}if(e.kind==="array")return{...e,items:A(e.items,t,n)};if(e.kind==="record")return{...e,value:A(e.value,t,n)};if(e.kind==="object"){let r=e.properties.filter(o=>!o[t]).map(o=>({...o,schema:A(o.schema,t,n)}));return{...e,properties:r}}return e}function De(e,t,n,r){let o=[],s=a=>{if(a.kind==="ref"){if(r.has(a.name))return;r.add(a.name);let i=n.get(a.name);i&&s(i)}else if(a.kind==="object")for(let i of a.properties)i[t]&&!o.includes(i.name)&&o.push(i.name);else if(a.kind==="intersection")for(let i of a.members)s(i)};return s(e),o}function Ue(e){let t=e.components?.securitySchemes;if(!t)return[];let n=[];for(let[r,o]of Object.entries(t)){let s=S(e,o),a=s.type;a==="oauth2"||a==="openIdConnect"?n.push({kind:"bearer",key:r}):a==="http"&&(s.scheme??"").toLowerCase()==="bearer"?n.push({kind:"bearer",key:r}):a==="http"&&(s.scheme??"").toLowerCase()==="basic"?n.push({kind:"basic",key:r}):a==="apiKey"&&s.in==="header"&&typeof s.name=="string"?n.push({kind:"apiKeyHeader",key:r,headerName:s.name}):a==="apiKey"&&s.in==="query"&&typeof s.name=="string"?n.push({kind:"apiKeyQuery",key:r,paramName:s.name}):a==="apiKey"&&s.in==="cookie"&&typeof s.name=="string"&&(b.warn(`generate-client: security scheme "${r}" sends its credential in the Cookie header, which browsers ignore \u2014 cookie auth works only in server-side clients.
14
+ `),n.push({kind:"apiKeyCookie",key:r,cookieName:s.name}))}return n}function Ce(e,t,n){let r=e.security??t.security;if(!r)return[];let o=[];for(let s of r){let a=Object.keys(s);a.length!==0&&a.every(i=>n.has(i))&&o.push([...new Set(a)])}return o}function Be(e){let t=e.components?.schemas;return t?Object.entries(t).map(([n,r])=>{if(v(r)){let s=he(e,r.$ref);return{name:n,schema:q(s,`components.schemas.${n}`,e),description:s.description}}let o=q(r,`components.schemas.${n}`,e);return{name:n,schema:o,description:r.description}}):[]}function Le(e,t){let n=new Set(t.map(a=>a.key)),r=[],o=new Set;for(let[a,i]of Object.entries(e.paths??{})){if(!i)continue;let c=S(e,i),u=(c.parameters??[]).map(p=>ge(S(e,p),`paths.${a}.parameters`,e));for(let p of Ne){let f=c[p];f&&(r.push({method:p,path:a,operation:f,pathLevelParams:u}),f.operationId&&o.add(f.operationId))}}return[{name:"Default",operations:r.map(a=>{let i=a.operation.operationId??_e(ze(a.method,a.path),o);return Fe(a.method,a.path,a.operation,i,a.pathLevelParams,e,n)})}]}function ze(e,t){let n=t.split("/").filter(Boolean).map(r=>Ke(r.replace(/[{}]/g,"")));return`${e}${n.join("")}`}function Ke(e){return e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function _e(e,t){let n=e,r=2;for(;t.has(n);)n=`${e}${r++}`;return t.add(n),n}function Fe(e,t,n,r,o,s,a){let i=(n.parameters??[]).map(w=>ge(S(s,w),`paths.${t}.${e}.parameters`,s)),c=new Set,u=[];for(let w of i)c.add(`${w.in}:${w.name}`),u.push(w);for(let w of o)c.has(`${w.in}:${w.name}`)||u.push(w);let p=u.filter(w=>w.in==="path"),f=u.filter(w=>w.in==="query"),m=u.filter(w=>w.in==="header"),l=u.filter(w=>w.in==="cookie"),h=n.requestBody?He(S(s,n.requestBody),`${e} ${t}`,s):void 0,{successResponses:d,successResponseHeaders:g}=Je(n,t,s),j=Ve(n,t,s),P=Ce(n,s,a),X=n["x-redoclyPagination"],H=Xe(d);return{name:r,method:e,path:t,summary:n.summary,description:n.description,pathParams:p,queryParams:f,headerParams:m,cookieParams:l,requestBody:h,successResponses:d,...g===void 0?{}:{successResponseHeaders:g},errorResponses:j,security:P,tags:Array.isArray(n.tags)?n.tags.filter(w=>typeof w=="string"):[],...X!==void 0?{paginationExtension:X}:{},...H===void 0?{}:{sse:H}}}function Xe(e){let t=e.find(o=>o.contentType.split(";")[0].trim().toLowerCase()==="text/event-stream");if(t===void 0)return;let n=t.itemSchema&&t.itemSchema.kind!=="unknown"?t.itemSchema:t.schema.kind!=="unknown"?t.schema:void 0;if(n===void 0)return{dataKind:"text"};let r=n.kind==="object"||n.kind==="ref"||n.kind==="array"||n.kind==="record"||n.kind==="union"||n.kind==="intersection";return{eventSchema:n,dataKind:r?"json":"text"}}function ge(e,t,n){if(!e.in)throw new y(`Parameter ${e.name} at ${t} is missing "in"`);if(!["path","query","header","cookie"].includes(e.in))throw new y(`Unsupported parameter location "${e.in}" for ${e.name} at ${t}`);let r=O(e.schema,`${t}.${e.name}`,n);e.deprecated===!0&&(r={...r,metadata:K(r.metadata,{deprecated:!0})});let o={name:e.name,in:e.in,schema:r,required:!!e.required,description:e.description};if(o.in==="query"){let s=e;(s.style==="form"||s.style==="spaceDelimited"||s.style==="pipeDelimited"||s.style==="deepObject")&&(o.style=s.style),typeof s.explode=="boolean"&&(o.explode=s.explode),typeof s.allowReserved=="boolean"&&(o.allowReserved=s.allowReserved)}return o}function He(e,t,n){let r=e.content??{},o=r["application/json"]??r["application/merge-patch+json"]??r["application/x-www-form-urlencoded"]??r["multipart/form-data"]??Object.values(r)[0];if(!o)return;let s=Object.keys(r).find(i=>r[i]===o),a=O(o.schema,`${t}.requestBody`,n);return{contentType:s,schema:a,required:!!e.required,description:e.description}}function Je(e,t,n){let r=e.responses??{},o=Object.keys(r).filter(m=>/^2\d\d$/.test(m));o.length===0&&(r["2XX"]?o.push("2XX"):r.default&&o.push("default"));let s=o[0];if(!s)return{successResponses:[]};let a=r[s];if(!a)return{successResponses:[]};let i=S(n,a),c=We(i.headers,`paths.${t}.response.${s}`,n),u=i.content;if(!u)return{successResponses:[],...c===void 0?{}:{successResponseHeaders:c}};let p=s==="default"||s==="2XX"?s:Number(s),f=[];for(let[m,l]of Object.entries(u)){let h=O(l.schema,`paths.${t}.response.${s}.${m}`,n),d=l.itemSchema,g=d!==void 0?O(d,`paths.${t}.response.${s}.${m}.itemSchema`,n):void 0;f.push({contentType:m,schema:h,status:p,...g===void 0?{}:{itemSchema:g}})}return{successResponses:f,...c===void 0?{}:{successResponseHeaders:c}}}function We(e,t,n){if(!e)return;let r=[];for(let[o,s]of Object.entries(e)){let a=S(n,s),i={name:o.toLowerCase(),schema:O(a.schema===void 0?void 0:S(n,a.schema),`${t}.headers.${o}`,n)};a.required===!0&&(i.required=!0),r.push(i)}return r.length>0?r:void 0}function Ve(e,t,n){let r=e.responses??{},o=Object.keys(r).filter(i=>/^([45]\d\d|4XX|5XX)$/.test(i));Object.keys(r).some(i=>/^(2\d\d|2XX)$/.test(i))&&r.default&&o.push("default");let a=[];for(let i of o){let c=r[i];if(!c)continue;let p=S(n,c).content;if(!p)continue;let f=i==="default"||i==="4XX"||i==="5XX"?i:Number(i);for(let[m,l]of Object.entries(p)){let h=O(l.schema,`paths.${t}.response.${i}.${m}`,n);a.push({contentType:m,schema:h,status:f})}}return a}function O(e,t,n){return e===void 0||typeof e=="boolean"?{kind:"unknown"}:v(e)?{kind:"ref",name:M(e.$ref)}:q(e,t,n)}function q(e,t,n){let r=Ie(e),o=e.oneOf??e.anyOf;if(o){let i=o.map((p,f)=>v(p)?{kind:"ref",name:M(p.$ref)}:q(p,`${t}.[${f}]`,n)),c=Re(i);if(c.length===1&&c.length<i.length){let p=c[0];return{...p,description:p.description??e.description,metadata:K(r,p.metadata)}}let u=Te(e,o);return k({kind:"union",members:c,discriminator:u,description:e.description},r)}if(e.allOf){let i=e.allOf.map((u,p)=>v(u)?{kind:"ref",name:M(u.$ref)}:q(u,`${t}.allOf[${p}]`,n)),c=me(e,t,n);if(c.length>0&&i.unshift({kind:"object",properties:c}),i.length===1){let u=i[0];return{...u,description:u.description??e.description,metadata:K(r,u.metadata)}}return k({kind:"intersection",members:i,description:e.description},r)}let s=e.type;if(Array.isArray(s)){let i=s.filter(p=>p!=="null"),c=s.includes("null"),u=i.map(p=>{let f={...e,type:p};if(Array.isArray(f.enum)){let m=f.enum.filter(l=>l!==null);f.enum=m.length>0?m:void 0}return q(f,t,n)});return c&&u.push({kind:"null"}),u.length===1?u[0]:k({kind:"union",members:u,description:e.description},r)}if(e.nullable)return{kind:"union",members:[q({...e,nullable:void 0},t,n),{kind:"null"}],description:e.description};if(e.const!==void 0){let i=e.const;if(typeof i!="string"&&typeof i!="number"&&typeof i!="boolean")throw new y(`Unsupported const value at ${t}: ${JSON.stringify(i)}`);return k({kind:"literal",value:i,description:e.description},r)}if(e.enum){let i=e.enum,c=i.filter(m=>m!==null),u=c.length!==i.length;if(c.length===0)return k({kind:"null",description:e.description},r);let p=Qe(c,t),f=p==="boolean"?{kind:"scalar",scalar:"boolean",description:e.description}:{kind:"enum",values:c,scalar:p,description:e.description};return k(u?{kind:"union",members:[f,{kind:"null"}],description:e.description}:f,r)}let a=s;if(a==="null")return k({kind:"null",description:e.description},r);if(a==="array"){let i=e.items,c=O(i,`${t}.items`,n);return k({kind:"array",items:c,description:e.description},r)}if(a==="object"||e.properties||e.additionalProperties){let i=me(e,t,n),c=e.additionalProperties;if(i.length===0&&c!==!1){let u=O(c,`${t}.additionalProperties`,n);return k({kind:"record",value:u,description:e.description},r)}return k({kind:"object",properties:i,description:e.description},r)}return k(a==="string"||a==="number"||a==="integer"||a==="boolean"?{kind:"scalar",scalar:a,description:e.description}:{kind:"unknown",description:e.description},r)}function Qe(e,t){let n=!1,r=!1,o=!1;for(let s of e)if(typeof s=="string")n=!0;else if(typeof s=="number")r=!0;else if(typeof s=="boolean")o=!0;else throw new y(`Unsupported enum value type at ${t}: ${JSON.stringify(s)}`);return n&&!r&&!o?"string":r&&!n&&!o?"number":o&&!n&&!r?"boolean":"string"}function Ye(e){return!(e.openapi??"").startsWith("3.0")}function me(e,t,n){let r=e.properties??{},o=new Set(e.required??[]),s=Ye(n);return Object.entries(r).map(([a,i])=>{let c=i,u=v(i)&&!s;return u&&c.readOnly===!0&&b.warn(`generate-client: "${a}" declares readOnly beside a $ref, which OpenAPI ${n.openapi} ignores \u2014 the property stays in request bodies. Inline the schema, wrap the $ref in allOf, or move the description to OpenAPI 3.1.
15
15
  `),u&&c.writeOnly===!0&&b.warn(`generate-client: "${a}" declares writeOnly beside a $ref, which OpenAPI ${n.openapi} ignores \u2014 the property stays in responses. Inline the schema, wrap the $ref in allOf, or move the description to OpenAPI 3.1.
16
- `),{name:a,schema:O(i,`${t}.${a}`,n),required:o.has(a),description:i.description,...c.readOnly===!0&&!u?{readOnly:!0}:{},...c.writeOnly===!0&&!u?{writeOnly:!0}:{}}})}function we(e){let t=_(e),n={...t};delete n.swagger,delete n.host,delete n.basePath,delete n.schemes,delete n.definitions,delete n.securityDefinitions,delete n.consumes,delete n.produces,delete n.parameters,delete n.responses,n.openapi="3.0.3";let r=Ze(t);return r&&(n.servers=r),n.components=et(t),n.paths=ot(t.paths??{},t.consumes??void 0,t.produces??void 0),n}function Ze(e){let t=e.host,n=e.basePath??"",r=(e.schemes??["https"])[0]??"https";if(t)return[{url:`${r}://${t}${n}`}]}function et(e){let t={};e.definitions&&(t.schemas=e.definitions),e.parameters&&(t.parameters=Object.fromEntries(Object.entries(e.parameters).map(([r,o])=>[r,F(o)]))),e.responses&&(t.responses=$e(e.responses,void 0));let n=e.securityDefinitions;if(n){let r={};for(let[o,s]of Object.entries(n))r[o]=tt(s);t.securitySchemes=r}return t}function tt(e){switch(e.type){case"basic":return{type:"http",scheme:"basic"};case"apiKey":return{type:"apiKey",name:e.name,in:e.in};case"oauth2":{let t=e.flow==="accessCode"?"authorizationCode":e.flow==="application"?"clientCredentials":e.flow,n={scopes:e.scopes??{}};return e.authorizationUrl&&(n.authorizationUrl=e.authorizationUrl),e.tokenUrl&&(n.tokenUrl=e.tokenUrl),{type:"oauth2",flows:{[t]:n}}}default:return e}}function _(e){if(Array.isArray(e))return e.map(_);if(x(e)){let t={};for(let[n,r]of Object.entries(e))n==="$ref"&&typeof r=="string"?t.$ref=r.replace("#/definitions/","#/components/schemas/").replace("#/parameters/","#/components/parameters/").replace("#/responses/","#/components/responses/"):t[n]=_(r);return t}return e}var nt="application/json",rt="application/json",be=new Set(["name","in","required","description","deprecated","allowEmptyValue","collectionFormat"]);function ot(e,t,n){let r={};for(let[o,s]of Object.entries(e)){let a=s,i={};for(let[c,u]of Object.entries(a)){if(c==="parameters"&&Array.isArray(u)){i.parameters=u.map(F);continue}if(!st(c)){i[c]=u;continue}i[c]=it(u,t,n)}r[o]=i}return r}function st(e){return["get","put","post","delete","options","head","patch"].includes(e.toLowerCase())}function it(e,t,n){let r=e.consumes??t,o=e.produces??n,s=e.parameters??[],a=s.find(f=>f.in==="body"),i=s.filter(f=>f.in==="formData"),c=s.filter(f=>f.in!=="body"&&f.in!=="formData").map(F),u={...e,parameters:c};delete u.consumes,delete u.produces;let p=r?.[0]??nt;if(a)u.requestBody={required:!!a.required,content:{[p]:{schema:a.schema}}};else if(i.length>0){let f={},m=[];for(let d of i)f[d.name]=at(d),d.required&&m.push(d.name);let l={type:"object",properties:f};m.length>0&&(l.required=m);let h=r?.find(d=>d==="multipart/form-data")??r?.[0]??"application/x-www-form-urlencoded";u.requestBody={required:m.length>0,content:{[h]:{schema:l}}}}return e.responses&&(u.responses=$e(e.responses,o)),u}function F(e){if(e.$ref!==void 0||e.in==="body"||e.in==="formData")return e;let t={},n={};for(let[r,o]of Object.entries(e))be.has(r)?t[r]=o:n[r]=o;if(t.schema=n,delete t.collectionFormat,e.in==="query"&&n.type==="array"){let r=e.collectionFormat??"csv";r!=="multi"&&(t.style=r==="ssv"?"spaceDelimited":r==="pipes"?"pipeDelimited":"form",t.explode=!1)}return t}function at(e){let t={};for(let[n,r]of Object.entries(e))be.has(n)||(t[n]=r);return t}function $e(e,t){let n=t?.[0]??rt,r={};for(let[o,s]of Object.entries(e)){let a=s;if(a.schema===void 0){r[o]=a;continue}let{schema:i,...c}=a;r[o]={...c,content:{[n]:{schema:i}}}}return r}async function ke(e,t,n){let r=t??await G({}),o=await Z({ref:e,config:r,collectSpecData:n}),s=await G({rules:{struct:"error"}}),a=await ee({externalRefResolver:new Q,document:o.bundle,config:s}),i=[...o.problems,...a].filter(u=>u.severity==="error");if(i.length>0){let u=i.map(p=>`- ${p.message} (at ${p.location?.[0]?.pointer??e})`).join(`
16
+ `),{name:a,schema:O(i,`${t}.${a}`,n),required:o.has(a),description:i.description,...c.readOnly===!0&&!u?{readOnly:!0}:{},...c.writeOnly===!0&&!u?{writeOnly:!0}:{}}})}function we(e){let t=_(e),n={...t};delete n.swagger,delete n.host,delete n.basePath,delete n.schemes,delete n.definitions,delete n.securityDefinitions,delete n.consumes,delete n.produces,delete n.parameters,delete n.responses,n.openapi="3.0.3";let r=Ze(t);return r&&(n.servers=r),n.components=et(t),n.paths=ot(t.paths??{},t.consumes??void 0,t.produces??void 0),n}function Ze(e){let t=e.host,n=e.basePath??"",r=(e.schemes??["https"])[0]??"https";if(t)return[{url:`${r}://${t}${n}`}]}function et(e){let t={};e.definitions&&(t.schemas=e.definitions),e.parameters&&(t.parameters=Object.fromEntries(Object.entries(e.parameters).map(([r,o])=>[r,F(o)]))),e.responses&&(t.responses=$e(e.responses,void 0));let n=e.securityDefinitions;if(n){let r={};for(let[o,s]of Object.entries(n))r[o]=tt(s);t.securitySchemes=r}return t}function tt(e){switch(e.type){case"basic":return{type:"http",scheme:"basic"};case"apiKey":return{type:"apiKey",name:e.name,in:e.in};case"oauth2":{let t=e.flow==="accessCode"?"authorizationCode":e.flow==="application"?"clientCredentials":e.flow,n={scopes:e.scopes??{}};return e.authorizationUrl&&(n.authorizationUrl=e.authorizationUrl),e.tokenUrl&&(n.tokenUrl=e.tokenUrl),{type:"oauth2",flows:{[t]:n}}}default:return e}}function _(e){if(Array.isArray(e))return e.map(_);if(x(e)){let t={};for(let[n,r]of Object.entries(e))n==="$ref"&&typeof r=="string"?t.$ref=r.replace("#/definitions/","#/components/schemas/").replace("#/parameters/","#/components/parameters/").replace("#/responses/","#/components/responses/"):t[n]=_(r);return t}return e}var nt="application/json",rt="application/json",be=new Set(["name","in","required","description","deprecated","allowEmptyValue","collectionFormat"]);function ot(e,t,n){let r={};for(let[o,s]of Object.entries(e)){let a=s,i={};for(let[c,u]of Object.entries(a)){if(c==="parameters"&&Array.isArray(u)){i.parameters=u.map(F);continue}if(!st(c)){i[c]=u;continue}i[c]=it(u,t,n)}r[o]=i}return r}function st(e){return["get","put","post","delete","options","head","patch"].includes(e.toLowerCase())}function it(e,t,n){let r=e.consumes??t,o=e.produces??n,s=e.parameters??[],a=s.find(f=>f.in==="body"),i=s.filter(f=>f.in==="formData"),c=s.filter(f=>f.in!=="body"&&f.in!=="formData").map(F),u={...e,parameters:c};delete u.consumes,delete u.produces;let p=r?.[0]??nt;if(a)u.requestBody={required:!!a.required,content:{[p]:{schema:a.schema}}};else if(i.length>0){let f={},m=[];for(let d of i)f[d.name]=at(d),d.required&&m.push(d.name);let l={type:"object",properties:f};m.length>0&&(l.required=m);let h=r?.find(d=>d==="multipart/form-data")??r?.[0]??"application/x-www-form-urlencoded";u.requestBody={required:m.length>0,content:{[h]:{schema:l}}}}return e.responses&&(u.responses=$e(e.responses,o)),u}function F(e){if(e.$ref!==void 0||e.in==="body"||e.in==="formData")return e;let t={},n={};for(let[r,o]of Object.entries(e))be.has(r)?t[r]=o:n[r]=o;if(t.schema=n,delete t.collectionFormat,e.in==="query"&&n.type==="array"){let r=e.collectionFormat??"csv";r!=="multi"&&(t.style=r==="ssv"?"spaceDelimited":r==="pipes"?"pipeDelimited":"form",t.explode=!1)}return t}function at(e){let t={};for(let[n,r]of Object.entries(e))be.has(n)||(t[n]=r);return t}function $e(e,t){let n=t?.[0]??rt,r={};for(let[o,s]of Object.entries(e)){let a=s;if(a.schema===void 0){r[o]=a;continue}let{schema:i,...c}=a;r[o]={...c,content:{[n]:{schema:i}}}}return r}async function ke(e,t,n){let r=t??await R({}),o=await Z({ref:e,config:r,collectSpecData:n}),s=await R({rules:{struct:"error"}}),a=await ee({externalRefResolver:new Q,document:o.bundle,config:s}),i=[...o.problems,...a].filter(u=>u.severity==="error");if(i.length>0){let u=i.map(p=>`- ${p.message} (at ${p.location?.[0]?.pointer??e})`).join(`
17
17
  `);throw new Error(`The API description has ${i.length} error(s):
18
18
  ${u}`)}let c=o.bundle.parsed;return{document:c,version:Y(c)}}var lt=["Generated by @redocly/client-generator \u2014 do not edit by hand.","Source: OpenAPI description. Re-run `redocly generate-client` to update."];function mt(e,t){let n=[],r=new Set,o=E(ve(t.outputPath)),{dir:s,name:a,ext:i}=ft(t.outputPath),c={path:t.outputPath,dir:s,stem:a,ext:i},u=lt,p=!1;for(let f of t.generators){let m=t.registry.get(f),l={model:e,output:c,banner:u,outputMode:t.outputMode,emit:t.emit,pagination:t.pagination,selected:t.generators,options:t.generatorOptions?.get(f)??{}},h;try{t.emit.docs===!0&&m.docs!==void 0?(h=[...m.run(l),...m.docs(l)],p=!0):h=m.run(l)}catch(d){let g=d instanceof Error?d.message:String(d);throw new Error(`Generator "${f}" failed: ${g}`)}if(!Array.isArray(h)||h.some(d=>typeof d?.path!="string"||d.path===""||typeof d.content!="string"))throw new Error(`Generator "${f}" failed: run() must return an array of { path, content } files.`);for(let d of h){let g=E(o,d.path);if(g!==o&&!g.startsWith(o+dt))throw new Error(`Generator "${f}" failed: file path escapes the output directory: ${d.path}`);if(r.has(g))throw new Error(`Generator conflict: ${d.path} already emitted by an earlier generator`);r.add(g),n.push({path:g,content:d.content})}}return t.emit.docs===!0&&!p&&b.warn(`generate-client: docs is on, but no selected generator writes documentation (${t.generators.join(", ")}).
19
19
  `),n}function ht(e){for(let t of e.services)for(let n of t.operations){let r=new Set,o=new Set;for(let s of[...n.pathParams,...n.queryParams,...n.headerParams,...n.cookieParams])r.has(s.name)&&o.add(s.name),r.add(s.name);o.size!==0&&b.warn(`generate-client: operation "${n.specName??n.name}" uses ${[...o].map(s=>`"${s}"`).join(", ")} in more than one parameter location. Every SDK sends both, and the SDKs whose methods take one argument per parameter give the later one a suffixed name \u2014 rename it in the description to choose the name yourself.
20
- `)}}function yt(e,t,n,r,o,s,a){let i=[],c=new Set;for(let u of te(t.services)){let p=gt(e,u.path,u.method);if(c.has(p))continue;c.add(p);let f=r.map(m=>o.get(m)?.sample?.(u,{model:t,emit:n,outputPath:s,pagination:a})).filter(m=>m!==void 0);f.length>0&&i.push({target:p,update:{"x-codeSamples":f}})}if(i.length!==0)return V({overlay:"1.0.0",info:{title:`Code samples for ${t.title}`,version:t.version},actions:i})}function gt(e,t,n){let r=a=>`['${a.replaceAll("\\","\\\\").replaceAll("'","\\'")}']`,o=e.paths?.[t];return`${v(o)&&o.$ref.startsWith("#/")?"$"+o.$ref.slice(2).split("/").map(J).map(r).join(""):`$.paths${r(t)}`}.${n}`}async function nn(e){if(e.output.split(/[\\/]/).some(d=>d==="undefined"||d==="null"))throw new Error(`output path "${e.output}" contains a literal "undefined" or "null" segment \u2014 this looks like an interpolation bug in the caller`);if(e.setup&&/^[a-z][a-z0-9+.-]+:/i.test(e.setup))throw new y(`setup must be a local file path \u2014 remote setup modules are not supported (got: ${e.setup})`);let t=E(e.output),{document:n,version:r}=await ke(e.api,e.config,e.collectSpecData),o=r==="oas2"?we(n):n,s=ye(o);ht(s);let a;if(e.setup){let{bakeSetup:d}=await import("./CQMMUWIJ.js"),g=E(e.configDir??process.cwd(),e.setup);a=d(await ut(g,"utf-8"))}let i=e.generators?.length?e.generators:["typescript"],{selected:c,registry:u}=await ce(i,{customGenerators:e.customGenerators,configDir:e.configDir}),p=ne(s,e.pagination),f={serverUrl:e.serverUrl,argsStyle:e.argsStyle,errorMode:e.errorMode,dateType:e.dateType,mockData:e.mockData,mockSeed:e.mockSeed,queryKeyPrefix:e.queryKeyPrefix,telemetry:e.telemetry,setup:a,runtime:e.runtime,importExt:e.importExt,goPackage:e.goPackage,pagination:p,docs:e.docs,docsFrontmatter:e.docsFrontmatter};se(c,f,u,e.outputMode);let m=ie(c,u,e.options),l=mt(s,{outputPath:t,outputMode:e.outputMode??"single",emit:f,pagination:p,generators:c,generatorOptions:m,registry:u});if(e.codeSamples===!0){let d=yt(n,s,f,c,u,t,p);d!==void 0&&l.push({path:t.replace(/\.[^.]+$/,".code-samples.yaml"),content:d})}let h=[];for(let d of l)await ct(ve(d.path),{recursive:!0}),await pt(d.path,d.content,"utf-8"),h.push({path:d.path,bytes:Buffer.byteLength(d.content,"utf-8")});return{outputPath:t,bytes:h.reduce((d,g)=>d+g.bytes,0),files:h}}export{T as a,se as b,mt as c,nn as d};
20
+ `)}}function yt(e,t,n,r,o,s,a){let i=[],c=new Set;for(let u of te(t.services)){let p=gt(e,u.path,u.method);if(c.has(p))continue;c.add(p);let f=r.map(m=>o.get(m)?.sample?.(u,{model:t,emit:n,outputPath:s,pagination:a})).filter(m=>m!==void 0);f.length>0&&i.push({target:p,update:{"x-codeSamples":f}})}if(i.length!==0)return V({overlay:"1.0.0",info:{title:`Code samples for ${t.title}`,version:t.version},actions:i})}function gt(e,t,n){let r=a=>`['${a.replaceAll("\\","\\\\").replaceAll("'","\\'")}']`,o=e.paths?.[t];return`${v(o)&&o.$ref.startsWith("#/")?"$"+o.$ref.slice(2).split("/").map(J).map(r).join(""):`$.paths${r(t)}`}.${n}`}async function nn(e){if(e.output.split(/[\\/]/).some(d=>d==="undefined"||d==="null"))throw new Error(`output path "${e.output}" contains a literal "undefined" or "null" segment \u2014 this looks like an interpolation bug in the caller`);if(e.setup&&/^[a-z][a-z0-9+.-]+:/i.test(e.setup))throw new y(`setup must be a local file path \u2014 remote setup modules are not supported (got: ${e.setup})`);let t=E(e.output),{document:n,version:r}=await ke(e.api,e.config,e.collectSpecData),o=r==="oas2"?we(n):n,s=ye(o);ht(s);let a;if(e.setup){let{bakeSetup:d}=await import("./CQMMUWIJ.js"),g=E(e.configDir??process.cwd(),e.setup);a=d(await ut(g,"utf-8"))}let i=e.generators?.length?e.generators:["typescript"],{selected:c,registry:u}=await ce(i,{customGenerators:e.customGenerators,configDir:e.configDir}),p=ne(s,e.pagination),f={serverUrl:e.serverUrl,argsStyle:e.argsStyle,errorMode:e.errorMode,dateType:e.dateType,mockData:e.mockData,mockSeed:e.mockSeed,queryKeyPrefix:e.queryKeyPrefix,telemetry:e.telemetry,setup:a,runtime:e.runtime,importExt:e.importExt,goPackage:e.goPackage,pagination:p,docs:e.docs,docsFrontmatter:e.docsFrontmatter};se(c,f,u,e.outputMode);let m=ie(c,u,e.options),l=mt(s,{outputPath:t,outputMode:e.outputMode??"single",emit:f,pagination:p,generators:c,generatorOptions:m,registry:u});if(e.codeSamples===!0){let d=yt(n,s,f,c,u,t,p);d!==void 0&&l.push({path:t.replace(/\.[^.]+$/,".code-samples.yaml"),content:d})}let h=[];for(let d of l)await ct(ve(d.path),{recursive:!0}),await pt(d.path,d.content,"utf-8"),h.push({path:d.path,bytes:Buffer.byteLength(d.content,"utf-8")});return{outputPath:t,bytes:h.reduce((d,g)=>d+g.bytes,0),files:h}}export{G as a,se as b,mt as c,nn as d};