@povio/openapi-codegen-cli 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/sh.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ Expecting `+on.join(", ")+", got '"+(this.terminals_[P]||P)+"'":Ma="Parse error
|
|
|
71
71
|
`.trim()},"lookupPropertyFunctionVarDeclaration"),blockValue:o(function(t){var r=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(t,0,n);var i=this.popStack();n.splice(1,0,i),this.push(this.source.functionCall(r,"call",n))},"blockValue"),ambiguousBlockValue:o(function(){var t=this.aliasable("container.hooks.blockHelperMissing"),r=[this.contextName(0)];this.setupHelperArgs("",0,r,!0),this.flushInline();var n=this.topStack();r.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(t,"call",r),"}"])},"ambiguousBlockValue"),appendContent:o(function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},"appendContent"),append:o(function(){if(this.isInline())this.replaceStack(function(r){return[" != null ? ",r,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},"append"),appendEscaped:o(function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},"appendEscaped"),getContext:o(function(t){this.lastContext=t},"getContext"),pushContext:o(function(){this.pushStackLiteral(this.contextName(this.lastContext))},"pushContext"),lookupOnContext:o(function(t,r,n,i){var s=0;!i&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(t[s++])):this.pushContext(),this.resolvePath("context",t,s,r,n)},"lookupOnContext"),lookupBlockParam:o(function(t,r){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",r,1)},"lookupBlockParam"),lookupData:o(function(t,r,n){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",r,0,!0,n)},"lookupData"),resolvePath:o(function(t,r,n,i,s){var a=this;if(this.options.strict||this.options.assumeObjects){this.push(b3(this.options.strict&&s,this,r,n,t));return}for(var c=r.length;n<c;n++)this.replaceStack(function(u){var l=a.nameLookup(u,r[n],t);return i?[" && ",l]:[" != null ? ",l," : ",u]})},"resolvePath"),resolvePossibleLambda:o(function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},"resolvePossibleLambda"),pushStringParam:o(function(t,r){this.pushContext(),this.pushString(r),r!=="SubExpression"&&(typeof t=="string"?this.pushString(t):this.pushStackLiteral(t))},"pushStringParam"),emptyHash:o(function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},"emptyHash"),pushHash:o(function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},"pushHash"),popHash:o(function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},"popHash"),pushString:o(function(t){this.pushStackLiteral(this.quotedString(t))},"pushString"),pushLiteral:o(function(t){this.pushStackLiteral(t)},"pushLiteral"),pushProgram:o(function(t){t!=null?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},"pushProgram"),registerDecorator:o(function(t,r){var n=this.nameLookup("decorators",r,"decorator"),i=this.setupHelperArgs(r,t);this.decorators.push(["fn = ",this.decorators.functionCall(n,"",["fn","props","container",i])," || fn;"])},"registerDecorator"),invokeHelper:o(function(t,r,n){var i=this.popStack(),s=this.setupHelper(t,r),a=[];n&&a.push(s.name),a.push(i),this.options.strict||a.push(this.aliasable("container.hooks.helperMissing"));var c=["(",this.itemsSeparatedBy(a,"||"),")"],u=this.source.functionCall(c,"call",s.callParams);this.push(u)},"invokeHelper"),itemsSeparatedBy:o(function(t,r){var n=[];n.push(t[0]);for(var i=1;i<t.length;i++)n.push(r,t[i]);return n},"itemsSeparatedBy"),invokeKnownHelper:o(function(t,r){var n=this.setupHelper(t,r);this.push(this.source.functionCall(n.name,"call",n.callParams))},"invokeKnownHelper"),invokeAmbiguous:o(function(t,r){this.useRegister("helper");var n=this.popStack();this.emptyHash();var i=this.setupHelper(0,t,r),s=this.lastHelper=this.nameLookup("helpers",t,"helper"),a=["(","(helper = ",s," || ",n,")"];this.options.strict||(a[0]="(helper = ",a.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",a,i.paramsInit?["),(",i.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",i.callParams)," : helper))"])},"invokeAmbiguous"),invokePartial:o(function(t,r,n){var i=[],s=this.setupParams(r,1,i);t&&(r=this.popStack(),delete s.name),n&&(s.indent=JSON.stringify(n)),s.helpers="helpers",s.partials="partials",s.decorators="container.decorators",t?i.unshift(r):i.unshift(this.nameLookup("partials",r,"partial")),this.options.compat&&(s.depths="depths"),s=this.objectLiteral(s),i.push(s),this.push(this.source.functionCall("container.invokePartial","",i))},"invokePartial"),assignToHash:o(function(t){var r=this.popStack(),n=void 0,i=void 0,s=void 0;this.trackIds&&(s=this.popStack()),this.stringParams&&(i=this.popStack(),n=this.popStack());var a=this.hash;n&&(a.contexts[t]=n),i&&(a.types[t]=i),s&&(a.ids[t]=s),a.values[t]=r},"assignToHash"),pushId:o(function(t,r,n){t==="BlockParam"?this.pushStackLiteral("blockParams["+r[0]+"].path["+r[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):t==="PathExpression"?this.pushString(r):t==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},"pushId"),compiler:ni,compileChildren:o(function(t,r){for(var n=t.children,i=void 0,s=void 0,a=0,c=n.length;a<c;a++){i=n[a],s=new this.compiler;var u=this.matchExistingProgram(i);if(u==null){this.context.programs.push("");var l=this.context.programs.length;i.index=l,i.name="program"+l,this.context.programs[l]=s.compile(i,r,this.context,!this.precompile),this.context.decorators[l]=s.decorators,this.context.environments[l]=i,this.useDepths=this.useDepths||s.useDepths,this.useBlockParams=this.useBlockParams||s.useBlockParams,i.useDepths=this.useDepths,i.useBlockParams=this.useBlockParams}else i.index=u.index,i.name="program"+u.index,this.useDepths=this.useDepths||u.useDepths,this.useBlockParams=this.useBlockParams||u.useBlockParams}},"compileChildren"),matchExistingProgram:o(function(t){for(var r=0,n=this.context.environments.length;r<n;r++){var i=this.context.environments[r];if(i&&i.equals(t))return i}},"matchExistingProgram"),programExpression:o(function(t){var r=this.environment.children[t],n=[r.index,"data",r.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},"programExpression"),useRegister:o(function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},"useRegister"),push:o(function(t){return t instanceof ri||(t=this.source.wrap(t)),this.inlineStack.push(t),t},"push"),pushStackLiteral:o(function(t){this.push(new ri(t))},"pushStackLiteral"),pushSource:o(function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},"pushSource"),replaceStack:o(function(t){var r=["("],n=void 0,i=void 0,s=void 0;if(!this.isInline())throw new Hf.default("replaceStack on non-inline");var a=this.popStack(!0);if(a instanceof ri)n=[a.value],r=["(",n],s=!0;else{i=!0;var c=this.incrStack();r=["((",this.push(c)," = ",a,")"],n=this.topStack()}var u=t.call(this,n);s||this.popStack(),i&&this.stackSlot--,this.push(r.concat(u,")"))},"replaceStack"),incrStack:o(function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},"incrStack"),topStackName:o(function(){return"stack"+this.stackSlot},"topStackName"),flushInline:o(function(){var t=this.inlineStack;this.inlineStack=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i instanceof ri)this.compileStack.push(i);else{var s=this.incrStack();this.pushSource([s," = ",i,";"]),this.compileStack.push(s)}}},"flushInline"),isInline:o(function(){return this.inlineStack.length},"isInline"),popStack:o(function(t){var r=this.isInline(),n=(r?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof ri)return n.value;if(!r){if(!this.stackSlot)throw new Hf.default("Invalid stack pop");this.stackSlot--}return n},"popStack"),topStack:o(function(){var t=this.isInline()?this.inlineStack:this.compileStack,r=t[t.length-1];return r instanceof ri?r.value:r},"topStack"),contextName:o(function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},"contextName"),quotedString:o(function(t){return this.source.quotedString(t)},"quotedString"),objectLiteral:o(function(t){return this.source.objectLiteral(t)},"objectLiteral"),aliasable:o(function(t){var r=this.aliases[t];return r?(r.referenceCount++,r):(r=this.aliases[t]=this.source.wrap(t),r.aliasable=!0,r.referenceCount=1,r)},"aliasable"),setupHelper:o(function(t,r,n){var i=[],s=this.setupHelperArgs(r,t,i,n),a=this.nameLookup("helpers",r,"helper"),c=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:i,paramsInit:s,name:a,callParams:[c].concat(i)}},"setupHelper"),setupParams:o(function(t,r,n){var i={},s=[],a=[],c=[],u=!n,l=void 0;u&&(n=[]),i.name=this.quotedString(t),i.hash=this.popStack(),this.trackIds&&(i.hashIds=this.popStack()),this.stringParams&&(i.hashTypes=this.popStack(),i.hashContexts=this.popStack());var f=this.popStack(),p=this.popStack();(p||f)&&(i.fn=p||"container.noop",i.inverse=f||"container.noop");for(var d=r;d--;)l=this.popStack(),n[d]=l,this.trackIds&&(c[d]=this.popStack()),this.stringParams&&(a[d]=this.popStack(),s[d]=this.popStack());return u&&(i.args=this.source.generateArray(n)),this.trackIds&&(i.ids=this.source.generateArray(c)),this.stringParams&&(i.types=this.source.generateArray(a),i.contexts=this.source.generateArray(s)),this.options.data&&(i.data="data"),this.useBlockParams&&(i.blockParams="blockParams"),i},"setupParams"),setupHelperArgs:o(function(t,r,n,i){var s=this.setupParams(t,r,n);return s.loc=JSON.stringify(this.source.currentLocation),s=this.objectLiteral(s),i?(this.useRegister("options"),n.push("options"),["options=",s]):n?(n.push(s),""):s},"setupHelperArgs")};(function(){for(var e="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),t=ni.RESERVED_WORDS={},r=0,n=e.length;r<n;r++)t[e[r]]=!0})();ni.isValidJavaScriptVariableName=function(e){return!ni.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)};function b3(e,t,r,n,i){var s=t.popStack(),a=r.length;for(e&&a--;n<a;n++)s=t.nameLookup(s,r[n],i);return e?[t.aliasable("container.strict"),"(",s,", ",t.quotedString(r[n]),", ",JSON.stringify(t.source.currentLocation)," )"]:s}o(b3,"strictLookup");Ra.default=ni;C_.exports=Ra.default});var D_=h((Ca,M_)=>{"use strict";Ca.__esModule=!0;function $o(e){return e&&e.__esModule?e:{default:e}}o($o,"_interopRequireDefault");var _3=Lb(),P3=$o(_3),$3=Sf(),E3=$o($3),Bf=Jb(),Uf=r_(),O3=j_(),x3=$o(O3),w3=Ea(),A3=$o(w3),I3=hf(),T3=$o(I3),N3=P3.default.create;function q_(){var e=N3();return e.compile=function(t,r){return Uf.compile(t,r,e)},e.precompile=function(t,r){return Uf.precompile(t,r,e)},e.AST=E3.default,e.Compiler=Uf.Compiler,e.JavaScriptCompiler=x3.default,e.Parser=Bf.parser,e.parse=Bf.parse,e.parseWithoutProcessing=Bf.parseWithoutProcessing,e}o(q_,"create");var ii=q_();ii.create=q_;T3.default(ii);ii.Visitor=A3.default;ii.default=ii;Ca.default=ii;M_.exports=Ca.default});var L_=h(ja=>{"use strict";ja.__esModule=!0;ja.print=j3;ja.PrintVisitor=Y;function k3(e){return e&&e.__esModule?e:{default:e}}o(k3,"_interopRequireDefault");var R3=Ea(),C3=k3(R3);function j3(e){return new Y().accept(e)}o(j3,"print");function Y(){this.padding=0}o(Y,"PrintVisitor");Y.prototype=new C3.default;Y.prototype.pad=function(e){for(var t="",r=0,n=this.padding;r<n;r++)t+=" ";return t+=e+`
|
|
72
72
|
`,t};Y.prototype.Program=function(e){var t="",r=e.body,n=void 0,i=void 0;if(e.blockParams){var s="BLOCK PARAMS: [";for(n=0,i=e.blockParams.length;n<i;n++)s+=" "+e.blockParams[n];s+=" ]",t+=this.pad(s)}for(n=0,i=r.length;n<i;n++)t+=this.accept(r[n]);return this.padding--,t};Y.prototype.MustacheStatement=function(e){return this.pad("{{ "+this.SubExpression(e)+" }}")};Y.prototype.Decorator=function(e){return this.pad("{{ DIRECTIVE "+this.SubExpression(e)+" }}")};Y.prototype.BlockStatement=Y.prototype.DecoratorBlock=function(e){var t="";return t+=this.pad((e.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,t+=this.pad(this.SubExpression(e)),e.program&&(t+=this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--),e.inverse&&(e.program&&this.padding++,t+=this.pad("{{^}}"),this.padding++,t+=this.accept(e.inverse),this.padding--,e.program&&this.padding--),this.padding--,t};Y.prototype.PartialStatement=function(e){var t="PARTIAL:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),this.pad("{{> "+t+" }}")};Y.prototype.PartialBlockStatement=function(e){var t="PARTIAL BLOCK:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),t+=" "+this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--,this.pad("{{> "+t+" }}")};Y.prototype.ContentStatement=function(e){return this.pad("CONTENT[ '"+e.value+"' ]")};Y.prototype.CommentStatement=function(e){return this.pad("{{! '"+e.value+"' }}")};Y.prototype.SubExpression=function(e){for(var t=e.params,r=[],n=void 0,i=0,s=t.length;i<s;i++)r.push(this.accept(t[i]));return t="["+r.join(", ")+"]",n=e.hash?" "+this.accept(e.hash):"",this.accept(e.path)+" "+t+n};Y.prototype.PathExpression=function(e){var t=e.parts.join("/");return(e.data?"@":"")+"PATH:"+t};Y.prototype.StringLiteral=function(e){return'"'+e.value+'"'};Y.prototype.NumberLiteral=function(e){return"NUMBER{"+e.value+"}"};Y.prototype.BooleanLiteral=function(e){return"BOOLEAN{"+e.value+"}"};Y.prototype.UndefinedLiteral=function(){return"UNDEFINED"};Y.prototype.NullLiteral=function(){return"NULL"};Y.prototype.Hash=function(e){for(var t=e.pairs,r=[],n=0,i=t.length;n<i;n++)r.push(this.accept(t[n]));return"HASH{"+r.join(", ")+"}"};Y.prototype.HashPair=function(e){return e.key+"="+this.accept(e.value)}});var _r=h((TV,H_)=>{var qa=D_().default,V_=L_();qa.PrintVisitor=V_.PrintVisitor;qa.print=V_.print;H_.exports=qa;function F_(e,t){var r=require("fs"),n=r.readFileSync(t,"utf8");e.exports=qa.compile(n)}o(F_,"extension");typeof require<"u"&&require.extensions&&(require.extensions[".handlebars"]=F_,require.extensions[".hbs"]=F_)});var Ej={};f2(Ej,{getGenerateFilesData:()=>$j,getGenerateMetadata:()=>Pj});module.exports=d2(Ej);var Kf=mt(Ev());var Ov="Schema",xv="Enum",wv="Body",Av="Param",Iv="Response",Tv="ErrorResponse",Qi="z.void()",ks="z.enum",Rs={bindings:["z"],from:"zod"};var Yi={input:"input.yaml",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},standalone:!1,baseUrl:"",schemaSuffix:Ov,enumSuffix:xv,withDefaultValues:!0,additionalPropertiesDefaultValue:!1,extractEnums:!0,removeOperationPrefixEndingWith:"Controller_",infiniteQueries:!0};var Z=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),ur=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),Nv=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),se=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),kv=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),wp=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),Rv=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),ck=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"),Ap=o(e=>{let t=e.map(Z).map(Cv).map(r=>uk(r)).flat();return ck(t)},"getMostCommonAdjacentCombinationSplit"),Cv=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),jv=o(e=>Cv(e).join(" "),"camelToSpaceSeparated"),uk=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"),qv=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${ur(r)}|${Z(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var Cs=o(e=>`use${Z(se(e.operationName))}`,"getQueryName"),Mv=o(e=>`use${Z(se(e.operationName))}Infinite`,"getInfiniteQueryName");var Ji="AppRestClient",js={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Ip="src/data",Tp="@/data",Dv="@/util/rest/clients/app-rest-client",Lv="@/types/react-query";var qs={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},Ms={fileName:"app-rest-client",extension:"ts"};var Ce=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var Np={"Content-Type":"application/json",Accept:"application/json"},Fv="data";var Vv=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Ot=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");var Lt=Symbol.for("@ts-pattern/matcher"),lk=Symbol.for("@ts-pattern/isVariadic"),Ls="@ts-pattern/anonymous-select-key",kp=o(e=>!!(e&&typeof e=="object"),"r"),Ds=o(e=>e&&!!e[Lt],"i"),At=o((e,t,r)=>{if(Ds(e)){let n=e[Lt](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(kp(e)){if(!kp(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];Ds(c)&&c[lk]?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,f)=>At(l,a[f],r))&&i.every((l,f)=>At(l,c[f],r))&&(s.length===0||At(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>At(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||Ds(s=i)&&s[Lt]().matcherType==="optional")&&At(i,t[n],r);var s})}return Object.is(t,e)},"s"),mr=o(e=>{var t,r,n;return kp(e)?Ds(e)?(t=(r=(n=e[Lt]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?eo(e,mr):eo(Object.values(e),mr):[]},"o"),eo=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function Ze(e){return Object.assign(e,{optional:o(()=>pk(e),"optional"),and:o(t=>G(e,t),"and"),or:o(t=>fk(e,t),"or"),select:o(t=>t===void 0?Hv(e):Hv(t,e),"select")})}o(Ze,"u");function pk(e){return Ze({[Lt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(mr(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:At(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>mr(e),"getSelectionKeys"),matcherType:"optional"})})}o(pk,"h");function G(...e){return Ze({[Lt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>At(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>eo(e,mr),"getSelectionKeys"),matcherType:"and"})})}o(G,"m");function fk(...e){return Ze({[Lt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return eo(e,mr).forEach(i=>n(i,void 0)),{matched:e.some(i=>At(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>eo(e,mr),"getSelectionKeys"),matcherType:"or"})})}o(fk,"d");function D(e){return{[Lt]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(D,"p");function Hv(...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 Ze({[Lt]:()=>({match:o(n=>{let i={[t??Ls]:n};return{matched:r===void 0||At(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??Ls].concat(r===void 0?[]:mr(r)),"getSelectionKeys")})})}o(Hv,"y");function xt(e){return typeof e=="number"}o(xt,"v");function lr(e){return typeof e=="string"}o(lr,"b");function pr(e){return typeof e=="bigint"}o(pr,"w");var Q8=Ze(D(function(e){return!0}));var fr=o(e=>Object.assign(Ze(e),{startsWith:o(t=>{return fr(G(e,(r=t,D(n=>lr(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return fr(G(e,(r=t,D(n=>lr(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>fr(G(e,(r=>D(n=>lr(n)&&n.length>=r))(t))),"minLength"),length:o(t=>fr(G(e,(r=>D(n=>lr(n)&&n.length===r))(t))),"length"),maxLength:o(t=>fr(G(e,(r=>D(n=>lr(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return fr(G(e,(r=t,D(n=>lr(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return fr(G(e,(r=t,D(n=>lr(n)&&!!n.match(r)))));var r},"regex")}),"j"),Y8=fr(D(lr)),wt=o(e=>Object.assign(Ze(e),{between:o((t,r)=>wt(G(e,((n,i)=>D(s=>xt(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>wt(G(e,(r=>D(n=>xt(n)&&n<r))(t))),"lt"),gt:o(t=>wt(G(e,(r=>D(n=>xt(n)&&n>r))(t))),"gt"),lte:o(t=>wt(G(e,(r=>D(n=>xt(n)&&n<=r))(t))),"lte"),gte:o(t=>wt(G(e,(r=>D(n=>xt(n)&&n>=r))(t))),"gte"),int:o(()=>wt(G(e,D(t=>xt(t)&&Number.isInteger(t)))),"int"),finite:o(()=>wt(G(e,D(t=>xt(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>wt(G(e,D(t=>xt(t)&&t>0))),"positive"),negative:o(()=>wt(G(e,D(t=>xt(t)&&t<0))),"negative")}),"x"),J8=wt(D(xt)),dr=o(e=>Object.assign(Ze(e),{between:o((t,r)=>dr(G(e,((n,i)=>D(s=>pr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>dr(G(e,(r=>D(n=>pr(n)&&n<r))(t))),"lt"),gt:o(t=>dr(G(e,(r=>D(n=>pr(n)&&n>r))(t))),"gt"),lte:o(t=>dr(G(e,(r=>D(n=>pr(n)&&n<=r))(t))),"lte"),gte:o(t=>dr(G(e,(r=>D(n=>pr(n)&&n>=r))(t))),"gte"),positive:o(()=>dr(G(e,D(t=>pr(t)&&t>0))),"positive"),negative:o(()=>dr(G(e,D(t=>pr(t)&&t<0))),"negative")}),"A"),X8=dr(D(pr)),eL=Ze(D(function(e){return typeof e=="boolean"})),tL=Ze(D(function(e){return typeof e=="symbol"})),rL=Ze(D(function(e){return e==null})),nL=Ze(D(function(e){return e!=null}));var qp=class qp 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(qp,"W");var Rp=qp,Cp={matched:!1,value:void 0};function ge(e){return new jp(e,Cp)}o(ge,"z");var Xi=class Xi{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,f)=>{s=!0,a[l]=f},"a"),u=!n.some(l=>At(l,this.input,c))||i&&!i(this.input)?Cp:{matched:!0,value:r(s?Ls in a?a[Ls]:a:this.input,this.input)};return new Xi(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Xi(this.input,n?{matched:!0,value:r(this.input,this.input)}:Cp)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Rp(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Xi,"I");var jp=Xi;var Mp=["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"];var Dp=2,Bv=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],Uv=["query","header","path"],hr=["get","put","post","delete","options","head","patch","trace"],Zv=["string","number","integer","boolean"],Un=["allOf","anyOf","oneOf"];function gr(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(gr,"pick");function It(e){return kv(e)}o(It,"formatTag");function Ur(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return It(r??t.defaultTag)}o(Ur,"getOperationTag");function Gv(e,t){let r={};for(let n in e.paths){let i=e.paths[n],s=gr(i,hr);for(let a in s){let c=s[a];if(!c||c.deprecated&&!t.withDeprecatedEndpoints)continue;let u=t.splitByTags?Ur(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(Gv,"getOperationsByTag");var Kv=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Zr=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),Zn=o(e=>Zr(e).split("/").at(-1),"getSchemaNameByRef");function M(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(M,"isReferenceObject");function Vp(e){let t=dk(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return se(t)}o(Vp,"normalizeString");function Wv(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(Wv,"wrapWithQuotesIfNeeded");function Qv(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(Qv,"unwrapQuotesIfNeeded");function dk(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(dk,"prefixStringStartingWithNumberIfNeeded");function Hp(e){let t=e.replaceAll("_","#");return se(t.replaceAll("-","_")).replaceAll("#","_")}o(Hp,"pathParamToVariableName");var Ft=o(e=>Zv.includes(e),"isPrimitiveType");function Yv(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(Yv,"escapeControlCharacters");function Ge(e){return e.includes("application/")&&e.includes("json")||Bv.includes(e)||e.includes("text/")}o(Ge,"isParamMediaTypeAllowed");function Fs(e){return e>=200&&e<300}o(Fs,"isMainResponseStatus");function Vs(e){return!(e>=200&&e<300)}o(Vs,"isErrorStatus");function Gn(e){return e==="application/json"}o(Gn,"isMediaTypeAllowed");function Lp({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${hk(e)}`,u=r.operationId?Ot(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((f,p)=>p===0?f:Z(f)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=qv(u,i);Mp.includes(l)||(u=l)}return Mp.includes(u)?c:u}o(Lp,"getOperationName");function to({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?Ur(r,n):n.defaultTag,s=o(a=>{let c=Lp({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>Lp({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??Lp({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(to,"getUniqueOperationName");function Jv(e,t,r){let n=[];for(let i in e.paths){let s=e.paths[i],a=gr(s,hr);for(let c in a){let u=a[c];if(!u||u.deprecated&&!r.withDeprecatedEndpoints)continue;let l=to({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(Jv,"getUniqueOperationNamesWithoutSplitByTags");var zv=/({\w+})/g,mk=/[^\w\-]+/g;function hk(e){e=Z(Nv(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(zv)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(zv,"")}By${Z(r.slice(1,-1))}`}return e.replace(mk,"_")}o(hk,"pathToVariableName");var Fp=/{(\b\w+(?:-\w+)*\b)}/g;function Xv(e){let t=e.match(Fp);return t===null?e.replaceAll(Fp,":$1"):(t.forEach(r=>{let n=Hp(r.replaceAll(Fp,":$1"));e=e.replaceAll(r,n)}),e)}o(Xv,"replaceHyphenatedPath");function je(e){return!M(e)}o(je,"isSchemaObject");function Hs(e){return e.type==="array"}o(Hs,"isArraySchemaObject");function eS(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(gk(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(M(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(eS,"inferRequiredSchema");var gk=o(e=>!M(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var Tt=o((e,t)=>wp(Z(Vp(e)),t),"getZodSchemaName"),Bp=o((e,t,r)=>wp(Z(Vp(e)),`${t}${r}`),"getEnumZodSchemaName"),$e=o(e=>!e.startsWith("z."),"isNamedZodSchema"),tS=o(e=>e.startsWith(ks),"isEnumZodSchema"),Gr=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),Bs=o(e=>se(`${e}_${wv}`),"getBodyZodSchemaName"),rS=o((e,t)=>se(`${e}_${t}${Av}`),"getParamZodSchemaName"),yk=o(e=>se(`${e}${Iv}`),"getMainResponseZodSchemaName"),vk=o((e,t)=>se(`${e}_${t}_${Tv}`),"getErrorResponseZodSchemaName");function Us({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Gr(t,r,n);return!Fs(i)&&e!=="default"&&Vs(i)?vk(s,e):yk(s)}o(Us,"getResponseZodSchemaName");function ro(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Z(jv(i))}: \`${e[i]}\``],[])}o(ro,"getSchemaDescriptions");function Ee(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(M(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(Un.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&&Ee(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&&Ee(a,t);if(i.additionalProperties)for(let[s,a]of Object.entries(i.additionalProperties))!(a instanceof Object)||n({type:"additionalProperty",parentSchema:e,schema:a,data:r,propertyName:s})===!0||Ee(a,t);if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;Ee(s,t)}}o(Ee,"iterateSchema");var no=o((e,t)=>Rv(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),nS=o((e,t)=>$e(t)?`${e.options.tsNamespaces?`${K({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),yr=o((e,t,r)=>{if(!$e(t))return t===Qi?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${K({type:"models",tag:n,options:e.options})}.`:""}${no(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function iS(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(iS,"getZodSchemaType");function oS(e){if(e.schemaObj)return[e.schemaObj.description,...ro(e.schemaObj).join(". ")].filter(Boolean)}o(oS,"getZodSchemaDescription");function sS(e,t,r){var n;if(M(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?yr(e,i,r):void 0}if(Hs(t)){if(!M(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${yr(e,i,r)}[]`:void 0}if(Un.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return sS(e,i[0],r)}return t.type}o(sS,"getType");function aS(e,t,r){if(!t.schemaObj)return[];let n="[0]",i={},s=o(a=>{var u;if(a.type==="reference")return!0;if(a.type==="composite")return;let c=[...((u=a.data)==null?void 0:u.pathSegments)??[]];if(a.type==="array"?c.push(n):(a.type==="property"||a.type==="additionalProperty")&&c.push(a.propertyName),a.schema&&c[c.length-1]!==n){let l=e.resolveObject(a.schema),f=[l.description,...ro(l)].filter(Boolean),p=c.join(".");i[p]&&"type"in a.schema&&a.schema.type==="object"||(delete i[p],i[p]={type:sS(e,a.schema,r)??"unknown",description:f.join(". ")})}return Ee(a.schema,{data:{pathSegments:[...c]},onSchema:s}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(a=>{if(M(a)){let c=e.resolveObject(a);Ee(c,{data:{pathSegments:[]},onSchema:s})}}),Ee(t.schemaObj,{data:{pathSegments:[]},onSchema:s}),i}o(aS,"getZodSchemaPropertyDescriptions");function Zs(e){return ge(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(Zs,"primitiveTypeToTsType");function zn({zodSchemaName:e,schema:t,resolver:r}){let n="void",i;e&&$e(e)?(n=yr(r,e),i=r.getTagByZodSchemaName(e)):t!=null&&t.type&&Ft(t==null?void 0:t.type)&&(n=Zs(t==null?void 0:t.type));let s=n.split(".");return{type:s[s.length-1],...s.length>1?{namespace:s[0]}:{},...i?{importPath:Kr({type:"models",tag:i,includeTagDir:!0,options:r.options})}:{}}}o(zn,"getTsTypeBase");function zr({schema:e,isCircular:t,parentTypes:r,resolver:n}){if(!e)return{metaType:"primitive"};for(let i of Un){let s=e[i];if(s)if(s.length>1){let a=s.map(c=>{let u=n.resolveObject(c);return zr({schema:u,parentTypes:r,resolver:n})});return a.every(({metaType:c})=>c==="object")?{metaType:"object",objectProperties:a.reduce((c,{objectProperties:u})=>{let l=u.map(({name:f})=>f);return[...c.filter(({name:f})=>!l.includes(f)),...u]},[])}:{metaType:"composite",[i]:a}}else e=n.resolveObject(s[0])}return e.type==="array"?{metaType:"array",arrayType:cS({arraySchema:e,resolver:n,parentTypes:r})}:(e.type==="object"||e.properties)&&t?{metaType:"object",objectProperties:[],isCircular:!0}:e.type==="object"||e.properties?{metaType:"object",objectProperties:Sk({schema:e,parentTypes:r,resolver:n})}:{metaType:"primitive"}}o(zr,"getSchemaTsMetaType");function cS({arraySchema:e,parentTypes:t,resolver:r}){let n,i;if(M(e.items)){let u=e.items.$ref;n=r.getZodSchemaNameByRef(u),i=r.getSchemaByRef(u)}else i=e.items;let s=zn({zodSchemaName:n,schema:i,resolver:r}),a=uS(s,t),c=zr({schema:i,isCircular:a,parentTypes:[...t,s],resolver:r});return{...s,...c}}o(cS,"getArraySchemaTsType");function Sk({schema:e,parentTypes:t,resolver:r}){return Object.entries((e==null?void 0:e.properties)??{}).map(([n,i])=>{var a;let s=((a=e==null?void 0:e.required)==null?void 0:a.includes(n))??!1;if(M(i)){let c=r.getZodSchemaNameByRef(i.$ref),u=r.getSchemaByRef(i.$ref),l=zn({zodSchemaName:c,schema:u,resolver:r}),f=uS(l,t),p=zr({schema:u,isCircular:f,parentTypes:[...t,l],resolver:r});return{name:n,isRequired:s,...l,...p}}else if(i.type==="array"){let c=cS({arraySchema:i,parentTypes:t,resolver:r});return{name:n,isRequired:s,type:"array",metaType:"array",arrayType:c}}else if(Ft(i.type))return{name:n,isRequired:s,type:Zs(i.type),metaType:"primitive"};return{name:n,isRequired:s,type:"void",metaType:"primitive"}})}o(Sk,"getSchemaTsProperties");function uS(e,t){return t.findIndex(({type:r,namespace:n})=>r===e.type&&n===e.namespace)>-1}o(uS,"getIsCircular");var qe={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation",queryClient:"useQueryClient"},lS={bindings:[qe.query,qe.infiniteQuery,qe.mutation,qe.queryClient],from:"@tanstack/react-query"},Wr={pageParamName:"page"},Gs={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"};var io=o(e=>ur(se(e.operationName)),"getEndpointName");function pS(e,t){return`${t.tsNamespaces?`${K({type:"endpoints",tag:oo(e,t),options:t})}.`:""}${io(e)}`}o(pS,"getImportedEndpointName");var fS=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function oo(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return It(r??t.defaultTag)}o(oo,"getEndpointTag");function Up(e,t,r){return t.parameters.map(n=>{var s,a,c,u;let i="string";if($e(n.zodSchema))i=yr(e,n.zodSchema);else if((s=n.parameterObject)!=null&&s.schema&&je(n.parameterObject.schema)){let l=(c=(a=n.parameterObject)==null?void 0:a.schema)==null?void 0:c.type;l&&Ft(l)&&(i=Zs(l))}return{name:Ot(n.name),type:i,paramType:n.type,required:((u=n.parameterObject)==null?void 0:u.required)??!0,parameterObject:n.parameterObject,bodyObject:n.bodyObject}}).sort((n,i)=>{if(n.required===i.required){let s=["Path","Body","Query","Header"];return s.indexOf(n.paramType)-s.indexOf(i.paramType)}return n.required?-1:1}).filter(n=>r!=="removePageParam"||n.name!==Wr.pageParamName).map(n=>({...n,name:r==="replacePageParam"&&n.name===Wr.pageParamName?"pageParam":n.name}))}o(Up,"mapEndpointParamsToFunctionParams");function dS(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=Vv(i.name)?i.name:`"${i.name}"`,a=Ot(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Np["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Np.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Ot(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(dS,"getEndpointConfig");function vr({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=Zp({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=Zp({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>no(u,e.options),"getEntityName"),options:e.options});return bk(e.options,a,c)}o(vr,"getModelsImports");function mS({tag:e,endpoints:t,options:r}){return Zp({type:"endpoints",tag:e,entities:t,getTag:o(n=>oo(n,r),"getTag"),getEntityName:io,options:r})}o(mS,"getEndpointsImports");function hS({tags:e,entityName:t,getAliasEntityName:r,options:n}){let i=new Map;return e.forEach(s=>{let a=`${t}${r?` as ${r(s)}`:""}`;i.has(s)?n.tsNamespaces||i.get(s).bindings.push(a):i.set(s,{bindings:[n.tsNamespaces?K({type:"acl",tag:s,options:n}):a],from:`${so(n)}${Kr({type:"acl",tag:s,includeTagDir:!0,options:n})}`})}),Array.from(i.values())}o(hS,"getAclImports");function so(e){let t=Tp;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${Ip}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${Ip}`,"g"),Tp)),`${t}/`.replace(/\/\//g,"/")}o(so,"getImportPath");function Zp({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?K({type:e,tag:u,options:s}):i(c)],from:`${l?"./":so(s)}${Kr({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(Zp,"getImports");function bk(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:Ce(n.bindings)}))}o(bk,"mergeImports");function zs({fileName:e,extension:t}){return`${e}.${t}`}o(zs,"getFileNameWithExtension");function gS({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${ur(t)}/`:""}${ur(t)}.${i}`:i}o(gS,"getTagFileNameWithoutExtension");function Kr(...e){return gS(...e)}o(Kr,"getTagImportPath");function yS(...e){return`${gS(...e)}.ts`}o(yS,"getTagFileName");var K=o(({type:e,tag:t,options:r})=>`${Z(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function vS(e){return e.standalone?`${so(e)}${Ms.fileName}`:Dv}o(vS,"getAppRestClientImportPath");function SS(e){return e.standalone?`${so(e)}${qs.reactQueryTypes.fileName}`:Lv}o(SS,"getQueryTypesImportPath");var at=o(e=>e.method==="get","isQuery"),Ks=o(e=>e.method!=="get","isMutation"),Ws=o((e,t)=>at(e)&&t.every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery");function Qs(e){return{type:"invalid-schema",message:e}}o(Qs,"getInvalidSchemaError");function bS(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(bS,"getInvalidOperationIdError");function _S(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(_S,"getMissingPathParameterError");function PS(e){return{type:"not-allowed-inline-enum",message:e}}o(PS,"getNotAllowedInlineEnumError");function $S(e){return{type:"not-allowed-circular-schema",message:e}}o($S,"getNotAllowedCircularSchemaError");function ES(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${OS(t,r)}`}}o(ES,"getMissingAclConditionPropertyError");function Gp(e,t,r){return{type:"missing-status-code",message:`Missing status code ${e} in operation ${OS(t,r)}`}}o(Gp,"getMissingStatusCodeError");function OS(e,t){return e.operationId??`${t.method} ${t.path}`}o(OS,"getOperationDescriptor");function Nt({schema:e,meta:t,options:r}){let n=[];ge(e.type).with("string",()=>n.push($k(e))).with("number","integer",()=>n.push(Ok(e))).with("array",()=>n.push(xk(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
73
73
|
`,"\r",`\r
|
|
74
|
-
`].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(_k({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?Pk(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(Nt,"getZodChain");function _k({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(_k,"getZodChainablePresence");function Pk(e){return e.default!==void 0?`default(${ge(e.type).with("number","integer",()=>Qv(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(Pk,"getZodChainableDefault");function $k(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(${Ek(e.pattern)})`),e.format){let r=ge(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($k,"getZodChainableStringValidations");function Ek(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=Yv(e),`/${e}/`}o(Ek,"formatPatternIfNeeded");function Ok(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(Ok,"getZodChainableNumberValidations");function xk(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(xk,"getZodChainableArrayValidations");var Qr=o(e=>e.reduce((t,r)=>t+r,0),"sum");function ie(e,t){if(!t)return e;if(M(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?Oe("oneOf")+ie(e,{...t,type:t.type[0]}):e+Oe("oneOf")+Qr(t.type.map(r=>ie(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?Oe("oneOf")+ie(e,t.oneOf[0]):e+Oe("oneOf")+Qr(t.oneOf.map(r=>ie(0,r)));if(t.anyOf)return t.anyOf.length===1?Oe("anyOf")+ie(e,t.anyOf[0]):e+Oe("anyOf")+Qr(t.anyOf.map(r=>ie(0,r)));if(t.allOf)return t.allOf.length===1?Oe("allOf")+ie(e,t.allOf[0]):e+Oe("allOf")+Qr(t.allOf.map(r=>ie(0,r)));if(!t.type)return e;if(Ft(t.type))return t.enum?e+xS(t)+Oe("enum")+Qr(t.enum.map(r=>ie(0,r))):e+xS(t);if(t.type==="array")return t.items?Oe("array")+ie(e,t.items):Oe("array")+ie(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.additionalProperties)return t.additionalProperties===!0?Oe("record")+ie(e):Oe("record")+ie(e,t.additionalProperties);if(t.properties){let r=Object.values(t.properties);return e+Oe("object")+Qr(r.map(n=>ie(0,n)))}return Oe("empty-object")+ie(e)}return e}o(ie,"getOpenAPISchemaComplexity");function xS(e){return ge(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(xS,"complexityByType");function Oe(e){return ge(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","record","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(Oe,"complexityByComposite");var zp=class zp{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;M(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?`${K({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return ie(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(zp,"ZodSchema");var ao=zp;function Q({schema:e,resolver:t,meta:r,tag:n}){var g;let i=new ao(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(M(e))return wk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=Ik({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=Ak({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=Tk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let f=Nk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let p=kk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let d=t.options.allReadonly?".readonly()":"";if(Hs(e))return e.items?i.assign(`z.array(${Q({...a,schema:e.items}).getCodeString(n,t.options)}${Nt({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let m=e.type?e.type.toLowerCase():void 0;if(m==="object"||e.properties||e.additionalProperties){let y=t.options.additionalPropertiesDefaultValue!==void 0?t.options.additionalPropertiesDefaultValue:!0,S=(e.additionalProperties===null||e.additionalProperties===void 0?y:e.additionalProperties)===!1?"":".passthrough()";if(typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0)return i.assign(`z.record(${Q({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+Nt({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options})})`);let b=e.required&&e.required.length>0,E=t.options.withImplicitRequiredProps?!1:!((g=e.required)!=null&&g.length),P="{}";e.properties&&(P="{ "+Object.entries(e.properties).map(([ae,J])=>{var Gt;let z={...s,isRequired:E?!0:b?(Gt=e.required)==null?void 0:Gt.includes(ae):t.options.withImplicitRequiredProps,name:ae,isParentPartial:E},ve=J;if(M(J)&&t&&(ve=t.getSchemaByRef(J.$ref),!ve))throw new Error(`Schema ${J.$ref} not found`);let Se=Q({...a,schema:J,meta:z}).getCodeString(n,t.options)+Nt({schema:ve,meta:z,options:t.options});return[ae,Se]}).map(([ae,J])=>`${Wv(ae)}: ${J}`).join(", ")+" }");let _=E?".partial()":"",V=t.options.strictObjects?".strict()":"";return i.assign(`z.object(${P})${_}${V}${S}${d}`)}if(!m)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${m}`)}o(Q,"getZodSchema");function wk({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!M(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=Q({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(wk,"getReferenceZodSchema");function Ak({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!je(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=Q({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=>je(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
|
|
74
|
+
`].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(_k({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?Pk(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(Nt,"getZodChain");function _k({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(_k,"getZodChainablePresence");function Pk(e){return e.default!==void 0?`default(${ge(e.type).with("number","integer",()=>Qv(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(Pk,"getZodChainableDefault");function $k(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(${Ek(e.pattern)})`),e.format){let r=ge(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($k,"getZodChainableStringValidations");function Ek(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=Yv(e),`/${e}/`}o(Ek,"formatPatternIfNeeded");function Ok(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(Ok,"getZodChainableNumberValidations");function xk(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(xk,"getZodChainableArrayValidations");var Qr=o(e=>e.reduce((t,r)=>t+r,0),"sum");function ie(e,t){if(!t)return e;if(M(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?Oe("oneOf")+ie(e,{...t,type:t.type[0]}):e+Oe("oneOf")+Qr(t.type.map(r=>ie(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?Oe("oneOf")+ie(e,t.oneOf[0]):e+Oe("oneOf")+Qr(t.oneOf.map(r=>ie(0,r)));if(t.anyOf)return t.anyOf.length===1?Oe("anyOf")+ie(e,t.anyOf[0]):e+Oe("anyOf")+Qr(t.anyOf.map(r=>ie(0,r)));if(t.allOf)return t.allOf.length===1?Oe("allOf")+ie(e,t.allOf[0]):e+Oe("allOf")+Qr(t.allOf.map(r=>ie(0,r)));if(!t.type)return e;if(Ft(t.type))return t.enum?e+xS(t)+Oe("enum")+Qr(t.enum.map(r=>ie(0,r))):e+xS(t);if(t.type==="array")return t.items?Oe("array")+ie(e,t.items):Oe("array")+ie(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.additionalProperties)return t.additionalProperties===!0?Oe("record")+ie(e):Oe("record")+ie(e,t.additionalProperties);if(t.properties){let r=Object.values(t.properties);return e+Oe("object")+Qr(r.map(n=>ie(0,n)))}return Oe("empty-object")+ie(e)}return e}o(ie,"getOpenAPISchemaComplexity");function xS(e){return ge(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(xS,"complexityByType");function Oe(e){return ge(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","record","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(Oe,"complexityByComposite");var zp=class zp{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;M(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?`${K({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return ie(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(zp,"ZodSchema");var ao=zp;function Q({schema:e,resolver:t,meta:r,tag:n}){var g;let i=new ao(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(M(e))return wk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=Ik({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=Ak({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=Tk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let f=Nk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let p=kk({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let d=t.options.allReadonly?".readonly()":"";if(Hs(e))return e.items?i.assign(`z.array(${Q({...a,schema:e.items}).getCodeString(n,t.options)}${Nt({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let m=e.type?e.type.toLowerCase():void 0;if(m==="object"||e.properties||e.additionalProperties){let y=t.options.additionalPropertiesDefaultValue!==void 0?t.options.additionalPropertiesDefaultValue:!0,S=(e.additionalProperties===null||e.additionalProperties===void 0?y:e.additionalProperties)===!1?"":".passthrough()";if(typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0)return i.assign(`z.record(${Q({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+Nt({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options})})`);let b=e.required&&e.required.length>0,E=t.options.withImplicitRequiredProps?!1:!((g=e.required)!=null&&g.length),P="{}";e.properties&&(P="{ "+Object.entries(e.properties).map(([ae,J])=>{var Gt;let z={...s,isRequired:E?!0:b?(Gt=e.required)==null?void 0:Gt.includes(ae):t.options.withImplicitRequiredProps,name:ae,isParentPartial:E},ve=J;if(M(J)&&t&&(ve=t.getSchemaByRef(J.$ref),!ve))throw new Error(`Schema ${J.$ref} not found`);let Se=Q({...a,schema:J,meta:z}).getCodeString(n,t.options)+Nt({schema:ve,meta:z,options:t.options});return[ae,Se]}).map(([ae,J])=>`${Wv(ae)}: ${J}`).join(", ")+" }");let _=E?".partial()":"",V=t.options.strictObjects?".strict()":"";return i.assign(`z.object(${P})${_}${V}${S}${d}`)}if(m==="any")return i.assign("z.any()");if(!m)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${m}`)}o(Q,"getZodSchema");function wk({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!M(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=Q({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(wk,"getReferenceZodSchema");function Ak({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!je(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=Q({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=>je(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
|
|
75
75
|
z.discriminatedUnion("${c}", [${e.oneOf.map(u=>Q({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
|
|
76
76
|
`)}return t.assign(`z.union([${e.oneOf.map(c=>Q({schema:c,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(Ak,"getOneOfZodSchema");function Ik({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!(!je(e)||!Array.isArray(e.type)))return e.type.length===1?Q({schema:{...e,type:e.type[0]},resolver:r,meta:n,tag:i}):t.assign(`z.union([${e.type.map(s=>Q({schema:{...e,type:s},resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(Ik,"getArrayZodSchema");function Tk({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!je(e)||!e.anyOf)return;if(e.anyOf.length===1){let a=Q({schema:e.anyOf[0],resolver:r,meta:n,tag:i});return t.assign(a.getCodeString(i,r.options))}let s=e.anyOf.map(a=>Q({schema:a,resolver:r,meta:n,tag:i})).map(a=>a.getCodeString(i,r.options)).join(", ");return t.assign(`z.union([${s}])`)}o(Tk,"getAnyOfZodSchema");function Nk({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!je(e)||!e.allOf)return;if(e.allOf.length===1){let p=Q({schema:e.allOf[0],resolver:r,meta:n,tag:i});return t.assign(p.getCodeString(i,r.options))}let{patchRequiredSchemaInLoop:s,noRequiredOnlyAllof:a,composedRequiredSchema:c}=eS(e),u=a.map(p=>{let d=Q({schema:p,resolver:r,meta:n,tag:i});return r&&s(p,r.getSchemaByRef.bind(r)),d});c.required.length&&u.push(Q({schema:c,resolver:r,meta:n,tag:i}));let l=u.at(0),f=u.slice(1).map(p=>`merge(${p.getCodeString(i,r.options)})`).join(".");return t.assign(`${l.getCodeString(i,r.options)}.${f}`)}o(Nk,"getAllOfZodSchema");function kk({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!je(e))return;let s=e.type?e.type.toLowerCase():void 0;if(s&&Ft(s)){if(e.enum){if(s==="string")return Rk({schema:e,zodSchema:t,resolver:r,meta:n,tag:i});if(e.enum.some(a=>typeof a=="string"))return t.assign("z.never()");if(e.enum.length===1){let a=e.enum[0];return t.assign(`z.literal(${a===null?"null":a})`)}return t.assign(`z.union([${e.enum.map(a=>`z.literal(${a===null?"null":a})`).join(", ")}])`)}return t.assign(ge(s).with("integer",()=>"z.number()").with("string",()=>ge(e.format).with("binary",()=>"z.instanceof(File)").otherwise(()=>"z.string()")).otherwise(a=>`z.${a}()`))}}o(kk,"getPrimitiveZodSchema");function Rk({resolver:e,schema:t,zodSchema:r,meta:n,tag:i}){var l;if(!je(t))return;let s=Kn(t);if(!e.options.extractEnums)return r.assign(s);let a=e.getEnumZodSchemaDataByCode(s);if(a)return((l=r.meta.parent)==null?void 0:l.ref)===e.getRefByZodSchemaName(a.zodSchemaName)?r.assign(a.code):new ao({$ref:e.getRefByZodSchemaName(a.zodSchemaName)},e,n).inherit(r).assign(s);let c=e.getExtractedEnumZodSchemaDataByCode(s);if(!c)return r.assign(s);if(!c.zodSchemaName||!c.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${s}`);let u=e.options.tsNamespaces&&c.tag!==i?`${K({type:"models",tag:c.tag,options:e.options})}.`:"";return r.assign(`${u}${c.zodSchemaName}`)}o(Rk,"getEnumZodSchema");function Kn(e){var t;return`${ks}([${(t=e.enum)==null?void 0:t.map(r=>r===null?"null":`"${r}"`).join(", ")}])`}o(Kn,"getEnumZodSchemaCode");function Wn({schema:e,zodSchema:t,fallbackName:r,resolver:n,tag:i}){var c;let s=t.getCodeString();if((!$e(s)||t.ref===void 0)&&r){if(t.complexity<Dp)return s;let u=Tt(r,n.options.schemaSuffix);for(;n.getCodeByZodSchemaName(u);){if((c=n.getZodSchemaNamesByCompositeCode(s))!=null&&c.includes(u))return u;if(n.getCodeByZodSchemaName(u)===u)return u;throw new Error(`Can't uniquely resolve zod schema name: ${u}`)}return n.setZodSchema(u,s,i),n.addZodSchemaForCompositeCode(s,t,u,e),u}let a=n.getCodeByZodSchemaName(s);if(!a&&t.ref&&(a=n.getCodeByZodSchemaName(n.getZodSchemaNameByRef(t.ref))),t.ref&&a)return ie(0,n.getSchemaByRef(t.ref))<Dp?n.getCodeByZodSchemaName(s):s;throw new Error(`Invalid ref: ${t.ref}`)}o(Wn,"resolveZodSchemaName");function wS({resolver:e,endpoint:t,operation:r}){let n=r["x-acl"];return n==null?void 0:n.map(i=>{let s=Object.keys(i.conditions??{}).reduce((a,c)=>{let u=Ck({resolver:e,endpoint:t,acl:n,name:c});return u?[...a,u]:(e.validationErrors.push(ES(c,r,t)),a)},[]);return{...i,conditionsTypes:s}})}o(wS,"getEndpointAcl");function Ck({resolver:e,endpoint:t,acl:r,name:n}){var p,d,m,g,y,v,S,b,E,P;let i=(d=(p=r[0])==null?void 0:p.conditions)==null?void 0:d[n];if(!i)return;let s=i.replace(/^\$[^.]*\./,"").split("."),a,c,u,l=0,f=t.parameters.find(({name:_})=>_===s[l]);if(f)c=(m=f.parameterObject)==null?void 0:m.required,a=(g=f.parameterObject)==null?void 0:g.schema,u=`${f.name} ${ur(f.type)} parameter`,l++;else{let _=t.parameters.find(({bodyObject:ae})=>!!ae),q=Object.keys(((y=_==null?void 0:_.bodyObject)==null?void 0:y.content)??{}).find(Ge);q&&(a=(b=(S=(v=_==null?void 0:_.bodyObject)==null?void 0:v.content)==null?void 0:S[q])==null?void 0:b.schema,u=`${at(t)?"query":"mutation"} data`)}for(;a&&l<s.length;){let _=e.resolveObject(a);a=(E=Object.entries(_.properties??{}).find(([q])=>q===s[l]))==null?void 0:E[1],c=((P=_.required)==null?void 0:P.includes(s[l]))??!1,l++}if(a)return{name:n,type:M(a)?void 0:a.type,zodSchemaName:M(a)?e.getZodSchemaNameByRef(a.$ref):void 0,required:c,info:u}}o(Ck,"getEndpointAclConditionPropertyType");function AS({resolver:e,operation:t,operationName:r,isUniqueOperationName:n,tag:i}){var m,g;let s=e.resolveObject(t.requestBody);if(!s)return;let c=Object.keys(s.content??{}).find(Ge);if(!c)return;let u=(g=(m=s.content)==null?void 0:m[c])==null?void 0:g.schema;if(!u)return;let l=Q({schema:u,resolver:e,meta:{isRequired:s.required??!0},tag:i}),f=e.resolveObject(u),p=Wn({schema:f,zodSchema:l,fallbackName:Bs(Gr(r,n,i)),resolver:e,tag:i}),d=Nt({schema:f,meta:l.meta,options:e.options});return{endpointParameter:{name:Fv,type:"Body",description:s.description,zodSchema:p+d,bodyObject:s},requestFormat:c}}o(AS,"getEndpointBody");function IS({resolver:e,param:t,operationName:r,isUniqueOperationName:n,tag:i}){let s=e.resolveObject(t);if(!Uv.includes(s.in))return;let a={};if(s.content){let p=Object.keys(s.content??{}),d=p.find(Ge);if(!d)throw new Error(`Unsupported media type for param ${s.name}: ${p.join(", ")}`);let m=s.content[d];if(!m)throw new Error(`No content with media type for param ${s.name}: ${d}`);a=(m==null?void 0:m.schema)??m}else s.schema&&(a=s.schema);e.options.withDescription&&a&&(a.description=(s.description??"").trim());let c=Q({schema:a,resolver:e,meta:{isRequired:s.in==="path"?!0:s.required??!1},tag:i}),u=e.resolveObject(a),l=Nt({schema:u,meta:c.meta,options:e.options}),f=Wn({schema:u,zodSchema:c.assign(c.getCodeString(i)+l),fallbackName:rS(Gr(r,n,i),s.name),resolver:e,tag:i});return{name:ge(s.in).with("path",()=>Hp(s.name)).otherwise(()=>s.name),type:ge(s.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:f,parameterObject:s}}o(IS,"getEndpointParameter");function NS(e){var r,n,i,s,a;let t=[];for(let c in e.openApiDoc.paths){let u=e.openApiDoc.paths[c],l=gr(u,hr),f=TS(u.parameters??[]);for(let p in l){let d=l[p];if(!d||d.deprecated&&!e.options.withDeprecatedEndpoints)continue;let m=d.operationId&&d.operationId!==Ot(d.operationId);d.operationId&&m&&e.validationErrors.push(bS(d.operationId));let g=Object.entries({...f,...TS(d.parameters??[])}).map(([,P])=>P),y=to({path:c,method:p,operation:d,operationsByTag:e.operationsByTag,options:e.options}),v=e.operationNames.filter(P=>P===y).length<=1,S=Ur(d,e.options),b={method:p,path:Xv(c),operationName:y,description:d.description,summary:d.summary,tags:(r=d.tags)==null?void 0:r.map(It),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[]};if(d.requestBody){let P=AS({resolver:e,operation:d,operationName:y,isUniqueOperationName:v,tag:S});P&&(b.parameters.push(P.endpointParameter),b.requestFormat=P.requestFormat)}for(let P of g){let _=IS({resolver:e,param:P,operationName:y,isUniqueOperationName:v,tag:S});_&&b.parameters.push(_)}let E=jk(b);E.forEach(P=>{b.parameters.push(P)}),E.length>0&&e.validationErrors.push(_S(E,c));for(let P in d.responses){b.responseStatusCodes.push(P);let _=e.resolveObject(d.responses[P]),q=Object.keys(_.content??{}).find(Gn),ae,J;if(q?(b.responseFormat=q,ae=(i=(n=_.content)==null?void 0:n[q])==null?void 0:i.schema):J=Qi,ae){let z=Q({schema:ae,resolver:e,meta:{isRequired:!0},tag:S}),ve=e.resolveObject(ae);J=Wn({schema:ve,zodSchema:z,fallbackName:z.ref?void 0:Us({statusCode:P,operationName:y,isUniqueOperationName:v,tag:S}),resolver:e,tag:S})+Nt({schema:ve,meta:z.meta,options:e.options})}if(J){let z=Number(P);Fs(z)?(b.response=J,b.responseObject=_,b.responseDescription=_.description):P!=="default"&&Vs(z)&&b.errors.push({zodSchema:J,status:z,description:_.description})}}b.response||(b.response=Qi),b.acl=wS({resolver:e,endpoint:b,operation:d}),(s=d.security)!=null&&s[0].Authorization&&!b.responseStatusCodes.includes("401")&&e.validationErrors.push(Gp("401",d,b)),(a=b.acl)!=null&&a[0]&&!b.responseStatusCodes.includes("403")&&e.validationErrors.push(Gp("403",d,b)),t.push(b)}}return t}o(NS,"getEndpointsFromOpenAPIDoc");function TS(e){return Object.fromEntries((e??[]).map(t=>[M(t)?t.$ref:t.name,t]))}o(TS,"getParameters");function jk(e){return[...e.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(r=>r[1]).filter(r=>e.parameters.findIndex(({name:n})=>n===r)===-1).map(r=>qk(r))}o(jk,"getMissingPathParameters");function qk(e){return{name:e,type:"Path",zodSchema:"z.string()",parameterObject:{name:e,required:!0,in:"path",schema:{type:"string"}}}}o(qk,"getPathParameterFromName");function kS(e,t){let r=Mk(e,t),n=Dk(e,r);return{refsDependencyGraph:r,deepDependencyGraph:n}}o(kS,"getOpenAPISchemaDependencyGraph");function Mk(e,t){let r={},n={};return e.forEach(i=>Lk({schema:t(i),fromRef:i,getSchemaByRef:t,visitedRefs:r,refsDependencyGraph:n})),n}o(Mk,"getRefsDependencyGraph");function Dk(e,t){let r={},n={},i=o((s,a)=>{n[a].add(s),t[s]&&a!==s&&t[s].forEach(c=>{let u=`${a}__${c}`;r[u]||(r[u]=!0,i(c,a))})},"visit");return e.forEach(s=>{let a=t[s];a&&(n[s]||(n[s]=new Set),a.forEach(c=>i(c,s)))}),n}o(Dk,"getDeepRefsDependencyGraph");function Lk({schema:e,fromRef:t,getSchemaByRef:r,visitedRefs:n={},refsDependencyGraph:i={}}){let s=o(a=>{if(a.type!=="reference"||!a.data)return;let{schema:c,data:u}=a;if(i[u.fromRef]||(i[u.fromRef]=new Set),i[u.fromRef].add(c.$ref),n[c.$ref])return!0;n[u.fromRef]=!0,Ee(r(c.$ref),{data:{fromRef:c.$ref},onSchema:s})},"onSchema");return Ee(e,{data:{fromRef:t},onSchema:s}),{visitedRefs:n,refsDependencyGraph:i}}o(Lk,"getSchemaRefsDependencyGraph");function Ys(e,t,r){let n=[];return Ee(t,{onSchema:o(s=>{s.type==="reference"?n.push(s.schema):M(s.parentSchema)&&(s.type==="property"||s.type==="additionalProperty"?e.validationErrors.push(Qs(`${r} has both reference and properties`)):s.type==="array"?e.validationErrors.push(Qs(`${r} is both reference and array schema`)):s.type==="composite"&&e.validationErrors.push(Qs(`${r} has both reference and composite keyword`)))},"onSchema")}),n}o(Ys,"getSchemaRefObjs");function RS(e,t){return t.map(i=>Zr(i.$ref)).reduce((i,s)=>{let a=e.dependencyGraph.deepDependencyGraph[s];return[...i,s,...Array.from(a??[])]},[])}o(RS,"getDeepSchemaRefObjs");function co({schema:e,nameSegments:t=[],includeSelf:r,...n}){r&&CS({schema:e,nameSegments:t,...n}),Ee(e,{data:{nameSegments:t},onSchema:o(s=>{var c;if(s.type==="reference")return!0;let a=[...((c=s.data)==null?void 0:c.nameSegments)??[]];(s.type==="property"||s.type==="additionalProperty")&&a.push(s.propertyName),CS({schema:s.schema,nameSegments:[...a],...n})},"onSchema")})}o(co,"updateExtractedEnumZodSchemaData");function CS({resolver:e,schema:t,schemaRef:r,schemaInfo:n,tags:i,nameSegments:s=[]}){if(!t||M(t)||!t.enum)return;let a=Kn(t),c=e.extractedEnumZodSchemaData.find(u=>u.code===a);c?(c.meta.zodSchemaNameSegments.push(s),c.meta.tags.push(...i),c.meta.schemaRefs.push(...r?[r]:[]),c.meta.schemas.push(...t?[t]:[])):e.extractedEnumZodSchemaData.push({code:a,meta:{zodSchemaNameSegments:[s],tags:[...i],schemaRefs:r?[r]:[],schemas:t?[t]:[]}}),e.validationErrors.push(PS(r?`schema ${Zn(r)} property ${s[s.length-1]}`:n??s.join("->")))}o(CS,"handleExtractedEnumZodSchemaDataUpdate");function jS(e){e.extractedEnumZodSchemaData.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(s=>s[s.length-1]).filter(Boolean),i=Ap(n);if(!i)throw new Error(`No common last segment found for enum: ${r.code}`);r.zodSchemaName=Bp(i,e.options.enumSuffix,e.options.schemaSuffix)});let t=0;for(;t<5&&!Kp(e);)Fk(e,t+2),t++;if(Kp(e)||e.extractedEnumZodSchemaData.filter(n=>!MS(e,n)).forEach(n=>{n.zodSchemaName=Bp(n.meta.zodSchemaNameSegments[0].map(i=>Wp(Z(i))).join(""),e.options.enumSuffix,e.options.schemaSuffix)}),!Kp(e))throw new Error("Failed to resolve unique names for enum zod schemas")}o(jS,"resolveExtractedEnumZodSchemaNames");function Kp(e){return e.extractedEnumZodSchemaData.every(t=>MS(e,t))}o(Kp,"allExtractedEnumZodSchemaNamesAreUnique");function Fk(e,t){e.extractedEnumZodSchemaData.forEach(r=>{let n=e.extractedEnumZodSchemaData.filter(({zodSchemaName:i})=>r.zodSchemaName===i);n.length!==1&&Vk(n,t)})}o(Fk,"additionalResolveExtractedEnumZodSchemaName");function Vk(e,t=2){e.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(i=>i[i.length-t]).filter(Boolean);if(n.length===1){let i=[Wp(Z(n[0])),r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=i}else{let i=Ap(n),s=[i?Wp(Z(i)):"",r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=s}})}o(Vk,"suffixWithPreviousSegmentName");function qS(e){e.extractedEnumZodSchemaData.forEach(t=>{let r=Ce(t.meta.tags);t.tag=r.length===1?r[0]:e.options.defaultTag})}o(qS,"resolveExtractedEnumZodSchemaTags");function MS(e,t){return e.extractedEnumZodSchemaData.filter(({zodSchemaName:r})=>t.zodSchemaName===r).length===1}o(MS,"isUnique");function Wp(e){return e.replace(/(Dto|DTO|Response|Request)/g,"")}o(Wp,"sanitizeName");function DS(e){var n;let t={},r={};return Object.entries(((n=e.openApiDoc.components)==null?void 0:n.schemas)??{}).forEach(([i,s])=>{let a=Tt(i,e.options.schemaSuffix);if(!t[a]){let c=e.getTagByZodSchemaName(a),u=e.resolveObject(s);u.enum?r[a]=Kn(u):t[a]=Q({schema:s,resolver:e,tag:c}).getCodeString(c)}}),{zodSchemas:t,enumZodSchemas:r}}o(DS,"getZodSchemasFromOpenAPIDoc");function LS(e){var r;let t=[];return Object.entries(((r=e.openApiDoc.components)==null?void 0:r.schemas)??{}).forEach(([n,i])=>{let s=Tt(n,e.options.schemaSuffix),a=e.resolveObject(i);!t.find(c=>c.zodSchemaName===s)&&a.enum&&t.push({zodSchemaName:s,code:Kn(a)})}),t}o(LS,"getEnumZodSchemasFromOpenAPIDoc");var Qp=class Qp{constructor(t,r){this.openApiDoc=t;this.options=r;this.dependencyGraph=kS(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=LS(this),this.operationsByTag=Gv(t,r),this.operationNames=Jv(t,this.operationsByTag,r),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];operationsByTag={};operationNames=[];extractedEnumZodSchemaData=[];validationErrors=[];get docSchemas(){var t;return((t=this.openApiDoc.components)==null?void 0:t.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(Kv)}getSchemaByRef(t){return this.docSchemas[Zn(t)]}getSchemaDataByRef(t){return this.schemaData.find(r=>r.ref===t)}getZodSchemaNameByRef(t){var n,i;let r=((n=this.getSchemaDataByRef(Zr(t)))==null?void 0:n.zodSchemaName)??((i=this.extractedEnumZodSchemaData.find(s=>s.zodSchemaName===t))==null?void 0:i.zodSchemaName);if(!r)throw new Error(`Zod schema not found for ref: ${t}`);return r}getRefByZodSchemaName(t){var r;return(r=this.schemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.ref}getTagByZodSchemaName(t){var u,l;if(!this.options.splitByTags)return this.options.defaultTag;let r=this.extractedEnumZodSchemaData.find(f=>f.zodSchemaName===t);if(r)return It(r.tag??this.options.defaultTag);let n=this.getRefByZodSchemaName(t),i=n?((u=this.getSchemaDataByRef(n))==null?void 0:u.tags)??[]:[],s=((l=this.zodSchemaData.find(f=>f.zodSchemaName===t))==null?void 0:l.tags)??[],a=Ce(i,s),c=a.length===1?a[0]:this.options.defaultTag;return It(c??this.options.defaultTag)}getCodeByZodSchemaName(t){var r;return(r=this.zodSchemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.code}getZodSchemaNamesByCompositeCode(t){var r;return(r=this.compositeZodSchemaData.find(n=>n.code===t))==null?void 0:r.zodSchemas.map(n=>n.zodSchemaName)}setZodSchema(t,r,n){let i=this.zodSchemaData.find(s=>s.zodSchemaName===t);i?(i.code=r,i.tags=(i.tags??[]).concat(n)):this.zodSchemaData.push({zodSchemaName:t,code:r,tags:[n]})}addZodSchemaForCompositeCode(t,r,n,i){let s={zodSchemaName:n,zodSchema:r,schema:i},a=this.compositeZodSchemaData.find(c=>c.code===t);a?a.zodSchemas.push(s):this.compositeZodSchemaData.push({code:t,zodSchemas:[s]})}getCompositeZodSchemaByZodSchemaName(t){var n;let r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t));return(n=r==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.zodSchema}getSchemaByCompositeZodSchemaName(t){var r,n;return(n=(r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t)))==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.schema}getEnumZodSchemaDataByCode(t){return this.enumZodSchemas.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByCode(t){return this.extractedEnumZodSchemaData.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByName(t){return this.extractedEnumZodSchemaData.find(({zodSchemaName:r})=>r===t)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(t){return this.extractedEnumZodSchemaData.reduce((r,{zodSchemaName:n,meta:i})=>(n&&i.schemaRefs.includes(t)&&r.push(n),r),[])}getZodSchemas(){return this.zodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>({...t,[r]:n}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>r?{...t,[r]:n}:t,{})}resolveObject(t){return M(t)?this.getSchemaByRef(t.$ref):t}isSchemaCircular(t){var r;return(r=this.dependencyGraph.deepDependencyGraph[t])==null?void 0:r.has(t)}getCircularSchemaChain(t,r=t,n=[]){var i,s;return(i=this.dependencyGraph.refsDependencyGraph[r])!=null&&i.has(t)?[...n,r,t]:Array.from(((s=this.dependencyGraph.refsDependencyGraph[r])==null?void 0:s.values())??[]).map(a=>{let c=this.getCircularSchemaChain(t,a,n);return c.length>0?[r,...c]:c}).flat()}getBaseUrl(){var r;let t=(r=this.openApiDoc.servers)==null?void 0:r[0].url;return this.options.baseUrl===""&&t?t:this.options.baseUrl}getZodSchemaObj(t){let r=this.getRefByZodSchemaName(t);if(r)return this.getSchemaByRef(r);let n=this.getSchemaByCompositeZodSchemaName(t);if(n)return n;let i=this.getExtractedEnumZodSchemaDataByName(t);if(i)return i.meta.schemas.reduce((s,a)=>({...s,...this.resolveObject(a)}),{})}initialize(){var t,r,n,i,s;this.schemaRefs.forEach(a=>{let c=Zr(a),u=Zn(c),l=Tt(u,this.options.schemaSuffix);this.schemaData.push({ref:c,name:u,zodSchemaName:l,tags:[]})});for(let a in this.openApiDoc.paths){let c=this.openApiDoc.paths[a],u=gr(c,hr);for(let l in u){let f=u[l];if(!f||f.deprecated&&!this.options.withDeprecatedEndpoints)continue;let p=Ur(f,this.options),d=to({path:a,method:l,operation:f,operationsByTag:this.operationsByTag,options:this.options}),m=this.operationNames.filter(S=>S===d).length<=1,g=se(Gr(d,m,p)),y=[];if((t=f.parameters)==null||t.map(S=>{let b=S,E=b.schema,P=`operation ${f.operationId??a} parameter ${b.name}`;y.push(...Ys(this,E,P)),this.options.extractEnums&&co({resolver:this,schema:E,schemaInfo:P,tags:[p],nameSegments:[g,b.name],includeSelf:!0})}),f.requestBody){let S=this.resolveObject(f.requestBody),E=Object.keys(S.content??{}).find(Ge);if(E){let P=(n=(r=S.content)==null?void 0:r[E])==null?void 0:n.schema,_=`operation ${f.operationId} request body`;y.push(...Ys(this,P,_)),this.options.extractEnums&&co({resolver:this,schema:P,schemaInfo:_,tags:[p],nameSegments:[Bs(g)]})}}for(let S in f.responses){let b=this.resolveObject(f.responses[S]),P=Object.keys(b.content??{}).find(Gn);if(P){let _=(s=(i=b.content)==null?void 0:i[P])==null?void 0:s.schema,V=`operation ${f.operationId} response body`;y.push(...Ys(this,_,V)),this.options.extractEnums&&co({resolver:this,schema:_,schemaInfo:V,tags:[p],nameSegments:[Us({statusCode:S,operationName:d,isUniqueOperationName:m,tag:p})]})}}RS(this,y).forEach(S=>{let b=this.getSchemaDataByRef(S);b&&b.tags.push(p)})}}this.options.extractEnums&&(this.schemaRefs.forEach(a=>{var u;let c=Zr(a);co({resolver:this,schema:this.getSchemaByRef(c),schemaRef:c,tags:((u=this.getSchemaDataByRef(c))==null?void 0:u.tags)??[],nameSegments:[Zn(c)]})}),qS(this),this.handleDuplicateEnumZodSchemas(),jS(this))}handleDuplicateEnumZodSchemas(){let t=this.enumZodSchemas.map(({code:n})=>n),r=this.enumZodSchemas.filter(({code:n})=>t.includes(n));this.schemaData.forEach(n=>{var a;let i=(a=r.find(({zodSchemaName:c})=>c===n.zodSchemaName))==null?void 0:a.code;if(!i)return;let s=this.extractedEnumZodSchemaData.find(({code:c})=>c===i);s&&(n.tags.push(...s.meta.tags??[]),s.meta.schemaRefs.forEach(c=>{this.dependencyGraph.refsDependencyGraph[c]||(this.dependencyGraph.refsDependencyGraph[c]=new Set),this.dependencyGraph.refsDependencyGraph[c].add(n.ref),this.dependencyGraph.deepDependencyGraph[c]||(this.dependencyGraph.deepDependencyGraph[c]=new Set),this.dependencyGraph.deepDependencyGraph[c].add(n.ref)}))}),this.extractedEnumZodSchemaData=this.extractedEnumZodSchemaData.filter(({code:n})=>!t.includes(n))}};o(Qp,"SchemaResolver");var Js=Qp;function FS(e){let t=[],r={};function n(i,s){Array.isArray(s)||(s=[]),s.push(i),r[i]=!0,e[i]&&e[i].forEach(a=>{s.includes(a)||r[a]||n(a,s.slice(0))}),t.includes(i)||t.push(i)}return o(n,"visit"),Object.keys(e).forEach(i=>n(i,[])),t}o(FS,"topologicalSort");function VS(e,t){let r=Object.entries(e),n=r.filter(([i])=>t.includes(i)).sort(([i],[s])=>t.indexOf(i)-t.indexOf(s)).concat(r.filter(([i])=>!t.includes(i)));return Object.fromEntries(n)}o(VS,"sortObjKeysFromArray");function HS(e,t){let r=FS(e.dependencyGraph.deepDependencyGraph).map(i=>e.getZodSchemaNameByRef(i));return VS(t,r)}o(HS,"sortZodSchemasByTopology");function BS(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{let s=e.getRefByZodSchemaName(n);s&&e.isSchemaCircular(s)?(e.validationErrors.push($S(e.getCircularSchemaChain(s).join(" -> "))),r[Tt(n,e.options.schemaSuffix)]=`z.lazy(() => ${i})`):r[Tt(n,e.options.schemaSuffix)]=i}),r}o(BS,"wrapCircularZodSchemas");function Xs(e,t){let r=new Js(e,t),n=NS(r),i=DS(r),s={...i.zodSchemas,...r.getZodSchemas(),...i.enumZodSchemas};return s=BS(r,s),s=HS(r,s),s={...r.getExtractedEnumZodSchemas(),...s},{resolver:r,data:Hk({resolver:r,endpoints:n,zodSchemas:s,options:t})}}o(Xs,"getDataFromOpenAPIDoc");function Hk({resolver:e,endpoints:t,zodSchemas:r,options:n}){let i=new Map;return n.splitByTags?(t.forEach(s=>{let a=oo(s,n);US(a,i).endpoints.push(s)}),Object.entries(r).forEach(([s,a])=>{let c=e.getTagByZodSchemaName(s);c&&(US(c,i).zodSchemas[s]=a)}),i):(i.set(n.defaultTag,{endpoints:t,zodSchemas:r}),i)}o(Hk,"splitDataByTags");function US(e,t){return t.has(e)||t.set(e,{endpoints:[],zodSchemas:{}}),t.get(e)}o(US,"getTagElement");async function ZS(e,t){let{resolver:r,data:n}=await Xs(e,t),i=[],s=[];return n.forEach(({endpoints:c,zodSchemas:u},l)=>{var d;((d=t.excludeTags)==null?void 0:d.findIndex(m=>m.toLowerCase()===l.toLowerCase()))===-1&&(Object.keys(u).forEach(m=>{let g=r.getRefByZodSchemaName(m),y=g?r.getSchemaByRef(g):r.getSchemaByCompositeZodSchemaName(m),v=zn({zodSchemaName:m,schema:y,resolver:r}),S;y&&(S=zr({schema:y,parentTypes:[v],resolver:r})),i.push({...v,metaType:"primitive",...S})}),c.forEach(m=>{let g="queries",y=It(l);s.push({name:Cs(m),importPath:Kr({type:g,tag:y,includeTagDir:!0,options:t}),namespace:t.tsNamespaces?K({type:g,tag:y,options:t}):void 0,isQuery:at(m),isMutation:Ks(m),params:Bk({resolver:r,endpoint:m}),response:Uk({resolver:r,endpoint:m})})}))}),{openApiDoc:e,models:i,queries:s}}o(ZS,"getMetadataFromOpenAPIDoc");function Bk({resolver:e,endpoint:t}){return t.parameters.map(r=>{var a,c,u,l;let n;if((a=r.parameterObject)!=null&&a.schema)n=e.resolveObject(r.parameterObject.schema);else if(r.bodyObject){let p=Object.keys(r.bodyObject.content??{}).find(Ge);p&&(n=e.resolveObject((u=(c=r.bodyObject.content)==null?void 0:c[p])==null?void 0:u.schema))}let i=zn({zodSchemaName:r.zodSchema,schema:n,resolver:e}),s;return n&&(s=zr({schema:n,parentTypes:[i],resolver:e})),{name:Ot(r.name),isRequired:((l=r.parameterObject)==null?void 0:l.required)??!0,...i,...s,paramType:r.type}}).sort((r,n)=>{if(r.isRequired===n.isRequired){let i=["Path","Body","Query","Header"];return i.indexOf(r.paramType)-i.indexOf(n.paramType)}return r.isRequired?-1:1}).map(({paramType:r,...n})=>n)}o(Bk,"getQueryMetadataParams");function Uk({resolver:e,endpoint:t}){var a,c,u,l;let r,n=Object.keys(((a=t.responseObject)==null?void 0:a.content)??{}).find(Gn);n&&(r=e.resolveObject((l=(u=(c=t.responseObject)==null?void 0:c.content)==null?void 0:u[n])==null?void 0:l.schema));let i=zn({zodSchemaName:t.response,schema:r,resolver:e}),s;return r&&(s=zr({schema:r,parentTypes:[i],resolver:e})),{...i,metaType:"primitive",...s}}o(Uk,"getQueryMetadataResponse");var GS={fileName:"acl/app.ability",extension:"ts"},uo="AllAbilities",ct={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subject:"subject"},Yp={bindings:[ct.abilityTuple,ct.pureAbility,ct.forcedSubject,ct.subject],from:"@casl/ability"};var zS=o(e=>`Use${Z(se(e.operationName))}Ability`,"getAbilityTypeName"),KS=o(e=>`canUse${Z(se(e.operationName))}`,"getAbilityFunctionName"),WS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),QS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),YS=o(e=>{var t;return!!((t=Jp(e))!=null&&t.length)},"hasAbilityConditions"),Jp=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),JS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),ea=o(e=>`${Z(e)}${uo}`,"getTagAllAbilitiesName");var zf=mt(_r());var Zf=mt(require("fs")),B_=mt(require("path"));function U_(e){return Zf.default.readFileSync(B_.default.join(__dirname,`../${e}`),"utf-8")}o(U_,"readFileSync");function Gf(e){let t=`src/generators/templates/${e}.hbs`;return U_(t)}o(Gf,"readHbsTemplateSync");function Z_(e){let t=`src/assets/${e}`;return U_(t)}o(Z_,"readAssetSync");function Eo({output:e,fileName:t}){return`${e}/${t}`}o(Eo,"getOutputFileName");var Zt=mt(_r());function G_(){q3(),M3(),D3(),L3(),F3(),V3(),H3(),B3()}o(G_,"registerAclHbsHelpers");function q3(){Zt.default.registerHelper("abilityTypeName",zS)}o(q3,"registerAbilityTypeNameHelper");function M3(){Zt.default.registerHelper("abilityFunctionName",KS)}o(M3,"registerAbilityFunctionNameHelper");function D3(){Zt.default.registerHelper("ablityAction",WS)}o(D3,"registerAbilityActionHelper");function L3(){Zt.default.registerHelper("ablitySubject",QS)}o(L3,"registerAbilitySubjectHelper");function F3(){Zt.default.registerHelper("hasAbilityConditions",YS)}o(F3,"registerHasAbilityConditionsHelper");function V3(){Zt.default.registerHelper("abilityConditionsTypes",Jp)}o(V3,"registerAbilityConditionsTypesHelper");function H3(){Zt.default.registerHelper("abilityDescription",JS)}o(H3,"registerAbilityDescriptionHelper");function B3(){Zt.default.registerHelper("tagAllAbilitiesName",ea)}o(B3,"registerTagAllAbilitiesNameHelper");var Oo=mt(_r());function z_(){U3(),Z3(),G3(),z3()}o(z_,"registerCommonHbsHelpers");function U3(){Oo.default.registerHelper("isEqual",(e,t)=>e===t)}o(U3,"registerIsEqualHelper");function Z3(){Oo.default.registerHelper("commaSeparated",e=>e.join(", "))}o(Z3,"registerCommaSeparatedListHelper");function G3(){Oo.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
|
|
77
77
|
*`))}o(G3,"registerAddAsteriskAfterNewLineHelper");function z3(){Oo.default.registerHelper("jsonStringify",e=>JSON.stringify(e,null,2))}o(z3,"registerJsonStringifyHelper");var Pr=mt(_r());function K_(e){K3(),W3(e.options),J3(e),Q3(),Y3(),X3(e),ej()}o(K_,"registerEndpointsHbsHelpers");function K3(){Pr.default.registerHelper("endpointName",io)}o(K3,"registerEndpointNameHelper");function W3(e){Pr.default.registerHelper("importedEndpointName",t=>pS(t,e))}o(W3,"registerImportedEndpointNameHelper");function Q3(){Pr.default.registerHelper("endpointPath",fS)}o(Q3,"registerEndpointPathHelper");function Y3(){Pr.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(Y3,"registerEndpointBodyHelper");function J3(e){Pr.default.registerHelper("endpointParams",(t,r)=>Up(e,t,r))}o(J3,"registerEndpointParamsHelper");function X3(e){Pr.default.registerHelper("endpointArgs",(t,r)=>Up(e,t,r).map(n=>n.name).join(", "))}o(X3,"registerEndpointArgsHelper");function ej(){Pr.default.registerHelper("endpointParamDescription",e=>{var s,a,c,u,l;let t=[`${e.paramType} parameter`],r=((s=e.parameterObject)==null?void 0:s.description)||((a=e.bodyObject)==null?void 0:a.description);r&&t.push(r);let n,i;if((c=e.parameterObject)!=null&&c.schema&&je(e.parameterObject.schema)&&(n=(u=e.parameterObject)==null?void 0:u.schema),(l=e.bodyObject)!=null&&l.content){let p=Object.keys(e.bodyObject.content??{}).find(Ge);p&&(i=e.bodyObject.content[p],i.schema&&je(i.schema)&&(n=i.schema))}if(n){let f=ro(n);t.push(...f)}return i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(ej,"registerEndpointParamDescriptionHelper");var lt=mt(_r());function W_(e){tj(),rj(),nj(),ij(),oj(e),sj(),aj(),cj(),uj(),lj()}o(W_,"registerPartialsHbsHelpers");function tj(){lt.default.registerHelper("genModelJsDocs",(e,t,r)=>pt("model-js-docs")({name:e,zodSchema:t,tag:r}))}o(tj,"registerGenerateModelJsDocsHelper");function rj(){lt.default.registerHelper("genImport",e=>pt("import")({import:e}))}o(rj,"registerImportHelper");function nj(){lt.default.registerHelper("genEndpointParams",(e,t)=>pt("endpoint-params")({endpoint:e,extra:t}))}o(nj,"registerGenerateEndpointParamsHelper");function ij(){lt.default.registerHelper("genEndpointConfig",e=>{let t=dS(e);return Object.keys(t).length===0?"":pt("endpoint-config")({endpointConfig:t})})}o(ij,"registerGenerateEndpointConfigHelper");function oj(e){lt.default.registerHelper("genQueryKeys",(t,r)=>t.length===0?"":pt("query-keys")({queryEndpoints:t,namespace:r,generateInfiniteQueries:e.options.infiniteQueries}))}o(oj,"registerGenerateQueryKeysHelper");function sj(){lt.default.registerHelper("genQuery",(e,t)=>{let r,n;return at(e)?(r="query-use-query",n=qe.query):(r="query-use-mutation",n=qe.mutation),pt(r)({endpoint:e,queryEndpoints:t,queryHook:n})})}o(sj,"registerGenerateQueryHelper");function aj(){lt.default.registerHelper("genInfiniteQuery",e=>pt("query-use-infinite-query")({endpoint:e,infiniteQueryHook:qe.infiniteQuery,pageParamName:Gs.pageParamName,totalItemsName:Gs.totalItemsName,limitParamName:Gs.limitParamName}))}o(aj,"registerGenerateInfiniteQueryHelper");function cj(){lt.default.registerHelper("genQueryJsDocs",(e,t)=>pt("query-js-docs")({endpoint:e,infiniteQuery:t==="infiniteQuery"}))}o(cj,"registerGenerateQueryJsDocsHelper");function uj(){lt.default.registerHelper("genCaslAbilityType",e=>pt("casl-ability-type")({endpoint:e,abilityTupleType:ct.abilityTuple}))}o(uj,"registerGenerateCaslAbilityTypeHelper");function lj(){lt.default.registerHelper("genCaslAbilityFunction",e=>pt("casl-ability-function")({endpoint:e}))}o(lj,"registerGenerateCaslAbilityFunctionHelper");var xo=mt(_r());function Q_(){pj(),dj(),fj(),mj()}o(Q_,"registerQueryHbsHelpers");function pj(){xo.default.registerHelper("queryName",Cs)}o(pj,"registerQueryNameHelper");function fj(){xo.default.registerHelper("infiniteQueryName",Mv)}o(fj,"registerInfiniteQueryNameHelper");function dj(){xo.default.registerHelper("isQuery",at)}o(dj,"registerIsQueryHelper");function mj(){xo.default.registerHelper("isInfiniteQuery",e=>Ws(e,Object.values(Wr)))}o(mj,"registerIsInfiniteQueryHelper");var nn=mt(_r());function Y_(e){hj(e.options),gj(e),yj(e),vj(),Sj(),bj(e)}o(Y_,"registerZodHbsHelpers");function hj(e){nn.default.registerHelper("zodInferedType",t=>no(t,e))}o(hj,"registerInferedTypeHelper");function gj(e){nn.default.registerHelper("importedZodSchemaName",t=>nS(e,t))}o(gj,"registerImportedZodSchemaNameHelper");function yj(e){nn.default.registerHelper("importedZodSchemaInferedType",t=>yr(e,t))}o(yj,"registerImportedZodSchemaInferedTypeHelper");function vj(){nn.default.registerHelper("zodSchemaType",e=>iS(e))}o(vj,"registerZodSchemaTypeHelper");function Sj(){nn.default.registerHelper("zodSchemaDescription",e=>oS(e))}o(Sj,"registerZodSchemaDescriptionHelper");function bj(e){nn.default.registerHelper("zodSchemaPropertyDescriptions",(t,r)=>aS(e,t,r))}o(bj,"registerZodSchemaPropertyDescriptionsHelper");function ft(e,t){let r=Gf(t);return z_(),Y_(e),K_(e),Q_(),G_(),W_(e),zf.default.compile(r)}o(ft,"getHbsTemplateDelegate");function pt(e){let t=Gf(`partials/${e}`);return zf.default.compile(t)}o(pt,"getHbsPartialTemplateDelegate");function J_({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints.filter(({acl:f})=>f&&f.length>0);if(!n||n.length===0)return;let i=n.some(({acl:f})=>(f==null?void 0:f[0].conditions)&&Object.keys(f[0].conditions).length>0),s={...Yp,bindings:[ct.abilityTuple,...i?[ct.forcedSubject,ct.subject]:[]]},a=n.reduce((f,p)=>{var m,g;let d=(g=(m=p.acl)==null?void 0:m[0].conditionsTypes)==null?void 0:g.reduce((y,v)=>[...y,...v!=null&&v.zodSchemaName?[v.zodSchemaName]:[]],[]);return[...f,...d??[]]},[]),c=vr({resolver:e,tag:r,zodSchemasAsTypes:Ce(a)});return ft(e,"acl")({caslAbilityTupleImport:s,modelsImports:c,includeNamespace:e.options.tsNamespaces,namespace:K({type:"acl",tag:r,options:e.options}),endpoints:n})}o(J_,"generateAcl");function X_(e,t){if(!t||t.length===0)return;let r={...Yp,bindings:[ct.pureAbility]},n=hS({tags:t,entityName:uo,getAliasEntityName:ea,options:e.options}),i=t.map(a=>K({type:"acl",tag:a,options:e.options}));return ft(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:uo,includeNamespace:e.options.tsNamespaces,tags:t,namespaces:i})}o(X_,"generateAppAcl");function e2({resolver:e,data:t,tag:r=""}){var f;let n=(f=t.get(r))==null?void 0:f.endpoints;if(!n||n.length===0)return;let i={bindings:[Ji],from:vS(e.options)},s=n.map(p=>p.response),a=s.some(p=>!$e(p)),c=n.reduce((p,d)=>[...p,...d.parameters],[]),u=vr({resolver:e,tag:r,zodSchemas:Ce(s.filter($e)),zodSchemasAsTypes:Ce(c.map(p=>p.zodSchema).filter($e))});return ft(e,"endpoints")({appRestClientImport:i,hasZodImport:a,zodImport:Rs,modelsImports:u,includeNamespace:e.options.tsNamespaces,namespace:K({type:"endpoints",tag:r,options:e.options}),restClientName:Ji,endpoints:n})}o(e2,"generateEndpoints");function t2(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(r2(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(t2,"getZodSchemaRefs");function r2(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&r2(n).forEach(s=>r.add(s)),r},new Set)}o(r2,"getSchemaRefs");function n2({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((l,f)=>[...l,...t2(e,f)],[]).filter(l=>!n[l]),s=vr({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((l,[f,p])=>{let d=e.getRefByZodSchemaName(f);return{...l,[f]:{code:p,isCircular:!!d&&e.isSchemaCircular(d),isEnum:tS(p),schemaObj:e.getZodSchemaObj(f)}}},{});return ft(e,"models")({zodImport:Rs,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:K({type:"models",tag:r,options:e.options}),tag:r,zodSchemasData:a})}o(n2,"generateModels");function i2({resolver:e,data:t,tag:r=""}){var m;let n=(m=t.get(r))==null?void 0:m.endpoints;if(!n||n.length===0)return;let i=n.filter(at),s=i.filter(g=>Ws(g,Object.values(Wr))),a=n.filter(Ks),c={...lS,bindings:[...i.length>0?[qe.query]:[],...e.options.infiniteQueries&&s.length>0?[qe.infiniteQuery]:[],...a.length>0?[qe.mutation]:[],...i.length>0&&a.length>0?[qe.queryClient]:[]]},u={bindings:[...i.length>0?[js.query]:[],...e.options.infiniteQueries&&s.length>0?[js.infiniteQuery]:[],...a.length>0?[js.mutation]:[]],from:SS(e.options)},l=n.reduce((g,y)=>[...g,...y.parameters],[]),f=vr({resolver:e,tag:r,zodSchemasAsTypes:Ce(l.map(g=>g.zodSchema).filter($e))}),p=mS({tag:r,endpoints:n,options:e.options});return ft(e,"queries")({queryImport:c,queryTypesImport:u,modelsImports:f,endpointsImports:p,includeNamespace:e.options.tsNamespaces,namespace:K({type:"queries",tag:r,options:e.options}),endpoints:n,queryEndpoints:i,generateInfiniteQueries:e.options.infiniteQueries})}o(i2,"generateQueries");function o2(e){return ft(e,"app-rest-client")({appRestClientName:Ji,baseUrl:e.getBaseUrl()})}o(o2,"generateAppRestClient");function s2(e,t){let r=t.standalone&&t.importPath==="ts"?"relative":t.importPath,n={...Yi,...t,importPath:r},{resolver:i,data:s}=Xs(e,n),a=[],c=[],u=["models","endpoints","queries","acl"],l={models:n2,endpoints:e2,queries:i2,acl:J_};s.forEach((p,d)=>{n.excludeTags.find(g=>g.toLowerCase()===d.toLowerCase())||u.forEach(g=>{let y=l[g]({resolver:i,data:s,tag:d});if(y){let v=Eo({output:n.output,fileName:yS({tag:d,type:g,options:n})});a.push({fileName:v,content:y}),g==="acl"&&c.push(d)}})});let f=X_(i,c);if(f){let p=Eo({output:n.output,fileName:zs(GS)});a.push({fileName:p,content:f})}return n.standalone&&a.push(..._j(i)),a}o(s2,"generateCodeFromOpenAPIDoc");function _j(e){let t=[];return Object.values(qs).forEach(r=>{let n=zs(r);t.push({fileName:Eo({output:e.options.output,fileName:n}),content:Z_(n)})}),t.push({fileName:Eo({output:e.options.output,fileName:zs(Ms)}),content:o2(e)}),t}o(_j,"getStandaloneFiles");async function Pj({input:e,options:t}){let r={...Yi,...t},n=await Kf.default.bundle(e);return await ZS(n,r)}o(Pj,"getGenerateMetadata");async function $j({input:e,options:t}){let r={...Yi,...t},n=await Kf.default.bundle(e);return s2(n,r)}o($j,"getGenerateFilesData");0&&(module.exports={getGenerateFilesData,getGenerateMetadata});
|
package/dist/sh.js
CHANGED
|
@@ -137,9 +137,9 @@ ${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(My,"stringEncaseCRLFWithFirstIndex");var{stdout:qy,stderr:Dy}=Ny,sf=Symbol("GENERATOR"),oo=Symbol("STYLER"),ds=Symbol("IS_EMPTY"),Ly=["ansi","ansi","ansi256","ansi16m"],so=Object.create(null),iw=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=qy?qy.level:0;e.level=t.level===void 0?r:t.level},"applyOptions"),uf=class uf{constructor(t){return Fy(t)}};o(uf,"Chalk");var sc=uf,Fy=o(e=>{let t=o((...r)=>r.join(" "),"chalk");return iw(t,e),Object.setPrototypeOf(t,hs.prototype),t},"chalkFactory");function hs(e){return Fy(e)}o(hs,"createChalk");Object.setPrototypeOf(hs.prototype,Function.prototype);for(let[e,t]of Object.entries(br))so[e]={get(){let r=ac(this,cf(t.open,t.close,this[oo]),this[ds]);return Object.defineProperty(this,e,{value:r}),r}};so.visible={get(){let e=ac(this,this[oo],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var af=o((e,t,r,...n)=>e==="rgb"?t==="ansi16m"?br[r].ansi16m(...n):t==="ansi256"?br[r].ansi256(br.rgbToAnsi256(...n)):br[r].ansi(br.rgbToAnsi(...n)):e==="hex"?af("rgb",t,r,...br.hexToRgb(...n)):br[r][e](...n),"getModelAnsi"),ow=["rgb","hex","ansi256"];for(let e of ow){so[e]={get(){let{level:r}=this;return function(...n){let i=cf(af(e,Ly[r],"color",...n),br.color.close,this[oo]);return ac(this,i,this[ds])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);so[t]={get(){let{level:r}=this;return function(...n){let i=cf(af(e,Ly[r],"bgColor",...n),br.bgColor.close,this[oo]);return ac(this,i,this[ds])}}}}var sw=Object.defineProperties(()=>{},{...so,level:{enumerable:!0,get(){return this[sf].level},set(e){this[sf].level=e}}}),cf=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"),ac=o((e,t,r)=>{let n=o((...i)=>aw(n,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(n,sw),n[sf]=e,n[oo]=t,n[ds]=r,n},"createBuilder"),aw=o((e,t)=>{if(e.level<=0||!t)return e[ds]?"":t;let r=e[oo];if(r===void 0)return t;let{openAll:n,closeAll:i}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=ky(t,r.close,r.open),r=r.parent;let s=t.indexOf(`
|
|
140
|
-
`);return s!==-1&&(t=My(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(hs.prototype,so);var GF=hs(),ZF=hs({level:Dy?Dy.level:0});var Dr=new sc;function ms(e,t,r){console.log(r!==void 0&&r!==t?`${Dr.yellow(`${e}:`.padEnd(20))}${Dr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(ms,"logVariable");function ir(e){console.log(`[INFO] ${e}`)}o(ir,"logInfo");function On(e){console.log(Dr.green(`[SUCCESS] ${e}`))}o(On,"logSuccess");function gs(e,t){e instanceof Error?(console.log(Dr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Dr.red(`[ERROR] ${e}`))}o(gs,"logError");function cc(e){console.log(Dr.bgYellow(`==== ${e} ====`))}o(cc,"logBanner");var Vy=yt(require("fs"));function ao(){return"0.6.0"}o(ao,"getVersion");var s6=yt(Hy());var lf=Symbol("options_key");function Ge(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(lf,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(lf,s,t)}}}o(Ge,"YargOption");function Uy(e){let t=Reflect.getMetadata(lf,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Uy,"getYargsOption");function uc(e){return async t=>t.options(cw(e)).middleware(async r=>await uw(e,r),!0)}o(uc,"getBuilder");function cw(e){return Object.entries(Uy(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(cw,"getYargsOptions");async function uw(e,t){let r=new e;for(let[n,i]of Object.entries(Uy(e)))r[n]=t[n]??i.default;return r}o(uw,"loadYargsConfig");var HE=yt(em());var vO="Schema",_O="Enum",SO="Body",PO="Param",OO="Response",EO="ErrorResponse",aa="z.void()",mu="z.enum",gu={bindings:["z"],from:"zod"};var yu={input:"input.yaml",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},standalone:!1,baseUrl:"",schemaSuffix:vO,enumSuffix:_O,withDefaultValues:!0,additionalPropertiesDefaultValue:!1,extractEnums:!0,removeOperationPrefixEndingWith:"Controller_",infiniteQueries:!0};var $O={"invalid-schema":"Invalid 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 Status Codes"};var tm={"Content-Type":"application/json",Accept:"application/json"},wO="data";var xO=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Fn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");var ln=Symbol.for("@ts-pattern/matcher"),iq=Symbol.for("@ts-pattern/isVariadic"),vu="@ts-pattern/anonymous-select-key",rm=o(e=>!!(e&&typeof e=="object"),"r"),bu=o(e=>e&&!!e[ln],"i"),Qr=o((e,t,r)=>{if(bu(e)){let n=e[ln](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(rm(e)){if(!rm(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];bu(c)&&c[iq]?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)=>Qr(l,a[p],r))&&i.every((l,p)=>Qr(l,c[p],r))&&(s.length===0||Qr(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Qr(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||bu(s=i)&&s[ln]().matcherType==="optional")&&Qr(i,t[n],r);var s})}return Object.is(t,e)},"s"),zn=o(e=>{var t,r,n;return rm(e)?bu(e)?(t=(r=(n=e[ln]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?ua(e,zn):ua(Object.values(e),zn):[]},"o"),ua=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function fr(e){return Object.assign(e,{optional:o(()=>oq(e),"optional"),and:o(t=>Fe(e,t),"and"),or:o(t=>sq(e,t),"or"),select:o(t=>t===void 0?AO(e):AO(t,e),"select")})}o(fr,"u");function oq(e){return fr({[ln]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(zn(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Qr(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>zn(e),"getSelectionKeys"),matcherType:"optional"})})}o(oq,"h");function Fe(...e){return fr({[ln]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Qr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ua(e,zn),"getSelectionKeys"),matcherType:"and"})})}o(Fe,"m");function sq(...e){return fr({[ln]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return ua(e,zn).forEach(i=>n(i,void 0)),{matched:e.some(i=>Qr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ua(e,zn),"getSelectionKeys"),matcherType:"or"})})}o(sq,"d");function Oe(e){return{[ln]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(Oe,"p");function AO(...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 fr({[ln]:()=>({match:o(n=>{let i={[t??vu]:n};return{matched:r===void 0||Qr(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??vu].concat(r===void 0?[]:zn(r)),"getSelectionKeys")})})}o(AO,"y");function Kr(e){return typeof e=="number"}o(Kr,"v");function Vn(e){return typeof e=="string"}o(Vn,"b");function Bn(e){return typeof e=="bigint"}o(Bn,"w");var w9=fr(Oe(function(e){return!0}));var Hn=o(e=>Object.assign(fr(e),{startsWith:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>Hn(Fe(e,(r=>Oe(n=>Vn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>Hn(Fe(e,(r=>Oe(n=>Vn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>Hn(Fe(e,(r=>Oe(n=>Vn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&!!n.match(r)))));var r},"regex")}),"j"),x9=Hn(Oe(Vn)),Yr=o(e=>Object.assign(fr(e),{between:o((t,r)=>Yr(Fe(e,((n,i)=>Oe(s=>Kr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n<r))(t))),"lt"),gt:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n>r))(t))),"gt"),lte:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n<=r))(t))),"lte"),gte:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n>=r))(t))),"gte"),int:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&Number.isInteger(t)))),"int"),finite:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&t>0))),"positive"),negative:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&t<0))),"negative")}),"x"),A9=Yr(Oe(Kr)),Un=o(e=>Object.assign(fr(e),{between:o((t,r)=>Un(Fe(e,((n,i)=>Oe(s=>Bn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n<r))(t))),"lt"),gt:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n>r))(t))),"gt"),lte:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n<=r))(t))),"lte"),gte:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n>=r))(t))),"gte"),positive:o(()=>Un(Fe(e,Oe(t=>Bn(t)&&t>0))),"positive"),negative:o(()=>Un(Fe(e,Oe(t=>Bn(t)&&t<0))),"negative")}),"A"),I9=Un(Oe(Bn)),C9=fr(Oe(function(e){return typeof e=="boolean"})),j9=fr(Oe(function(e){return typeof e=="symbol"})),T9=fr(Oe(function(e){return e==null})),R9=fr(Oe(function(e){return e!=null}));var sm=class sm 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(sm,"W");var nm=sm,im={matched:!1,value:void 0};function Ot(e){return new om(e,im)}o(Ot,"z");var ca=class ca{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=>Qr(l,this.input,c))||i&&!i(this.input)?im:{matched:!0,value:r(s?vu in a?a[vu]:a:this.input,this.input)};return new ca(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new ca(this.input,n?{matched:!0,value:r(this.input,this.input)}:im)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new nm(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(ca,"I");var om=ca;var am=["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"];var cm=2,IO=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],CO=["query","header","path"],Gn=["get","put","post","delete","options","head","patch","trace"],jO=["string","number","integer","boolean"],la=["allOf","anyOf","oneOf"];function Zn(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(Zn,"pick");var Ve=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Wn=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),TO=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ft=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),RO=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),um=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),NO=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),aq=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"),lm=o(e=>{let t=e.map(Ve).map(kO).map(r=>cq(r)).flat();return aq(t)},"getMostCommonAdjacentCombinationSplit"),kO=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),MO=o(e=>kO(e).join(" "),"camelToSpaceSeparated"),cq=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"),qO=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${Wn(r)}|${Ve(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");function Kn(e){return RO(e)}o(Kn,"formatTag");function Mi(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Kn(r??t.defaultTag)}o(Mi,"getOperationTag");function DO(e,t){let r={};for(let n in e.paths){let i=e.paths[n],s=Zn(i,Gn);for(let a in s){let c=s[a];if(!c||c.deprecated&&!t.withDeprecatedEndpoints)continue;let u=t.splitByTags?Mi(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(DO,"getOperationsByTag");var FO=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),qi=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),Zo=o(e=>qi(e).split("/").at(-1),"getSchemaNameByRef");function Ee(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(Ee,"isReferenceObject");function dm(e){let t=uq(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ft(t)}o(dm,"normalizeString");function VO(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(VO,"wrapWithQuotesIfNeeded");function BO(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(BO,"unwrapQuotesIfNeeded");function uq(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(uq,"prefixStringStartingWithNumberIfNeeded");function hm(e){let t=e.replaceAll("_","#");return ft(t.replaceAll("-","_")).replaceAll("#","_")}o(hm,"pathParamToVariableName");var Di=o(e=>jO.includes(e),"isPrimitiveType");function HO(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(HO,"escapeControlCharacters");function Jr(e){return e.includes("application/")&&e.includes("json")||IO.includes(e)||e.includes("text/")}o(Jr,"isParamMediaTypeAllowed");function _u(e){return e>=200&&e<300}o(_u,"isMainResponseStatus");function Su(e){return!(e>=200&&e<300)}o(Su,"isErrorStatus");function Pu(e){return e==="application/json"}o(Pu,"isMediaTypeAllowed");function fm({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${fq(e)}`,u=r.operationId?Fn(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((p,f)=>f===0?p:Ve(p)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=qO(u,i);am.includes(l)||(u=l)}return am.includes(u)?c:u}o(fm,"getOperationName");function fa({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?Mi(r,n):n.defaultTag,s=o(a=>{let c=fm({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>fm({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??fm({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(fa,"getUniqueOperationName");function UO(e,t,r){let n=[];for(let i in e.paths){let s=e.paths[i],a=Zn(s,Gn);for(let c in a){let u=a[c];if(!u||u.deprecated&&!r.withDeprecatedEndpoints)continue;let l=fa({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(UO,"getUniqueOperationNamesWithoutSplitByTags");var LO=/({\w+})/g,lq=/[^\w\-]+/g;function fq(e){e=Ve(TO(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(LO)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(LO,"")}By${Ve(r.slice(1,-1))}`}return e.replace(lq,"_")}o(fq,"pathToVariableName");var pm=/{(\b\w+(?:-\w+)*\b)}/g;function zO(e){let t=e.match(pm);return t===null?e.replaceAll(pm,":$1"):(t.forEach(r=>{let n=hm(r.replaceAll(pm,":$1"));e=e.replaceAll(r,n)}),e)}o(zO,"replaceHyphenatedPath");function Gt(e){return!Ee(e)}o(Gt,"isSchemaObject");function Ou(e){return e.type==="array"}o(Ou,"isArraySchemaObject");function GO(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(pq(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(Ee(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(GO,"inferRequiredSchema");var pq=o(e=>!Ee(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var pa="AppRestClient",Eu={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},mm="src/data",gm="@/data",ZO="@/util/rest/clients/app-rest-client",WO="@/types/react-query";var $u={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},wu={fileName:"app-rest-client",extension:"ts"};var Zt=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var Xr=o((e,t)=>um(Ve(dm(e)),t),"getZodSchemaName"),ym=o((e,t,r)=>um(Ve(dm(e)),`${t}${r}`),"getEnumZodSchemaName"),Lt=o(e=>!e.startsWith("z."),"isNamedZodSchema"),KO=o(e=>e.startsWith(mu),"isEnumZodSchema"),Li=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),xu=o(e=>ft(`${e}_${SO}`),"getBodyZodSchemaName"),YO=o((e,t)=>ft(`${e}_${t}${PO}`),"getParamZodSchemaName"),dq=o(e=>ft(`${e}${OO}`),"getMainResponseZodSchemaName"),hq=o((e,t)=>ft(`${e}_${t}_${EO}`),"getErrorResponseZodSchemaName");function Au({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Li(t,r,n);return!_u(i)&&e!=="default"&&Su(i)?hq(s,e):dq(s)}o(Au,"getResponseZodSchemaName");function da(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Ve(MO(i))}: \`${e[i]}\``],[])}o(da,"getSchemaDescriptions");function It(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(Ee(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(la.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&&It(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&&It(a,t);if(i.additionalProperties)for(let[s,a]of Object.entries(i.additionalProperties))!(a instanceof Object)||n({type:"additionalProperty",parentSchema:e,schema:a,data:r,propertyName:s})===!0||It(a,t);if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;It(s,t)}}o(It,"iterateSchema");var ha=o((e,t)=>NO(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),QO=o((e,t)=>Lt(t)?`${e.options.tsNamespaces?`${et({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),Fi=o((e,t,r)=>{if(!Lt(t))return t===aa?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${et({type:"models",tag:n,options:e.options})}.`:""}${ha(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function JO(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(JO,"getZodSchemaType");function XO(e){if(e.schemaObj)return[e.schemaObj.description,...da(e.schemaObj).join(". ")].filter(Boolean)}o(XO,"getZodSchemaDescription");function eE(e,t,r){var n;if(Ee(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?Fi(e,i,r):void 0}if(Ou(t)){if(!Ee(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${Fi(e,i,r)}[]`:void 0}if(la.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return eE(e,i[0],r)}return t.type}o(eE,"getType");function tE(e,t,r){if(!t.schemaObj)return[];let n="[0]",i={},s=o(a=>{var u;if(a.type==="reference")return!0;if(a.type==="composite")return;let c=[...((u=a.data)==null?void 0:u.pathSegments)??[]];if(a.type==="array"?c.push(n):(a.type==="property"||a.type==="additionalProperty")&&c.push(a.propertyName),a.schema&&c[c.length-1]!==n){let l=e.resolveObject(a.schema),p=[l.description,...da(l)].filter(Boolean),f=c.join(".");i[f]&&"type"in a.schema&&a.schema.type==="object"||(delete i[f],i[f]={type:eE(e,a.schema,r)??"unknown",description:p.join(". ")})}return It(a.schema,{data:{pathSegments:[...c]},onSchema:s}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(a=>{if(Ee(a)){let c=e.resolveObject(a);It(c,{data:{pathSegments:[]},onSchema:s})}}),It(t.schemaObj,{data:{pathSegments:[]},onSchema:s}),i}o(tE,"getZodSchemaPropertyDescriptions");function Yn({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=bm({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=bm({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>ha(u,e.options),"getEntityName"),options:e.options});return mq(e.options,a,c)}o(Yn,"getModelsImports");function rE({tag:e,endpoints:t,options:r}){return bm({type:"endpoints",tag:e,entities:t,getTag:o(n=>ya(n,r),"getTag"),getEntityName:ga,options:r})}o(rE,"getEndpointsImports");function nE({tags:e,entityName:t,getAliasEntityName:r,options:n}){let i=new Map;return e.forEach(s=>{let a=`${t}${r?` as ${r(s)}`:""}`;i.has(s)?n.tsNamespaces||i.get(s).bindings.push(a):i.set(s,{bindings:[n.tsNamespaces?et({type:"acl",tag:s,options:n}):a],from:`${ma(n)}${Iu({type:"acl",tag:s,includeTagDir:!0,options:n})}`})}),Array.from(i.values())}o(nE,"getAclImports");function ma(e){let t=gm;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${mm}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${mm}`,"g"),gm)),`${t}/`.replace(/\/\//g,"/")}o(ma,"getImportPath");function bm({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?et({type:e,tag:u,options:s}):i(c)],from:`${l?"./":ma(s)}${Iu({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(bm,"getImports");function mq(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:Zt(n.bindings)}))}o(mq,"mergeImports");function Cu({fileName:e,extension:t}){return`${e}.${t}`}o(Cu,"getFileNameWithExtension");function iE({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Wn(t)}/`:""}${Wn(t)}.${i}`:i}o(iE,"getTagFileNameWithoutExtension");function Iu(...e){return iE(...e)}o(Iu,"getTagImportPath");function ju(...e){return`${iE(...e)}.ts`}o(ju,"getTagFileName");var et=o(({type:e,tag:t,options:r})=>`${Ve(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function oE(e){return e.standalone?`${ma(e)}${wu.fileName}`:ZO}o(oE,"getAppRestClientImportPath");function sE(e){return e.standalone?`${ma(e)}${$u.reactQueryTypes.fileName}`:WO}o(sE,"getQueryTypesImportPath");function aE(e){return Ot(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(aE,"primitiveTypeToTsType");var Wt={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation",queryClient:"useQueryClient"},cE={bindings:[Wt.query,Wt.infiniteQuery,Wt.mutation,Wt.queryClient],from:"@tanstack/react-query"},Vi={pageParamName:"page"},Tu={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"};var ga=o(e=>Wn(ft(e.operationName)),"getEndpointName");function uE(e,t){return`${t.tsNamespaces?`${et({type:"endpoints",tag:ya(e,t),options:t})}.`:""}${ga(e)}`}o(uE,"getImportedEndpointName");var lE=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ya(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Kn(r??t.defaultTag)}o(ya,"getEndpointTag");function vm(e,t,r){return t.parameters.map(n=>{var s,a,c,u;let i="string";if(Lt(n.zodSchema))i=Fi(e,n.zodSchema);else if((s=n.parameterObject)!=null&&s.schema&&Gt(n.parameterObject.schema)){let l=(c=(a=n.parameterObject)==null?void 0:a.schema)==null?void 0:c.type;l&&Di(l)&&(i=aE(l))}return{name:Fn(n.name),type:i,paramType:n.type,required:((u=n.parameterObject)==null?void 0:u.required)??!0,parameterObject:n.parameterObject,bodyObject:n.bodyObject}}).sort((n,i)=>{if(n.required===i.required){let s=["Path","Body","Query","Header"];return s.indexOf(n.paramType)-s.indexOf(i.paramType)}return n.required?-1:1}).filter(n=>r!=="removePageParam"||n.name!==Vi.pageParamName).map(n=>({...n,name:r==="replacePageParam"&&n.name===Vi.pageParamName?"pageParam":n.name}))}o(vm,"mapEndpointParamsToFunctionParams");function fE(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=xO(i.name)?i.name:`"${i.name}"`,a=Fn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==tm["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==tm.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Fn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(fE,"getEndpointConfig");function Ru(e){return{type:"invalid-schema",message:e}}o(Ru,"getInvalidSchemaError");function pE(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(pE,"getInvalidOperationIdError");function dE(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(dE,"getMissingPathParameterError");function hE(e){return{type:"not-allowed-inline-enum",message:e}}o(hE,"getNotAllowedInlineEnumError");function mE(e){return{type:"not-allowed-circular-schema",message:e}}o(mE,"getNotAllowedCircularSchemaError");function gE(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${yE(t,r)}`}}o(gE,"getMissingAclConditionPropertyError");function _m(e,t,r){return{type:"missing-status-code",message:`Missing status code ${e} in operation ${yE(t,r)}`}}o(_m,"getMissingStatusCodeError");function yE(e,t){return e.operationId??`${t.method} ${t.path}`}o(yE,"getOperationDescriptor");function bE(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(bE,"groupByType");function en({schema:e,meta:t,options:r}){let n=[];Ot(e.type).with("string",()=>n.push(bq(e))).with("number","integer",()=>n.push(_q(e))).with("array",()=>n.push(Sq(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
140
|
+
`);return s!==-1&&(t=My(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(hs.prototype,so);var GF=hs(),ZF=hs({level:Dy?Dy.level:0});var Dr=new sc;function ms(e,t,r){console.log(r!==void 0&&r!==t?`${Dr.yellow(`${e}:`.padEnd(20))}${Dr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(ms,"logVariable");function ir(e){console.log(`[INFO] ${e}`)}o(ir,"logInfo");function On(e){console.log(Dr.green(`[SUCCESS] ${e}`))}o(On,"logSuccess");function gs(e,t){e instanceof Error?(console.log(Dr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Dr.red(`[ERROR] ${e}`))}o(gs,"logError");function cc(e){console.log(Dr.bgYellow(`==== ${e} ====`))}o(cc,"logBanner");var Vy=yt(require("fs"));function ao(){return"0.6.1"}o(ao,"getVersion");var s6=yt(Hy());var lf=Symbol("options_key");function Ge(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(lf,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(lf,s,t)}}}o(Ge,"YargOption");function Uy(e){let t=Reflect.getMetadata(lf,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Uy,"getYargsOption");function uc(e){return async t=>t.options(cw(e)).middleware(async r=>await uw(e,r),!0)}o(uc,"getBuilder");function cw(e){return Object.entries(Uy(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(cw,"getYargsOptions");async function uw(e,t){let r=new e;for(let[n,i]of Object.entries(Uy(e)))r[n]=t[n]??i.default;return r}o(uw,"loadYargsConfig");var HE=yt(em());var vO="Schema",_O="Enum",SO="Body",PO="Param",OO="Response",EO="ErrorResponse",aa="z.void()",mu="z.enum",gu={bindings:["z"],from:"zod"};var yu={input:"input.yaml",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},standalone:!1,baseUrl:"",schemaSuffix:vO,enumSuffix:_O,withDefaultValues:!0,additionalPropertiesDefaultValue:!1,extractEnums:!0,removeOperationPrefixEndingWith:"Controller_",infiniteQueries:!0};var $O={"invalid-schema":"Invalid 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 Status Codes"};var tm={"Content-Type":"application/json",Accept:"application/json"},wO="data";var xO=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Fn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");var ln=Symbol.for("@ts-pattern/matcher"),iq=Symbol.for("@ts-pattern/isVariadic"),vu="@ts-pattern/anonymous-select-key",rm=o(e=>!!(e&&typeof e=="object"),"r"),bu=o(e=>e&&!!e[ln],"i"),Qr=o((e,t,r)=>{if(bu(e)){let n=e[ln](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(rm(e)){if(!rm(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];bu(c)&&c[iq]?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)=>Qr(l,a[p],r))&&i.every((l,p)=>Qr(l,c[p],r))&&(s.length===0||Qr(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Qr(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||bu(s=i)&&s[ln]().matcherType==="optional")&&Qr(i,t[n],r);var s})}return Object.is(t,e)},"s"),zn=o(e=>{var t,r,n;return rm(e)?bu(e)?(t=(r=(n=e[ln]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?ua(e,zn):ua(Object.values(e),zn):[]},"o"),ua=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function fr(e){return Object.assign(e,{optional:o(()=>oq(e),"optional"),and:o(t=>Fe(e,t),"and"),or:o(t=>sq(e,t),"or"),select:o(t=>t===void 0?AO(e):AO(t,e),"select")})}o(fr,"u");function oq(e){return fr({[ln]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(zn(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Qr(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>zn(e),"getSelectionKeys"),matcherType:"optional"})})}o(oq,"h");function Fe(...e){return fr({[ln]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Qr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ua(e,zn),"getSelectionKeys"),matcherType:"and"})})}o(Fe,"m");function sq(...e){return fr({[ln]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return ua(e,zn).forEach(i=>n(i,void 0)),{matched:e.some(i=>Qr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ua(e,zn),"getSelectionKeys"),matcherType:"or"})})}o(sq,"d");function Oe(e){return{[ln]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(Oe,"p");function AO(...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 fr({[ln]:()=>({match:o(n=>{let i={[t??vu]:n};return{matched:r===void 0||Qr(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??vu].concat(r===void 0?[]:zn(r)),"getSelectionKeys")})})}o(AO,"y");function Kr(e){return typeof e=="number"}o(Kr,"v");function Vn(e){return typeof e=="string"}o(Vn,"b");function Bn(e){return typeof e=="bigint"}o(Bn,"w");var w9=fr(Oe(function(e){return!0}));var Hn=o(e=>Object.assign(fr(e),{startsWith:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>Hn(Fe(e,(r=>Oe(n=>Vn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>Hn(Fe(e,(r=>Oe(n=>Vn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>Hn(Fe(e,(r=>Oe(n=>Vn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return Hn(Fe(e,(r=t,Oe(n=>Vn(n)&&!!n.match(r)))));var r},"regex")}),"j"),x9=Hn(Oe(Vn)),Yr=o(e=>Object.assign(fr(e),{between:o((t,r)=>Yr(Fe(e,((n,i)=>Oe(s=>Kr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n<r))(t))),"lt"),gt:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n>r))(t))),"gt"),lte:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n<=r))(t))),"lte"),gte:o(t=>Yr(Fe(e,(r=>Oe(n=>Kr(n)&&n>=r))(t))),"gte"),int:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&Number.isInteger(t)))),"int"),finite:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&t>0))),"positive"),negative:o(()=>Yr(Fe(e,Oe(t=>Kr(t)&&t<0))),"negative")}),"x"),A9=Yr(Oe(Kr)),Un=o(e=>Object.assign(fr(e),{between:o((t,r)=>Un(Fe(e,((n,i)=>Oe(s=>Bn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n<r))(t))),"lt"),gt:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n>r))(t))),"gt"),lte:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n<=r))(t))),"lte"),gte:o(t=>Un(Fe(e,(r=>Oe(n=>Bn(n)&&n>=r))(t))),"gte"),positive:o(()=>Un(Fe(e,Oe(t=>Bn(t)&&t>0))),"positive"),negative:o(()=>Un(Fe(e,Oe(t=>Bn(t)&&t<0))),"negative")}),"A"),I9=Un(Oe(Bn)),C9=fr(Oe(function(e){return typeof e=="boolean"})),j9=fr(Oe(function(e){return typeof e=="symbol"})),T9=fr(Oe(function(e){return e==null})),R9=fr(Oe(function(e){return e!=null}));var sm=class sm 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(sm,"W");var nm=sm,im={matched:!1,value:void 0};function Ot(e){return new om(e,im)}o(Ot,"z");var ca=class ca{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=>Qr(l,this.input,c))||i&&!i(this.input)?im:{matched:!0,value:r(s?vu in a?a[vu]:a:this.input,this.input)};return new ca(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new ca(this.input,n?{matched:!0,value:r(this.input,this.input)}:im)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new nm(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(ca,"I");var om=ca;var am=["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"];var cm=2,IO=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],CO=["query","header","path"],Gn=["get","put","post","delete","options","head","patch","trace"],jO=["string","number","integer","boolean"],la=["allOf","anyOf","oneOf"];function Zn(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(Zn,"pick");var Ve=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Wn=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),TO=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ft=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),RO=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),um=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),NO=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),aq=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"),lm=o(e=>{let t=e.map(Ve).map(kO).map(r=>cq(r)).flat();return aq(t)},"getMostCommonAdjacentCombinationSplit"),kO=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),MO=o(e=>kO(e).join(" "),"camelToSpaceSeparated"),cq=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"),qO=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${Wn(r)}|${Ve(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");function Kn(e){return RO(e)}o(Kn,"formatTag");function Mi(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Kn(r??t.defaultTag)}o(Mi,"getOperationTag");function DO(e,t){let r={};for(let n in e.paths){let i=e.paths[n],s=Zn(i,Gn);for(let a in s){let c=s[a];if(!c||c.deprecated&&!t.withDeprecatedEndpoints)continue;let u=t.splitByTags?Mi(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(DO,"getOperationsByTag");var FO=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),qi=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),Zo=o(e=>qi(e).split("/").at(-1),"getSchemaNameByRef");function Ee(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(Ee,"isReferenceObject");function dm(e){let t=uq(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ft(t)}o(dm,"normalizeString");function VO(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(VO,"wrapWithQuotesIfNeeded");function BO(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(BO,"unwrapQuotesIfNeeded");function uq(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(uq,"prefixStringStartingWithNumberIfNeeded");function hm(e){let t=e.replaceAll("_","#");return ft(t.replaceAll("-","_")).replaceAll("#","_")}o(hm,"pathParamToVariableName");var Di=o(e=>jO.includes(e),"isPrimitiveType");function HO(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(HO,"escapeControlCharacters");function Jr(e){return e.includes("application/")&&e.includes("json")||IO.includes(e)||e.includes("text/")}o(Jr,"isParamMediaTypeAllowed");function _u(e){return e>=200&&e<300}o(_u,"isMainResponseStatus");function Su(e){return!(e>=200&&e<300)}o(Su,"isErrorStatus");function Pu(e){return e==="application/json"}o(Pu,"isMediaTypeAllowed");function fm({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${fq(e)}`,u=r.operationId?Fn(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((p,f)=>f===0?p:Ve(p)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=qO(u,i);am.includes(l)||(u=l)}return am.includes(u)?c:u}o(fm,"getOperationName");function fa({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?Mi(r,n):n.defaultTag,s=o(a=>{let c=fm({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>fm({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??fm({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(fa,"getUniqueOperationName");function UO(e,t,r){let n=[];for(let i in e.paths){let s=e.paths[i],a=Zn(s,Gn);for(let c in a){let u=a[c];if(!u||u.deprecated&&!r.withDeprecatedEndpoints)continue;let l=fa({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(UO,"getUniqueOperationNamesWithoutSplitByTags");var LO=/({\w+})/g,lq=/[^\w\-]+/g;function fq(e){e=Ve(TO(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(LO)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(LO,"")}By${Ve(r.slice(1,-1))}`}return e.replace(lq,"_")}o(fq,"pathToVariableName");var pm=/{(\b\w+(?:-\w+)*\b)}/g;function zO(e){let t=e.match(pm);return t===null?e.replaceAll(pm,":$1"):(t.forEach(r=>{let n=hm(r.replaceAll(pm,":$1"));e=e.replaceAll(r,n)}),e)}o(zO,"replaceHyphenatedPath");function Gt(e){return!Ee(e)}o(Gt,"isSchemaObject");function Ou(e){return e.type==="array"}o(Ou,"isArraySchemaObject");function GO(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(pq(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(Ee(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(GO,"inferRequiredSchema");var pq=o(e=>!Ee(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var pa="AppRestClient",Eu={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},mm="src/data",gm="@/data",ZO="@/util/rest/clients/app-rest-client",WO="@/types/react-query";var $u={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},wu={fileName:"app-rest-client",extension:"ts"};var Zt=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var Xr=o((e,t)=>um(Ve(dm(e)),t),"getZodSchemaName"),ym=o((e,t,r)=>um(Ve(dm(e)),`${t}${r}`),"getEnumZodSchemaName"),Lt=o(e=>!e.startsWith("z."),"isNamedZodSchema"),KO=o(e=>e.startsWith(mu),"isEnumZodSchema"),Li=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),xu=o(e=>ft(`${e}_${SO}`),"getBodyZodSchemaName"),YO=o((e,t)=>ft(`${e}_${t}${PO}`),"getParamZodSchemaName"),dq=o(e=>ft(`${e}${OO}`),"getMainResponseZodSchemaName"),hq=o((e,t)=>ft(`${e}_${t}_${EO}`),"getErrorResponseZodSchemaName");function Au({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Li(t,r,n);return!_u(i)&&e!=="default"&&Su(i)?hq(s,e):dq(s)}o(Au,"getResponseZodSchemaName");function da(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Ve(MO(i))}: \`${e[i]}\``],[])}o(da,"getSchemaDescriptions");function It(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(Ee(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(la.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&&It(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&&It(a,t);if(i.additionalProperties)for(let[s,a]of Object.entries(i.additionalProperties))!(a instanceof Object)||n({type:"additionalProperty",parentSchema:e,schema:a,data:r,propertyName:s})===!0||It(a,t);if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;It(s,t)}}o(It,"iterateSchema");var ha=o((e,t)=>NO(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),QO=o((e,t)=>Lt(t)?`${e.options.tsNamespaces?`${et({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),Fi=o((e,t,r)=>{if(!Lt(t))return t===aa?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${et({type:"models",tag:n,options:e.options})}.`:""}${ha(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function JO(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(JO,"getZodSchemaType");function XO(e){if(e.schemaObj)return[e.schemaObj.description,...da(e.schemaObj).join(". ")].filter(Boolean)}o(XO,"getZodSchemaDescription");function eE(e,t,r){var n;if(Ee(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?Fi(e,i,r):void 0}if(Ou(t)){if(!Ee(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${Fi(e,i,r)}[]`:void 0}if(la.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return eE(e,i[0],r)}return t.type}o(eE,"getType");function tE(e,t,r){if(!t.schemaObj)return[];let n="[0]",i={},s=o(a=>{var u;if(a.type==="reference")return!0;if(a.type==="composite")return;let c=[...((u=a.data)==null?void 0:u.pathSegments)??[]];if(a.type==="array"?c.push(n):(a.type==="property"||a.type==="additionalProperty")&&c.push(a.propertyName),a.schema&&c[c.length-1]!==n){let l=e.resolveObject(a.schema),p=[l.description,...da(l)].filter(Boolean),f=c.join(".");i[f]&&"type"in a.schema&&a.schema.type==="object"||(delete i[f],i[f]={type:eE(e,a.schema,r)??"unknown",description:p.join(". ")})}return It(a.schema,{data:{pathSegments:[...c]},onSchema:s}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(a=>{if(Ee(a)){let c=e.resolveObject(a);It(c,{data:{pathSegments:[]},onSchema:s})}}),It(t.schemaObj,{data:{pathSegments:[]},onSchema:s}),i}o(tE,"getZodSchemaPropertyDescriptions");function Yn({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=bm({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=bm({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>ha(u,e.options),"getEntityName"),options:e.options});return mq(e.options,a,c)}o(Yn,"getModelsImports");function rE({tag:e,endpoints:t,options:r}){return bm({type:"endpoints",tag:e,entities:t,getTag:o(n=>ya(n,r),"getTag"),getEntityName:ga,options:r})}o(rE,"getEndpointsImports");function nE({tags:e,entityName:t,getAliasEntityName:r,options:n}){let i=new Map;return e.forEach(s=>{let a=`${t}${r?` as ${r(s)}`:""}`;i.has(s)?n.tsNamespaces||i.get(s).bindings.push(a):i.set(s,{bindings:[n.tsNamespaces?et({type:"acl",tag:s,options:n}):a],from:`${ma(n)}${Iu({type:"acl",tag:s,includeTagDir:!0,options:n})}`})}),Array.from(i.values())}o(nE,"getAclImports");function ma(e){let t=gm;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${mm}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${mm}`,"g"),gm)),`${t}/`.replace(/\/\//g,"/")}o(ma,"getImportPath");function bm({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?et({type:e,tag:u,options:s}):i(c)],from:`${l?"./":ma(s)}${Iu({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(bm,"getImports");function mq(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:Zt(n.bindings)}))}o(mq,"mergeImports");function Cu({fileName:e,extension:t}){return`${e}.${t}`}o(Cu,"getFileNameWithExtension");function iE({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Wn(t)}/`:""}${Wn(t)}.${i}`:i}o(iE,"getTagFileNameWithoutExtension");function Iu(...e){return iE(...e)}o(Iu,"getTagImportPath");function ju(...e){return`${iE(...e)}.ts`}o(ju,"getTagFileName");var et=o(({type:e,tag:t,options:r})=>`${Ve(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function oE(e){return e.standalone?`${ma(e)}${wu.fileName}`:ZO}o(oE,"getAppRestClientImportPath");function sE(e){return e.standalone?`${ma(e)}${$u.reactQueryTypes.fileName}`:WO}o(sE,"getQueryTypesImportPath");function aE(e){return Ot(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(aE,"primitiveTypeToTsType");var Wt={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation",queryClient:"useQueryClient"},cE={bindings:[Wt.query,Wt.infiniteQuery,Wt.mutation,Wt.queryClient],from:"@tanstack/react-query"},Vi={pageParamName:"page"},Tu={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"};var ga=o(e=>Wn(ft(e.operationName)),"getEndpointName");function uE(e,t){return`${t.tsNamespaces?`${et({type:"endpoints",tag:ya(e,t),options:t})}.`:""}${ga(e)}`}o(uE,"getImportedEndpointName");var lE=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ya(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Kn(r??t.defaultTag)}o(ya,"getEndpointTag");function vm(e,t,r){return t.parameters.map(n=>{var s,a,c,u;let i="string";if(Lt(n.zodSchema))i=Fi(e,n.zodSchema);else if((s=n.parameterObject)!=null&&s.schema&&Gt(n.parameterObject.schema)){let l=(c=(a=n.parameterObject)==null?void 0:a.schema)==null?void 0:c.type;l&&Di(l)&&(i=aE(l))}return{name:Fn(n.name),type:i,paramType:n.type,required:((u=n.parameterObject)==null?void 0:u.required)??!0,parameterObject:n.parameterObject,bodyObject:n.bodyObject}}).sort((n,i)=>{if(n.required===i.required){let s=["Path","Body","Query","Header"];return s.indexOf(n.paramType)-s.indexOf(i.paramType)}return n.required?-1:1}).filter(n=>r!=="removePageParam"||n.name!==Vi.pageParamName).map(n=>({...n,name:r==="replacePageParam"&&n.name===Vi.pageParamName?"pageParam":n.name}))}o(vm,"mapEndpointParamsToFunctionParams");function fE(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=xO(i.name)?i.name:`"${i.name}"`,a=Fn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==tm["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==tm.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Fn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(fE,"getEndpointConfig");function Ru(e){return{type:"invalid-schema",message:e}}o(Ru,"getInvalidSchemaError");function pE(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(pE,"getInvalidOperationIdError");function dE(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(dE,"getMissingPathParameterError");function hE(e){return{type:"not-allowed-inline-enum",message:e}}o(hE,"getNotAllowedInlineEnumError");function mE(e){return{type:"not-allowed-circular-schema",message:e}}o(mE,"getNotAllowedCircularSchemaError");function gE(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${yE(t,r)}`}}o(gE,"getMissingAclConditionPropertyError");function _m(e,t,r){return{type:"missing-status-code",message:`Missing status code ${e} in operation ${yE(t,r)}`}}o(_m,"getMissingStatusCodeError");function yE(e,t){return e.operationId??`${t.method} ${t.path}`}o(yE,"getOperationDescriptor");function bE(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(bE,"groupByType");function en({schema:e,meta:t,options:r}){let n=[];Ot(e.type).with("string",()=>n.push(bq(e))).with("number","integer",()=>n.push(_q(e))).with("array",()=>n.push(Sq(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
141
141
|
`,"\r",`\r
|
|
142
|
-
`].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(gq({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?yq(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(en,"getZodChain");function gq({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(gq,"getZodChainablePresence");function yq(e){return e.default!==void 0?`default(${Ot(e.type).with("number","integer",()=>BO(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(yq,"getZodChainableDefault");function bq(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(${vq(e.pattern)})`),e.format){let r=Ot(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(bq,"getZodChainableStringValidations");function vq(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=HO(e),`/${e}/`}o(vq,"formatPatternIfNeeded");function _q(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(_q,"getZodChainableNumberValidations");function Sq(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(Sq,"getZodChainableArrayValidations");var Bi=o(e=>e.reduce((t,r)=>t+r,0),"sum");function at(e,t){if(!t)return e;if(Ee(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?Ct("oneOf")+at(e,{...t,type:t.type[0]}):e+Ct("oneOf")+Bi(t.type.map(r=>at(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?Ct("oneOf")+at(e,t.oneOf[0]):e+Ct("oneOf")+Bi(t.oneOf.map(r=>at(0,r)));if(t.anyOf)return t.anyOf.length===1?Ct("anyOf")+at(e,t.anyOf[0]):e+Ct("anyOf")+Bi(t.anyOf.map(r=>at(0,r)));if(t.allOf)return t.allOf.length===1?Ct("allOf")+at(e,t.allOf[0]):e+Ct("allOf")+Bi(t.allOf.map(r=>at(0,r)));if(!t.type)return e;if(Di(t.type))return t.enum?e+vE(t)+Ct("enum")+Bi(t.enum.map(r=>at(0,r))):e+vE(t);if(t.type==="array")return t.items?Ct("array")+at(e,t.items):Ct("array")+at(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.additionalProperties)return t.additionalProperties===!0?Ct("record")+at(e):Ct("record")+at(e,t.additionalProperties);if(t.properties){let r=Object.values(t.properties);return e+Ct("object")+Bi(r.map(n=>at(0,n)))}return Ct("empty-object")+at(e)}return e}o(at,"getOpenAPISchemaComplexity");function vE(e){return Ot(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(vE,"complexityByType");function Ct(e){return Ot(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","record","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(Ct,"complexityByComposite");var Sm=class Sm{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;Ee(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?`${et({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return at(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(Sm,"ZodSchema");var ba=Sm;function We({schema:e,resolver:t,meta:r,tag:n}){var y;let i=new ba(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(Ee(e))return Pq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=Eq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=Oq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=$q({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let p=wq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let f=xq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let d=t.options.allReadonly?".readonly()":"";if(Ou(e))return e.items?i.assign(`z.array(${We({...a,schema:e.items}).getCodeString(n,t.options)}${en({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=t.options.additionalPropertiesDefaultValue!==void 0?t.options.additionalPropertiesDefaultValue:!0,E=(e.additionalProperties===null||e.additionalProperties===void 0?b:e.additionalProperties)===!1?"":".passthrough()";if(typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0)return i.assign(`z.record(${We({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+en({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options})})`);let w=e.required&&e.required.length>0,j=t.options.withImplicitRequiredProps?!1:!((y=e.required)!=null&&y.length),I="{}";e.properties&&(I="{ "+Object.entries(e.properties).map(([xe,Pe])=>{var M;let J={...s,isRequired:j?!0:w?(M=e.required)==null?void 0:M.includes(xe):t.options.withImplicitRequiredProps,name:xe,isParentPartial:j},k=Pe;if(Ee(Pe)&&t&&(k=t.getSchemaByRef(Pe.$ref),!k))throw new Error(`Schema ${Pe.$ref} not found`);let T=We({...a,schema:Pe,meta:J}).getCodeString(n,t.options)+en({schema:k,meta:J,options:t.options});return[xe,T]}).map(([xe,Pe])=>`${VO(xe)}: ${Pe}`).join(", ")+" }");let C=j?".partial()":"",fe=t.options.strictObjects?".strict()":"";return i.assign(`z.object(${I})${C}${fe}${E}${d}`)}if(!h)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${h}`)}o(We,"getZodSchema");function Pq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Ee(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=We({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(Pq,"getReferenceZodSchema");function Oq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!Gt(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=We({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=>Gt(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
|
|
142
|
+
`].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(gq({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?yq(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(en,"getZodChain");function gq({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(gq,"getZodChainablePresence");function yq(e){return e.default!==void 0?`default(${Ot(e.type).with("number","integer",()=>BO(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(yq,"getZodChainableDefault");function bq(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(${vq(e.pattern)})`),e.format){let r=Ot(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(bq,"getZodChainableStringValidations");function vq(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=HO(e),`/${e}/`}o(vq,"formatPatternIfNeeded");function _q(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(_q,"getZodChainableNumberValidations");function Sq(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(Sq,"getZodChainableArrayValidations");var Bi=o(e=>e.reduce((t,r)=>t+r,0),"sum");function at(e,t){if(!t)return e;if(Ee(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?Ct("oneOf")+at(e,{...t,type:t.type[0]}):e+Ct("oneOf")+Bi(t.type.map(r=>at(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?Ct("oneOf")+at(e,t.oneOf[0]):e+Ct("oneOf")+Bi(t.oneOf.map(r=>at(0,r)));if(t.anyOf)return t.anyOf.length===1?Ct("anyOf")+at(e,t.anyOf[0]):e+Ct("anyOf")+Bi(t.anyOf.map(r=>at(0,r)));if(t.allOf)return t.allOf.length===1?Ct("allOf")+at(e,t.allOf[0]):e+Ct("allOf")+Bi(t.allOf.map(r=>at(0,r)));if(!t.type)return e;if(Di(t.type))return t.enum?e+vE(t)+Ct("enum")+Bi(t.enum.map(r=>at(0,r))):e+vE(t);if(t.type==="array")return t.items?Ct("array")+at(e,t.items):Ct("array")+at(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.additionalProperties)return t.additionalProperties===!0?Ct("record")+at(e):Ct("record")+at(e,t.additionalProperties);if(t.properties){let r=Object.values(t.properties);return e+Ct("object")+Bi(r.map(n=>at(0,n)))}return Ct("empty-object")+at(e)}return e}o(at,"getOpenAPISchemaComplexity");function vE(e){return Ot(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(vE,"complexityByType");function Ct(e){return Ot(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","record","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(Ct,"complexityByComposite");var Sm=class Sm{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;Ee(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?`${et({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return at(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(Sm,"ZodSchema");var ba=Sm;function We({schema:e,resolver:t,meta:r,tag:n}){var y;let i=new ba(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(Ee(e))return Pq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=Eq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=Oq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=$q({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let p=wq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let f=xq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let d=t.options.allReadonly?".readonly()":"";if(Ou(e))return e.items?i.assign(`z.array(${We({...a,schema:e.items}).getCodeString(n,t.options)}${en({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=t.options.additionalPropertiesDefaultValue!==void 0?t.options.additionalPropertiesDefaultValue:!0,E=(e.additionalProperties===null||e.additionalProperties===void 0?b:e.additionalProperties)===!1?"":".passthrough()";if(typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0)return i.assign(`z.record(${We({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+en({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options})})`);let w=e.required&&e.required.length>0,j=t.options.withImplicitRequiredProps?!1:!((y=e.required)!=null&&y.length),I="{}";e.properties&&(I="{ "+Object.entries(e.properties).map(([xe,Pe])=>{var M;let J={...s,isRequired:j?!0:w?(M=e.required)==null?void 0:M.includes(xe):t.options.withImplicitRequiredProps,name:xe,isParentPartial:j},k=Pe;if(Ee(Pe)&&t&&(k=t.getSchemaByRef(Pe.$ref),!k))throw new Error(`Schema ${Pe.$ref} not found`);let T=We({...a,schema:Pe,meta:J}).getCodeString(n,t.options)+en({schema:k,meta:J,options:t.options});return[xe,T]}).map(([xe,Pe])=>`${VO(xe)}: ${Pe}`).join(", ")+" }");let C=j?".partial()":"",fe=t.options.strictObjects?".strict()":"";return i.assign(`z.object(${I})${C}${fe}${E}${d}`)}if(h==="any")return i.assign("z.any()");if(!h)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${h}`)}o(We,"getZodSchema");function Pq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Ee(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=We({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(Pq,"getReferenceZodSchema");function Oq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!Gt(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=We({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=>Gt(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=>We({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
|
|
144
144
|
`)}return t.assign(`z.union([${e.oneOf.map(c=>We({schema:c,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(Oq,"getOneOfZodSchema");function Eq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!(!Gt(e)||!Array.isArray(e.type)))return e.type.length===1?We({schema:{...e,type:e.type[0]},resolver:r,meta:n,tag:i}):t.assign(`z.union([${e.type.map(s=>We({schema:{...e,type:s},resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(Eq,"getArrayZodSchema");function $q({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Gt(e)||!e.anyOf)return;if(e.anyOf.length===1){let a=We({schema:e.anyOf[0],resolver:r,meta:n,tag:i});return t.assign(a.getCodeString(i,r.options))}let s=e.anyOf.map(a=>We({schema:a,resolver:r,meta:n,tag:i})).map(a=>a.getCodeString(i,r.options)).join(", ");return t.assign(`z.union([${s}])`)}o($q,"getAnyOfZodSchema");function wq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Gt(e)||!e.allOf)return;if(e.allOf.length===1){let f=We({schema:e.allOf[0],resolver:r,meta:n,tag:i});return t.assign(f.getCodeString(i,r.options))}let{patchRequiredSchemaInLoop:s,noRequiredOnlyAllof:a,composedRequiredSchema:c}=GO(e),u=a.map(f=>{let d=We({schema:f,resolver:r,meta:n,tag:i});return r&&s(f,r.getSchemaByRef.bind(r)),d});c.required.length&&u.push(We({schema:c,resolver:r,meta:n,tag:i}));let l=u.at(0),p=u.slice(1).map(f=>`merge(${f.getCodeString(i,r.options)})`).join(".");return t.assign(`${l.getCodeString(i,r.options)}.${p}`)}o(wq,"getAllOfZodSchema");function xq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Gt(e))return;let s=e.type?e.type.toLowerCase():void 0;if(s&&Di(s)){if(e.enum){if(s==="string")return Aq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i});if(e.enum.some(a=>typeof a=="string"))return t.assign("z.never()");if(e.enum.length===1){let a=e.enum[0];return t.assign(`z.literal(${a===null?"null":a})`)}return t.assign(`z.union([${e.enum.map(a=>`z.literal(${a===null?"null":a})`).join(", ")}])`)}return t.assign(Ot(s).with("integer",()=>"z.number()").with("string",()=>Ot(e.format).with("binary",()=>"z.instanceof(File)").otherwise(()=>"z.string()")).otherwise(a=>`z.${a}()`))}}o(xq,"getPrimitiveZodSchema");function Aq({resolver:e,schema:t,zodSchema:r,meta:n,tag:i}){var l;if(!Gt(t))return;let s=Wo(t);if(!e.options.extractEnums)return r.assign(s);let a=e.getEnumZodSchemaDataByCode(s);if(a)return((l=r.meta.parent)==null?void 0:l.ref)===e.getRefByZodSchemaName(a.zodSchemaName)?r.assign(a.code):new ba({$ref:e.getRefByZodSchemaName(a.zodSchemaName)},e,n).inherit(r).assign(s);let c=e.getExtractedEnumZodSchemaDataByCode(s);if(!c)return r.assign(s);if(!c.zodSchemaName||!c.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${s}`);let u=e.options.tsNamespaces&&c.tag!==i?`${et({type:"models",tag:c.tag,options:e.options})}.`:"";return r.assign(`${u}${c.zodSchemaName}`)}o(Aq,"getEnumZodSchema");function Wo(e){var t;return`${mu}([${(t=e.enum)==null?void 0:t.map(r=>r===null?"null":`"${r}"`).join(", ")}])`}o(Wo,"getEnumZodSchemaCode");function Ko({schema:e,zodSchema:t,fallbackName:r,resolver:n,tag:i}){var c;let s=t.getCodeString();if((!Lt(s)||t.ref===void 0)&&r){if(t.complexity<cm)return s;let u=Xr(r,n.options.schemaSuffix);for(;n.getCodeByZodSchemaName(u);){if((c=n.getZodSchemaNamesByCompositeCode(s))!=null&&c.includes(u))return u;if(n.getCodeByZodSchemaName(u)===u)return u;throw new Error(`Can't uniquely resolve zod schema name: ${u}`)}return n.setZodSchema(u,s,i),n.addZodSchemaForCompositeCode(s,t,u,e),u}let a=n.getCodeByZodSchemaName(s);if(!a&&t.ref&&(a=n.getCodeByZodSchemaName(n.getZodSchemaNameByRef(t.ref))),t.ref&&a)return at(0,n.getSchemaByRef(t.ref))<cm?n.getCodeByZodSchemaName(s):s;throw new Error(`Invalid ref: ${t.ref}`)}o(Ko,"resolveZodSchemaName");var fn=o(e=>e.method==="get","isQuery"),_E=o(e=>e.method!=="get","isMutation"),Nu=o((e,t)=>fn(e)&&t.every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery");function SE({resolver:e,endpoint:t,operation:r}){let n=r["x-acl"];return n==null?void 0:n.map(i=>{let s=Object.keys(i.conditions??{}).reduce((a,c)=>{let u=Iq({resolver:e,endpoint:t,acl:n,name:c});return u?[...a,u]:(e.validationErrors.push(gE(c,r,t)),a)},[]);return{...i,conditionsTypes:s}})}o(SE,"getEndpointAcl");function Iq({resolver:e,endpoint:t,acl:r,name:n}){var f,d,h,y,b,g,E,w,j,I;let i=(d=(f=r[0])==null?void 0:f.conditions)==null?void 0:d[n];if(!i)return;let s=i.replace(/^\$[^.]*\./,"").split("."),a,c,u,l=0,p=t.parameters.find(({name:C})=>C===s[l]);if(p)c=(h=p.parameterObject)==null?void 0:h.required,a=(y=p.parameterObject)==null?void 0:y.schema,u=`${p.name} ${Wn(p.type)} parameter`,l++;else{let C=t.parameters.find(({bodyObject:xe})=>!!xe),ne=Object.keys(((b=C==null?void 0:C.bodyObject)==null?void 0:b.content)??{}).find(Jr);ne&&(a=(w=(E=(g=C==null?void 0:C.bodyObject)==null?void 0:g.content)==null?void 0:E[ne])==null?void 0:w.schema,u=`${fn(t)?"query":"mutation"} data`)}for(;a&&l<s.length;){let C=e.resolveObject(a);a=(j=Object.entries(C.properties??{}).find(([ne])=>ne===s[l]))==null?void 0:j[1],c=((I=C.required)==null?void 0:I.includes(s[l]))??!1,l++}if(a)return{name:n,type:Ee(a)?void 0:a.type,zodSchemaName:Ee(a)?e.getZodSchemaNameByRef(a.$ref):void 0,required:c,info:u}}o(Iq,"getEndpointAclConditionPropertyType");function PE({resolver:e,operation:t,operationName:r,isUniqueOperationName:n,tag:i}){var h,y;let s=e.resolveObject(t.requestBody);if(!s)return;let c=Object.keys(s.content??{}).find(Jr);if(!c)return;let u=(y=(h=s.content)==null?void 0:h[c])==null?void 0:y.schema;if(!u)return;let l=We({schema:u,resolver:e,meta:{isRequired:s.required??!0},tag:i}),p=e.resolveObject(u),f=Ko({schema:p,zodSchema:l,fallbackName:xu(Li(r,n,i)),resolver:e,tag:i}),d=en({schema:p,meta:l.meta,options:e.options});return{endpointParameter:{name:wO,type:"Body",description:s.description,zodSchema:f+d,bodyObject:s},requestFormat:c}}o(PE,"getEndpointBody");function OE({resolver:e,param:t,operationName:r,isUniqueOperationName:n,tag:i}){let s=e.resolveObject(t);if(!CO.includes(s.in))return;let a={};if(s.content){let f=Object.keys(s.content??{}),d=f.find(Jr);if(!d)throw new Error(`Unsupported media type for param ${s.name}: ${f.join(", ")}`);let h=s.content[d];if(!h)throw new Error(`No content with media type for param ${s.name}: ${d}`);a=(h==null?void 0:h.schema)??h}else s.schema&&(a=s.schema);e.options.withDescription&&a&&(a.description=(s.description??"").trim());let c=We({schema:a,resolver:e,meta:{isRequired:s.in==="path"?!0:s.required??!1},tag:i}),u=e.resolveObject(a),l=en({schema:u,meta:c.meta,options:e.options}),p=Ko({schema:u,zodSchema:c.assign(c.getCodeString(i)+l),fallbackName:YO(Li(r,n,i),s.name),resolver:e,tag:i});return{name:Ot(s.in).with("path",()=>hm(s.name)).otherwise(()=>s.name),type:Ot(s.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:p,parameterObject:s}}o(OE,"getEndpointParameter");function $E(e){var r,n,i,s,a;let t=[];for(let c in e.openApiDoc.paths){let u=e.openApiDoc.paths[c],l=Zn(u,Gn),p=EE(u.parameters??[]);for(let f in l){let d=l[f];if(!d||d.deprecated&&!e.options.withDeprecatedEndpoints)continue;let h=d.operationId&&d.operationId!==Fn(d.operationId);d.operationId&&h&&e.validationErrors.push(pE(d.operationId));let y=Object.entries({...p,...EE(d.parameters??[])}).map(([,I])=>I),b=fa({path:c,method:f,operation:d,operationsByTag:e.operationsByTag,options:e.options}),g=e.operationNames.filter(I=>I===b).length<=1,E=Mi(d,e.options),w={method:f,path:zO(c),operationName:b,description:d.description,summary:d.summary,tags:(r=d.tags)==null?void 0:r.map(Kn),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[]};if(d.requestBody){let I=PE({resolver:e,operation:d,operationName:b,isUniqueOperationName:g,tag:E});I&&(w.parameters.push(I.endpointParameter),w.requestFormat=I.requestFormat)}for(let I of y){let C=OE({resolver:e,param:I,operationName:b,isUniqueOperationName:g,tag:E});C&&w.parameters.push(C)}let j=Cq(w);j.forEach(I=>{w.parameters.push(I)}),j.length>0&&e.validationErrors.push(dE(j,c));for(let I in d.responses){w.responseStatusCodes.push(I);let C=e.resolveObject(d.responses[I]),ne=Object.keys(C.content??{}).find(Pu),xe,Pe;if(ne?(w.responseFormat=ne,xe=(i=(n=C.content)==null?void 0:n[ne])==null?void 0:i.schema):Pe=aa,xe){let J=We({schema:xe,resolver:e,meta:{isRequired:!0},tag:E}),k=e.resolveObject(xe);Pe=Ko({schema:k,zodSchema:J,fallbackName:J.ref?void 0:Au({statusCode:I,operationName:b,isUniqueOperationName:g,tag:E}),resolver:e,tag:E})+en({schema:k,meta:J.meta,options:e.options})}if(Pe){let J=Number(I);_u(J)?(w.response=Pe,w.responseObject=C,w.responseDescription=C.description):I!=="default"&&Su(J)&&w.errors.push({zodSchema:Pe,status:J,description:C.description})}}w.response||(w.response=aa),w.acl=SE({resolver:e,endpoint:w,operation:d}),(s=d.security)!=null&&s[0].Authorization&&!w.responseStatusCodes.includes("401")&&e.validationErrors.push(_m("401",d,w)),(a=w.acl)!=null&&a[0]&&!w.responseStatusCodes.includes("403")&&e.validationErrors.push(_m("403",d,w)),t.push(w)}}return t}o($E,"getEndpointsFromOpenAPIDoc");function EE(e){return Object.fromEntries((e??[]).map(t=>[Ee(t)?t.$ref:t.name,t]))}o(EE,"getParameters");function Cq(e){return[...e.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(r=>r[1]).filter(r=>e.parameters.findIndex(({name:n})=>n===r)===-1).map(r=>jq(r))}o(Cq,"getMissingPathParameters");function jq(e){return{name:e,type:"Path",zodSchema:"z.string()",parameterObject:{name:e,required:!0,in:"path",schema:{type:"string"}}}}o(jq,"getPathParameterFromName");function wE(e,t){let r=Tq(e,t),n=Rq(e,r);return{refsDependencyGraph:r,deepDependencyGraph:n}}o(wE,"getOpenAPISchemaDependencyGraph");function Tq(e,t){let r={},n={};return e.forEach(i=>Nq({schema:t(i),fromRef:i,getSchemaByRef:t,visitedRefs:r,refsDependencyGraph:n})),n}o(Tq,"getRefsDependencyGraph");function Rq(e,t){let r={},n={},i=o((s,a)=>{n[a].add(s),t[s]&&a!==s&&t[s].forEach(c=>{let u=`${a}__${c}`;r[u]||(r[u]=!0,i(c,a))})},"visit");return e.forEach(s=>{let a=t[s];a&&(n[s]||(n[s]=new Set),a.forEach(c=>i(c,s)))}),n}o(Rq,"getDeepRefsDependencyGraph");function Nq({schema:e,fromRef:t,getSchemaByRef:r,visitedRefs:n={},refsDependencyGraph:i={}}){let s=o(a=>{if(a.type!=="reference"||!a.data)return;let{schema:c,data:u}=a;if(i[u.fromRef]||(i[u.fromRef]=new Set),i[u.fromRef].add(c.$ref),n[c.$ref])return!0;n[u.fromRef]=!0,It(r(c.$ref),{data:{fromRef:c.$ref},onSchema:s})},"onSchema");return It(e,{data:{fromRef:t},onSchema:s}),{visitedRefs:n,refsDependencyGraph:i}}o(Nq,"getSchemaRefsDependencyGraph");function ku(e,t,r){let n=[];return It(t,{onSchema:o(s=>{s.type==="reference"?n.push(s.schema):Ee(s.parentSchema)&&(s.type==="property"||s.type==="additionalProperty"?e.validationErrors.push(Ru(`${r} has both reference and properties`)):s.type==="array"?e.validationErrors.push(Ru(`${r} is both reference and array schema`)):s.type==="composite"&&e.validationErrors.push(Ru(`${r} has both reference and composite keyword`)))},"onSchema")}),n}o(ku,"getSchemaRefObjs");function xE(e,t){return t.map(i=>qi(i.$ref)).reduce((i,s)=>{let a=e.dependencyGraph.deepDependencyGraph[s];return[...i,s,...Array.from(a??[])]},[])}o(xE,"getDeepSchemaRefObjs");function va({schema:e,nameSegments:t=[],includeSelf:r,...n}){r&&AE({schema:e,nameSegments:t,...n}),It(e,{data:{nameSegments:t},onSchema:o(s=>{var c;if(s.type==="reference")return!0;let a=[...((c=s.data)==null?void 0:c.nameSegments)??[]];(s.type==="property"||s.type==="additionalProperty")&&a.push(s.propertyName),AE({schema:s.schema,nameSegments:[...a],...n})},"onSchema")})}o(va,"updateExtractedEnumZodSchemaData");function AE({resolver:e,schema:t,schemaRef:r,schemaInfo:n,tags:i,nameSegments:s=[]}){if(!t||Ee(t)||!t.enum)return;let a=Wo(t),c=e.extractedEnumZodSchemaData.find(u=>u.code===a);c?(c.meta.zodSchemaNameSegments.push(s),c.meta.tags.push(...i),c.meta.schemaRefs.push(...r?[r]:[]),c.meta.schemas.push(...t?[t]:[])):e.extractedEnumZodSchemaData.push({code:a,meta:{zodSchemaNameSegments:[s],tags:[...i],schemaRefs:r?[r]:[],schemas:t?[t]:[]}}),e.validationErrors.push(hE(r?`schema ${Zo(r)} property ${s[s.length-1]}`:n??s.join("->")))}o(AE,"handleExtractedEnumZodSchemaDataUpdate");function IE(e){e.extractedEnumZodSchemaData.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(s=>s[s.length-1]).filter(Boolean),i=lm(n);if(!i)throw new Error(`No common last segment found for enum: ${r.code}`);r.zodSchemaName=ym(i,e.options.enumSuffix,e.options.schemaSuffix)});let t=0;for(;t<5&&!Pm(e);)kq(e,t+2),t++;if(Pm(e)||e.extractedEnumZodSchemaData.filter(n=>!jE(e,n)).forEach(n=>{n.zodSchemaName=ym(n.meta.zodSchemaNameSegments[0].map(i=>Om(Ve(i))).join(""),e.options.enumSuffix,e.options.schemaSuffix)}),!Pm(e))throw new Error("Failed to resolve unique names for enum zod schemas")}o(IE,"resolveExtractedEnumZodSchemaNames");function Pm(e){return e.extractedEnumZodSchemaData.every(t=>jE(e,t))}o(Pm,"allExtractedEnumZodSchemaNamesAreUnique");function kq(e,t){e.extractedEnumZodSchemaData.forEach(r=>{let n=e.extractedEnumZodSchemaData.filter(({zodSchemaName:i})=>r.zodSchemaName===i);n.length!==1&&Mq(n,t)})}o(kq,"additionalResolveExtractedEnumZodSchemaName");function Mq(e,t=2){e.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(i=>i[i.length-t]).filter(Boolean);if(n.length===1){let i=[Om(Ve(n[0])),r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=i}else{let i=lm(n),s=[i?Om(Ve(i)):"",r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=s}})}o(Mq,"suffixWithPreviousSegmentName");function CE(e){e.extractedEnumZodSchemaData.forEach(t=>{let r=Zt(t.meta.tags);t.tag=r.length===1?r[0]:e.options.defaultTag})}o(CE,"resolveExtractedEnumZodSchemaTags");function jE(e,t){return e.extractedEnumZodSchemaData.filter(({zodSchemaName:r})=>t.zodSchemaName===r).length===1}o(jE,"isUnique");function Om(e){return e.replace(/(Dto|DTO|Response|Request)/g,"")}o(Om,"sanitizeName");function TE(e){var n;let t={},r={};return Object.entries(((n=e.openApiDoc.components)==null?void 0:n.schemas)??{}).forEach(([i,s])=>{let a=Xr(i,e.options.schemaSuffix);if(!t[a]){let c=e.getTagByZodSchemaName(a),u=e.resolveObject(s);u.enum?r[a]=Wo(u):t[a]=We({schema:s,resolver:e,tag:c}).getCodeString(c)}}),{zodSchemas:t,enumZodSchemas:r}}o(TE,"getZodSchemasFromOpenAPIDoc");function RE(e){var r;let t=[];return Object.entries(((r=e.openApiDoc.components)==null?void 0:r.schemas)??{}).forEach(([n,i])=>{let s=Xr(n,e.options.schemaSuffix),a=e.resolveObject(i);!t.find(c=>c.zodSchemaName===s)&&a.enum&&t.push({zodSchemaName:s,code:Wo(a)})}),t}o(RE,"getEnumZodSchemasFromOpenAPIDoc");var Em=class Em{constructor(t,r){this.openApiDoc=t;this.options=r;this.dependencyGraph=wE(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=RE(this),this.operationsByTag=DO(t,r),this.operationNames=UO(t,this.operationsByTag,r),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];operationsByTag={};operationNames=[];extractedEnumZodSchemaData=[];validationErrors=[];get docSchemas(){var t;return((t=this.openApiDoc.components)==null?void 0:t.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(FO)}getSchemaByRef(t){return this.docSchemas[Zo(t)]}getSchemaDataByRef(t){return this.schemaData.find(r=>r.ref===t)}getZodSchemaNameByRef(t){var n,i;let r=((n=this.getSchemaDataByRef(qi(t)))==null?void 0:n.zodSchemaName)??((i=this.extractedEnumZodSchemaData.find(s=>s.zodSchemaName===t))==null?void 0:i.zodSchemaName);if(!r)throw new Error(`Zod schema not found for ref: ${t}`);return r}getRefByZodSchemaName(t){var r;return(r=this.schemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.ref}getTagByZodSchemaName(t){var u,l;if(!this.options.splitByTags)return this.options.defaultTag;let r=this.extractedEnumZodSchemaData.find(p=>p.zodSchemaName===t);if(r)return Kn(r.tag??this.options.defaultTag);let n=this.getRefByZodSchemaName(t),i=n?((u=this.getSchemaDataByRef(n))==null?void 0:u.tags)??[]:[],s=((l=this.zodSchemaData.find(p=>p.zodSchemaName===t))==null?void 0:l.tags)??[],a=Zt(i,s),c=a.length===1?a[0]:this.options.defaultTag;return Kn(c??this.options.defaultTag)}getCodeByZodSchemaName(t){var r;return(r=this.zodSchemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.code}getZodSchemaNamesByCompositeCode(t){var r;return(r=this.compositeZodSchemaData.find(n=>n.code===t))==null?void 0:r.zodSchemas.map(n=>n.zodSchemaName)}setZodSchema(t,r,n){let i=this.zodSchemaData.find(s=>s.zodSchemaName===t);i?(i.code=r,i.tags=(i.tags??[]).concat(n)):this.zodSchemaData.push({zodSchemaName:t,code:r,tags:[n]})}addZodSchemaForCompositeCode(t,r,n,i){let s={zodSchemaName:n,zodSchema:r,schema:i},a=this.compositeZodSchemaData.find(c=>c.code===t);a?a.zodSchemas.push(s):this.compositeZodSchemaData.push({code:t,zodSchemas:[s]})}getCompositeZodSchemaByZodSchemaName(t){var n;let r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t));return(n=r==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.zodSchema}getSchemaByCompositeZodSchemaName(t){var r,n;return(n=(r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t)))==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.schema}getEnumZodSchemaDataByCode(t){return this.enumZodSchemas.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByCode(t){return this.extractedEnumZodSchemaData.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByName(t){return this.extractedEnumZodSchemaData.find(({zodSchemaName:r})=>r===t)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(t){return this.extractedEnumZodSchemaData.reduce((r,{zodSchemaName:n,meta:i})=>(n&&i.schemaRefs.includes(t)&&r.push(n),r),[])}getZodSchemas(){return this.zodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>({...t,[r]:n}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>r?{...t,[r]:n}:t,{})}resolveObject(t){return Ee(t)?this.getSchemaByRef(t.$ref):t}isSchemaCircular(t){var r;return(r=this.dependencyGraph.deepDependencyGraph[t])==null?void 0:r.has(t)}getCircularSchemaChain(t,r=t,n=[]){var i,s;return(i=this.dependencyGraph.refsDependencyGraph[r])!=null&&i.has(t)?[...n,r,t]:Array.from(((s=this.dependencyGraph.refsDependencyGraph[r])==null?void 0:s.values())??[]).map(a=>{let c=this.getCircularSchemaChain(t,a,n);return c.length>0?[r,...c]:c}).flat()}getBaseUrl(){var r;let t=(r=this.openApiDoc.servers)==null?void 0:r[0].url;return this.options.baseUrl===""&&t?t:this.options.baseUrl}getZodSchemaObj(t){let r=this.getRefByZodSchemaName(t);if(r)return this.getSchemaByRef(r);let n=this.getSchemaByCompositeZodSchemaName(t);if(n)return n;let i=this.getExtractedEnumZodSchemaDataByName(t);if(i)return i.meta.schemas.reduce((s,a)=>({...s,...this.resolveObject(a)}),{})}initialize(){var t,r,n,i,s;this.schemaRefs.forEach(a=>{let c=qi(a),u=Zo(c),l=Xr(u,this.options.schemaSuffix);this.schemaData.push({ref:c,name:u,zodSchemaName:l,tags:[]})});for(let a in this.openApiDoc.paths){let c=this.openApiDoc.paths[a],u=Zn(c,Gn);for(let l in u){let p=u[l];if(!p||p.deprecated&&!this.options.withDeprecatedEndpoints)continue;let f=Mi(p,this.options),d=fa({path:a,method:l,operation:p,operationsByTag:this.operationsByTag,options:this.options}),h=this.operationNames.filter(E=>E===d).length<=1,y=ft(Li(d,h,f)),b=[];if((t=p.parameters)==null||t.map(E=>{let w=E,j=w.schema,I=`operation ${p.operationId??a} parameter ${w.name}`;b.push(...ku(this,j,I)),this.options.extractEnums&&va({resolver:this,schema:j,schemaInfo:I,tags:[f],nameSegments:[y,w.name],includeSelf:!0})}),p.requestBody){let E=this.resolveObject(p.requestBody),j=Object.keys(E.content??{}).find(Jr);if(j){let I=(n=(r=E.content)==null?void 0:r[j])==null?void 0:n.schema,C=`operation ${p.operationId} request body`;b.push(...ku(this,I,C)),this.options.extractEnums&&va({resolver:this,schema:I,schemaInfo:C,tags:[f],nameSegments:[xu(y)]})}}for(let E in p.responses){let w=this.resolveObject(p.responses[E]),I=Object.keys(w.content??{}).find(Pu);if(I){let C=(s=(i=w.content)==null?void 0:i[I])==null?void 0:s.schema,fe=`operation ${p.operationId} response body`;b.push(...ku(this,C,fe)),this.options.extractEnums&&va({resolver:this,schema:C,schemaInfo:fe,tags:[f],nameSegments:[Au({statusCode:E,operationName:d,isUniqueOperationName:h,tag:f})]})}}xE(this,b).forEach(E=>{let w=this.getSchemaDataByRef(E);w&&w.tags.push(f)})}}this.options.extractEnums&&(this.schemaRefs.forEach(a=>{var u;let c=qi(a);va({resolver:this,schema:this.getSchemaByRef(c),schemaRef:c,tags:((u=this.getSchemaDataByRef(c))==null?void 0:u.tags)??[],nameSegments:[Zo(c)]})}),CE(this),this.handleDuplicateEnumZodSchemas(),IE(this))}handleDuplicateEnumZodSchemas(){let t=this.enumZodSchemas.map(({code:n})=>n),r=this.enumZodSchemas.filter(({code:n})=>t.includes(n));this.schemaData.forEach(n=>{var a;let i=(a=r.find(({zodSchemaName:c})=>c===n.zodSchemaName))==null?void 0:a.code;if(!i)return;let s=this.extractedEnumZodSchemaData.find(({code:c})=>c===i);s&&(n.tags.push(...s.meta.tags??[]),s.meta.schemaRefs.forEach(c=>{this.dependencyGraph.refsDependencyGraph[c]||(this.dependencyGraph.refsDependencyGraph[c]=new Set),this.dependencyGraph.refsDependencyGraph[c].add(n.ref),this.dependencyGraph.deepDependencyGraph[c]||(this.dependencyGraph.deepDependencyGraph[c]=new Set),this.dependencyGraph.deepDependencyGraph[c].add(n.ref)}))}),this.extractedEnumZodSchemaData=this.extractedEnumZodSchemaData.filter(({code:n})=>!t.includes(n))}};o(Em,"SchemaResolver");var Mu=Em;function NE(e){let t=[],r={};function n(i,s){Array.isArray(s)||(s=[]),s.push(i),r[i]=!0,e[i]&&e[i].forEach(a=>{s.includes(a)||r[a]||n(a,s.slice(0))}),t.includes(i)||t.push(i)}return o(n,"visit"),Object.keys(e).forEach(i=>n(i,[])),t}o(NE,"topologicalSort");function kE(e,t){let r=Object.entries(e),n=r.filter(([i])=>t.includes(i)).sort(([i],[s])=>t.indexOf(i)-t.indexOf(s)).concat(r.filter(([i])=>!t.includes(i)));return Object.fromEntries(n)}o(kE,"sortObjKeysFromArray");function ME(e,t){let r=NE(e.dependencyGraph.deepDependencyGraph).map(i=>e.getZodSchemaNameByRef(i));return kE(t,r)}o(ME,"sortZodSchemasByTopology");function qE(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{let s=e.getRefByZodSchemaName(n);s&&e.isSchemaCircular(s)?(e.validationErrors.push(mE(e.getCircularSchemaChain(s).join(" -> "))),r[Xr(n,e.options.schemaSuffix)]=`z.lazy(() => ${i})`):r[Xr(n,e.options.schemaSuffix)]=i}),r}o(qE,"wrapCircularZodSchemas");function qu(e,t){let r=new Mu(e,t),n=$E(r),i=TE(r),s={...i.zodSchemas,...r.getZodSchemas(),...i.enumZodSchemas};return s=qE(r,s),s=ME(r,s),s={...r.getExtractedEnumZodSchemas(),...s},{resolver:r,data:qq({resolver:r,endpoints:n,zodSchemas:s,options:t})}}o(qu,"getDataFromOpenAPIDoc");function qq({resolver:e,endpoints:t,zodSchemas:r,options:n}){let i=new Map;return n.splitByTags?(t.forEach(s=>{let a=ya(s,n);DE(a,i).endpoints.push(s)}),Object.entries(r).forEach(([s,a])=>{let c=e.getTagByZodSchemaName(s);c&&(DE(c,i).zodSchemas[s]=a)}),i):(i.set(n.defaultTag,{endpoints:t,zodSchemas:r}),i)}o(qq,"splitDataByTags");function DE(e,t){return t.has(e)||t.set(e,{endpoints:[],zodSchemas:{}}),t.get(e)}o(DE,"getTagElement");var Yo=yt(require("fs")),$m=yt(require("path"));function LE(e){return Yo.default.readFileSync($m.default.join(__dirname,`../${e}`),"utf-8")}o(LE,"readFileSync");function wm(e){let t=`src/generators/templates/${e}.hbs`;return LE(t)}o(wm,"readHbsTemplateSync");function FE(e){let t=`src/assets/${e}`;return LE(t)}o(FE,"readAssetSync");function Hi({output:e,fileName:t}){return`${e}/${t}`}o(Hi,"getOutputFileName");function Dq(e,t){let r=$m.default.dirname(e);Yo.default.existsSync(r)||Yo.default.mkdirSync(r,{recursive:!0}),Yo.default.writeFileSync(e,t,"utf-8")}o(Dq,"writeFileWithDirSync");function Lq({fileName:e,content:t}){Dq(e,t)}o(Lq,"writeFileSync");function VE(e){e.forEach(Lq)}o(VE,"writeGenerateFileData");function BE(e,t){let r={...yu,...t},{resolver:n,data:i}=qu(e,r);if(n.validationErrors.length>0){let s=bE(n.validationErrors);Object.entries(s).forEach(([a,c])=>{console.log(`${Dr.red(`${$O[a]}:`)}
|
|
145
145
|
${c.map(u=>`- ${u}`).join(`
|