@redocly/cli 2.47.0 → 2.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/lib/chunks/{TEQA5OM7.js → 2GJPOM5H.js} +1 -1
  2. package/lib/chunks/{W2NJCZOS.js → 3CR6IHZV.js} +1 -1
  3. package/lib/chunks/3JJEI7CJ.js +456 -0
  4. package/lib/chunks/{QRD3XQNU.js → 3M6ARSHY.js} +1 -1
  5. package/lib/chunks/3X52NOC5.js +7 -0
  6. package/lib/chunks/46OWEERC.js +19 -0
  7. package/lib/chunks/4IA3ZTGK.js +20 -0
  8. package/lib/chunks/{TO2KJ36N.js → 5E3L4HJN.js} +1 -1
  9. package/lib/chunks/5EG7SNNU.js +177 -0
  10. package/lib/chunks/5L3FH5WQ.js +16 -0
  11. package/lib/chunks/5L5WOOWA.js +7 -0
  12. package/lib/chunks/5ZEWVWOC.js +14 -0
  13. package/lib/chunks/6O3ZHZZ2.js +7 -0
  14. package/lib/chunks/{KEUH3PST.js → AJZAID3R.js} +1 -1
  15. package/lib/chunks/BD5JG7YZ.js +7 -0
  16. package/lib/chunks/{B6HS7CVY.js → BEOYUN4L.js} +48 -48
  17. package/lib/chunks/CF5YCHNA.js +7 -0
  18. package/lib/chunks/D27SC2KR.js +90 -0
  19. package/lib/chunks/{SN2EC2ZR.js → DYAVWTVD.js} +1 -1
  20. package/lib/chunks/E35Q6YJN.js +7 -0
  21. package/lib/chunks/EB2V4VMP.js +7 -0
  22. package/lib/chunks/{QVV2EKMT.js → FL3CA53Z.js} +1 -1
  23. package/lib/chunks/FVBSRIWC.js +18 -0
  24. package/lib/chunks/G2XR6TRU.js +67 -0
  25. package/lib/chunks/G3YJARF7.js +57 -0
  26. package/lib/chunks/GA6WYGKY.js +7 -0
  27. package/lib/chunks/GBRES7WG.js +5400 -0
  28. package/lib/chunks/GHPAE4DZ.js +20 -0
  29. package/lib/chunks/{SL6AH3N2.js → GJRJZYC4.js} +1 -1
  30. package/lib/chunks/{REBHK2JR.js → GOJNDGZT.js} +1 -1
  31. package/lib/chunks/HJYFWIVE.js +9 -0
  32. package/lib/chunks/HLZCPNF7.js +16 -0
  33. package/lib/chunks/KIQI3UBS.js +177 -0
  34. package/lib/chunks/KNPQJVYA.js +14 -0
  35. package/lib/chunks/L3TZNNJJ.js +13 -0
  36. package/lib/chunks/{34J2ZJDK.js → LUC2DWUK.js} +1 -1
  37. package/lib/chunks/MBHFDTYI.js +78 -0
  38. package/lib/chunks/NB54XRRU.js +10 -0
  39. package/lib/chunks/NSIQWNYL.js +7 -0
  40. package/lib/chunks/NWMTC4AN.js +7 -0
  41. package/lib/chunks/PFYPTG4G.js +7 -0
  42. package/lib/chunks/{5NR4DJW4.js → PVM7EVWV.js} +1 -1
  43. package/lib/chunks/Q5FNL2RM.js +22 -0
  44. package/lib/chunks/QW5MTOU2.js +22 -0
  45. package/lib/chunks/REFX2EKS.js +13 -0
  46. package/lib/chunks/S4GQKQ5G.js +7 -0
  47. package/lib/chunks/SGBB4RNM.js +11 -0
  48. package/lib/chunks/{YQW463Z7.js → SPPRUUK3.js} +1 -1
  49. package/lib/chunks/SQVG3CEM.js +8 -0
  50. package/lib/chunks/TSB6PODJ.js +13 -0
  51. package/lib/chunks/U2A6GEAN.js +42 -0
  52. package/lib/chunks/UDBINQ2S.js +42 -0
  53. package/lib/chunks/UKSQ7B5H.js +2268 -0
  54. package/lib/chunks/{QL4V2A4A.js → V3JMSQFP.js} +1 -1
  55. package/lib/chunks/VWSPU27A.js +30 -0
  56. package/lib/chunks/W62VKXGM.js +26 -0
  57. package/lib/chunks/WIZYCYZG.js +7 -0
  58. package/lib/chunks/XDK4JK3V.js +9 -0
  59. package/lib/chunks/{5PXRDPHV.js → YJGI7CZ2.js} +1 -1
  60. package/lib/chunks/YQS3OX36.js +11 -0
  61. package/lib/chunks/{S4MX7JPH.js → Z2AXUXMK.js} +1 -1
  62. package/lib/chunks/ZBL4IVEW.js +11 -0
  63. package/lib/chunks/ZGMTMVBB.js +19 -0
  64. package/lib/chunks/{RIFZSMUA.js → ZVUMPMHU.js} +1 -1
  65. package/lib/eject-assets/AGENTS.md +137 -0
  66. package/lib/eject-assets/generators/cli/docs.ts +224 -0
  67. package/lib/eject-assets/generators/cli/engine-source.ts +21 -0
  68. package/lib/eject-assets/generators/cli/index.ts +90 -0
  69. package/lib/eject-assets/generators/cli/render.ts +348 -0
  70. package/lib/eject-assets/generators/go/client.ts +57 -0
  71. package/lib/eject-assets/generators/go/descriptor.ts +41 -0
  72. package/lib/eject-assets/generators/go/index.ts +336 -0
  73. package/lib/eject-assets/generators/go/models.ts +179 -0
  74. package/lib/eject-assets/generators/go/naming.ts +49 -0
  75. package/lib/eject-assets/generators/go/operations.ts +296 -0
  76. package/lib/eject-assets/generators/go/pagination.ts +194 -0
  77. package/lib/eject-assets/generators/go/types.ts +60 -0
  78. package/lib/eject-assets/generators/mock/faker.ts +214 -0
  79. package/lib/eject-assets/generators/mock/index.ts +35 -0
  80. package/lib/eject-assets/generators/mock/render.ts +282 -0
  81. package/lib/eject-assets/generators/mock/sample.ts +316 -0
  82. package/lib/eject-assets/generators/mock/values.ts +63 -0
  83. package/lib/eject-assets/generators/php/client.ts +63 -0
  84. package/lib/eject-assets/generators/php/descriptor.ts +58 -0
  85. package/lib/eject-assets/generators/php/index.ts +237 -0
  86. package/lib/eject-assets/generators/php/models.ts +275 -0
  87. package/lib/eject-assets/generators/php/naming.ts +51 -0
  88. package/lib/eject-assets/generators/php/operations.ts +232 -0
  89. package/lib/eject-assets/generators/php/pagination.ts +133 -0
  90. package/lib/eject-assets/generators/php/types.ts +148 -0
  91. package/lib/eject-assets/generators/python/client.ts +123 -0
  92. package/lib/eject-assets/generators/python/descriptor.ts +52 -0
  93. package/lib/eject-assets/generators/python/index.ts +251 -0
  94. package/lib/eject-assets/generators/python/models.ts +242 -0
  95. package/lib/eject-assets/generators/python/naming.ts +46 -0
  96. package/lib/eject-assets/generators/python/operations.ts +147 -0
  97. package/lib/eject-assets/generators/python/pagination.ts +128 -0
  98. package/lib/eject-assets/generators/python/types.ts +54 -0
  99. package/lib/eject-assets/generators/swr/index.ts +37 -0
  100. package/lib/eject-assets/generators/swr/render.ts +78 -0
  101. package/lib/eject-assets/generators/tanstack-query/index.ts +48 -0
  102. package/lib/eject-assets/generators/tanstack-query/render.ts +346 -0
  103. package/lib/eject-assets/generators/transformers/index.ts +46 -0
  104. package/lib/eject-assets/generators/transformers/render.ts +506 -0
  105. package/lib/eject-assets/generators/typescript/banner.ts +35 -0
  106. package/lib/eject-assets/generators/typescript/client.ts +254 -0
  107. package/lib/eject-assets/generators/typescript/descriptor.ts +137 -0
  108. package/lib/eject-assets/generators/typescript/index.ts +101 -0
  109. package/lib/eject-assets/generators/typescript/inline-runtime.ts +135 -0
  110. package/lib/eject-assets/generators/typescript/operation-signature.ts +62 -0
  111. package/lib/eject-assets/generators/typescript/operation-types.ts +17 -0
  112. package/lib/eject-assets/generators/typescript/operations.ts +524 -0
  113. package/lib/eject-assets/generators/typescript/response-headers.ts +74 -0
  114. package/lib/eject-assets/generators/typescript/type-guards.ts +159 -0
  115. package/lib/eject-assets/generators/typescript/types.ts +172 -0
  116. package/lib/eject-assets/generators/zod/index.ts +32 -0
  117. package/lib/eject-assets/generators/zod/schemas.ts +456 -0
  118. package/lib/eject-assets/skills/cli-generator/SKILL.md +121 -0
  119. package/lib/eject-assets/skills/client-generators/SKILL.md +142 -0
  120. package/lib/eject-assets/skills/go-generator/SKILL.md +96 -0
  121. package/lib/eject-assets/skills/mock-generator/SKILL.md +50 -0
  122. package/lib/eject-assets/skills/php-generator/SKILL.md +112 -0
  123. package/lib/eject-assets/skills/python-generator/SKILL.md +110 -0
  124. package/lib/eject-assets/skills/swr-generator/SKILL.md +50 -0
  125. package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
  126. package/lib/eject-assets/skills/transformers-generator/SKILL.md +47 -0
  127. package/lib/eject-assets/skills/typescript-generator/SKILL.md +95 -0
  128. package/lib/eject-assets/skills/zod-generator/SKILL.md +54 -0
  129. package/lib/index.js +272 -193
  130. package/package.json +1 -1
  131. package/lib/chunks/PIJLRHNN.js +0 -8
  132. package/lib/chunks/Y5HLCNL5.js +0 -2542
@@ -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,b,c,d,e}from"./GHPAE4DZ.js";import"./NSIQWNYL.js";import"./UKSQ7B5H.js";import"./YQS3OX36.js";import"./GBRES7WG.js";import"./PFYPTG4G.js";import"./BEOYUN4L.js";import"./NEWT5A6S.js";import"./HJYFWIVE.js";import"./RFWIIJFG.js";export{e as phpDocs,c as phpGenerator,d as phpSample,a as phpType,b as renderPhpModels};
@@ -0,0 +1,90 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{b as D,g as L}from"./YQS3OX36.js";import{a as h,c as F,d as J,e as U}from"./GBRES7WG.js";import{a as _,d as G,e as x,f as R,h as K,i as O,j as Q,k as b,l as V,m as z}from"./NB54XRRU.js";import{n as H}from"./HJYFWIVE.js";import{join as Se}from"node:path";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 N(e){return e.filter(t=>t.length>0).join(`
8
+
9
+ `)+`
10
+ `}function v(e){let t=["/**",` * ${O(`${e.title} (v${e.version})`)}`];if(e.description)for(let n of z(O(e.description)))t.push(` * ${n}`.replace(/ +$/,""));return t.push(" */"),t.join(`
11
+ `)}function P(e){return e.contentType==="multipart/form-data"&&e.schema.kind==="object"}function k(e){let t=new Map(e.pathParams.map(r=>[r.name,r])),n=[];for(let r of e.path.matchAll(/\{([^{}]+)\}/g)){let s=t.get(r[1]);s!==void 0&&n.push(s)}return n}function W(e){let t=k(e),n=e.queryParams.length>0,r=!!e.requestBody,s=e.headerParams.length>0,o=e.cookieParams.length>0;return{hasQuery:n,hasBody:r,hasHeaders:s,hasCookies:o,hasInputs:t.length>0||n||r||s||o,varsRequired:t.length>0||e.queryParams.some(i=>i.required)||(e.requestBody?.required??!1)||e.headerParams.some(i=>i.required)||e.cookieParams.some(i=>i.required),variablesTypeName:`${b(e.name)}Variables`}}var Te=" ";function Pe(e,t=[]){let n=H(e,{schemas:t});return n==="integer"?"number":n}function X(e,t=[]){let n=Y(e,t);if(n.length!==0)return n.map(r=>({name:r.name,key:r.key,type:r.type}))}function C(e,t=[],n=""){let r=n+Te,s=Y(e,t).map(o=>`${r}${o.key}${o.required===!0?"":"?"}: ${o.type};`);return s.length===0?"{}":`{
12
+ ${s.join(`
13
+ `)}
14
+ ${n}}`}function Y(e,t){let n=new Set;return(e??[]).map(r=>({...r,key:R(V(r.name),n),type:Pe(r.schema,t)}))}var ee=" ";function g(e,t,n){let r=Q(e,t);return r===void 0?[]:[`${n}/**`,...O(r).split(`
15
+ `).map(s=>`${n} * ${s}`.replace(/ +$/,"")),`${n} */`]}function Z(e){return typeof e=="string"?JSON.stringify(e):String(e)}function ke(e,t,n){switch(e){case"string":return t?.format==="binary"?"Blob":n==="Date"&&(t?.format==="date-time"||t?.format==="date")?"Date":"string";case"number":case"integer":return"number";case"boolean":return"boolean"}}function E(e){return e.kind==="union"||e.kind==="intersection"||e.kind==="enum"&&e.values.length>1}function l(e,t="string",n=""){switch(e.kind){case"scalar":return ke(e.scalar,e.metadata,t);case"ref":return e.name;case"literal":return Z(e.value);case"enum":return e.values.map(Z).join(" | ");case"null":return"null";case"unknown":return"unknown";case"array":{let r=l(e.items,t,n);return E(e.items)?`(${r})[]`:`${r}[]`}case"record":return`Record<string, ${l(e.value,t,n)}>`;case"object":{if(e.properties.length===0)return"{}";let r=n+ee;return`{
16
+ ${e.properties.flatMap(o=>je(o,t,r)).join(`
17
+ `)}
18
+ ${n}}`}case"union":return e.members.map(r=>{let s=l(r,t,n);return E(r)?`(${s})`:s}).join(" | ");case"intersection":return e.members.map(r=>{let s=l(r,t,n);return E(r)?`(${s})`:s}).join(" & ");case"omit":return`Omit<${e.base}, ${e.keys.map(r=>JSON.stringify(r)).join(" | ")}>`}}function je(e,t,n){let r=x(e.name),s=e.readOnly?"readonly ":"",o=e.required?"":"?",i=l(e.schema,t,n);return[...g(e.description,e.schema.metadata,n),`${n}${s}${r}${o}: ${i};`]}function xe(e){let t=e.schema;return t.kind!=="enum"||t.scalar!=="string"?[]:t.values.every(n=>typeof n=="string"&&_(n))?[`export const ${e.name} = {`,...t.values.map((n,r)=>`${ee}${n}: ${JSON.stringify(n)}${r===t.values.length-1?"":","}`),"} as const;"]:[]}function te(e,t="string"){let n=[];for(let r of e){let s=[...g(r.schema.description??r.description,r.schema.metadata,""),`export type ${r.name} = ${l(r.schema,t)};`];n.push(s.join(`
19
+ `));let o=xe(r);o.length>0&&n.push(o.join(`
20
+ `))}return n.join(`
21
+
22
+ `)}var S=" ";function w(e,t,n=""){if(P(e))return l(e.schema,t,n);switch(e.contentType){case"multipart/form-data":return"FormData";case"application/x-www-form-urlencoded":return"URLSearchParams";case"application/octet-stream":return"Blob | ArrayBuffer";default:return l(e.schema,t,n)}}function $(e,t,n=""){let r=n+S,s=e.flatMap(o=>[...g(o.description,o.schema.metadata,r),`${r}${x(o.name)}${o.required?"":"?"}: ${l(o.schema,t,r)};`]);return s.length===0?"{}":`{
23
+ ${s.join(`
24
+ `)}
25
+ ${n}}`}function B(e,t,n=""){if(e.length===0)return{type:"void",kind:"void"};let r=e.find(a=>a.contentType.toLowerCase().includes("json"));if(r)return{type:l(r.schema,t,n),kind:"json"};let s=[],o=new Set,i=!1,c=!1;for(let a of e){let u;a.contentType.startsWith("image/")||a.contentType==="application/octet-stream"?(u="Blob",i=!0):a.contentType.startsWith("text/")?(u="string",c=!0):u=l(a.schema,t,n),!o.has(u)&&(o.add(u),s.push(u))}return{type:s.join(" | "),kind:i?"blob":c?"text":"json"}}function ne(e,t,n=""){let r=new Set,s=[];for(let o of e){let i=l(o.schema,t,n);r.has(i)||(r.add(i),s.push(i))}return s}function Oe(e,t,n=""){let r=e.sse?.eventSchema;return r?l(r,t,n):"string"}function j(e,t,n,r,s,o){let i=s.has(t)?n():t;return`${o}${e}${r?"":"?"}: ${i};`}function qe(e,t){let n=new Set,r=e;for(;r.kind==="ref";){let{name:s}=r;if(n.has(s))return;n.add(s);let o=t?.find(i=>i.name===s);if(o===void 0)return;r=o.schema}return r}function re(e,t){let n=qe(e,t);if(n?.kind==="object")return n.properties.map(s=>s.name);if(n?.kind!=="intersection")return;let r=new Set;for(let s of n.members){let o=re(s,t);if(o===void 0)return;for(let i of o)r.add(i)}return[...r]}function A(e,t){let n=[...k(e),...e.queryParams,...e.headerParams,...e.cookieParams],r=(e.requestBody?.required??!1)&&e.requestBody!==void 0?re(e.requestBody.schema,t):void 0,s=r!==void 0,o=new Map;for(let c of n)o.set(c.name,(o.get(c.name)??0)+1);e.requestBody&&!s&&o.set("body",(o.get("body")??0)+1);for(let c of r??[])o.set(c,(o.get(c)??0)+1);let i=[...o].filter(([,c])=>c>1).map(([c])=>c);return i.length>0?{collisions:i}:{mergeBody:s}}function Re(e,t,n){return e.flatMap(r=>[...g(r.description,r.schema.metadata,n),`${n}${x(r.name)}${r.required?"":"?"}: ${l(r.schema,t.dateType,n)};`])}function se(e,t,n,r=""){let{dateType:s,schemaNames:o}=n,i=r+S,c=n.argsStyle==="flat"?A(e,n.schemas):void 0;if(c!==void 0&&"mergeBody"in c)return Ne(e,t,n,c.mergeBody,r);let a=[],u=k(e);return u.length>0&&a.push(j("path",`${t}Path`,()=>$(u,s,i),!0,o,i)),e.queryParams.length>0&&a.push(j("query",`${t}Query`,()=>$(e.queryParams,s,i),e.queryParams.some(m=>m.required),o,i)),e.requestBody&&a.push(j("body",`${t}Body`,()=>w(e.requestBody,s,i),e.requestBody.required,o,i)),e.headerParams.length>0&&a.push(j("headers",`${t}Headers`,()=>$(e.headerParams,s,i),e.headerParams.some(m=>m.required),o,i)),e.cookieParams.length>0&&a.push(j("cookies",`${t}Cookies`,()=>$(e.cookieParams,s,i),e.cookieParams.some(m=>m.required),o,i)),a.length===0?"{}":`{
26
+ ${a.join(`
27
+ `)}
28
+ ${r}}`}function Ne(e,t,n,r,s){let o=s+S,i=Re([...k(e),...e.queryParams,...e.headerParams,...e.cookieParams],n,o);e.requestBody&&!r&&i.push(j("body",`${t}Body`,()=>w(e.requestBody,n.dateType,o),e.requestBody.required,n.schemaNames,o));let c=n.schemaNames.has(`${t}Body`)?w(e.requestBody,n.dateType,s):`${t}Body`,a=i.length===0?"{}":`{
29
+ ${i.join(`
30
+ `)}
31
+ ${s}}`;return r?i.length===0?c:`${a} & ${c}`:a}function M(e,t,n){let r=`${b(e.name)}Result`;return t.schemaNames.has(r)?B(e.successResponses,t.dateType,n).type:r}function ve(e,t,n){let r=ne(e.errorResponses,t.dateType,n);if(r.length===0)return"unknown";let s=`${b(e.name)}Error`;return t.schemaNames.has(s)?r.join(" | "):s}function oe(e,t,n){let r=h(e.services);if(r.length===0)return"";let s=r.flatMap(o=>{let i=t.get(o.name),c=b(o.name),a=S+S,u=se(o,c,n,a),m=o.sse!==void 0,p=m?Oe(o,n.dateType,a):n.errorMode==="result"?`Result<${M(o,n,a)}, ${ve(o,n,a)}>`:M(o,n,a),f=[`${a}args: ${u};`,`${a}result: ${p};`];n.errorMode==="result"&&!m&&f.push(`${a}mode: "result";`);let y=o.successResponseHeaders;y&&y.length>0&&f.push(`${a}headers: ${C(y,n.schemas,a)};`);let d=n.pagination?.get(o.name);return d&&(f.push(`${a}item: ${l(d.itemSchema,n.dateType,a)};`),n.errorMode==="result"&&f.push(`${a}page: ${M(o,n,a)};`)),m&&f.push(`${a}kind: "sse";`),[`${S}${i}: {`,...f,`${S}};`]});return[...g("Per-operation `args`/`result` shapes (plus `kind: 'sse'` for event streams) \u2014 the\ntype-level companion of `OPERATIONS` that gives `createClient<Ops>` its typed methods.",void 0,""),"export type Ops = {",...s,"};"].join(`
32
+ `)}function ie(e,t){let{dateType:n,schemaNames:r}=t,s=b(e.name),o=e.sse!==void 0,{hasInputs:i}=W(e),c=[];if(!o){let m=`${s}Result`;if(r.has(m)||c.push(`export type ${m} = ${B(e.successResponses,n).type};`),t.errorMode==="result"){let p=ne(e.errorResponses,n),f=`${s}Error`;p.length>0&&!r.has(f)&&c.push(`export type ${f} = ${p.join(" | ")};`)}}let a=k(e);a.length>0&&!r.has(`${s}Path`)&&c.push(`export type ${s}Path = ${$(a,n)};`),e.queryParams.length>0&&!r.has(`${s}Query`)&&c.push(`export type ${s}Query = ${$(e.queryParams,n)};`),e.requestBody&&!r.has(`${s}Body`)&&c.push(`export type ${s}Body = ${w(e.requestBody,n)};`),e.headerParams.length>0&&!r.has(`${s}Headers`)&&c.push(`export type ${s}Headers = ${$(e.headerParams,n)};`);let u=e.successResponseHeaders;return u&&u.length>0&&!r.has(`${s}ResponseHeaders`)&&c.push(`export type ${s}ResponseHeaders = ${C(u,t.schemas)};`),e.cookieParams.length>0&&!r.has(`${s}Cookies`)&&c.push(`export type ${s}Cookies = ${$(e.cookieParams,n)};`),i&&!r.has(`${s}Variables`)&&c.push(`export type ${s}Variables = ${se(e,s,t)};`),c.join(`
33
+
34
+ `)}function ae(e,t){let n=new Set,r=s=>{switch(s.kind){case"ref":n.add(s.name);return;case"omit":n.add(s.base);return;case"array":r(s.items);return;case"record":r(s.value);return;case"object":for(let o of s.properties)r(o.schema);return;case"union":case"intersection":for(let o of s.members)r(o);return;default:return}};for(let s of h(e.services)){for(let i of[...s.pathParams,...s.queryParams,...s.headerParams,...s.cookieParams])r(i.schema);s.requestBody&&r(s.requestBody.schema);for(let i of s.successResponses)r(i.schema),i.itemSchema&&r(i.itemSchema);if(t.errorMode==="result")for(let i of s.errorResponses)r(i.schema);let o=t.pagination?.get(s.name);o&&r(o.itemSchema)}return[...n].filter(s=>t.schemaNames.has(s)).sort()}function I(e){let t=new Set(U),n=new Map;for(let r of h(e.services))n.set(r.name,R(r.name,t));return n}function we(e,t,n,r,s=[],o="grouped"){let i=[...e.pathParams,...e.queryParams,...e.headerParams,...e.cookieParams].map(p=>({name:p.name,in:p.in,...p.style!==void 0?{style:p.style}:{},...p.explode!==void 0?{explode:p.explode}:{},...p.allowReserved!==void 0?{allowReserved:p.allowReserved}:{}})),c=L(e,{securitySchemes:t}),u=e.sse!==void 0?"sse":B(e.successResponses,n).kind,m=X(e.successResponseHeaders,s);return{id:e.specName??e.name,method:e.method.toUpperCase(),path:e.path,...e.tags.length>0?{tags:e.tags}:{},...i.length>0?{params:i}:{},...e.requestBody?{body:{contentType:e.requestBody.contentType,...P(e.requestBody)?{multipart:!0}:{}}}:{},...u!=="json"?{responseKind:u}:{},...e.sse===void 0?{}:{sseDataKind:e.sse.dataKind},...c.length>0?{security:c}:{},...m===void 0?{}:{responseHeaders:m},...r?.has(e.name)?{pagination:r.get(e.name).spec}:{},...o==="flat"&&"collisions"in A(e,s)?{argsStyle:"grouped"}:{}}}function ce(e,t,n,r,s="grouped"){let o=h(e.services);if(o.length===0)return"";let i=o.map((a,u)=>{let m=K(we(a,e.securitySchemes,n,r,e.schemas,s));return` ${t.get(a.name)}: ${m}${u===o.length-1?"":","}`}),c=[[...g(`The wire-shape descriptor for every operation, keyed by operationId \u2014 the data the
35
+ runtime routes requests by. Also minification-safe static metadata (method, path,
36
+ tags) for cache keys, tracing span names, and request logging.`,void 0,""),"export const OPERATIONS = {",...i,"} as const satisfies Record<string, OperationDescriptor>;"].join(`
37
+ `),'export type OperationId = (typeof OPERATIONS)[keyof typeof OPERATIONS]["id"];','export type OperationPath = (typeof OPERATIONS)[keyof typeof OPERATIONS]["path"];'];return o.some(a=>a.tags.length>0)&&c.push(`export type OperationTag = Extract<(typeof OPERATIONS)[keyof typeof OPERATIONS], {
38
+ tags: readonly string[];
39
+ }>["tags"][number];`),c.join(`
40
+
41
+ `)}var Be="// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator, assembled per this API's needs) \u2500\u2500\u2500";function ue(e){let t=["types.ts","errors.ts","url.ts","parse.ts","retry.ts"];return e.multipart&&t.push("multipart.ts"),e.auth&&t.push("auth.ts"),e.setup&&t.push("setup.ts"),e.paginate&&t.push("paginate.ts"),t.push("send.ts"),e.sse&&t.push("sse.ts"),t.push("create-client.ts"),t}function me(e){return[Be,...ue(e).map(t=>J[t]),fe(e)].join(`
42
+
43
+ `)}function pe(e,t="js"){let n=[...ue(e).map(r=>({name:r,content:F[r]})),{name:"factory.ts",content:Ie(e)}];return t==="js"?n:n.map(({name:r,content:s})=>({name:r,content:s.replace(/(from '\.\/[a-z-]+)\.js'/g,"$1.ts'")}))}function Ie(e){let t=["import { createClientCore } from './create-client.js';",...e.multipart?["import { toFormData } from './multipart.js';"]:[],...e.auth?["import { resolveAuth } from './auth.js';"]:[],...e.paginate?["import { items, itemsByLink, pages, pagesByLink } from './paginate.js';"]:[],...e.sse?["import { sse } from './sse.js';"]:[],`import type {
44
+ Client,
45
+ ClientConfig,
46
+ OperationContext,
47
+ OperationDescriptor,
48
+ OpsShape,
49
+ } from './types.js';`],n=["export { ApiError, TimeoutError } from './errors.js';","export { defaultRetryOn } from './retry.js';",...e.setup?["export { mergeSetup } from './setup.js';"]:[],"export type * from './types.js';"];return[t.join(`
50
+ `),fe(e),n.join(`
51
+ `)].join(`
52
+
53
+ `)}function fe(e){let t=[...e.multipart?["serializeMultipart: toFormData"]:[],...e.auth?["resolveAuth"]:[],...e.sse?["sse"]:[],...e.paginate?["paginate: { pages, items, pagesByLink, itemsByLink }"]:[]];return`/**
54
+ * The client factory: \`createClientCore\` wired with the capabilities this API needs.
55
+ * Exported so apps can build additional instances (per-tenant, per-environment) over
56
+ * the same \`OPERATIONS\`/\`Ops\`. The trailing string params carry the wiring's literal
57
+ * unions (\`OperationId\`/\`OperationPath\`/\`OperationTag\`) into \`ctx.operation\`.
58
+ */
59
+ export function createClient<
60
+ Ops extends OpsShape,
61
+ Id extends string = string,
62
+ Path extends string = string,
63
+ Tag extends string = string,
64
+ >(
65
+ operations: Record<string, OperationDescriptor>,
66
+ config?: ClientConfig<OperationContext<Id, Path, Tag>>
67
+ ): Client<Ops, OperationContext<Id, Path, Tag>> {
68
+ return createClientCore<Ops, Id, Path, Tag>(operations, config, ${t.length>0?`{ ${t.join(", ")} }`:"{}"});
69
+ }`}function le(e){let t=new Map(e.map(s=>[s.name,s.schema])),n=[],r=new Set;for(let s of e)for(let o of Ce(s)){let i=o.union.discriminator??Ee(o.union,t);if(!i)continue;let c=new Map;for(let a of i.mapping){if(!t.has(a.schemaName))continue;let u=c.get(a.schemaName);u?u.push(a.value):c.set(a.schemaName,[a.value])}for(let[a,u]of c){let m=`is${a}`;if(r.has(m))continue;r.add(m);let p=`(value as Record<string, unknown>)[${JSON.stringify(i.propertyName)}]`,f=u.length===1?`${p} === ${JSON.stringify(u[0])}`:`([${u.map(y=>JSON.stringify(y)).join(", ")}] as readonly unknown[]).includes(${p})`;n.push(["/**",` * Narrow a \`${o.label}\` to \`${a}\` via its \`${i.propertyName}\` discriminant.`," */",`export function ${m}(value: ${o.label}): value is ${a} {`,` return ${f};`,"}"].join(`
70
+ `))}}return n.join(`
71
+
72
+ `)}function Ce(e){let t=[],n=e.schema;if(n.kind==="union"){t.push({union:n,label:e.name});for(let r of n.members)T(r,t)}else T(n,t);return t}function T(e,t){switch(e.kind){case"union":{let n=e.members.map(r=>r.kind==="ref"?r.name:void 0);n.every(r=>r!==void 0)&&t.push({union:e,label:n.join(" | ")});for(let r of e.members)T(r,t);break}case"array":T(e.items,t);break;case"record":T(e.value,t);break;case"object":for(let n of e.properties)T(n.schema,t);break;case"intersection":for(let n of e.members)T(n,t);break}}function Ee(e,t){let n=[];for(let s of e.members){if(s.kind!=="ref"||!t.get(s.name))return;n.push(s.name)}if(n.length<2)return;let r=n.map(s=>Me(t.get(s)));for(let s of Object.keys(r[0])){if(!r.every(i=>s in i))continue;let o=r.map(i=>i[s]);if(o.every(i=>typeof i=="string")&&new Set(o).size===o.length)return{propertyName:s,mapping:n.map((i,c)=>({value:o[c],schemaName:i}))}}}function Me(e){let t={},n=r=>{if(r.kind==="object")for(let s of r.properties)s.schema.kind==="literal"&&(t[s.name]=s.schema.value);else if(r.kind==="intersection")for(let s of r.members)n(s)};return n(e),t}function he(e,t={}){return be(e,t).entry}function ye(e,t){let n=h(e.services);return{multipart:n.some(r=>r.requestBody&&P(r.requestBody)),auth:e.securitySchemes.length>0||n.some(r=>r.security.length>0),sse:n.some(r=>r.sse!==void 0),setup:!!t.setup,paginate:(t.pagination??new Map).size>0}}function ge(e,t){return t.runtime!=="module"?[]:pe(ye(e,t),t.importExt??"js").map(({name:n,content:r})=>({name:n,content:`${q}
73
+
74
+ ${r.trim()}
75
+ `}))}function Ae(e,t,n){let r=e.importExt??"js",s=["OperationDescriptor",...e.setup?["ClientConfig","Middleware"]:[],...t.errorMode==="result"&&n?["Result"]:[]].sort();return[`import { createClient${e.setup?", mergeSetup":""} } from './runtime/factory.${r}';`,`import type { ${s.join(", ")} } from './runtime/types.${r}';`,`export * from './runtime/factory.${r}';`].join(`
76
+ `)}function $e(e,t,n){return be(e,t,n)}function be(e,t,n){let r=h(e.services),s=I(e),o=t.pagination??new Map,i={argsStyle:t.argsStyle??"grouped",errorMode:t.errorMode??"throw",dateType:t.dateType??"string",schemaNames:new Set(e.schemas.map(d=>d.name)),schemas:e.schemas,pagination:o},c=r.length>0?[oe(e,s,i),ce(e,s,i.dateType,o,i.argsStyle)]:["export type Ops = Record<string, never>;","export const OPERATIONS = {} as const satisfies Record<string, OperationDescriptor>;"],a=t.runtime==="module"?Ae(t,i,r.length>0):me(ye(e,t)),u=[te(e.schemas,i.dateType),le(e.schemas)].filter(d=>d.length>0).join(`
77
+
78
+ `),m=[...r.map(d=>ie(d,i)),...c].filter(d=>d.length>0).join(`
79
+
80
+ `),p=He(r,s),f=t.runtime==="module";if(n===void 0)return{entry:N([q,v(e),...f?[a]:[],[u,m].filter(d=>d.length>0).join(`
81
+
82
+ `),...f?[]:[a],de(t,i,e),p])};let y=u.length>0;return{entry:N([q,v(e),...f?[a]:[],y?De(e,i,`./${n}.schemas.${t.importExt??"js"}`):"",m,...f?[]:[a],de(t,i,e),p]),schemas:y?N([q,v(e),u]):void 0}}function De(e,t,n){let r=ae(e,t);return`${r.length>0?`import type { ${r.join(", ")} } from '${n}';
83
+ `:""}export * from '${n}';`}function de(e,t,n){let r=e.serverUrl??n.serverUrl,s=[...r!==void 0?[`serverUrl: ${G(r)}`]:[],...t.errorMode==="result"?['errorMode: "result"']:[],...t.argsStyle==="flat"?['argsStyle: "flat"']:[],'clientHeader: "redocly-client-generator"'],o=s.length>0?`{ ${s.join(", ")} }`:"{}",i=e.setup?`mergeSetup({ config: ${o} }, mergeSetup(__redoclySetup, {}))`:o,c=h(n.services),a=c.some(p=>p.tags.length>0),m=`export const client = createClient${c.length>0?`<Ops, OperationId, OperationPath, ${a?"OperationTag":"string"}>`:"<Ops>"}(OPERATIONS, ${i});`;return e.setup?`// \u2500\u2500\u2500 Baked-in setup (--setup) \u2500\u2500\u2500
84
+ const __redoclySetup: { config?: ClientConfig; middleware?: Middleware[] } = ${e.setup};
85
+ `+m:m}function He(e,t){let n=["export const { configure, use } = client;"];if(e.length===0)return n.join(`
86
+ `);let r=e.map(s=>t.get(s.name)).join(", ");return n.push(`export const { ${r} } = client;`),n.join(`
87
+ `)}var Rt=({model:e,output:t,outputMode:n,emit:r})=>{let s=ge(e,r).map(({name:o,content:i})=>({path:Se(t.dir,"runtime",o),content:i}));if(n==="split"){let{dir:o,stem:i}=t,{entry:c,schemas:a}=$e(e,r,i);return[...a===void 0?[]:[{path:Se(o,`${i}.schemas.ts`),content:a}],{path:t.path,content:c},...s]}return[{path:t.path,content:he(e,r)},...s]},Nt=({model:e,output:t,emit:n,pagination:r})=>[{path:t.path.replace(/\.[^.\\/]+$/,".typescript.md"),content:D(e,{title:`${e.title} TypeScript client reference`,frontmatter:n.docsFrontmatter===!0,language:{name:"typescript",label:"TypeScript",fence:"typescript",requires:"The client has no dependencies."},sample:s=>Le(s,{model:e,emit:n,outputPath:t.path}),paginated:new Set(r?.keys()??[])})}];function Le(e,t){let n=I(t.model).get(e.name)??e.name,s=`./${t.outputPath.replace(/^.*[\\/]/,"").replace(/\.[^.]+$/,"")}.${t.emit.importExt??"js"}`,o=e.queryParams.filter(p=>p.required),i=t.emit.argsStyle==="flat",c=e.pathParams.map(p=>`${p.name}: '<${p.name}>'`),a=o.map(p=>`${p.name}: /* \u2026 */`),u=i?[...c,...a,...e.requestBody?["/* body properties */"]:[]]:[...c.length>0?[`path: { ${c.join(", ")} }`]:[],...a.length>0?[`query: { ${a.join(", ")} }`]:[],...e.requestBody?["body: { /* \u2026 */ }"]:[]],m=u.length>0?[`{ ${u.join(", ")} }`]:[];return{lang:"typescript",label:"TypeScript SDK",source:`import { ${n} } from '${s}';
88
+
89
+ const result = await ${n}(${m.join(", ")});
90
+ `}}export{W as a,g as b,l as c,Rt as d,Nt as e,Le 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{h as a}from"./QVV2EKMT.js";import"./P26PQ2RU.js";import"./RS5PUOTT.js";import"./5NR4DJW4.js";import"./BXI4SF2U.js";import"./32XCOMOR.js";import"./B6HS7CVY.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as RedoclyOAuthClient};
7
+ import{h as a}from"./FL3CA53Z.js";import"./P26PQ2RU.js";import"./RS5PUOTT.js";import"./PVM7EVWV.js";import"./BXI4SF2U.js";import"./32XCOMOR.js";import"./BEOYUN4L.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as RedoclyOAuthClient};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{b as a,c as b,d as c}from"./MBHFDTYI.js";import"./UKSQ7B5H.js";import"./XDK4JK3V.js";import"./VWSPU27A.js";import"./YQS3OX36.js";import"./GBRES7WG.js";import"./PFYPTG4G.js";import"./BEOYUN4L.js";import"./NEWT5A6S.js";import"./NB54XRRU.js";import"./HJYFWIVE.js";import"./RFWIIJFG.js";export{b as cliDocs,a as cliGenerator,c as cliSample};
@@ -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,b,c,d,e,f}from"./46OWEERC.js";import"./SQVG3CEM.js";import"./UKSQ7B5H.js";import"./YQS3OX36.js";import"./GBRES7WG.js";import"./PFYPTG4G.js";import"./BEOYUN4L.js";import"./NEWT5A6S.js";import"./HJYFWIVE.js";import"./RFWIIJFG.js";export{f as pythonDocs,d as pythonGenerator,c as pythonOptions,e as pythonSample,a as pythonType,b as renderPythonModels};
@@ -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{c as p}from"./P26PQ2RU.js";import{a as O}from"./RS5PUOTT.js";import{a as R}from"./5NR4DJW4.js";import{a as I}from"./BXI4SF2U.js";import{G as T,I as w,O as a}from"./B6HS7CVY.js";import{e as C}from"./RFWIIJFG.js";import{Buffer as P}from"node:buffer";import y from"node:crypto";import{mkdirSync as j,existsSync as F,writeFileSync as q,readFileSync as z,rmSync as M}from"node:fs";import{homedir as H}from"node:os";import B from"node:path";var l={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function G(){return process.env.REDOCLY_DOMAIN||l.us}var U=D((o,e)=>{try{let t=e||o?.resolvedConfig.residency;return W(t)?l[t]:t?new URL(t).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:l.us}catch{throw new f}});function x(o){try{U(void 0,o)}catch{return!1}return!0}function D(o){return(...e)=>{let t=o(...e);if(!t.startsWith("https://"))throw new f;return t}}var f=class extends Error{constructor(){super("Invalid Reunite URL")}};function W(o){return typeof o=="string"&&o in l}import*as k from"node:child_process";var g=C(I(),1);var N=C(O(),1);function b(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function S(o){let e=process.env.NO_PROXY||process.env.no_proxy;if(!e)return!1;let t=e.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(t.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return t.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var _=async(o,{timeout:e,...t}={})=>{let r=b(),s=r&&!S(o),n,i=e?{connect:{timeout:e}}:{};return s?n=new g.ProxyAgent({uri:r,...i}):e&&(n=new g.Agent(i)),await fetch(o,{signal:e?AbortSignal.timeout(e):void 0,...t,dispatcher:n})};var c=class extends Error{constructor(t,r){super(t);this.status=r}status},h=class{constructor(e){this.command=e}command;sunsetWarnings=[];async request(e,t){let r={...t.headers,"user-agent":`redocly-cli/${R} ${this.command}`};try{let s=await _(e,{...t,headers:r});return this.collectSunsetWarning(s),s}catch(s){let n="Failed to fetch.";throw s.cause&&(n+=` Caused by ${s.cause.message||s.cause.name}.`),(s.code||s.cause?.code)&&(n+=` Code: ${s.code||s.cause?.code}`),new Error(n)}}collectSunsetWarning(e){let t=this.getSunsetDate(e);if(!t)return;let r=new Date(t);t>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(e){let{headers:t}=e;if(!t)return;let r=t.get("sunset")||t.get("Sunset");if(r)return Date.parse(r)}},v=class{constructor(e,t,r){this.client=e;this.domain=t;this.apiKey=r}client;domain;apiKey;async getParsedResponse(e){let t=await e.json();if(e.ok)return t;throw new c(`${t.title||e.statusText||"Unknown error"}.`,e.status)}async getDefaultBranch(e,t){try{let r=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/source`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof c?new c(s,r.status):new Error(s)}}async upsert(e,t,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/remotes`,{timeout:p,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}async push(e,t,r,s){let n=new globalThis.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let u=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await L(i.stream)]);n.append(`files[${i.path}]`,u,i.path)}r.isMainBranch&&n.append("isMainBranch","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:n});return await this.getParsedResponse(i)}catch(i){let u=`Failed to push. ${i.message}`;throw i instanceof c?new c(u,i.status):new Error(u)}}async getRemotesList({organizationId:e,projectId:t,mountPath:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/remotes?filter=mountPath:/${r}/`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get remote list. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}async getPush({organizationId:e,projectId:t,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/pushes/${r}`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}},$=class{apiClient;command;remotes;constructor({domain:e,apiKey:t,command:r}){this.command=r,this.apiClient=new h(this.command),this.remotes=new v(this.apiClient,e,t)}reportSunsetWarnings(){let e=this.apiClient.sunsetWarnings;if(e.length){let[{isSunsetExpired:t,sunsetDate:r}]=e.sort((n,i)=>n.isSunsetExpired!==i.isSunsetExpired?n.isSunsetExpired?-1:1:n.sunsetDate>i.sunsetDate?1:-1),s='Update to the latest version by running "npm install @redocly/cli@latest".';t?a.error(`The "${this.command}" command is not compatible with your version of Redocly CLI. ${s}
7
+ import{c as p}from"./P26PQ2RU.js";import{a as O}from"./RS5PUOTT.js";import{a as R}from"./PVM7EVWV.js";import{a as I}from"./BXI4SF2U.js";import{G as T,I as w,O as a}from"./BEOYUN4L.js";import{e as C}from"./RFWIIJFG.js";import{Buffer as P}from"node:buffer";import y from"node:crypto";import{mkdirSync as j,existsSync as F,writeFileSync as q,readFileSync as z,rmSync as M}from"node:fs";import{homedir as H}from"node:os";import B from"node:path";var l={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function G(){return process.env.REDOCLY_DOMAIN||l.us}var U=D((o,e)=>{try{let t=e||o?.resolvedConfig.residency;return W(t)?l[t]:t?new URL(t).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:l.us}catch{throw new f}});function x(o){try{U(void 0,o)}catch{return!1}return!0}function D(o){return(...e)=>{let t=o(...e);if(!t.startsWith("https://"))throw new f;return t}}var f=class extends Error{constructor(){super("Invalid Reunite URL")}};function W(o){return typeof o=="string"&&o in l}import*as k from"node:child_process";var g=C(I(),1);var N=C(O(),1);function b(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function S(o){let e=process.env.NO_PROXY||process.env.no_proxy;if(!e)return!1;let t=e.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(t.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return t.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var _=async(o,{timeout:e,...t}={})=>{let r=b(),s=r&&!S(o),n,i=e?{connect:{timeout:e}}:{};return s?n=new g.ProxyAgent({uri:r,...i}):e&&(n=new g.Agent(i)),await fetch(o,{signal:e?AbortSignal.timeout(e):void 0,...t,dispatcher:n})};var c=class extends Error{constructor(t,r){super(t);this.status=r}status},h=class{constructor(e){this.command=e}command;sunsetWarnings=[];async request(e,t){let r={...t.headers,"user-agent":`redocly-cli/${R} ${this.command}`};try{let s=await _(e,{...t,headers:r});return this.collectSunsetWarning(s),s}catch(s){let n="Failed to fetch.";throw s.cause&&(n+=` Caused by ${s.cause.message||s.cause.name}.`),(s.code||s.cause?.code)&&(n+=` Code: ${s.code||s.cause?.code}`),new Error(n)}}collectSunsetWarning(e){let t=this.getSunsetDate(e);if(!t)return;let r=new Date(t);t>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(e){let{headers:t}=e;if(!t)return;let r=t.get("sunset")||t.get("Sunset");if(r)return Date.parse(r)}},v=class{constructor(e,t,r){this.client=e;this.domain=t;this.apiKey=r}client;domain;apiKey;async getParsedResponse(e){let t=await e.json();if(e.ok)return t;throw new c(`${t.title||e.statusText||"Unknown error"}.`,e.status)}async getDefaultBranch(e,t){try{let r=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/source`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof c?new c(s,r.status):new Error(s)}}async upsert(e,t,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/remotes`,{timeout:p,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}async push(e,t,r,s){let n=new globalThis.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let u=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await L(i.stream)]);n.append(`files[${i.path}]`,u,i.path)}r.isMainBranch&&n.append("isMainBranch","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:n});return await this.getParsedResponse(i)}catch(i){let u=`Failed to push. ${i.message}`;throw i instanceof c?new c(u,i.status):new Error(u)}}async getRemotesList({organizationId:e,projectId:t,mountPath:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/remotes?filter=mountPath:/${r}/`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get remote list. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}async getPush({organizationId:e,projectId:t,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/pushes/${r}`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}},$=class{apiClient;command;remotes;constructor({domain:e,apiKey:t,command:r}){this.command=r,this.apiClient=new h(this.command),this.remotes=new v(this.apiClient,e,t)}reportSunsetWarnings(){let e=this.apiClient.sunsetWarnings;if(e.length){let[{isSunsetExpired:t,sunsetDate:r}]=e.sort((n,i)=>n.isSunsetExpired!==i.isSunsetExpired?n.isSunsetExpired?-1:1:n.sunsetDate>i.sunsetDate?1:-1),s='Update to the latest version by running "npm install @redocly/cli@latest".';t?a.error(`The "${this.command}" command is not compatible with your version of Redocly CLI. ${s}
8
8
 
9
9
  `):a.warn(`The "${this.command}" command will be incompatible with your version of Redocly CLI after ${r.toLocaleString()}. ${s}
10
10
 
@@ -0,0 +1,18 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a as Z,b as ee,f as ne,h as T,i as te}from"./GBRES7WG.js";import{a as h}from"./PFYPTG4G.js";import{C as J,O as k,R as V,W,aa as Q,c as R,ca as N,ja as Y,q as O,s as X}from"./BEOYUN4L.js";import"./NEWT5A6S.js";import{b as q,c as E,k as C}from"./NB54XRRU.js";import"./HJYFWIVE.js";import"./RFWIIJFG.js";import{mkdir as an,readFile as cn,writeFile as dn}from"node:fs/promises";import{dirname as Se,parse as un,resolve as A,sep as pn}from"node:path";function x(e){return{requires:["typescript"],errorModes:["throw"],load:()=>import("./UDBINQ2S.js").then(n=>({run:n.tanstackQueryGenerator(e)}))}}var I={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"},j={typescript:{load:()=>import("./G2XR6TRU.js").then(e=>({run:e.typescriptGenerator,sample:e.typescriptSample,docs:e.typescriptDocs}))},zod:{load:()=>import("./KIQI3UBS.js").then(e=>({run:e.zodGenerator}))},transformers:{requires:["typescript"],dateTypes:["Date"],load:()=>import("./L3TZNNJJ.js").then(e=>({run:e.transformersGenerator}))},"tanstack-query":x("react"),"tanstack-query-vue":x("vue"),"tanstack-query-svelte":x("svelte"),"tanstack-query-solid":x("solid"),swr:{requires:["typescript"],errorModes:["throw"],load:()=>import("./HLZCPNF7.js").then(e=>({run:e.swrGenerator}))},mock:{requires:["typescript"],load:()=>import("./Q5FNL2RM.js").then(e=>({run:e.mockGenerator}))},cli:{requires:["typescript","zod"],errorModes:["throw"],load:()=>import("./G3YJARF7.js").then(e=>({run:e.cliGenerator,sample:e.cliSample,docs:e.cliDocs}))},python:{notApplicable:I,load:()=>import("./ZGMTMVBB.js").then(e=>({run:e.pythonGenerator,sample:e.pythonSample,docs:e.pythonDocs,options:e.pythonOptions}))},go:{errorModes:["throw"],notApplicable:I,load:()=>import("./5ZEWVWOC.js").then(e=>({run:e.goGenerator,sample:e.goSample,docs:e.goDocs}))},php:{errorModes:["throw"],notApplicable:I,load:()=>import("./4IA3ZTGK.js").then(e=>({run:e.phpGenerator,sample:e.phpSample,docs:e.phpDocs}))}};function re(e,n,t,r){let s=new Set(e);n.goPackage!==void 0&&!s.has("go")&&k.warn(`generate-client: goPackage is ignored \u2014 it declares the Go package clause, and no selected generator uses it (add --generator go).
8
+ `);let o=n.errorMode??"throw",i=n.dateType??"string";for(let a of e){let c=t.get(a);if(!c)throw new h(`Unknown generator: ${a}`);for(let u of c.requires??[])if(!s.has(u)){let p=[...new Set([u,...e])].map(g=>`--generator ${g}`).join(" ");throw new h(`The "${a}" generator requires the "${u}" generator. Add it, e.g. ${p}.`)}if(c.errorModes&&!c.errorModes.includes(o))throw new h(`The "${a}" generator does not support --error-mode "${o}" (supported: ${c.errorModes.join(", ")}).`);if(c.dateTypes&&!c.dateTypes.includes(i))throw new h(`The "${a}" generator requires --date-type ${c.dateTypes.join(" or ")} (got "${i}") so the runtime values match the generated types.`);let d={...n,outputMode:r};for(let[u,p]of Object.entries(c.notApplicable??{}))d[u]!==void 0&&k.warn(`generate-client: the "${a}" generator ignores ${u} \u2014 ${p}.
9
+ `)}}function oe(e,n,t){let r=new Map;for(let s of e){let o=n.get(s)?.options,i=t?.[s];if(o===void 0){i!==void 0&&k.warn(`generate-client: the "${s}" generator declares no options, so client.options.${s} is ignored.
10
+ `),r.set(s,{});continue}r.set(s,be(s,o,i))}return r}function be(e,n,t){if(t!==void 0&&!R(t))throw new h(`The "${e}" generator's options must be a map of option names to values.`);let r=t??{},s=Object.keys(n.properties);if(n.additionalProperties!==!0){for(let i of Object.keys(r))if(!s.includes(i))throw new h(`The "${e}" generator got an unknown option "${i}". Declared options: ${s.join(", ")||"(none)"}.`)}for(let i of n.required??[])if(r[i]===void 0)throw new h(`The "${e}" generator requires the "${i}" option.`);let o={...r};for(let[i,a]of Object.entries(n.properties)){if(o[i]===void 0){a.default!==void 0&&(o[i]=a.default);continue}let c=Oe(a,o[i]);if(c!==void 0)throw new h(`The "${e}" generator's "${i}" ${c}.`)}return o}function Oe(e,n){if("enum"in e)return e.enum.includes(n)?void 0:`must be one of: ${e.enum.join(", ")}`;if(e.type==="array"){let t=e.items.type;return Array.isArray(n)&&n.every(r=>typeof r===t)?void 0:`must be an array of ${t}`}return typeof n===e.type?void 0:`must be a ${e.type}`}import{isAbsolute as Me,resolve as $e}from"node:path";import{pathToFileURL as Re}from"node:url";async function ie(e,n={}){let t=new Map;for(let a of n.customGenerators??[])ae(t,a);let r=[];for(let a of e)r.push(await se(a,t,n.configDir));let s=[],o=new Set,i=async a=>{if(!(s.includes(a)||o.has(a))){o.add(a);for(let c of t.get(a).requires??[])(t.has(c)||c in j)&&await i(await se(c,t,n.configDir));o.delete(a),s.push(a)}};for(let a of r)await i(a);return{selected:s,registry:t}}async function se(e,n,t){if(n.has(e))return e;let r=j[e];if(r!==void 0){let{load:o,...i}=r;return n.set(e,{...i,...await o()}),e}if(e==="sdk")throw new h('The "sdk" generator is now named "typescript". Update the `generators` list or the --generator flag.');let s=await ve(e,t??process.cwd());return ae(n,s),s.name}function ae(e,n){if(!R(n)||typeof n.name!="string"||n.name===""||typeof n.run!="function")throw new h("Invalid custom generator: expected an object with a non-empty string `name` and a `run` function (build one with `defineGenerator`).");if(e.has(n.name))throw new h(`Generator name "${n.name}" collides with an existing generator. Rename the custom generator.`);if(n.requiresGenerator!==void 0){let t=te(T,n.requiresGenerator);if(t===void 0)throw new h(`Generator "${n.name}" declares requiresGenerator "${n.requiresGenerator}", which is not a range we read. Use ^1.2.0, ~1.2.0, >=1.2.0, or an exact version.`);if(!t)throw new h(`Generator "${n.name}" needs @redocly/client-generator ${n.requiresGenerator}; this CLI ships ${T}. 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.`)}n.name in j&&k.warn(`generate-client: custom generator "${n.name}" takes over the built-in generator of the same name.
11
+ `),e.set(n.name,{run:n.run,sample:n.sample,docs:n.docs,notApplicable:n.notApplicable,options:n.options,requires:n.requires,errorModes:n.errorModes,dateTypes:n.dateTypes})}async function ve(e,n){if(X(e))throw new h(`Remote generator modules are not supported \u2014 use a local path or a package name. Got: ${e}`);let t=e.startsWith(".")||Me(e),r=t?Re($e(n,e)).href:e;if(t&&e.endsWith(".ts")&&!process.features.typescript)throw new h(`Generator "${e}" is TypeScript, which this Node cannot run directly \u2014 use Node 22.18, 23.6, or newer.`);let s;try{s=await import(r)}catch(i){throw new h(`Could not load generator "${e}": ${i.message}`)}let o=s.default??s.generator;if(o===void 0)throw new h(`Generator module "${e}" must export a generator (a default export or a \`generator\` export built with \`defineGenerator\`).`);return o}function ue(e){let n=new Set,t=new Set,r=new Map;for(let f of e.securitySchemes){let m=B(f.key,n,t);m!==f.key&&(r.set(f.key,m),L("security scheme",f.key,m,de(f.key,n)),f.key=m)}let s=new Set(ne()),o=new Set(s),i=new Set,a=new Map;for(let f of e.schemas){let m=B(f.name,o,i);m!==f.name&&(a.set(f.name,m),L("schema",f.name,m,de(f.name,s)),f.name=m)}let c=f=>a.get(f)??ce(f),d=f=>r.get(f)??ce(f);for(let f of e.schemas)S(f.schema,c);let u=new Set(o),p=new Set,g=new Set;for(let f of e.services)for(let m of f.operations){let l=g.has(m.name);g.add(m.name);let y=m.name,P=B(m.name,u,p);if(P!==m.name){let G=l?{kind:"duplicate-operation-id"}:s.has(y)?{kind:"reserved"}:o.has(y)?{kind:"schema-collision"}:{kind:"unusable"};L("operation",y,P,G),m.specName=m.name,m.name=P}Pe(m,c),m.security=m.security.map(G=>G.map(d))}}function B(e,n,t){let r=E(e),s=r,o=2;for(;n.has(s)||t.has(C(s));)s=`${r}_${o++}`;return n.add(s),t.add(C(s)),s}function pe(e){for(let n of e.schemas)if(!q(n.name))throw U("schema",n.name);for(let n of e.securitySchemes)if(!q(n.key))throw U("security scheme",n.key);for(let n of e.services)for(let t of n.operations)if(!q(t.name))throw U("operation",t.name)}function U(e,n){return new Error(`Internal error: ${e} name ${JSON.stringify(n)} is not a safe identifier after sanitization.`)}function ce(e){return E(e)}function L(e,n,t,r){let s=JSON.stringify(n),o=JSON.stringify(t),i=r.kind==="duplicate-operation-id"?`two operations share the operationId ${s}; the second is emitted as ${o} \u2014 give each operation a unique operationId to control its method name`:r.kind==="schema-collision"?`${e} ${s} collides with the schema of the same name, so it is emitted as ${o} \u2014 rename the operation or the schema in the description to control its name`:r.kind==="reserved"?`${e} ${s} is a name a generated client already declares, so it is emitted as ${o} \u2014 the reserved set spans every target language, so one schema keeps one name across the SDKs you generate`:`${e} ${s} is not a usable identifier, so it is emitted as ${o}`;k.warn(`generate-client: ${i}.
12
+ `)}function de(e,n){return n.has(e)?{kind:"reserved"}:{kind:"unusable"}}function S(e,n){switch(e.kind){case"ref":e.name=n(e.name);break;case"omit":e.base=n(e.base);break;case"array":S(e.items,n);break;case"record":S(e.value,n);break;case"object":for(let t of e.properties)S(t.schema,n);break;case"union":for(let t of e.members)S(t,n);if(e.discriminator)for(let t of e.discriminator.mapping)t.schemaName=n(t.schemaName);break;case"intersection":for(let t of e.members)S(t,n);break}}function Pe(e,n){for(let t of e.pathParams)S(t.schema,n);for(let t of e.queryParams)S(t.schema,n);for(let t of e.headerParams)S(t.schema,n);for(let t of e.cookieParams)S(t.schema,n);e.requestBody&&S(e.requestBody.schema,n);for(let t of[...e.successResponses,...e.errorResponses])S(t.schema,n),t.itemSchema&&S(t.itemSchema,n)}var Ge=["get","post","put","delete","patch","head","options"];function fe(e,n){if(!n.startsWith("#/"))throw new h(`External $ref not supported: ${n}`);let t=n.slice(2).split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~")),r=e;for(let s of t){if(!R(r)&&!Array.isArray(r))throw new h(`Cannot resolve $ref: ${n}`);r=r[s]}if(r===void 0)throw new h(`Cannot resolve $ref: ${n}`);return r}function M(e,n){return O(n)?fe(e,n.$ref):n}function D(e){let n=e.lastIndexOf("/");return n>=0?e.slice(n+1):e}function De(e){let n=e,t={};return typeof n.minimum=="number"&&(t.minimum=n.minimum),typeof n.maximum=="number"&&(t.maximum=n.maximum),typeof n.exclusiveMinimum=="number"?t.exclusiveMinimum=n.exclusiveMinimum:n.exclusiveMinimum===!0&&typeof n.minimum=="number"&&(t.exclusiveMinimum=n.minimum,delete t.minimum),typeof n.exclusiveMaximum=="number"?t.exclusiveMaximum=n.exclusiveMaximum:n.exclusiveMaximum===!0&&typeof n.maximum=="number"&&(t.exclusiveMaximum=n.maximum,delete t.maximum),typeof n.minLength=="number"&&(t.minLength=n.minLength),typeof n.maxLength=="number"&&(t.maxLength=n.maxLength),typeof n.pattern=="string"&&(t.pattern=n.pattern),typeof n.minItems=="number"&&(t.minItems=n.minItems),typeof n.maxItems=="number"&&(t.maxItems=n.maxItems),n.uniqueItems===!0&&(t.uniqueItems=!0),typeof n.format=="string"&&(t.format=n.format),n.deprecated===!0&&(t.deprecated=!0),n.example!==void 0?t.example=n.example:Array.isArray(n.examples)&&n.examples.length>0&&(t.example=n.examples[0]),n.default!==void 0&&(t.default=n.default),Object.keys(t).length>0?t:void 0}function qe(e,n){let t=e.discriminator;if(!t||typeof t.propertyName!="string")return;let r=[];if(t.mapping)for(let[s,o]of Object.entries(t.mapping))r.push({value:s,schemaName:D(o)});else for(let s of n)if(O(s)){let o=D(s.$ref);r.push({value:o,schemaName:o})}if(r.length!==0)return{propertyName:t.propertyName,mapping:r}}function b(e,n){return n?{...e,metadata:n}:e}function z(e,n){return e?n?{...e,...n}:e:n}function xe(e){return e?e.url.replace(/\{([^{}]+)\}/g,(n,t)=>e.variables?.[t]?.default??n):""}function me(e){let n=e.info?.title??"Api",t=e.info?.version??"0.0.0",r=e.info?.description,s=xe(e.servers?.[0]),o=(e.servers??[]).map(u=>({url:u.url,description:u.description,variables:Object.entries(u.variables??{}).map(([p,g])=>({name:p,default:g.default,description:g.description}))})),i=Ie(e),a=Ee(e),c=Be(e,a),d={title:n,version:t,description:r,serverUrl:s,servers:o,services:c,schemas:i,securitySchemes:a};return ue(d),je(c,i),pe(d),d}function je(e,n){let t=new Map(n.map(r=>[r.name,r.schema]));for(let r of e)for(let s of r.operations)s.requestBody&&(s.requestBody.schema=Ne(s.requestBody.schema,t))}function Ae(e){let n=e.filter(t=>t.kind!=="unknown");return n.length>0?n:[{kind:"unknown"}]}function Ne(e,n){if(e.kind==="ref"){let t=Te(e,n,new Set);return t.length>0?{kind:"omit",base:e.name,keys:t}:e}if(e.kind==="object"){let t=e.properties.filter(r=>!r.readOnly);return t.length===e.properties.length?e:{...e,properties:t}}return e}function Te(e,n,t){let r=[],s=o=>{if(o.kind==="ref"){if(t.has(o.name))return;t.add(o.name);let i=n.get(o.name);i&&s(i)}else if(o.kind==="object")for(let i of o.properties)i.readOnly&&!r.includes(i.name)&&r.push(i.name);else if(o.kind==="intersection")for(let i of o.members)s(i)};return s(e),r}function Ee(e){let n=e.components?.securitySchemes;if(!n)return[];let t=[];for(let[r,s]of Object.entries(n)){let o=M(e,s),i=o.type;i==="oauth2"||i==="openIdConnect"?t.push({kind:"bearer",key:r}):i==="http"&&(o.scheme??"").toLowerCase()==="bearer"?t.push({kind:"bearer",key:r}):i==="http"&&(o.scheme??"").toLowerCase()==="basic"?t.push({kind:"basic",key:r}):i==="apiKey"&&o.in==="header"&&typeof o.name=="string"?t.push({kind:"apiKeyHeader",key:r,headerName:o.name}):i==="apiKey"&&o.in==="query"&&typeof o.name=="string"?t.push({kind:"apiKeyQuery",key:r,paramName:o.name}):i==="apiKey"&&o.in==="cookie"&&typeof o.name=="string"&&(k.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.
13
+ `),t.push({kind:"apiKeyCookie",key:r,cookieName:o.name}))}return t}function Ce(e,n,t){let r=e.security??n.security;if(!r)return[];let s=[];for(let o of r){let i=Object.keys(o);i.length!==0&&i.every(a=>t.has(a))&&s.push([...new Set(i)])}return s}function Ie(e){let n=e.components?.schemas;return n?Object.entries(n).map(([t,r])=>{if(O(r)){let o=fe(e,r.$ref);return{name:t,schema:v(o,`components.schemas.${t}`,e),description:o.description}}let s=v(r,`components.schemas.${t}`,e);return{name:t,schema:s,description:r.description}}):[]}function Be(e,n){let t=new Set(n.map(i=>i.key)),r=[],s=new Set;for(let[i,a]of Object.entries(e.paths??{})){if(!a)continue;let c=M(e,a),d=(c.parameters??[]).map(u=>ge(M(e,u),`paths.${i}.parameters`,e));for(let u of Ge){let p=c[u];p&&(r.push({method:u,path:i,operation:p,pathLevelParams:d}),p.operationId&&s.add(p.operationId))}}return[{name:"Default",operations:r.map(i=>{let a=i.operation.operationId??ze(Ue(i.method,i.path),s);return He(i.method,i.path,i.operation,a,i.pathLevelParams,e,t)})}]}function Ue(e,n){let t=n.split("/").filter(Boolean).map(r=>Le(r.replace(/[{}]/g,"")));return`${e}${t.join("")}`}function Le(e){return e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(n=>n[0].toUpperCase()+n.slice(1)).join("")}function ze(e,n){let t=e,r=2;for(;n.has(t);)t=`${e}${r++}`;return n.add(t),t}function He(e,n,t,r,s,o,i){let a=(t.parameters??[]).map(w=>ge(M(o,w),`paths.${n}.${e}.parameters`,o)),c=new Set,d=[];for(let w of a)c.add(`${w.in}:${w.name}`),d.push(w);for(let w of s)c.has(`${w.in}:${w.name}`)||d.push(w);let u=d.filter(w=>w.in==="path"),p=d.filter(w=>w.in==="query"),g=d.filter(w=>w.in==="header"),f=d.filter(w=>w.in==="cookie"),m=t.requestBody?Fe(M(o,t.requestBody),`${e} ${n}`,o):void 0,{successResponses:l,successResponseHeaders:y}=_e(t,n,o),P=Je(t,n,o),G=Ce(t,o,i),F=t["x-redoclyPagination"],_=Ke(l);return{name:r,method:e,path:n,summary:t.summary,description:t.description,pathParams:u,queryParams:p,headerParams:g,cookieParams:f,requestBody:m,successResponses:l,...y===void 0?{}:{successResponseHeaders:y},errorResponses:P,security:G,tags:Array.isArray(t.tags)?t.tags.filter(w=>typeof w=="string"):[],...F!==void 0?{paginationExtension:F}:{},..._===void 0?{}:{sse:_}}}function Ke(e){let n=e.find(s=>s.contentType.split(";")[0].trim().toLowerCase()==="text/event-stream");if(n===void 0)return;let t=n.itemSchema&&n.itemSchema.kind!=="unknown"?n.itemSchema:n.schema.kind!=="unknown"?n.schema:void 0;if(t===void 0)return{dataKind:"text"};let r=t.kind==="object"||t.kind==="ref"||t.kind==="array"||t.kind==="record"||t.kind==="union"||t.kind==="intersection";return{eventSchema:t,dataKind:r?"json":"text"}}function ge(e,n,t){if(!e.in)throw new h(`Parameter ${e.name} at ${n} is missing "in"`);if(!["path","query","header","cookie"].includes(e.in))throw new h(`Unsupported parameter location "${e.in}" for ${e.name} at ${n}`);let r=$(e.schema,`${n}.${e.name}`,t);e.deprecated===!0&&(r={...r,metadata:z(r.metadata,{deprecated:!0})});let s={name:e.name,in:e.in,schema:r,required:!!e.required,description:e.description};if(s.in==="query"){let o=e;(o.style==="form"||o.style==="spaceDelimited"||o.style==="pipeDelimited"||o.style==="deepObject")&&(s.style=o.style),typeof o.explode=="boolean"&&(s.explode=o.explode),typeof o.allowReserved=="boolean"&&(s.allowReserved=o.allowReserved)}return s}function Fe(e,n,t){let r=e.content??{},s=r["application/json"]??r["application/merge-patch+json"]??r["application/x-www-form-urlencoded"]??r["multipart/form-data"]??Object.values(r)[0];if(!s)return;let o=Object.keys(r).find(a=>r[a]===s),i=$(s.schema,`${n}.requestBody`,t);return{contentType:o,schema:i,required:!!e.required,description:e.description}}function _e(e,n,t){let r=e.responses??{},s=Object.keys(r).filter(g=>/^2\d\d$/.test(g));s.length===0&&(r["2XX"]?s.push("2XX"):r.default&&s.push("default"));let o=s[0];if(!o)return{successResponses:[]};let i=r[o];if(!i)return{successResponses:[]};let a=M(t,i),c=Xe(a.headers,`paths.${n}.response.${o}`,t),d=a.content;if(!d)return{successResponses:[],...c===void 0?{}:{successResponseHeaders:c}};let u=o==="default"||o==="2XX"?o:Number(o),p=[];for(let[g,f]of Object.entries(d)){let m=$(f.schema,`paths.${n}.response.${o}.${g}`,t),l=f.itemSchema,y=l!==void 0?$(l,`paths.${n}.response.${o}.${g}.itemSchema`,t):void 0;p.push({contentType:g,schema:m,status:u,...y===void 0?{}:{itemSchema:y}})}return{successResponses:p,...c===void 0?{}:{successResponseHeaders:c}}}function Xe(e,n,t){if(!e)return;let r=[];for(let[s,o]of Object.entries(e)){let i=M(t,o),a={name:s.toLowerCase(),schema:$(i.schema===void 0?void 0:M(t,i.schema),`${n}.headers.${s}`,t)};i.required===!0&&(a.required=!0),r.push(a)}return r.length>0?r:void 0}function Je(e,n,t){let r=e.responses??{},s=Object.keys(r).filter(a=>/^([45]\d\d|4XX|5XX)$/.test(a));Object.keys(r).some(a=>/^(2\d\d|2XX)$/.test(a))&&r.default&&s.push("default");let i=[];for(let a of s){let c=r[a];if(!c)continue;let u=M(t,c).content;if(!u)continue;let p=a==="default"||a==="4XX"||a==="5XX"?a:Number(a);for(let[g,f]of Object.entries(u)){let m=$(f.schema,`paths.${n}.response.${a}.${g}`,t);i.push({contentType:g,schema:m,status:p})}}return i}function $(e,n,t){return e===void 0||typeof e=="boolean"?{kind:"unknown"}:O(e)?{kind:"ref",name:D(e.$ref)}:v(e,n,t)}function v(e,n,t){let r=De(e),s=e.oneOf??e.anyOf;if(s){let a=s.map((u,p)=>O(u)?{kind:"ref",name:D(u.$ref)}:v(u,`${n}.[${p}]`,t)),c=Ae(a);if(c.length===1&&c.length<a.length){let u=c[0];return{...u,description:u.description??e.description,metadata:z(r,u.metadata)}}let d=qe(e,s);return b({kind:"union",members:c,discriminator:d,description:e.description},r)}if(e.allOf){let a=e.allOf.map((d,u)=>O(d)?{kind:"ref",name:D(d.$ref)}:v(d,`${n}.allOf[${u}]`,t)),c=le(e,n,t);if(c.length>0&&a.unshift({kind:"object",properties:c}),a.length===1){let d=a[0];return{...d,description:d.description??e.description,metadata:z(r,d.metadata)}}return b({kind:"intersection",members:a,description:e.description},r)}let o=e.type;if(Array.isArray(o)){let a=o.filter(u=>u!=="null"),c=o.includes("null"),d=a.map(u=>{let p={...e,type:u};if(Array.isArray(p.enum)){let g=p.enum.filter(f=>f!==null);p.enum=g.length>0?g:void 0}return v(p,n,t)});return c&&d.push({kind:"null"}),d.length===1?d[0]:b({kind:"union",members:d,description:e.description},r)}if(e.nullable)return{kind:"union",members:[v({...e,nullable:void 0},n,t),{kind:"null"}],description:e.description};if(e.const!==void 0){let a=e.const;if(typeof a!="string"&&typeof a!="number"&&typeof a!="boolean")throw new h(`Unsupported const value at ${n}: ${JSON.stringify(a)}`);return b({kind:"literal",value:a,description:e.description},r)}if(e.enum){let a=e.enum,c=a.filter(g=>g!==null),d=c.length!==a.length;if(c.length===0)return b({kind:"null",description:e.description},r);let u=Ve(c,n),p=u==="boolean"?{kind:"scalar",scalar:"boolean",description:e.description}:{kind:"enum",values:c,scalar:u,description:e.description};return b(d?{kind:"union",members:[p,{kind:"null"}],description:e.description}:p,r)}let i=o;if(i==="null")return b({kind:"null",description:e.description},r);if(i==="array"){let a=e.items,c=$(a,`${n}.items`,t);return b({kind:"array",items:c,description:e.description},r)}if(i==="object"||e.properties||e.additionalProperties){let a=le(e,n,t),c=e.additionalProperties;if(a.length===0&&c!==!1){let d=$(c,`${n}.additionalProperties`,t);return b({kind:"record",value:d,description:e.description},r)}return b({kind:"object",properties:a,description:e.description},r)}return b(i==="string"||i==="number"||i==="integer"||i==="boolean"?{kind:"scalar",scalar:i,description:e.description}:{kind:"unknown",description:e.description},r)}function Ve(e,n){let t=!1,r=!1,s=!1;for(let o of e)if(typeof o=="string")t=!0;else if(typeof o=="number")r=!0;else if(typeof o=="boolean")s=!0;else throw new h(`Unsupported enum value type at ${n}: ${JSON.stringify(o)}`);return t&&!r&&!s?"string":r&&!t&&!s?"number":s&&!t&&!r?"boolean":"string"}function We(e){return!(e.openapi??"").startsWith("3.0")}function le(e,n,t){let r=e.properties??{},s=new Set(e.required??[]),o=We(t);return Object.entries(r).map(([i,a])=>{let c=a.readOnly===!0;c&&O(a)&&!o&&k.warn(`generate-client: "${i}" declares readOnly beside a $ref, which OpenAPI ${t.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.
14
+ `);let d=c&&(o||!O(a));return{name:i,schema:$(a,`${n}.${i}`,t),required:s.has(i),description:a.description,...d?{readOnly:!0}:{}}})}function he(e){let n=H(e),t={...n};delete t.swagger,delete t.host,delete t.basePath,delete t.schemes,delete t.definitions,delete t.securityDefinitions,delete t.consumes,delete t.produces,delete t.parameters,delete t.responses,t.openapi="3.0.3";let r=Qe(n);return r&&(t.servers=r),t.components=Ye(n),t.paths=tn(n.paths??{},n.consumes??void 0,n.produces??void 0),t}function Qe(e){let n=e.host,t=e.basePath??"",r=(e.schemes??["https"])[0]??"https";if(n)return[{url:`${r}://${n}${t}`}]}function Ye(e){let n={};e.definitions&&(n.schemas=e.definitions),e.parameters&&(n.parameters=Object.fromEntries(Object.entries(e.parameters).map(([r,s])=>[r,K(s)]))),e.responses&&(n.responses=we(e.responses,void 0));let t=e.securityDefinitions;if(t){let r={};for(let[s,o]of Object.entries(t))r[s]=Ze(o);n.securitySchemes=r}return n}function Ze(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 n=e.flow==="accessCode"?"authorizationCode":e.flow==="application"?"clientCredentials":e.flow,t={scopes:e.scopes??{}};return e.authorizationUrl&&(t.authorizationUrl=e.authorizationUrl),e.tokenUrl&&(t.tokenUrl=e.tokenUrl),{type:"oauth2",flows:{[n]:t}}}default:return e}}function H(e){if(Array.isArray(e))return e.map(H);if(R(e)){let n={};for(let[t,r]of Object.entries(e))t==="$ref"&&typeof r=="string"?n.$ref=r.replace("#/definitions/","#/components/schemas/").replace("#/parameters/","#/components/parameters/").replace("#/responses/","#/components/responses/"):n[t]=H(r);return n}return e}var en="application/json",nn="application/json",ye=new Set(["name","in","required","description","deprecated","allowEmptyValue","collectionFormat"]);function tn(e,n,t){let r={};for(let[s,o]of Object.entries(e)){let i=o,a={};for(let[c,d]of Object.entries(i)){if(c==="parameters"&&Array.isArray(d)){a.parameters=d.map(K);continue}if(!rn(c)){a[c]=d;continue}a[c]=on(d,n,t)}r[s]=a}return r}function rn(e){return["get","put","post","delete","options","head","patch"].includes(e.toLowerCase())}function on(e,n,t){let r=e.consumes??n,s=e.produces??t,o=e.parameters??[],i=o.find(p=>p.in==="body"),a=o.filter(p=>p.in==="formData"),c=o.filter(p=>p.in!=="body"&&p.in!=="formData").map(K),d={...e,parameters:c};delete d.consumes,delete d.produces;let u=r?.[0]??en;if(i)d.requestBody={required:!!i.required,content:{[u]:{schema:i.schema}}};else if(a.length>0){let p={},g=[];for(let l of a)p[l.name]=sn(l),l.required&&g.push(l.name);let f={type:"object",properties:p};g.length>0&&(f.required=g);let m=r?.find(l=>l==="multipart/form-data")??r?.[0]??"application/x-www-form-urlencoded";d.requestBody={required:g.length>0,content:{[m]:{schema:f}}}}return e.responses&&(d.responses=we(e.responses,s)),d}function K(e){if(e.$ref!==void 0||e.in==="body"||e.in==="formData")return e;let n={},t={};for(let[r,s]of Object.entries(e))ye.has(r)?n[r]=s:t[r]=s;if(n.schema=t,delete n.collectionFormat,e.in==="query"&&t.type==="array"){let r=e.collectionFormat??"csv";r!=="multi"&&(n.style=r==="ssv"?"spaceDelimited":r==="pipes"?"pipeDelimited":"form",n.explode=!1)}return n}function sn(e){let n={};for(let[t,r]of Object.entries(e))ye.has(t)||(n[t]=r);return n}function we(e,n){let t=n?.[0]??nn,r={};for(let[s,o]of Object.entries(e)){let i=o;if(i.schema===void 0){r[s]=i;continue}let{schema:a,...c}=i;r[s]={...c,content:{[t]:{schema:a}}}}return r}async function ke(e,n){let t=n??await N({}),r=await Q({ref:e,config:t}),s=await N({rules:{struct:"error"}}),o=await Y({externalRefResolver:new W,document:r.bundle,config:s}),i=[...r.problems,...o].filter(c=>c.severity==="error");if(i.length>0){let c=i.map(d=>`- ${d.message} (at ${d.location?.[0]?.pointer??e})`).join(`
15
+ `);throw new Error(`The API description has ${i.length} error(s):
16
+ ${c}`)}let a=r.bundle.parsed;return{document:a,version:V(a)}}var ln=["Generated by @redocly/client-generator \u2014 do not edit by hand.","Source: OpenAPI description. Re-run `redocly generate-client` to update."];function fn(e,n){let t=[],r=new Set,s=A(Se(n.outputPath)),{dir:o,name:i,ext:a}=un(n.outputPath),c={path:n.outputPath,dir:o,stem:i,ext:a},d=ln,u=!1;for(let p of n.generators){let g=n.registry.get(p),f={model:e,output:c,banner:d,outputMode:n.outputMode,emit:n.emit,pagination:n.pagination,selected:n.generators,options:n.generatorOptions?.get(p)??{}},m;try{n.emit.docs===!0&&g.docs!==void 0?(m=[...g.run(f),...g.docs(f)],u=!0):m=g.run(f)}catch(l){let y=l instanceof Error?l.message:String(l);throw new Error(`Generator "${p}" failed: ${y}`)}if(!Array.isArray(m)||m.some(l=>typeof l?.path!="string"||l.path===""||typeof l.content!="string"))throw new Error(`Generator "${p}" failed: run() must return an array of { path, content } files.`);for(let l of m){let y=A(s,l.path);if(y!==s&&!y.startsWith(s+pn))throw new Error(`Generator "${p}" failed: file path escapes the output directory: ${l.path}`);if(r.has(y))throw new Error(`Generator conflict: ${l.path} already emitted by an earlier generator`);r.add(y),t.push({path:y,content:l.content})}}return n.emit.docs===!0&&!u&&k.warn(`generate-client: docs is on, but no selected generator writes documentation (${n.generators.join(", ")}).
17
+ `),t}function mn(e){for(let n of e.services)for(let t of n.operations){let r=new Set,s=new Set;for(let o of[...t.pathParams,...t.queryParams,...t.headerParams,...t.cookieParams])r.has(o.name)&&s.add(o.name),r.add(o.name);s.size!==0&&k.warn(`generate-client: operation "${t.specName??t.name}" uses ${[...s].map(o=>`"${o}"`).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.
18
+ `)}}function gn(e,n,t,r,s,o){let i=[];for(let a of Z(e.services)){let c=t.map(d=>r.get(d)?.sample?.(a,{model:e,emit:n,outputPath:s,pagination:o})).filter(d=>d!==void 0);c.length>0&&i.push({target:`$.paths['${a.path.replaceAll("'","''")}'].${a.method}`,update:{"x-codeSamples":c}})}if(i.length!==0)return J({overlay:"1.0.0",info:{title:`Code samples for ${e.title}`,version:e.version},actions:i})}async function et(e){if(e.output.split(/[\\/]/).some(l=>l==="undefined"||l==="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 h(`setup must be a local file path \u2014 remote setup modules are not supported (got: ${e.setup})`);let n=A(e.output),{document:t,version:r}=await ke(e.api,e.config),s=r==="oas2"?he(t):t,o=me(s);mn(o);let i;if(e.setup){let{bakeSetup:l}=await import("./ZBL4IVEW.js"),y=A(e.configDir??process.cwd(),e.setup);i=l(await cn(y,"utf-8"))}let a=e.generators?.length?e.generators:["typescript"],{selected:c,registry:d}=await ie(a,{customGenerators:e.customGenerators,configDir:e.configDir}),u=ee(o,e.pagination),p={serverUrl:e.serverUrl,argsStyle:e.argsStyle,errorMode:e.errorMode,dateType:e.dateType,mockData:e.mockData,mockSeed:e.mockSeed,queryKeyPrefix:e.queryKeyPrefix,setup:i,runtime:e.runtime,importExt:e.importExt,goPackage:e.goPackage,pagination:u,docs:e.docs,docsFrontmatter:e.docsFrontmatter};re(c,p,d,e.outputMode);let g=oe(c,d,e.options),f=fn(o,{outputPath:n,outputMode:e.outputMode??"single",emit:p,pagination:u,generators:c,generatorOptions:g,registry:d});if(e.codeSamples===!0){let l=gn(o,p,c,d,n,u);l!==void 0&&f.push({path:n.replace(/\.[^.]+$/,".code-samples.yaml"),content:l})}let m=[];for(let l of f)await an(Se(l.path),{recursive:!0}),await dn(l.path,l.content,"utf-8"),m.push({path:l.path,bytes:Buffer.byteLength(l.content,"utf-8")});return{outputPath:n,bytes:m.reduce((l,y)=>l+y.bytes,0),files:m}}export{et as generateClient,fn as runGenerators};
@@ -0,0 +1,67 @@
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"./UKSQ7B5H.js";import{b as S,c as v,d as k,e as P,f as w,g as D,h as q,i as U,j as B}from"./VWSPU27A.js";import{b,g as R}from"./YQS3OX36.js";import{a as d,c as j,d as N,e as T}from"./GBRES7WG.js";import"./PFYPTG4G.js";import"./BEOYUN4L.js";import"./NEWT5A6S.js";import{d as E,f as A,h as I,i as x,m as C}from"./NB54XRRU.js";import"./HJYFWIVE.js";import"./RFWIIJFG.js";import{join as Y}from"node:path";var y="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function O(e){return e.filter(t=>t.length>0).join(`
8
+
9
+ `)+`
10
+ `}function M(e){let t=["/**",` * ${x(`${e.title} (v${e.version})`)}`];if(e.description)for(let n of C(x(e.description)))t.push(` * ${n}`.replace(/ +$/,""));return t.push(" */"),t.join(`
11
+ `)}function $(e){let t=new Set(T),n=new Map;for(let r of d(e.services))n.set(r.name,A(r.name,t));return n}function Z(e,t,n,r,i=[],o="grouped"){let s=[...e.pathParams,...e.queryParams,...e.headerParams,...e.cookieParams].map(p=>({name:p.name,in:p.in,...p.style!==void 0?{style:p.style}:{},...p.explode!==void 0?{explode:p.explode}:{},...p.allowReserved!==void 0?{allowReserved:p.allowReserved}:{}})),c=R(e,{securitySchemes:t}),m=e.sse!==void 0?"sse":w(e.successResponses,n).kind,l=v(e.successResponseHeaders,i);return{id:e.specName??e.name,method:e.method.toUpperCase(),path:e.path,...e.tags.length>0?{tags:e.tags}:{},...s.length>0?{params:s}:{},...e.requestBody?{body:{contentType:e.requestBody.contentType,...S(e.requestBody)?{multipart:!0}:{}}}:{},...m!=="json"?{responseKind:m}:{},...e.sse===void 0?{}:{sseDataKind:e.sse.dataKind},...c.length>0?{security:c}:{},...l===void 0?{}:{responseHeaders:l},...r?.has(e.name)?{pagination:r.get(e.name).spec}:{},...o==="flat"&&"collisions"in D(e,i)?{argsStyle:"grouped"}:{}}}function F(e,t,n,r,i="grouped"){let o=d(e.services);if(o.length===0)return"";let s=o.map((a,m)=>{let l=I(Z(a,e.securitySchemes,n,r,e.schemas,i));return` ${t.get(a.name)}: ${l}${m===o.length-1?"":","}`}),c=[[...k(`The wire-shape descriptor for every operation, keyed by operationId \u2014 the data the
12
+ runtime routes requests by. Also minification-safe static metadata (method, path,
13
+ tags) for cache keys, tracing span names, and request logging.`,void 0,""),"export const OPERATIONS = {",...s,"} as const satisfies Record<string, OperationDescriptor>;"].join(`
14
+ `),'export type OperationId = (typeof OPERATIONS)[keyof typeof OPERATIONS]["id"];','export type OperationPath = (typeof OPERATIONS)[keyof typeof OPERATIONS]["path"];'];return o.some(a=>a.tags.length>0)&&c.push(`export type OperationTag = Extract<(typeof OPERATIONS)[keyof typeof OPERATIONS], {
15
+ tags: readonly string[];
16
+ }>["tags"][number];`),c.join(`
17
+
18
+ `)}var ee="// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator, assembled per this API's needs) \u2500\u2500\u2500";function L(e){let t=["types.ts","errors.ts","url.ts","parse.ts","retry.ts"];return e.multipart&&t.push("multipart.ts"),e.auth&&t.push("auth.ts"),e.setup&&t.push("setup.ts"),e.paginate&&t.push("paginate.ts"),t.push("send.ts"),e.sse&&t.push("sse.ts"),t.push("create-client.ts"),t}function G(e){return[ee,...L(e).map(t=>N[t]),H(e)].join(`
19
+
20
+ `)}function _(e,t="js"){let n=[...L(e).map(r=>({name:r,content:j[r]})),{name:"factory.ts",content:te(e)}];return t==="js"?n:n.map(({name:r,content:i})=>({name:r,content:i.replace(/(from '\.\/[a-z-]+)\.js'/g,"$1.ts'")}))}function te(e){let t=["import { createClientCore } from './create-client.js';",...e.multipart?["import { toFormData } from './multipart.js';"]:[],...e.auth?["import { resolveAuth } from './auth.js';"]:[],...e.paginate?["import { items, itemsByLink, pages, pagesByLink } from './paginate.js';"]:[],...e.sse?["import { sse } from './sse.js';"]:[],`import type {
21
+ Client,
22
+ ClientConfig,
23
+ OperationContext,
24
+ OperationDescriptor,
25
+ OpsShape,
26
+ } from './types.js';`],n=["export { ApiError, TimeoutError } from './errors.js';","export { defaultRetryOn } from './retry.js';",...e.setup?["export { mergeSetup } from './setup.js';"]:[],"export type * from './types.js';"];return[t.join(`
27
+ `),H(e),n.join(`
28
+ `)].join(`
29
+
30
+ `)}function H(e){let t=[...e.multipart?["serializeMultipart: toFormData"]:[],...e.auth?["resolveAuth"]:[],...e.sse?["sse"]:[],...e.paginate?["paginate: { pages, items, pagesByLink, itemsByLink }"]:[]];return`/**
31
+ * The client factory: \`createClientCore\` wired with the capabilities this API needs.
32
+ * Exported so apps can build additional instances (per-tenant, per-environment) over
33
+ * the same \`OPERATIONS\`/\`Ops\`. The trailing string params carry the wiring's literal
34
+ * unions (\`OperationId\`/\`OperationPath\`/\`OperationTag\`) into \`ctx.operation\`.
35
+ */
36
+ export function createClient<
37
+ Ops extends OpsShape,
38
+ Id extends string = string,
39
+ Path extends string = string,
40
+ Tag extends string = string,
41
+ >(
42
+ operations: Record<string, OperationDescriptor>,
43
+ config?: ClientConfig<OperationContext<Id, Path, Tag>>
44
+ ): Client<Ops, OperationContext<Id, Path, Tag>> {
45
+ return createClientCore<Ops, Id, Path, Tag>(operations, config, ${t.length>0?`{ ${t.join(", ")} }`:"{}"});
46
+ }`}function J(e){let t=new Map(e.map(i=>[i.name,i.schema])),n=[],r=new Set;for(let i of e)for(let o of ne(i)){let s=o.union.discriminator??re(o.union,t);if(!s)continue;let c=new Map;for(let a of s.mapping){if(!t.has(a.schemaName))continue;let m=c.get(a.schemaName);m?m.push(a.value):c.set(a.schemaName,[a.value])}for(let[a,m]of c){let l=`is${a}`;if(r.has(l))continue;r.add(l);let p=`(value as Record<string, unknown>)[${JSON.stringify(s.propertyName)}]`,f=m.length===1?`${p} === ${JSON.stringify(m[0])}`:`([${m.map(h=>JSON.stringify(h)).join(", ")}] as readonly unknown[]).includes(${p})`;n.push(["/**",` * Narrow a \`${o.label}\` to \`${a}\` via its \`${s.propertyName}\` discriminant.`," */",`export function ${l}(value: ${o.label}): value is ${a} {`,` return ${f};`,"}"].join(`
47
+ `))}}return n.join(`
48
+
49
+ `)}function ne(e){let t=[],n=e.schema;if(n.kind==="union"){t.push({union:n,label:e.name});for(let r of n.members)g(r,t)}else g(n,t);return t}function g(e,t){switch(e.kind){case"union":{let n=e.members.map(r=>r.kind==="ref"?r.name:void 0);n.every(r=>r!==void 0)&&t.push({union:e,label:n.join(" | ")});for(let r of e.members)g(r,t);break}case"array":g(e.items,t);break;case"record":g(e.value,t);break;case"object":for(let n of e.properties)g(n.schema,t);break;case"intersection":for(let n of e.members)g(n,t);break}}function re(e,t){let n=[];for(let i of e.members){if(i.kind!=="ref"||!t.get(i.name))return;n.push(i.name)}if(n.length<2)return;let r=n.map(i=>ie(t.get(i)));for(let i of Object.keys(r[0])){if(!r.every(s=>i in s))continue;let o=r.map(s=>s[i]);if(o.every(s=>typeof s=="string")&&new Set(o).size===o.length)return{propertyName:i,mapping:n.map((s,c)=>({value:o[c],schemaName:s}))}}}function ie(e){let t={},n=r=>{if(r.kind==="object")for(let i of r.properties)i.schema.kind==="literal"&&(t[i.name]=i.schema.value);else if(r.kind==="intersection")for(let i of r.members)n(i)};return n(e),t}function K(e,t={}){return X(e,t).entry}function Q(e,t){let n=d(e.services);return{multipart:n.some(r=>r.requestBody&&S(r.requestBody)),auth:e.securitySchemes.length>0||n.some(r=>r.security.length>0),sse:n.some(r=>r.sse!==void 0),setup:!!t.setup,paginate:(t.pagination??new Map).size>0}}function V(e,t){return t.runtime!=="module"?[]:_(Q(e,t),t.importExt??"js").map(({name:n,content:r})=>({name:n,content:`${y}
50
+
51
+ ${r.trim()}
52
+ `}))}function se(e,t,n){let r=e.importExt??"js",i=["OperationDescriptor",...e.setup?["ClientConfig","Middleware"]:[],...t.errorMode==="result"&&n?["Result"]:[]].sort();return[`import { createClient${e.setup?", mergeSetup":""} } from './runtime/factory.${r}';`,`import type { ${i.join(", ")} } from './runtime/types.${r}';`,`export * from './runtime/factory.${r}';`].join(`
53
+ `)}function W(e,t,n){return X(e,t,n)}function X(e,t,n){let r=d(e.services),i=$(e),o=t.pagination??new Map,s={argsStyle:t.argsStyle??"grouped",errorMode:t.errorMode??"throw",dateType:t.dateType??"string",schemaNames:new Set(e.schemas.map(u=>u.name)),schemas:e.schemas,pagination:o},c=r.length>0?[q(e,i,s),F(e,i,s.dateType,o,s.argsStyle)]:["export type Ops = Record<string, never>;","export const OPERATIONS = {} as const satisfies Record<string, OperationDescriptor>;"],a=t.runtime==="module"?se(t,s,r.length>0):G(Q(e,t)),m=[P(e.schemas,s.dateType),J(e.schemas)].filter(u=>u.length>0).join(`
54
+
55
+ `),l=[...r.map(u=>U(u,s)),...c].filter(u=>u.length>0).join(`
56
+
57
+ `),p=ae(r,i),f=t.runtime==="module";if(n===void 0)return{entry:O([y,M(e),...f?[a]:[],[m,l].filter(u=>u.length>0).join(`
58
+
59
+ `),...f?[]:[a],z(t,s,e),p])};let h=m.length>0;return{entry:O([y,M(e),...f?[a]:[],h?oe(e,s,`./${n}.schemas.${t.importExt??"js"}`):"",l,...f?[]:[a],z(t,s,e),p]),schemas:h?O([y,M(e),m]):void 0}}function oe(e,t,n){let r=B(e,t);return`${r.length>0?`import type { ${r.join(", ")} } from '${n}';
60
+ `:""}export * from '${n}';`}function z(e,t,n){let r=e.serverUrl??n.serverUrl,i=[...r!==void 0?[`serverUrl: ${E(r)}`]:[],...t.errorMode==="result"?['errorMode: "result"']:[],...t.argsStyle==="flat"?['argsStyle: "flat"']:[],'clientHeader: "redocly-client-generator"'],o=i.length>0?`{ ${i.join(", ")} }`:"{}",s=e.setup?`mergeSetup({ config: ${o} }, mergeSetup(__redoclySetup, {}))`:o,c=d(n.services),a=c.some(p=>p.tags.length>0),l=`export const client = createClient${c.length>0?`<Ops, OperationId, OperationPath, ${a?"OperationTag":"string"}>`:"<Ops>"}(OPERATIONS, ${s});`;return e.setup?`// \u2500\u2500\u2500 Baked-in setup (--setup) \u2500\u2500\u2500
61
+ const __redoclySetup: { config?: ClientConfig; middleware?: Middleware[] } = ${e.setup};
62
+ `+l:l}function ae(e,t){let n=["export const { configure, use } = client;"];if(e.length===0)return n.join(`
63
+ `);let r=e.map(i=>t.get(i.name)).join(", ");return n.push(`export const { ${r} } = client;`),n.join(`
64
+ `)}var we=({model:e,output:t,outputMode:n,emit:r})=>{let i=V(e,r).map(({name:o,content:s})=>({path:Y(t.dir,"runtime",o),content:s}));if(n==="split"){let{dir:o,stem:s}=t,{entry:c,schemas:a}=W(e,r,s);return[...a===void 0?[]:[{path:Y(o,`${s}.schemas.ts`),content:a}],{path:t.path,content:c},...i]}return[{path:t.path,content:K(e,r)},...i]},De=({model:e,output:t,emit:n,pagination:r})=>[{path:t.path.replace(/\.[^.\\/]+$/,".typescript.md"),content:b(e,{title:`${e.title} TypeScript client reference`,frontmatter:n.docsFrontmatter===!0,language:{name:"typescript",label:"TypeScript",fence:"typescript",requires:"The client has no dependencies."},sample:i=>pe(i,{model:e,emit:n,outputPath:t.path}),paginated:new Set(r?.keys()??[])})}];function pe(e,t){let n=$(t.model).get(e.name)??e.name,i=`./${t.outputPath.replace(/^.*[\\/]/,"").replace(/\.[^.]+$/,"")}.${t.emit.importExt??"js"}`,o=e.queryParams.filter(p=>p.required),s=t.emit.argsStyle==="flat",c=e.pathParams.map(p=>`${p.name}: '<${p.name}>'`),a=o.map(p=>`${p.name}: /* \u2026 */`),m=s?[...c,...a,...e.requestBody?["/* body properties */"]:[]]:[...c.length>0?[`path: { ${c.join(", ")} }`]:[],...a.length>0?[`query: { ${a.join(", ")} }`]:[],...e.requestBody?["body: { /* \u2026 */ }"]:[]],l=m.length>0?[`{ ${m.join(", ")} }`]:[];return{lang:"typescript",label:"TypeScript SDK",source:`import { ${n} } from '${i}';
65
+
66
+ const result = await ${n}(${l.join(", ")});
67
+ `}}export{De as typescriptDocs,we as typescriptGenerator,pe as typescriptSample};
@@ -0,0 +1,57 @@
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"./UKSQ7B5H.js";import"./XDK4JK3V.js";import{g as m}from"./VWSPU27A.js";import{k as l,l as c}from"./YQS3OX36.js";import{c as b,d as $}from"./GBRES7WG.js";import"./PFYPTG4G.js";import{O as h}from"./BEOYUN4L.js";import"./NEWT5A6S.js";import"./NB54XRRU.js";import{a as C,b as S}from"./HJYFWIVE.js";import"./RFWIIJFG.js";import{join as y}from"node:path";function g(t){return(t??"").replace(/\s+/g," ").trim().replace(/\\/g,"\\\\").replace(/\|/g,"\\|")}function k(t){return[t.group===void 0?void 0:l(t.group),t.name].filter(Boolean).join(" ")}function R(t,e){return[t,k(e),...e.positionals.map(i=>`<${i.name}>`),...e.flags.filter(i=>i.required).map(i=>`--${i.name} <${i.type}>`),...e.body?[e.body.required?"--json '<json>'":"[--json '<json>']"]:[]].filter(i=>i!=="").join(" ")}function P(t,e){t.line("| Flag | Type | Required | Description |"),t.line("| ---- | ---- | -------- | ----------- |");for(let n of e){let i=[g(n.description),n.enum===void 0?"":`One of ${n.enum.map(r=>`\`${r}\``).join(", ")}.`,n.type==="array"?"Repeat the flag for multiple values.":""].filter(r=>r!=="").join(" ");t.line(`| \`--${n.name}\` | ${n.type} | ${n.required?"yes":"no"} | ${i} |`)}t.blank()}function A(t,e,n){if(t.line(`### \`${k(e)}\``),t.blank(),e.summary!==void 0&&(t.line(g(e.summary)),t.blank()),t.line(`\`${e.method} ${e.path}\``),t.blank(),t.line("```sh"),t.line(R(n.name,e)),t.line("```"),t.blank(),e.positionals.length>0){t.line("| Argument | Description |"),t.line("| -------- | ----------- |");for(let r of e.positionals)t.line(`| \`<${r.name}>\` | ${g(r.description)} |`);t.blank()}e.flags.length>0&&P(t,e.flags);let i=[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(r=>r!=="");for(let r of i)t.line(r);i.length>0&&t.blank()}function v(t,e){let n=new C;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 i=e.schemes.some(o=>o.kind==="bearer");for(let[o,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."],...i?[["--token <token>","Bearer token, overriding the environment."]]:[],["--json <json\\|@file\\|@->","Request body, inline or from a file or stdin."]])n.line(`| \`${o}\` | ${s} |`);n.blank();let r=c(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 o of e.schemes){let s=o.kind==="bearer"?`\`${r}_TOKEN\` (or \`--token\`)`:o.kind==="basic"?`\`${r}_USERNAME\` and \`${r}_PASSWORD\``:`\`${r}_API_KEY_${c(o.key)}\``;n.line(`| ${o.kind} (\`${o.key}\`) | ${s} |`)}}n.blank(),n.line("## Exit codes"),n.blank(),n.line("| Code | Meaning |"),n.line("| ---- | ------- |");for(let[o,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(`| ${o} | ${s} |`);n.blank(),n.line("Errors print one JSON object to stderr, so stdout stays clean for piping."),n.blank();let a=[...new Set(t.map(o=>o.group))];for(let o of a){let s=t.filter(d=>d.group===o);o===void 0?(n.line("## Commands"),n.blank()):(n.line(`## ${o}`),n.blank(),n.line(`Addressed as \`${e.name} ${l(o)} <command>\`.`),n.blank());for(let d of s)A(n,d,e)}return n.toString().replace(/\n{3,}/g,`
8
+
9
+ `).trimEnd()+`
10
+ `}function w(){return $["cli.ts"]}function x(){return b["cli.ts"]}var E="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function q(t){return S.snake(t).replace(/_/g,"-")}function j(t){let e=t.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:q(t.name),param:t.name,type:n,required:t.required,...e.kind==="enum"?{enum:e.values.map(String)}:{},...t.description!==void 0?{description:t.description}:{}}}function F(t){let e=t.successResponses;return e.some(n=>n.contentType.toLowerCase().includes("json"))?!1:e.some(n=>n.contentType.startsWith("image/")||n.contentType==="application/octet-stream")}function N(t){return t.successResponses.find(e=>e.contentType.toLowerCase().includes("json"))?.schema}function T(t,e,n){if(n!=="flat")return{};let i=m(t,e.schemas);return"mergeBody"in i&&i.mergeBody?{merged:!0}:{}}function D(t,e,n){return n!=="flat"?{}:"collisions"in m(t,e.schemas)?{argsStyle:"grouped"}:{}}function p(t,e){let n=[];for(let i of t.services)for(let r of i.operations){let a=r.requestBody?.contentType.toLowerCase().includes("json")?r.requestBody:void 0,o=N(r);n.push({...r.tags.length>0?{group:r.tags[0]}:{},name:r.name,...r.summary!==void 0?{summary:r.summary}:{},method:r.method.toUpperCase(),path:r.path,positionals:r.pathParams.map(s=>({name:s.name,type:j(s).type,...s.description!==void 0?{description:s.description}:{}})),flags:r.queryParams.map(j),...a?{body:{required:a.required,...T(r,t,e.argsStyle)}}:{},...a===void 0&&r.requestBody!==void 0?{unsupportedBody:r.requestBody.contentType}:{},...e.pagination?.has(r.name)===!0?{paginated:!0}:{},...D(r,t,e.argsStyle),...r.sse!==void 0?{sse:!0}:{},...F(r)?{blob:!0}:{},...a!==void 0||o!==void 0?{schemas:{...a?{request:a.schema}:{},...o!==void 0?{response:o}:{}}}:{}})}return n}var U=`function isProcessEntry(): boolean {
11
+ if (process.argv[1] === undefined) return false;
12
+ try {
13
+ return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
14
+ } catch {
15
+ return false;
16
+ }
17
+ }
18
+ if (isProcessEntry()) {
19
+ process.exit(await run());
20
+ }`;function u(t,e){return JSON.stringify(t,null,e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function f(t){return t.securitySchemes.map(e=>({key:e.key,kind:e.kind==="bearer"||e.kind==="basic"?e.kind:"apiKey"}))}function _(t){return t.group===void 0?`${t.name} (keeps the bare word, so the "${t.name}" group has no help page)`:`${t.name} (run it as "${l(t.group)} ${t.name}")`}function B(t){let e=new Set(t.filter(i=>i.group).map(i=>l(i.group))),n=t.filter(i=>e.has(i.name));n.length!==0&&h.warn(`generate-client: cli reads a leading group name as the group, so ${n.length} operation(s) named after a tag resolve unusually \u2014 rename the operation or the tag: ${n.map(_).join(", ")}.
21
+ `)}function M(t,e){let n=p(t,{pagination:e.pagination,argsStyle:e.argsStyle});B(n);let i=f(t),r=`./${e.stem}.${e.importExt}`,a=["client","configure",...e.zodSelected?["use"]:[]];return["#!/usr/bin/env node",E,`import { readFileSync, realpathSync, writeFileSync } from "node:fs";
22
+ import { fileURLToPath } from "node:url";`,[`import { ${a.join(", ")} } from "${r}";`,...e.zodSelected?[`import { zodValidation } from "./${e.stem}.zod.${e.importExt}";`]:[]].join(`
23
+ `),e.runtime==="module"?`import { invokedName, runCli, type CliCommand, type CliWiring } from "./runtime/cli.${e.importExt}";`:`// \u2500\u2500\u2500 Embedded cli engine (@redocly/client-generator) \u2500\u2500\u2500
24
+ `+w(),`export const COMMANDS: CliCommand[] = ${u(n,2)};`,...e.zodSelected?['use(zodValidation(process.argv.includes("--dry-run") ? { response: false } : {}));']:[],`export const wiring: CliWiring = {
25
+ name: invokedName(process.argv[1], ${u(e.stem)}),
26
+ envPrefix: ${u(c(e.stem))},
27
+ client,
28
+ ${e.argsStyle==="flat"?` argsStyle: "flat",
29
+ `:""} configure,
30
+ schemes: ${u(i)},
31
+ env: process.env,
32
+ stdin: () => readFileSync(0, "utf-8"),
33
+ readFile: (path: string) => readFileSync(path, "utf-8"),
34
+ writeFile: (path: string, data: Uint8Array) => writeFileSync(path, data),
35
+ stdout: (line: string) => console.log(line),
36
+ stderr: (line: string) => console.error(line),
37
+ };
38
+
39
+ /** Run this CLI programmatically; defaults to the process argv. */
40
+ export const run = (argv: string[] = process.argv.slice(2)): Promise<number> =>
41
+ runCli(COMMANDS, wiring, argv);
42
+
43
+ // Re-exported so a composed entry can run these commands without its own runtime copy.
44
+ export { runCli };
45
+
46
+ // Self-execute only as the process entry, so importing this module is side-effect-safe:
47
+ // composed binaries and login-style wrappers import COMMANDS/wiring/run instead of
48
+ // editing this generated file.
49
+ ${U}`].join(`
50
+
51
+ `)+`
52
+ `}var ne=({model:t,output:e,banner:n,emit:i,selected:r,pagination:a})=>{let o=M(t,{stem:e.stem,importExt:i.importExt??"js",zodSelected:r?.includes("zod")??!1,pagination:a,argsStyle:i.argsStyle??"grouped",runtime:i.runtime??"inline"}),s={path:y(e.dir,`${e.stem}.cli.ts`),content:o};if(i.runtime!=="module")return[s];let d=n.map(O=>`// ${O}`).join(`
53
+ `);return[s,{path:y(e.dir,"runtime","cli.ts"),content:`${d}
54
+
55
+ ${x().trim()}
56
+ `}]},te=({model:t,output:e,emit:n,pagination:i})=>{let r=v(p(t,{pagination:i}),{title:`${t.title} command-line reference`,frontmatter:n.docsFrontmatter===!0,name:e.stem,schemes:f(t)});return[{path:y(e.dir,`${e.stem}.cli.md`),content:r}]};function re(t,e){let n=p(e.model,{pagination:e.pagination}).find(r=>r.name===t.name);return n===void 0?void 0:{lang:"shell",label:"CLI",source:`npx tsx client.cli.ts ${["client",...n.group?[l(n.group)]:[],n.name,...n.positionals.map(r=>`<${r.name}>`),...n.flags.filter(r=>r.required).map(r=>`--${r.name} <${r.type}>`),...n.body?["--json '<json>'"]:[]].slice(1).join(" ")}
57
+ `}}export{te as cliDocs,ne as cliGenerator,re as cliSample};
@@ -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}from"./QW5MTOU2.js";import"./YQS3OX36.js";import"./GBRES7WG.js";import"./PFYPTG4G.js";import"./BEOYUN4L.js";import"./NEWT5A6S.js";import"./NB54XRRU.js";import"./HJYFWIVE.js";import"./RFWIIJFG.js";export{a as mockGenerator};