@povio/openapi-codegen-cli 2.0.0-rc.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -9
- package/dist/generator.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/rest/error-handling.d.ts +6 -1
- package/dist/lib/rest/rest-client.d.ts +4 -2
- package/dist/sh.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/generators/templates/app-rest-client.hbs +1 -1
package/dist/sh.js
CHANGED
|
@@ -522,7 +522,7 @@ ${rr.join(`
|
|
|
522
522
|
`:`
|
|
523
523
|
`)+m,T=b+1,b=l.indexOf(`
|
|
524
524
|
`,T)}while(b!==-1);return I+=l.slice(T),I}t(EQe,"stringEncaseCRLFWithFirstIndex");var{stdout:PQe,stderr:wQe}=kQe,DEe=Symbol("GENERATOR"),vM=Symbol("STYLER"),MU=Symbol("IS_EMPTY"),AQe=["ansi","ansi","ansi256","ansi16m"],bM=Object.create(null),R5t=t((l,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let m=PQe?PQe.level:0;l.level=u.level===void 0?m:u.level},"applyOptions"),OEe=class OEe{constructor(u){return DQe(u)}};t(OEe,"Chalk");var nce=OEe,DQe=t(l=>{let u=t((...m)=>m.join(" "),"chalk");return R5t(u,l),Object.setPrototypeOf(u,RU.prototype),u},"chalkFactory");function RU(l){return DQe(l)}t(RU,"createChalk");Object.setPrototypeOf(RU.prototype,Function.prototype);for(let[l,u]of Object.entries(Yx))bM[l]={get(){let m=ice(this,NEe(u.open,u.close,this[vM]),this[MU]);return Object.defineProperty(this,l,{value:m}),m}};bM.visible={get(){let l=ice(this,this[vM],!0);return Object.defineProperty(this,"visible",{value:l}),l}};var IEe=t((l,u,m,...b)=>l==="rgb"?u==="ansi16m"?Yx[m].ansi16m(...b):u==="ansi256"?Yx[m].ansi256(Yx.rgbToAnsi256(...b)):Yx[m].ansi(Yx.rgbToAnsi(...b)):l==="hex"?IEe("rgb",u,m,...Yx.hexToRgb(...b)):Yx[m][l](...b),"getModelAnsi"),L5t=["rgb","hex","ansi256"];for(let l of L5t){bM[l]={get(){let{level:m}=this;return function(...b){let T=NEe(IEe(l,AQe[m],"color",...b),Yx.color.close,this[vM]);return ice(this,T,this[MU])}}};let u="bg"+l[0].toUpperCase()+l.slice(1);bM[u]={get(){let{level:m}=this;return function(...b){let T=NEe(IEe(l,AQe[m],"bgColor",...b),Yx.bgColor.close,this[vM]);return ice(this,T,this[MU])}}}}var j5t=Object.defineProperties(()=>{},{...bM,level:{enumerable:!0,get(){return this[DEe].level},set(l){this[DEe].level=l}}}),NEe=t((l,u,m)=>{let b,T;return m===void 0?(b=l,T=u):(b=m.openAll+l,T=u+m.closeAll),{open:l,close:u,openAll:b,closeAll:T,parent:m}},"createStyler"),ice=t((l,u,m)=>{let b=t((...T)=>B5t(b,T.length===1?""+T[0]:T.join(" ")),"builder");return Object.setPrototypeOf(b,j5t),b[DEe]=l,b[vM]=u,b[MU]=m,b},"createBuilder"),B5t=t((l,u)=>{if(l.level<=0||!u)return l[MU]?"":u;let m=l[vM];if(m===void 0)return u;let{openAll:b,closeAll:T}=m;if(u.includes("\x1B"))for(;m!==void 0;)u=CQe(u,m.close,m.open),m=m.parent;let I=u.indexOf(`
|
|
525
|
-
`);return I!==-1&&(u=EQe(u,T,b,I)),b+u+T},"applyStyle");Object.defineProperties(RU.prototype,bM);var VXt=RU(),UXt=RU({level:wQe?wQe.level:0});var CA=new nce;function FEe(l){console.log(l)}t(FEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function LU(l){console.log(CA.green(`[SUCCESS] ${l}`))}t(LU,"logSuccess");function HN(l,u){l instanceof Error?console.log(CA.red(`[ERROR] ${u||l.message}`)):console.log(CA.red(`[ERROR] ${l}`))}t(HN,"logError");function sce(l){console.log(CA.bgYellow(`==== ${l} ====`))}t(sce,"logBanner");var IQe=Vd(require("fs"));function SM(){return"2.0.0-rc.2"}t(SM,"getVersion");var iYt=Vd(OQe());var MEe=Symbol("options_key");function zu(l){return(u,m)=>{var b,T;if(l!=null){let I={...Reflect.getMetadata(MEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((T=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:T.toLowerCase())}};Reflect.defineMetadata(MEe,I,u)}}}t(zu,"YargOption");function FQe(l){let u=Reflect.getMetadata(MEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(FQe,"getYargsOption");function ace(l){return async u=>u.options($5t(l)).middleware(async m=>await J5t(l,m),!0)}t(ace,"getBuilder");function $5t(l){return Object.entries(FQe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([T])=>!["envAlias","default"].includes(T))),u),{})}t($5t,"getYargsOptions");async function J5t(l,u){let m=new l;for(let[b,T]of Object.entries(FQe(l)))m[b]=u[b]??T.default;return m}t(J5t,"loadYargsConfig");var cit=Vd(Cwe());var frt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},_rt={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var u_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),qA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),wW=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ny=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),prt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),Ewe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),drt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),RVt=t(l=>{var b;let u=l.reduce((T,I)=>({...T,[I]:(T[I]??0)+1}),{});return(b=Object.entries(u).sort((T,I)=>T[1]===I[1]?I[0].length-T[0].length:I[1]-T[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),Pwe=t(l=>{let u=l.map(u_).map(mrt).map(m=>LVt(m)).flat();return RVt(u)},"getMostCommonAdjacentCombinationSplit"),mrt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),_le=t(l=>mrt(l).join(" "),"camelToSpaceSeparated"),LVt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let T=0;T<l.length;T++)if(!u.includes(l[T].toLowerCase()))for(let I=T+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(T,I).join(""));return m},"getAdjacentStringCombinations"),hrt=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${qA(m)}|${u_(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");function m8(l){return prt(l)}t(m8,"formatTag");function zA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return m8(m??u.defaultTag)}t(zA,"getOperationTag");function Y1(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return m8(m??u.defaultTag)}t(Y1,"getEndpointTag");function grt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(grt,"isTagExcluded");var h8="application/json",wwe={"Content-Type":h8,Accept:h8},ple="data",Awe="axios",VA="config",DC="AxiosRequestConfig",dle={defaultImport:Awe,bindings:[DC],from:"axios"};var r6=Vd(mle()),Dwe=2,yrt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],vrt=["query","header","path"],g8=[r6.OpenAPIV3.HttpMethods.GET,r6.OpenAPIV3.HttpMethods.PUT,r6.OpenAPIV3.HttpMethods.POST,r6.OpenAPIV3.HttpMethods.DELETE,r6.OpenAPIV3.HttpMethods.OPTIONS,r6.OpenAPIV3.HttpMethods.HEAD,r6.OpenAPIV3.HttpMethods.PATCH,r6.OpenAPIV3.HttpMethods.TRACE],brt=["string","number","integer","boolean"],AW=["allOf","anyOf","oneOf"];var Srt="Schema",xrt="Enum",Trt="Body",krt="Param",Crt="Response",Ert="ErrorResponse",DW="z.void()",aR="z.any()",hle="z.instanceof(Blob)",IW="z.enum",Prt="z.int()",wrt="z.number()",gle="z.string()",Art="z.email()",Drt="z.url()",Irt="z.uuid()",Nrt="z.iso.datetime({ offset: true })",WA={bindings:["z"],from:"zod"};var n6=Symbol.for("@ts-pattern/matcher"),$Vt=Symbol.for("@ts-pattern/isVariadic"),vle="@ts-pattern/anonymous-select-key",Iwe=t(l=>!!(l&&typeof l=="object"),"r"),yle=t(l=>l&&!!l[n6],"i"),OC=t((l,u,m)=>{if(yle(l)){let b=l[n6](),{matched:T,selections:I}=b.match(u);return T&&I&&Object.keys(I).forEach(L=>m(L,I[L])),T}if(Iwe(l)){if(!Iwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],T=[],I=[];for(let L of l.keys()){let Q=l[L];yle(Q)&&Q[$Vt]?I.push(Q):I.length?T.push(Q):b.push(Q)}if(I.length){if(I.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(u.length<b.length+T.length)return!1;let L=u.slice(0,b.length),Q=T.length===0?[]:u.slice(-T.length),ae=u.slice(b.length,T.length===0?1/0:-T.length);return b.every((ee,pe)=>OC(ee,L[pe],m))&&T.every((ee,pe)=>OC(ee,Q[pe],m))&&(I.length===0||OC(I[0],ae,m))}return l.length===u.length&&l.every((L,Q)=>OC(L,u[Q],m))}return Reflect.ownKeys(l).every(b=>{let T=l[b];return(b in u||yle(I=T)&&I[n6]().matcherType==="optional")&&OC(T,u[b],m);var I})}return Object.is(u,l)},"s"),XA=t(l=>{var u,m,b;return Iwe(l)?yle(l)?(u=(m=(b=l[n6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?OW(l,XA):OW(Object.values(l),XA):[]},"o"),OW=t((l,u)=>l.reduce((m,b)=>m.concat(u(b)),[]),"c");function pS(l){return Object.assign(l,{optional:t(()=>JVt(l),"optional"),and:t(u=>Zp(l,u),"and"),or:t(u=>qVt(l,u),"or"),select:t(u=>u===void 0?Ort(l):Ort(u,l),"select")})}t(pS,"u");function JVt(l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return u===void 0?(XA(l).forEach(T=>b(T,void 0)),{matched:!0,selections:m}):{matched:OC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>XA(l),"getSelectionKeys"),matcherType:"optional"})})}t(JVt,"h");function Zp(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return{matched:l.every(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>OW(l,XA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function qVt(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return OW(l,XA).forEach(T=>b(T,void 0)),{matched:l.some(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>OW(l,XA),"getSelectionKeys"),matcherType:"or"})})}t(qVt,"d");function Df(l){return{[n6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Df,"p");function Ort(...l){let u=typeof l[0]=="string"?l[0]:void 0,m=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return pS({[n6]:()=>({match:t(b=>{let T={[u??vle]:b};return{matched:m===void 0||OC(m,b,(I,L)=>{T[I]=L}),selections:T}},"match"),getSelectionKeys:t(()=>[u??vle].concat(m===void 0?[]:XA(m)),"getSelectionKeys")})})}t(Ort,"y");function IC(l){return typeof l=="number"}t(IC,"v");function HA(l){return typeof l=="string"}t(HA,"b");function GA(l){return typeof l=="bigint"}t(GA,"w");var Cnr=pS(Df(function(l){return!0}));var QA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>QA(Zp(l,(m=>Df(b=>HA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>QA(Zp(l,(m=>Df(b=>HA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>QA(Zp(l,(m=>Df(b=>HA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&!!b.match(m)))));var m},"regex")}),"j"),Enr=QA(Df(HA)),NC=t(l=>Object.assign(pS(l),{between:t((u,m)=>NC(Zp(l,((b,T)=>Df(I=>IC(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<m))(u))),"lt"),gt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>m))(u))),"gt"),lte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<=m))(u))),"lte"),gte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>=m))(u))),"gte"),int:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>NC(Zp(l,Df(u=>IC(u)&&u>0))),"positive"),negative:t(()=>NC(Zp(l,Df(u=>IC(u)&&u<0))),"negative")}),"x"),Pnr=NC(Df(IC)),ZA=t(l=>Object.assign(pS(l),{between:t((u,m)=>ZA(Zp(l,((b,T)=>Df(I=>GA(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b<m))(u))),"lt"),gt:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b>m))(u))),"gt"),lte:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b<=m))(u))),"lte"),gte:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b>=m))(u))),"gte"),positive:t(()=>ZA(Zp(l,Df(u=>GA(u)&&u>0))),"positive"),negative:t(()=>ZA(Zp(l,Df(u=>GA(u)&&u<0))),"negative")}),"A"),wnr=ZA(Df(GA)),Anr=pS(Df(function(l){return typeof l=="boolean"})),Dnr=pS(Df(function(l){return typeof l=="symbol"})),Inr=pS(Df(function(l){return l==null})),Nnr=pS(Df(function(l){return l!=null}));var Mwe=class Mwe extends Error{constructor(u){let m;try{m=JSON.stringify(u)}catch{m=u}super(`Pattern matching error: no pattern matches value ${m}`),this.input=void 0,this.input=u}};t(Mwe,"W");var Nwe=Mwe,Owe={matched:!1,value:void 0};function Xy(l){return new Fwe(l,Owe)}t(Xy,"z");var NW=class NW{constructor(u,m){this.input=void 0,this.state=void 0,this.input=u,this.state=m}with(...u){if(this.state.matched)return this;let m=u[u.length-1],b=[u[0]],T;u.length===3&&typeof u[1]=="function"?T=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Q=t((ee,pe)=>{I=!0,L[ee]=pe},"a"),ae=!b.some(ee=>OC(ee,this.input,Q))||T&&!T(this.input)?Owe:{matched:!0,value:m(I?vle in L?L[vle]:L:this.input,this.input)};return new NW(this.input,ae)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new NW(this.input,b?{matched:!0,value:m(this.input,this.input)}:Owe)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Nwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(NW,"I");var Fwe=NW;function gf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(gf,"isReferenceObject");function iy(l){return!gf(l)}t(iy,"isSchemaObject");function ble(l){return l.type==="array"}t(ble,"isArraySchemaObject");function Frt(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[u,m]=l.allOf.reduce((T,I)=>{if(zVt(I)){let L=I.required;T[0].push(...L??[])}else T[1].push(I);return T},[[],[]]),b={properties:u.reduce((T,I)=>(T[I]={},T),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((T,I)=>{if(gf(T)){let L=I(T.$ref);L&&b.required.forEach(Q=>{var ae;b.properties[Q]=((ae=L==null?void 0:L.properties)==null?void 0:ae[Q])??{}})}else{let L=T.properties??{};b.required.forEach(Q=>{L[Q]&&(b.properties[Q]=L[Q]??{})})}},"patchRequiredSchemaInLoop")}}t(Frt,"inferRequiredSchema");var zVt=t(l=>!gf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var Rrt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),y8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),oR=t(l=>y8(l).split("/").at(-1),"getSchemaNameByRef");function Lwe(l){let u=VVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ny(u)}t(Lwe,"normalizeString");function jwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(jwe,"wrapWithQuotesIfNeeded");function Lrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(Lrt,"unwrapQuotesIfNeeded");function VVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(VVt,"prefixStringStartingWithNumberIfNeeded");function Bwe(l){let u=l.replaceAll("_","#");return ny(u.replaceAll("-","_")).replaceAll("#","_")}t(Bwe,"pathParamToVariableName");var v8=t(l=>brt.includes(l),"isPrimitiveType");function jrt(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(u,m)=>{let b=m.codePointAt(),T=b.toString(16);return b<=255?`\\x${`00${T}`.slice(-2)}`:`\\u${`0000${T}`.slice(-4)}`}).replace(/\//g,"\\/")}t(jrt,"escapeControlCharacters");function FC(l){return l.includes("application/")&&l.includes("json")||yrt.includes(l)||l.includes("text/")}t(FC,"isParamMediaTypeAllowed");function FW(l){return l>=200&&l<300}t(FW,"isMainResponseStatus");function Sle(l){return!(l>=200&&l<300)}t(Sle,"isErrorStatus");function xle(l){return l.startsWith("application/")}t(xle,"isMediaTypeAllowed");var Mrt=/({\w+})/g,UVt=/[^\w\-]+/g;function Brt(l){l=u_(wW(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(Mrt)];if(u.length>0){let m=u.sort((b,T)=>b.index-T.index)[u.length-1][0];l=`${l.replace(Mrt,"")}By${u_(m.slice(1,-1))}`}return l.replace(UVt,"_")}t(Brt,"pathToVariableName");var Rwe=/{(\b\w+(?:-\w+)*\b)}/g;function $rt(l){let u=l.match(Rwe);return u===null?l.replaceAll(Rwe,":$1"):(u.forEach(m=>{let b=Bwe(m.replaceAll(Rwe,":$1"));l=l.replaceAll(m,b)}),l)}t($rt,"replaceHyphenatedPath");var Tle=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&iy(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),b8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");function MC({schema:l,meta:u,options:m}){let b=[];Xy(l.type).with("string",()=>b.push(GVt(l))).with("number","integer",()=>b.push(ZVt(l))).with("array",()=>b.push(XVt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
|
|
525
|
+
`);return I!==-1&&(u=EQe(u,T,b,I)),b+u+T},"applyStyle");Object.defineProperties(RU.prototype,bM);var VXt=RU(),UXt=RU({level:wQe?wQe.level:0});var CA=new nce;function FEe(l){console.log(l)}t(FEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function LU(l){console.log(CA.green(`[SUCCESS] ${l}`))}t(LU,"logSuccess");function HN(l,u){l instanceof Error?console.log(CA.red(`[ERROR] ${u||l.message}`)):console.log(CA.red(`[ERROR] ${l}`))}t(HN,"logError");function sce(l){console.log(CA.bgYellow(`==== ${l} ====`))}t(sce,"logBanner");var IQe=Vd(require("fs"));function SM(){return"2.0.0"}t(SM,"getVersion");var iYt=Vd(OQe());var MEe=Symbol("options_key");function zu(l){return(u,m)=>{var b,T;if(l!=null){let I={...Reflect.getMetadata(MEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((T=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:T.toLowerCase())}};Reflect.defineMetadata(MEe,I,u)}}}t(zu,"YargOption");function FQe(l){let u=Reflect.getMetadata(MEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(FQe,"getYargsOption");function ace(l){return async u=>u.options($5t(l)).middleware(async m=>await J5t(l,m),!0)}t(ace,"getBuilder");function $5t(l){return Object.entries(FQe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([T])=>!["envAlias","default"].includes(T))),u),{})}t($5t,"getYargsOptions");async function J5t(l,u){let m=new l;for(let[b,T]of Object.entries(FQe(l)))m[b]=u[b]??T.default;return m}t(J5t,"loadYargsConfig");var cit=Vd(Cwe());var frt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},_rt={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var u_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),qA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),wW=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ny=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),prt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),Ewe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),drt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),RVt=t(l=>{var b;let u=l.reduce((T,I)=>({...T,[I]:(T[I]??0)+1}),{});return(b=Object.entries(u).sort((T,I)=>T[1]===I[1]?I[0].length-T[0].length:I[1]-T[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),Pwe=t(l=>{let u=l.map(u_).map(mrt).map(m=>LVt(m)).flat();return RVt(u)},"getMostCommonAdjacentCombinationSplit"),mrt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),_le=t(l=>mrt(l).join(" "),"camelToSpaceSeparated"),LVt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let T=0;T<l.length;T++)if(!u.includes(l[T].toLowerCase()))for(let I=T+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(T,I).join(""));return m},"getAdjacentStringCombinations"),hrt=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${qA(m)}|${u_(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");function m8(l){return prt(l)}t(m8,"formatTag");function zA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return m8(m??u.defaultTag)}t(zA,"getOperationTag");function Y1(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return m8(m??u.defaultTag)}t(Y1,"getEndpointTag");function grt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(grt,"isTagExcluded");var h8="application/json",wwe={"Content-Type":h8,Accept:h8},ple="data",Awe="axios",VA="config",DC="AxiosRequestConfig",dle={defaultImport:Awe,bindings:[DC],from:"axios"};var r6=Vd(mle()),Dwe=2,yrt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],vrt=["query","header","path"],g8=[r6.OpenAPIV3.HttpMethods.GET,r6.OpenAPIV3.HttpMethods.PUT,r6.OpenAPIV3.HttpMethods.POST,r6.OpenAPIV3.HttpMethods.DELETE,r6.OpenAPIV3.HttpMethods.OPTIONS,r6.OpenAPIV3.HttpMethods.HEAD,r6.OpenAPIV3.HttpMethods.PATCH,r6.OpenAPIV3.HttpMethods.TRACE],brt=["string","number","integer","boolean"],AW=["allOf","anyOf","oneOf"];var Srt="Schema",xrt="Enum",Trt="Body",krt="Param",Crt="Response",Ert="ErrorResponse",DW="z.void()",aR="z.any()",hle="z.instanceof(Blob)",IW="z.enum",Prt="z.int()",wrt="z.number()",gle="z.string()",Art="z.email()",Drt="z.url()",Irt="z.uuid()",Nrt="z.iso.datetime({ offset: true })",WA={bindings:["z"],from:"zod"};var n6=Symbol.for("@ts-pattern/matcher"),$Vt=Symbol.for("@ts-pattern/isVariadic"),vle="@ts-pattern/anonymous-select-key",Iwe=t(l=>!!(l&&typeof l=="object"),"r"),yle=t(l=>l&&!!l[n6],"i"),OC=t((l,u,m)=>{if(yle(l)){let b=l[n6](),{matched:T,selections:I}=b.match(u);return T&&I&&Object.keys(I).forEach(L=>m(L,I[L])),T}if(Iwe(l)){if(!Iwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],T=[],I=[];for(let L of l.keys()){let Q=l[L];yle(Q)&&Q[$Vt]?I.push(Q):I.length?T.push(Q):b.push(Q)}if(I.length){if(I.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(u.length<b.length+T.length)return!1;let L=u.slice(0,b.length),Q=T.length===0?[]:u.slice(-T.length),ae=u.slice(b.length,T.length===0?1/0:-T.length);return b.every((ee,pe)=>OC(ee,L[pe],m))&&T.every((ee,pe)=>OC(ee,Q[pe],m))&&(I.length===0||OC(I[0],ae,m))}return l.length===u.length&&l.every((L,Q)=>OC(L,u[Q],m))}return Reflect.ownKeys(l).every(b=>{let T=l[b];return(b in u||yle(I=T)&&I[n6]().matcherType==="optional")&&OC(T,u[b],m);var I})}return Object.is(u,l)},"s"),XA=t(l=>{var u,m,b;return Iwe(l)?yle(l)?(u=(m=(b=l[n6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?OW(l,XA):OW(Object.values(l),XA):[]},"o"),OW=t((l,u)=>l.reduce((m,b)=>m.concat(u(b)),[]),"c");function pS(l){return Object.assign(l,{optional:t(()=>JVt(l),"optional"),and:t(u=>Zp(l,u),"and"),or:t(u=>qVt(l,u),"or"),select:t(u=>u===void 0?Ort(l):Ort(u,l),"select")})}t(pS,"u");function JVt(l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return u===void 0?(XA(l).forEach(T=>b(T,void 0)),{matched:!0,selections:m}):{matched:OC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>XA(l),"getSelectionKeys"),matcherType:"optional"})})}t(JVt,"h");function Zp(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return{matched:l.every(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>OW(l,XA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function qVt(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return OW(l,XA).forEach(T=>b(T,void 0)),{matched:l.some(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>OW(l,XA),"getSelectionKeys"),matcherType:"or"})})}t(qVt,"d");function Df(l){return{[n6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Df,"p");function Ort(...l){let u=typeof l[0]=="string"?l[0]:void 0,m=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return pS({[n6]:()=>({match:t(b=>{let T={[u??vle]:b};return{matched:m===void 0||OC(m,b,(I,L)=>{T[I]=L}),selections:T}},"match"),getSelectionKeys:t(()=>[u??vle].concat(m===void 0?[]:XA(m)),"getSelectionKeys")})})}t(Ort,"y");function IC(l){return typeof l=="number"}t(IC,"v");function HA(l){return typeof l=="string"}t(HA,"b");function GA(l){return typeof l=="bigint"}t(GA,"w");var Cnr=pS(Df(function(l){return!0}));var QA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>QA(Zp(l,(m=>Df(b=>HA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>QA(Zp(l,(m=>Df(b=>HA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>QA(Zp(l,(m=>Df(b=>HA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return QA(Zp(l,(m=u,Df(b=>HA(b)&&!!b.match(m)))));var m},"regex")}),"j"),Enr=QA(Df(HA)),NC=t(l=>Object.assign(pS(l),{between:t((u,m)=>NC(Zp(l,((b,T)=>Df(I=>IC(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<m))(u))),"lt"),gt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>m))(u))),"gt"),lte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<=m))(u))),"lte"),gte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>=m))(u))),"gte"),int:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>NC(Zp(l,Df(u=>IC(u)&&u>0))),"positive"),negative:t(()=>NC(Zp(l,Df(u=>IC(u)&&u<0))),"negative")}),"x"),Pnr=NC(Df(IC)),ZA=t(l=>Object.assign(pS(l),{between:t((u,m)=>ZA(Zp(l,((b,T)=>Df(I=>GA(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b<m))(u))),"lt"),gt:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b>m))(u))),"gt"),lte:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b<=m))(u))),"lte"),gte:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b>=m))(u))),"gte"),positive:t(()=>ZA(Zp(l,Df(u=>GA(u)&&u>0))),"positive"),negative:t(()=>ZA(Zp(l,Df(u=>GA(u)&&u<0))),"negative")}),"A"),wnr=ZA(Df(GA)),Anr=pS(Df(function(l){return typeof l=="boolean"})),Dnr=pS(Df(function(l){return typeof l=="symbol"})),Inr=pS(Df(function(l){return l==null})),Nnr=pS(Df(function(l){return l!=null}));var Mwe=class Mwe extends Error{constructor(u){let m;try{m=JSON.stringify(u)}catch{m=u}super(`Pattern matching error: no pattern matches value ${m}`),this.input=void 0,this.input=u}};t(Mwe,"W");var Nwe=Mwe,Owe={matched:!1,value:void 0};function Xy(l){return new Fwe(l,Owe)}t(Xy,"z");var NW=class NW{constructor(u,m){this.input=void 0,this.state=void 0,this.input=u,this.state=m}with(...u){if(this.state.matched)return this;let m=u[u.length-1],b=[u[0]],T;u.length===3&&typeof u[1]=="function"?T=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Q=t((ee,pe)=>{I=!0,L[ee]=pe},"a"),ae=!b.some(ee=>OC(ee,this.input,Q))||T&&!T(this.input)?Owe:{matched:!0,value:m(I?vle in L?L[vle]:L:this.input,this.input)};return new NW(this.input,ae)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new NW(this.input,b?{matched:!0,value:m(this.input,this.input)}:Owe)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Nwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(NW,"I");var Fwe=NW;function gf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(gf,"isReferenceObject");function iy(l){return!gf(l)}t(iy,"isSchemaObject");function ble(l){return l.type==="array"}t(ble,"isArraySchemaObject");function Frt(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[u,m]=l.allOf.reduce((T,I)=>{if(zVt(I)){let L=I.required;T[0].push(...L??[])}else T[1].push(I);return T},[[],[]]),b={properties:u.reduce((T,I)=>(T[I]={},T),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((T,I)=>{if(gf(T)){let L=I(T.$ref);L&&b.required.forEach(Q=>{var ae;b.properties[Q]=((ae=L==null?void 0:L.properties)==null?void 0:ae[Q])??{}})}else{let L=T.properties??{};b.required.forEach(Q=>{L[Q]&&(b.properties[Q]=L[Q]??{})})}},"patchRequiredSchemaInLoop")}}t(Frt,"inferRequiredSchema");var zVt=t(l=>!gf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var Rrt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),y8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),oR=t(l=>y8(l).split("/").at(-1),"getSchemaNameByRef");function Lwe(l){let u=VVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ny(u)}t(Lwe,"normalizeString");function jwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(jwe,"wrapWithQuotesIfNeeded");function Lrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(Lrt,"unwrapQuotesIfNeeded");function VVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(VVt,"prefixStringStartingWithNumberIfNeeded");function Bwe(l){let u=l.replaceAll("_","#");return ny(u.replaceAll("-","_")).replaceAll("#","_")}t(Bwe,"pathParamToVariableName");var v8=t(l=>brt.includes(l),"isPrimitiveType");function jrt(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(u,m)=>{let b=m.codePointAt(),T=b.toString(16);return b<=255?`\\x${`00${T}`.slice(-2)}`:`\\u${`0000${T}`.slice(-4)}`}).replace(/\//g,"\\/")}t(jrt,"escapeControlCharacters");function FC(l){return l.includes("application/")&&l.includes("json")||yrt.includes(l)||l.includes("text/")}t(FC,"isParamMediaTypeAllowed");function FW(l){return l>=200&&l<300}t(FW,"isMainResponseStatus");function Sle(l){return!(l>=200&&l<300)}t(Sle,"isErrorStatus");function xle(l){return l.startsWith("application/")}t(xle,"isMediaTypeAllowed");var Mrt=/({\w+})/g,UVt=/[^\w\-]+/g;function Brt(l){l=u_(wW(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(Mrt)];if(u.length>0){let m=u.sort((b,T)=>b.index-T.index)[u.length-1][0];l=`${l.replace(Mrt,"")}By${u_(m.slice(1,-1))}`}return l.replace(UVt,"_")}t(Brt,"pathToVariableName");var Rwe=/{(\b\w+(?:-\w+)*\b)}/g;function $rt(l){let u=l.match(Rwe);return u===null?l.replaceAll(Rwe,":$1"):(u.forEach(m=>{let b=Bwe(m.replaceAll(Rwe,":$1"));l=l.replaceAll(m,b)}),l)}t($rt,"replaceHyphenatedPath");var Tle=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&iy(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),b8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");function MC({schema:l,meta:u,options:m}){let b=[];Xy(l.type).with("string",()=>b.push(GVt(l))).with("number","integer",()=>b.push(ZVt(l))).with("array",()=>b.push(XVt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
|
|
526
526
|
`,"\r",`\r
|
|
527
527
|
`].some(I=>String.prototype.includes.call(l.description,I))?b.push(`describe(\`${l.description}\`)`):b.push(`describe("${l.description}")`));let T=b.concat(WVt({schema:l,meta:u,options:m}),m.withDefaultValues!==!1?HVt(l):[]).filter(Boolean).join(".");return T?`.${T}`:""}t(MC,"getZodChain");function WVt({schema:l,meta:u,options:m}){return l.nullable&&!(u!=null&&u.isRequired)?"nullish()":l.nullable||m.replaceOptionalWithNullish&&(u!=null&&u.isParentPartial)?"nullable()":u!=null&&u.isRequired?"":m.replaceOptionalWithNullish?"nullish()":"optional()"}t(WVt,"getZodChainablePresence");function HVt(l){return l.default!==void 0?`default(${Xy(l.type).with("number","integer",()=>Lrt(l.default)).otherwise(()=>JSON.stringify(l.default))})`:""}t(HVt,"getZodChainableDefault");function GVt(l){let u=[];return l.enum||(l.minLength!==void 0&&u.push(`min(${l.minLength})`),l.maxLength!==void 0&&u.push(`max(${l.maxLength})`)),l.pattern&&u.push(`regex(${QVt(l.pattern)})`),u.join(".")}t(GVt,"getZodChainableStringValidations");function QVt(l){return l.startsWith("/")&&l.endsWith("/")&&(l=l.slice(1,-1)),l=jrt(l),`/${l}/`}t(QVt,"formatPatternIfNeeded");function ZVt(l){let u=[];return l.enum?"":(l.minimum!==void 0?l.exclusiveMinimum===!0?u.push(`gt(${l.minimum})`):u.push(`gte(${l.minimum})`):typeof l.exclusiveMinimum=="number"&&u.push(`gt(${l.exclusiveMinimum})`),l.maximum!==void 0?l.exclusiveMaximum===!0?u.push(`lt(${l.maximum})`):u.push(`lte(${l.maximum})`):typeof l.exclusiveMaximum=="number"&&u.push(`lt(${l.exclusiveMaximum})`),l.multipleOf&&u.push(`multipleOf(${l.multipleOf})`),u.join("."))}t(ZVt,"getZodChainableNumberValidations");function XVt(l){let u=[];return l.minItems&&u.push(`min(${l.minItems})`),l.maxItems&&u.push(`max(${l.maxItems})`),u.join(".")}t(XVt,"getZodChainableArrayValidations");var C_=t(({type:l,tag:u,options:m})=>`${u_(u)}${m.configs[l].namespaceSuffix}`,"getNamespaceName");var S8=t(l=>l.reduce((u,m)=>u+m,0),"sum");function hg(l,u){if(!u)return l;if(gf(u))return l+2;if(Array.isArray(u.type))return u.type.length===1?Db("oneOf")+hg(l,{...u,type:u.type[0]}):l+Db("oneOf")+S8(u.type.map(m=>hg(0,{...u,type:m})));if(u.oneOf)return u.oneOf.length===1?Db("oneOf")+hg(l,u.oneOf[0]):l+Db("oneOf")+S8(u.oneOf.map(m=>hg(0,m)));if(u.anyOf)return u.anyOf.length===1?Db("anyOf")+hg(l,u.anyOf[0]):l+Db("anyOf")+S8(u.anyOf.map(m=>hg(0,m)));if(u.allOf)return u.allOf.length===1?Db("allOf")+hg(l,u.allOf[0]):l+Db("allOf")+S8(u.allOf.map(m=>hg(0,m)));if(!u.type)return l;if(v8(u.type))return u.enum?l+Jrt(u)+Db("enum")+S8(u.enum.map(m=>hg(0,m))):l+Jrt(u);if(u.type==="array")return u.items?Db("array")+hg(l,u.items):Db("array")+hg(l);if(u.type==="object"||u.properties||u.additionalProperties){if(u.properties){let m=Object.values(u.properties);l+=Db("object")+S8(m.map(b=>hg(0,b)))}else l+=Db("empty-object");u.additionalProperties&&(typeof u.additionalProperties=="object"?l+=hg(0,u.additionalProperties):l+=hg(1))}return l}t(hg,"getOpenAPISchemaComplexity");function Jrt(l){return Xy(l.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}t(Jrt,"complexityByType");function Db(l){return Xy(l).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}t(Db,"complexityByComposite");var Jwe=class Jwe{constructor(u,m,b={referencedBy:[]},T){this.schema=u;this.resolver=m;gf(u)&&(this.ref=u.$ref),T&&(this.enumRef=T),this.meta={...b,referencedBy:[...(b==null?void 0:b.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(u,m){var I,L;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let b=(I=this.resolver)==null?void 0:I.getZodSchemaNameByRef(this.ref);if(!b)return this.ref;let T=(L=this.resolver)==null?void 0:L.getTagByZodSchemaName(b);return m!=null&&m.tsNamespaces&&T&&T!==u?`${C_({type:"models",tag:T,options:m})}.${b}`:b}get complexity(){return hg(0,this.schema)}assign(u){return this.code=u,this}inherit(u){return u&&u.children.push(this),this}};t(Jwe,"ZodSchema");var MW=Jwe;function $we(l){var u,m;if(l)return(u=l.parent)!=null&&u.ref?l.parent.ref:$we((m=l.parent)==null?void 0:m.meta)}t($we,"getParentRef");function qrt(l,u){let m=l.getRefByZodSchemaName(u);if(m){let T=Array.from(l.dependencyGraph.refsDependencyGraph[m]??[]).map(L=>l.getZodSchemaNameByRef(L)),I=l.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(m);return[...T,...I]}let b=l.getCompositeZodSchemaByZodSchemaName(u);return b?Array.from(kle(b)).map(T=>l.getZodSchemaNameByRef(T)):[]}t(qrt,"getZodSchemaRefs");function kle(l,{skipObjectSchema:u=!1}={}){return l.children.reduce((b,T)=>{let I=T.ref??T.enumRef;return I&&b.add(I),T.children.length>0&&(!u||!iy(T.schema)||T.schema.type!=="object")&&kle(T).forEach(L=>b.add(L)),b},new Set)}t(kle,"getSchemaRefs");function Hd({schema:l,resolver:u,meta:m,tag:b}){var rr;let T=new MW(l,u,m),I={parent:T.inherit(m==null?void 0:m.parent),referencedBy:[...T.meta.referencedBy]},L={resolver:u,meta:I,tag:b};if(gf(l))return YVt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});let Q=eUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(Q)return Q;let ae=KVt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(ae)return ae;let ee=tUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(ee)return ee;let pe=rUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(pe)return pe;let Te=nUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(Te)return Te;let Ke=u.options.allReadonly?".readonly()":"";if(ble(l))return l.items?T.assign(`z.array(${Hd({...L,schema:l.items}).getCodeString(b,u.options)}${MC({schema:l.items,meta:{...I,isRequired:!0},options:u.options})})${Ke}`):T.assign(`z.array(${aR})${Ke}`);let Pt=l.type?l.type.toLowerCase():void 0;if(Pt==="object"||l.properties||l.additionalProperties){let or=l.required&&l.required.length>0,Lt=u.options.withImplicitRequiredProps?!1:l.properties&&!((rr=l.required)!=null&&rr.length),Xt="{}";l.properties&&(Xt=`{ ${Object.entries(l.properties).map(([vo,Vn])=>{var Ht;let ql={...I,isRequired:Lt?!0:or?(Ht=l.required)==null?void 0:Ht.includes(vo):u.options.withImplicitRequiredProps,name:vo,isParentPartial:Lt},zl=Vn;if(gf(Vn)&&u&&(zl=u.getSchemaByRef(Vn.$ref),!zl))throw new Error(`Schema ${Vn.$ref} not found`);let ia=Hd({...L,schema:Vn,meta:ql}),lr=ia.getCodeString(b,u.options)+MC({schema:zl,meta:ql,options:u.options}),xs=!1,Fs=$we(m);return Fs&&(xs=[...gf(Vn)?[Vn.$ref]:[],...kle(ia,{skipObjectSchema:!0})].some(wa=>{var Eo;return(Eo=u.dependencyGraph.deepDependencyGraph[wa])==null?void 0:Eo.has(Fs)})),[vo,lr,xs]}).map(([vo,Vn,ql])=>ql?`get ${jwe(vo)}() { return ${Vn} }`:`${jwe(vo)}: ${Vn}`).join(", ")} }`);let Vt="";l.additionalProperties&&(Vt=`.catchall(${typeof l.additionalProperties=="object"&&Object.keys(l.additionalProperties).length>0?Hd({...L,schema:l.additionalProperties}).getCodeString(b,u.options)+MC({schema:l.additionalProperties,meta:{...I,isRequired:!0},options:u.options}):aR})`);let zn=`z.object(${Xt})${Lt?".partial()":""}${Vt}${Ke}`;return T.assign(zn)}if(Pt==="any")return T.assign(aR);if(!Pt)return T.assign("z.unknown()");throw new Error(`Unsupported schema type: ${Pt}`)}t(Hd,"getZodSchema");function YVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!gf(l))return;let I=u.meta.referencedBy.slice(0,-1).map(ae=>ae.ref?m.getZodSchemaNameByRef(ae.ref)??ae.ref:void 0).filter(Boolean),L=m.getZodSchemaNameByRef(l.$ref);if(I.length>1&&I.includes(L))return u.assign(m.getCodeByZodSchemaName(u.ref));let Q=m.getCodeByZodSchemaName(l.$ref);if(!Q){let ae=m.getSchemaByRef(l.$ref);if(!ae)throw new Error(`Schema ${l.$ref} not found`);Q=Hd({schema:ae,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)}return m.getCodeByZodSchemaName(L)||m.setZodSchema(L,Q,T),u}t(YVt,"getReferenceZodSchema");function KVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){var L;if(!iy(l)||!l.oneOf)return;if(l.oneOf.length===1){let Q=Hd({schema:l.oneOf[0],resolver:m,meta:b,tag:T});return u.assign(Q.getCodeString(T,m.options))}let I=(L=l.oneOf)==null?void 0:L.some(Q=>iy(Q)&&((Q==null?void 0:Q.allOf)||[]).length>1);if(l.discriminator&&!I){let Q=l.discriminator.propertyName;return u.assign(`
|
|
528
528
|
z.discriminatedUnion("${Q}", [${l.oneOf.map(ae=>Hd({schema:ae,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])
|
|
@@ -534,7 +534,7 @@ ${T.map(I=>`- ${I}`).join(`
|
|
|
534
534
|
`)}
|
|
535
535
|
`)}return m.validationErrors}t(sit,"checkOpenAPIDoc");function yUt(l,u){return["models","endpoints","queries"].map(m=>uT({output:u.output,fileName:$le({tag:l,type:m,options:u})}))}t(yUt,"getOutputFileNames");function Vle({fileConfig:l={},params:{excludeTags:u,...m}}){let b=Grt(dR,l??{},{...m,excludeTags:u==null?void 0:u.split(",")});return b.checkAcl=b.acl&&b.checkAcl,b}t(Vle,"resolveConfig");var jC=Vd(require("fs")),KW=Vd(require("path"));var bUt=["openapi-codegen.config.ts"];async function Ule(l){try{if(l)return await oit(l);for(let u of bUt){let m=KW.default.resolve(process.cwd(),u);if(jC.default.existsSync(m))return await oit(m)}return null}catch(u){return HN(`Failed to load configuration: ${u instanceof Error?u.message:u}`),null}}t(Ule,"loadConfig");async function oit(l){let u=KW.default.resolve(process.cwd(),l);if(!jC.default.existsSync(u))throw new Error(`Configuration file not found: ${l}`);let m=KW.default.extname(u).toLowerCase();if(m!==".ts")throw new Error(`Only TypeScript configuration files are supported. Found: ${m}`);return xUt(u)}t(oit,"loadConfigFromPath");var cAe,SUt=t(function(u){return cAe===void 0&&(cAe=require("import-fresh")),cAe(u)},"loadJsSync"),LC;async function xUt(l){LC===void 0&&(LC=ait());let u=`${l.slice(0,-2)}cjs`;try{let m=TUt(KW.default.dirname(l))??{};m.compilerOptions={...m.compilerOptions,module:LC.ModuleKind.NodeNext,moduleResolution:LC.ModuleResolutionKind.NodeNext,target:LC.ScriptTarget.ES2022,noEmit:!1};let b=jC.default.readFileSync(l,"utf-8"),T=LC.transpileModule(b,m).outputText;return(0,jC.writeFileSync)(u,T),SUt(u).default}catch(m){throw m.message=`TypeScript Error in ${l}:
|
|
536
536
|
${m.message}`,m}finally{(0,jC.existsSync)(u)&&(0,jC.rmSync)(u)}}t(xUt,"loadTsConfig");function TUt(l){let u=LC.findConfigFile(l,T=>LC.sys.fileExists(T));if(u===void 0)return;let{config:m,error:b}=LC.readConfigFile(u,T=>LC.sys.readFile(T));if(b)throw new Error(`Error in ${u}: ${b.messageText.toString()}`);return m}t(TUt,"resolveTsConfig");async function lit({verbose:l,config:u,excludeTags:m,...b}){let T=Date.now();l&&oS("Resolving config...");let I=await Ule(u),L=Vle({fileConfig:I,params:b});l&&oS("Parsing OpenAPI spec...");let Q=await cit.default.bundle(L.input);l&&oS("Running check...");let ae=sit(Q,L);if(ae.length===0)LU(`Time: ${Date.now()-T}ms`);else throw new Error(`Found ${ae.length} issues. Time: ${Date.now()-T}ms`)}t(lit,"check");var fT=class fT{config;input;splitByTags;defaultTag;excludeTags;excludePathRegex;excludeRedundantZodSchemas;verbose};t(fT,"CheckOptions"),qu([zu({envAlias:"config"})],fT.prototype,"config",2),qu([zu({envAlias:"input"})],fT.prototype,"input",2),qu([zu({envAlias:"splitByTags",type:"boolean"})],fT.prototype,"splitByTags",2),qu([zu({envAlias:"defaultTag"})],fT.prototype,"defaultTag",2),qu([zu({envAlias:"excludeTags"})],fT.prototype,"excludeTags",2),qu([zu({envAlias:"excludePathRegex"})],fT.prototype,"excludePathRegex",2),qu([zu({envAlias:"excludeRedundantZodSchemas",type:"boolean"})],fT.prototype,"excludeRedundantZodSchemas",2),qu([zu({envAlias:"verbose",default:!1,type:"boolean"})],fT.prototype,"verbose",2);var lAe=fT,uit={command:"check",describe:"Check OpenAPI spec",builder:ace(lAe),handler:t(async l=>{let u=await l;return u.verbose&&sce(`OpenAPI CodeGen ${SM()}`),lit(u)},"handler")};var Pat=Vd(Cwe()),wat=require("child_process");var t3e=Vd(l6());var u6=Vd(l6());function tat(l){mGt(),hGt(l.options),gGt(),yGt(),vGt(),bGt(),SGt(),xGt()}t(tat,"registerAclHbsHelpers");function mGt(){u6.default.registerHelper("abilityFunctionName",zW)}t(mGt,"registerAbilityFunctionNameHelper");function hGt(l){u6.default.registerHelper("importedAbilityFunctionName",u=>jle(u,l))}t(hGt,"registerImportedAbilityFunctionNameHelper");function gGt(){u6.default.registerHelper("ablityAction",Xwe)}t(gGt,"registerAbilityActionHelper");function yGt(){u6.default.registerHelper("ablitySubject",Ywe)}t(yGt,"registerAbilitySubjectHelper");function vGt(){u6.default.registerHelper("hasAbilityConditions",VW)}t(vGt,"registerHasAbilityConditionsHelper");function bGt(){u6.default.registerHelper("abilityConditionsTypes",mR)}t(bGt,"registerAbilityConditionsTypesHelper");function SGt(){u6.default.registerHelper("abilityDescription",dnt)}t(SGt,"registerAbilityDescriptionHelper");function xGt(){u6.default.registerHelper("abilitySubjectTypes",Kwe)}t(xGt,"registerAbilitySubjectTypesHelper");var R8=Vd(l6());function rat(){TGt(),kGt(),CGt(),EGt(),PGt(),wGt()}t(rat,"registerCommonHbsHelpers");function TGt(){R8.default.registerHelper("isEqual",(l,u)=>l===u)}t(TGt,"registerIsEqualHelper");function kGt(){R8.default.registerHelper("commaSeparated",l=>l.join(", "))}t(kGt,"registerCommaSeparatedListHelper");function CGt(){R8.default.registerHelper("union",l=>l.join(" | "))}t(CGt,"registerUnionHelper");function EGt(){R8.default.registerHelper("addAsteriskAfterNewLine",l=>l.replace(/\n/g,`
|
|
537
|
-
*`))}t(EGt,"registerAddAsteriskAfterNewLineHelper");function PGt(){R8.default.registerHelper("jsonStringify",l=>JSON.stringify(l,null,2))}t(PGt,"registerJsonStringifyHelper");function wGt(){R8.default.registerHelper("capitalize",u_)}t(wGt,"registerCapitalizeHelper");var o3=Vd(l6());function nat(l){AGt(),DGt(l.options),OGt(l),IGt(),NGt(),FGt(l),MGt()}t(nat,"registerEndpointsHbsHelpers");function AGt(){o3.default.registerHelper("endpointName",ZW)}t(AGt,"registerEndpointNameHelper");function DGt(l){o3.default.registerHelper("importedEndpointName",u=>Ont(u,l))}t(DGt,"registerImportedEndpointNameHelper");function IGt(){o3.default.registerHelper("endpointPath",Rnt)}t(IGt,"registerEndpointPathHelper");function NGt(){o3.default.registerHelper("endpointBody",n3)}t(NGt,"registerEndpointBodyHelper");function OGt(l){o3.default.registerHelper("endpointParams",(u,m)=>i3(l,u,m.hash))}t(OGt,"registerEndpointParamsHelper");function FGt(l){o3.default.registerHelper("endpointArgs",(u,m)=>i3(l,u,m.hash).map(b=>b.name).join(", "))}t(FGt,"registerEndpointArgsHelper");function MGt(){o3.default.registerHelper("endpointParamDescription",l=>{var I,L,Q,ae,ee;let u=[`${l.paramType} parameter`],m=((I=l.parameterObject)==null?void 0:I.description)||((L=l.bodyObject)==null?void 0:L.description);m&&u.push(m);let b,T;if((Q=l.parameterObject)!=null&&Q.schema&&iy(l.parameterObject.schema)&&(b=(ae=l.parameterObject)==null?void 0:ae.schema),(ee=l.bodyObject)!=null&&ee.content){let Te=Object.keys(l.bodyObject.content??{}).find(FC);Te&&(T=l.bodyObject.content[Te],T.schema&&iy(T.schema)&&(b=T.schema))}if(b){let pe=GW(b);u.push(...pe)}return T!=null&&T.example&&u.push(`Example: \`${T.example}\``),u.join(". ")})}t(MGt,"registerEndpointParamDescriptionHelper");var iat=Vd(l6());function sat(){RGt()}t(sat,"registerImportsHbsHelpers");function RGt(){iat.default.registerHelper("importNames",(l,u)=>[...u?[u]:[],...l?[`{ ${l.join(", ")} }`]:[]].join(", "))}t(RGt,"registerBindingsHelper");var gg=Vd(l6());var pT={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},aat={bindings:[pT.query,pT.infiniteQuery,pT.mutation],from:"@tanstack/react-query"},pH="moduleName";function oat(l){LGt(),jGt(),BGt(),$Gt(l),JGt(l),qGt(),zGt(l),VGt(l),UGt(l),WGt(l),HGt(l),GGt(),QGt(),ZGt(),XGt(),YGt(),KGt()}t(oat,"registerPartialsHbsHelpers");function LGt(){gg.default.registerHelper("genModelJsDocs",(l,u,m)=>oy("model-js-docs")({name:l,zodSchema:u,tag:m}))}t(LGt,"registerGenerateModelJsDocsHelper");function jGt(){gg.default.registerHelper("genImport",l=>oy("import")({import:l}))}t(jGt,"registerImportHelper");function BGt(){gg.default.registerHelper("genEndpointParams",(l,u)=>oy("endpoint-params")({endpoint:l,options:u}))}t(BGt,"registerGenerateEndpointParamsHelper");function $Gt(l){gg.default.registerHelper("hasUndefinedEndpointBody",u=>Fnt(u)&&!n3(u)&&Mnt(u,l))}t($Gt,"registerHasUndefinedEndpointBodyHelper");function JGt(l){gg.default.registerHelper("genEndpointConfig",u=>{let m=rAe(u),b=l.options.axiosRequestConfig;return Object.keys(m).length===0?b?VA:"":oy("endpoint-config")({endpointConfig:m,hasAxiosRequestConfig:b,hasBlobResponse:u.response===hle,hasFileDownload:u.mediaDownload,axiosRequestConfigName:VA,generateParse:l.options.parseRequestParams})})}t(JGt,"registerGenerateEndpointConfigHelper");function qGt(){gg.default.registerHelper("genEndpointParamParse",(l,u)=>{var m;return oy("endpoint-param-parse")({param:l,paramName:u,isQuery:l.type==="Query",zodExtendedNamespace:dS.namespace,parse:dS.exports.parse,sortExp:dS.exports.sortExp,addOptional:!((m=l.parameterObject??l.bodyObject)!=null&&m.required)&&(l.parameterSortingEnumSchemaName||wh(l.zodSchema))})})}t(qGt,"registerGenerateEndpointParamParseHelper");function zGt(l){gg.default.registerHelper("genQueryKeys",u=>u.length===0?"":oy("query-keys")({queryEndpoints:u,queriesModuleName:pH,generateInfiniteQueries:l.options.infiniteQueries}))}t(zGt,"registerGenerateQueryKeysHelper");function VGt(l){gg.default.registerHelper("genQuery",u=>{if(!mS(u))return;let m=l.options.axiosRequestConfig,b=l.options.checkAcl&&u.acl;return oy("query-use-query")({endpoint:u,queryHook:pT.query,hasQueryFn:i3(l,u).length>0||m||b,hasQueryFnBody:b,hasAxiosRequestConfig:m,axiosRequestConfigName:VA,axiosRequestConfigType:DC,hasAclCheck:b,aclCheckHook:e3})})}t(VGt,"registerGenerateQueryHelper");function UGt(l){gg.default.registerHelper("genMutation",(u,m)=>{if(!t3(u))return;let b=Lnt(u,m),T=jnt(l,u,b),I=l.options.checkAcl&&u.acl;return oy("query-use-mutation")({endpoint:u,queryHook:pT.mutation,queriesModuleName:pH,hasAxiosRequestConfig:l.options.axiosRequestConfig,hasMutationFnBody:u.mediaUpload||I,axiosRequestConfigName:VA,axiosRequestConfigType:DC,hasMutationEffects:l.options.mutationEffects,mutationEffectsType:lR.optionsType,updateQueryEndpoints:b,destructuredVariables:T,hasAclCheck:I,aclCheckHook:e3})})}t(UGt,"registerGenerateMutationHelper");function WGt(l){gg.default.registerHelper("genInfiniteQuery",u=>{if(!l.options.infiniteQueries||!gR(u,l.options))return;let m=l.options.checkAcl&&u.acl;return oy("query-use-infinite-query")({endpoint:u,infiniteQueryHook:pT.infiniteQuery,hasQueryFnBody:m,pageParamName:l.options.infiniteQueryResponseParamNames.page,totalItemsName:l.options.infiniteQueryResponseParamNames.totalItems,limitParamName:l.options.infiniteQueryResponseParamNames.limit,hasAxiosRequestConfig:l.options.axiosRequestConfig,axiosRequestConfigName:VA,axiosRequestConfigType:DC,hasAclCheck:m,aclCheckHook:e3})})}t(WGt,"registerGenerateInfiniteQueryHelper");function HGt(l){gg.default.registerHelper("genQueryJsDocs",(u,m)=>oy("query-js-docs")({endpoint:u,query:m.hash.query,mutation:m.hash.mutation,infiniteQuery:m.hash.infiniteQuery,hasMutationEffects:l.options.mutationEffects,mutationEffectsType:lR.optionsType}))}t(HGt,"registerGenerateQueryJsDocsHelper");function GGt(){gg.default.registerHelper("genCaslAbilityType",l=>oy("casl-ability-type")({endpoint:l,abilityTuple:sy.abilityTuple}))}t(GGt,"registerGenerateCaslAbilityTypeHelper");function QGt(){gg.default.registerHelper("genCaslAbilityFunction",l=>oy("casl-ability-function")({endpoint:l}))}t(QGt,"registerGenerateCaslAbilityFunctionHelper");function ZGt(){gg.default.registerHelper("genCaslAbilityQuery",l=>oy("casl-ability-query")({endpoint:l}))}t(ZGt,"registerGenerateCaslAbilityQueryHelper");function XGt(){gg.default.registerHelper("genAclCheckCall",l=>{var T;let u=(T=mR(l))==null?void 0:T.map(I=>I.name),m=l.parameters.map(I=>I.name),b=u==null?void 0:u.every(I=>m.includes(I));return oy("acl-check-call")({endpoint:l,generateAclCheckParams:VW(l)&&b})})}t(XGt,"registerGenerateAclCheckCallHelper");function YGt(){gg.default.registerHelper("genInputsConfig",l=>oy("inputs-config")({inputsConfig:l}))}t(YGt,"registerGenerateInputsConfigHelper");function KGt(){gg.default.registerHelper("genColumnsConfig",l=>oy("columns-config")({columnsConfig:l}))}t(KGt,"registerGenerateColumnsConfigHelper");var wR=Vd(l6());function cat(l){eQt(),rQt(),nQt(),tQt(),iQt(l)}t(cat,"registerQueryHbsHelpers");function eQt(){wR.default.registerHelper("queryName",(l,u)=>WW(l,u.hash.mutation))}t(eQt,"registerQueryNameHelper");function tQt(){wR.default.registerHelper("infiniteQueryName",HW)}t(tQt,"registerInfiniteQueryNameHelper");function rQt(){wR.default.registerHelper("isQuery",mS)}t(rQt,"registerIsQueryHelper");function nQt(){wR.default.registerHelper("isMutation",t3)}t(nQt,"registerIsMutationHelper");function iQt(l){wR.default.registerHelper("isInfiniteQuery",u=>gR(u,l.options))}t(iQt,"registerIsInfiniteQueryHelper");var L8=Vd(l6());function lat(l){sQt(l.options),aQt(l),oQt(l),cQt(),lQt(),uQt(l)}t(lat,"registerZodHbsHelpers");function sQt(l){L8.default.registerHelper("zodInferedType",u=>QW(u,l))}t(sQt,"registerInferedTypeHelper");function aQt(l){L8.default.registerHelper("importedZodSchemaName",u=>w8(l,u))}t(aQt,"registerImportedZodSchemaNameHelper");function oQt(l){L8.default.registerHelper("importedZodSchemaInferedType",u=>P8(l,u))}t(oQt,"registerImportedZodSchemaInferedTypeHelper");function cQt(){L8.default.registerHelper("zodSchemaType",l=>gnt(l))}t(cQt,"registerZodSchemaTypeHelper");function lQt(){L8.default.registerHelper("zodSchemaDescription",l=>ynt(l))}t(lQt,"registerZodSchemaDescriptionHelper");function uQt(l){L8.default.registerHelper("zodSchemaPropertyDescriptions",(u,m)=>bnt(l,u,m))}t(uQt,"registerZodSchemaPropertyDescriptionsHelper");function Ah(l,u){let m=oAe(u);return rat(),sat(),lat(l),nat(l),cat(l),tat(l),oat(l),t3e.default.compile(m)}t(Ah,"getHbsTemplateDelegate");function oy(l){let u=oAe(`partials/${l}`);return t3e.default.compile(u)}t(oy,"getHbsPartialTemplateDelegate");function uat({resolver:l,data:u,tag:m}){let b=eAe({resolver:l,data:u,tag:m});if(!b)return;let{hasAdditionalAbilityImports:T,modelsImports:I,endpoints:L}=b,Q={bindings:[sy.abilityTuple,...T?[sy.forcedSubject,sy.subject]:[]],from:Zwe.from};return Ah(l,"acl")({caslAbilityTupleImport:Q,modelsImports:I,includeNamespace:l.options.tsNamespaces,namespace:C_({type:"acl",tag:m,options:l.options}),endpoints:L})}t(uat,"generateAcl");function fat({resolver:l,data:u}){let{appAbilitiesType:m,hasAdditionalAbilityImports:b,modelsImports:T}=mnt({resolver:l,data:u}),I={bindings:[sy.pureAbility,sy.abilityTuple,...m?[]:[sy.subjectType],...b?[sy.forcedSubject]:[]],from:Zwe.from};return Ah(l,"app-acl")({caslAbilityTupleImport:I,modelsImports:T,appAbilitiesType:m,appAbilities:qW,abilityTuple:sy.abilityTuple,subjectType:sy.subjectType})}t(fat,"generateAppAcl");var r3e="config";function _at({data:l,tag:u,resolver:m}){var Lt;let b=(Lt=l.get(u))==null?void 0:Lt.endpoints;if(!b||b.length===0)return{configs:[]};let T=b.map(Xt=>({...Xt,pathSegments:fnt(Xt.path)})),I=T.filter(Xt=>snt(Xt,m.options)),L=fQt(I),Q=!1,ae=[],ee=[],pe=[],Te=Object.entries(L).map(([Xt,Vt])=>{let Ti=_Qt(m,Vt);if(!Ti)return;ee.push(Vt),pe.push(Vt),Ti.zodSchema&&(wh(Ti.zodSchema)?ae.push(Ti.zodSchema):Q=!0),Ti.sortableEnumSchemaName&&ae.push(Ti.sortableEnumSchemaName);let zn=Vt.parameters.find(lr=>lr.name===m.options.filterParamName);zn&&ae.push(zn.zodSchema);let _i={name:Xt,title:u_(_le(Xt.replace(/config$/i,""))),readAll:{acl:AR(Vt,m.options),paginated:E8(Vt,m.options),infinite:m.options.infiniteQueries?hnt(Vt,m.options):void 0,filters:wue(m,zn),columns:Ti.columns}},vo=T.find(lr=>ant(lr,Vt));if(vo){ee.push(vo);let lr=vo.response;wh(lr)?(ae.push(lr),lr=w8(m,lr)):Q=!0,_i.read={acl:AR(vo,m.options),schema:lr,query:E8(vo,m.options)}}let Vn=T.find(lr=>ont(lr,Vt));if(Vn){ee.push(Vn);let lr=n3(Vn);lr&&ae.push(lr.zodSchema),_i.create={acl:AR(Vn,m.options),mutation:E8(Vn,m.options),inputDefs:wue(m,lr)}}let ql=T.find(lr=>cnt(lr,Vt));if(ql){ee.push(ql);let lr=n3(ql);lr&&ae.push(lr.zodSchema),_i.update={acl:AR(ql,m.options),mutation:E8(ql,m.options),inputDefs:wue(m,lr)}}let zl=T.find(lr=>lnt(lr,Vt));zl&&(ee.push(zl),_i.delete={acl:AR(zl,m.options),mutation:E8(zl,m.options)});let ia=T.find(lr=>unt(lr,Vt));if(ia){ee.push(ia);let lr=n3(ia);lr&&ae.push(lr.zodSchema),_i.bulkDelete={acl:AR(ia,m.options),mutation:E8(ia,m.options),inputDefs:wue(m,lr)}}return _i}),Ke=RC({resolver:m,tag:u,zodSchemas:ae}),Pt=xnt({tag:u,endpoints:ee,options:m.options}),rr=m.options.infiniteQueries?Tnt({tag:u,endpoints:pe,options:m.options}):[],or=Ble({tag:u,endpoints:ee.filter(Xt=>Xt.acl),options:m.options});return{configs:Te.filter(Boolean),hasZodImport:Q,modelsImports:Ke,queriesImports:UW(m.options,Pt,rr),aclImports:or}}t(_at,"getBuilderConfigs");function fQt(l){let u=l.map(b=>({...b,namePathSegments:b.pathSegments.filter(T=>!pR(T))})).sort((b,T)=>b.namePathSegments.length-T.namePathSegments.length),m={};for(let b of u){let T=b.namePathSegments,I=T.length>0?`${wW(T.pop())}${u_(r3e)}`:r3e;for(;m[I];){if(T.length===0)throw new Error(`Can't uniquely resolve builder config name: ${I}`);I=`${wW(T.pop())}${u_(I)}`}m[I]=b}return m}t(fQt,"resolveBuilderConfigNames");function AR(l,u){return u.acl&&l.acl?jle(l,u):void 0}t(AR,"getAclConfig");function wue(l,u){var I,L,Q;if(!u)return;let m;if(u.type==="Body"?m=(L=(I=u.bodyObject)==null?void 0:I.content[h8])==null?void 0:L.schema:m=(Q=u.parameterObject)==null?void 0:Q.schema,!m)return;let b=l.resolveObject(m),T=Object.keys((b==null?void 0:b.properties)??{}).reduce((ae,ee)=>({...ae,[ee]:!0}),{});return{schema:w8(l,u.zodSchema),options:{inputs:T}}}t(wue,"getInputsConfig");function _Qt(l,u){var Pt,rr,or;let m=u.responseObject;if(!m)return;let b=(rr=(Pt=m.content)==null?void 0:Pt[h8])==null?void 0:rr.schema;if(!b)return;let T=pat(l,b),I=Object.keys(T).filter(Lt=>l.resolveObject(T[Lt]).type==="array");I.sort((Lt,Xt)=>{let Vt=l.options.dataResponseParamNames.indexOf(Lt),Ti=l.options.dataResponseParamNames.indexOf(Xt);return Vt!==-1&&Ti!==-1?Vt-Ti:Vt!==-1?-1:Ti!==-1?1:Lt.localeCompare(Xt)});let L=I[0];if(!L)return;let Q=l.resolveObject(T[L]);if(!Q||Q.type!=="array")return;let ae=Q.items,ee=l.resolveObject(ae);if(!ee)return;let pe=gf(ae)?l.getZodSchemaNameByRef(ae.$ref):aR,Te=Object.keys((ee==null?void 0:ee.properties)??{}).reduce((Lt,Xt)=>({...Lt,[Xt]:!0}),{}),Ke=(or=u.parameters.find(Lt=>Lt.parameterObject&&Tle(Lt.parameterObject)))==null?void 0:or.parameterSortingEnumSchemaName;return{columns:{schema:w8(l,pe),options:{columns:Te,sortable:Ke?w8(l,Ke):void 0}},zodSchema:pe,sortableEnumSchemaName:Ke}}t(_Qt,"getColumnsConfig");function pat(l,u){let m=l.resolveObject(u);return m.properties?m.properties:"allOf"in m&&m.allOf?m.allOf.reduce((b,T)=>({...b,...pat(l,T)}),{}):{}}t(pat,"getSchemaProperties");function dat(l){let{configs:u,hasZodImport:m,modelsImports:b,queriesImports:T,aclImports:I}=_at(l);if(u.length===0)return;let{resolver:L,tag:Q}=l,ae=u.some(Pt=>{var rr,or;return Pt.readAll.filters||((rr=Pt.create)==null?void 0:rr.inputDefs)||((or=Pt.update)==null?void 0:or.inputDefs)}),ee={bindings:[LW.dynamicInputs],from:L.options.dynamicInputsImportPath},pe=u.some(Pt=>Pt.readAll.columns),Te={bindings:[LW.dynamicColumns],from:L.options.dynamicColumnsImportPath};return Ah(L,"configs")({hasZodImport:m,zodImport:WA,hasDynamicInputsImport:ae,dynamicInputsImport:ee,hasDynamicColumnsImport:pe,dynamicColumnsImport:Te,modelsImports:b,queriesImports:T,aclImports:I,includeNamespace:L.options.tsNamespaces,namespace:C_({type:"configs",tag:Q,options:L.options}),configs:u,dynamicInputs:LW.dynamicInputs,dynamicColumns:LW.dynamicColumns})}t(dat,"generateConfigs");function mat({resolver:l,data:u,tag:m}){var Vt;let b=(Vt=u.get(m))==null?void 0:Vt.endpoints;if(!b||b.length===0)return;let T={bindings:[RW],from:Cnt(l.options)},I=l.options.axiosRequestConfig,L=I,Q={bindings:I?[DC]:[],from:dle.from},ae=l.options.parseRequestParams,ee=b.reduce((Ti,zn)=>[...Ti,...zn.parameters],[]),pe=ee.filter(Ti=>!["Path","Header"].includes(Ti.type)).map(Ti=>Ti.parameterSortingEnumSchemaName??Ti.zodSchema),Te=b.map(Ti=>Ti.response),Ke=Ib([...Te,...ae?pe:[]]),Pt=Ke.some(Ti=>!wh(Ti)),rr=l.options.parseRequestParams&&pe.length>0,or={bindings:[dS.namespace],from:Ant(l.options)},Lt=RC({resolver:l,tag:m,zodSchemas:Ke.filter(wh),zodSchemasAsTypes:Ib(ee.map(Ti=>Ti.zodSchema).filter(wh))});return Ah(l,"endpoints")({appRestClientImport:T,hasAxiosImport:L,axiosImport:Q,hasZodImport:Pt,zodImport:WA,hasZodExtendedImport:rr,zodExtendedImport:or,modelsImports:Lt,includeNamespace:l.options.tsNamespaces,namespace:C_({type:"endpoints",tag:m,options:l.options}),restClientName:RW,hasAxiosRequestConfig:I,axiosRequestConfigName:VA,axiosRequestConfigType:DC,endpoints:b,generateParse:ae})}t(mat,"generateEndpoints");function hat({resolver:l,data:u,tag:m}){var ae;let b=(ae=u.get(m))==null?void 0:ae.zodSchemas;if(!b||Object.keys(b).length===0)return;let T=Object.keys(b).reduce((ee,pe)=>[...ee,...qrt(l,pe)],[]).filter(ee=>!b[ee]),I=RC({resolver:l,tag:m,zodSchemas:T}),L=Object.entries(b).reduce((ee,[pe,Te])=>{let Ke=l.getZodSchemaObj(pe),Pt={code:Te,isEnum:Urt(Te),schemaObj:Ke};return{...ee,[pe]:Pt}},{});return Ah(l,"models")({zodImport:WA,modelsImports:I,includeNamespace:l.options.tsNamespaces,namespace:C_({type:"models",tag:m,options:l.options}),tag:m,zodSchemasData:L})}t(hat,"generateModels");function gat({resolver:l,data:u,tag:m}){var zl;let b=(zl=u.get(m))==null?void 0:zl.endpoints;if(!b||b.length===0)return;let T=l.options.axiosRequestConfig,I=b.some(({mediaUpload:ia})=>ia),L=T||I,Q={defaultImport:I?Awe:void 0,bindings:T?[DC]:[],from:dle.from},ae=b.filter(mS),ee=ae.filter(ia=>gR(ia,l.options)),pe=b.filter(t3),Te={bindings:[...ae.length>0?[pT.query]:[],...l.options.infiniteQueries&&ee.length>0?[pT.infiniteQuery]:[],...pe.length>0?[pT.mutation]:[]],from:aat.from},Ke=l.options.mutationEffects,Pt={bindings:[Vwe],from:Ent(l.options)},rr=Ke&&pe.length>0,or={bindings:[...pe.length>0?[lR.optionsType,lR.hookName]:[]],from:Pnt(l.options)},Lt=b.filter(ia=>ia.acl),Xt=l.options.checkAcl&&Lt.length>0,Vt={bindings:[e3],from:wnt(l.options)},Ti={bindings:[...ae.length>0?[Ele.query]:[],...l.options.infiniteQueries&&ee.length>0?[Ele.infiniteQuery]:[],...pe.length>0?[Ele.mutation]:[]],from:l.options.queryTypesImportPath},zn=b.reduce((ia,lr)=>[...ia,...lr.parameters],[]),_i=RC({resolver:l,tag:m,zodSchemasAsTypes:Ib(zn.map(ia=>ia.zodSchema).filter(wh))}),vo=Snt({tag:m,endpoints:b,options:l.options}),Vn=Ble({tag:m,endpoints:Lt,options:l.options});return Ah(l,"queries")({hasAxiosImport:L,axiosImport:Q,queryImport:Te,hasMutationEffects:Ke,queryModulesImport:Pt,hasMutationEffectsImport:rr,mutationEffectsImport:or,hasAclCheck:Xt,aclCheckImport:Vt,queryTypesImport:Ti,modelsImports:_i,endpointsImports:vo,aclImports:Vn,includeNamespace:l.options.tsNamespaces,tag:m,namespace:C_({type:"queries",tag:m,options:l.options}),queriesModuleName:pH,queryModuleEnum:Vwe,endpoints:b,queryEndpoints:ae})}t(gat,"generateQueries");function yat(l){return Ah(l,"acl-check")({abilityContextImport:Vrt,appAbilitiesImport:{bindings:[qW],from:Dnt(l.options)},errorHandlingImport:Ple,abilityContext:zwe,appAbilities:qW,errorHandler:YA.ErrorHandler,sharedErrorHandler:YA.SharedErrorHandler,aclCheckHook:e3,hasGenericAppAbilities:l.options.abilityContextGenericAppAbilities})}t(yat,"generateAclCheck");function vat(l){return Ah(l,"app-rest-client")({appRestClientName:RW,baseUrl:l.getBaseUrl(),packageImportPath:x8})}t(vat,"generateAppRestClient");function bat({resolver:l,data:u}){let m=[];return u.forEach((T,I)=>{var Q;let L=(Q=u.get(I))==null?void 0:Q.endpoints;!L||L.length===0||m.push({tag:I,namespace:C_({type:"queries",tag:I,options:l.options})})}),Ah(l,"query-modules")({modules:m})}t(bat,"generateQueryModules");function Sat(l){return Ah(l,"zod-extended")({zodImport:WA,zodExtendedNamespace:dS.namespace,parse:dS.exports.parse,sortExp:dS.exports.sortExp,errorHandler:YA.ErrorHandler,sharedErrorHandler:YA.SharedErrorHandler,errorHandlingImport:Ple})}t(Sat,"generateZodExtended");function xat(l,u){return u.options.acl?[{fileName:uT({output:u.options.output,fileName:A8(Rle)}),content:fat({resolver:u,data:l})},...u.options.checkAcl?[{fileName:uT({output:u.options.output,fileName:A8(Lle)}),content:yat(u)}]:[]]:[]}t(xat,"getAclFiles");function Tat(l,u){return u.options.mutationEffects?[...pQt([Ale],u),{fileName:uT({output:u.options.output,fileName:A8(wle)}),content:bat({resolver:u,data:l})}]:[]}t(Tat,"getMutationEffectsFiles");function kat(l,u){return u.options.parseRequestParams?[{fileName:uT({output:u.options.output,fileName:A8(Dle)}),content:Sat(u)}]:[]}t(kat,"getZodExtendedFiles");function Cat(l){return l.options.restClientImportPath!==dR.restClientImportPath?[]:[{fileName:uT({output:l.options.output,fileName:A8(Cle)}),content:vat(l)}]}t(Cat,"getAppRestClientFiles");function pQt(l,u){return l.reduce((m,b)=>[...m,dQt(b,u)],[])}t(pQt,"getAssetFiles");function dQt(l,u){let m=A8(l);return{fileName:uT({output:u.options.output,fileName:m}),content:nit(m)}}t(dQt,"getAssetFile");function Eat(l,u){let{resolver:m,data:b}=zle(l,u),T=[],I=[],L=["models","endpoints","queries",...m.options.acl?["acl"]:[],...m.options.builderConfigs?["configs"]:[]],Q={models:hat,endpoints:mat,queries:gat,acl:uat,configs:dat};return b.forEach((ae,ee)=>{L.forEach(pe=>{let Te=Q[pe]({resolver:m,data:b,tag:ee});if(Te){let Ke=uT({output:u.output,fileName:$le({tag:ee,type:pe,options:u})});T.push({fileName:Ke,content:Te}),pe==="acl"&&I.push(ee)}})}),T.push(...xat(b,m),...Tat(b,m),...kat(b,m),...Cat(m)),T}t(Eat,"generateCodeFromOpenAPIDoc");async function Aat({prettier:l,verbose:u,config:m,...b}){let T=Date.now();u&&oS("Resolving config...");let I=await Ule(m),L=Vle({fileConfig:I,params:b});u&&oS("Parsing OpenAPI spec...");let Q=await Pat.default.bundle(L.input);u&&oS("Generating code...");let ae=Eat(Q,L);u&&oS("Writing files..."),iit(ae),u&&LU(`Time: ${Date.now()-T}ms`),l&&mQt({output:L.output,verbose:u})}t(Aat,"generate");function mQt({output:l,verbose:u}){u&&oS("Running Prettier..."),(0,wat.exec)(`prettier --write ${l} `,b=>{u&&(b?HN(b,"Prettier error"):LU("Prettier finished."))})}t(mQt,"execPrettier");var q_=class q_{config;input;output;tsNamespaces;tsPath;splitByTags;defaultTag;excludeTags;excludePathRegex;excludeRedundantZodSchemas;importPath;extractEnums;removeOperationPrefixEndingWith;acl;checkAcl;baseUrl;replaceOptionalWithNullish;infiniteQueries;mutationEffects;parseRequestParams;axiosRequestConfig;builderConfigs;prettier;verbose};t(q_,"GenerateOptions"),qu([zu({envAlias:"config"})],q_.prototype,"config",2),qu([zu({envAlias:"input"})],q_.prototype,"input",2),qu([zu({envAlias:"output"})],q_.prototype,"output",2),qu([zu({envAlias:"tsNamespaces",type:"boolean"})],q_.prototype,"tsNamespaces",2),qu([zu({envAlias:"tsPath"})],q_.prototype,"tsPath",2),qu([zu({envAlias:"splitByTags",type:"boolean"})],q_.prototype,"splitByTags",2),qu([zu({envAlias:"defaultTag"})],q_.prototype,"defaultTag",2),qu([zu({envAlias:"excludeTags"})],q_.prototype,"excludeTags",2),qu([zu({envAlias:"excludePathRegex"})],q_.prototype,"excludePathRegex",2),qu([zu({envAlias:"excludeRedundantZodSchemas",type:"boolean"})],q_.prototype,"excludeRedundantZodSchemas",2),qu([zu({envAlias:"importPath"})],q_.prototype,"importPath",2),qu([zu({envAlias:"extractEnums",type:"boolean"})],q_.prototype,"extractEnums",2),qu([zu({envAlias:"removeOperationPrefixEndingWith"})],q_.prototype,"removeOperationPrefixEndingWith",2),qu([zu({envAlias:"acl",type:"boolean"})],q_.prototype,"acl",2),qu([zu({envAlias:"checkAcl",type:"boolean"})],q_.prototype,"checkAcl",2),qu([zu({envAlias:"baseUrl"})],q_.prototype,"baseUrl",2),qu([zu({envAlias:"replaceOptionalWithNullish",type:"boolean"})],q_.prototype,"replaceOptionalWithNullish",2),qu([zu({envAlias:"infiniteQueries",type:"boolean"})],q_.prototype,"infiniteQueries",2),qu([zu({envAlias:"mutationEffects",type:"boolean"})],q_.prototype,"mutationEffects",2),qu([zu({envAlias:"parseRequestParams",type:"boolean"})],q_.prototype,"parseRequestParams",2),qu([zu({envAlias:"axiosRequestConfig",type:"boolean"})],q_.prototype,"axiosRequestConfig",2),qu([zu({envAlias:"builderConfigs",type:"boolean"})],q_.prototype,"builderConfigs",2),qu([zu({envAlias:"prettier",default:!0,type:"boolean"})],q_.prototype,"prettier",2),qu([zu({envAlias:"verbose",default:!1,type:"boolean"})],q_.prototype,"verbose",2);var n3e=q_,Dat={command:"generate",describe:"Generate code from OpenAPI spec",builder:ace(n3e),handler:t(async l=>{let u=await l;return u.verbose&&sce(`OpenAPI CodeGen ${SM()}`),Aat(u)},"handler")};yQe(iEe(process.argv)).version(SM()||"unknown").scriptName("openapi-codegen").command(Dat).command(uit).help().demandCommand(1).strictCommands(!0).showHelpOnFail(!0).fail((l,u)=>{l&&HN(l),u&&HN(u),oS("Use '--help' for more info"),process.exit(1)}).parse();
|
|
537
|
+
*`))}t(EGt,"registerAddAsteriskAfterNewLineHelper");function PGt(){R8.default.registerHelper("jsonStringify",l=>JSON.stringify(l,null,2))}t(PGt,"registerJsonStringifyHelper");function wGt(){R8.default.registerHelper("capitalize",u_)}t(wGt,"registerCapitalizeHelper");var o3=Vd(l6());function nat(l){AGt(),DGt(l.options),OGt(l),IGt(),NGt(),FGt(l),MGt()}t(nat,"registerEndpointsHbsHelpers");function AGt(){o3.default.registerHelper("endpointName",ZW)}t(AGt,"registerEndpointNameHelper");function DGt(l){o3.default.registerHelper("importedEndpointName",u=>Ont(u,l))}t(DGt,"registerImportedEndpointNameHelper");function IGt(){o3.default.registerHelper("endpointPath",Rnt)}t(IGt,"registerEndpointPathHelper");function NGt(){o3.default.registerHelper("endpointBody",n3)}t(NGt,"registerEndpointBodyHelper");function OGt(l){o3.default.registerHelper("endpointParams",(u,m)=>i3(l,u,m.hash))}t(OGt,"registerEndpointParamsHelper");function FGt(l){o3.default.registerHelper("endpointArgs",(u,m)=>i3(l,u,m.hash).map(b=>b.name).join(", "))}t(FGt,"registerEndpointArgsHelper");function MGt(){o3.default.registerHelper("endpointParamDescription",l=>{var I,L,Q,ae,ee;let u=[`${l.paramType} parameter`],m=((I=l.parameterObject)==null?void 0:I.description)||((L=l.bodyObject)==null?void 0:L.description);m&&u.push(m);let b,T;if((Q=l.parameterObject)!=null&&Q.schema&&iy(l.parameterObject.schema)&&(b=(ae=l.parameterObject)==null?void 0:ae.schema),(ee=l.bodyObject)!=null&&ee.content){let Te=Object.keys(l.bodyObject.content??{}).find(FC);Te&&(T=l.bodyObject.content[Te],T.schema&&iy(T.schema)&&(b=T.schema))}if(b){let pe=GW(b);u.push(...pe)}return T!=null&&T.example&&u.push(`Example: \`${T.example}\``),u.join(". ")})}t(MGt,"registerEndpointParamDescriptionHelper");var iat=Vd(l6());function sat(){RGt()}t(sat,"registerImportsHbsHelpers");function RGt(){iat.default.registerHelper("importNames",(l,u)=>[...u?[u]:[],...l?[`{ ${l.join(", ")} }`]:[]].join(", "))}t(RGt,"registerBindingsHelper");var gg=Vd(l6());var pT={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},aat={bindings:[pT.query,pT.infiniteQuery,pT.mutation],from:"@tanstack/react-query"},pH="moduleName";function oat(l){LGt(),jGt(),BGt(),$Gt(l),JGt(l),qGt(),zGt(l),VGt(l),UGt(l),WGt(l),HGt(l),GGt(),QGt(),ZGt(),XGt(),YGt(),KGt()}t(oat,"registerPartialsHbsHelpers");function LGt(){gg.default.registerHelper("genModelJsDocs",(l,u,m)=>oy("model-js-docs")({name:l,zodSchema:u,tag:m}))}t(LGt,"registerGenerateModelJsDocsHelper");function jGt(){gg.default.registerHelper("genImport",l=>oy("import")({import:l}))}t(jGt,"registerImportHelper");function BGt(){gg.default.registerHelper("genEndpointParams",(l,u)=>oy("endpoint-params")({endpoint:l,options:u}))}t(BGt,"registerGenerateEndpointParamsHelper");function $Gt(l){gg.default.registerHelper("hasUndefinedEndpointBody",u=>Fnt(u)&&!n3(u)&&Mnt(u,l))}t($Gt,"registerHasUndefinedEndpointBodyHelper");function JGt(l){gg.default.registerHelper("genEndpointConfig",u=>{let m=rAe(u),b=l.options.axiosRequestConfig;return Object.keys(m).length===0?b?VA:"":oy("endpoint-config")({endpointConfig:m,hasAxiosRequestConfig:b,hasBlobResponse:u.response===hle,hasFileDownload:u.mediaDownload,axiosRequestConfigName:VA,generateParse:l.options.parseRequestParams})})}t(JGt,"registerGenerateEndpointConfigHelper");function qGt(){gg.default.registerHelper("genEndpointParamParse",(l,u)=>{var m;return oy("endpoint-param-parse")({param:l,paramName:u,isQuery:l.type==="Query",zodExtendedNamespace:dS.namespace,parse:dS.exports.parse,sortExp:dS.exports.sortExp,addOptional:!((m=l.parameterObject??l.bodyObject)!=null&&m.required)&&(l.parameterSortingEnumSchemaName||wh(l.zodSchema))})})}t(qGt,"registerGenerateEndpointParamParseHelper");function zGt(l){gg.default.registerHelper("genQueryKeys",u=>u.length===0?"":oy("query-keys")({queryEndpoints:u,queriesModuleName:pH,generateInfiniteQueries:l.options.infiniteQueries}))}t(zGt,"registerGenerateQueryKeysHelper");function VGt(l){gg.default.registerHelper("genQuery",u=>{if(!mS(u))return;let m=l.options.axiosRequestConfig,b=l.options.checkAcl&&u.acl;return oy("query-use-query")({endpoint:u,queryHook:pT.query,hasQueryFn:i3(l,u).length>0||m||b,hasQueryFnBody:b,hasAxiosRequestConfig:m,axiosRequestConfigName:VA,axiosRequestConfigType:DC,hasAclCheck:b,aclCheckHook:e3})})}t(VGt,"registerGenerateQueryHelper");function UGt(l){gg.default.registerHelper("genMutation",(u,m)=>{if(!t3(u))return;let b=Lnt(u,m),T=jnt(l,u,b),I=l.options.checkAcl&&u.acl;return oy("query-use-mutation")({endpoint:u,queryHook:pT.mutation,queriesModuleName:pH,hasAxiosRequestConfig:l.options.axiosRequestConfig,hasMutationFnBody:u.mediaUpload||I,axiosRequestConfigName:VA,axiosRequestConfigType:DC,hasMutationEffects:l.options.mutationEffects,mutationEffectsType:lR.optionsType,updateQueryEndpoints:b,destructuredVariables:T,hasAclCheck:I,aclCheckHook:e3})})}t(UGt,"registerGenerateMutationHelper");function WGt(l){gg.default.registerHelper("genInfiniteQuery",u=>{if(!l.options.infiniteQueries||!gR(u,l.options))return;let m=l.options.checkAcl&&u.acl;return oy("query-use-infinite-query")({endpoint:u,infiniteQueryHook:pT.infiniteQuery,hasQueryFnBody:m,pageParamName:l.options.infiniteQueryResponseParamNames.page,totalItemsName:l.options.infiniteQueryResponseParamNames.totalItems,limitParamName:l.options.infiniteQueryResponseParamNames.limit,hasAxiosRequestConfig:l.options.axiosRequestConfig,axiosRequestConfigName:VA,axiosRequestConfigType:DC,hasAclCheck:m,aclCheckHook:e3})})}t(WGt,"registerGenerateInfiniteQueryHelper");function HGt(l){gg.default.registerHelper("genQueryJsDocs",(u,m)=>oy("query-js-docs")({endpoint:u,query:m.hash.query,mutation:m.hash.mutation,infiniteQuery:m.hash.infiniteQuery,hasMutationEffects:l.options.mutationEffects,mutationEffectsType:lR.optionsType}))}t(HGt,"registerGenerateQueryJsDocsHelper");function GGt(){gg.default.registerHelper("genCaslAbilityType",l=>oy("casl-ability-type")({endpoint:l,abilityTuple:sy.abilityTuple}))}t(GGt,"registerGenerateCaslAbilityTypeHelper");function QGt(){gg.default.registerHelper("genCaslAbilityFunction",l=>oy("casl-ability-function")({endpoint:l}))}t(QGt,"registerGenerateCaslAbilityFunctionHelper");function ZGt(){gg.default.registerHelper("genCaslAbilityQuery",l=>oy("casl-ability-query")({endpoint:l}))}t(ZGt,"registerGenerateCaslAbilityQueryHelper");function XGt(){gg.default.registerHelper("genAclCheckCall",l=>{var T;let u=(T=mR(l))==null?void 0:T.map(I=>I.name),m=l.parameters.map(I=>I.name),b=u==null?void 0:u.every(I=>m.includes(I));return oy("acl-check-call")({endpoint:l,generateAclCheckParams:VW(l)&&b})})}t(XGt,"registerGenerateAclCheckCallHelper");function YGt(){gg.default.registerHelper("genInputsConfig",l=>oy("inputs-config")({inputsConfig:l}))}t(YGt,"registerGenerateInputsConfigHelper");function KGt(){gg.default.registerHelper("genColumnsConfig",l=>oy("columns-config")({columnsConfig:l}))}t(KGt,"registerGenerateColumnsConfigHelper");var wR=Vd(l6());function cat(l){eQt(),rQt(),nQt(),tQt(),iQt(l)}t(cat,"registerQueryHbsHelpers");function eQt(){wR.default.registerHelper("queryName",(l,u)=>WW(l,u.hash.mutation))}t(eQt,"registerQueryNameHelper");function tQt(){wR.default.registerHelper("infiniteQueryName",HW)}t(tQt,"registerInfiniteQueryNameHelper");function rQt(){wR.default.registerHelper("isQuery",mS)}t(rQt,"registerIsQueryHelper");function nQt(){wR.default.registerHelper("isMutation",t3)}t(nQt,"registerIsMutationHelper");function iQt(l){wR.default.registerHelper("isInfiniteQuery",u=>gR(u,l.options))}t(iQt,"registerIsInfiniteQueryHelper");var L8=Vd(l6());function lat(l){sQt(l.options),aQt(l),oQt(l),cQt(),lQt(),uQt(l)}t(lat,"registerZodHbsHelpers");function sQt(l){L8.default.registerHelper("zodInferedType",u=>QW(u,l))}t(sQt,"registerInferedTypeHelper");function aQt(l){L8.default.registerHelper("importedZodSchemaName",u=>w8(l,u))}t(aQt,"registerImportedZodSchemaNameHelper");function oQt(l){L8.default.registerHelper("importedZodSchemaInferedType",u=>P8(l,u))}t(oQt,"registerImportedZodSchemaInferedTypeHelper");function cQt(){L8.default.registerHelper("zodSchemaType",l=>gnt(l))}t(cQt,"registerZodSchemaTypeHelper");function lQt(){L8.default.registerHelper("zodSchemaDescription",l=>ynt(l))}t(lQt,"registerZodSchemaDescriptionHelper");function uQt(l){L8.default.registerHelper("zodSchemaPropertyDescriptions",(u,m)=>bnt(l,u,m))}t(uQt,"registerZodSchemaPropertyDescriptionsHelper");function Ah(l,u){let m=oAe(u);return rat(),sat(),lat(l),nat(l),cat(l),tat(l),oat(l),t3e.default.compile(m)}t(Ah,"getHbsTemplateDelegate");function oy(l){let u=oAe(`partials/${l}`);return t3e.default.compile(u)}t(oy,"getHbsPartialTemplateDelegate");function uat({resolver:l,data:u,tag:m}){let b=eAe({resolver:l,data:u,tag:m});if(!b)return;let{hasAdditionalAbilityImports:T,modelsImports:I,endpoints:L}=b,Q={bindings:[sy.abilityTuple,...T?[sy.forcedSubject,sy.subject]:[]],from:Zwe.from};return Ah(l,"acl")({caslAbilityTupleImport:Q,modelsImports:I,includeNamespace:l.options.tsNamespaces,namespace:C_({type:"acl",tag:m,options:l.options}),endpoints:L})}t(uat,"generateAcl");function fat({resolver:l,data:u}){let{appAbilitiesType:m,hasAdditionalAbilityImports:b,modelsImports:T}=mnt({resolver:l,data:u}),I={bindings:[sy.pureAbility,sy.abilityTuple,...m?[]:[sy.subjectType],...b?[sy.forcedSubject]:[]],from:Zwe.from};return Ah(l,"app-acl")({caslAbilityTupleImport:I,modelsImports:T,appAbilitiesType:m,appAbilities:qW,abilityTuple:sy.abilityTuple,subjectType:sy.subjectType})}t(fat,"generateAppAcl");var r3e="config";function _at({data:l,tag:u,resolver:m}){var Lt;let b=(Lt=l.get(u))==null?void 0:Lt.endpoints;if(!b||b.length===0)return{configs:[]};let T=b.map(Xt=>({...Xt,pathSegments:fnt(Xt.path)})),I=T.filter(Xt=>snt(Xt,m.options)),L=fQt(I),Q=!1,ae=[],ee=[],pe=[],Te=Object.entries(L).map(([Xt,Vt])=>{let Ti=_Qt(m,Vt);if(!Ti)return;ee.push(Vt),pe.push(Vt),Ti.zodSchema&&(wh(Ti.zodSchema)?ae.push(Ti.zodSchema):Q=!0),Ti.sortableEnumSchemaName&&ae.push(Ti.sortableEnumSchemaName);let zn=Vt.parameters.find(lr=>lr.name===m.options.filterParamName);zn&&ae.push(zn.zodSchema);let _i={name:Xt,title:u_(_le(Xt.replace(/config$/i,""))),readAll:{acl:AR(Vt,m.options),paginated:E8(Vt,m.options),infinite:m.options.infiniteQueries?hnt(Vt,m.options):void 0,filters:wue(m,zn),columns:Ti.columns}},vo=T.find(lr=>ant(lr,Vt));if(vo){ee.push(vo);let lr=vo.response;wh(lr)?(ae.push(lr),lr=w8(m,lr)):Q=!0,_i.read={acl:AR(vo,m.options),schema:lr,query:E8(vo,m.options)}}let Vn=T.find(lr=>ont(lr,Vt));if(Vn){ee.push(Vn);let lr=n3(Vn);lr&&ae.push(lr.zodSchema),_i.create={acl:AR(Vn,m.options),mutation:E8(Vn,m.options),inputDefs:wue(m,lr)}}let ql=T.find(lr=>cnt(lr,Vt));if(ql){ee.push(ql);let lr=n3(ql);lr&&ae.push(lr.zodSchema),_i.update={acl:AR(ql,m.options),mutation:E8(ql,m.options),inputDefs:wue(m,lr)}}let zl=T.find(lr=>lnt(lr,Vt));zl&&(ee.push(zl),_i.delete={acl:AR(zl,m.options),mutation:E8(zl,m.options)});let ia=T.find(lr=>unt(lr,Vt));if(ia){ee.push(ia);let lr=n3(ia);lr&&ae.push(lr.zodSchema),_i.bulkDelete={acl:AR(ia,m.options),mutation:E8(ia,m.options),inputDefs:wue(m,lr)}}return _i}),Ke=RC({resolver:m,tag:u,zodSchemas:ae}),Pt=xnt({tag:u,endpoints:ee,options:m.options}),rr=m.options.infiniteQueries?Tnt({tag:u,endpoints:pe,options:m.options}):[],or=Ble({tag:u,endpoints:ee.filter(Xt=>Xt.acl),options:m.options});return{configs:Te.filter(Boolean),hasZodImport:Q,modelsImports:Ke,queriesImports:UW(m.options,Pt,rr),aclImports:or}}t(_at,"getBuilderConfigs");function fQt(l){let u=l.map(b=>({...b,namePathSegments:b.pathSegments.filter(T=>!pR(T))})).sort((b,T)=>b.namePathSegments.length-T.namePathSegments.length),m={};for(let b of u){let T=b.namePathSegments,I=T.length>0?`${wW(T.pop())}${u_(r3e)}`:r3e;for(;m[I];){if(T.length===0)throw new Error(`Can't uniquely resolve builder config name: ${I}`);I=`${wW(T.pop())}${u_(I)}`}m[I]=b}return m}t(fQt,"resolveBuilderConfigNames");function AR(l,u){return u.acl&&l.acl?jle(l,u):void 0}t(AR,"getAclConfig");function wue(l,u){var I,L,Q;if(!u)return;let m;if(u.type==="Body"?m=(L=(I=u.bodyObject)==null?void 0:I.content[h8])==null?void 0:L.schema:m=(Q=u.parameterObject)==null?void 0:Q.schema,!m)return;let b=l.resolveObject(m),T=Object.keys((b==null?void 0:b.properties)??{}).reduce((ae,ee)=>({...ae,[ee]:!0}),{});return{schema:w8(l,u.zodSchema),options:{inputs:T}}}t(wue,"getInputsConfig");function _Qt(l,u){var Pt,rr,or;let m=u.responseObject;if(!m)return;let b=(rr=(Pt=m.content)==null?void 0:Pt[h8])==null?void 0:rr.schema;if(!b)return;let T=pat(l,b),I=Object.keys(T).filter(Lt=>l.resolveObject(T[Lt]).type==="array");I.sort((Lt,Xt)=>{let Vt=l.options.dataResponseParamNames.indexOf(Lt),Ti=l.options.dataResponseParamNames.indexOf(Xt);return Vt!==-1&&Ti!==-1?Vt-Ti:Vt!==-1?-1:Ti!==-1?1:Lt.localeCompare(Xt)});let L=I[0];if(!L)return;let Q=l.resolveObject(T[L]);if(!Q||Q.type!=="array")return;let ae=Q.items,ee=l.resolveObject(ae);if(!ee)return;let pe=gf(ae)?l.getZodSchemaNameByRef(ae.$ref):aR,Te=Object.keys((ee==null?void 0:ee.properties)??{}).reduce((Lt,Xt)=>({...Lt,[Xt]:!0}),{}),Ke=(or=u.parameters.find(Lt=>Lt.parameterObject&&Tle(Lt.parameterObject)))==null?void 0:or.parameterSortingEnumSchemaName;return{columns:{schema:w8(l,pe),options:{columns:Te,sortable:Ke?w8(l,Ke):void 0}},zodSchema:pe,sortableEnumSchemaName:Ke}}t(_Qt,"getColumnsConfig");function pat(l,u){let m=l.resolveObject(u);return m.properties?m.properties:"allOf"in m&&m.allOf?m.allOf.reduce((b,T)=>({...b,...pat(l,T)}),{}):{}}t(pat,"getSchemaProperties");function dat(l){let{configs:u,hasZodImport:m,modelsImports:b,queriesImports:T,aclImports:I}=_at(l);if(u.length===0)return;let{resolver:L,tag:Q}=l,ae=u.some(Pt=>{var rr,or;return Pt.readAll.filters||((rr=Pt.create)==null?void 0:rr.inputDefs)||((or=Pt.update)==null?void 0:or.inputDefs)}),ee={bindings:[LW.dynamicInputs],from:L.options.dynamicInputsImportPath},pe=u.some(Pt=>Pt.readAll.columns),Te={bindings:[LW.dynamicColumns],from:L.options.dynamicColumnsImportPath};return Ah(L,"configs")({hasZodImport:m,zodImport:WA,hasDynamicInputsImport:ae,dynamicInputsImport:ee,hasDynamicColumnsImport:pe,dynamicColumnsImport:Te,modelsImports:b,queriesImports:T,aclImports:I,includeNamespace:L.options.tsNamespaces,namespace:C_({type:"configs",tag:Q,options:L.options}),configs:u,dynamicInputs:LW.dynamicInputs,dynamicColumns:LW.dynamicColumns})}t(dat,"generateConfigs");function mat({resolver:l,data:u,tag:m}){var Vt;let b=(Vt=u.get(m))==null?void 0:Vt.endpoints;if(!b||b.length===0)return;let T={bindings:[RW],from:Cnt(l.options)},I=l.options.axiosRequestConfig,L=I,Q={bindings:I?[DC]:[],from:dle.from},ae=l.options.parseRequestParams,ee=b.reduce((Ti,zn)=>[...Ti,...zn.parameters],[]),pe=ee.filter(Ti=>!["Path","Header"].includes(Ti.type)).map(Ti=>Ti.parameterSortingEnumSchemaName??Ti.zodSchema),Te=b.map(Ti=>Ti.response),Ke=Ib([...Te,...ae?pe:[]]),Pt=Ke.some(Ti=>!wh(Ti)),rr=l.options.parseRequestParams&&pe.length>0,or={bindings:[dS.namespace],from:Ant(l.options)},Lt=RC({resolver:l,tag:m,zodSchemas:Ke.filter(wh),zodSchemasAsTypes:Ib(ee.map(Ti=>Ti.zodSchema).filter(wh))});return Ah(l,"endpoints")({appRestClientImport:T,hasAxiosImport:L,axiosImport:Q,hasZodImport:Pt,zodImport:WA,hasZodExtendedImport:rr,zodExtendedImport:or,modelsImports:Lt,includeNamespace:l.options.tsNamespaces,namespace:C_({type:"endpoints",tag:m,options:l.options}),restClientName:RW,hasAxiosRequestConfig:I,axiosRequestConfigName:VA,axiosRequestConfigType:DC,endpoints:b,generateParse:ae})}t(mat,"generateEndpoints");function hat({resolver:l,data:u,tag:m}){var ae;let b=(ae=u.get(m))==null?void 0:ae.zodSchemas;if(!b||Object.keys(b).length===0)return;let T=Object.keys(b).reduce((ee,pe)=>[...ee,...qrt(l,pe)],[]).filter(ee=>!b[ee]),I=RC({resolver:l,tag:m,zodSchemas:T}),L=Object.entries(b).reduce((ee,[pe,Te])=>{let Ke=l.getZodSchemaObj(pe),Pt={code:Te,isEnum:Urt(Te),schemaObj:Ke};return{...ee,[pe]:Pt}},{});return Ah(l,"models")({zodImport:WA,modelsImports:I,includeNamespace:l.options.tsNamespaces,namespace:C_({type:"models",tag:m,options:l.options}),tag:m,zodSchemasData:L})}t(hat,"generateModels");function gat({resolver:l,data:u,tag:m}){var zl;let b=(zl=u.get(m))==null?void 0:zl.endpoints;if(!b||b.length===0)return;let T=l.options.axiosRequestConfig,I=b.some(({mediaUpload:ia})=>ia),L=T||I,Q={defaultImport:I?Awe:void 0,bindings:T?[DC]:[],from:dle.from},ae=b.filter(mS),ee=ae.filter(ia=>gR(ia,l.options)),pe=b.filter(t3),Te={bindings:[...ae.length>0?[pT.query]:[],...l.options.infiniteQueries&&ee.length>0?[pT.infiniteQuery]:[],...pe.length>0?[pT.mutation]:[]],from:aat.from},Ke=l.options.mutationEffects,Pt={bindings:[Vwe],from:Ent(l.options)},rr=Ke&&pe.length>0,or={bindings:[...pe.length>0?[lR.optionsType,lR.hookName]:[]],from:Pnt(l.options)},Lt=b.filter(ia=>ia.acl),Xt=l.options.checkAcl&&Lt.length>0,Vt={bindings:[e3],from:wnt(l.options)},Ti={bindings:[...ae.length>0?[Ele.query]:[],...l.options.infiniteQueries&&ee.length>0?[Ele.infiniteQuery]:[],...pe.length>0?[Ele.mutation]:[]],from:l.options.queryTypesImportPath},zn=b.reduce((ia,lr)=>[...ia,...lr.parameters],[]),_i=RC({resolver:l,tag:m,zodSchemasAsTypes:Ib(zn.map(ia=>ia.zodSchema).filter(wh))}),vo=Snt({tag:m,endpoints:b,options:l.options}),Vn=Ble({tag:m,endpoints:Lt,options:l.options});return Ah(l,"queries")({hasAxiosImport:L,axiosImport:Q,queryImport:Te,hasMutationEffects:Ke,queryModulesImport:Pt,hasMutationEffectsImport:rr,mutationEffectsImport:or,hasAclCheck:Xt,aclCheckImport:Vt,queryTypesImport:Ti,modelsImports:_i,endpointsImports:vo,aclImports:Vn,includeNamespace:l.options.tsNamespaces,tag:m,namespace:C_({type:"queries",tag:m,options:l.options}),queriesModuleName:pH,queryModuleEnum:Vwe,endpoints:b,queryEndpoints:ae})}t(gat,"generateQueries");function yat(l){return Ah(l,"acl-check")({abilityContextImport:Vrt,appAbilitiesImport:{bindings:[qW],from:Dnt(l.options)},errorHandlingImport:Ple,abilityContext:zwe,appAbilities:qW,errorHandler:YA.ErrorHandler,sharedErrorHandler:YA.SharedErrorHandler,aclCheckHook:e3,hasGenericAppAbilities:l.options.abilityContextGenericAppAbilities})}t(yat,"generateAclCheck");function vat(l){return Ah(l,"app-rest-client")({appRestClientName:RW,baseUrl:l.getBaseUrl(),restClientImportPath:x8})}t(vat,"generateAppRestClient");function bat({resolver:l,data:u}){let m=[];return u.forEach((T,I)=>{var Q;let L=(Q=u.get(I))==null?void 0:Q.endpoints;!L||L.length===0||m.push({tag:I,namespace:C_({type:"queries",tag:I,options:l.options})})}),Ah(l,"query-modules")({modules:m})}t(bat,"generateQueryModules");function Sat(l){return Ah(l,"zod-extended")({zodImport:WA,zodExtendedNamespace:dS.namespace,parse:dS.exports.parse,sortExp:dS.exports.sortExp,errorHandler:YA.ErrorHandler,sharedErrorHandler:YA.SharedErrorHandler,errorHandlingImport:Ple})}t(Sat,"generateZodExtended");function xat(l,u){return u.options.acl?[{fileName:uT({output:u.options.output,fileName:A8(Rle)}),content:fat({resolver:u,data:l})},...u.options.checkAcl?[{fileName:uT({output:u.options.output,fileName:A8(Lle)}),content:yat(u)}]:[]]:[]}t(xat,"getAclFiles");function Tat(l,u){return u.options.mutationEffects?[...pQt([Ale],u),{fileName:uT({output:u.options.output,fileName:A8(wle)}),content:bat({resolver:u,data:l})}]:[]}t(Tat,"getMutationEffectsFiles");function kat(l,u){return u.options.parseRequestParams?[{fileName:uT({output:u.options.output,fileName:A8(Dle)}),content:Sat(u)}]:[]}t(kat,"getZodExtendedFiles");function Cat(l){return l.options.restClientImportPath!==dR.restClientImportPath?[]:[{fileName:uT({output:l.options.output,fileName:A8(Cle)}),content:vat(l)}]}t(Cat,"getAppRestClientFiles");function pQt(l,u){return l.reduce((m,b)=>[...m,dQt(b,u)],[])}t(pQt,"getAssetFiles");function dQt(l,u){let m=A8(l);return{fileName:uT({output:u.options.output,fileName:m}),content:nit(m)}}t(dQt,"getAssetFile");function Eat(l,u){let{resolver:m,data:b}=zle(l,u),T=[],I=[],L=["models","endpoints","queries",...m.options.acl?["acl"]:[],...m.options.builderConfigs?["configs"]:[]],Q={models:hat,endpoints:mat,queries:gat,acl:uat,configs:dat};return b.forEach((ae,ee)=>{L.forEach(pe=>{let Te=Q[pe]({resolver:m,data:b,tag:ee});if(Te){let Ke=uT({output:u.output,fileName:$le({tag:ee,type:pe,options:u})});T.push({fileName:Ke,content:Te}),pe==="acl"&&I.push(ee)}})}),T.push(...xat(b,m),...Tat(b,m),...kat(b,m),...Cat(m)),T}t(Eat,"generateCodeFromOpenAPIDoc");async function Aat({prettier:l,verbose:u,config:m,...b}){let T=Date.now();u&&oS("Resolving config...");let I=await Ule(m),L=Vle({fileConfig:I,params:b});u&&oS("Parsing OpenAPI spec...");let Q=await Pat.default.bundle(L.input);u&&oS("Generating code...");let ae=Eat(Q,L);u&&oS("Writing files..."),iit(ae),u&&LU(`Time: ${Date.now()-T}ms`),l&&mQt({output:L.output,verbose:u})}t(Aat,"generate");function mQt({output:l,verbose:u}){u&&oS("Running Prettier..."),(0,wat.exec)(`prettier --write ${l} `,b=>{u&&(b?HN(b,"Prettier error"):LU("Prettier finished."))})}t(mQt,"execPrettier");var q_=class q_{config;input;output;tsNamespaces;tsPath;splitByTags;defaultTag;excludeTags;excludePathRegex;excludeRedundantZodSchemas;importPath;extractEnums;removeOperationPrefixEndingWith;acl;checkAcl;baseUrl;replaceOptionalWithNullish;infiniteQueries;mutationEffects;parseRequestParams;axiosRequestConfig;builderConfigs;prettier;verbose};t(q_,"GenerateOptions"),qu([zu({envAlias:"config"})],q_.prototype,"config",2),qu([zu({envAlias:"input"})],q_.prototype,"input",2),qu([zu({envAlias:"output"})],q_.prototype,"output",2),qu([zu({envAlias:"tsNamespaces",type:"boolean"})],q_.prototype,"tsNamespaces",2),qu([zu({envAlias:"tsPath"})],q_.prototype,"tsPath",2),qu([zu({envAlias:"splitByTags",type:"boolean"})],q_.prototype,"splitByTags",2),qu([zu({envAlias:"defaultTag"})],q_.prototype,"defaultTag",2),qu([zu({envAlias:"excludeTags"})],q_.prototype,"excludeTags",2),qu([zu({envAlias:"excludePathRegex"})],q_.prototype,"excludePathRegex",2),qu([zu({envAlias:"excludeRedundantZodSchemas",type:"boolean"})],q_.prototype,"excludeRedundantZodSchemas",2),qu([zu({envAlias:"importPath"})],q_.prototype,"importPath",2),qu([zu({envAlias:"extractEnums",type:"boolean"})],q_.prototype,"extractEnums",2),qu([zu({envAlias:"removeOperationPrefixEndingWith"})],q_.prototype,"removeOperationPrefixEndingWith",2),qu([zu({envAlias:"acl",type:"boolean"})],q_.prototype,"acl",2),qu([zu({envAlias:"checkAcl",type:"boolean"})],q_.prototype,"checkAcl",2),qu([zu({envAlias:"baseUrl"})],q_.prototype,"baseUrl",2),qu([zu({envAlias:"replaceOptionalWithNullish",type:"boolean"})],q_.prototype,"replaceOptionalWithNullish",2),qu([zu({envAlias:"infiniteQueries",type:"boolean"})],q_.prototype,"infiniteQueries",2),qu([zu({envAlias:"mutationEffects",type:"boolean"})],q_.prototype,"mutationEffects",2),qu([zu({envAlias:"parseRequestParams",type:"boolean"})],q_.prototype,"parseRequestParams",2),qu([zu({envAlias:"axiosRequestConfig",type:"boolean"})],q_.prototype,"axiosRequestConfig",2),qu([zu({envAlias:"builderConfigs",type:"boolean"})],q_.prototype,"builderConfigs",2),qu([zu({envAlias:"prettier",default:!0,type:"boolean"})],q_.prototype,"prettier",2),qu([zu({envAlias:"verbose",default:!1,type:"boolean"})],q_.prototype,"verbose",2);var n3e=q_,Dat={command:"generate",describe:"Generate code from OpenAPI spec",builder:ace(n3e),handler:t(async l=>{let u=await l;return u.verbose&&sce(`OpenAPI CodeGen ${SM()}`),Aat(u)},"handler")};yQe(iEe(process.argv)).version(SM()||"unknown").scriptName("openapi-codegen").command(Dat).command(uit).help().demandCommand(1).strictCommands(!0).showHelpOnFail(!0).fail((l,u)=>{l&&HN(l),u&&HN(u),oS("Use '--help' for more info"),process.exit(1)}).parse();
|
|
538
538
|
/*! Bundled license information:
|
|
539
539
|
|
|
540
540
|
reflect-metadata/Reflect.js:
|