@povio/openapi-codegen-cli 1.2.10 → 1.2.11

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.
package/dist/sh.js CHANGED
@@ -522,7 +522,7 @@ ${rr.join(`
522
522
  `:`
523
523
  `)+m,T=b+1,b=l.indexOf(`
524
524
  `,T)}while(b!==-1);return I+=l.slice(T),I}t(CQe,"stringEncaseCRLFWithFirstIndex");var{stdout:EQe,stderr:PQe}=TQe,AEe=Symbol("GENERATOR"),yM=Symbol("STYLER"),OU=Symbol("IS_EMPTY"),wQe=["ansi","ansi","ansi256","ansi16m"],vM=Object.create(null),B5t=t((l,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let m=EQe?EQe.level:0;l.level=u.level===void 0?m:u.level},"applyOptions"),NEe=class NEe{constructor(u){return AQe(u)}};t(NEe,"Chalk");var tce=NEe,AQe=t(l=>{let u=t((...m)=>m.join(" "),"chalk");return B5t(u,l),Object.setPrototypeOf(u,FU.prototype),u},"chalkFactory");function FU(l){return AQe(l)}t(FU,"createChalk");Object.setPrototypeOf(FU.prototype,Function.prototype);for(let[l,u]of Object.entries(Yx))vM[l]={get(){let m=rce(this,IEe(u.open,u.close,this[yM]),this[OU]);return Object.defineProperty(this,l,{value:m}),m}};vM.visible={get(){let l=rce(this,this[yM],!0);return Object.defineProperty(this,"visible",{value:l}),l}};var DEe=t((l,u,m,...b)=>l==="rgb"?u==="ansi16m"?Yx[m].ansi16m(...b):u==="ansi256"?Yx[m].ansi256(Yx.rgbToAnsi256(...b)):Yx[m].ansi(Yx.rgbToAnsi(...b)):l==="hex"?DEe("rgb",u,m,...Yx.hexToRgb(...b)):Yx[m][l](...b),"getModelAnsi"),$5t=["rgb","hex","ansi256"];for(let l of $5t){vM[l]={get(){let{level:m}=this;return function(...b){let T=IEe(DEe(l,wQe[m],"color",...b),Yx.color.close,this[yM]);return rce(this,T,this[OU])}}};let u="bg"+l[0].toUpperCase()+l.slice(1);vM[u]={get(){let{level:m}=this;return function(...b){let T=IEe(DEe(l,wQe[m],"bgColor",...b),Yx.bgColor.close,this[yM]);return rce(this,T,this[OU])}}}}var J5t=Object.defineProperties(()=>{},{...vM,level:{enumerable:!0,get(){return this[AEe].level},set(l){this[AEe].level=l}}}),IEe=t((l,u,m)=>{let b,T;return m===void 0?(b=l,T=u):(b=m.openAll+l,T=u+m.closeAll),{open:l,close:u,openAll:b,closeAll:T,parent:m}},"createStyler"),rce=t((l,u,m)=>{let b=t((...T)=>q5t(b,T.length===1?""+T[0]:T.join(" ")),"builder");return Object.setPrototypeOf(b,J5t),b[AEe]=l,b[yM]=u,b[OU]=m,b},"createBuilder"),q5t=t((l,u)=>{if(l.level<=0||!u)return l[OU]?"":u;let m=l[yM];if(m===void 0)return u;let{openAll:b,closeAll:T}=m;if(u.includes("\x1B"))for(;m!==void 0;)u=kQe(u,m.close,m.open),m=m.parent;let I=u.indexOf(`
525
- `);return I!==-1&&(u=CQe(u,T,b,I)),b+u+T},"applyStyle");Object.defineProperties(FU.prototype,vM);var WXt=FU(),HXt=FU({level:PQe?PQe.level:0});var EA=new tce;function OEe(l){console.log(l)}t(OEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function MU(l){console.log(EA.green(`[SUCCESS] ${l}`))}t(MU,"logSuccess");function HN(l,u){l instanceof Error?console.log(EA.red(`[ERROR] ${u||l.message}`)):console.log(EA.red(`[ERROR] ${l}`))}t(HN,"logError");function nce(l){console.log(EA.bgYellow(`==== ${l} ====`))}t(nce,"logBanner");var DQe=Vd(require("fs"));function bM(){return"1.2.10"}t(bM,"getVersion");var aYt=Vd(NQe());var FEe=Symbol("options_key");function Du(l){return(u,m)=>{var b,T;if(l!=null){let I={...Reflect.getMetadata(FEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((T=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:T.toLowerCase())}};Reflect.defineMetadata(FEe,I,u)}}}t(Du,"YargOption");function OQe(l){let u=Reflect.getMetadata(FEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(OQe,"getYargsOption");function ice(l){return async u=>u.options(z5t(l)).middleware(async m=>await V5t(l,m),!0)}t(ice,"getBuilder");function z5t(l){return Object.entries(OQe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([T])=>!["envAlias","default"].includes(T))),u),{})}t(z5t,"getYargsOptions");async function V5t(l,u){let m=new l;for(let[b,T]of Object.entries(OQe(l)))m[b]=u[b]??T.default;return m}t(V5t,"loadYargsConfig");var uit=Vd(kwe());var urt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},frt={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var u_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),zA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),EW=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ny=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),_rt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),Cwe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),prt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),BVt=t(l=>{var b;let u=l.reduce((T,I)=>({...T,[I]:(T[I]??0)+1}),{});return(b=Object.entries(u).sort((T,I)=>T[1]===I[1]?I[0].length-T[0].length:I[1]-T[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),Ewe=t(l=>{let u=l.map(u_).map(drt).map(m=>$Vt(m)).flat();return BVt(u)},"getMostCommonAdjacentCombinationSplit"),drt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),ule=t(l=>drt(l).join(" "),"camelToSpaceSeparated"),$Vt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let T=0;T<l.length;T++)if(!u.includes(l[T].toLowerCase()))for(let I=T+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(T,I).join(""));return m},"getAdjacentStringCombinations"),mrt=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${zA(m)}|${u_(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");function m8(l){return _rt(l)}t(m8,"formatTag");function VA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return m8(m??u.defaultTag)}t(VA,"getOperationTag");function Y1(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return m8(m??u.defaultTag)}t(Y1,"getEndpointTag");function hrt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(hrt,"isTagExcluded");var h8="application/json",Pwe={"Content-Type":h8,Accept:h8},fle="data",wwe="axios",UA="config",DC="AxiosRequestConfig",_le={defaultImport:wwe,bindings:[DC],from:"axios"};var r6=Vd(ple()),Awe=2,grt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],yrt=["query","header","path"],g8=[r6.OpenAPIV3.HttpMethods.GET,r6.OpenAPIV3.HttpMethods.PUT,r6.OpenAPIV3.HttpMethods.POST,r6.OpenAPIV3.HttpMethods.DELETE,r6.OpenAPIV3.HttpMethods.OPTIONS,r6.OpenAPIV3.HttpMethods.HEAD,r6.OpenAPIV3.HttpMethods.PATCH,r6.OpenAPIV3.HttpMethods.TRACE],vrt=["string","number","integer","boolean"],PW=["allOf","anyOf","oneOf"];var brt="Schema",Srt="Enum",xrt="Body",Trt="Param",krt="Response",Crt="ErrorResponse",wW="z.void()",sR="z.any()",dle="z.instanceof(Blob)",AW="z.enum",Ert="z.int()",Prt="z.number()",mle="z.string()",wrt="z.email()",Art="z.url()",Drt="z.uuid()",Irt="z.iso.datetime({ offset: true })",HA={bindings:["z"],from:"zod"};var n6=Symbol.for("@ts-pattern/matcher"),zVt=Symbol.for("@ts-pattern/isVariadic"),gle="@ts-pattern/anonymous-select-key",Dwe=t(l=>!!(l&&typeof l=="object"),"r"),hle=t(l=>l&&!!l[n6],"i"),OC=t((l,u,m)=>{if(hle(l)){let b=l[n6](),{matched:T,selections:I}=b.match(u);return T&&I&&Object.keys(I).forEach(L=>m(L,I[L])),T}if(Dwe(l)){if(!Dwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],T=[],I=[];for(let L of l.keys()){let Q=l[L];hle(Q)&&Q[zVt]?I.push(Q):I.length?T.push(Q):b.push(Q)}if(I.length){if(I.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(u.length<b.length+T.length)return!1;let L=u.slice(0,b.length),Q=T.length===0?[]:u.slice(-T.length),ae=u.slice(b.length,T.length===0?1/0:-T.length);return b.every((ee,pe)=>OC(ee,L[pe],m))&&T.every((ee,pe)=>OC(ee,Q[pe],m))&&(I.length===0||OC(I[0],ae,m))}return l.length===u.length&&l.every((L,Q)=>OC(L,u[Q],m))}return Reflect.ownKeys(l).every(b=>{let T=l[b];return(b in u||hle(I=T)&&I[n6]().matcherType==="optional")&&OC(T,u[b],m);var I})}return Object.is(u,l)},"s"),YA=t(l=>{var u,m,b;return Dwe(l)?hle(l)?(u=(m=(b=l[n6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?IW(l,YA):IW(Object.values(l),YA):[]},"o"),IW=t((l,u)=>l.reduce((m,b)=>m.concat(u(b)),[]),"c");function pS(l){return Object.assign(l,{optional:t(()=>VVt(l),"optional"),and:t(u=>Zp(l,u),"and"),or:t(u=>UVt(l,u),"or"),select:t(u=>u===void 0?Nrt(l):Nrt(u,l),"select")})}t(pS,"u");function VVt(l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return u===void 0?(YA(l).forEach(T=>b(T,void 0)),{matched:!0,selections:m}):{matched:OC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>YA(l),"getSelectionKeys"),matcherType:"optional"})})}t(VVt,"h");function Zp(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return{matched:l.every(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function UVt(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return IW(l,YA).forEach(T=>b(T,void 0)),{matched:l.some(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"or"})})}t(UVt,"d");function Df(l){return{[n6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Df,"p");function Nrt(...l){let u=typeof l[0]=="string"?l[0]:void 0,m=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return pS({[n6]:()=>({match:t(b=>{let T={[u??gle]:b};return{matched:m===void 0||OC(m,b,(I,L)=>{T[I]=L}),selections:T}},"match"),getSelectionKeys:t(()=>[u??gle].concat(m===void 0?[]:YA(m)),"getSelectionKeys")})})}t(Nrt,"y");function IC(l){return typeof l=="number"}t(IC,"v");function GA(l){return typeof l=="string"}t(GA,"b");function QA(l){return typeof l=="bigint"}t(QA,"w");var Pnr=pS(Df(function(l){return!0}));var ZA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&!!b.match(m)))));var m},"regex")}),"j"),wnr=ZA(Df(GA)),NC=t(l=>Object.assign(pS(l),{between:t((u,m)=>NC(Zp(l,((b,T)=>Df(I=>IC(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<m))(u))),"lt"),gt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>m))(u))),"gt"),lte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<=m))(u))),"lte"),gte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>=m))(u))),"gte"),int:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>NC(Zp(l,Df(u=>IC(u)&&u>0))),"positive"),negative:t(()=>NC(Zp(l,Df(u=>IC(u)&&u<0))),"negative")}),"x"),Anr=NC(Df(IC)),XA=t(l=>Object.assign(pS(l),{between:t((u,m)=>XA(Zp(l,((b,T)=>Df(I=>QA(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<m))(u))),"lt"),gt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>m))(u))),"gt"),lte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<=m))(u))),"lte"),gte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>=m))(u))),"gte"),positive:t(()=>XA(Zp(l,Df(u=>QA(u)&&u>0))),"positive"),negative:t(()=>XA(Zp(l,Df(u=>QA(u)&&u<0))),"negative")}),"A"),Dnr=XA(Df(QA)),Inr=pS(Df(function(l){return typeof l=="boolean"})),Nnr=pS(Df(function(l){return typeof l=="symbol"})),Onr=pS(Df(function(l){return l==null})),Fnr=pS(Df(function(l){return l!=null}));var Fwe=class Fwe extends Error{constructor(u){let m;try{m=JSON.stringify(u)}catch{m=u}super(`Pattern matching error: no pattern matches value ${m}`),this.input=void 0,this.input=u}};t(Fwe,"W");var Iwe=Fwe,Nwe={matched:!1,value:void 0};function Xy(l){return new Owe(l,Nwe)}t(Xy,"z");var DW=class DW{constructor(u,m){this.input=void 0,this.state=void 0,this.input=u,this.state=m}with(...u){if(this.state.matched)return this;let m=u[u.length-1],b=[u[0]],T;u.length===3&&typeof u[1]=="function"?T=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Q=t((ee,pe)=>{I=!0,L[ee]=pe},"a"),ae=!b.some(ee=>OC(ee,this.input,Q))||T&&!T(this.input)?Nwe:{matched:!0,value:m(I?gle in L?L[gle]:L:this.input,this.input)};return new DW(this.input,ae)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new DW(this.input,b?{matched:!0,value:m(this.input,this.input)}:Nwe)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Iwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(DW,"I");var Owe=DW;function gf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(gf,"isReferenceObject");function iy(l){return!gf(l)}t(iy,"isSchemaObject");function yle(l){return l.type==="array"}t(yle,"isArraySchemaObject");function Ort(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[u,m]=l.allOf.reduce((T,I)=>{if(WVt(I)){let L=I.required;T[0].push(...L??[])}else T[1].push(I);return T},[[],[]]),b={properties:u.reduce((T,I)=>(T[I]={},T),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((T,I)=>{if(gf(T)){let L=I(T.$ref);L&&b.required.forEach(Q=>{var ae;b.properties[Q]=((ae=L==null?void 0:L.properties)==null?void 0:ae[Q])??{}})}else{let L=T.properties??{};b.required.forEach(Q=>{L[Q]&&(b.properties[Q]=L[Q]??{})})}},"patchRequiredSchemaInLoop")}}t(Ort,"inferRequiredSchema");var WVt=t(l=>!gf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var Mrt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),y8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),aR=t(l=>y8(l).split("/").at(-1),"getSchemaNameByRef");function Rwe(l){let u=HVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ny(u)}t(Rwe,"normalizeString");function Lwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(Lwe,"wrapWithQuotesIfNeeded");function Rrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(Rrt,"unwrapQuotesIfNeeded");function HVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(HVt,"prefixStringStartingWithNumberIfNeeded");function jwe(l){let u=l.replaceAll("_","#");return ny(u.replaceAll("-","_")).replaceAll("#","_")}t(jwe,"pathParamToVariableName");var v8=t(l=>vrt.includes(l),"isPrimitiveType");function Lrt(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(u,m)=>{let b=m.codePointAt(),T=b.toString(16);return b<=255?`\\x${`00${T}`.slice(-2)}`:`\\u${`0000${T}`.slice(-4)}`}).replace(/\//g,"\\/")}t(Lrt,"escapeControlCharacters");function FC(l){return l.includes("application/")&&l.includes("json")||grt.includes(l)||l.includes("text/")}t(FC,"isParamMediaTypeAllowed");function NW(l){return l>=200&&l<300}t(NW,"isMainResponseStatus");function vle(l){return!(l>=200&&l<300)}t(vle,"isErrorStatus");function ble(l){return l.startsWith("application/")}t(ble,"isMediaTypeAllowed");var Frt=/({\w+})/g,GVt=/[^\w\-]+/g;function jrt(l){l=u_(EW(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(Frt)];if(u.length>0){let m=u.sort((b,T)=>b.index-T.index)[u.length-1][0];l=`${l.replace(Frt,"")}By${u_(m.slice(1,-1))}`}return l.replace(GVt,"_")}t(jrt,"pathToVariableName");var Mwe=/{(\b\w+(?:-\w+)*\b)}/g;function Brt(l){let u=l.match(Mwe);return u===null?l.replaceAll(Mwe,":$1"):(u.forEach(m=>{let b=jwe(m.replaceAll(Mwe,":$1"));l=l.replaceAll(m,b)}),l)}t(Brt,"replaceHyphenatedPath");var Sle=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&iy(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),b8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");function MC({schema:l,meta:u,options:m}){let b=[];Xy(l.type).with("string",()=>b.push(XVt(l))).with("number","integer",()=>b.push(KVt(l))).with("array",()=>b.push(eUt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
525
+ `);return I!==-1&&(u=CQe(u,T,b,I)),b+u+T},"applyStyle");Object.defineProperties(FU.prototype,vM);var WXt=FU(),HXt=FU({level:PQe?PQe.level:0});var EA=new tce;function OEe(l){console.log(l)}t(OEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function MU(l){console.log(EA.green(`[SUCCESS] ${l}`))}t(MU,"logSuccess");function HN(l,u){l instanceof Error?console.log(EA.red(`[ERROR] ${u||l.message}`)):console.log(EA.red(`[ERROR] ${l}`))}t(HN,"logError");function nce(l){console.log(EA.bgYellow(`==== ${l} ====`))}t(nce,"logBanner");var DQe=Vd(require("fs"));function bM(){return"1.2.11"}t(bM,"getVersion");var aYt=Vd(NQe());var FEe=Symbol("options_key");function Du(l){return(u,m)=>{var b,T;if(l!=null){let I={...Reflect.getMetadata(FEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((T=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:T.toLowerCase())}};Reflect.defineMetadata(FEe,I,u)}}}t(Du,"YargOption");function OQe(l){let u=Reflect.getMetadata(FEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(OQe,"getYargsOption");function ice(l){return async u=>u.options(z5t(l)).middleware(async m=>await V5t(l,m),!0)}t(ice,"getBuilder");function z5t(l){return Object.entries(OQe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([T])=>!["envAlias","default"].includes(T))),u),{})}t(z5t,"getYargsOptions");async function V5t(l,u){let m=new l;for(let[b,T]of Object.entries(OQe(l)))m[b]=u[b]??T.default;return m}t(V5t,"loadYargsConfig");var uit=Vd(kwe());var urt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},frt={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var u_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),zA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),EW=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ny=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),_rt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),Cwe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),prt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),BVt=t(l=>{var b;let u=l.reduce((T,I)=>({...T,[I]:(T[I]??0)+1}),{});return(b=Object.entries(u).sort((T,I)=>T[1]===I[1]?I[0].length-T[0].length:I[1]-T[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),Ewe=t(l=>{let u=l.map(u_).map(drt).map(m=>$Vt(m)).flat();return BVt(u)},"getMostCommonAdjacentCombinationSplit"),drt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),ule=t(l=>drt(l).join(" "),"camelToSpaceSeparated"),$Vt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let T=0;T<l.length;T++)if(!u.includes(l[T].toLowerCase()))for(let I=T+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(T,I).join(""));return m},"getAdjacentStringCombinations"),mrt=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${zA(m)}|${u_(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");function m8(l){return _rt(l)}t(m8,"formatTag");function VA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return m8(m??u.defaultTag)}t(VA,"getOperationTag");function Y1(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return m8(m??u.defaultTag)}t(Y1,"getEndpointTag");function hrt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(hrt,"isTagExcluded");var h8="application/json",Pwe={"Content-Type":h8,Accept:h8},fle="data",wwe="axios",UA="config",DC="AxiosRequestConfig",_le={defaultImport:wwe,bindings:[DC],from:"axios"};var r6=Vd(ple()),Awe=2,grt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],yrt=["query","header","path"],g8=[r6.OpenAPIV3.HttpMethods.GET,r6.OpenAPIV3.HttpMethods.PUT,r6.OpenAPIV3.HttpMethods.POST,r6.OpenAPIV3.HttpMethods.DELETE,r6.OpenAPIV3.HttpMethods.OPTIONS,r6.OpenAPIV3.HttpMethods.HEAD,r6.OpenAPIV3.HttpMethods.PATCH,r6.OpenAPIV3.HttpMethods.TRACE],vrt=["string","number","integer","boolean"],PW=["allOf","anyOf","oneOf"];var brt="Schema",Srt="Enum",xrt="Body",Trt="Param",krt="Response",Crt="ErrorResponse",wW="z.void()",sR="z.any()",dle="z.instanceof(Blob)",AW="z.enum",Ert="z.int()",Prt="z.number()",mle="z.string()",wrt="z.email()",Art="z.url()",Drt="z.uuid()",Irt="z.iso.datetime({ offset: true })",HA={bindings:["z"],from:"zod"};var n6=Symbol.for("@ts-pattern/matcher"),zVt=Symbol.for("@ts-pattern/isVariadic"),gle="@ts-pattern/anonymous-select-key",Dwe=t(l=>!!(l&&typeof l=="object"),"r"),hle=t(l=>l&&!!l[n6],"i"),OC=t((l,u,m)=>{if(hle(l)){let b=l[n6](),{matched:T,selections:I}=b.match(u);return T&&I&&Object.keys(I).forEach(L=>m(L,I[L])),T}if(Dwe(l)){if(!Dwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],T=[],I=[];for(let L of l.keys()){let Q=l[L];hle(Q)&&Q[zVt]?I.push(Q):I.length?T.push(Q):b.push(Q)}if(I.length){if(I.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(u.length<b.length+T.length)return!1;let L=u.slice(0,b.length),Q=T.length===0?[]:u.slice(-T.length),ae=u.slice(b.length,T.length===0?1/0:-T.length);return b.every((ee,pe)=>OC(ee,L[pe],m))&&T.every((ee,pe)=>OC(ee,Q[pe],m))&&(I.length===0||OC(I[0],ae,m))}return l.length===u.length&&l.every((L,Q)=>OC(L,u[Q],m))}return Reflect.ownKeys(l).every(b=>{let T=l[b];return(b in u||hle(I=T)&&I[n6]().matcherType==="optional")&&OC(T,u[b],m);var I})}return Object.is(u,l)},"s"),YA=t(l=>{var u,m,b;return Dwe(l)?hle(l)?(u=(m=(b=l[n6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?IW(l,YA):IW(Object.values(l),YA):[]},"o"),IW=t((l,u)=>l.reduce((m,b)=>m.concat(u(b)),[]),"c");function pS(l){return Object.assign(l,{optional:t(()=>VVt(l),"optional"),and:t(u=>Zp(l,u),"and"),or:t(u=>UVt(l,u),"or"),select:t(u=>u===void 0?Nrt(l):Nrt(u,l),"select")})}t(pS,"u");function VVt(l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return u===void 0?(YA(l).forEach(T=>b(T,void 0)),{matched:!0,selections:m}):{matched:OC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>YA(l),"getSelectionKeys"),matcherType:"optional"})})}t(VVt,"h");function Zp(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return{matched:l.every(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function UVt(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return IW(l,YA).forEach(T=>b(T,void 0)),{matched:l.some(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"or"})})}t(UVt,"d");function Df(l){return{[n6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Df,"p");function Nrt(...l){let u=typeof l[0]=="string"?l[0]:void 0,m=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return pS({[n6]:()=>({match:t(b=>{let T={[u??gle]:b};return{matched:m===void 0||OC(m,b,(I,L)=>{T[I]=L}),selections:T}},"match"),getSelectionKeys:t(()=>[u??gle].concat(m===void 0?[]:YA(m)),"getSelectionKeys")})})}t(Nrt,"y");function IC(l){return typeof l=="number"}t(IC,"v");function GA(l){return typeof l=="string"}t(GA,"b");function QA(l){return typeof l=="bigint"}t(QA,"w");var Pnr=pS(Df(function(l){return!0}));var ZA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&!!b.match(m)))));var m},"regex")}),"j"),wnr=ZA(Df(GA)),NC=t(l=>Object.assign(pS(l),{between:t((u,m)=>NC(Zp(l,((b,T)=>Df(I=>IC(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<m))(u))),"lt"),gt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>m))(u))),"gt"),lte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<=m))(u))),"lte"),gte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>=m))(u))),"gte"),int:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>NC(Zp(l,Df(u=>IC(u)&&u>0))),"positive"),negative:t(()=>NC(Zp(l,Df(u=>IC(u)&&u<0))),"negative")}),"x"),Anr=NC(Df(IC)),XA=t(l=>Object.assign(pS(l),{between:t((u,m)=>XA(Zp(l,((b,T)=>Df(I=>QA(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<m))(u))),"lt"),gt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>m))(u))),"gt"),lte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<=m))(u))),"lte"),gte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>=m))(u))),"gte"),positive:t(()=>XA(Zp(l,Df(u=>QA(u)&&u>0))),"positive"),negative:t(()=>XA(Zp(l,Df(u=>QA(u)&&u<0))),"negative")}),"A"),Dnr=XA(Df(QA)),Inr=pS(Df(function(l){return typeof l=="boolean"})),Nnr=pS(Df(function(l){return typeof l=="symbol"})),Onr=pS(Df(function(l){return l==null})),Fnr=pS(Df(function(l){return l!=null}));var Fwe=class Fwe extends Error{constructor(u){let m;try{m=JSON.stringify(u)}catch{m=u}super(`Pattern matching error: no pattern matches value ${m}`),this.input=void 0,this.input=u}};t(Fwe,"W");var Iwe=Fwe,Nwe={matched:!1,value:void 0};function Xy(l){return new Owe(l,Nwe)}t(Xy,"z");var DW=class DW{constructor(u,m){this.input=void 0,this.state=void 0,this.input=u,this.state=m}with(...u){if(this.state.matched)return this;let m=u[u.length-1],b=[u[0]],T;u.length===3&&typeof u[1]=="function"?T=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Q=t((ee,pe)=>{I=!0,L[ee]=pe},"a"),ae=!b.some(ee=>OC(ee,this.input,Q))||T&&!T(this.input)?Nwe:{matched:!0,value:m(I?gle in L?L[gle]:L:this.input,this.input)};return new DW(this.input,ae)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new DW(this.input,b?{matched:!0,value:m(this.input,this.input)}:Nwe)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Iwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(DW,"I");var Owe=DW;function gf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(gf,"isReferenceObject");function iy(l){return!gf(l)}t(iy,"isSchemaObject");function yle(l){return l.type==="array"}t(yle,"isArraySchemaObject");function Ort(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[u,m]=l.allOf.reduce((T,I)=>{if(WVt(I)){let L=I.required;T[0].push(...L??[])}else T[1].push(I);return T},[[],[]]),b={properties:u.reduce((T,I)=>(T[I]={},T),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((T,I)=>{if(gf(T)){let L=I(T.$ref);L&&b.required.forEach(Q=>{var ae;b.properties[Q]=((ae=L==null?void 0:L.properties)==null?void 0:ae[Q])??{}})}else{let L=T.properties??{};b.required.forEach(Q=>{L[Q]&&(b.properties[Q]=L[Q]??{})})}},"patchRequiredSchemaInLoop")}}t(Ort,"inferRequiredSchema");var WVt=t(l=>!gf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var Mrt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),y8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),aR=t(l=>y8(l).split("/").at(-1),"getSchemaNameByRef");function Rwe(l){let u=HVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ny(u)}t(Rwe,"normalizeString");function Lwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(Lwe,"wrapWithQuotesIfNeeded");function Rrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(Rrt,"unwrapQuotesIfNeeded");function HVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(HVt,"prefixStringStartingWithNumberIfNeeded");function jwe(l){let u=l.replaceAll("_","#");return ny(u.replaceAll("-","_")).replaceAll("#","_")}t(jwe,"pathParamToVariableName");var v8=t(l=>vrt.includes(l),"isPrimitiveType");function Lrt(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(u,m)=>{let b=m.codePointAt(),T=b.toString(16);return b<=255?`\\x${`00${T}`.slice(-2)}`:`\\u${`0000${T}`.slice(-4)}`}).replace(/\//g,"\\/")}t(Lrt,"escapeControlCharacters");function FC(l){return l.includes("application/")&&l.includes("json")||grt.includes(l)||l.includes("text/")}t(FC,"isParamMediaTypeAllowed");function NW(l){return l>=200&&l<300}t(NW,"isMainResponseStatus");function vle(l){return!(l>=200&&l<300)}t(vle,"isErrorStatus");function ble(l){return l.startsWith("application/")}t(ble,"isMediaTypeAllowed");var Frt=/({\w+})/g,GVt=/[^\w\-]+/g;function jrt(l){l=u_(EW(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(Frt)];if(u.length>0){let m=u.sort((b,T)=>b.index-T.index)[u.length-1][0];l=`${l.replace(Frt,"")}By${u_(m.slice(1,-1))}`}return l.replace(GVt,"_")}t(jrt,"pathToVariableName");var Mwe=/{(\b\w+(?:-\w+)*\b)}/g;function Brt(l){let u=l.match(Mwe);return u===null?l.replaceAll(Mwe,":$1"):(u.forEach(m=>{let b=jwe(m.replaceAll(Mwe,":$1"));l=l.replaceAll(m,b)}),l)}t(Brt,"replaceHyphenatedPath");var Sle=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&iy(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),b8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");function MC({schema:l,meta:u,options:m}){let b=[];Xy(l.type).with("string",()=>b.push(XVt(l))).with("number","integer",()=>b.push(KVt(l))).with("array",()=>b.push(eUt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
526
526
  `,"\r",`\r
527
527
  `].some(I=>String.prototype.includes.call(l.description,I))?b.push(`describe(\`${l.description}\`)`):b.push(`describe("${l.description}")`));let T=b.concat(QVt({schema:l,meta:u,options:m}),m.withDefaultValues!==!1?ZVt(l):[]).filter(Boolean).join(".");return T?`.${T}`:""}t(MC,"getZodChain");function QVt({schema:l,meta:u,options:m}){return l.nullable&&!(u!=null&&u.isRequired)?"nullish()":l.nullable||m.replaceOptionalWithNullish&&(u!=null&&u.isParentPartial)?"nullable()":u!=null&&u.isRequired?"":m.replaceOptionalWithNullish?"nullish()":"optional()"}t(QVt,"getZodChainablePresence");function ZVt(l){return l.default!==void 0?`default(${Xy(l.type).with("number","integer",()=>Rrt(l.default)).otherwise(()=>JSON.stringify(l.default))})`:""}t(ZVt,"getZodChainableDefault");function XVt(l){let u=[];return l.enum||(l.minLength!==void 0&&u.push(`min(${l.minLength})`),l.maxLength!==void 0&&u.push(`max(${l.maxLength})`)),l.pattern&&u.push(`regex(${YVt(l.pattern)})`),u.join(".")}t(XVt,"getZodChainableStringValidations");function YVt(l){return l.startsWith("/")&&l.endsWith("/")&&(l=l.slice(1,-1)),l=Lrt(l),`/${l}/`}t(YVt,"formatPatternIfNeeded");function KVt(l){let u=[];return l.enum?"":(l.minimum!==void 0?l.exclusiveMinimum===!0?u.push(`gt(${l.minimum})`):u.push(`gte(${l.minimum})`):typeof l.exclusiveMinimum=="number"&&u.push(`gt(${l.exclusiveMinimum})`),l.maximum!==void 0?l.exclusiveMaximum===!0?u.push(`lt(${l.maximum})`):u.push(`lte(${l.maximum})`):typeof l.exclusiveMaximum=="number"&&u.push(`lt(${l.exclusiveMaximum})`),l.multipleOf&&u.push(`multipleOf(${l.multipleOf})`),u.join("."))}t(KVt,"getZodChainableNumberValidations");function eUt(l){let u=[];return l.minItems&&u.push(`min(${l.minItems})`),l.maxItems&&u.push(`max(${l.maxItems})`),u.join(".")}t(eUt,"getZodChainableArrayValidations");var C_=t(({type:l,tag:u,options:m})=>`${u_(u)}${m.configs[l].namespaceSuffix}`,"getNamespaceName");var S8=t(l=>l.reduce((u,m)=>u+m,0),"sum");function hg(l,u){if(!u)return l;if(gf(u))return l+2;if(Array.isArray(u.type))return u.type.length===1?Db("oneOf")+hg(l,{...u,type:u.type[0]}):l+Db("oneOf")+S8(u.type.map(m=>hg(0,{...u,type:m})));if(u.oneOf)return u.oneOf.length===1?Db("oneOf")+hg(l,u.oneOf[0]):l+Db("oneOf")+S8(u.oneOf.map(m=>hg(0,m)));if(u.anyOf)return u.anyOf.length===1?Db("anyOf")+hg(l,u.anyOf[0]):l+Db("anyOf")+S8(u.anyOf.map(m=>hg(0,m)));if(u.allOf)return u.allOf.length===1?Db("allOf")+hg(l,u.allOf[0]):l+Db("allOf")+S8(u.allOf.map(m=>hg(0,m)));if(!u.type)return l;if(v8(u.type))return u.enum?l+$rt(u)+Db("enum")+S8(u.enum.map(m=>hg(0,m))):l+$rt(u);if(u.type==="array")return u.items?Db("array")+hg(l,u.items):Db("array")+hg(l);if(u.type==="object"||u.properties||u.additionalProperties){if(u.properties){let m=Object.values(u.properties);l+=Db("object")+S8(m.map(b=>hg(0,b)))}else l+=Db("empty-object");u.additionalProperties&&(typeof u.additionalProperties=="object"?l+=hg(0,u.additionalProperties):l+=hg(1))}return l}t(hg,"getOpenAPISchemaComplexity");function $rt(l){return Xy(l.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}t($rt,"complexityByType");function Db(l){return Xy(l).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}t(Db,"complexityByComposite");var $we=class $we{constructor(u,m,b={referencedBy:[]},T){this.schema=u;this.resolver=m;gf(u)&&(this.ref=u.$ref),T&&(this.enumRef=T),this.meta={...b,referencedBy:[...(b==null?void 0:b.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(u,m){var I,L;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let b=(I=this.resolver)==null?void 0:I.getZodSchemaNameByRef(this.ref);if(!b)return this.ref;let T=(L=this.resolver)==null?void 0:L.getTagByZodSchemaName(b);return m!=null&&m.tsNamespaces&&T&&T!==u?`${C_({type:"models",tag:T,options:m})}.${b}`:b}get complexity(){return hg(0,this.schema)}assign(u){return this.code=u,this}inherit(u){return u&&u.children.push(this),this}};t($we,"ZodSchema");var OW=$we;function Bwe(l){var u,m;if(l)return(u=l.parent)!=null&&u.ref?l.parent.ref:Bwe((m=l.parent)==null?void 0:m.meta)}t(Bwe,"getParentRef");function Jrt(l,u){let m=l.getRefByZodSchemaName(u);if(m){let T=Array.from(l.dependencyGraph.refsDependencyGraph[m]??[]).map(L=>l.getZodSchemaNameByRef(L)),I=l.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(m);return[...T,...I]}let b=l.getCompositeZodSchemaByZodSchemaName(u);return b?Array.from(xle(b)).map(T=>l.getZodSchemaNameByRef(T)):[]}t(Jrt,"getZodSchemaRefs");function xle(l,{skipObjectSchema:u=!1}={}){return l.children.reduce((b,T)=>{let I=T.ref??T.enumRef;return I&&b.add(I),T.children.length>0&&(!u||!iy(T.schema)||T.schema.type!=="object")&&xle(T).forEach(L=>b.add(L)),b},new Set)}t(xle,"getSchemaRefs");function Hd({schema:l,resolver:u,meta:m,tag:b}){var rr;let T=new OW(l,u,m),I={parent:T.inherit(m==null?void 0:m.parent),referencedBy:[...T.meta.referencedBy]},L={resolver:u,meta:I,tag:b};if(gf(l))return tUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});let Q=nUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(Q)return Q;let ae=rUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(ae)return ae;let ee=iUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(ee)return ee;let pe=sUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(pe)return pe;let Te=aUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(Te)return Te;let Ke=u.options.allReadonly?".readonly()":"";if(yle(l))return l.items?T.assign(`z.array(${Hd({...L,schema:l.items}).getCodeString(b,u.options)}${MC({schema:l.items,meta:{...I,isRequired:!0},options:u.options})})${Ke}`):T.assign(`z.array(${sR})${Ke}`);let Pt=l.type?l.type.toLowerCase():void 0;if(Pt==="object"||l.properties||l.additionalProperties){let or=l.required&&l.required.length>0,Lt=u.options.withImplicitRequiredProps?!1:l.properties&&!((rr=l.required)!=null&&rr.length),Xt="{}";l.properties&&(Xt=`{ ${Object.entries(l.properties).map(([vo,Vn])=>{var Ht;let ql={...I,isRequired:Lt?!0:or?(Ht=l.required)==null?void 0:Ht.includes(vo):u.options.withImplicitRequiredProps,name:vo,isParentPartial:Lt},zl=Vn;if(gf(Vn)&&u&&(zl=u.getSchemaByRef(Vn.$ref),!zl))throw new Error(`Schema ${Vn.$ref} not found`);let ia=Hd({...L,schema:Vn,meta:ql}),lr=ia.getCodeString(b,u.options)+MC({schema:zl,meta:ql,options:u.options}),xs=!1,Fs=Bwe(m);return Fs&&(xs=[...gf(Vn)?[Vn.$ref]:[],...xle(ia,{skipObjectSchema:!0})].some(wa=>{var Eo;return(Eo=u.dependencyGraph.deepDependencyGraph[wa])==null?void 0:Eo.has(Fs)})),[vo,lr,xs]}).map(([vo,Vn,ql])=>ql?`get ${Lwe(vo)}() { return ${Vn} }`:`${Lwe(vo)}: ${Vn}`).join(", ")} }`);let Vt="";l.additionalProperties&&(Vt=`.catchall(${typeof l.additionalProperties=="object"&&Object.keys(l.additionalProperties).length>0?Hd({...L,schema:l.additionalProperties}).getCodeString(b,u.options)+MC({schema:l.additionalProperties,meta:{...I,isRequired:!0},options:u.options}):sR})`);let zn=`z.object(${Xt})${Lt?".partial()":""}${Vt}${Ke}`;return T.assign(zn)}if(Pt==="any")return T.assign(sR);if(!Pt)return T.assign("z.unknown()");throw new Error(`Unsupported schema type: ${Pt}`)}t(Hd,"getZodSchema");function tUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!gf(l))return;let I=u.meta.referencedBy.slice(0,-1).map(ae=>ae.ref?m.getZodSchemaNameByRef(ae.ref)??ae.ref:void 0).filter(Boolean),L=m.getZodSchemaNameByRef(l.$ref);if(I.length>1&&I.includes(L))return u.assign(m.getCodeByZodSchemaName(u.ref));let Q=m.getCodeByZodSchemaName(l.$ref);if(!Q){let ae=m.getSchemaByRef(l.$ref);if(!ae)throw new Error(`Schema ${l.$ref} not found`);Q=Hd({schema:ae,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)}return m.getCodeByZodSchemaName(L)||m.setZodSchema(L,Q,T),u}t(tUt,"getReferenceZodSchema");function rUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){var L;if(!iy(l)||!l.oneOf)return;if(l.oneOf.length===1){let Q=Hd({schema:l.oneOf[0],resolver:m,meta:b,tag:T});return u.assign(Q.getCodeString(T,m.options))}let I=(L=l.oneOf)==null?void 0:L.some(Q=>iy(Q)&&((Q==null?void 0:Q.allOf)||[]).length>1);if(l.discriminator&&!I){let Q=l.discriminator.propertyName;return u.assign(`
528
528
  z.discriminatedUnion("${Q}", [${l.oneOf.map(ae=>Hd({schema:ae,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
@@ -17,12 +17,12 @@ export const {{queryName endpoint mutation=true}} = (options?: AppMutationOption
17
17
  let dataToSend: File | FormData = file;
18
18
  if (method === "post") {
19
19
  dataToSend = new FormData();
20
- dataToSend.append('file', file);
21
20
  if (uploadInstructions.fields) {
22
21
  for (const [key, value] of uploadInstructions.fields) {
23
22
  dataToSend.append(key, value);
24
23
  }
25
24
  }
25
+ dataToSend.append('file', file);
26
26
  }
27
27
  await axios[method](uploadInstructions.url, dataToSend, {
28
28
  headers: {