@povio/openapi-codegen-cli 0.14.3 → 0.14.4

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
@@ -137,7 +137,7 @@ ${y.join(`
137
137
  `:`
138
138
  `)+r,i=n+1,n=e.indexOf(`
139
139
  `,i)}while(n!==-1);return s+=e.slice(i),s}o(Pb,"stringEncaseCRLFWithFirstIndex");var{stdout:xb,stderr:$b}=Ob,Uf=Symbol("GENERATOR"),_o=Symbol("STYLER"),ks=Symbol("IS_EMPTY"),wb=["ansi","ansi","ansi256","ansi16m"],So=Object.create(null),ow=o((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=xb?xb.level:0;e.level=t.level===void 0?r:t.level},"applyOptions"),Zf=class Zf{constructor(t){return Ab(t)}};o(Zf,"Chalk");var Fc=Zf,Ab=o(e=>{let t=o((...r)=>r.join(" "),"chalk");return ow(t,e),Object.setPrototypeOf(t,qs.prototype),t},"chalkFactory");function qs(e){return Ab(e)}o(qs,"createChalk");Object.setPrototypeOf(qs.prototype,Function.prototype);for(let[e,t]of Object.entries(xr))So[e]={get(){let r=Hc(this,zf(t.open,t.close,this[_o]),this[ks]);return Object.defineProperty(this,e,{value:r}),r}};So.visible={get(){let e=Hc(this,this[_o],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Gf=o((e,t,r,...n)=>e==="rgb"?t==="ansi16m"?xr[r].ansi16m(...n):t==="ansi256"?xr[r].ansi256(xr.rgbToAnsi256(...n)):xr[r].ansi(xr.rgbToAnsi(...n)):e==="hex"?Gf("rgb",t,r,...xr.hexToRgb(...n)):xr[r][e](...n),"getModelAnsi"),sw=["rgb","hex","ansi256"];for(let e of sw){So[e]={get(){let{level:r}=this;return function(...n){let i=zf(Gf(e,wb[r],"color",...n),xr.color.close,this[_o]);return Hc(this,i,this[ks])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);So[t]={get(){let{level:r}=this;return function(...n){let i=zf(Gf(e,wb[r],"bgColor",...n),xr.bgColor.close,this[_o]);return Hc(this,i,this[ks])}}}}var aw=Object.defineProperties(()=>{},{...So,level:{enumerable:!0,get(){return this[Uf].level},set(e){this[Uf].level=e}}}),zf=o((e,t,r)=>{let n,i;return r===void 0?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},"createStyler"),Hc=o((e,t,r)=>{let n=o((...i)=>cw(n,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(n,aw),n[Uf]=e,n[_o]=t,n[ks]=r,n},"createBuilder"),cw=o((e,t)=>{if(e.level<=0||!t)return e[ks]?"":t;let r=e[_o];if(r===void 0)return t;let{openAll:n,closeAll:i}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=Eb(t,r.close,r.open),r=r.parent;let s=t.indexOf(`
140
- `);return s!==-1&&(t=Pb(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(qs.prototype,So);var f6=qs(),p6=qs({level:$b?$b.level:0});var Vr=new Fc;function Ds(e,t,r){console.log(r!==void 0&&r!==t?`${Vr.yellow(`${e}:`.padEnd(20))}${Vr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(Ds,"logVariable");function pr(e){console.log(`[INFO] ${e}`)}o(pr,"logInfo");function Nn(e){console.log(Vr.green(`[SUCCESS] ${e}`))}o(Nn,"logSuccess");function Ls(e,t){e instanceof Error?(console.log(Vr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Vr.red(`[ERROR] ${e}`))}o(Ls,"logError");function Bc(e){console.log(Vr.bgYellow(`==== ${e} ====`))}o(Bc,"logBanner");var Ib=yt(require("fs"));function Oo(){return"0.14.3"}o(Oo,"getVersion");var x6=yt(Tb());var Wf=Symbol("options_key");function Oe(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(Wf,t)||{},[r]:{...e,describe:e.envAlias?`${e.describe||""} [${e.envAlias}]`:e.describe,type:e.type||((i=(n=Reflect.getMetadata("design:type",t,r))==null?void 0:n.name)==null?void 0:i.toLowerCase())}};Reflect.defineMetadata(Wf,s,t)}}}o(Oe,"YargOption");function Rb(e){let t=Reflect.getMetadata(Wf,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Rb,"getYargsOption");function Vc(e){return async t=>t.options(uw(e)).middleware(async r=>await lw(e,r),!0)}o(Vc,"getBuilder");function uw(e){return Object.entries(Rb(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(uw,"getYargsOptions");async function lw(e,t){let r=new e;for(let[n,i]of Object.entries(Rb(e)))r[n]=t[n]??i.default;return r}o(lw,"loadYargsConfig");var Hx=yt(Dm());var aP={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"},cP={"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 qr={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},uP={bindings:[qr.query,qr.infiniteQuery,qr.mutation],from:"@tanstack/react-query"},Ca={pageParamName:"page"},Ku={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},Ta="moduleName";var Lm={"Content-Type":"application/json",Accept:"application/json"},Yu="data",Fm="axios",Yn="config",en="AxiosRequestConfig",Qu={defaultImport:Fm,bindings:[en],from:"axios"};var lP=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Qn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function we(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(we,"isReferenceObject");function ot(e){return!we(e)}o(ot,"isSchemaObject");function Ju(e){return e.type==="array"}o(Ju,"isArraySchemaObject");function fP(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(oD(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(we(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(fP,"inferRequiredSchema");var oD=o(e=>!we(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var _n=Symbol.for("@ts-pattern/matcher"),sD=Symbol.for("@ts-pattern/isVariadic"),el="@ts-pattern/anonymous-select-key",Hm=o(e=>!!(e&&typeof e=="object"),"r"),Xu=o(e=>e&&!!e[_n],"i"),nn=o((e,t,r)=>{if(Xu(e)){let n=e[_n](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(Hm(e)){if(!Hm(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];Xu(c)&&c[sD]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,p)=>nn(l,a[p],r))&&i.every((l,p)=>nn(l,c[p],r))&&(s.length===0||nn(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>nn(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||Xu(s=i)&&s[_n]().matcherType==="optional")&&nn(i,t[n],r);var s})}return Object.is(t,e)},"s"),ri=o(e=>{var t,r,n;return Hm(e)?Xu(e)?(t=(r=(n=e[_n]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Na(e,ri):Na(Object.values(e),ri):[]},"o"),Na=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function br(e){return Object.assign(e,{optional:o(()=>aD(e),"optional"),and:o(t=>ze(e,t),"and"),or:o(t=>cD(e,t),"or"),select:o(t=>t===void 0?pP(e):pP(t,e),"select")})}o(br,"u");function aD(e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(ri(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:nn(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>ri(e),"getSelectionKeys"),matcherType:"optional"})})}o(aD,"h");function ze(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"and"})})}o(ze,"m");function cD(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return Na(e,ri).forEach(i=>n(i,void 0)),{matched:e.some(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"or"})})}o(cD,"d");function xe(e){return{[_n]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(xe,"p");function pP(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return br({[_n]:()=>({match:o(n=>{let i={[t??el]:n};return{matched:r===void 0||nn(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??el].concat(r===void 0?[]:ri(r)),"getSelectionKeys")})})}o(pP,"y");function tn(e){return typeof e=="number"}o(tn,"v");function Jn(e){return typeof e=="string"}o(Jn,"b");function Xn(e){return typeof e=="bigint"}o(Xn,"w");var VU=br(xe(function(e){return!0}));var ei=o(e=>Object.assign(br(e),{startsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&!!n.match(r)))));var r},"regex")}),"j"),UU=ei(xe(Jn)),rn=o(e=>Object.assign(br(e),{between:o((t,r)=>rn(ze(e,((n,i)=>xe(s=>tn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<r))(t))),"lt"),gt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>r))(t))),"gt"),lte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<=r))(t))),"lte"),gte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>=r))(t))),"gte"),int:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isInteger(t)))),"int"),finite:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>rn(ze(e,xe(t=>tn(t)&&t>0))),"positive"),negative:o(()=>rn(ze(e,xe(t=>tn(t)&&t<0))),"negative")}),"x"),GU=rn(xe(tn)),ti=o(e=>Object.assign(br(e),{between:o((t,r)=>ti(ze(e,((n,i)=>xe(s=>Xn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<r))(t))),"lt"),gt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>r))(t))),"gt"),lte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<=r))(t))),"lte"),gte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>=r))(t))),"gte"),positive:o(()=>ti(ze(e,xe(t=>Xn(t)&&t>0))),"positive"),negative:o(()=>ti(ze(e,xe(t=>Xn(t)&&t<0))),"negative")}),"A"),zU=ti(xe(Xn)),ZU=br(xe(function(e){return typeof e=="boolean"})),WU=br(xe(function(e){return typeof e=="symbol"})),KU=br(xe(function(e){return e==null})),YU=br(xe(function(e){return e!=null}));var Gm=class Gm extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(Gm,"W");var Bm=Gm,Vm={matched:!1,value:void 0};function At(e){return new Um(e,Vm)}o(At,"z");var Ra=class Ra{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,p)=>{s=!0,a[l]=p},"a"),u=!n.some(l=>nn(l,this.input,c))||i&&!i(this.input)?Vm:{matched:!0,value:r(s?el in a?a[el]:a:this.input,this.input)};return new Ra(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Ra(this.input,n?{matched:!0,value:r(this.input,this.input)}:Vm)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Bm(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Ra,"I");var Um=Ra;var zm=2,dP=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],hP=["query","header","path"],Wi=["get","put","post","delete","options","head","patch","trace"],mP=["string","number","integer","boolean"],ja=["allOf","anyOf","oneOf"];var Te=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),ni=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),gP=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ht=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),yP=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Zm=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),bP=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),uD=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),Wm=o(e=>{let t=e.map(Te).map(vP).map(r=>lD(r)).flat();return uD(t)},"getMostCommonAdjacentCombinationSplit"),vP=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),_P=o(e=>vP(e).join(" "),"camelToSpaceSeparated"),lD=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations"),SP=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${ni(r)}|${Te(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var EP=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Ki=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),as=o(e=>Ki(e).split("/").at(-1),"getSchemaNameByRef");function Ym(e){let t=fD(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ht(t)}o(Ym,"normalizeString");function PP(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(PP,"wrapWithQuotesIfNeeded");function xP(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(xP,"unwrapQuotesIfNeeded");function fD(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(fD,"prefixStringStartingWithNumberIfNeeded");function Qm(e){let t=e.replaceAll("_","#");return ht(t.replaceAll("-","_")).replaceAll("#","_")}o(Qm,"pathParamToVariableName");var on=o(e=>mP.includes(e),"isPrimitiveType");function $P(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o($P,"escapeControlCharacters");function sn(e){return e.includes("application/")&&e.includes("json")||dP.includes(e)||e.includes("text/")}o(sn,"isParamMediaTypeAllowed");function Ma(e){return e>=200&&e<300}o(Ma,"isMainResponseStatus");function tl(e){return!(e>=200&&e<300)}o(tl,"isErrorStatus");function rl(e){return e.startsWith("application/")}o(rl,"isMediaTypeAllowed");var OP=/({\w+})/g,pD=/[^\w\-]+/g;function wP(e){e=Te(gP(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(OP)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(OP,"")}By${Te(r.slice(1,-1))}`}return e.replace(pD,"_")}o(wP,"pathToVariableName");var Km=/{(\b\w+(?:-\w+)*\b)}/g;function AP(e){let t=e.match(Km);return t===null?e.replaceAll(Km,":$1"):(t.forEach(r=>{let n=Qm(r.replaceAll(Km,":$1"));e=e.replaceAll(r,n)}),e)}o(AP,"replaceHyphenatedPath");var IP=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&ot(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),Yi=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");var Xt=o(e=>e.method==="get","isQuery"),oi=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),cs=o((e,t)=>Xt(e)&&(t??Object.values(Ca)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),CP=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...ii(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return ii(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");function si(e){return yP(e)}o(si,"formatTag");function ai(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return si(r??t.defaultTag)}o(ai,"getOperationTag");function TP(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(TP,"isTagExcluded");var nl={fileName:"acl/app.ability",extension:"ts"},ka="AllAbilities",qa="AppAbilities",il={fileName:"acl/useAclCheck",extension:"ts"},ci="useAclCheck",It={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},Jm={bindings:[It.abilityTuple,It.pureAbility,It.forcedSubject,It.subjectType,It.subject],from:"@casl/ability"};var er=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var RP=o(e=>`Use${Te(ht(e.operationName))}Ability`,"getAbilityTypeName"),Da=o(e=>`canUse${Te(ht(e.operationName))}`,"getAbilityFunctionName"),NP=o((e,t)=>`${t.tsNamespaces?`${Be({type:"acl",tag:ui(e,t),options:t})}.`:""}${Da(e)}`,"getImportedAbilityFunctionName"),jP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),MP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),ol=o(e=>{var t;return!!((t=La(e))!=null&&t.length)},"hasAbilityConditions"),La=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),kP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),sl=o(e=>`${Te(e)}${ka}`,"getTagAllAbilitiesName");function _t(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(we(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ja.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&_t(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&_t(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;_t(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;_t(s,t)}}o(_t,"iterateSchema");var an=o((e,t)=>Zm(Te(Ym(e)),t),"getZodSchemaName"),Fa=o((e,t,r)=>Zm(Te(Ym(e)),`${t}${r}`),"getEnumZodSchemaName"),Ct=o(e=>["z.",`${pt.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),qP=o(e=>e.startsWith(Ms),"isEnumZodSchema"),Qi=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),al=o(e=>ht(`${e}_${db}`),"getBodyZodSchemaName"),DP=o((e,t)=>ht(`${e}_${t}${hb}`),"getParamZodSchemaName"),dD=o(e=>ht(`${e}${mb}`),"getMainResponseZodSchemaName"),hD=o((e,t)=>ht(`${e}_${t}_${gb}`),"getErrorResponseZodSchemaName");function cl({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Qi(t,r,n);return!Ma(i)&&e!=="default"&&tl(i)?hD(s,e):dD(s)}o(cl,"getResponseZodSchemaName");function Ha(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Te(_P(i))}: \`${e[i]}\``],[])}o(Ha,"getSchemaDescriptions");var Ba=o((e,t)=>bP(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),LP=o((e,t)=>Ct(t)?`${e.options.tsNamespaces?`${Be({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),Ji=o((e,t,r)=>{if(!Ct(t))return t===js?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${Be({type:"models",tag:n,options:e.options})}.`:""}${Ba(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function FP(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(FP,"getZodSchemaType");function HP(e){if(e.schemaObj)return[e.schemaObj.description,...Ha(e.schemaObj).join(". ")].filter(Boolean)}o(HP,"getZodSchemaDescription");function BP(e,t,r){var n;if(we(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?Ji(e,i,r):void 0}if(Ju(t)){if(!we(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${Ji(e,i,r)}[]`:void 0}if(ja.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return BP(e,i[0],r)}return t.type}o(BP,"getType");function VP(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let p=e.resolveObject(c.schema),f=[p.description,...Ha(p)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:BP(e,c.schema,r)??"unknown",description:f.join(". ")})}return _t(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(we(c)){let u=e.resolveObject(c);_t(u,{data:{pathSegments:[]},onSchema:a})}}),_t(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(VP,"getZodSchemaPropertyDescriptions");function li({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=ul({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=ul({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Ba(u,e.options),"getEntityName"),options:e.options});return mD(e.options,a,c)}o(li,"getModelsImports");function UP({tag:e,endpoints:t,options:r}){return ul({type:"endpoints",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Va,options:r})}o(UP,"getEndpointsImports");function GP({tag:e,endpoints:t,options:r}){return ul({type:"acl",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Da,options:r})}o(GP,"getAclImports");function zP({tags:e,entityName:t,getAliasEntityName:r,type:n,options:i}){let s=new Map;return e.forEach(a=>{let c=`${t}${r?` as ${r(a)}`:""}`;s.has(a)?i.tsNamespaces||s.get(a).bindings.push(c):s.set(a,{bindings:[i.tsNamespaces?Be({type:n,tag:a,options:i}):c],from:`${cn(i)}${ll({type:n,tag:a,includeTagDir:!0,options:i})}`})}),Array.from(s.values())}o(zP,"getEntityImports");function cn(e){let t=Ff;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${Lf}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${Lf}`,"g"),Ff)),`${t}/`.replace(/\/\//g,"/")}o(cn,"getImportPath");function ul({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?Be({type:e,tag:u,options:s}):i(c)],from:`${l?"./":cn(s)}${ll({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(ul,"getImports");function mD(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:er(n.bindings)}))}o(mD,"mergeImports");function Xi({fileName:e,extension:t}){return`${e}.${t}`}o(Xi,"getFileNameWithExtension");function ZP({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${ni(t)}/`:""}${ni(t)}.${i}`:i}o(ZP,"getTagFileNameWithoutExtension");function ll(...e){return ZP(...e)}o(ll,"getTagImportPath");function fl(...e){return`${ZP(...e)}.ts`}o(fl,"getTagFileName");var Be=o(({type:e,tag:t,options:r})=>`${Te(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function WP(e){return e.standalone?`${cn(e)}${Rc.fileName}`:e.restClientImportPath}o(WP,"getAppRestClientImportPath");function KP(e){return e.standalone?`${cn(e)}${Tc.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(KP,"getQueryTypesImportPath");function YP(e){return`${cn(e)}${Nc.fileName}`}o(YP,"getQueryModulesImportPath");function QP(e){return`${cn(e)}${jc.fileName}`}o(QP,"getMutationEffectsImportPath");function JP(e){return`${cn(e)}${il.fileName}`}o(JP,"getAclCheckImportPath");function pl(e){return`${cn(e)}${Mc.fileName}`}o(pl,"getZodUtilsImportPath");function XP(e){return`${cn(e)}${nl.fileName}`}o(XP,"getAppAbilitiesImportPath");function ex(e){return At(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(ex,"primitiveTypeToTsType");var Va=o(e=>ni(ht(e.operationName)),"getEndpointName");function tx(e,t){return`${t.tsNamespaces?`${Be({type:"endpoints",tag:ui(e,t),options:t})}.`:""}${Va(e)}`}o(tx,"getImportedEndpointName");var rx=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ui(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return si(r??t.defaultTag)}o(ui,"getEndpointTag");function ii(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(Ct(i.zodSchema))s=Ji(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&ot(i.parameterObject.schema)){let p=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;p&&on(p)&&(s=ex(p))}return{name:Qn(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==Yu)&&(!(r!=null&&r.excludePageParam)||i.name!==Ca.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===Ca.pageParamName?"pageParam":i.name}))}o(ii,"mapEndpointParamsToFunctionParams");function nx(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=lP(i.name)?i.name:`"${i.name}"`,a=Qn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Lm["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Lm.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Qn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(nx,"getEndpointConfig");function ix(e,t){return t.filter(r=>Xt(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(ix,"getUpdateQueryEndpoints");var Xm=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function eo(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(eo,"pick");function us(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=ai(e,t),i=TP(n,t);return r||i}o(us,"isOperationExcluded");function eg({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${wP(e)}`,u=r.operationId?Qn(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((p,f)=>f===0?p:Te(p)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=SP(u,i);l===""?u=t.toLowerCase():Xm.includes(l)||(u=l)}return Xm.includes(u)?c:u}o(eg,"getOperationName");function Ua({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?ai(r,n):n.defaultTag,s=o(a=>{let c=eg({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>eg({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??eg({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(Ua,"getUniqueOperationName");function ox(e,t,r){let n=[];for(let i in e.paths){if(Yi(i,r))continue;let s=e.paths[i],a=eo(s,Wi);for(let c in a){let u=a[c];if(!u||us(u,r))continue;let l=Ua({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(ox,"getUniqueOperationNamesWithoutSplitByTags");function sx(e,t){let r={};for(let n in e.paths){if(Yi(n,t))continue;let i=e.paths[n],s=eo(i,Wi);for(let a in s){let c=s[a];if(!c||us(c,t))continue;let u=t.splitByTags?ai(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(sx,"getOperationsByTag");function Ga(e){return{type:"invalid-schema",message:e}}o(Ga,"getInvalidSchemaError");function ax(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(ax,"getInvalidOperationIdError");function cx(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(cx,"getMissingPathParameterError");function ux(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(ux,"getNotAllowedInlineEnumError");function lx(e){return{type:"not-allowed-circular-schema",message:e}}o(lx,"getNotAllowedCircularSchemaError");function fx(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${hl(t,r)}`}}o(fx,"getMissingAclConditionPropertyError");function tg(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${dl(e)} in operation ${hl(t,r)}`}}o(tg,"getMissingStatusCodeError");function px(e,t,r){return{type:"invalid-status-code",message:`Operation ${hl(t,r)} expected HTTP status code ${dl(e.expected)} but received ${dl(e.received)}`}}o(px,"getInvalidStatusCodeError");function dx(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${hl(t,r)} has multiple success HTTP status codes: ${e.map(dl).join(", ")}`}}o(dx,"getMultipleSuccessStatusCodesError");function hl(e,t){return e.operationId??`${t.method} ${t.path}`}o(hl,"getOperationDescriptor");function dl(e){return`${e} (${aP[e]})`}o(dl,"getStatusCodeDescription");function hx(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(hx,"groupByType");function un({schema:e,meta:t,options:r}){let n=[];At(e.type).with("string",()=>n.push(bD(e))).with("number","integer",()=>n.push(_D(e))).with("array",()=>n.push(SD(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
140
+ `);return s!==-1&&(t=Pb(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(qs.prototype,So);var f6=qs(),p6=qs({level:$b?$b.level:0});var Vr=new Fc;function Ds(e,t,r){console.log(r!==void 0&&r!==t?`${Vr.yellow(`${e}:`.padEnd(20))}${Vr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(Ds,"logVariable");function pr(e){console.log(`[INFO] ${e}`)}o(pr,"logInfo");function Nn(e){console.log(Vr.green(`[SUCCESS] ${e}`))}o(Nn,"logSuccess");function Ls(e,t){e instanceof Error?(console.log(Vr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Vr.red(`[ERROR] ${e}`))}o(Ls,"logError");function Bc(e){console.log(Vr.bgYellow(`==== ${e} ====`))}o(Bc,"logBanner");var Ib=yt(require("fs"));function Oo(){return"0.14.4"}o(Oo,"getVersion");var x6=yt(Tb());var Wf=Symbol("options_key");function Oe(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(Wf,t)||{},[r]:{...e,describe:e.envAlias?`${e.describe||""} [${e.envAlias}]`:e.describe,type:e.type||((i=(n=Reflect.getMetadata("design:type",t,r))==null?void 0:n.name)==null?void 0:i.toLowerCase())}};Reflect.defineMetadata(Wf,s,t)}}}o(Oe,"YargOption");function Rb(e){let t=Reflect.getMetadata(Wf,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Rb,"getYargsOption");function Vc(e){return async t=>t.options(uw(e)).middleware(async r=>await lw(e,r),!0)}o(Vc,"getBuilder");function uw(e){return Object.entries(Rb(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(uw,"getYargsOptions");async function lw(e,t){let r=new e;for(let[n,i]of Object.entries(Rb(e)))r[n]=t[n]??i.default;return r}o(lw,"loadYargsConfig");var Hx=yt(Dm());var aP={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"},cP={"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 qr={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},uP={bindings:[qr.query,qr.infiniteQuery,qr.mutation],from:"@tanstack/react-query"},Ca={pageParamName:"page"},Ku={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},Ta="moduleName";var Lm={"Content-Type":"application/json",Accept:"application/json"},Yu="data",Fm="axios",Yn="config",en="AxiosRequestConfig",Qu={defaultImport:Fm,bindings:[en],from:"axios"};var lP=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Qn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function we(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(we,"isReferenceObject");function ot(e){return!we(e)}o(ot,"isSchemaObject");function Ju(e){return e.type==="array"}o(Ju,"isArraySchemaObject");function fP(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(oD(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(we(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(fP,"inferRequiredSchema");var oD=o(e=>!we(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var _n=Symbol.for("@ts-pattern/matcher"),sD=Symbol.for("@ts-pattern/isVariadic"),el="@ts-pattern/anonymous-select-key",Hm=o(e=>!!(e&&typeof e=="object"),"r"),Xu=o(e=>e&&!!e[_n],"i"),nn=o((e,t,r)=>{if(Xu(e)){let n=e[_n](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(Hm(e)){if(!Hm(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];Xu(c)&&c[sD]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,p)=>nn(l,a[p],r))&&i.every((l,p)=>nn(l,c[p],r))&&(s.length===0||nn(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>nn(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||Xu(s=i)&&s[_n]().matcherType==="optional")&&nn(i,t[n],r);var s})}return Object.is(t,e)},"s"),ri=o(e=>{var t,r,n;return Hm(e)?Xu(e)?(t=(r=(n=e[_n]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Na(e,ri):Na(Object.values(e),ri):[]},"o"),Na=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function br(e){return Object.assign(e,{optional:o(()=>aD(e),"optional"),and:o(t=>ze(e,t),"and"),or:o(t=>cD(e,t),"or"),select:o(t=>t===void 0?pP(e):pP(t,e),"select")})}o(br,"u");function aD(e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(ri(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:nn(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>ri(e),"getSelectionKeys"),matcherType:"optional"})})}o(aD,"h");function ze(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"and"})})}o(ze,"m");function cD(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return Na(e,ri).forEach(i=>n(i,void 0)),{matched:e.some(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"or"})})}o(cD,"d");function xe(e){return{[_n]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(xe,"p");function pP(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return br({[_n]:()=>({match:o(n=>{let i={[t??el]:n};return{matched:r===void 0||nn(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??el].concat(r===void 0?[]:ri(r)),"getSelectionKeys")})})}o(pP,"y");function tn(e){return typeof e=="number"}o(tn,"v");function Jn(e){return typeof e=="string"}o(Jn,"b");function Xn(e){return typeof e=="bigint"}o(Xn,"w");var VU=br(xe(function(e){return!0}));var ei=o(e=>Object.assign(br(e),{startsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&!!n.match(r)))));var r},"regex")}),"j"),UU=ei(xe(Jn)),rn=o(e=>Object.assign(br(e),{between:o((t,r)=>rn(ze(e,((n,i)=>xe(s=>tn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<r))(t))),"lt"),gt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>r))(t))),"gt"),lte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<=r))(t))),"lte"),gte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>=r))(t))),"gte"),int:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isInteger(t)))),"int"),finite:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>rn(ze(e,xe(t=>tn(t)&&t>0))),"positive"),negative:o(()=>rn(ze(e,xe(t=>tn(t)&&t<0))),"negative")}),"x"),GU=rn(xe(tn)),ti=o(e=>Object.assign(br(e),{between:o((t,r)=>ti(ze(e,((n,i)=>xe(s=>Xn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<r))(t))),"lt"),gt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>r))(t))),"gt"),lte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<=r))(t))),"lte"),gte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>=r))(t))),"gte"),positive:o(()=>ti(ze(e,xe(t=>Xn(t)&&t>0))),"positive"),negative:o(()=>ti(ze(e,xe(t=>Xn(t)&&t<0))),"negative")}),"A"),zU=ti(xe(Xn)),ZU=br(xe(function(e){return typeof e=="boolean"})),WU=br(xe(function(e){return typeof e=="symbol"})),KU=br(xe(function(e){return e==null})),YU=br(xe(function(e){return e!=null}));var Gm=class Gm extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(Gm,"W");var Bm=Gm,Vm={matched:!1,value:void 0};function At(e){return new Um(e,Vm)}o(At,"z");var Ra=class Ra{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,p)=>{s=!0,a[l]=p},"a"),u=!n.some(l=>nn(l,this.input,c))||i&&!i(this.input)?Vm:{matched:!0,value:r(s?el in a?a[el]:a:this.input,this.input)};return new Ra(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Ra(this.input,n?{matched:!0,value:r(this.input,this.input)}:Vm)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Bm(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Ra,"I");var Um=Ra;var zm=2,dP=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],hP=["query","header","path"],Wi=["get","put","post","delete","options","head","patch","trace"],mP=["string","number","integer","boolean"],ja=["allOf","anyOf","oneOf"];var Te=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),ni=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),gP=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ht=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),yP=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Zm=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),bP=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),uD=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),Wm=o(e=>{let t=e.map(Te).map(vP).map(r=>lD(r)).flat();return uD(t)},"getMostCommonAdjacentCombinationSplit"),vP=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),_P=o(e=>vP(e).join(" "),"camelToSpaceSeparated"),lD=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations"),SP=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${ni(r)}|${Te(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var EP=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Ki=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),as=o(e=>Ki(e).split("/").at(-1),"getSchemaNameByRef");function Ym(e){let t=fD(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ht(t)}o(Ym,"normalizeString");function PP(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(PP,"wrapWithQuotesIfNeeded");function xP(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(xP,"unwrapQuotesIfNeeded");function fD(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(fD,"prefixStringStartingWithNumberIfNeeded");function Qm(e){let t=e.replaceAll("_","#");return ht(t.replaceAll("-","_")).replaceAll("#","_")}o(Qm,"pathParamToVariableName");var on=o(e=>mP.includes(e),"isPrimitiveType");function $P(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o($P,"escapeControlCharacters");function sn(e){return e.includes("application/")&&e.includes("json")||dP.includes(e)||e.includes("text/")}o(sn,"isParamMediaTypeAllowed");function Ma(e){return e>=200&&e<300}o(Ma,"isMainResponseStatus");function tl(e){return!(e>=200&&e<300)}o(tl,"isErrorStatus");function rl(e){return e.startsWith("application/")}o(rl,"isMediaTypeAllowed");var OP=/({\w+})/g,pD=/[^\w\-]+/g;function wP(e){e=Te(gP(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(OP)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(OP,"")}By${Te(r.slice(1,-1))}`}return e.replace(pD,"_")}o(wP,"pathToVariableName");var Km=/{(\b\w+(?:-\w+)*\b)}/g;function AP(e){let t=e.match(Km);return t===null?e.replaceAll(Km,":$1"):(t.forEach(r=>{let n=Qm(r.replaceAll(Km,":$1"));e=e.replaceAll(r,n)}),e)}o(AP,"replaceHyphenatedPath");var IP=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&ot(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),Yi=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");var Xt=o(e=>e.method==="get","isQuery"),oi=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),cs=o((e,t)=>Xt(e)&&(t??Object.values(Ca)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),CP=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...ii(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return ii(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");function si(e){return yP(e)}o(si,"formatTag");function ai(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return si(r??t.defaultTag)}o(ai,"getOperationTag");function TP(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(TP,"isTagExcluded");var nl={fileName:"acl/app.ability",extension:"ts"},ka="AllAbilities",qa="AppAbilities",il={fileName:"acl/useAclCheck",extension:"ts"},ci="useAclCheck",It={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},Jm={bindings:[It.abilityTuple,It.pureAbility,It.forcedSubject,It.subjectType,It.subject],from:"@casl/ability"};var er=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var RP=o(e=>`Use${Te(ht(e.operationName))}Ability`,"getAbilityTypeName"),Da=o(e=>`canUse${Te(ht(e.operationName))}`,"getAbilityFunctionName"),NP=o((e,t)=>`${t.tsNamespaces?`${Be({type:"acl",tag:ui(e,t),options:t})}.`:""}${Da(e)}`,"getImportedAbilityFunctionName"),jP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),MP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),ol=o(e=>{var t;return!!((t=La(e))!=null&&t.length)},"hasAbilityConditions"),La=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),kP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),sl=o(e=>`${Te(e)}${ka}`,"getTagAllAbilitiesName");function _t(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(we(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ja.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&_t(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&_t(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;_t(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;_t(s,t)}}o(_t,"iterateSchema");var an=o((e,t)=>Zm(Te(Ym(e)),t),"getZodSchemaName"),Fa=o((e,t,r)=>Zm(Te(Ym(e)),`${t}${r}`),"getEnumZodSchemaName"),Ct=o(e=>["z.",`${pt.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),qP=o(e=>e.startsWith(Ms),"isEnumZodSchema"),Qi=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),al=o(e=>ht(`${e}_${db}`),"getBodyZodSchemaName"),DP=o((e,t)=>ht(`${e}_${t}${hb}`),"getParamZodSchemaName"),dD=o(e=>ht(`${e}${mb}`),"getMainResponseZodSchemaName"),hD=o((e,t)=>ht(`${e}_${t}_${gb}`),"getErrorResponseZodSchemaName");function cl({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Qi(t,r,n);return!Ma(i)&&e!=="default"&&tl(i)?hD(s,e):dD(s)}o(cl,"getResponseZodSchemaName");function Ha(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Te(_P(i))}: \`${e[i]}\``],[])}o(Ha,"getSchemaDescriptions");var Ba=o((e,t)=>bP(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),LP=o((e,t)=>Ct(t)?`${e.options.tsNamespaces?`${Be({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),Ji=o((e,t,r)=>{if(!Ct(t))return t===js?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${Be({type:"models",tag:n,options:e.options})}.`:""}${Ba(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function FP(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(FP,"getZodSchemaType");function HP(e){if(e.schemaObj)return[e.schemaObj.description,...Ha(e.schemaObj).join(". ")].filter(Boolean)}o(HP,"getZodSchemaDescription");function BP(e,t,r){var n;if(we(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?Ji(e,i,r):void 0}if(Ju(t)){if(!we(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${Ji(e,i,r)}[]`:void 0}if(ja.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return BP(e,i[0],r)}return t.type}o(BP,"getType");function VP(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let p=e.resolveObject(c.schema),f=[p.description,...Ha(p)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:BP(e,c.schema,r)??"unknown",description:f.join(". ")})}return _t(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(we(c)){let u=e.resolveObject(c);_t(u,{data:{pathSegments:[]},onSchema:a})}}),_t(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(VP,"getZodSchemaPropertyDescriptions");function li({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=ul({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=ul({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Ba(u,e.options),"getEntityName"),options:e.options});return mD(e.options,a,c)}o(li,"getModelsImports");function UP({tag:e,endpoints:t,options:r}){return ul({type:"endpoints",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Va,options:r})}o(UP,"getEndpointsImports");function GP({tag:e,endpoints:t,options:r}){return ul({type:"acl",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Da,options:r})}o(GP,"getAclImports");function zP({tags:e,entityName:t,getAliasEntityName:r,type:n,options:i}){let s=new Map;return e.forEach(a=>{let c=`${t}${r?` as ${r(a)}`:""}`;s.has(a)?i.tsNamespaces||s.get(a).bindings.push(c):s.set(a,{bindings:[i.tsNamespaces?Be({type:n,tag:a,options:i}):c],from:`${cn(i)}${ll({type:n,tag:a,includeTagDir:!0,options:i})}`})}),Array.from(s.values())}o(zP,"getEntityImports");function cn(e){let t=Ff;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${Lf}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${Lf}`,"g"),Ff)),`${t}/`.replace(/\/\//g,"/")}o(cn,"getImportPath");function ul({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?Be({type:e,tag:u,options:s}):i(c)],from:`${l?"./":cn(s)}${ll({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(ul,"getImports");function mD(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:er(n.bindings)}))}o(mD,"mergeImports");function Xi({fileName:e,extension:t}){return`${e}.${t}`}o(Xi,"getFileNameWithExtension");function ZP({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${ni(t)}/`:""}${ni(t)}.${i}`:i}o(ZP,"getTagFileNameWithoutExtension");function ll(...e){return ZP(...e)}o(ll,"getTagImportPath");function fl(...e){return`${ZP(...e)}.ts`}o(fl,"getTagFileName");var Be=o(({type:e,tag:t,options:r})=>`${Te(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function WP(e){return e.standalone?`${cn(e)}${Rc.fileName}`:e.restClientImportPath}o(WP,"getAppRestClientImportPath");function KP(e){return e.standalone?`${cn(e)}${Tc.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(KP,"getQueryTypesImportPath");function YP(e){return`${cn(e)}${Nc.fileName}`}o(YP,"getQueryModulesImportPath");function QP(e){return`${cn(e)}${jc.fileName}`}o(QP,"getMutationEffectsImportPath");function JP(e){return`${cn(e)}${il.fileName}`}o(JP,"getAclCheckImportPath");function pl(e){return`${cn(e)}${Mc.fileName}`}o(pl,"getZodUtilsImportPath");function XP(e){return`${cn(e)}${nl.fileName}`}o(XP,"getAppAbilitiesImportPath");function ex(e){return At(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(ex,"primitiveTypeToTsType");var Va=o(e=>ni(ht(e.operationName)),"getEndpointName");function tx(e,t){return`${t.tsNamespaces?`${Be({type:"endpoints",tag:ui(e,t),options:t})}.`:""}${Va(e)}`}o(tx,"getImportedEndpointName");var rx=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ui(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return si(r??t.defaultTag)}o(ui,"getEndpointTag");function ii(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(Ct(i.zodSchema))s=Ji(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&ot(i.parameterObject.schema)){let p=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;p&&on(p)&&(s=ex(p))}return{name:Qn(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==Yu)&&(!(r!=null&&r.excludePageParam)||i.name!==Ca.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===Ca.pageParamName?"pageParam":i.name}))}o(ii,"mapEndpointParamsToFunctionParams");function nx(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=lP(i.name)?i.name:`"${i.name}"`,a=Qn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Lm["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Lm.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Qn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(nx,"getEndpointConfig");function ix(e,t){return t.filter(r=>Xt(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(ix,"getUpdateQueryEndpoints");var Xm=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function eo(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(eo,"pick");function us(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=ai(e,t),i=TP(n,t);return r||i}o(us,"isOperationExcluded");function eg({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${wP(e)}`,u=r.operationId?Qn(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((p,f)=>f===0?p:Te(p)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=SP(u,i);l===""?u=t.toLowerCase():Xm.includes(l)||(u=l)}return Xm.includes(u)?c:u}o(eg,"getOperationName");function Ua({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?ai(r,n):n.defaultTag,s=o(a=>{let c=eg({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>eg({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??eg({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(Ua,"getUniqueOperationName");function ox(e,t,r){let n=[];for(let i in e.paths){if(Yi(i,r))continue;let s=e.paths[i],a=eo(s,Wi);for(let c in a){let u=a[c];if(!u||us(u,r))continue;let l=Ua({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(ox,"getUniqueOperationNamesWithoutSplitByTags");function sx(e,t){let r={};for(let n in e.paths){if(Yi(n,t))continue;let i=e.paths[n],s=eo(i,Wi);for(let a in s){let c=s[a];if(!c||us(c,t))continue;let u=t.splitByTags?ai(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(sx,"getOperationsByTag");function Ga(e){return{type:"invalid-schema",message:e}}o(Ga,"getInvalidSchemaError");function ax(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(ax,"getInvalidOperationIdError");function cx(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(cx,"getMissingPathParameterError");function ux(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(ux,"getNotAllowedInlineEnumError");function lx(e){return{type:"not-allowed-circular-schema",message:e}}o(lx,"getNotAllowedCircularSchemaError");function fx(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${hl(t,r)}`}}o(fx,"getMissingAclConditionPropertyError");function tg(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${dl(e)} in operation ${hl(t,r)}`}}o(tg,"getMissingStatusCodeError");function px(e,t,r){return{type:"invalid-status-code",message:`Operation ${hl(t,r)} expected HTTP status code ${dl(e.expected)} but received ${dl(e.received)}`}}o(px,"getInvalidStatusCodeError");function dx(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${hl(t,r)} has multiple success HTTP status codes: ${e.map(dl).join(", ")}`}}o(dx,"getMultipleSuccessStatusCodesError");function hl(e,t){return e.operationId??`${t.method} ${t.path}`}o(hl,"getOperationDescriptor");function dl(e){return`${e} (${aP[e]})`}o(dl,"getStatusCodeDescription");function hx(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(hx,"groupByType");function un({schema:e,meta:t,options:r}){let n=[];At(e.type).with("string",()=>n.push(bD(e))).with("number","integer",()=>n.push(_D(e))).with("array",()=>n.push(SD(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
141
141
  `,"\r",`\r
142
142
  `].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(gD({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?yD(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(un,"getZodChain");function gD({schema:e,meta:t,options:r}){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable||r.replaceOptionalWithNullish&&(t!=null&&t.isParentPartial)?"nullable()":t!=null&&t.isRequired?"":r.replaceOptionalWithNullish?"nullish()":"optional()"}o(gD,"getZodChainablePresence");function yD(e){return e.default!==void 0?`default(${At(e.type).with("number","integer",()=>xP(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(yD,"getZodChainableDefault");function bD(e){let t=[];if(e.enum||(e.minLength!==void 0&&t.push(`min(${e.minLength})`),e.maxLength!==void 0&&t.push(`max(${e.maxLength})`)),e.pattern&&t.push(`regex(${vD(e.pattern)})`),e.format){let r=At(e.format).with("email",()=>"email()").with("hostname","uri",()=>"url()").with("uuid",()=>"uuid()").with("date-time",()=>"datetime({ offset: true })").otherwise(()=>"");r&&t.push(r)}return t.join(".")}o(bD,"getZodChainableStringValidations");function vD(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=$P(e),`/${e}/`}o(vD,"formatPatternIfNeeded");function _D(e){let t=[];return e.enum?"":(e.type==="integer"&&t.push("int()"),e.minimum!==void 0?e.exclusiveMinimum===!0?t.push(`gt(${e.minimum})`):t.push(`gte(${e.minimum})`):typeof e.exclusiveMinimum=="number"&&t.push(`gt(${e.exclusiveMinimum})`),e.maximum!==void 0?e.exclusiveMaximum===!0?t.push(`lt(${e.maximum})`):t.push(`lte(${e.maximum})`):typeof e.exclusiveMaximum=="number"&&t.push(`lt(${e.exclusiveMaximum})`),e.multipleOf&&t.push(`multipleOf(${e.multipleOf})`),t.join("."))}o(_D,"getZodChainableNumberValidations");function SD(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(SD,"getZodChainableArrayValidations");var OD={type:"string",format:"date-time"},ED={type:"string",format:"email"},PD={type:"object",properties:{start:{type:"string",format:"date-time"},end:{type:"string",format:"date-time"}}},xD={type:"object",properties:{html:{type:"string"},json:{type:"object"}}},ls=(i=>(i.datetime="datetime",i.email="email",i.dateRange="dateRange",i.textEditor="textEditor",i))(ls||{}),ml={datetime:OD,email:ED,dateRange:PD,textEditor:xD};function mx(){return Object.values(ls).filter(e=>on(ml[e].type))}o(mx,"getPrimitiveBrands");function gx(){return Object.values(ls).filter(e=>!on(ml[e].type))}o(gx,"getOtherBrands");function fs(e,t){let r=ml[t];return!(e.type!==r.type||r.format&&e.format!==r.format||!Object.entries(r.properties??{}).every(([i,s])=>{var c;let a=(c=e.properties)==null?void 0:c[i];return a&&a.type===s.type&&a.format===s.format}))}o(fs,"matchesBrand");function rg(e,t,r){return r.branded?`${pt.namespace}.${pt.exports.brand}(${e}, "${t}")`:e}o(rg,"wrapWithBrand");var to=o(e=>e.reduce((t,r)=>t+r,0),"sum");function mt(e,t){if(!t)return e;if(we(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?tr("oneOf")+mt(e,{...t,type:t.type[0]}):e+tr("oneOf")+to(t.type.map(r=>mt(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?tr("oneOf")+mt(e,t.oneOf[0]):e+tr("oneOf")+to(t.oneOf.map(r=>mt(0,r)));if(t.anyOf)return t.anyOf.length===1?tr("anyOf")+mt(e,t.anyOf[0]):e+tr("anyOf")+to(t.anyOf.map(r=>mt(0,r)));if(t.allOf)return t.allOf.length===1?tr("allOf")+mt(e,t.allOf[0]):e+tr("allOf")+to(t.allOf.map(r=>mt(0,r)));if(!t.type)return e;if(on(t.type))return t.enum?e+yx(t)+tr("enum")+to(t.enum.map(r=>mt(0,r))):e+yx(t);if(t.type==="array")return t.items?tr("array")+mt(e,t.items):tr("array")+mt(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.properties){let r=Object.values(t.properties);e+=tr("object")+to(r.map(n=>mt(0,n)))}else e+=tr("empty-object");t.additionalProperties&&(typeof t.additionalProperties=="object"?e+=mt(0,t.additionalProperties):e+=mt(1))}return e}o(mt,"getOpenAPISchemaComplexity");function yx(e){return At(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(yx,"complexityByType");function tr(e){return At(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(tr,"complexityByComposite");var ng=class ng{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;we(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.tsNamespaces&&i&&i!==t?`${Be({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return mt(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(ng,"ZodSchema");var za=ng;function Qe({schema:e,resolver:t,meta:r,tag:n}){var y;let i=new za(e,t,r),s={parent:i.inherit(r==null?void 0:r.parent),referencedBy:[...i.meta.referencedBy]},a={resolver:t,meta:s,tag:n};if(we(e))return $D({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=AD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=wD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=ID({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let p=CD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let f=TD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let d=t.options.allReadonly?".readonly()":"";if(Ju(e))return e.items?i.assign(`z.array(${Qe({...a,schema:e.items}).getCodeString(n,t.options)}${un({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let h=e.type?e.type.toLowerCase():void 0;if(h==="object"||e.properties||e.additionalProperties){let b=e.required&&e.required.length>0,g=t.options.withImplicitRequiredProps?!1:e.properties&&!((y=e.required)!=null&&y.length),P="{}";e.properties&&(P="{ "+Object.entries(e.properties).map(([re,$e])=>{var R;let Ae={...s,isRequired:g?!0:b?(R=e.required)==null?void 0:R.includes(re):t.options.withImplicitRequiredProps,name:re,isParentPartial:g},G=$e;if(we($e)&&t&&(G=t.getSchemaByRef($e.$ref),!G))throw new Error(`Schema ${$e.$ref} not found`);let j=Qe({...a,schema:$e,meta:Ae}).getCodeString(n,t.options)+un({schema:G,meta:Ae,options:t.options});return ot($e)&&mx().forEach(k=>{fs($e,k)&&(j=rg(j,k,t.options))}),[re,j]}).map(([re,$e])=>`${PP(re)}: ${$e}`).join(", ")+" }");let $="";e.additionalProperties&&($=`.catchall(${typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0?Qe({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+un({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options}):"z.any()"})`);let C=g?".partial()":"",T=t.options.strictObjects?".strict()":"",w=`z.object(${P})${C}${T}${$}${d}`;return gx().forEach(te=>{fs(e,te)&&(w=rg(w,te,t.options))}),i.assign(w)}if(h==="any")return i.assign("z.any()");if(!h)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${h}`)}o(Qe,"getZodSchema");function $D({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!we(e))return;let s=t.meta.referencedBy.slice(0,-1).map(u=>u.ref?r.getZodSchemaNameByRef(u.ref)??u.ref:void 0).filter(Boolean),a=r.getZodSchemaNameByRef(e.$ref);if(s.length>1&&s.includes(a))return t.assign(r.getCodeByZodSchemaName(t.ref));let c=r.getCodeByZodSchemaName(e.$ref);if(!c){let u=r.getSchemaByRef(e.$ref);if(!u)throw new Error(`Schema ${e.$ref} not found`);c=Qe({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o($D,"getReferenceZodSchema");function wD({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!ot(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=Qe({schema:e.oneOf[0],resolver:r,meta:n,tag:i});return t.assign(c.getCodeString(i,r.options))}let s=(a=e.oneOf)==null?void 0:a.some(c=>ot(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
143
143
  z.discriminatedUnion("${c}", [${e.oneOf.map(u=>Qe({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "0.14.3",
3
+ "version": "0.14.4",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
@@ -49,9 +49,9 @@ export namespace {{zodUtilsNamespace}} {
49
49
  }
50
50
 
51
51
  export class ZodBranded<T extends z.ZodTypeAny, B extends string | number | symbol> extends z.ZodType<
52
- T["_output"] | (T["_output"] & ZodBrand<B>),
52
+ T["_output"],
53
53
  z.ZodTypeDef,
54
- T["_input"] | (T["_input"] & ZodBrand<B>)
54
+ T["_input"]
55
55
  > {
56
56
  readonly _schema: T;
57
57
 
@@ -66,6 +66,10 @@ export namespace {{zodUtilsNamespace}} {
66
66
  _parse(input: z.ParseInput) {
67
67
  return this._schema._parse(input);
68
68
  }
69
+
70
+ unwrap() {
71
+ return this._schema;
72
+ }
69
73
  }
70
74
 
71
75
  export type ExtractZodBrand<T> = T extends ZodBrand<infer B> ? B : never;