@redocly/cli 2.64.0 → 2.65.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 (125) hide show
  1. package/lib/chunks/{ALBI5SPY.js → 2N5733QR.js} +1 -1
  2. package/lib/chunks/{654FMWX6.js → 2WJNLVFJ.js} +1 -1
  3. package/lib/chunks/{XYU2LTWU.js → 2XSAJEYO.js} +1 -1
  4. package/lib/chunks/{UC5EDLXL.js → 472CS7HK.js} +1 -1
  5. package/lib/chunks/{ULQK2S4O.js → 47H5P7DF.js} +1 -1
  6. package/lib/chunks/{S3W5GQGC.js → 4BWADBBP.js} +1 -1
  7. package/lib/chunks/{N4R4236N.js → 4K73EOV3.js} +1 -1
  8. package/lib/chunks/{VKTRI5YG.js → 5BB2E772.js} +1 -1
  9. package/lib/chunks/{4EAF6XUQ.js → 5KWYBSEY.js} +1 -1
  10. package/lib/chunks/{GRTUPOKN.js → 6D4QQEWE.js} +64 -64
  11. package/lib/chunks/{2MCPXKB6.js → 6D6SERR2.js} +1 -1
  12. package/lib/chunks/{RWDQI2KD.js → 6TFC2OYQ.js} +1 -1
  13. package/lib/chunks/{QCOPS234.js → 7BZGNWGO.js} +1 -1
  14. package/lib/chunks/{M4NCSK7Q.js → 7IN56VMG.js} +1 -1
  15. package/lib/chunks/{J665DSDI.js → 7Y45I5SU.js} +1 -1
  16. package/lib/chunks/{2ZIICV4T.js → A55KSVEI.js} +1 -1
  17. package/lib/chunks/{UQW6CW3M.js → AAMQ6PF3.js} +1 -1
  18. package/lib/chunks/{WQBSNQXL.js → B6HQPQVF.js} +1 -1
  19. package/lib/chunks/{L5X7LBV6.js → B6V4SOCA.js} +1 -1
  20. package/lib/chunks/{GOTKYHFM.js → BAIZWXC6.js} +1 -1
  21. package/lib/chunks/{6MP4DHWK.js → BWA2MZEG.js} +1 -1
  22. package/lib/chunks/{BWXAXULF.js → C462YNOX.js} +1 -1
  23. package/lib/chunks/{TWFZE4OF.js → C6QQGZXT.js} +1 -1
  24. package/lib/chunks/{LG3SUXEW.js → CBJ23L7Q.js} +1 -1
  25. package/lib/chunks/{6FADWAOY.js → EIGOI65B.js} +1 -1
  26. package/lib/chunks/{GKSUZULD.js → FGKVDZSD.js} +1 -1
  27. package/lib/chunks/{Z4X6WES7.js → FRHR2DRO.js} +1 -1
  28. package/lib/chunks/H2G6FSDS.js +53 -0
  29. package/lib/chunks/{7APJVQSB.js → HNEOPZAP.js} +1 -1
  30. package/lib/chunks/{OS52EARM.js → HQSXMF3M.js} +1 -1
  31. package/lib/chunks/{FVGFKJ67.js → IFWW4AH6.js} +1 -1
  32. package/lib/chunks/{2DKR4Z25.js → IJJGUPFL.js} +1 -1
  33. package/lib/chunks/{WKQJPOYW.js → J7YUB7EL.js} +1 -1
  34. package/lib/chunks/{UNOXQ62I.js → JIU326EH.js} +2 -2
  35. package/lib/chunks/{NRWIPPEV.js → JUZHXP62.js} +1 -1
  36. package/lib/chunks/{RRQJCLNO.js → K6KXLY2V.js} +1 -1
  37. package/lib/chunks/{CVPT656W.js → KIY6ZQFM.js} +1 -1
  38. package/lib/chunks/{X6TQQHRM.js → KKAYPMM3.js} +1 -1
  39. package/lib/chunks/{ONBORCDJ.js → LUYLXWYZ.js} +1 -1
  40. package/lib/chunks/{CEASD5U3.js → M2DYVAS3.js} +1 -1
  41. package/lib/chunks/{VWF52WKH.js → ME4RMLPZ.js} +1 -1
  42. package/lib/chunks/{FXKIC5R3.js → MQWGV2WY.js} +1 -1
  43. package/lib/chunks/{3CSDNX6S.js → MWJKN6NG.js} +1 -1
  44. package/lib/chunks/{HYMULX2S.js → N7JGYQGR.js} +1 -1
  45. package/lib/chunks/{FU7GBMUU.js → O7U2BX37.js} +1 -1
  46. package/lib/chunks/{XDBFHG7X.js → OD47UYXG.js} +1 -1
  47. package/lib/chunks/{JQJ5TDVP.js → PBXLYXXR.js} +1 -1
  48. package/lib/chunks/{MVCGBDOY.js → PO4VK5GM.js} +1 -1
  49. package/lib/chunks/{TTE4EAVV.js → PUFMOTSK.js} +1 -1
  50. package/lib/chunks/{SRRHJLPL.js → QJUYBSEZ.js} +1 -1
  51. package/lib/chunks/{ENIPOAVJ.js → QV24OXH3.js} +2 -2
  52. package/lib/chunks/{DPNI74SB.js → RR6N3VYB.js} +1 -1
  53. package/lib/chunks/{M74SGAZK.js → S242M5IF.js} +1 -1
  54. package/lib/chunks/{ZM3M44Q3.js → SCB6ZITR.js} +1 -1
  55. package/lib/chunks/{DL4VP2Z4.js → SDQYWQUI.js} +2 -2
  56. package/lib/chunks/{LMO5V2XF.js → SEKSITHZ.js} +1 -1
  57. package/lib/chunks/{LCAJ35J6.js → SEYOG575.js} +1 -1
  58. package/lib/chunks/{B5ZOH4BB.js → SMBH5JAE.js} +1 -1
  59. package/lib/chunks/{5PR7FNUB.js → T66YKREQ.js} +1 -1
  60. package/lib/chunks/{BGGUKU7E.js → TYX2MLO5.js} +1 -1
  61. package/lib/chunks/{I6NMWBVI.js → U2GUGMK3.js} +35 -35
  62. package/lib/chunks/{AC62H63B.js → UE7IAPIP.js} +1 -1
  63. package/lib/chunks/{EQTXHL74.js → VAPFU7OM.js} +2 -2
  64. package/lib/chunks/{OGNRVBTI.js → WDTMN7JE.js} +1 -1
  65. package/lib/chunks/{HIII45WJ.js → WUOVEP7D.js} +1 -1
  66. package/lib/chunks/{VMIHLA3H.js → XIQZ6CQT.js} +1 -1
  67. package/lib/chunks/{GKCVQWOQ.js → YLLKDBIZ.js} +3 -3
  68. package/lib/chunks/{ZFXOCOU6.js → ZB7MWGMD.js} +1 -1
  69. package/lib/chunks/{IH3N62Q4.js → ZCLACSBJ.js} +1 -1
  70. package/lib/chunks/{QWTSCCNH.js → ZGFTDVO4.js} +1 -1
  71. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  72. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  73. package/lib/eject-assets/generators/cli/index.ts +2 -2
  74. package/lib/eject-assets/generators/cli/render.ts +1 -1
  75. package/lib/eject-assets/generators/go/client.ts +1 -1
  76. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  77. package/lib/eject-assets/generators/go/index.ts +2 -2
  78. package/lib/eject-assets/generators/go/models.ts +1 -1
  79. package/lib/eject-assets/generators/go/naming.ts +1 -1
  80. package/lib/eject-assets/generators/go/operations.ts +1 -1
  81. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  82. package/lib/eject-assets/generators/go/types.ts +1 -1
  83. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  84. package/lib/eject-assets/generators/mock/index.ts +2 -2
  85. package/lib/eject-assets/generators/mock/render.ts +1 -1
  86. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  87. package/lib/eject-assets/generators/mock/values.ts +1 -1
  88. package/lib/eject-assets/generators/php/client.ts +1 -1
  89. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  90. package/lib/eject-assets/generators/php/index.ts +2 -2
  91. package/lib/eject-assets/generators/php/models.ts +1 -1
  92. package/lib/eject-assets/generators/php/naming.ts +1 -1
  93. package/lib/eject-assets/generators/php/operations.ts +1 -1
  94. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  95. package/lib/eject-assets/generators/php/types.ts +1 -1
  96. package/lib/eject-assets/generators/python/client.ts +1 -1
  97. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  98. package/lib/eject-assets/generators/python/index.ts +2 -2
  99. package/lib/eject-assets/generators/python/models.ts +1 -1
  100. package/lib/eject-assets/generators/python/naming.ts +1 -1
  101. package/lib/eject-assets/generators/python/operations.ts +1 -1
  102. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  103. package/lib/eject-assets/generators/python/types.ts +1 -1
  104. package/lib/eject-assets/generators/swr/index.ts +2 -2
  105. package/lib/eject-assets/generators/swr/render.ts +1 -1
  106. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  107. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  108. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  109. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  110. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  111. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  112. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  113. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  114. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  115. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  116. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  117. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  118. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  119. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  120. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  121. package/lib/eject-assets/generators/zod/index.ts +2 -2
  122. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  123. package/lib/index.js +5 -5
  124. package/package.json +1 -1
  125. package/lib/chunks/U4RAHOFK.js +0 -53
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./NRWIPPEV.js";import{ca as w,ga as l,ia as n,l as x,pa as h,va as A,wa as g,ya as k}from"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
7
+ import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./JUZHXP62.js";import{ca as w,ga as l,ia as n,l as x,pa as h,va as A,wa as g,ya as k}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
8
8
 
9
9
  `),f===void 0?n.info(l(`validating ${m(o)}...
10
10
  `)):n.info(l(`validating ${m(o)} using lint rules for api '${f}'...
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./NRWIPPEV.js";import{aa as y,ba as $,ca as i,ga as u,ia as n,pa as k,ra as T,u as O,va as B,wa as E}from"./EQTXHL74.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
7
+ import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./JUZHXP62.js";import{aa as y,ba as $,ca as i,ga as u,ia as n,pa as k,ra as T,u as O,va as B,wa as E}from"./VAPFU7OM.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
8
8
  `)):n.info(u(`bundling ${s(o)} using configuration for api '${c}'...
9
9
  `));let{bundle:D,problems:w,...x}=await T({ref:o,config:p,dereference:e.dereferenced,removeUnusedComponents:e["remove-unused-components"],keepUrlRefs:e["keep-url-references"],componentRenamingConflicts:e["component-renaming-conflicts-severity"],componentNamesStrategy:e["component-names-strategy"],overlays:m,collectSpecData:G}),r=B(w),{outputFile:f,ext:K}=F({entrypoint:o,output:J,argvOutput:e.output,ext:e.ext,entries:e?.apis?.length||0});if(r.errors===0||e.force)if(f){let t=g(b(D.parsed),K,e.dereferenced);_(f,t)}else{let t=g(b(D.parsed),e.ext||"yaml",e.dereferenced);n.output(t)}a.errors+=r.errors,a.warnings+=r.warnings,a.ignored+=r.ignored,E(w,{format:"codeframe",totals:r,version:W,command:"bundle"}),e.metafile&&(A.length>1&&n.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),L(e.metafile,JSON.stringify(x),"utf-8"));let h=R(d);r.errors>0?e.force?n.info(`\u2753 Created a bundle for ${i(s(o))} at ${i(f||"stdout")} with errors ${y(h)}.
10
10
  ${$("Errors ignored because of --force")}.
@@ -4,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{ca as e,ia as t}from"./EQTXHL74.js";function r({verificationUri:o,userCode:n}){t.output(`Attempting to automatically open the SSO authorization page in your default browser.
7
+ import{ca as e,ia as t}from"./VAPFU7OM.js";function r({verificationUri:o,userCode:n}){t.output(`Attempting to automatically open the SSO authorization page in your default browser.
8
8
  `),t.output(`If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
9
9
 
10
10
  `),t.output(e(o)),t.output(`
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a}from"./FXKIC5R3.js";import"./JQJ5TDVP.js";import"./UNOXQ62I.js";import"./WZXA5XPB.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
7
+ import{a}from"./MQWGV2WY.js";import"./PBXLYXXR.js";import"./JIU326EH.js";import"./WZXA5XPB.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b,c,d,e}from"./GOTKYHFM.js";import"./HAOBCQWB.js";import"./JQJ5TDVP.js";import"./UNOXQ62I.js";import"./WZXA5XPB.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as phpDocs,c as phpGenerator,d as phpSample,a as phpType,b as renderPhpModels};
7
+ import{a,b,c,d,e}from"./BAIZWXC6.js";import"./HAOBCQWB.js";import"./PBXLYXXR.js";import"./JIU326EH.js";import"./WZXA5XPB.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as phpDocs,c as phpGenerator,d as phpSample,a as phpType,b as renderPhpModels};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./JQJ5TDVP.js";import{a as B,e as C,g as G}from"./UNOXQ62I.js";import{a}from"./WZXA5XPB.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{z as AUTHORING_HELPER_NAMES,G as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,C as WIRING_NAMES,B as allOperations,c as casing,E as constantCase,A as defineClientSetup,H as defineGenerator,g as deref,i as discriminatorCases,m as docText,l as enumValues,h as flattenAllOf,I as generateClient,D as groupSlug,o as headerCoerceType,e as identifierFor,u as isBinaryContentType,s as isMultipartBody,j as isNullable,t as isUntypedMultipartBody,q as jsonSuccessSchema,F as mergeConfig,x as paginationItemSchema,p as paginationRuleFor,y as renderReferencePage,n as resolveSchemaPointer,n as schemaAtPointer,w as securityRequirements,v as serverUrlParts,r as sseResponse,f as uniqueIdentifiers,k as unwrapNullable};
7
+ import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./PBXLYXXR.js";import{a as B,e as C,g as G}from"./JIU326EH.js";import{a}from"./WZXA5XPB.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{z as AUTHORING_HELPER_NAMES,G as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,C as WIRING_NAMES,B as allOperations,c as casing,E as constantCase,A as defineClientSetup,H as defineGenerator,g as deref,i as discriminatorCases,m as docText,l as enumValues,h as flattenAllOf,I as generateClient,D as groupSlug,o as headerCoerceType,e as identifierFor,u as isBinaryContentType,s as isMultipartBody,j as isNullable,t as isUntypedMultipartBody,q as jsonSuccessSchema,F as mergeConfig,x as paginationItemSchema,p as paginationRuleFor,y as renderReferencePage,n as resolveSchemaPointer,n as schemaAtPointer,w as securityRequirements,v as serverUrlParts,r as sseResponse,f as uniqueIdentifiers,k as unwrapNullable};
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a}from"./CEASD5U3.js";import{ia as p}from"./EQTXHL74.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
7
+ import{a}from"./M2DYVAS3.js";import{ia as p}from"./VAPFU7OM.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
8
8
  `);let i=new Set(t.schemas.map(e=>e.name)),o=n.filter(e=>e.sse===void 0&&m(e,i));return o.length>0&&p.warn(`generate-client: ${r} skipped ${o.length} operation(s) whose variables type name collides with a schema \u2014 rename the schema or the operation: ${o.map(e=>e.name).join(", ")}.
9
9
  `),n.filter(e=>e.sse===void 0&&!m(e,i))}function m(t,r){let n=a(t);return n.hasInputs&&r.has(n.variablesTypeName)}function x(t){return t.method==="get"||t.method==="head"}function u(t){return a(t).hasInputs}function f(t){return a(t).variablesTypeName}function $(t,r,n){let s=[];return a(t).hasInputs?s.push(r):n&&s.push("{}"),n&&s.push("{ ...init, envelope: undefined }"),`${t.name}(${s.join(", ")})`}function v(t,r,n){let s=t.map(e=>e.name).sort(),i=t.filter(u).map(f).sort();return n&&i.push("RequestOptions"),`import { ${[...s,...i.map(e=>`type ${e}`)].join(", ")} } from ${JSON.stringify(r)};`}export{g as a,x as b,u as c,f as d,$ as e,v as f};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c as p}from"./HBUZKWXC.js";import{a as i,b as s}from"./4PTNG4EI.js";import{ia as t}from"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as g}from"node:child_process";import{existsSync as l,readFileSync as P}from"node:fs";import w from"node:path";var S=async({argv:r})=>{let{plan:e,port:a}=r,n=r["project-dir"],o=r.product||h(n);if(!j(o))throw t.info(`Invalid product ${o}.`),new Error("Project preview launch failed.");let c=s[o],d=i[o];t.info(`
7
+ import{c as p}from"./HBUZKWXC.js";import{a as i,b as s}from"./4PTNG4EI.js";import{ia as t}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as g}from"node:child_process";import{existsSync as l,readFileSync as P}from"node:fs";import w from"node:path";var S=async({argv:r})=>{let{plan:e,port:a}=r,n=r["project-dir"],o=r.product||h(n);if(!j(o))throw t.info(`Invalid product ${o}.`),new Error("Project preview launch failed.");let c=s[o],d=i[o];t.info(`
8
8
  Launching preview of ${c} ${e} using NPX.
9
9
 
10
10
  `);let{npxExecutableName:m,shell:f}=p();g(m,["-y",d,"preview",`--plan=${e}`,`--port=${a||4e3}`],{stdio:"inherit",cwd:n,shell:f}).on("error",u=>{throw t.info(`Project preview launch failed: ${u.message}`),new Error("Project preview launch failed.")})},j=r=>r?!!s[r]:!1,h=r=>{let e=w.join(process.cwd(),r,"package.json");if(l(e))try{let n=JSON.parse(P(e,"utf-8")).dependencies||{};for(let[o,c]of Object.entries(i))if(n[c])return t.info(`
@@ -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
- var e={name:"@redocly/cli",version:"2.64.0",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.32.1","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.7.0","@redocly/openapi-core":"2.64.0","@redocly/recheck":"2.64.0","@redocly/respect-core":"2.64.0","@redocly/reunite-integration":"2.64.0","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.10",react:"^17.0.0 || ^18.2.0 || ^19.2.7","react-dom":"^17.0.0 || ^18.2.0 || ^19.2.7",redoc:"2.5.4",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^7.30.0",yargs:"17.0.1"}};var{version:c,name:i,engines:s}=e,n=e.devDependencies.redoc,p="sha384-w447zOpYfw/1Tv/5AK9NfHTlQIqE3RVR6KY62jCyy9zNDgO64cMwGGP1Fj0zJVf5";export{c as a,i as b,s as c,n as d,p as e};
7
+ var e={name:"@redocly/cli",version:"2.65.0",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.32.1","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.7.2","@redocly/openapi-core":"2.65.0","@redocly/recheck":"2.65.0","@redocly/respect-core":"2.65.0","@redocly/reunite-integration":"2.65.0","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.10",react:"^17.0.0 || ^18.2.0 || ^19.2.7","react-dom":"^17.0.0 || ^18.2.0 || ^19.2.7",redoc:"2.5.4",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^7.30.0",yargs:"17.0.1"}};var{version:c,name:i,engines:s}=e,n=e.devDependencies.redoc,p="sha384-w447zOpYfw/1Tv/5AK9NfHTlQIqE3RVR6KY62jCyy9zNDgO64cMwGGP1Fj0zJVf5";export{c as a,i as b,s as c,n as d,p as e};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as W}from"./HAOBCQWB.js";import{b as E,c as I,d as L,e as F,f as ne,g as te,h as re,i as ie,j as se}from"./JQJ5TDVP.js";import{a as X,c as C,d as p,e as S,f as N,g as R,h as B,i as Z,j,k as D,l as O,n as ee}from"./UW4UC7ZI.js";var U=C.php,w=class extends X{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return S(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of O(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=O(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,G=new w;function y(e){return G.typeName(e)}function k(e){return G.memberName(e)}function o(e){return G.string(e)}function ae(e){return p(e.name,{style:"camel",reserved:h})}function K(e){let n=e.services.flatMap(i=>i.operations),s=S(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function he(e){return te(e).map(s=>s.kind==="literal"?o(s.value):`$${k(s.name)}`).join(" . ")}function oe(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let c=r.variables.map(l=>`string $${k(l.name)} = ${o(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${c.join(", ")}): string`),e.block("{",()=>{e.line(`return ${he(r)};`)},"}")})},"}"),e.blank()}function ce(e,n){let s=re(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${o(t.scheme)}, 'name' => ${o(t.name)}, 'in' => ${o(t.in)}]`:`['kind' => ${o(t.kind)}, 'scheme' => ${o(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function le(e){return`[${[`'style' => ${o(e.style)}`,...e.param!==void 0?[`'param' => ${o(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${o(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${o(e.hasMore)}`]:[],...e.nextLink!==void 0?[`'nextLink' => ${o(e.nextLink)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${o(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${o(e.items)}`]:[]].join(", ")}]`}function ue(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let c=ee(r.schema,n);return`[${o(r.name)}, ${o(t)}, ${o(c)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=D(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&R(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&J(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=N(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return ye(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function J(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function ye(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function V(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=N(i,n);return _(i.name,n)==="other"?V(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function $e(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&B(s.schema,n)!==void 0}function q(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&J(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return q({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if($e(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=N(r,s);return a===void 0?void 0:q(a,n,s,i)}if(r.kind==="array"){let t=q(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=q(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function x(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return x({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if($e(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=N(r,s);return a===void 0?void 0:x(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=x(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function ge(e,n,s,i,r,t){let a=[...s.filter(c=>c.required),...s.filter(c=>!c.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let c of a){let l=m(c.schema,i,r);if(c.required)e.line(`public ${l} $${k(c.name)},`);else{let u=A(l);e.line(`public ${u} $${k(c.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let c of a){let l=`$data[${o(c.name)}]`,u=q(c.schema,l,i,r),d=k(c.name);c.required?e.line(`${d}: ${u??l},`):u===void 0?e.line(`${d}: ${l} ?? null,`):e.line(`${d}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let c of a){let l=`$this->${k(c.name)}`,u=x(c.schema,l,i,r)??l;c.required?e.line(`$data[${o(c.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${o(c.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function z(e,n="string"){let s=new w;for(let{name:i,schema:r}of e.schemas){let t=D(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let c=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${c}`),s.block("{",()=>{let l=S(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,d)=>{let b=typeof u=="string"?o(u):String(u);s.line(`case ${l[d]} = ${b};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let c=R(r,e);if(c!==void 0){ge(s,i,c.properties,e,n,c.description??r.description);continue}}let a=B(r,e);if(a!==void 0){let c=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${c} is a discriminated union (${o(a.property)}): ${l}. */`),s.line(`function unmarshal${c}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${o(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${o(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var de=new Set(["post","put","patch"]),be=["body","headers","idempotencyKey"];function fe(e){return F(e)||e.requestBody!==void 0&&ne(e.requestBody.contentType)}function Q(e,n,s,i){let r=S([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:be}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let d=r[e.pathParams.length+u];return{php:d,wire:l.name,type:m(l.schema,n,i),value:x(l.schema,`$${d}`,n,i)??`$${d}`}}),c=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${fe(e)?"mixed":L(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&de.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:c}}function ke(e,n,s){e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${o(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${o(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Y(e,n,s,i,r,t=!1){let a=Q(n,i,!0,r),c=I(n),l=E(n),u=c===void 0&&l===void 0&&n.successResponses.some(g=>g.contentType!==""),d=t?"Envelope":c!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",b=t?`${s}WithHeaders`:s,H=t?void 0:V(l,i,r);e.doc(b,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${b}(${a.signature.join(", ")}): ${d}`),e.block("{",()=>{if(ke(e,n,a),c!==void 0){let f=c.schema!==void 0&&c.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${f?"true":"false"});`);return}let g=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(F(n))e.line("[$contentType, $encoded] = multipartBody($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody&&fe(n))g.push("'body' => binaryBody($body)",`'contentType' => ${o(n.requestBody.contentType)}`);else if(n.requestBody&&L(n))e.line("[$contentType, $encoded] = toMultipart($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let f=x(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${f});`),g.push("'body' => $payload",`'contentType' => ${o(n.requestBody.contentType)}`)}de.has(n.method.toLowerCase())&&n.requestBody&&g.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${g.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:q(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ue(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(d==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function me(e,n,s,i,r,t,a,c,l){let u=Q(n,i,!1,r),d=s,b=()=>{e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:f,wire:P,value:v}of u.queryArgs)e.block(`if ($${f} !== null) {`,()=>{e.line(`$base[${o(P)}] = ${v};`)},"}");let $=u.pathArgs.map(({php:f,wire:P})=>`${o(P)} => $${f}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),g=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${d} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${g}>`),e.line(" */"),e.line(`public function ${d}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${d} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${d}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${o(c??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function Pe(e){let n=e.split(`
7
+ import{b as W}from"./HAOBCQWB.js";import{b as E,c as I,d as L,e as F,f as ne,g as te,h as re,i as ie,j as se}from"./PBXLYXXR.js";import{a as X,c as C,d as p,e as S,f as N,g as R,h as B,i as Z,j,k as D,l as O,n as ee}from"./UW4UC7ZI.js";var U=C.php,w=class extends X{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return S(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of O(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=O(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,G=new w;function y(e){return G.typeName(e)}function k(e){return G.memberName(e)}function o(e){return G.string(e)}function ae(e){return p(e.name,{style:"camel",reserved:h})}function K(e){let n=e.services.flatMap(i=>i.operations),s=S(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function he(e){return te(e).map(s=>s.kind==="literal"?o(s.value):`$${k(s.name)}`).join(" . ")}function oe(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let c=r.variables.map(l=>`string $${k(l.name)} = ${o(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${c.join(", ")}): string`),e.block("{",()=>{e.line(`return ${he(r)};`)},"}")})},"}"),e.blank()}function ce(e,n){let s=re(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${o(t.scheme)}, 'name' => ${o(t.name)}, 'in' => ${o(t.in)}]`:`['kind' => ${o(t.kind)}, 'scheme' => ${o(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function le(e){return`[${[`'style' => ${o(e.style)}`,...e.param!==void 0?[`'param' => ${o(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${o(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${o(e.hasMore)}`]:[],...e.nextLink!==void 0?[`'nextLink' => ${o(e.nextLink)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${o(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${o(e.items)}`]:[]].join(", ")}]`}function ue(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let c=ee(r.schema,n);return`[${o(r.name)}, ${o(t)}, ${o(c)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=D(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&R(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&J(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=N(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return ye(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function J(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function ye(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function V(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=N(i,n);return _(i.name,n)==="other"?V(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function $e(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&B(s.schema,n)!==void 0}function q(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&J(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return q({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if($e(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=N(r,s);return a===void 0?void 0:q(a,n,s,i)}if(r.kind==="array"){let t=q(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=q(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function x(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return x({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if($e(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=N(r,s);return a===void 0?void 0:x(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=x(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function ge(e,n,s,i,r,t){let a=[...s.filter(c=>c.required),...s.filter(c=>!c.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let c of a){let l=m(c.schema,i,r);if(c.required)e.line(`public ${l} $${k(c.name)},`);else{let u=A(l);e.line(`public ${u} $${k(c.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let c of a){let l=`$data[${o(c.name)}]`,u=q(c.schema,l,i,r),d=k(c.name);c.required?e.line(`${d}: ${u??l},`):u===void 0?e.line(`${d}: ${l} ?? null,`):e.line(`${d}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let c of a){let l=`$this->${k(c.name)}`,u=x(c.schema,l,i,r)??l;c.required?e.line(`$data[${o(c.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${o(c.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function z(e,n="string"){let s=new w;for(let{name:i,schema:r}of e.schemas){let t=D(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let c=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${c}`),s.block("{",()=>{let l=S(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,d)=>{let b=typeof u=="string"?o(u):String(u);s.line(`case ${l[d]} = ${b};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let c=R(r,e);if(c!==void 0){ge(s,i,c.properties,e,n,c.description??r.description);continue}}let a=B(r,e);if(a!==void 0){let c=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${c} is a discriminated union (${o(a.property)}): ${l}. */`),s.line(`function unmarshal${c}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${o(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${o(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var de=new Set(["post","put","patch"]),be=["body","headers","idempotencyKey"];function fe(e){return F(e)||e.requestBody!==void 0&&ne(e.requestBody.contentType)}function Q(e,n,s,i){let r=S([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:be}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let d=r[e.pathParams.length+u];return{php:d,wire:l.name,type:m(l.schema,n,i),value:x(l.schema,`$${d}`,n,i)??`$${d}`}}),c=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${fe(e)?"mixed":L(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&de.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:c}}function ke(e,n,s){e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${o(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${o(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Y(e,n,s,i,r,t=!1){let a=Q(n,i,!0,r),c=I(n),l=E(n),u=c===void 0&&l===void 0&&n.successResponses.some(g=>g.contentType!==""),d=t?"Envelope":c!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",b=t?`${s}WithHeaders`:s,H=t?void 0:V(l,i,r);e.doc(b,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${b}(${a.signature.join(", ")}): ${d}`),e.block("{",()=>{if(ke(e,n,a),c!==void 0){let f=c.schema!==void 0&&c.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${f?"true":"false"});`);return}let g=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(F(n))e.line("[$contentType, $encoded] = multipartBody($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody&&fe(n))g.push("'body' => binaryBody($body)",`'contentType' => ${o(n.requestBody.contentType)}`);else if(n.requestBody&&L(n))e.line("[$contentType, $encoded] = toMultipart($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let f=x(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${f});`),g.push("'body' => $payload",`'contentType' => ${o(n.requestBody.contentType)}`)}de.has(n.method.toLowerCase())&&n.requestBody&&g.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${g.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:q(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ue(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(d==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function me(e,n,s,i,r,t,a,c,l){let u=Q(n,i,!1,r),d=s,b=()=>{e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:f,wire:P,value:v}of u.queryArgs)e.block(`if ($${f} !== null) {`,()=>{e.line(`$base[${o(P)}] = ${v};`)},"}");let $=u.pathArgs.map(({php:f,wire:P})=>`${o(P)} => $${f}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),g=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${d} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${g}>`),e.line(" */"),e.line(`public function ${d}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${d} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${d}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${o(c??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function Pe(e){let n=e.split(`
8
8
  `),s=0;for(let i=0;i<n.length;i++)if(n[i].trim().startsWith("namespace ")){s=i+1;break}return n.slice(s).join(`
9
9
  `).trim()}var dn=({model:e,output:n,banner:s,emit:i,pagination:r})=>{let t=new w,a=i.dateType??"string",c=p(e.title,{style:"pascal",reserved:h});t.line("<?php"),t.blank(),t.line(`// Code generated by @redocly/client-generator (php) from ${o(e.title)} ${e.version}. DO NOT EDIT.`),t.line("// Regenerate with `redocly generate-client`. PHP >= 8.1, curl extension \u2014 zero Composer dependencies."),t.blank(),t.line("declare(strict_types=1);"),t.blank(),t.line(`namespace ${c};`),t.blank(),t.line(z(e,a)),oe(t,e),i.runtime==="module"?(t.line("// \u2500\u2500\u2500 Runtime (a real file beside this one, written by the same run) \u2500\u2500\u2500"),t.line("require_once __DIR__ . '/runtime.php';"),t.blank()):(t.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator php runtime) \u2500\u2500\u2500"),t.line(Pe(W)),t.blank());let l=e.services.flatMap($=>$.operations),u=K(e),d=new Map;for(let $ of l){let f=r?.get($.name)?.spec;f!==void 0&&d.set($.name,f)}t.doc("Client",`Client for ${e.title} (${e.version}).`),t.line("class Client"),t.block("{",()=>{t.block("public const OPERATIONS = [",()=>{for(let $ of l){let f=$.specName??$.name,P=ce($,e),v=d.get($.name),M=[`'id' => ${o(f)}`,`'method' => ${o($.method.toUpperCase())}`,`'path' => ${o($.path)}`,...P!==void 0?[`'security' => ${P}`]:[],...v!==void 0?[`'pagination' => ${le(v)}`]:[]];t.line(`${o(f)} => [${M.join(", ")}],`)}},"];"),t.blank(),t.line("public function __construct(private Config $config)"),t.block("{",()=>{t.block("if ($this->config->serverUrl === '') {",()=>{t.line(`$this->config->serverUrl = ${o(i.serverUrl??e.serverUrl??"")};`)},"}")},"}"),t.blank();for(let $ of l){let f=u.get($.name);Y(t,$,f,e,a),I($)===void 0&&($.successResponseHeaders?.length??0)>0&&Y(t,$,f,e,a,!0);let P=d.get($.name);if(P===void 0)continue;let v=E($),M=v===void 0?void 0:q(v,"$page",e,a),T=ie(v,P.items,e),pe=T===void 0?void 0:q(T,"$item",e,a);me(t,$,f,e,a,M,pe,P.items,T===void 0?"mixed":m(T,e,a))}},"}");let b={path:n.path.replace(/\.[^.\\/]+$/,".php"),content:t.toString()};if(i.runtime!=="module")return[b];let H=s.map($=>`// ${$}`).join(`
10
10
  `),g=W.replace(/^namespace .*$/m,`namespace ${c};`).replace(/^<\?php\n/,`<?php
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as A,c as F,d as S,e as l}from"./S3W5GQGC.js";import"./LG3SUXEW.js";import{e as $,g as x,n as I,o as P}from"./VKTRI5YG.js";import{f as p}from"./NRWIPPEV.js";import"./GKXY6U4S.js";import{aa as w,ia as n,l as u}from"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
7
+ import{b as A,c as F,d as S,e as l}from"./4BWADBBP.js";import"./CBJ23L7Q.js";import{e as $,g as x,n as I,o as P}from"./5BB2E772.js";import{f as p}from"./JUZHXP62.js";import"./GKXY6U4S.js";import{aa as w,ia as n,l as u}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
8
8
  `)}),!e.length)return p("push",h,"No files to upload");let m=await I({domain:f,apiKey:i,organization:g,project:d,mountPath:z,files:e,defaultBranch:t["default-branch"],commit:{message:t.message,branchName:t.branch,sha:t["commit-sha"],url:t["commit-url"],createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:U(t.author)},version:c,replace:t.replace,onUploadStart:a=>{n.info(`Uploading to ${a.mountPath} ${e.length} ${u("file",e.length)}:
9
9
  `)},onSunsetWarning:a=>s.push(a),onSlugDeprecated:S});r=m.pushId,y=m.organizationId,b=m.projectId}catch(i){l("push",s),F("\u2717 File upload failed.",i)}for(let i of e)n.info(w(`\u2713 ${i.name}
10
10
  `));return n.info(`
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b}from"./RWDQI2KD.js";import"./NRWIPPEV.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as bundleTelemetry,b as handleBundle};
7
+ import{a,b}from"./6TFC2OYQ.js";import"./JUZHXP62.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as bundleTelemetry,b as handleBundle};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as o,b as t,c as e}from"./HBUZKWXC.js";import{ia as r}from"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as p}from"node:child_process";var u=async({argv:n})=>{r.info(`
7
+ import{a as o,b as t,c as e}from"./HBUZKWXC.js";import{ia as r}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as p}from"node:child_process";var u=async({argv:n})=>{r.info(`
8
8
  Launching translate using NPX.
9
9
 
10
10
  `);let{npxExecutableName:s,sanitize:a,shell:i}=e(),l=a(n["project-dir"],o),c=a(n.locale,t);p(s,["-y","@redocly/realm","translate",c,`-d=${l}`],{stdio:"inherit",shell:i}).on("error",m=>{throw r.info(`Translate launch failed: ${m.message}`),new Error("Translate launch failed.")})};export{u as handleTranslations};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{ia as t}from"./EQTXHL74.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
7
+ import{ia as t}from"./VAPFU7OM.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
8
8
  `);return}this.intervalId===null&&(this.intervalId=setInterval(()=>{this.showFrame()},100))}}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,t.info("\r")),this.message=""}};function h(i){i.stop(),e.stderr.isTTY&&t.info("\x1B[2K")}function m(i,r){let[s]=r.inFlight;if(!s)return;let a=r.inFlight.size>1?` (+${r.inFlight.size-1} more)`:"";i.start(`[${r.position}/${r.total}] ${r.action} ${s}${a}`)}export{n as a,h as b,m as c};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b,c,d,e}from"./S3W5GQGC.js";import"./LG3SUXEW.js";import"./VKTRI5YG.js";import"./NRWIPPEV.js";import"./GKXY6U4S.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as DeploymentError,b as handlePushStatus,c as handleReuniteError,d as printSlugDeprecation,e as printSunsetWarning};
7
+ import{a,b,c,d,e}from"./4BWADBBP.js";import"./CBJ23L7Q.js";import"./5BB2E772.js";import"./JUZHXP62.js";import"./GKXY6U4S.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as DeploymentError,b as handlePushStatus,c as handleReuniteError,d as printSlugDeprecation,e as printSunsetWarning};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b,c,d,e,f,g}from"./I6NMWBVI.js";import"./UF2ZCH7W.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
7
+ import{a,b,c,d,e,f,g}from"./U2GUGMK3.js";import"./UF2ZCH7W.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as T,b as O,c as A,d as E}from"./LMO5V2XF.js";import{c as m,k as C,r as $}from"./AC62H63B.js";import{a as q}from"./GKXY6U4S.js";import{c as H,ia as u,oa as y,pa as R}from"./EQTXHL74.js";import"./NEWT5A6S.js";import{e as z}from"./RFWIIJFG.js";import{createReadStream as F,createWriteStream as k,existsSync as N}from"node:fs";import{appendFile as V,mkdir as _,rm as j,writeFile as W}from"node:fs/promises";import B from"node:path";import{createInterface as G}from"node:readline";var w=class{outputPath;entriesPath;creatorVersion;writeChain=Promise.resolve();directoryEnsured=!1;started=!1;count=0;constructor(t,r){this.outputPath=B.resolve(process.cwd(),t),this.entriesPath=`${this.outputPath}.entries.tmp`,this.creatorVersion=r}get entryCount(){return this.count}add(t){let r=`${JSON.stringify(t)}
7
+ import{a as T,b as O,c as A,d as E}from"./SEKSITHZ.js";import{c as m,k as C,r as $}from"./UE7IAPIP.js";import{a as q}from"./GKXY6U4S.js";import{c as H,ia as u,oa as y,pa as R}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import{e as z}from"./RFWIIJFG.js";import{createReadStream as F,createWriteStream as k,existsSync as N}from"node:fs";import{appendFile as V,mkdir as _,rm as j,writeFile as W}from"node:fs/promises";import B from"node:path";import{createInterface as G}from"node:readline";var w=class{outputPath;entriesPath;creatorVersion;writeChain=Promise.resolve();directoryEnsured=!1;started=!1;count=0;constructor(t,r){this.outputPath=B.resolve(process.cwd(),t),this.entriesPath=`${this.outputPath}.entries.tmp`,this.creatorVersion=r}get entryCount(){return this.count}add(t){let r=`${JSON.stringify(t)}
8
8
  `,n=this.writeChain.catch(()=>{}).then(()=>this.append(r)).then(()=>{this.count+=1});return this.writeChain=n.catch(()=>{}),n}async finalize(){await this.writeChain.catch(()=>{}),await this.ensureDirectory(),await this.writeDocument(),await j(this.entriesPath,{force:!0})}async append(t){if(await this.ensureDirectory(),!this.started){await W(this.entriesPath,t,"utf8"),this.started=!0;return}await V(this.entriesPath,t,"utf8")}async ensureDirectory(){this.directoryEnsured||(await _(B.dirname(this.outputPath),{recursive:!0}),this.directoryEnsured=!0)}async writeDocument(){let t=k(this.outputPath,{encoding:"utf8"}),r=n=>new Promise((o,s)=>{t.write(n,i=>i?s(i):o())});try{let n=JSON.stringify({name:"redocly-cli proxy",version:this.creatorVersion});await r(`{
9
9
  "log": {
10
10
  "version": "1.2",
@@ -0,0 +1,53 @@
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 V}from"./XIQZ6CQT.js";import{c as I,d as N,e as fe,h as G,j as _,k as ue,v as B,w as H}from"./UE7IAPIP.js";import{a as ae,b as W,c as ce,d as pe}from"./S242M5IF.js";import{a as ie}from"./64G5RPLP.js";import"./CBJ23L7Q.js";import{O as oe,P as v,c as y,ia as S,l as O,oa as C,ta as se}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{mkdir as At,writeFile as jt}from"node:fs/promises";import kt from"node:path";var Ve=/^[a-zA-Z][a-zA-Z0-9]*(?:[_\-.][a-zA-Z0-9]+)*$/,Be=/^[0-9a-f-]{8,}$/i,He=[["uuid",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i],["date-time",/^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/],["date",/^\d{4}-\d{2}-\d{2}$/],["email",/^[^\s@]+@[^\s@]+\.[^\s@]+$/],["uri",/^https?:\/\/\S+$/],["ipv4",/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/]],M=new WeakMap;function z(e){return{formats:He.filter(([,t])=>t.test(e)).map(([t])=>t),values:[e],count:1,overflow:!1}}function x(e,t){if(!e)return t;if(!t)return e;let n={formats:e.formats.filter(r=>t.formats.includes(r)),values:[],count:e.count+t.count,overflow:e.overflow||t.overflow};if(!n.overflow){let r=[...e.values];for(let s of t.values)r.includes(s)||r.push(s);r.length>10?n.overflow=!0:n.values=r}return n}function D(e,t){M.set(e,t)}function U(e){return M.get(e)}function F(e,t){let n=M.get(e);n&&M.set(t,n)}function ze(e){return e.length<=30&&!Be.test(e)&&Ve.test(e)}function X(e,t){return e.formats.length>0?{format:e.formats[0]}:t&&!e.overflow&&e.count>=4&&e.values.length>0&&e.values.length<=5&&e.values.length*2<=e.count&&e.values.every(ze)?{enum:[...e.values].sort()}:{}}function $(e){let t=M.get(e);if(t){let n=typeof e.type=="string"?[e.type]:e.type??[];n.includes("string")&&Object.assign(e,X(t,n.length===1))}for(let n of Object.values(e.properties??{}))$(n);e.additionalProperties&&$(e.additionalProperties),e.items&&$(e.items);for(let n of e.oneOf??[])$(n)}function me(e){for(let t of Object.values(e.paths))for(let n of Object.values(t)){for(let r of Object.values(n.requestBody?.content??{}))$(r.schema);for(let r of Object.values(n.responses))for(let s of Object.values(r.content??{}))$(s.schema)}for(let t of Object.values(e.components?.schemas??{}))$(t);return e}var be=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Y=/^\d+$/,De=/^[0-9a-hjkmnp-tv-z]{26}$/i,Ue=/^[a-z][a-z0-9]*_(?=[0-9a-z]*\d)[0-9a-z]{10,}$/i,Fe=/^[a-z](?=[a-z0-9]*\d)[a-z0-9]{23,24}$/,Q=new Set(ie),Le=new Set(["get","head"]),de="application/x-www-form-urlencoded",le="multipart/form-data";function Ye(e){return e?Y.test(e)||be.test(e)||De.test(e)||Ue.test(e)||Fe.test(e)?!0:/^[0-9a-f]{16,}$/i.test(e):!1}function ee(e){let t=e.split("/"),n=[],r=new Set;return{template:t.map((o,a)=>{if(!Ye(o))return o;let i=t[a-1],c=i?`${O(i,1)}Id`:"id",p=1;for(;r.has(c);)p+=1,c=i?`${O(i,1)}Id${p}`:`id${p}`;return r.add(c),n.push({name:c,value:o}),`{${c}}`}).join("/")||"/",params:n}}function T(e){if(e===null)return{type:"null"};if(Array.isArray(e)){if(e.length===0)return{type:"array"};let t=e.slice(0,20).map(T);return{type:"array",items:E(t)}}switch(typeof e){case"string":{let t={type:"string"};return D(t,z(e)),t}case"boolean":return{type:"boolean"};case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"object":{let t=Object.entries(e);if(t.length>0&&(t.every(([a])=>Y.test(a))||t.every(([a])=>be.test(a))))return{type:"object",additionalProperties:E(t.map(([,a])=>T(a)))};let n={},r=[];for(let[o,a]of t)n[o]=T(a),r.push(o);let s={type:"object",properties:n};return r.length>0&&(s.required=r),s}default:return{}}}function E(e){if(e.length===0)return{};let[t,...n]=e,r=t;for(let s of n)r=L(r,s);return r}function he(e){return Object.keys(e).length===0}function A(e){return e.additionalProperties?"map":e.type==="object"?"object":e.type==="array"?"array":"scalar"}function Z(e){return e.oneOf?e.oneOf.flatMap(Z):Array.isArray(e.type)?e.type.map(t=>{if(t==="object"){let r={type:"object"};return e.properties&&(r.properties=e.properties),e.required&&(r.required=e.required),e.additionalProperties&&(r.additionalProperties=e.additionalProperties),r}if(t==="array")return e.items?{type:"array",items:e.items}:{type:"array"};let n={type:t};return t==="string"&&F(e,n),n}):[e]}var Ke=.5,We=3;function Oe(e,t){let n=Object.keys(e.properties??{}),r=Object.keys(t.properties??{});if(n.length===0||r.length===0)return 1;let s=new Set(r),o=n.filter(a=>s.has(a)).length;return o/(n.length+r.length-o)}function Xe(e,t){let n=A(e);if(n!==A(t))return!1;switch(n){case"scalar":return e.type===t.type||e.type==="integer"&&t.type==="number"||e.type==="number"&&t.type==="integer";case"object":return Oe(e,t)>=Ke;default:return!0}}function ve(e,t){switch(A(e)){case"scalar":{if(e.type!==t.type)return{type:"number"};if(e.type==="string"){let n=x(U(e),U(t));if(n){let r={type:"string"};return D(r,n),r}}return e}case"map":return{type:"object",additionalProperties:L(e.additionalProperties??{},t.additionalProperties??{})};case"object":{let n={...e.properties??{}};for(let[a,i]of Object.entries(t.properties??{}))n[a]=n[a]?L(n[a],i):i;let r=new Set(t.required??[]),s=(e.required??[]).filter(a=>r.has(a)),o={type:"object",properties:n};return s.length>0&&(o.required=s),o}case"array":{if(!e.items||!t.items){let n=e.items??t.items;return n?{type:"array",items:n}:{type:"array"}}return{type:"array",items:L(e.items,t.items)}}}}function Ze(e){let t=[...e],n=()=>t.filter(r=>A(r)==="object").length;for(;n()>We;){let r=-1,s=-1,o=-1;for(let a=0;a<t.length;a++)if(A(t[a])==="object")for(let i=a+1;i<t.length;i++){if(A(t[i])!=="object")continue;let c=Oe(t[a],t[i]);c>o&&(o=c,r=a,s=i)}t[r]=ve(t[r],t[s]),t.splice(s,1)}return t}var Qe=["boolean","integer","number","string","null"];function et(e){if(e.length===1)return e[0];let t=[],n=new Set,r;for(let i of e)A(i)==="scalar"&&typeof i.type=="string"?(n.add(i.type),i.type==="string"&&(r=x(r,U(i)))):t.push(i);let s=Qe.filter(i=>n.has(i)),o=i=>{let c={type:i};return(typeof i=="string"?i==="string":i.includes("string"))&&r&&D(c,r),c};if(t.length===0)return s.length===1?o(s[0]):o(s);if(t.length===1&&s.length===1&&s[0]==="null"&&typeof t[0].type=="string")return{...t[0],type:[t[0].type,"null"]};let a=[...t];return s.length===1?a.push(o(s[0])):s.length>1&&a.push(o(s)),{oneOf:a}}function L(e,t){if(he(e)||he(t))return{};let n=Z(e);for(let r of Z(t)){let s=n.findIndex(o=>Xe(o,r));s===-1?n.push(r):n[s]=ve(n[s],r)}return et(Ze(n))}function tt(e){if(!e)return;let t=e.trim();if(!(!t.startsWith("{")&&!t.startsWith("[")))try{return JSON.parse(t)}catch{return}}function nt(e,t){let n=t?.match(/boundary="?([^";,]+)"?/i)?.[1];if(!n)return;let r={};for(let s of e.split(`--${n}`)){let o=s.match(/^\r?\n([\s\S]*?)\r?\n\r?\n([\s\S]*)\r?\n$/);if(!o)continue;let[,a,i]=o,c=a.match(/\bname="([^"]*)"/i)?.[1];c!==void 0&&(r[c]=/\bfilename="/i.test(a)?{type:"string",format:"binary"}:T(i))}if(Object.keys(r).length!==0)return{type:"object",properties:r,required:Object.keys(r)}}function ge(e){let t=_(e.contentType);if(e.bodyJson!==void 0)return{mime:ue(t)?t:"application/json",schema:T(e.bodyJson)};if(t===de&&e.bodyText){let r={};for(let[s,o]of new URLSearchParams(e.bodyText))r[s]=o;return Object.keys(r).length===0?void 0:{mime:de,schema:T(r)}}if(t===le&&e.bodyText){let r=nt(e.bodyText,e.contentType);return r?{mime:le,schema:r}:void 0}let n=tt(e.bodyText);if(n!==void 0)return{mime:"application/json",schema:T(n)}}function ye(e,t,n){let r=e.get(t);e.set(t,r?E([r,n]):n)}async function we(e){let t=await N(e.trafficPath);if(t.length===0)throw new Error("No traffic files found in the provided traffic path.");let n=B(e.server),r=new Map,s=new Set,o=0,a=0,i=p=>{let f=p.request.method.toLowerCase();if(!Q.has(f))return;let u=p.request.path||"/";if(n){let d=H(p.request,n);if(d===void 0)return;u=d}if(f==="query"&&e.openapiVersion==="3.1"){a+=1;return}!n&&p.request.host&&!fe(p.request.host)&&s.add(`${p.request.protocol}//${p.request.host}`);let{template:m,params:k}=ee(G(u)),P=`${f} ${m}`,l=r.get(P);l||(l={method:f,template:m,pathParams:new Map,queryParams:new Map,requestBodies:new Map,responses:new Map},r.set(P,l));for(let{name:d,value:g}of k){let h=l.pathParams.get(d);l.pathParams.set(d,{numeric:(h?.numeric??!0)&&Y.test(g),observations:x(h?.observations,z(g))})}for(let d of new Set(p.request.query.keys())){let g=p.request.query.getAll(d),h=l.queryParams.get(d),q=g.length>0&&g.every(R=>Y.test(R)),b=h?.observations;for(let R of g)b=x(b,z(R));l.queryParams.set(d,{numeric:(h?.numeric??!0)&&q,observations:b})}if(!Le.has(f)){let d=ge(p.request);d&&ye(l.requestBodies,d.mime,d.schema)}if(p.response&&p.response.status>=100){let d=String(p.response.status),g=l.responses.get(d);g||(g={bodies:new Map},l.responses.set(d,g)),g.statusText??=p.response.statusText||void 0;let h=ge(p.response);h&&ye(g.bodies,h.mime,h.schema)}};for(let p of t){let f=await V(p,e.format);if(!f){S.warn(`Skipping traffic file with unrecognized format: ${p}
8
+ `);continue}o+=1;for await(let u of f.parse(p))i(u)}if(o===0)throw new Error("No supported traffic files found to generate an OpenAPI description from.");if(r.size===0&&a>0)throw new C("All observed HTTP exchanges use the QUERY method, which OpenAPI 3.1 does not support. Use --openapi-version 3.2 to include them.");if(r.size===0)throw new Error(n?`No HTTP exchanges in the traffic matched the server "${n}".`:"No HTTP exchanges were observed in the traffic. Cannot generate an OpenAPI description.");let c=n?[n]:Array.from(s).sort();return rt(r,e.openapiVersion,e.title??"Generated API",c)}function Pe(e){return Object.values(e.paths).reduce((t,n)=>t+Object.keys(n).length,0)}function Se(e,t){if(e.numeric)return{type:"integer"};let n={type:"string"};return e.observations&&Object.assign(n,X(e.observations,t)),n}function rt(e,t,n,r){let s={};for(let o of e.values()){let a=s[o.template]??={},i=[...Array.from(o.pathParams).map(([p,f])=>({name:p,in:"path",required:!0,schema:Se(f,!1)})),...Array.from(o.queryParams).map(([p,f])=>({name:p,in:"query",required:!1,schema:Se(f,!0)}))],c={operationId:ot(o.method,o.template),responses:{}};if(i.length>0&&(c.parameters=i),o.requestBodies.size>0){let p={};for(let[f,u]of o.requestBodies)p[f]={schema:u};c.requestBody={content:p}}if(o.responses.size===0)c.responses.default={description:"Observed response"};else for(let[p,f]of o.responses){let u={description:f.statusText||"Observed response"};if(f.bodies.size>0){let m={};for(let[k,P]of f.bodies)m[k]={schema:P};u.content=m}c.responses[p]=u}a[o.method]=c}return{openapi:`${t}.0`,info:{title:n,version:"1.0.0"},...r.length>0?{servers:r.map(o=>({url:o}))}:{},paths:s}}function ot(e,t){let n=t.split("/").filter(Boolean).map(r=>r.replace(/[{}]/g,"")).join("-");return`${e}-${n||"root"}`}function K(e,t){return`${e.toUpperCase()} ${t}`}function $e(e,t){let n;if(e.bodyJson!==void 0)try{n=JSON.stringify(e.bodyJson)}catch{n=void 0}if(n??=e.bodyText,!n)return;let r=n.trim();if(r)return r.length>t?`${r.slice(0,t)}\u2026[truncated]`:r}function Te(e){if(!e)return"";let t=e.bodyJson;return t===void 0?e.bodyText?_(e.contentType)||"text":"":t===null?"null":Array.isArray(t)?`array<${t.length>0?Ae(t[0]):""}>`:Ae(t)}function Ae(e){return y(e)?Object.keys(e).sort().join(","):e===null?"null":typeof e}async function je(e){let t=e.perGroup??2,n=e.perOperation??4,r=e.maxBodyChars??2e3,s=B(e.server),o=await N(e.trafficPath),a=new Map;for(let c of o){let p=await V(c,e.format);if(p)for await(let f of p.parse(c)){let u=f.request.method.toUpperCase();if(!Q.has(u.toLowerCase()))continue;let m=f.request.path||"/";if(s){let R=H(f.request,s);if(R===void 0)continue;m=R}let k=G(m),{template:P}=ee(k),l=f.response&&f.response.status>=100?f.response:void 0,d=l?.status,g=`${Te(f.request)}\u2192${Te(l)}`,h=a.get(K(u,P));h||(h=new Map,a.set(K(u,P),h));let q=`${d??""} ${g}`,b=h.get(q);b||(b=[],h.set(q,b)),!(b.length>=t)&&b.push({method:u,path:k,query:f.request.query.toString(),status:d,requestContentType:f.request.contentType,requestBody:$e(f.request,r),responseContentType:l?.contentType,responseBody:l?$e(l,r):void 0})}}let i=new Map;for(let[c,p]of a){let f=[];for(let u=0;u<t&&f.length<n;u++)for(let m of p.values()){if(f.length>=n)break;m[u]&&f.push(m[u])}i.set(c,f)}return i}var st=e=>`You are an expert API designer. You are given one operation from an OpenAPI ${e} description that was inferred mechanically from recorded HTTP traffic, the component schemas it references, and a sample of the real recorded HTTP exchanges for that operation. The inferred description is only a hypothesis: types are coarse, every observed property is marked required, and descriptions are missing. Alternative body shapes observed in the traffic appear as "oneOf" variants or type unions. Common string formats (uuid, date-time, date, email, uri, ipv4) and small closed enums are detected conservatively from the observed values.
9
+
10
+ Refine the operation into the most accurate OpenAPI ${e} definition you can justify from the evidence, while staying conservative:
11
+ - Keep the path template and the HTTP method exactly as given. Do not rename path parameters, do not move parameters to the path item level, and keep every response status code. The result is programmatically checked and rejected otherwise.
12
+ - Keep the operationId unless it is clearly wrong.
13
+ - Narrow property types where the samples clearly support it (formats such as date-time, uuid, email, uri; integer vs number; enums when a field only ever takes a small fixed set of values). Verify the formats and enums already detected against the samples; correct or extend them where justified. The detected formats and enums were derived from the full recorded traffic while you see only a subset of it, so never remove a detected format or enum value merely because the samples do not show it \u2014 correct one only when a sample contradicts it.
14
+ - Relax "required" for properties that are plausibly optional (e.g. absent in some samples, or clearly nullable). Express nullable values as type unions such as ["string", "null"].
15
+ - When a request or response body has alternative shapes \u2014 the baseline shows "oneOf" variants, or the samples show clearly different payloads \u2014 model them explicitly with "oneOf". Name each variant in components/schemas, and add a "discriminator" when a property (such as "type" or "kind") selects the variant.
16
+ - Factor structure shared between variants or schemas with "allOf": extract the common base into components/schemas and compose each variant as "allOf" of the base plus its specific properties.
17
+ - Keep the $ref references to the component schemas you were given. You may refine the definition of a referenced component when the samples justify it, and you may add new components, but never rename an existing component and never reuse a reserved component name listed in the input.
18
+ - Add concise, useful "summary" and "description" fields to the operation, its parameters and important schema properties.
19
+ - Add example values drawn from the real samples where helpful, but never copy values that look like secrets or personal data (tokens, API keys, passwords, session identifiers, email addresses, personal names); use clearly fictional placeholder values instead.
20
+
21
+ Output ONLY a YAML document with this exact top-level structure:
22
+
23
+ paths:
24
+ <the path template exactly as given>:
25
+ <the method>:
26
+ ...the refined operation...
27
+ components:
28
+ schemas:
29
+ ...only the component schemas you changed or added; omit "components" entirely when there are none...
30
+
31
+ Do not wrap the output in Markdown code fences. Do not add any commentary before or after the document.`;function it(e){return e.length===0?"(no sample exchanges were captured)":e.map((t,n)=>{let r=[],s=t.query?`?${t.query}`:"";return r.push(`### Exchange ${n+1}`),r.push(`${t.method} ${t.path}${s}`),t.requestContentType&&r.push(`Request Content-Type: ${t.requestContentType}`),t.requestBody&&r.push(`Request body: ${t.requestBody}`),t.status!==void 0&&r.push(`Response status: ${t.status}`),t.responseContentType&&r.push(`Response Content-Type: ${t.responseContentType}`),t.responseBody&&r.push(`Response body: ${t.responseBody}`),r.join(`
32
+ `)}).join(`
33
+
34
+ `)}function ke(e){let t=[];return t.push(`# Operation to refine (inferred from traffic)
35
+
36
+ \`\`\`yaml
37
+ ${v({paths:{[e.path]:{[e.method]:e.operation}}})}\`\`\``),Object.keys(e.components).length>0&&t.push(`# Component schemas referenced by this operation (current definitions)
38
+
39
+ \`\`\`yaml
40
+ ${v({components:{schemas:e.components}})}\`\`\``),e.reservedComponentNames.length>0&&t.push(`# Reserved component names (used elsewhere in the description; do not redefine or reuse them)
41
+
42
+ ${e.reservedComponentNames.join(", ")}`),t.push(`# Recorded HTTP exchanges for this operation
43
+
44
+ ${it(e.samples)}`),t.push(`Refine ${e.method.toUpperCase()} ${e.path} as instructed and output only the YAML document.`),{system:st(e.openapiVersion),user:t.join(`
45
+
46
+ `)}}var Re=/^#\/components\/schemas\/(.+)$/;function te(e,t){if(Array.isArray(e)){for(let n of e)te(n,t);return}if(y(e)){if(typeof e.$ref=="string"){let n=e.$ref.match(Re);n&&t.add(n[1])}if(y(e.discriminator)&&y(e.discriminator.mapping)){for(let n of Object.values(e.discriminator.mapping))if(typeof n=="string"){let r=n.match(Re);t.add(r?r[1]:n)}}for(let n of Object.values(e))te(n,t)}}function Ee(e,t){let n=new Set,r=[e];for(;r.length>0;){let s=new Set;te(r.pop(),s);for(let o of s)!n.has(o)&&o in t&&(n.add(o),r.push(t[o]))}return n}function at(e){let t=e.components?.schemas;if(!t)return;let n=Ee(e.paths,t);for(let r of Object.keys(t))n.has(r)||delete t[r];Object.keys(t).length===0&&delete e.components}function ct(e,t,n){let r=ae(e),s;try{s=oe(r)}catch(f){throw new Error(`the provider did not return valid YAML: ${f instanceof Error?f.message:String(f)}`)}if(!y(s))throw new Error('the response is not a YAML document with a "paths" object');let o=s.paths;if(!y(o))throw new Error('the response is not a YAML document with a "paths" object');let a=o[t];if(!y(a))throw new Error(`the response does not keep the path template "${t}"`);let i=a[n];if(!y(i))throw new Error(`the response does not contain the ${n.toUpperCase()} operation`);let c=s.components,p=y(c)?c.schemas:void 0;return{operation:i,components:y(p)?p:{}}}function pt(e,t){let n=y(t.responses)?t.responses:{};return Object.keys(e.responses).filter(r=>!(r in n))}async function ft(e){let t=e.document.components?.schemas??{},n=Ee(e.operation,t),r={};for(let m of n)r[m]=t[m];let s=Object.keys(t).filter(m=>!n.has(m)),{system:o,user:a}=ke({openapiVersion:e.document.openapi,path:e.path,method:e.method,operation:e.operation,components:r,reservedComponentNames:s,samples:e.samples}),{text:i}=await ce(e.provider,{system:o,user:a,model:e.model}),c=ct(i,e.path,e.method),p=pt(e.operation,c.operation);if(p.length>0)throw new Error(`the response dropped observed response status(es): ${p.join(", ")}`);if(typeof c.operation.operationId!="string")throw new Error("the response dropped the operationId");let f=Object.keys(c.components).filter(m=>s.includes(m));if(f.length>0)throw new Error(`the response redefines reserved component(s): ${f.join(", ")}`);let u={openapi:e.document.openapi,info:e.document.info,paths:{[e.path]:{[e.method]:c.operation}},components:{schemas:{...t,...c.components}}};return await W(v(u),e.config),c}function ut(e,t,n,r){e.paths[t][n]=r.operation,Object.keys(r.components).length>0&&(e.components??={schemas:{}},Object.assign(e.components.schemas,r.components))}async function Je(e){let t=structuredClone(e.baseline),n=await se({extends:["spec"]}),r=[];for(let[i,c]of Object.entries(e.baseline.paths))for(let[p,f]of Object.entries(c))r.push({path:i,method:p,operation:f});let o=(await pe({items:r,concurrency:e.concurrency??1,action:"Refining",successNote:"refined",failureNote:"kept the baseline",label:({path:i,method:c})=>`${c.toUpperCase()} ${i}`,run:async({path:i,method:c,operation:p})=>{let f=await ft({provider:e.provider,model:e.model,document:t,path:i,method:c,operation:p,samples:e.samplesByOperation.get(K(c,i))??[],config:n});return ut(t,i,c,f),f}})).filter(i=>i!==null).length;if(o===0)throw new Error(`the ${e.provider} provider did not produce a usable refinement for any operation`);at(t);let a=v(t);return await W(a,n),{yaml:a,document:t,refined:o,total:r.length}}var mt=2,dt=2,lt=.75,ht=2,Me=new Set(["integer","number"]),xe=new WeakMap;function w(e){let t=xe.get(e);if(t!==void 0)return t;let n;if(e.$ref!==void 0)n=`ref(${e.$ref})`;else if(e.oneOf)n=`oneOf(${e.oneOf.map(w).sort().join("|")})`;else{let s=[`type=${(Array.isArray(e.type)?[...e.type].sort().join(","):e.type)??""}`];if(e.properties){let o=Object.entries(e.properties).map(([a,i])=>`${JSON.stringify(a)}:${w(i)}`).sort().join(",");s.push(`props{${o}}`)}e.additionalProperties&&s.push(`values(${w(e.additionalProperties)})`),e.items&&s.push(`items(${w(e.items)})`),n=s.join(";")}return xe.set(e,n),n}function gt(e){return e.$ref===void 0&&e.type==="object"&&e.oneOf===void 0&&e.additionalProperties===void 0&&Object.keys(e.properties??{}).length>=mt}function qe(e,t){for(let n of t)e.set(n,(e.get(n)??0)+1)}function J(e,t,n){if(e.oneOf){e.oneOf.forEach((o,a)=>J(o,{...t,path:`${t.path}/oneOf/${a}`,fallbackHints:[]},n));return}let r=t.container,s=`${t.path}/`;if(gt(e)){let o=w(e),a=n.get(o);a||(a={keys:[o],schemas:[],merged:{},contexts:new Set,primaryVotes:new Map,fallbackVotes:new Map},n.set(o,a)),a.schemas.push(e),a.contexts.add(`${t.container}#${t.path}`),qe(a.primaryVotes,t.primaryHints),qe(a.fallbackVotes,t.fallbackHints),r=o,s=""}for(let[o,a]of Object.entries(e.properties??{}))J(a,{container:r,path:`${s}${o}`,primaryHints:[o],fallbackHints:[]},n);e.additionalProperties&&J(e.additionalProperties,{container:r,path:`${s}additionalProperties`,primaryHints:t.primaryHints.map(o=>O(o,1)),fallbackHints:t.fallbackHints.map(o=>O(o,1))},n),e.items&&J(e.items,{container:r,path:`${s}items`,primaryHints:t.primaryHints.map(o=>O(o,1)),fallbackHints:t.fallbackHints.map(o=>O(o,1))},n)}function yt(e){return e.split("/").filter(n=>n&&!n.startsWith("{")).at(-1)}function St(e){let t=new Map;for(let[n,r]of Object.entries(e.paths)){let s=yt(n),o=s?O(s,1):void 0;for(let[a,i]of Object.entries(r)){for(let[c,p]of Object.entries(i.requestBody?.content??{}))J(p.schema,{container:`request ${a} ${n} ${c}`,path:"",primaryHints:o?[o]:[],fallbackHints:o?[`${o} request`]:[]},t);for(let[c,p]of Object.entries(i.responses)){let f=Number(c)>=400;for(let[u,m]of Object.entries(p.content??{}))J(m.schema,{container:`response ${a} ${n} ${c} ${u}`,path:"",primaryHints:f?["error"]:o?[o]:[],fallbackHints:f?o?[`${o} error`]:[]:o?[`${o} response`]:[]},t)}}}return t}function Ce(e){return Object.keys(e.properties??{})}function bt(e,t){let n=Ce(e),r=new Set(Ce(t)),s=n.filter(a=>r.has(a)).length,o=n.length+r.size-s;return o===0?0:s/o}function Ie(e){if(e.$ref!==void 0||e.properties||e.additionalProperties||e.items||e.oneOf)return;let t=typeof e.type=="string"?[e.type]:e.type;if(!(!t||t.some(n=>n==="object"||n==="array")))return t}function ne(e){return Object.keys(e).length===0}function Ge(e,t){if(w(e)===w(t)||ne(e)||ne(t))return!0;let n=Ie(e),r=Ie(t);if(n&&r){let o=new Set(n.filter(i=>i!=="null")),a=new Set(r.filter(i=>i!=="null"));return o.size===a.size&&[...o].every(i=>a.has(i))?!0:[...o].every(i=>Me.has(i))&&[...a].every(i=>Me.has(i))}let s=o=>o.type==="array"||o.items!==void 0;return s(e)&&s(t)?!e.items||!t.items||Ge(e.items,t.items):!1}function Ot(e,t){let n=t.merged.properties??{};return Object.entries(e.merged.properties??{}).every(([r,s])=>!(r in n)||Ge(s,n[r]))}function vt(e){let t=[...e];for(;t.length>1;){let n=-1,r=-1,s=0;for(let i=0;i<t.length;i++)for(let c=i+1;c<t.length;c++){let p=bt(t[i].merged,t[c].merged);p>=lt&&p>s&&Ot(t[i],t[c])&&(s=p,n=i,r=c)}if(n===-1)break;let o=t[n],a=t[r];o.keys.push(...a.keys),o.schemas.push(...a.schemas),o.merged=E([o.merged,a.merged]);for(let i of a.contexts)o.contexts.add(i);for(let[i,c]of a.primaryVotes)o.primaryVotes.set(i,(o.primaryVotes.get(i)??0)+c);for(let[i,c]of a.fallbackVotes)o.fallbackVotes.set(i,(o.fallbackVotes.get(i)??0)+c);t.splice(r,1)}return t}function re(e,t){return e<t?-1:e>t?1:0}function wt(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function Ne(e){return[...e.entries()].sort(([t,n],[r,s])=>s-n||re(t,r)).map(([t])=>t)}function Pt(e){let t=[...e].sort((r,s)=>s.contexts.size-r.contexts.size||s.schemas.length-r.schemas.length||re(r.keys[0],s.keys[0])),n=new Set;return t.map(r=>{let s=[...Ne(r.primaryVotes),...Ne(r.fallbackVotes)].map(wt).filter(a=>a.length>0);s.length===0&&s.push("Schema");let o=s.find(a=>!n.has(a));for(let a=2;o===void 0;a++){let i=`${s[0]}${a}`;n.has(i)||(o=i)}return n.add(o),{group:r,name:o}})}function j(e,t,n=!1){if(!n){let s=t.get(w(e));if(s!==void 0)return{$ref:`#/components/schemas/${s}`}}let r={...e};return F(e,r),e.properties&&(r.properties=Object.fromEntries(Object.entries(e.properties).map(([s,o])=>[s,j(o,t)]))),e.additionalProperties&&(r.additionalProperties=j(e.additionalProperties,t)),e.items&&(r.items=j(e.items,t)),e.oneOf&&(r.oneOf=e.oneOf.map(s=>j(s,t))),r}function $t(e){let t=Object.values(e.properties??{}),n=t.filter(r=>r.type==="array"&&(!r.items||ne(r.items)));return n.length>0&&t.length-n.length<=ht}function Tt(e){let t=0,n=0;for(let r of e.primaryVotes.values())t+=r,n=Math.max(n,r);return n*2>t}function _e(e){let t=St(e);for(let i of t.values())i.merged=E(i.schemas);let r=vt([...t.values()]).filter(i=>i.contexts.size>=dt&&(Tt(i)||!i.schemas.some($t)));if(r.length===0)return e;let s=Pt(r),o=new Map;for(let{group:i,name:c}of s)for(let p of i.keys)o.set(p,c);let a={};for(let{group:i,name:c}of[...s].sort((p,f)=>re(p.name,f.name)))a[c]=j(i.merged,o,!0);for(let i of Object.values(e.paths))for(let c of Object.values(i)){for(let p of Object.values(c.requestBody?.content??{}))p.schema=j(p.schema,o);for(let p of Object.values(c.responses))for(let f of Object.values(p.content??{}))f.schema=j(f.schema,o)}return e.components={schemas:a},e}async function Rt(e,t){let n=I(e);await At(kt.dirname(n),{recursive:!0}),await jt(n,t,"utf8")}function Et(e){let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}async function gn({argv:e}){if(e.type!=="openapi")throw new C(`Unsupported spec type "${e.type}". Only "openapi" is supported.`);let t=Date.now(),n=I(e.traffic),r=e["traffic-format"],s=me(_e(await we({trafficPath:n,format:r,openapiVersion:e["openapi-version"],title:e.title,server:e.server})));S.info(`Inferred a baseline OpenAPI description from traffic: ${Pe(s)} operation(s).
47
+ `);let o=v(s);if(e["with-ai"]){let a=e["ai-provider"];S.info(`Refining the description with AI provider "${a}"...
48
+ `),S.warn(`Note: --with-ai sends samples of the recorded traffic (URLs, query strings, request and response bodies) to the selected AI provider. Make sure the traffic contains no secrets or personal data you are not allowed to share.
49
+ `);let i=await je({trafficPath:n,format:r,server:e.server});try{let c=await Je({provider:a,model:e["ai-model"],baseline:s,samplesByOperation:i,concurrency:e["ai-concurrency"]});o=c.yaml,S.info(`AI refinement complete: ${c.refined} of ${c.total} operation(s) refined (${a}).
50
+ `)}catch(c){S.warn(`AI refinement failed, falling back to the baseline description: ${c instanceof Error?c.message:String(c)}
51
+ `)}}e.output?(await Rt(e.output,o),S.info(`Written to: ${I(e.output)}
52
+ `)):S.output(o),S.info(`Done in ${Et(Date.now()-t)}.
53
+ `)}export{gn as handleGenerateSpec};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c as r}from"./EQTXHL74.js";var s="components",p="paths",i="webhooks",O="x-webhooks",c="channels",f="operations";function e(o,n){if(r(o)){n(o);for(let t of Object.keys(o))e(o[t],n)}else if(Array.isArray(o))for(let t of o)e(t,n)}function S(o){return o.startsWith(`#/${s}/`)}export{s as a,p as b,i as c,O as d,c as e,f,e as g,S as h};
7
+ import{c as r}from"./VAPFU7OM.js";var s="components",p="paths",i="webhooks",O="x-webhooks",c="channels",f="operations";function e(o,n){if(r(o)){n(o);for(let t of Object.keys(o))e(o[t],n)}else if(Array.isArray(o))for(let t of o)e(t,n)}function S(o){return o.startsWith(`#/${s}/`)}export{s as a,p as b,i as c,O as d,c as e,f,e as g,S as h};
@@ -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{i as c,l as a}from"./VKTRI5YG.js";import"./GKXY6U4S.js";import{ia as s}from"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function g({operation:i,input:r,version:n}){let t=await l(r),e=`${t.protocol}://${t.host}`;if(i!=="get"||!c(e))return"";let o=process.env.REDOCLY_AUTHORIZATION||await new a(n).getAccessToken(e);return o?`username=redocly
7
+ import{i as c,l as a}from"./5BB2E772.js";import"./GKXY6U4S.js";import{ia as s}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function g({operation:i,input:r,version:n}){let t=await l(r),e=`${t.protocol}://${t.host}`;if(i!=="get"||!c(e))return"";let o=process.env.REDOCLY_AUTHORIZATION||await new a(n).getAccessToken(e);return o?`username=redocly
8
8
  password=${o}
9
9
  `:(s.error(`You are not logged in to ${e}. Run \`redocly login --residency ${e}\` or set the REDOCLY_AUTHORIZATION environment variable.
10
10
  `),`quit=1
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as G}from"./HAOBCQWB.js";import{b as j,c as N,d as Q,e as O,f as Z,g as Y,h as X,i as ee,j as ne}from"./JQJ5TDVP.js";import{a as H}from"./WZXA5XPB.js";import{a as F,b as W,c as L,d as x,e as _,g as A,h as U,i as z,j as K,k as J,l as D,n as V}from"./UW4UC7ZI.js";var B=L.go,P=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return x(t,{style:"camel",reserved:B})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let s=d(o),a=s;for(let i=2;r.has(a);i++)a=`${s}${i}`;return r.add(a),a})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
7
+ import{a as G}from"./HAOBCQWB.js";import{b as j,c as N,d as Q,e as O,f as Z,g as Y,h as X,i as ee,j as ne}from"./PBXLYXXR.js";import{a as H}from"./WZXA5XPB.js";import{a as F,b as W,c as L,d as x,e as _,g as A,h as U,i as z,j as K,k as J,l as D,n as V}from"./UW4UC7ZI.js";var B=L.go,P=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return x(t,{style:"camel",reserved:B})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let s=d(o),a=s;for(let i=2;r.has(a);i++)a=`${s}${i}`;return r.add(a),a})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
8
8
  `?n+="\\n":r==="\r"?n+="\\r":r===" "?n+="\\t":o<32||o===127?n+=`\\x${o.toString(16).padStart(2,"0")}`:o>=55296&&o<=57343?n+="\\uFFFD":n+=r}return n+'"'}literal(t){return t==null?"nil":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?this.string(t):Array.isArray(t)?`[]any{${t.map(r=>this.literal(r)).join(", ")}}`:`map[string]any{${Object.entries(t).map(([r,o])=>`${this.string(r)}: ${this.literal(o)}`).join(", ")}}`}comment(t){for(let n of D(t))this.line(n===""?"//":`// ${n}`);return this}doc(t,n){let r=D(n);if(r.length===0)return this;this.line(`// ${t} \u2014 ${r[0]}`);let o=!1;for(let s of r.slice(1)){if(s===""){o||this.line("//"),o=!0;continue}this.line(`// ${s}`),o=!1}return this}layout(t){return ue(fe(t))}toString(){return this.layout(super.toString())}};function d(e){let t=x(e,{style:"pascal",reserved:B});return t.startsWith("_")?`N${t.slice(1)}`:t}function ue(e){return`${e.replace(/\n{3,}/g,`
9
9
 
10
10
  `).trimEnd()}
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as C,b as Z,c as ee,d as Ne,e as te,f as ne,g as Se,h as oe}from"./7APJVQSB.js";import{a as Fe,b as De}from"./64G5RPLP.js";import{f as de,g as L,h as ue,i as Ce,l as W,m as h,n as Oe}from"./NRWIPPEV.js";import{$ as le,O as pe,S as ce,T as fe,aa as ye,b as me,c as j,ca as u,d as O,h as ae,ia as N,ka as he,o as A,oa as S,r as d,t as v,va as ge,wa as Ae}from"./EQTXHL74.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import*as U from"node:fs";import*as Ge from"node:path";import{performance as Xe}from"perf_hooks";import*as G from"node:path";import*as R from"node:path";function F(e,t,o){let n=R.resolve(e),r=R.resolve(t);if(r!==n&&!r.startsWith(n+R.sep))throw new S(`Refusing to write "${o}" outside the output directory.`)}import*as we from"node:path";function D(e,t,o,n,r){let m=o?`.${o}`:"",a=we.join(e,t),i=a+m,p=n.get(i.toLowerCase());for(let s=2;n.has(i.toLowerCase());s++)i=`${a}-${s}${m}`;return r&&p&&p!==t&&p.toLowerCase()===t.toLowerCase()&&r.conflicts.push({name:t,collidingName:p,filename:i,pointer:r.pointer}),n.set(i.toLowerCase(),t),i}function $(e,t,o,n,r,m,a){let i={},p=new Map;for(let[s,c]of Object.entries(e||{})){if(d(c))continue;let f=D(n,L(s,r),m,p,{conflicts:a,pointer:`${t}/${v(s)}`});F(o,f,s),i[s]=f}return i}import*as Pe from"node:path";function g(e,t,o={}){Se(e,r=>{if(d(r)&&oe(r.$ref))n(r,"$ref");else if(j(r.discriminator)&&j(r.discriminator.mapping)){let{mapping:m}=r.discriminator;for(let a of Object.keys(m)){let i=m[a];typeof i=="string"&&oe(i)&&n(r.discriminator.mapping,a)}}});function n(r,m){let a=r[m].split("/"),i=a.pop(),p=a[2],s=o[p];if(!s||!s[i])return;let c=A(Pe.relative(t,s[i].filename));c.startsWith(".")||(c="./"+c),r[m]=c}}function Y(e,t,o="warn"){if(o==="off"||e.length===0)return;let n=e.map(({name:r,collidingName:m,filename:a,pointer:i})=>({ruleId:"split",severity:o,message:`${r} and ${m} would share one file on a case-insensitive file system`+(o==="error"?".":`, saving ${r} to ${a}.`),location:[{source:t,pointer:i,reportOnKey:!0}],suggest:[]}));if(Ae(n,{totals:ge(n),command:"split"}),o==="error")throw new S("\u274C Errors encountered while splitting: files not created.")}import*as ie from"node:path";var Ee=["schemas","messages","securitySchemes","parameters","correlationIds","messageTraits","operationTraits","serverBindings","channelBindings","operationBindings","messageBindings"];var xe=["schemas","messages","securitySchemes","servers","serverVariables","parameters","replies","replyAddresses","correlationIds","messageTraits","operationTraits","tags","externalDocs","serverBindings","channelBindings","operationBindings","messageBindings"];function H(e,t){return(t==="async2"?Ee:xe).filter(n=>n in e)}function ve({asyncapi:e,asyncapiDir:t,componentsFiles:o,ext:n,specVersion:r,conflicts:m}){let a=e.components;if(!a)return;let i=ie.join(t,C),p=H(a,r);for(let s of p){let c=ie.join(i,s),f=new Map;for(let l of Object.keys(a[s]||{})){let y=D(c,l,n,f,{conflicts:m,pointer:`#/components/${s}/${v(l)}`});F(t,y,l),o[s]=o[s]||{},o[s][l]={filename:y}}}}import*as be from"node:fs";import*as V from"node:path";import*as P from"node:fs";import*as $e from"node:path";function E(e,t,o){if(!P.existsSync(e)||!P.statSync(e).isDirectory())return;let n=P.readdirSync(e);for(let r of n){let m=$e.join(e,r);P.statSync(m).isDirectory()?E(m,t,o):t(m,e,o)}}function b(e,t,o){if(!ce(e))return;let n=W(e);g(n,t,o),h(n,e)}function Te({channels:e,channelsFiles:t,asyncapiDir:o,outDir:n,componentsFiles:r}){if(e){be.mkdirSync(n,{recursive:!0});for(let m of Object.keys(e)){let a=e[m];if(d(a))continue;let i=t[m];g(a,V.dirname(i),r),h(a,i),e[m]={$ref:A(V.relative(o,i))},E(n,b,r)}}}import*as Be from"node:fs";import*as k from"node:path";import*as ke from"node:fs";function K(e){return e!=="securitySchemes"}function z(e,t){K(t)&&ke.mkdirSync(e,{recursive:!0})}import*as je from"node:fs";function q(e,t){return je.existsSync(e)&&!me(W(e),t)}import*as Re from"node:path";function T(e,t,o){if(!(!j(e)&&!Array.isArray(e))){if(Array.isArray(e)){for(let n of e)T(n,t,o);return}for(let n of Object.keys(e)){let r=e[n];if(n==="$ref"&&typeof r=="string"&&r.startsWith("#/channels/")){let m=r.slice(11),a=m.indexOf("/"),i=a===-1?m:m.slice(0,a),p=a===-1?"":m.slice(a),s=o[i];if(s){let c=A(Re.relative(t,s));e[n]=p?`${c}#${p}`:c}}else T(r,t,o)}}}function _e(e,t){let o=e.components;o&&(O(o[t])&&delete o[t],O(o)&&delete e.components)}function Ie({asyncapi:e,asyncapiDir:t,componentsFiles:o,channelsFiles:n,specVersion:r}){let m=e.components;if(m){let p=function(s){let c=k.join(a,s);z(c,s);for(let f of Object.keys(m?.[s]||{})){let{filename:l}=o[s][f],y=m?.[s]?.[f];g(y,k.dirname(l),o),T(y,k.dirname(l),n),q(l,y)?N.warn(`warning: conflict for ${f} - file already exists with different content: ${u(l)} ... Skip.
7
+ import{a as C,b as Z,c as ee,d as Ne,e as te,f as ne,g as Se,h as oe}from"./HNEOPZAP.js";import{a as Fe,b as De}from"./64G5RPLP.js";import{f as de,g as L,h as ue,i as Ce,l as W,m as h,n as Oe}from"./JUZHXP62.js";import{$ as le,O as pe,S as ce,T as fe,aa as ye,b as me,c as j,ca as u,d as O,h as ae,ia as N,ka as he,o as A,oa as S,r as d,t as v,va as ge,wa as Ae}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import*as U from"node:fs";import*as Ge from"node:path";import{performance as Xe}from"perf_hooks";import*as G from"node:path";import*as R from"node:path";function F(e,t,o){let n=R.resolve(e),r=R.resolve(t);if(r!==n&&!r.startsWith(n+R.sep))throw new S(`Refusing to write "${o}" outside the output directory.`)}import*as we from"node:path";function D(e,t,o,n,r){let m=o?`.${o}`:"",a=we.join(e,t),i=a+m,p=n.get(i.toLowerCase());for(let s=2;n.has(i.toLowerCase());s++)i=`${a}-${s}${m}`;return r&&p&&p!==t&&p.toLowerCase()===t.toLowerCase()&&r.conflicts.push({name:t,collidingName:p,filename:i,pointer:r.pointer}),n.set(i.toLowerCase(),t),i}function $(e,t,o,n,r,m,a){let i={},p=new Map;for(let[s,c]of Object.entries(e||{})){if(d(c))continue;let f=D(n,L(s,r),m,p,{conflicts:a,pointer:`${t}/${v(s)}`});F(o,f,s),i[s]=f}return i}import*as Pe from"node:path";function g(e,t,o={}){Se(e,r=>{if(d(r)&&oe(r.$ref))n(r,"$ref");else if(j(r.discriminator)&&j(r.discriminator.mapping)){let{mapping:m}=r.discriminator;for(let a of Object.keys(m)){let i=m[a];typeof i=="string"&&oe(i)&&n(r.discriminator.mapping,a)}}});function n(r,m){let a=r[m].split("/"),i=a.pop(),p=a[2],s=o[p];if(!s||!s[i])return;let c=A(Pe.relative(t,s[i].filename));c.startsWith(".")||(c="./"+c),r[m]=c}}function Y(e,t,o="warn"){if(o==="off"||e.length===0)return;let n=e.map(({name:r,collidingName:m,filename:a,pointer:i})=>({ruleId:"split",severity:o,message:`${r} and ${m} would share one file on a case-insensitive file system`+(o==="error"?".":`, saving ${r} to ${a}.`),location:[{source:t,pointer:i,reportOnKey:!0}],suggest:[]}));if(Ae(n,{totals:ge(n),command:"split"}),o==="error")throw new S("\u274C Errors encountered while splitting: files not created.")}import*as ie from"node:path";var Ee=["schemas","messages","securitySchemes","parameters","correlationIds","messageTraits","operationTraits","serverBindings","channelBindings","operationBindings","messageBindings"];var xe=["schemas","messages","securitySchemes","servers","serverVariables","parameters","replies","replyAddresses","correlationIds","messageTraits","operationTraits","tags","externalDocs","serverBindings","channelBindings","operationBindings","messageBindings"];function H(e,t){return(t==="async2"?Ee:xe).filter(n=>n in e)}function ve({asyncapi:e,asyncapiDir:t,componentsFiles:o,ext:n,specVersion:r,conflicts:m}){let a=e.components;if(!a)return;let i=ie.join(t,C),p=H(a,r);for(let s of p){let c=ie.join(i,s),f=new Map;for(let l of Object.keys(a[s]||{})){let y=D(c,l,n,f,{conflicts:m,pointer:`#/components/${s}/${v(l)}`});F(t,y,l),o[s]=o[s]||{},o[s][l]={filename:y}}}}import*as be from"node:fs";import*as V from"node:path";import*as P from"node:fs";import*as $e from"node:path";function E(e,t,o){if(!P.existsSync(e)||!P.statSync(e).isDirectory())return;let n=P.readdirSync(e);for(let r of n){let m=$e.join(e,r);P.statSync(m).isDirectory()?E(m,t,o):t(m,e,o)}}function b(e,t,o){if(!ce(e))return;let n=W(e);g(n,t,o),h(n,e)}function Te({channels:e,channelsFiles:t,asyncapiDir:o,outDir:n,componentsFiles:r}){if(e){be.mkdirSync(n,{recursive:!0});for(let m of Object.keys(e)){let a=e[m];if(d(a))continue;let i=t[m];g(a,V.dirname(i),r),h(a,i),e[m]={$ref:A(V.relative(o,i))},E(n,b,r)}}}import*as Be from"node:fs";import*as k from"node:path";import*as ke from"node:fs";function K(e){return e!=="securitySchemes"}function z(e,t){K(t)&&ke.mkdirSync(e,{recursive:!0})}import*as je from"node:fs";function q(e,t){return je.existsSync(e)&&!me(W(e),t)}import*as Re from"node:path";function T(e,t,o){if(!(!j(e)&&!Array.isArray(e))){if(Array.isArray(e)){for(let n of e)T(n,t,o);return}for(let n of Object.keys(e)){let r=e[n];if(n==="$ref"&&typeof r=="string"&&r.startsWith("#/channels/")){let m=r.slice(11),a=m.indexOf("/"),i=a===-1?m:m.slice(0,a),p=a===-1?"":m.slice(a),s=o[i];if(s){let c=A(Re.relative(t,s));e[n]=p?`${c}#${p}`:c}}else T(r,t,o)}}}function _e(e,t){let o=e.components;o&&(O(o[t])&&delete o[t],O(o)&&delete e.components)}function Ie({asyncapi:e,asyncapiDir:t,componentsFiles:o,channelsFiles:n,specVersion:r}){let m=e.components;if(m){let p=function(s){let c=k.join(a,s);z(c,s);for(let f of Object.keys(m?.[s]||{})){let{filename:l}=o[s][f],y=m?.[s]?.[f];g(y,k.dirname(l),o),T(y,k.dirname(l),n),q(l,y)?N.warn(`warning: conflict for ${f} - file already exists with different content: ${u(l)} ... Skip.
8
8
  `):h(y,l),delete m?.[s]?.[f]}_e(e,s)},a=k.join(t,C);Be.mkdirSync(a,{recursive:!0}),H(m,r).forEach(p)}}import*as Me from"node:fs";import*as _ from"node:path";function Le({operations:e,operationFiles:t,asyncapiDir:o,outDir:n,componentsFiles:r,channelsFiles:m}){if(e){Me.mkdirSync(n,{recursive:!0});for(let a of Object.keys(e)){let i=e[a];if(d(i))continue;let p=t[a];g(i,_.dirname(p),r),T(i,_.dirname(p),m),h(i,p),e[a]={$ref:A(_.relative(o,p))},E(n,b,r)}}}function We({asyncapi:e,asyncapiDir:t,pathSeparator:o,ext:n,specVersion:r,source:m,fileNameConflictsSeverity:a}){let i=G.join(t,te),p=G.join(t,ne),s=r==="async3"?e.operations:void 0,c={},f=[];ve({asyncapi:e,asyncapiDir:t,componentsFiles:c,ext:n,specVersion:r,conflicts:f});let l=$(e.channels,`#/${te}`,t,i,o,n,f),y=$(s,`#/${ne}`,t,p,o,n,f);Y(f,m,a),Te({channels:e.channels,channelsFiles:l,asyncapiDir:t,outDir:i,componentsFiles:c}),Ie({asyncapi:e,asyncapiDir:t,componentsFiles:c,channelsFiles:l,specVersion:r}),Le({operations:s,operationFiles:y,asyncapiDir:t,outDir:p,componentsFiles:c,channelsFiles:l}),g(e,t,c),h(e,G.join(t,`asyncapi.${n}`))}import*as Q from"node:path";import*as se from"node:path";function X(e){return e?De.filter(t=>K(t)&&Object.keys(e).includes(t)):[]}function Ye(e,t,o,n,r){let{components:m}=e;if(!m)return;let a=se.join(t,C);for(let i of X(m)){let p=se.join(a,i),s=new Map;for(let c of Object.keys(m[i]||{})){let f=D(p,c,n,s,{conflicts:r,pointer:`#/components/${i}/${v(c)}`});F(t,f,c);let l=[];i==="schemas"&&(l=(m[i]?.[c]?.allOf||[]).map(({$ref:y})=>y).filter(ae)),o[i]=o[i]||{},o[i][c]={inherits:l,filename:f}}}}import*as Ke from"node:fs";import*as B from"node:path";import*as J from"node:path";function He(e,t,o,n){if(!e.discriminator)return;let r=`#/${C}/schemas/${t}`,m={};for(let[s,{inherits:c,filename:f}]of Object.entries(n))if(c.indexOf(r)>-1){let l=A(J.relative(J.dirname(o),f));m[s]=l.startsWith(".")?l:"./"+l}if(O(m))return;let a=e.properties[e.discriminator.propertyName],i=a&&a.enum,p=e.discriminator.mapping=e.discriminator.mapping||{};for(let s of Object.keys(m))i&&!i.includes(s)||(p[s]&&p[s]!==m[s]&&N.warn(`warning: explicit mapping overlaps with local mapping entry ${le(s)} at ${u(o)}. Please check it.`),p[s]=m[s])}function Ve(e,t){e.components&&O(e.components[t])&&delete e.components[t],O(e.components)&&delete e.components}function ze(e,t,o){let{components:n}=e;if(n){let a=function(i){let p=B.join(r,i);z(p,i);for(let s of Object.keys(n?.[i]||{})){let{filename:c}=o[i][s],f=n?.[i]?.[s];g(f,B.dirname(c),o),He(f,s,c,o.schemas||{}),q(c,f)?N.warn(`warning: conflict for ${s} - file already exists with different content: ${u(c)} ... Skip.
9
9
  `):h(f,c),delete e.components?.[i]?.[s]}Ve(e,i)},r=B.join(t,C);Ke.mkdirSync(r,{recursive:!0}),X(n).forEach(a)}}import*as I from"node:fs";import*as x from"node:path";function re(e,t,o,n,r,m,a=""){if(!e)return;I.mkdirSync(n,{recursive:!0});let i=new Map;for(let p of Object.keys(e)){let s=e[p];if(d(s))continue;let c=t[p];for(let f of Fe){let l=s[f],y=l?.["x-code-samples"]||l?.["x-codeSamples"];if(!(!y||!Array.isArray(y)))for(let w of y){if(w.source&&w.source.$ref)continue;let M=D(x.join(o,"code_samples",ue(w.lang),a+L(p,m)),f,Ce(w.lang).slice(1),i);F(o,M,w.lang),I.mkdirSync(x.dirname(M),{recursive:!0}),I.writeFileSync(M,w.source),w.source={$ref:A(x.relative(n,M))}}}h(s,c),e[p]={$ref:A(x.relative(o,c))},E(n,b,r)}}function qe(e,t,o,n,r,m){let a=Q.join(t,Z),i=Q.join(t,ee),p=e.webhooks||e["x-webhooks"],s="webhooks"in e&&e.webhooks?`#/${ee}`:`#/${Ne}`,c={},f=[];Ye(e,t,c,n,f);let l=$(e.paths,`#/${Z}`,t,a,o,n,f),y=$(p,s,t,i,o,n,f);Y(f,r,m),ze(e,t,c),re(e.paths,l,t,a,c,o),re(p,y,t,i,c,o,"webhook_"),g(e,t,c),h(e,Q.join(t,`openapi.${n}`))}async function ro({argv:e,collectSpecData:t}){let o=Xe.now(),{api:n,outDir:r,separator:m}=e,a=Oe(n);if(!U.existsSync(n))throw new S(`File ${u(n)} does not exist.`);let i=new fe(Ge.resolve(n),U.readFileSync(n,"utf-8")),p=pe(i.body,{filename:n});t?.({parsed:p});let s=he(p);switch(s){case"async2":case"async3":We({asyncapi:p,asyncapiDir:r,pathSeparator:m,ext:a,specVersion:s,source:i,fileNameConflictsSeverity:e["file-name-conflicts-severity"]});break;case"oas3_0":case"oas3_1":case"oas3_2":qe(p,r,m,a,i,e["file-name-conflicts-severity"]);break;case"oas2":throw new S("OpenAPI 2 is not supported by this command.");default:throw new S("File does not conform to the OpenAPI or AsyncAPI Specification. Version is not specified.")}N.info(`\u{1FA93} Document: ${u(n)} ${ye("is successfully split")}
10
10
  and all related files are saved to the directory: ${u(r)}
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as l}from"./FXKIC5R3.js";import{a as R,b as u,c as f,d}from"./HIII45WJ.js";import{d as y,e as G,f as x}from"./3CSDNX6S.js";import{c as g,d as S,e as h}from"./FVGFKJ67.js";import{c as k,d as v,e as b}from"./GOTKYHFM.js";import{a as D,b as E,c as q,d as z}from"./TTE4EAVV.js";import{a as o}from"./5PR7FNUB.js";import{a,b as p,c as s}from"./DPNI74SB.js";import"./HAOBCQWB.js";import{a as m}from"./QWTSCCNH.js";import{a as i}from"./JM7BMZLD.js";import{a as c}from"./UC5EDLXL.js";import"./UQW6CW3M.js";import{a as I,d as M,e as N}from"./CEASD5U3.js";import{a as rr,b as er,c as tr,d as or,e as nr,f as ar,g as pr,h as sr,i as mr,j as ir,k as cr}from"./JQJ5TDVP.js";import"./UNOXQ62I.js";import{a as U}from"./WZXA5XPB.js";import"./EQTXHL74.js";import"./NEWT5A6S.js";import{e as T,h as j,k as w}from"./LD5MEXEL.js";import{a as _,b as B,c as F,d as J,e as Q,f as H,g as K,h as P,i as V,j as W,k as X,l as Y,m as Z,n as $}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";var A={typescript:{run:a,sample:s,docs:p},zod:{run:m},transformers:{run:i},"tanstack-query":{run:o("react")},"tanstack-query-vue":{run:o("vue")},"tanstack-query-svelte":{run:o("svelte")},"tanstack-query-solid":{run:o("solid")},swr:{run:c},mock:{run:l},cli:{run:u,sample:d,docs:f},python:{run:y,sample:G,docs:x},go:{run:g,sample:S,docs:h},php:{run:k,sample:v,docs:b}},L=Object.fromEntries(Object.entries(D).map(([e,{load:r,...t}])=>[e,{...t,...A[e]}]));function n(){return new Map(Object.entries(L))}function C(e,r,t=n(),O){E(e,r,t,O)}function Er(e,r){let t=r.registry??n();return C(r.generators,r.emit,t,r.outputMode),q(e,{...r,registry:t})}export{cr as AUTHORING_HELPER_NAMES,U as NotSupportedError,_ as Printer,F as RESERVED_WORDS,B as casing,j as codeLiteral,Er as collectGeneratedFiles,H as deref,P as discriminatorCases,Y as docText,X as enumValues,K as flattenAllOf,z as generateClient,$ as headerCoerceType,J as identifierFor,ar as isBinaryContentType,or as isMultipartBody,V as isNullable,nr as isUntypedMultipartBody,er as jsonSuccessSchema,I as operationSignature,mr as paginationItemSchema,rr as paginationRuleFor,w as pascalCase,R as renderComposedCliEntry,ir as renderReferencePage,T as safeIdent,Z as schemaAtPointer,sr as securityRequirements,pr as serverUrlParts,tr as sseResponse,M as tsJsdoc,N as tsType,Q as uniqueIdentifiers,W as unwrapNullable};
7
+ import{a as l}from"./MQWGV2WY.js";import{a as R,b as u,c as f,d}from"./WUOVEP7D.js";import{d as y,e as G,f as x}from"./MWJKN6NG.js";import{c as g,d as S,e as h}from"./IFWW4AH6.js";import{c as k,d as v,e as b}from"./BAIZWXC6.js";import{a as D,b as E,c as q,d as z}from"./PUFMOTSK.js";import{a as o}from"./T66YKREQ.js";import{a,b as p,c as s}from"./RR6N3VYB.js";import"./HAOBCQWB.js";import{a as m}from"./ZGFTDVO4.js";import{a as i}from"./JM7BMZLD.js";import{a as c}from"./472CS7HK.js";import"./AAMQ6PF3.js";import{a as I,d as M,e as N}from"./M2DYVAS3.js";import{a as rr,b as er,c as tr,d as or,e as nr,f as ar,g as pr,h as sr,i as mr,j as ir,k as cr}from"./PBXLYXXR.js";import"./JIU326EH.js";import{a as U}from"./WZXA5XPB.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import{e as T,h as j,k as w}from"./LD5MEXEL.js";import{a as _,b as B,c as F,d as J,e as Q,f as H,g as K,h as P,i as V,j as W,k as X,l as Y,m as Z,n as $}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";var A={typescript:{run:a,sample:s,docs:p},zod:{run:m},transformers:{run:i},"tanstack-query":{run:o("react")},"tanstack-query-vue":{run:o("vue")},"tanstack-query-svelte":{run:o("svelte")},"tanstack-query-solid":{run:o("solid")},swr:{run:c},mock:{run:l},cli:{run:u,sample:d,docs:f},python:{run:y,sample:G,docs:x},go:{run:g,sample:S,docs:h},php:{run:k,sample:v,docs:b}},L=Object.fromEntries(Object.entries(D).map(([e,{load:r,...t}])=>[e,{...t,...A[e]}]));function n(){return new Map(Object.entries(L))}function C(e,r,t=n(),O){E(e,r,t,O)}function Er(e,r){let t=r.registry??n();return C(r.generators,r.emit,t,r.outputMode),q(e,{...r,registry:t})}export{cr as AUTHORING_HELPER_NAMES,U as NotSupportedError,_ as Printer,F as RESERVED_WORDS,B as casing,j as codeLiteral,Er as collectGeneratedFiles,H as deref,P as discriminatorCases,Y as docText,X as enumValues,K as flattenAllOf,z as generateClient,$ as headerCoerceType,J as identifierFor,ar as isBinaryContentType,or as isMultipartBody,V as isNullable,nr as isUntypedMultipartBody,er as jsonSuccessSchema,I as operationSignature,mr as paginationItemSchema,rr as paginationRuleFor,w as pascalCase,R as renderComposedCliEntry,ir as renderReferencePage,T as safeIdent,Z as schemaAtPointer,sr as securityRequirements,pr as serverUrlParts,tr as sseResponse,M as tsJsdoc,N as tsType,Q as uniqueIdentifiers,W as unwrapNullable};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c as x,ia as R}from"./EQTXHL74.js";import{m}from"./UW4UC7ZI.js";function C(e){return e.flatMap(n=>n.operations)}function P(e,n,o){let r=e.specName??e.name;if(o?.exclude?.includes(r))return{};let a=o?.operations?.[r];if(a!==void 0)return b(e,n,a,`pagination.operations["${r}"]`,!0);if(e.paginationExtension!==void 0)return b(e,n,e.paginationExtension,"x-redoclyPagination",!0);if(o?.style!==void 0){let{exclude:s,operations:c,...t}=o;return b(e,n,t,"pagination convention",!1)}return{}}function H(e,n){let o=new Map,r=[];for(let a of C(e.services)){let s=P(a,e,n);s.error!==void 0?r.push(s.error):s.spec!==void 0&&o.set(a.name,{spec:s.spec,itemSchema:s.itemSchema})}if(r.length>0)throw new Error(["Invalid pagination configuration:",...r].join(`
7
+ import{c as x,ia as R}from"./VAPFU7OM.js";import{m}from"./UW4UC7ZI.js";function C(e){return e.flatMap(n=>n.operations)}function P(e,n,o){let r=e.specName??e.name;if(o?.exclude?.includes(r))return{};let a=o?.operations?.[r];if(a!==void 0)return b(e,n,a,`pagination.operations["${r}"]`,!0);if(e.paginationExtension!==void 0)return b(e,n,e.paginationExtension,"x-redoclyPagination",!0);if(o?.style!==void 0){let{exclude:s,operations:c,...t}=o;return b(e,n,t,"pagination convention",!1)}return{}}function H(e,n){let o=new Map,r=[];for(let a of C(e.services)){let s=P(a,e,n);s.error!==void 0?r.push(s.error):s.spec!==void 0&&o.set(a.name,{spec:s.spec,itemSchema:s.itemSchema})}if(r.length>0)throw new Error(["Invalid pagination configuration:",...r].join(`
8
8
  - `));return o}function b(e,n,o,r,a){let s=`Pagination for operation "${e.name}" (${r})`,c=q(o);if(c!==void 0)return{error:`${s}: ${c}`};let t=o,i=d=>a?{error:`${s}: ${d}`}:{};if(e.sse!==void 0)return i("the operation is a Server-Sent Events stream");if(t.style!=="link"&&t.style!=="body-link"){let d=t.style==="cursor"?"cursorParam":"offsetParam",l=t.style==="cursor"?t.cursorParam:t.offsetParam,k=e.queryParams.find(u=>u.name===l);if(!k){let u=e.queryParams.map(T=>T.name).join(", ");return i(`query parameter "${l}" is not declared on the operation`+(u===""?"":` (declared: ${u})`))}let p=O(k.schema,n);if(!(p!==void 0&&(t.style==="cursor"?y(p,n):p.kind==="scalar"&&(p.scalar==="number"||p.scalar==="integer")))){let u=t.style==="cursor"?"a string":"a number";return i(`the "${d}" query parameter "${l}" must accept ${u} (got ${I(p)})`)}}let g=e.successResponses.find(d=>d.contentType.toLowerCase().includes("json"));if(!g)return i("the operation has no JSON success response");if(t.style==="link"){let d=e.successResponseHeaders?.some(l=>l.name==="link")===!0;if(!d&&!a)return{};d||R.warn(`generate-client: ${s.toLowerCase()} follows the Link header, but the success response does not document one.
9
9
  `)}let h=m(g.schema,t.items,n);if(h===void 0)return i(`the "items" pointer "${t.items}" does not resolve in the success response schema`);if(h.kind!=="array")return i(`the "items" pointer "${t.items}" must point at an array (got ${h.kind})`);if(t.style==="body-link"){let d=m(g.schema,t.nextLink,n);if(d===void 0)return i(`the "nextLink" pointer "${t.nextLink}" does not resolve in the success response schema`);if(!y(d,n))return i(`the "nextLink" pointer "${t.nextLink}" must point at a string (got ${d.kind})`)}if(t.style==="cursor"){let d=m(g.schema,t.nextCursor,n);if(d===void 0)return i(`the "nextCursor" pointer "${t.nextCursor}" does not resolve in the success response schema`);if(!y(d,n))return i(`the "nextCursor" pointer "${t.nextCursor}" must point at a string (got ${d.kind})`);if(t.hasMore!==void 0){let l=m(g.schema,t.hasMore,n);if(l===void 0)return i(`the "hasMore" pointer "${t.hasMore}" does not resolve in the success response schema`);if(l.kind!=="scalar"||l.scalar!=="boolean")return i(`the "hasMore" pointer "${t.hasMore}" must point at a boolean (got ${l.kind})`)}}let f=t.limitParam!==void 0?{limitParam:t.limitParam}:{};return{spec:t.style==="cursor"?{style:"cursor",param:t.cursorParam,...f,nextCursor:t.nextCursor,...t.hasMore!==void 0?{hasMore:t.hasMore}:{},items:t.items}:t.style==="link"?{style:"link",...f,items:t.items}:t.style==="body-link"?{style:"body-link",...f,nextLink:t.nextLink,items:t.items}:{style:t.style,param:t.offsetParam,...f,items:t.items},itemSchema:h.items}}function q(e){if(!x(e))return"the rule must be an object";let{style:n,cursorParam:o,nextCursor:r,hasMore:a,offsetParam:s,nextLink:c,limitParam:t,items:i}=e;if(n!=="cursor"&&n!=="offset"&&n!=="page"&&n!=="link"&&n!=="body-link")return`"style" must be one of "cursor" | "offset" | "page" | "link" | "body-link" (got ${JSON.stringify(n)})`;if(typeof i!="string"||i!==""&&!i.startsWith("/"))return'"items" must be a JSON pointer starting with "/" (or "" when the response body is the item array itself)';if(n==="cursor"){if(typeof o!="string"||o==="")return'cursor style requires a "cursorParam" query parameter name';if(typeof r!="string"||!r.startsWith("/"))return'cursor style requires a "nextCursor" JSON pointer starting with "/"';if(a!==void 0&&(typeof a!="string"||!a.startsWith("/")))return'"hasMore" must be a JSON pointer starting with "/"'}else if(n==="offset"||n==="page"){if(typeof s!="string"||s==="")return`${n} style requires an "offsetParam" query parameter name`}else if(n==="body-link"&&(typeof c!="string"||!c.startsWith("/")))return'body-link style requires a "nextLink" JSON pointer starting with "/"';if(t!==void 0&&typeof t!="string")return'"limitParam" must be a query parameter name'}function I(e){return e===void 0?"an unresolvable ref":e.kind==="scalar"||e.kind==="enum"?e.scalar:e.kind}function O(e,n){let o=new Set,r=e;for(;r.kind==="ref";){let{name:a}=r;if(o.has(a))return;o.add(a);let s=n.schemas.find(c=>c.name===a);if(s===void 0)return;r=s.schema}return r}function y(e,n){return e.kind==="scalar"||e.kind==="enum"?e.scalar==="string":e.kind==="literal"?typeof e.value=="string":e.kind==="union"?e.members.every(o=>{let r=O(o,n);return r!==void 0&&(r.kind==="null"||r.kind!=="union"&&y(r,n))}):!1}var G={"types.ts":`/**
10
10
  * The public type surface of the client runtime \u2014 \`@redocly/client-generator\`'s
@@ -5650,4 +5650,4 @@ async function runSingle(
5650
5650
  }
5651
5651
  return fail(1, detail);
5652
5652
  }
5653
- }`},S=["ApiError","ApiErrorLike","AuthCredentials","BodyMethod","Capabilities","CliAuthScheme","CliCommand","CliFlag","CliGlobals","CliInvocation","CliWiring","Client","ClientConfig","ClientCore","CommandContext","CommandSource","CustomCommand","Envelope","EnvelopeResult","EnvelopeResultForKnownInit","FRAME_DELIMITER","GLOBAL_FLAGS","HeadersOf","IDEMPOTENT_METHODS","LAYERS","LAYER_OF","LinkPageCall","Middleware","NoRequiredKeys","OperationArgs","OperationContext","OperationDescriptor","OperationMethodIdentity","OpsShape","PageOf","Paginated","PaginationSpec","ParamSpec","ParseAs","QueryStyle","QueryValue","RequestContext","RequestOptions","ResolvedCommand","ResponseHeaderSpec","Result","RetryConfig","RetryContext","RetryStrategy","SecuritySpec","SendCapabilities","ServerSentEvent","SettledCall","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","anySignal","buildUrl","callInputs","coerceResponseHeader","commandContract","constantCase","createClientCore","defaultRetryOn","encodeBase64","encodeReserved","execute","groupSlug","inputOf","invokedName","isConfigured","items","itemsByLink","kindFor","linkNext","linkPageCall","loadBody","mergeSetup","middlewareChain","namespaceArgs","normalizeCommands","oneLine","pageCall","pages","pagesByLink","paginateCapability","parse","parseInvocation","parseSseFrame","prepareRequest","queryStyles","readEnvelopeHeaders","readError","redactHeaders","renderComposedHelp","renderHelp","resolveAuth","resolvePointer","resolveToken","retryDelay","runCli","runSingle","runSources","send","shadowedCommandName","sleep","splitArgs","sse","stringHeaders","substitutePath","timeoutSignal","toFormData","toHeaderRecord"];var j=["client","OPERATIONS","Ops","OperationId","OperationPath","OperationTag","createClient","mergeSetup","ApiError","TimeoutError","configure","use","auth","defaultRetryOn","ClientConfig","RequestOptions","SseOptions","Middleware","OperationDescriptor","ServerSentEvent","Result","Envelope","EnvelopeResult","TokenProvider","__redoclySetup"],$=["z","http","HttpResponse","handlers","faker","queryOptions","useSWR","useSWRMutation","__Writable"],L=["AbortController","AbortSignal","Array","ArrayBuffer","ArrayBufferView","AsyncGenerator","AsyncIterable","Blob","BodyInit","Boolean","DOMException","Date","Error","Extract","FormData","Headers","HeadersInit","JSON","Map","Math","NonNullable","Number","Object","Omit","Partial","Promise","ReadableStream","Record","RegExp","RegExpExecArray","Request","RequestInit","Response","Set","String","Symbol","TextDecoder","TextEncoder","TypeError","Uint8Array","URL","URLSearchParams","btoa","clearTimeout","crypto","decodeURIComponent","document","encodeURIComponent","fetch","globalThis","setTimeout","undefined"],w;function Q(){return w===void 0&&(w=new Set([...j,...$,...L,...S])),w}var A={name:"@redocly/client-generator",version:"0.7.0",description:"Generate typed, zero-dependency TypeScript clients (fetch, auth, retries, middleware, SSE) from OpenAPI descriptions.",type:"module",types:"lib/index.d.ts",sideEffects:!1,exports:{".":{types:"./lib/index.d.ts",import:"./lib/index.js",default:"./lib/index.js"},"./generate":{types:"./lib/generate.d.ts",import:"./lib/generate.js",default:"./lib/generate.js"},"./printers/python":{types:"./lib/printers/python.d.ts",import:"./lib/printers/python.js",default:"./lib/printers/python.js"},"./printers/go":{types:"./lib/printers/go.d.ts",import:"./lib/printers/go.js",default:"./lib/printers/go.js"},"./printers/php":{types:"./lib/printers/php.d.ts",import:"./lib/printers/php.js",default:"./lib/printers/php.js"},"./printers/typescript":{types:"./lib/printers/typescript.d.ts",import:"./lib/printers/typescript.js",default:"./lib/printers/typescript.js"},"./printers":{types:"./lib/printers/index.d.ts",import:"./lib/printers/index.js",default:"./lib/printers/index.js"},"./contracts/typescript":{types:"./lib/contracts/typescript.d.ts",import:"./lib/contracts/typescript.js",default:"./lib/contracts/typescript.js"},"./runtime-sources":{types:"./lib/runtime-sources.d.ts",import:"./lib/runtime-sources.js",default:"./lib/runtime-sources.js"},"./package.json":"./package.json"},engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{"examples:regen":"node scripts/regenerate-examples.mjs",prepare:"node scripts/generate-runtime-sources.mjs && node scripts/generate-eject-assets.mjs","typecheck:examples":"node scripts/typecheck-examples.mjs"},license:"MIT",repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["OpenAPI","Swagger","TypeScript","client","generator","codegen","fetch"],contributors:["Roman Marshevskyi <roman.marshevskyy@redocly.com> (https://redocly.com/)"],dependencies:{"@redocly/openapi-core":"2.64.0"},peerDependencies:{typescript:">=5.5.0"},peerDependenciesMeta:{typescript:{optional:!0}},devDependencies:{typescript:"6.0.2"},files:["lib","eject-assets"]};var ee=A.version;function E(e){let n=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return n===null?void 0:[Number(n[1]),Number(n[2]),Number(n[3])]}function v(e,n){return e[0]-n[0]||e[1]-n[1]||e[2]-n[2]}function ne(e,n){let o=/^[\^~]|^>=/.exec(n.trim())?.[0]??"",r=E(n.trim().slice(o.length)),a=E(e);if(!(r===void 0||a===void 0))return v(a,r)<0?!1:o===">="?!0:o===""?v(a,r)===0:o==="~"?a[0]===r[0]&&a[1]===r[1]:r[0]!==0?a[0]===r[0]:r[1]!==0?a[0]===0&&a[1]===r[1]:v(a,r)===0}export{C as a,H as b,G as c,W as d,j as e,Q as f,ee as g,ne as h};
5653
+ }`},S=["ApiError","ApiErrorLike","AuthCredentials","BodyMethod","Capabilities","CliAuthScheme","CliCommand","CliFlag","CliGlobals","CliInvocation","CliWiring","Client","ClientConfig","ClientCore","CommandContext","CommandSource","CustomCommand","Envelope","EnvelopeResult","EnvelopeResultForKnownInit","FRAME_DELIMITER","GLOBAL_FLAGS","HeadersOf","IDEMPOTENT_METHODS","LAYERS","LAYER_OF","LinkPageCall","Middleware","NoRequiredKeys","OperationArgs","OperationContext","OperationDescriptor","OperationMethodIdentity","OpsShape","PageOf","Paginated","PaginationSpec","ParamSpec","ParseAs","QueryStyle","QueryValue","RequestContext","RequestOptions","ResolvedCommand","ResponseHeaderSpec","Result","RetryConfig","RetryContext","RetryStrategy","SecuritySpec","SendCapabilities","ServerSentEvent","SettledCall","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","anySignal","buildUrl","callInputs","coerceResponseHeader","commandContract","constantCase","createClientCore","defaultRetryOn","encodeBase64","encodeReserved","execute","groupSlug","inputOf","invokedName","isConfigured","items","itemsByLink","kindFor","linkNext","linkPageCall","loadBody","mergeSetup","middlewareChain","namespaceArgs","normalizeCommands","oneLine","pageCall","pages","pagesByLink","paginateCapability","parse","parseInvocation","parseSseFrame","prepareRequest","queryStyles","readEnvelopeHeaders","readError","redactHeaders","renderComposedHelp","renderHelp","resolveAuth","resolvePointer","resolveToken","retryDelay","runCli","runSingle","runSources","send","shadowedCommandName","sleep","splitArgs","sse","stringHeaders","substitutePath","timeoutSignal","toFormData","toHeaderRecord"];var j=["client","OPERATIONS","Ops","OperationId","OperationPath","OperationTag","createClient","mergeSetup","ApiError","TimeoutError","configure","use","auth","defaultRetryOn","ClientConfig","RequestOptions","SseOptions","Middleware","OperationDescriptor","ServerSentEvent","Result","Envelope","EnvelopeResult","TokenProvider","__redoclySetup"],$=["z","http","HttpResponse","handlers","faker","queryOptions","useSWR","useSWRMutation","__Writable"],L=["AbortController","AbortSignal","Array","ArrayBuffer","ArrayBufferView","AsyncGenerator","AsyncIterable","Blob","BodyInit","Boolean","DOMException","Date","Error","Extract","FormData","Headers","HeadersInit","JSON","Map","Math","NonNullable","Number","Object","Omit","Partial","Promise","ReadableStream","Record","RegExp","RegExpExecArray","Request","RequestInit","Response","Set","String","Symbol","TextDecoder","TextEncoder","TypeError","Uint8Array","URL","URLSearchParams","btoa","clearTimeout","crypto","decodeURIComponent","document","encodeURIComponent","fetch","globalThis","setTimeout","undefined"],w;function Q(){return w===void 0&&(w=new Set([...j,...$,...L,...S])),w}var A={name:"@redocly/client-generator",version:"0.7.2",description:"Generate typed, zero-dependency TypeScript clients (fetch, auth, retries, middleware, SSE) from OpenAPI descriptions.",type:"module",types:"lib/index.d.ts",sideEffects:!1,exports:{".":{types:"./lib/index.d.ts",import:"./lib/index.js",default:"./lib/index.js"},"./generate":{types:"./lib/generate.d.ts",import:"./lib/generate.js",default:"./lib/generate.js"},"./printers/python":{types:"./lib/printers/python.d.ts",import:"./lib/printers/python.js",default:"./lib/printers/python.js"},"./printers/go":{types:"./lib/printers/go.d.ts",import:"./lib/printers/go.js",default:"./lib/printers/go.js"},"./printers/php":{types:"./lib/printers/php.d.ts",import:"./lib/printers/php.js",default:"./lib/printers/php.js"},"./printers/typescript":{types:"./lib/printers/typescript.d.ts",import:"./lib/printers/typescript.js",default:"./lib/printers/typescript.js"},"./printers":{types:"./lib/printers/index.d.ts",import:"./lib/printers/index.js",default:"./lib/printers/index.js"},"./contracts/typescript":{types:"./lib/contracts/typescript.d.ts",import:"./lib/contracts/typescript.js",default:"./lib/contracts/typescript.js"},"./runtime-sources":{types:"./lib/runtime-sources.d.ts",import:"./lib/runtime-sources.js",default:"./lib/runtime-sources.js"},"./package.json":"./package.json"},engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{"examples:regen":"node scripts/regenerate-examples.mjs",prepare:"node scripts/generate-runtime-sources.mjs && node scripts/generate-eject-assets.mjs","typecheck:examples":"node scripts/typecheck-examples.mjs"},license:"MIT",repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["OpenAPI","Swagger","TypeScript","client","generator","codegen","fetch"],contributors:["Roman Marshevskyi <roman.marshevskyy@redocly.com> (https://redocly.com/)"],dependencies:{"@redocly/openapi-core":"2.65.0"},peerDependencies:{typescript:">=5.5.0"},peerDependenciesMeta:{typescript:{optional:!0}},devDependencies:{typescript:"6.0.2"},files:["lib","eject-assets"]};var ee=A.version;function E(e){let n=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return n===null?void 0:[Number(n[1]),Number(n[2]),Number(n[3])]}function v(e,n){return e[0]-n[0]||e[1]-n[1]||e[2]-n[2]}function ne(e,n){let o=/^[\^~]|^>=/.exec(n.trim())?.[0]??"",r=E(n.trim().slice(o.length)),a=E(e);if(!(r===void 0||a===void 0))return v(a,r)<0?!1:o===">="?!0:o===""?v(a,r)===0:o==="~"?a[0]===r[0]&&a[1]===r[1]:r[0]!==0?a[0]===r[0]:r[1]!==0?a[0]===0&&a[1]===r[1]:v(a,r)===0}export{C as a,H as b,G as c,W as d,j as e,Q as f,ee as g,ne as h};