@povio/openapi-codegen-cli 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -74,4 +74,4 @@ Expecting `+tn.join(", ")+", got '"+(this.terminals_[P]||P)+"'":$a="Parse error
74
74
  `].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(Xk(e,t),(r==null?void 0:r.withDefaultValues)!==!1?eN(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(xt,"getZodChain");function Xk(e,t){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable?"nullable()":t!=null&&t.isRequired?"":"optional()"}o(Xk,"getZodChainablePresence");function eN(e){return e.default!==void 0?`default(${ge(e.type).with("number","integer",()=>Mv(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(eN,"getZodChainableDefault");function tN(e){let t=[];if(e.enum||(e.minLength!==void 0&&t.push(`min(${e.minLength})`),e.maxLength!==void 0&&t.push(`max(${e.maxLength})`)),e.pattern&&t.push(`regex(${rN(e.pattern)})`),e.format){let r=ge(e.format).with("email",()=>"email()").with("hostname","uri",()=>"url()").with("uuid",()=>"uuid()").with("date-time",()=>"datetime({ offset: true })").otherwise(()=>"");r&&t.push(r)}return t.join(".")}o(tN,"getZodChainableStringValidations");function rN(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=Dv(e),`/${e}/`}o(rN,"formatPatternIfNeeded");function nN(e){let t=[];return e.enum?"":(e.type==="integer"&&t.push("int()"),e.minimum!==void 0?e.exclusiveMinimum===!0?t.push(`gt(${e.minimum})`):t.push(`gte(${e.minimum})`):typeof e.exclusiveMinimum=="number"&&t.push(`gt(${e.exclusiveMinimum})`),e.maximum!==void 0?e.exclusiveMaximum===!0?t.push(`lt(${e.maximum})`):t.push(`lte(${e.maximum})`):typeof e.exclusiveMaximum=="number"&&t.push(`lt(${e.exclusiveMaximum})`),e.multipleOf&&t.push(`multipleOf(${e.multipleOf})`),t.join("."))}o(nN,"getZodChainableNumberValidations");function iN(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(iN,"getZodChainableArrayValidations");var Kr=o(e=>e.reduce((t,r)=>t+r,0),"sum");function ie(e,t){if(!t)return e;if(F(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?Ee("oneOf")+ie(e,{...t,type:t.type[0]}):e+Ee("oneOf")+Kr(t.type.map(r=>ie(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?Ee("oneOf")+ie(e,t.oneOf[0]):e+Ee("oneOf")+Kr(t.oneOf.map(r=>ie(0,r)));if(t.anyOf)return t.anyOf.length===1?Ee("anyOf")+ie(e,t.anyOf[0]):e+Ee("anyOf")+Kr(t.anyOf.map(r=>ie(0,r)));if(t.allOf)return t.allOf.length===1?Ee("allOf")+ie(e,t.allOf[0]):e+Ee("allOf")+Kr(t.allOf.map(r=>ie(0,r)));if(!t.type)return e;if(qt(t.type))return t.enum?e+n_(t)+Ee("enum")+Kr(t.enum.map(r=>ie(0,r))):e+n_(t);if(t.type==="array")return t.items?Ee("array")+ie(e,t.items):Ee("array")+ie(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.additionalProperties)return t.additionalProperties===!0?Ee("record")+ie(e):Ee("record")+ie(e,t.additionalProperties);if(t.properties){let r=Object.values(t.properties);return e+Ee("object")+Kr(r.map(n=>ie(0,n)))}return Ee("empty-object")+ie(e)}return e}o(ie,"getOpenAPISchemaComplexity");function n_(e){return ge(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(n_,"complexityByType");function Ee(e){return ge(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","record","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(Ee,"complexityByComposite");var kp=class kp{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;F(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.includeNamespaces&&i&&i!==t?`${K({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return ie(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(kp,"ZodSchema");var Ji=kp;function W({schema:e,resolver:t,meta:r,tag:n}){var g;let i=new Ji(e,t,r),s={parent:i.inherit(r==null?void 0:r.parent),referencedBy:[...i.meta.referencedBy]},a={resolver:t,meta:s,tag:n};if(F(e))return oN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=aN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=sN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=cN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let f=uN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let p=lN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let d=t.options.allReadonly?".readonly()":"";if(Gv(e))return e.items?i.assign(`z.array(${W({...a,schema:e.items}).getCodeString(n,t.options)}${xt({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let m=e.type?e.type.toLowerCase():void 0;if(m==="object"||e.properties||e.additionalProperties){let y=t.options.additionalPropertiesDefaultValue!==void 0?t.options.additionalPropertiesDefaultValue:!0,_=(e.additionalProperties===null||e.additionalProperties===void 0?y:e.additionalProperties)===!1?"":".passthrough()";if(typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0)return i.assign(`z.record(${W({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+xt({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options})})`);let b=e.required&&e.required.length>0,O=t.options.withImplicitRequiredProps?!1:!((g=e.required)!=null&&g.length),P="{}";e.properties&&(P="{ "+Object.entries(e.properties).map(([se,J])=>{var Ut;let G={...s,isRequired:O?!0:b?(Ut=e.required)==null?void 0:Ut.includes(se):t.options.withImplicitRequiredProps,name:se},ve=J;if(F(J)&&t&&(ve=t.getSchemaByRef(J.$ref),!ve))throw new Error(`Schema ${J.$ref} not found`);let _e=W({...a,schema:J,meta:G}).getCodeString(n,t.options)+xt({schema:ve,meta:G,options:t.options});return[se,_e]}).map(([se,J])=>`${qv(se)}: ${J}`).join(", ")+" }");let S=O?".partial()":"",D=t.options.strictObjects?".strict()":"";return i.assign(`z.object(${P})${S}${D}${_}${d}`)}if(!m)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${m}`)}o(W,"getZodSchema");function oN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!F(e))return;let s=t.meta.referencedBy.slice(0,-1).map(u=>u.ref?r.getZodSchemaNameByRef(u.ref)??u.ref:void 0).filter(Boolean),a=r.getZodSchemaNameByRef(e.$ref);if(s.length>1&&s.includes(a))return t.assign(r.getCodeByZodSchemaName(t.ref));let c=r.getCodeByZodSchemaName(e.$ref);if(!c){let u=r.getSchemaByRef(e.$ref);if(!u)throw new Error(`Schema ${e.$ref} not found`);c=W({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(oN,"getReferenceZodSchema");function sN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!Ce(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=W({schema:e.oneOf[0],resolver:r,meta:n,tag:i});return t.assign(c.getCodeString(i,r.options))}let s=(a=e.oneOf)==null?void 0:a.some(c=>Ce(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
75
75
  z.discriminatedUnion("${c}", [${e.oneOf.map(u=>W({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
76
76
  `)}return t.assign(`z.union([${e.oneOf.map(c=>W({schema:c,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(sN,"getOneOfZodSchema");function aN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!(!Ce(e)||!Array.isArray(e.type)))return e.type.length===1?W({schema:{...e,type:e.type[0]},resolver:r,meta:n,tag:i}):t.assign(`z.union([${e.type.map(s=>W({schema:{...e,type:s},resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(aN,"getArrayZodSchema");function cN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Ce(e)||!e.anyOf)return;if(e.anyOf.length===1){let a=W({schema:e.anyOf[0],resolver:r,meta:n,tag:i});return t.assign(a.getCodeString(i,r.options))}let s=e.anyOf.map(a=>W({schema:a,resolver:r,meta:n,tag:i})).map(a=>a.getCodeString(i,r.options)).join(", ");return t.assign(`z.union([${s}])`)}o(cN,"getAnyOfZodSchema");function uN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Ce(e)||!e.allOf)return;if(e.allOf.length===1){let p=W({schema:e.allOf[0],resolver:r,meta:n,tag:i});return t.assign(p.getCodeString(i,r.options))}let{patchRequiredSchemaInLoop:s,noRequiredOnlyAllof:a,composedRequiredSchema:c}=Zv(e),u=a.map(p=>{let d=W({schema:p,resolver:r,meta:n,tag:i});return r&&s(p,r.getSchemaByRef.bind(r)),d});c.required.length&&u.push(W({schema:c,resolver:r,meta:n,tag:i}));let l=u.at(0),f=u.slice(1).map(p=>`merge(${p.getCodeString(i,r.options)})`).join(".");return t.assign(`${l.getCodeString(i,r.options)}.${f}`)}o(uN,"getAllOfZodSchema");function lN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Ce(e))return;let s=e.type?e.type.toLowerCase():void 0;if(s&&qt(s)){if(e.enum){if(s==="string")return pN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i});if(e.enum.some(a=>typeof a=="string"))return t.assign("z.never()");if(e.enum.length===1){let a=e.enum[0];return t.assign(`z.literal(${a===null?"null":a})`)}return t.assign(`z.union([${e.enum.map(a=>`z.literal(${a===null?"null":a})`).join(", ")}])`)}return t.assign(ge(s).with("integer",()=>"z.number()").with("string",()=>ge(e.format).with("binary",()=>"z.instanceof(File)").otherwise(()=>"z.string()")).otherwise(a=>`z.${a}()`))}}o(lN,"getPrimitiveZodSchema");function pN({resolver:e,schema:t,zodSchema:r,meta:n,tag:i}){if(!Ce(t))return;let s=Np(t),a=e.getEnumZodSchemaDataByCode(s);if(!e.options.extractEnums||!a)return r.assign(s);if(!a.zodSchemaName||!a.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${s}`);let c=e.options.includeNamespaces&&a.tag!==i?`${K({type:"models",tag:a.tag,options:e.options})}.`:"";return new Ji(t,e,n,a.zodSchemaName).inherit(r),r.assign(`${c}${a.zodSchemaName}`)}o(pN,"getEnumZodSchema");function Np(e){var t;return`z.enum([${(t=e.enum)==null?void 0:t.map(r=>r===null?"null":`"${r}"`).join(", ")}])`}o(Np,"getEnumZodSchemaCode");function Un({schema:e,zodSchema:t,fallbackName:r,resolver:n,tag:i}){var c;let s=t.getCodeString();if((!Oe(s)||t.ref===void 0)&&r){if(t.complexity<Pp)return s;let u=Mt(r,n.options.schemaSuffix);for(;n.getCodeByZodSchemaName(u);){if((c=n.getZodSchemaNamesByCompositeCode(s))!=null&&c.includes(u))return u;if(n.getCodeByZodSchemaName(u)===u)return u;throw new Error(`Can't uniquely resolve zod schema name: ${u}`)}return n.setZodSchema(u,s,i),n.addZodSchemaForCompositeCode(s,t,u,e),u}let a=n.getCodeByZodSchemaName(s);if(!a&&t.ref&&(a=n.getCodeByZodSchemaName(n.getZodSchemaNameByRef(t.ref))),t.ref&&a)return ie(0,n.getSchemaByRef(t.ref))<Pp?n.getCodeByZodSchemaName(s):s;throw new Error(`Invalid ref: ${t.ref}`)}o(Un,"resolveZodSchemaName");function i_({resolver:e,endpoint:t,operation:r}){let n=r["x-acl"];return n==null?void 0:n.map(i=>{let s=Object.keys(i.conditions??{}).reduce((a,c)=>{let u=fN({resolver:e,endpoint:t,acl:n,name:c});return u?[...a,u]:(e.validationErrors.push(t_(c,r,t)),a)},[]);return{...i,conditionsTypes:s}})}o(i_,"getEndpointAcl");function fN({resolver:e,endpoint:t,acl:r,name:n}){var p,d,m,g,y,v,_,b,O,P;let i=(d=(p=r[0])==null?void 0:p.conditions)==null?void 0:d[n];if(!i)return;let s=i.replace(/^\$[^.]*\./,"").split("."),a,c,u,l=0,f=t.parameters.find(({name:S})=>S===s[l]);if(f)c=(m=f.parameterObject)==null?void 0:m.required,a=(g=f.parameterObject)==null?void 0:g.schema,u=`${f.name} ${Hr(f.type)} parameter`,l++;else{let S=t.parameters.find(({bodyObject:se})=>!!se),R=Object.keys(((y=S==null?void 0:S.bodyObject)==null?void 0:y.content)??{}).find(Ue);R&&(a=(b=(_=(v=S==null?void 0:S.bodyObject)==null?void 0:v.content)==null?void 0:_[R])==null?void 0:b.schema,u=`${Et(t)?"query":"mutation"} data`)}for(;a&&l<s.length;){let S=e.resolveObject(a);a=(O=Object.entries(S.properties??{}).find(([R])=>R===s[l]))==null?void 0:O[1],c=((P=S.required)==null?void 0:P.includes(s[l]))??!1,l++}if(a)return{name:n,type:F(a)?void 0:a.type,zodSchemaName:F(a)?e.getZodSchemaNameByRef(a.$ref):void 0,required:c,info:u}}o(fN,"getEndpointAclConditionPropertyType");function o_({resolver:e,operation:t,operationName:r,isUniqueOperationName:n,tag:i}){var m,g;let s=e.resolveObject(t.requestBody);if(!s)return;let c=Object.keys(s.content??{}).find(Ue);if(!c)return;let u=(g=(m=s.content)==null?void 0:m[c])==null?void 0:g.schema;if(!u)return;let l=W({schema:u,resolver:e,meta:{isRequired:s.required??!0},tag:i}),f=e.resolveObject(u),p=Un({schema:f,zodSchema:l,fallbackName:ks(Gr(r,n,i)),resolver:e,tag:i}),d=xt({schema:f,meta:l.meta,options:e.options});return{endpointParameter:{name:zv,type:"Body",description:s.description,zodSchema:p+d,bodyObject:s},requestFormat:c}}o(o_,"getEndpointBody");function s_({resolver:e,param:t,operationName:r,isUniqueOperationName:n,tag:i}){let s=e.resolveObject(t);if(!kv.includes(s.in))return;let a={};if(s.content){let p=Object.keys(s.content??{}),d=p.find(Ue);if(!d)throw new Error(`Unsupported media type for param ${s.name}: ${p.join(", ")}`);let m=s.content[d];if(!m)throw new Error(`No content with media type for param ${s.name}: ${d}`);a=(m==null?void 0:m.schema)??m}else s.schema&&(a=s.schema);e.options.withDescription&&a&&(a.description=(s.description??"").trim());let c=W({schema:a,resolver:e,meta:{isRequired:s.in==="path"?!0:s.required??!1},tag:i}),u=e.resolveObject(a),l=xt({schema:u,meta:c.meta,options:e.options}),f=Un({schema:u,zodSchema:c.assign(c.getCodeString(i)+l),fallbackName:Vv(Gr(r,n,i),s.name),resolver:e,tag:i});return{name:ge(s.in).with("path",()=>xp(s.name)).otherwise(()=>s.name),type:ge(s.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:f,parameterObject:s}}o(s_,"getEndpointParameter");function c_(e){var r,n,i,s,a;let t=[];for(let c in e.openApiDoc.paths){let u=e.openApiDoc.paths[c],l=dr(u,fr),f=a_(u.parameters??[]);for(let p in l){let d=l[p];if(!d||d.deprecated&&!e.options.withDeprecatedEndpoints)continue;let m=d.operationId&&d.operationId!==bt(d.operationId);d.operationId&&m&&e.validationErrors.push(Qv(d.operationId));let g=Object.entries({...f,...a_(d.parameters??[])}).map(([,P])=>P),y=Ki({path:c,method:p,operation:d,operationsByTag:e.operationsByTag,options:e.options}),v=e.operationNames.filter(P=>P===y).length<=1,_=Ur(d,e.options),b={method:p,path:Fv(c),operationName:y,description:d.description,summary:d.summary,tags:(r=d.tags)==null?void 0:r.map(Ot),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[]};if(d.requestBody){let P=o_({resolver:e,operation:d,operationName:y,isUniqueOperationName:v,tag:_});P&&(b.parameters.push(P.endpointParameter),b.requestFormat=P.requestFormat)}for(let P of g){let S=s_({resolver:e,param:P,operationName:y,isUniqueOperationName:v,tag:_});S&&b.parameters.push(S)}let O=dN(b);O.forEach(P=>{b.parameters.push(P)}),O.length>0&&e.validationErrors.push(Jv(O,c));for(let P in d.responses){b.responseStatusCodes.push(P);let S=e.resolveObject(d.responses[P]),R=Object.keys(S.content??{}).find(Bn),se,J;if(R?(b.responseFormat=R,se=(i=(n=S.content)==null?void 0:n[R])==null?void 0:i.schema):J=dp,se){let G=W({schema:se,resolver:e,meta:{isRequired:!0},tag:_}),ve=e.resolveObject(se);J=Un({schema:ve,zodSchema:G,fallbackName:G.ref?void 0:Ns({statusCode:P,operationName:y,isUniqueOperationName:v,tag:_}),resolver:e,tag:_})+xt({schema:ve,meta:G.meta,options:e.options})}if(J){let G=Number(P);As(G)?(b.response=J,b.responseObject=S):P!=="default"&&Is(G)&&b.errors.push({zodSchema:J,status:G,description:S.description})}}b.response||(b.response=dp),b.acl=i_({resolver:e,endpoint:b,operation:d}),(s=d.security)!=null&&s[0].Authorization&&!b.responseStatusCodes.includes("401")&&e.validationErrors.push(Tp("401",d,b)),(a=b.acl)!=null&&a[0]&&!b.responseStatusCodes.includes("403")&&e.validationErrors.push(Tp("403",d,b)),t.push(b)}}return t}o(c_,"getEndpointsFromOpenAPIDoc");function a_(e){return Object.fromEntries((e??[]).map(t=>[F(t)?t.$ref:t.name,t]))}o(a_,"getParameters");function dN(e){return[...e.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(r=>r[1]).filter(r=>e.parameters.findIndex(({name:n})=>n===r)===-1).map(r=>mN(r))}o(dN,"getMissingPathParameters");function mN(e){return{name:e,type:"Path",zodSchema:"z.string()",parameterObject:{name:e,required:!0,in:"path",schema:{type:"string"}}}}o(mN,"getPathParameterFromName");function ot(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(F(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ws.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s){if((n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))===!0)return;ot(a,{data:r,onSchema:n})}}if(i.properties)for(let[s,a]of Object.entries(i.properties)){if(n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})===!0)return;ot(a,t)}if(i.additionalProperties)for(let[s,a]of Object.entries(i.additionalProperties)){if(!(a instanceof Object)||n({type:"additionalProperty",parentSchema:e,schema:a,data:r,propertyName:s})===!0)return;ot(a,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;ot(s,t)}}o(ot,"iterateSchema");function u_(e,t){let r=hN(e,t),n=gN(e,r);return{refsDependencyGraph:r,deepDependencyGraph:n}}o(u_,"getOpenAPISchemaDependencyGraph");function hN(e,t){let r={},n={};return e.forEach(i=>yN({schema:t(i),fromRef:i,getSchemaByRef:t,visitedRefs:r,refsDependencyGraph:n})),n}o(hN,"getRefsDependencyGraph");function gN(e,t){let r={},n={},i=o((s,a)=>{n[a].add(s),t[s]&&a!==s&&t[s].forEach(c=>{let u=`${a}__${c}`;r[u]||(r[u]=!0,i(c,a))})},"visit");return e.forEach(s=>{let a=t[s];a&&(n[s]||(n[s]=new Set),a.forEach(c=>i(c,s)))}),n}o(gN,"getDeepRefsDependencyGraph");function yN({schema:e,fromRef:t,getSchemaByRef:r,visitedRefs:n={},refsDependencyGraph:i={}}){let s=o(a=>{if(a.type!=="reference"||!a.data)return;let{schema:c,data:u}=a;if(i[u.fromRef]||(i[u.fromRef]=new Set),i[u.fromRef].add(c.$ref),n[c.$ref])return!0;n[u.fromRef]=!0,ot(r(c.$ref),{data:{fromRef:c.$ref},onSchema:s})},"onSchema");return ot(e,{data:{fromRef:t},onSchema:s}),{visitedRefs:n,refsDependencyGraph:i}}o(yN,"getSchemaRefsDependencyGraph");function qs(e,t,r){let n=[];return ot(t,{onSchema:o(i=>{i.type==="reference"?n.push(i.schema):F(i.parentSchema)&&(i.type==="property"||i.type==="additionalProperty"?e.validationErrors.push(js(`${r} has both reference and properties`)):i.type==="array"?e.validationErrors.push(js(`${r} is both reference and array schema`)):i.type==="composite"&&e.validationErrors.push(js(`${r} has both reference and composite keyword`)))},"onSchema")}),n}o(qs,"getSchemaRefObjs");function l_(e,t){return t.map(i=>zr(i.$ref)).reduce((i,s)=>{let a=e.dependencyGraph.deepDependencyGraph[s];return[...i,s,...Array.from(a??[])]},[])}o(l_,"getDeepSchemaRefObjs");function Xi({schema:e,nameSegments:t=[],includeSelf:r,...n}){r&&p_({schema:e,nameSegments:t,...n}),ot(e,{data:{nameSegments:t},onSchema:o(i=>{var a;if(i.type==="reference")return!0;let s=[...((a=i.data)==null?void 0:a.nameSegments)??[]];(i.type==="property"||i.type==="additionalProperty")&&s.push(i.propertyName),p_({schema:i.schema,nameSegments:[...s],...n})},"onSchema")})}o(Xi,"updateEnumZodSchemaData");function p_({resolver:e,schema:t,schemaRef:r,schemaInfo:n,tags:i,nameSegments:s=[]}){if(!t||F(t)||!t.enum)return;let a=Np(t),c=e.enumZodSchemaData.find(u=>u.code===a);c?(c.meta.zodSchemaNameSegments.push(s),c.meta.tags.push(...i),c.meta.schemaRefs.push(...r?[r]:[])):e.enumZodSchemaData.push({code:a,meta:{zodSchemaNameSegments:[s],tags:[...i],schemaRefs:r?[r]:[]}}),e.validationErrors.push(Xv(r?`schema ${Vn(r)} property ${s[s.length-1]}`:n??s.join("->")))}o(p_,"handleEnumZodSchemaDataUpdate");function f_(e){e.enumZodSchemaData.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(s=>s[s.length-1]).filter(Boolean),i=hp(n);if(!i)throw new Error(`No common last segment found for enum: ${r.code}`);r.zodSchemaName=wp(i,e.options.enumSuffix,e.options.schemaSuffix)});let t=0;for(;t<5&&!Rp(e);)vN(e,t+2),t++;if(Rp(e)||e.enumZodSchemaData.filter(n=>!m_(e,n)).forEach(n=>{n.zodSchemaName=wp(n.meta.zodSchemaNameSegments[0].map(i=>Cp(Z(i))).join(""),e.options.enumSuffix,e.options.schemaSuffix)}),!Rp(e))throw new Error("Failed to resolve unique names for enum zod schemas")}o(f_,"resolveEnumZodSchemaNames");function Rp(e){return e.enumZodSchemaData.every(t=>m_(e,t))}o(Rp,"allEnumZodSchemaNamesAreUnique");function vN(e,t){e.enumZodSchemaData.forEach(r=>{let n=e.enumZodSchemaData.filter(({zodSchemaName:i})=>r.zodSchemaName===i);n.length!==1&&_N(n,t)})}o(vN,"additionalResolveEnumZodSchemaName");function _N(e,t=2){e.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(i=>i[i.length-t]).filter(Boolean);if(n.length===1){let i=[Cp(Z(n[0])),r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=i}else{let i=hp(n),s=[i?Cp(Z(i)):"",r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=s}})}o(_N,"suffixWithPreviousSegmentName");function d_(e){e.enumZodSchemaData.forEach(t=>{let r=$e(t.meta.tags);t.tag=r.length===1?r[0]:e.options.defaultTag})}o(d_,"resolveEnumZodSchemaTags");function m_(e,t){return e.enumZodSchemaData.filter(({zodSchemaName:r})=>t.zodSchemaName===r).length===1}o(m_,"isUnique");function Cp(e){return e.replace(/(Dto|DTO|Response|Request)/g,"")}o(Cp,"sanitizeName");var jp=class jp{constructor(t,r){this.openApiDoc=t;this.options=r;this.dependencyGraph=u_(this.schemaRefs,this.getSchemaByRef.bind(this)),this.operationsByTag=Rv(t,r),this.operationNames=Lv(t,this.operationsByTag,r),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];enumZodSchemaData=[];dependencyGraph;operationsByTag={};operationNames=[];validationErrors=[];get docSchemas(){var t;return((t=this.openApiDoc.components)==null?void 0:t.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(jv)}getSchemaByRef(t){return this.docSchemas[Vn(t)]}getSchemaDataByRef(t){return this.schemaData.find(r=>r.ref===t)}getZodSchemaNameByRef(t){var n,i;let r=((n=this.getSchemaDataByRef(zr(t)))==null?void 0:n.zodSchemaName)??((i=this.enumZodSchemaData.find(s=>s.zodSchemaName===t))==null?void 0:i.zodSchemaName);if(!r)throw new Error(`Zod schema not found for ref: ${t}`);return r}getRefByZodSchemaName(t){var r;return(r=this.schemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.ref}getTagByZodSchemaName(t){var u,l;if(!this.options.splitByTags)return this.options.defaultTag;let r=this.enumZodSchemaData.find(f=>f.zodSchemaName===t);if(r)return Ot(r.tag??this.options.defaultTag);let n=this.getRefByZodSchemaName(t),i=n?((u=this.getSchemaDataByRef(n))==null?void 0:u.tags)??[]:[],s=((l=this.zodSchemaData.find(f=>f.zodSchemaName===t))==null?void 0:l.tags)??[],a=$e(i,s),c=a.length===1?a[0]:this.options.defaultTag;return Ot(c??this.options.defaultTag)}getCodeByZodSchemaName(t){var r;return(r=this.zodSchemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.code}getZodSchemaNamesByCompositeCode(t){var r;return(r=this.compositeZodSchemaData.find(n=>n.code===t))==null?void 0:r.zodSchemas.map(n=>n.zodSchemaName)}setZodSchema(t,r,n){let i=this.zodSchemaData.find(s=>s.zodSchemaName===t);i?(i.code=r,i.tags=(i.tags??[]).concat(n)):this.zodSchemaData.push({zodSchemaName:t,code:r,tags:[n]})}addZodSchemaForCompositeCode(t,r,n,i){let s={zodSchemaName:n,zodSchema:r,schema:i},a=this.compositeZodSchemaData.find(c=>c.code===t);a?a.zodSchemas.push(s):this.compositeZodSchemaData.push({code:t,zodSchemas:[s]})}getCompositeZodSchemaByZodSchemaName(t){var n;let r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t));return(n=r==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.zodSchema}getSchemaByCompositeZodSchemaName(t){var r,n;return(n=(r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t)))==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.schema}getEnumZodSchemaDataByCode(t){return this.enumZodSchemaData.find(r=>r.code===t)}getEnumZodSchemaNamesReferencedBySchemaRef(t){return this.enumZodSchemaData.reduce((r,{zodSchemaName:n,meta:i})=>(n&&i.schemaRefs.includes(t)&&r.push(n),r),[])}getZodSchemas(){return this.zodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>({...t,[r]:n}),{})}getEnumZodSchemas(){return this.enumZodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>r?{...t,[r]:n}:t,{})}resolveObject(t){return F(t)?this.getSchemaByRef(t.$ref):t}isSchemaCircular(t){var r;return(r=this.dependencyGraph.deepDependencyGraph[t])==null?void 0:r.has(t)}getCircularSchemaChain(t,r=t,n=[]){var i,s;return(i=this.dependencyGraph.refsDependencyGraph[r])!=null&&i.has(t)?[...n,r,t]:Array.from(((s=this.dependencyGraph.refsDependencyGraph[r])==null?void 0:s.values())??[]).map(a=>{let c=this.getCircularSchemaChain(t,a,n);return c.length>0?[r,...c]:c}).flat()}initialize(){var t,r,n,i,s,a;this.schemaRefs.forEach(c=>{let u=zr(c),l=Vn(u),f=Mt(l,this.options.schemaSuffix);this.schemaData.push({ref:u,name:l,zodSchemaName:f,tags:[]})});for(let c in this.openApiDoc.paths){let u=this.openApiDoc.paths[c],l=dr(u,fr);for(let f in l){let p=l[f];if(!p||p.deprecated&&!((t=this.options)!=null&&t.withDeprecatedEndpoints))continue;let d=Ur(p,this.options),m=Ki({path:c,method:f,operation:p,operationsByTag:this.operationsByTag,options:this.options}),g=this.operationNames.filter(b=>b===m).length<=1,y=ue(Gr(m,g,d)),v=[];if((r=p.parameters)==null||r.map(b=>{let O=b,P=O.schema,S=`operation ${p.operationId??c} parameter ${O.name}`;v.push(...qs(this,P,S)),this.options.extractEnums&&Xi({resolver:this,schema:P,schemaInfo:S,tags:[d],nameSegments:[y,O.name],includeSelf:!0})}),p.requestBody){let b=this.resolveObject(p.requestBody),P=Object.keys(b.content??{}).find(Ue);if(P){let S=(i=(n=b.content)==null?void 0:n[P])==null?void 0:i.schema,D=`operation ${p.operationId} request body`;v.push(...qs(this,S,D)),this.options.extractEnums&&Xi({resolver:this,schema:S,schemaInfo:D,tags:[d],nameSegments:[ks(y)]})}}for(let b in p.responses){let O=this.resolveObject(p.responses[b]),S=Object.keys(O.content??{}).find(Bn);if(S){let D=(a=(s=O.content)==null?void 0:s[S])==null?void 0:a.schema,R=`operation ${p.operationId} response body`;v.push(...qs(this,D,R)),this.options.extractEnums&&Xi({resolver:this,schema:D,schemaInfo:R,tags:[d],nameSegments:[Ns({statusCode:b,operationName:m,isUniqueOperationName:g,tag:d})]})}}l_(this,v).forEach(b=>{let O=this.getSchemaDataByRef(b);O&&O.tags.push(d)})}}this.options.extractEnums&&(this.schemaRefs.forEach(c=>{var l;let u=zr(c);Xi({resolver:this,schema:this.getSchemaByRef(u),schemaRef:u,tags:((l=this.getSchemaDataByRef(u))==null?void 0:l.tags)??[],nameSegments:[Vn(u)]})}),f_(this),d_(this))}};o(jp,"SchemaResolver");var Ms=jp;function h_(e){var r;let t={};return Object.entries(((r=e.openApiDoc.components)==null?void 0:r.schemas)??{}).forEach(([n,i])=>{let s=Mt(n,e.options.schemaSuffix);if(!t[s]){let a=e.getTagByZodSchemaName(s);t[s]=W({schema:i,resolver:e,tag:a}).getCodeString(a)}}),t}o(h_,"getZodSchemasFromOpenAPIDoc");function g_(e){let t=[],r={};function n(i,s){Array.isArray(s)||(s=[]),s.push(i),r[i]=!0,e[i]&&e[i].forEach(a=>{s.includes(a)||r[a]||n(a,s.slice(0))}),t.includes(i)||t.push(i)}return o(n,"visit"),Object.keys(e).forEach(i=>n(i,[])),t}o(g_,"topologicalSort");function y_(e,t){let r=Object.entries(e),n=r.filter(([i])=>t.includes(i)).sort(([i],[s])=>t.indexOf(i)-t.indexOf(s)).concat(r.filter(([i])=>!t.includes(i)));return Object.fromEntries(n)}o(y_,"sortObjKeysFromArray");function v_(e,t){let r=g_(e.dependencyGraph.deepDependencyGraph).map(i=>e.getZodSchemaNameByRef(i));return y_(t,r)}o(v_,"sortZodSchemasByTopology");function __(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{let s=e.getRefByZodSchemaName(n);s&&e.isSchemaCircular(s)?(e.validationErrors.push(e_(e.getCircularSchemaChain(s).join(" -> "))),r[Mt(n,e.options.schemaSuffix)]=`z.lazy(() => ${i})`):r[Mt(n,e.options.schemaSuffix)]=i}),r}o(__,"wrapCircularZodSchemas");function Ds(e,t){let r=new Ms(e,t),n=c_(r),s={...h_(r),...r.getZodSchemas()};return s=__(r,s),s=v_(r,s),s={...r.getEnumZodSchemas(),...s},{resolver:r,data:bN({resolver:r,endpoints:n,zodSchemas:s,options:t})}}o(Ds,"getDataFromOpenAPIDoc");function bN({resolver:e,endpoints:t,zodSchemas:r,options:n}){let i=new Map;return n.splitByTags?(t.forEach(s=>{let a=Qi(s,n);b_(a,i).endpoints.push(s)}),Object.entries(r).forEach(([s,a])=>{let c=e.getTagByZodSchemaName(s);c&&(b_(c,i).zodSchemas[s]=a)}),i):(i.set(n.defaultTag,{endpoints:t,zodSchemas:r}),i)}o(bN,"splitDataByTags");function b_(e,t){return t.has(e)||t.set(e,{endpoints:[],zodSchemas:{}}),t.get(e)}o(b_,"getTagElement");async function S_(e,t){let{resolver:r,data:n}=await Ds(e,t),i=[],s=[];return n.forEach(({endpoints:c,zodSchemas:u},l)=>{var d;((d=t.excludeTags)==null?void 0:d.findIndex(m=>m.toLowerCase()===l.toLowerCase()))===-1&&(Object.keys(u).forEach(m=>{let g=r.getRefByZodSchemaName(m),y=g?r.getSchemaByRef(g):r.getSchemaByCompositeZodSchemaName(m),v=Hn({zodSchemaName:m,schema:y,resolver:r}),_;y&&(_=Zr({schema:y,parentTypes:[v],resolver:r})),i.push({...v,metaType:"primitive",..._})}),c.forEach(m=>{let g="queries",y=Ot(l);s.push({name:Os(m),filePath:Ct({type:g,tag:y,includeTagDir:!0,options:t}),namespace:t.includeNamespaces?K({type:g,tag:y,options:t}):void 0,isQuery:Et(m),isMutation:Ts(m),params:SN({resolver:r,endpoint:m}),response:PN({resolver:r,endpoint:m})})}))}),{openApiDoc:e,models:i,queries:s}}o(S_,"getMetadataFromOpenAPIDoc");function SN({resolver:e,endpoint:t}){return t.parameters.map(r=>{var a,c,u,l;let n;if((a=r.parameterObject)!=null&&a.schema)n=e.resolveObject(r.parameterObject.schema);else if(r.bodyObject){let p=Object.keys(r.bodyObject.content??{}).find(Ue);p&&(n=e.resolveObject((u=(c=r.bodyObject.content)==null?void 0:c[p])==null?void 0:u.schema))}let i=Hn({zodSchemaName:r.zodSchema,schema:n,resolver:e}),s;return n&&(s=Zr({schema:n,parentTypes:[i],resolver:e})),{name:bt(r.name),isRequired:((l=r.parameterObject)==null?void 0:l.required)??!0,...i,...s,paramType:r.type}}).sort((r,n)=>{if(r.isRequired===n.isRequired){let i=["Path","Body","Query","Header"];return i.indexOf(r.paramType)-i.indexOf(n.paramType)}return r.isRequired?-1:1}).map(({paramType:r,...n})=>n)}o(SN,"getQueryMetadataParams");function PN({resolver:e,endpoint:t}){var a,c,u,l;let r,n=Object.keys(((a=t.responseObject)==null?void 0:a.content)??{}).find(Bn);n&&(r=e.resolveObject((l=(u=(c=t.responseObject)==null?void 0:c.content)==null?void 0:u[n])==null?void 0:l.schema));let i=Hn({zodSchemaName:t.response,schema:r,resolver:e}),s;return r&&(s=Zr({schema:r,parentTypes:[i],resolver:e})),{...i,metaType:"primitive",...s}}o(PN,"getQueryMetadataResponse");var P_="acl/app.ability",eo="AllAbilities",st={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subject:"subject"},qp={bindings:[st.abilityTuple,st.pureAbility,st.forcedSubject,st.subject],from:"@casl/ability"};var $_=o(e=>`Use${Z(ue(e.operationName))}Ability`,"getAbilityTypeName"),O_=o(e=>`canUse${Z(ue(e.operationName))}`,"getAbilityFunctionName"),E_=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),x_=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),w_=o(e=>{var t;return!!((t=Mp(e))!=null&&t.length)},"hasAbilityConditions"),Mp=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),A_=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),Ls=o(e=>`${Z(e)}${eo}`,"getTagAllAbilitiesName");var Dp="src/data",Lp="@/data",Fp="AppRestClient",I_={bindings:[Fp],from:"@/util/rest/clients/app-rest-client"},to={query:"AppQueryOptions",mutation:"AppMutationOptions"},T_={bindings:[to.query,to.mutation],from:"@/types/react-query"};function mr({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=Vp({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=Vp({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Yi(u,e.options),"getEntityName"),options:e.options});return $N(e.options,a,c)}o(mr,"getModelsImports");function k_({tag:e,endpoints:t,options:r}){return Vp({type:"endpoints",tag:e,entities:t,getTag:o(n=>Qi(n,r),"getTag"),getEntityName:Wi,options:r})}o(k_,"getEndpointsImports");function N_({tags:e,entityName:t,getAliasEntityName:r,options:n}){let i=new Map;return e.forEach(s=>{let a=`${t}${r?` as ${r(s)}`:""}`;i.has(s)?n.includeNamespaces||i.get(s).bindings.push(a):i.set(s,{bindings:[n.includeNamespaces?K({type:"acl",tag:s,options:n}):a],from:`${R_(n)}${Ct({type:"acl",tag:s,includeTagDir:!0,options:n})}`})}),Array.from(i.values())}o(N_,"getAclImports");function R_(e){let t=Lp;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${Dp}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${Dp}`,"g"),Lp)),`${t}/`.replace(/\/\//g,"/")}o(R_,"getImportPath");function Vp({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.includeNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.includeNamespaces?K({type:e,tag:u,options:s}):i(c)],from:`${l?"./":R_(s)}${Ct({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(Vp,"getImports");function $N(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.includeNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:$e(n.bindings)}))}o($N,"mergeImports");var Df=ut(yr());var Cf=ut(require("fs")),OS=ut(require("path"));function jf(e){let t=`src/generators/templates/${e}.hbs`;return Cf.default.readFileSync(OS.default.join(__dirname,`../${t}`),"utf-8")}o(jf,"readHbsTemplateSync");function qf({output:e,fileName:t}){return`${e}/${t}.ts`}o(qf,"getOutputFileName");var Bt=ut(yr());function ES(){h3(),g3(),y3(),v3(),_3(),b3(),S3(),P3()}o(ES,"registerAclHbsHelpers");function h3(){Bt.default.registerHelper("abilityTypeName",$_)}o(h3,"registerAbilityTypeNameHelper");function g3(){Bt.default.registerHelper("abilityFunctionName",O_)}o(g3,"registerAbilityFunctionNameHelper");function y3(){Bt.default.registerHelper("ablityAction",E_)}o(y3,"registerAbilityActionHelper");function v3(){Bt.default.registerHelper("ablitySubject",x_)}o(v3,"registerAbilitySubjectHelper");function _3(){Bt.default.registerHelper("hasAbilityConditions",w_)}o(_3,"registerHasAbilityConditionsHelper");function b3(){Bt.default.registerHelper("abilityConditionsTypes",Mp)}o(b3,"registerAbilityConditionsTypesHelper");function S3(){Bt.default.registerHelper("abilityDescription",A_)}o(S3,"registerAbilityDescriptionHelper");function P3(){Bt.default.registerHelper("tagAllAbilitiesName",Ls)}o(P3,"registerTagAllAbilitiesNameHelper");var Pa=ut(yr());function xS(){$3(),O3(),E3()}o(xS,"registerCommonHbsHelpers");function $3(){Pa.default.registerHelper("isEqual",(e,t)=>e===t)}o($3,"registerIsEqualHelper");function O3(){Pa.default.registerHelper("commaSeparated",e=>e.join(", "))}o(O3,"registerCommaSeparatedListHelper");function E3(){Pa.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
77
- *`))}o(E3,"registerAddAsteriskAfterNewLineHelper");var vr=ut(yr());function wS(e){x3(),w3(e.options),T3(e),A3(),I3(),k3(e),N3()}o(wS,"registerEndpointsHbsHelpers");function x3(){vr.default.registerHelper("endpointName",Wi)}o(x3,"registerEndpointNameHelper");function w3(e){vr.default.registerHelper("importedEndpointName",t=>Kv(t,e))}o(w3,"registerImportedEndpointNameHelper");function A3(){vr.default.registerHelper("endpointPath",Yv)}o(A3,"registerEndpointPathHelper");function I3(){vr.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(I3,"registerEndpointBodyHelper");function T3(e){vr.default.registerHelper("endpointParams",t=>Ip(e,t))}o(T3,"registerEndpointParamsHelper");function k3(e){vr.default.registerHelper("endpointArgs",t=>Ip(e,t).map(r=>r.name).join(", "))}o(k3,"registerEndpointArgsHelper");function N3(){vr.default.registerHelper("endpointParamDescription",e=>{var s,a,c,u,l;let t=[`${e.paramType} parameter`],r=((s=e.parameterObject)==null?void 0:s.description)||((a=e.bodyObject)==null?void 0:a.description);r&&t.push(r);let n,i;if((c=e.parameterObject)!=null&&c.schema&&Ce(e.parameterObject.schema)&&(n=(u=e.parameterObject)==null?void 0:u.schema),(l=e.bodyObject)!=null&&l.content){let p=Object.keys(e.bodyObject.content??{}).find(Ue);p&&(i=e.bodyObject.content[p],i.schema&&Ce(i.schema)&&(n=i.schema))}return n&&["description","minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","example"].filter(p=>n[p]).forEach(p=>{t.push(`${Z(Ev(p))}: \`${n[p]}\``)}),i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(N3,"registerEndpointParamDescriptionHelper");var br=ut(yr());var _r={query:"useQuery",mutation:"useMutation"},AS={bindings:[_r.query,_r.mutation],from:"@tanstack/react-query"};function IS(){R3(),C3(),j3(),q3(),M3(),D3(),L3()}o(IS,"registerPartialsHbsHelpers");function R3(){br.default.registerHelper("genImport",e=>Sr("import")({import:e}))}o(R3,"registerImportHelper");function C3(){br.default.registerHelper("genEndpointParams",e=>Sr("endpoint-params")({endpoint:e}))}o(C3,"registerGenerateEndpointParamsHelper");function j3(){br.default.registerHelper("genEndpointConfig",e=>{let t=Wv(e);return Object.keys(t).length===0?"":Sr("endpoint-config")({endpointConfig:t})})}o(j3,"registerGenerateEndpointConfigHelper");function q3(){br.default.registerHelper("genQueryKeys",e=>e.length===0?"":Sr("query-keys")({endpoints:e}))}o(q3,"registerGenerateQueryKeysHelper");function M3(){br.default.registerHelper("genQuery",e=>{let t,r;return Et(e)?(t="query-use-query",r=_r.query):(t="query-use-mutation",r=_r.mutation),Sr(t)({endpoint:e,queryHook:r})})}o(M3,"registerGenerateQueryHelper");function D3(){br.default.registerHelper("genCaslAbilityType",e=>Sr("casl-ability-type")({endpoint:e,abilityTupleType:st.abilityTuple}))}o(D3,"registerGenerateCaslAbilityTypeHelper");function L3(){br.default.registerHelper("genCaslAbilityFunction",e=>Sr("casl-ability-function")({endpoint:e}))}o(L3,"registerGenerateCaslAbilityFunctionHelper");var go=ut(yr());function TS(){F3(),V3(),B3(),H3()}o(TS,"registerQueryHbsHelpers");function F3(){go.default.registerHelper("queryName",Os)}o(F3,"registerQueryNameHelper");function V3(){go.default.registerHelper("allQueryKeys",gp)}o(V3,"registerQueryKeysHelper");function B3(){go.default.registerHelper("endpointPathQueryKeys",xv)}o(B3,"registerEndpointPathQueryKeysHelper");function H3(){go.default.registerHelper("isQuery",Et)}o(H3,"registerIsQueryHelper");var Mf=ut(yr());function kS(e){U3(e.options),z3(e)}o(kS,"registerZodHbsHelpers");function U3(e){Mf.default.registerHelper("zodInferedType",t=>Yi(t,e))}o(U3,"registerInferedTypeHelper");function z3(e){Mf.default.registerHelper("importedZodSchemaName",t=>Bv(e,t))}o(z3,"registerImportedZodSchemaNameHelper");function Ht(e,t){let r=jf(t);return xS(),kS(e),wS(e),TS(),ES(),IS(),Df.default.compile(r)}o(Ht,"getHbsTemplateDelegate");function Sr(e){let t=jf(`partials/${e}`);return Df.default.compile(t)}o(Sr,"getHbsPartialTemplateDelegate");function NS({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.endpoints.filter(({acl:l})=>l&&l.length>0);if(!n||n.length===0)return;let i={...qp,bindings:[st.abilityTuple,...n.filter(({acl:l})=>l==null?void 0:l[0].conditions)?[st.forcedSubject,st.subject]:[]]},s=n.reduce((l,f)=>{var d,m;let p=(m=(d=f.acl)==null?void 0:d[0].conditionsTypes)==null?void 0:m.reduce((g,y)=>[...g,...y!=null&&y.zodSchemaName?[y.zodSchemaName]:[]],[]);return[...l,...p??[]]},[]),a=mr({resolver:e,tag:r,zodSchemasAsTypes:$e(s)});return Ht(e,"acl")({caslAbilityTupleImport:i,modelsImports:a,includeNamespace:e.options.includeNamespaces,namespace:K({type:"acl",tag:r,options:e.options}),endpoints:n})}o(NS,"generateAcl");function RS(e,t){if(!t||t.length===0)return;let r={...qp,bindings:[st.pureAbility]},n=N_({tags:t,entityName:eo,getAliasEntityName:Ls,options:e.options}),i=t.map(a=>K({type:"acl",tag:a,options:e.options}));return Ht(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:eo,includeNamespace:e.options.includeNamespaces,tags:t,namespaces:i})}o(RS,"generateAppAcl");function CS({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints;if(!n||n.length===0)return;let i=n.map(f=>f.response),s=i.some(f=>!Oe(f)),a=n.reduce((f,p)=>[...f,...p.parameters],[]),c=mr({resolver:e,tag:r,zodSchemas:$e(i.filter(Oe)),zodSchemasAsTypes:$e(a.map(f=>f.zodSchema).filter(Oe))});return Ht(e,"endpoints")({restClientImport:I_,hasZodImport:s,zodImport:Ps,modelsImports:c,includeNamespace:e.options.includeNamespaces,namespace:K({type:"endpoints",tag:r,options:e.options}),restClientName:Fp,endpoints:n})}o(CS,"generateEndpoints");function jS(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(qS(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(jS,"getZodSchemaRefs");function qS(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&qS(n).forEach(s=>r.add(s)),r},new Set)}o(qS,"getSchemaRefs");function MS({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((l,f)=>[...l,...jS(e,f)],[]).filter(l=>!n[l]),s=mr({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((l,[f,p])=>{let d=e.getRefByZodSchemaName(f);return{...l,[f]:{code:p,isCircular:!!d&&e.isSchemaCircular(d)}}},{});return Ht(e,"models")({zodImport:Ps,modelsImports:s,includeNamespace:e.options.includeNamespaces,namespace:K({type:"models",tag:r,options:e.options}),zodSchemasData:a})}o(MS,"generateModels");function DS({resolver:e,data:t,tag:r=""}){var d;let n=(d=t.get(r))==null?void 0:d.endpoints;if(!n||n.length===0)return;let i=n.filter(Et),s=n.filter(Ts),a={...AS,bindings:[...i.length>0?[_r.query]:[],...s.length>0?[_r.mutation]:[]]},c={...T_,bindings:[...i.length>0?[to.query]:[],...s.length>0?[to.mutation]:[]]},u=[...i,...s].reduce((m,g)=>[...m,...g.parameters],[]),l=mr({resolver:e,tag:r,zodSchemasAsTypes:$e(u.map(m=>m.zodSchema).filter(Oe))}),f=k_({tag:r,endpoints:n,options:e.options});return Ht(e,"queries")({queryImport:a,queryTypesImport:c,modelsImports:l,endpointsImports:f,includeNamespace:e.options.includeNamespaces,namespace:K({type:"queries",tag:r,options:e.options}),endpoints:n,queryEndpoints:i})}o(DS,"generateQueries");function LS(e,t){let r={...zi,...t},{resolver:n,data:i}=Ds(e,r),s=[],a=[],c=["models","endpoints","queries","acl"],u={models:MS,endpoints:CS,queries:DS,acl:NS};i.forEach((f,p)=>{r.excludeTags.find(m=>m.toLowerCase()===p.toLowerCase())||c.forEach(m=>{let g=u[m]({resolver:n,data:i,tag:p});if(g){let y=qf({output:r.output,fileName:Ct({tag:p,type:m,options:r})});s.push({fileName:y,content:g}),m==="acl"&&a.push(p)}})});let l=RS(n,a);if(l){let f=qf({output:r.output,fileName:P_});s.push({fileName:f,content:l})}return s}o(LS,"generateCodeFromOpenAPIDoc");async function G3({input:e,options:t}){let r={...zi,...t},n=await Lf.default.bundle(e);return await S_(n,r)}o(G3,"getGenerateMetadata");async function Z3({input:e,options:t}){let r={...zi,...t},n=await Lf.default.bundle(e);return LS(n,r)}o(Z3,"getGenerateFilesData");0&&(module.exports={getGenerateFilesData,getGenerateMetadata});
77
+ *`))}o(E3,"registerAddAsteriskAfterNewLineHelper");var vr=ut(yr());function wS(e){x3(),w3(e.options),T3(e),A3(),I3(),k3(e),N3()}o(wS,"registerEndpointsHbsHelpers");function x3(){vr.default.registerHelper("endpointName",Wi)}o(x3,"registerEndpointNameHelper");function w3(e){vr.default.registerHelper("importedEndpointName",t=>Kv(t,e))}o(w3,"registerImportedEndpointNameHelper");function A3(){vr.default.registerHelper("endpointPath",Yv)}o(A3,"registerEndpointPathHelper");function I3(){vr.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(I3,"registerEndpointBodyHelper");function T3(e){vr.default.registerHelper("endpointParams",t=>Ip(e,t))}o(T3,"registerEndpointParamsHelper");function k3(e){vr.default.registerHelper("endpointArgs",t=>Ip(e,t).map(r=>r.name).join(", "))}o(k3,"registerEndpointArgsHelper");function N3(){vr.default.registerHelper("endpointParamDescription",e=>{var s,a,c,u,l;let t=[`${e.paramType} parameter`],r=((s=e.parameterObject)==null?void 0:s.description)||((a=e.bodyObject)==null?void 0:a.description);r&&t.push(r);let n,i;if((c=e.parameterObject)!=null&&c.schema&&Ce(e.parameterObject.schema)&&(n=(u=e.parameterObject)==null?void 0:u.schema),(l=e.bodyObject)!=null&&l.content){let p=Object.keys(e.bodyObject.content??{}).find(Ue);p&&(i=e.bodyObject.content[p],i.schema&&Ce(i.schema)&&(n=i.schema))}return n&&["description","minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","example"].filter(p=>n[p]).forEach(p=>{t.push(`${Z(Ev(p))}: \`${n[p]}\``)}),i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(N3,"registerEndpointParamDescriptionHelper");var br=ut(yr());var _r={query:"useQuery",mutation:"useMutation"},AS={bindings:[_r.query,_r.mutation],from:"@tanstack/react-query"};function IS(){R3(),C3(),j3(),q3(),M3(),D3(),L3()}o(IS,"registerPartialsHbsHelpers");function R3(){br.default.registerHelper("genImport",e=>Sr("import")({import:e}))}o(R3,"registerImportHelper");function C3(){br.default.registerHelper("genEndpointParams",e=>Sr("endpoint-params")({endpoint:e}))}o(C3,"registerGenerateEndpointParamsHelper");function j3(){br.default.registerHelper("genEndpointConfig",e=>{let t=Wv(e);return Object.keys(t).length===0?"":Sr("endpoint-config")({endpointConfig:t})})}o(j3,"registerGenerateEndpointConfigHelper");function q3(){br.default.registerHelper("genQueryKeys",e=>e.length===0?"":Sr("query-keys")({endpoints:e}))}o(q3,"registerGenerateQueryKeysHelper");function M3(){br.default.registerHelper("genQuery",e=>{let t,r;return Et(e)?(t="query-use-query",r=_r.query):(t="query-use-mutation",r=_r.mutation),Sr(t)({endpoint:e,queryHook:r})})}o(M3,"registerGenerateQueryHelper");function D3(){br.default.registerHelper("genCaslAbilityType",e=>Sr("casl-ability-type")({endpoint:e,abilityTupleType:st.abilityTuple}))}o(D3,"registerGenerateCaslAbilityTypeHelper");function L3(){br.default.registerHelper("genCaslAbilityFunction",e=>Sr("casl-ability-function")({endpoint:e}))}o(L3,"registerGenerateCaslAbilityFunctionHelper");var go=ut(yr());function TS(){F3(),V3(),B3(),H3()}o(TS,"registerQueryHbsHelpers");function F3(){go.default.registerHelper("queryName",Os)}o(F3,"registerQueryNameHelper");function V3(){go.default.registerHelper("allQueryKeys",gp)}o(V3,"registerQueryKeysHelper");function B3(){go.default.registerHelper("endpointPathQueryKeys",xv)}o(B3,"registerEndpointPathQueryKeysHelper");function H3(){go.default.registerHelper("isQuery",Et)}o(H3,"registerIsQueryHelper");var Mf=ut(yr());function kS(e){U3(e.options),z3(e)}o(kS,"registerZodHbsHelpers");function U3(e){Mf.default.registerHelper("zodInferedType",t=>Yi(t,e))}o(U3,"registerInferedTypeHelper");function z3(e){Mf.default.registerHelper("importedZodSchemaName",t=>Bv(e,t))}o(z3,"registerImportedZodSchemaNameHelper");function Ht(e,t){let r=jf(t);return xS(),kS(e),wS(e),TS(),ES(),IS(),Df.default.compile(r)}o(Ht,"getHbsTemplateDelegate");function Sr(e){let t=jf(`partials/${e}`);return Df.default.compile(t)}o(Sr,"getHbsPartialTemplateDelegate");function NS({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.endpoints.filter(({acl:l})=>l&&l.length>0);if(!n||n.length===0)return;let i={...qp,bindings:[st.abilityTuple,...n.filter(({acl:l})=>l==null?void 0:l[0].conditions).length>0?[st.forcedSubject,st.subject]:[]]},s=n.reduce((l,f)=>{var d,m;let p=(m=(d=f.acl)==null?void 0:d[0].conditionsTypes)==null?void 0:m.reduce((g,y)=>[...g,...y!=null&&y.zodSchemaName?[y.zodSchemaName]:[]],[]);return[...l,...p??[]]},[]),a=mr({resolver:e,tag:r,zodSchemasAsTypes:$e(s)});return Ht(e,"acl")({caslAbilityTupleImport:i,modelsImports:a,includeNamespace:e.options.includeNamespaces,namespace:K({type:"acl",tag:r,options:e.options}),endpoints:n})}o(NS,"generateAcl");function RS(e,t){if(!t||t.length===0)return;let r={...qp,bindings:[st.pureAbility]},n=N_({tags:t,entityName:eo,getAliasEntityName:Ls,options:e.options}),i=t.map(a=>K({type:"acl",tag:a,options:e.options}));return Ht(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:eo,includeNamespace:e.options.includeNamespaces,tags:t,namespaces:i})}o(RS,"generateAppAcl");function CS({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints;if(!n||n.length===0)return;let i=n.map(f=>f.response),s=i.some(f=>!Oe(f)),a=n.reduce((f,p)=>[...f,...p.parameters],[]),c=mr({resolver:e,tag:r,zodSchemas:$e(i.filter(Oe)),zodSchemasAsTypes:$e(a.map(f=>f.zodSchema).filter(Oe))});return Ht(e,"endpoints")({restClientImport:I_,hasZodImport:s,zodImport:Ps,modelsImports:c,includeNamespace:e.options.includeNamespaces,namespace:K({type:"endpoints",tag:r,options:e.options}),restClientName:Fp,endpoints:n})}o(CS,"generateEndpoints");function jS(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(qS(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(jS,"getZodSchemaRefs");function qS(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&qS(n).forEach(s=>r.add(s)),r},new Set)}o(qS,"getSchemaRefs");function MS({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((l,f)=>[...l,...jS(e,f)],[]).filter(l=>!n[l]),s=mr({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((l,[f,p])=>{let d=e.getRefByZodSchemaName(f);return{...l,[f]:{code:p,isCircular:!!d&&e.isSchemaCircular(d)}}},{});return Ht(e,"models")({zodImport:Ps,modelsImports:s,includeNamespace:e.options.includeNamespaces,namespace:K({type:"models",tag:r,options:e.options}),zodSchemasData:a})}o(MS,"generateModels");function DS({resolver:e,data:t,tag:r=""}){var d;let n=(d=t.get(r))==null?void 0:d.endpoints;if(!n||n.length===0)return;let i=n.filter(Et),s=n.filter(Ts),a={...AS,bindings:[...i.length>0?[_r.query]:[],...s.length>0?[_r.mutation]:[]]},c={...T_,bindings:[...i.length>0?[to.query]:[],...s.length>0?[to.mutation]:[]]},u=[...i,...s].reduce((m,g)=>[...m,...g.parameters],[]),l=mr({resolver:e,tag:r,zodSchemasAsTypes:$e(u.map(m=>m.zodSchema).filter(Oe))}),f=k_({tag:r,endpoints:n,options:e.options});return Ht(e,"queries")({queryImport:a,queryTypesImport:c,modelsImports:l,endpointsImports:f,includeNamespace:e.options.includeNamespaces,namespace:K({type:"queries",tag:r,options:e.options}),endpoints:n,queryEndpoints:i})}o(DS,"generateQueries");function LS(e,t){let r={...zi,...t},{resolver:n,data:i}=Ds(e,r),s=[],a=[],c=["models","endpoints","queries","acl"],u={models:MS,endpoints:CS,queries:DS,acl:NS};i.forEach((f,p)=>{r.excludeTags.find(m=>m.toLowerCase()===p.toLowerCase())||c.forEach(m=>{let g=u[m]({resolver:n,data:i,tag:p});if(g){let y=qf({output:r.output,fileName:Ct({tag:p,type:m,options:r})});s.push({fileName:y,content:g}),m==="acl"&&a.push(p)}})});let l=RS(n,a);if(l){let f=qf({output:r.output,fileName:P_});s.push({fileName:f,content:l})}return s}o(LS,"generateCodeFromOpenAPIDoc");async function G3({input:e,options:t}){let r={...zi,...t},n=await Lf.default.bundle(e);return await S_(n,r)}o(G3,"getGenerateMetadata");async function Z3({input:e,options:t}){let r={...zi,...t},n=await Lf.default.bundle(e);return LS(n,r)}o(Z3,"getGenerateFilesData");0&&(module.exports={getGenerateFilesData,getGenerateMetadata});
package/dist/sh.js CHANGED
@@ -137,7 +137,7 @@ ${y.join(`
137
137
  `:`
138
138
  `)+r,i=n+1,n=e.indexOf(`
139
139
  `,i)}while(n!==-1);return s+=e.slice(i),s}o(wy,"stringEncaseCRLFWithFirstIndex");var{stdout:xy,stderr:Ay}=Ey,Hl=Symbol("GENERATOR"),ro=Symbol("STYLER"),us=Symbol("IS_EMPTY"),Iy=["ansi","ansi","ansi256","ansi16m"],no=Object.create(null),q$=o((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=xy?xy.level:0;e.level=t.level===void 0?r:t.level},"applyOptions"),Gl=class Gl{constructor(t){return Cy(t)}};o(Gl,"Chalk");var Ja=Gl,Cy=o(e=>{let t=o((...r)=>r.join(" "),"chalk");return q$(t,e),Object.setPrototypeOf(t,ls.prototype),t},"chalkFactory");function ls(e){return Cy(e)}o(ls,"createChalk");Object.setPrototypeOf(ls.prototype,Function.prototype);for(let[e,t]of Object.entries(gr))no[e]={get(){let r=Xa(this,zl(t.open,t.close,this[ro]),this[us]);return Object.defineProperty(this,e,{value:r}),r}};no.visible={get(){let e=Xa(this,this[ro],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Ul=o((e,t,r,...n)=>e==="rgb"?t==="ansi16m"?gr[r].ansi16m(...n):t==="ansi256"?gr[r].ansi256(gr.rgbToAnsi256(...n)):gr[r].ansi(gr.rgbToAnsi(...n)):e==="hex"?Ul("rgb",t,r,...gr.hexToRgb(...n)):gr[r][e](...n),"getModelAnsi"),D$=["rgb","hex","ansi256"];for(let e of D$){no[e]={get(){let{level:r}=this;return function(...n){let i=zl(Ul(e,Iy[r],"color",...n),gr.color.close,this[ro]);return Xa(this,i,this[us])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);no[t]={get(){let{level:r}=this;return function(...n){let i=zl(Ul(e,Iy[r],"bgColor",...n),gr.bgColor.close,this[ro]);return Xa(this,i,this[us])}}}}var L$=Object.defineProperties(()=>{},{...no,level:{enumerable:!0,get(){return this[Hl].level},set(e){this[Hl].level=e}}}),zl=o((e,t,r)=>{let n,i;return r===void 0?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},"createStyler"),Xa=o((e,t,r)=>{let n=o((...i)=>F$(n,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(n,L$),n[Hl]=e,n[ro]=t,n[us]=r,n},"createBuilder"),F$=o((e,t)=>{if(e.level<=0||!t)return e[us]?"":t;let r=e[ro];if(r===void 0)return t;let{openAll:n,closeAll:i}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=$y(t,r.close,r.open),r=r.parent;let s=t.indexOf(`
140
- `);return s!==-1&&(t=wy(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(ls.prototype,no);var gF=ls(),yF=ls({level:Ay?Ay.level:0});var Nr=new Ja;function fs(e,t,r){console.log(r!==void 0&&r!==t?`${Nr.yellow(`${e}:`.padEnd(20))}${Nr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(fs,"logVariable");function rr(e){console.log(`[INFO] ${e}`)}o(rr,"logInfo");function vn(e){console.log(Nr.green(`[SUCCESS] ${e}`))}o(vn,"logSuccess");function ps(e,t){e instanceof Error?(console.log(Nr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Nr.red(`[ERROR] ${e}`))}o(ps,"logError");function ec(e){console.log(Nr.bgYellow(`==== ${e} ====`))}o(ec,"logBanner");var Ty=gt(require("fs"));function io(){return"0.4.9"}o(io,"getVersion");var CF=gt(Ry());var Zl=Symbol("options_key");function ut(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(Zl,t)||{},[r]:{...e,describe:e.envAlias?`${e.describe||""} [${e.envAlias}]`:e.describe,type:e.type||((i=(n=Reflect.getMetadata("design:type",t,r))==null?void 0:n.name)==null?void 0:i.toLowerCase())}};Reflect.defineMetadata(Zl,s,t)}}}o(ut,"YargOption");function Ny(e){let t=Reflect.getMetadata(Zl,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Ny,"getYargsOption");function tc(e){return async t=>t.options(B$(e)).middleware(async r=>await V$(e,r),!0)}o(tc,"getBuilder");function B$(e){return Object.entries(Ny(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(B$,"getYargsOptions");async function V$(e,t){let r=new e;for(let[n,i]of Object.entries(Ny(e)))r[n]=t[n]??i.default;return r}o(V$,"loadYargsConfig");var y1=gt(Dh());var uP="Schema",lP="Enum",fP="Body",pP="Param",dP="Response",hP="ErrorResponse",Lh="z.void()",au={bindings:["z"],from:"zod"};var cu={input:"input.yaml",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],includeNamespaces:!0,importPath:"ts",extractEnums:!0,configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},schemaSuffix:uP,enumSuffix:lP,additionalPropertiesDefaultValue:!1,removeOperationPrefixEndingWith:"Controller_"};var mP={"invalid-schema":"Invalid Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing Status Codes"};var Fh={"Content-Type":"application/json",Accept:"application/json"},gP="data";var yP=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Mn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");var on=Symbol.for("@ts-pattern/matcher"),q3=Symbol.for("@ts-pattern/isVariadic"),lu="@ts-pattern/anonymous-select-key",Bh=o(e=>!!(e&&typeof e=="object"),"r"),uu=o(e=>e&&!!e[on],"i"),Zr=o((e,t,r)=>{if(uu(e)){let n=e[on](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(Bh(e)){if(!Bh(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];uu(c)&&c[q3]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,p)=>Zr(l,a[p],r))&&i.every((l,p)=>Zr(l,c[p],r))&&(s.length===0||Zr(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Zr(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||uu(s=i)&&s[on]().matcherType==="optional")&&Zr(i,t[n],r);var s})}return Object.is(t,e)},"s"),Bn=o(e=>{var t,r,n;return Bh(e)?uu(e)?(t=(r=(n=e[on]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?ia(e,Bn):ia(Object.values(e),Bn):[]},"o"),ia=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function ur(e){return Object.assign(e,{optional:o(()=>D3(e),"optional"),and:o(t=>Fe(e,t),"and"),or:o(t=>L3(e,t),"or"),select:o(t=>t===void 0?bP(e):bP(t,e),"select")})}o(ur,"u");function D3(e){return ur({[on]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(Bn(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Zr(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>Bn(e),"getSelectionKeys"),matcherType:"optional"})})}o(D3,"h");function Fe(...e){return ur({[on]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Zr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ia(e,Bn),"getSelectionKeys"),matcherType:"and"})})}o(Fe,"m");function L3(...e){return ur({[on]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return ia(e,Bn).forEach(i=>n(i,void 0)),{matched:e.some(i=>Zr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ia(e,Bn),"getSelectionKeys"),matcherType:"or"})})}o(L3,"d");function Pe(e){return{[on]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(Pe,"p");function bP(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return ur({[on]:()=>({match:o(n=>{let i={[t??lu]:n};return{matched:r===void 0||Zr(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??lu].concat(r===void 0?[]:Bn(r)),"getSelectionKeys")})})}o(bP,"y");function zr(e){return typeof e=="number"}o(zr,"v");function qn(e){return typeof e=="string"}o(qn,"b");function Dn(e){return typeof e=="bigint"}o(Dn,"w");var Y9=ur(Pe(function(e){return!0}));var Ln=o(e=>Object.assign(ur(e),{startsWith:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>Ln(Fe(e,(r=>Pe(n=>qn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>Ln(Fe(e,(r=>Pe(n=>qn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>Ln(Fe(e,(r=>Pe(n=>qn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&!!n.match(r)))));var r},"regex")}),"j"),Q9=Ln(Pe(qn)),Gr=o(e=>Object.assign(ur(e),{between:o((t,r)=>Gr(Fe(e,((n,i)=>Pe(s=>zr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n<r))(t))),"lt"),gt:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n>r))(t))),"gt"),lte:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n<=r))(t))),"lte"),gte:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n>=r))(t))),"gte"),int:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&Number.isInteger(t)))),"int"),finite:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&t>0))),"positive"),negative:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&t<0))),"negative")}),"x"),J9=Gr(Pe(zr)),Fn=o(e=>Object.assign(ur(e),{between:o((t,r)=>Fn(Fe(e,((n,i)=>Pe(s=>Dn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n<r))(t))),"lt"),gt:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n>r))(t))),"gt"),lte:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n<=r))(t))),"lte"),gte:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n>=r))(t))),"gte"),positive:o(()=>Fn(Fe(e,Pe(t=>Dn(t)&&t>0))),"positive"),negative:o(()=>Fn(Fe(e,Pe(t=>Dn(t)&&t<0))),"negative")}),"A"),X9=Fn(Pe(Dn)),eH=ur(Pe(function(e){return typeof e=="boolean"})),tH=ur(Pe(function(e){return typeof e=="symbol"})),rH=ur(Pe(function(e){return e==null})),nH=ur(Pe(function(e){return e!=null}));var zh=class zh extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(zh,"W");var Vh=zh,Hh={matched:!1,value:void 0};function Ot(e){return new Uh(e,Hh)}o(Ot,"z");var na=class na{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,p)=>{s=!0,a[l]=p},"a"),u=!n.some(l=>Zr(l,this.input,c))||i&&!i(this.input)?Hh:{matched:!0,value:r(s?lu in a?a[lu]:a:this.input,this.input)};return new na(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new na(this.input,n?{matched:!0,value:r(this.input,this.input)}:Hh)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Vh(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(na,"I");var Uh=na;var vP=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];var Gh=2,_P=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],SP=["query","header","path"],Vn=["get","put","post","delete","options","head","patch","trace"],OP=["string","number","integer","boolean"],Zh=["allOf","anyOf","oneOf"];function Hn(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(Hn,"pick");var Ve=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Mi=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),fu=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ht=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),PP=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Wh=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),EP=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),F3=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),Kh=o(e=>{let t=e.map(Ve).map($P).map(r=>B3(r)).flat();return F3(t)},"getMostCommonAdjacentCombinationSplit"),$P=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),wP=o(e=>$P(e).join(" "),"camelToSpaceSeparated"),B3=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations");function Un(e){return PP(e)}o(Un,"formatTag");function qi(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Un(r??t.defaultTag)}o(qi,"getOperationTag");function xP(e,t){let r={};for(let n in e.paths){let i=e.paths[n],s=Hn(i,Vn);for(let a in s){let c=s[a];if(!c||c.deprecated&&!(t!=null&&t.withDeprecatedEndpoints))continue;let u=t.splitByTags?qi(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(xP,"getOperationsByTag");var IP=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Di=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),Uo=o(e=>Di(e).split("/").at(-1),"getSchemaNameByRef");function Ie(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(Ie,"isReferenceObject");function Jh(e){let t=V3(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ht(t)}o(Jh,"normalizeString");function CP(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(CP,"wrapWithQuotesIfNeeded");function TP(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(TP,"unwrapQuotesIfNeeded");function V3(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(V3,"prefixStringStartingWithNumberIfNeeded");function Xh(e){let t=e.replaceAll("_","#");return ht(t.replaceAll("-","_")).replaceAll("#","_")}o(Xh,"pathParamToVariableName");var Li=o(e=>OP.includes(e),"isPrimitiveType");function jP(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o(jP,"escapeControlCharacters");function Wr(e){return e.includes("application/")&&e.includes("json")||_P.includes(e)||e.includes("text/")}o(Wr,"isParamMediaTypeAllowed");function pu(e){return e>=200&&e<300}o(pu,"isMainResponseStatus");function du(e){return!(e>=200&&e<300)}o(du,"isErrorStatus");function hu(e){return e==="application/json"}o(hu,"isMediaTypeAllowed");function Yh({path:e,method:t,operation:r,options:n,keepOperationPrefixWithoutEnding:i}){let s=`${t}${U3(e)}`,a=r.operationId?Mn(r.operationId):s;if(n.removeOperationPrefixEndingWith&&i)return a.split(n.removeOperationPrefixEndingWith).map((u,l)=>l===0?u:Ve(u)).join("");if(n.removeOperationPrefixEndingWith&&!i){let c=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);a=a.replace(c,"")}return vP.includes(a)?s:a}o(Yh,"getOperationName");function oa({path:e,method:t,operation:r,operationsByTag:n,options:i}){let s=i.splitByTags?qi(r,i):i.defaultTag,a=Yh({path:e,method:t,operation:r,options:i});return n[s].filter(u=>Yh({path:e,method:t,operation:u,options:i})===a).length===1?a:Yh({path:e,method:t,operation:r,options:i,keepOperationPrefixWithoutEnding:!0})}o(oa,"getUniqueOperationName");function RP(e,t,r){let n=[];for(let i in e.paths){let s=e.paths[i],a=Hn(s,Vn);for(let c in a){let u=a[c];if(!u||u.deprecated&&!(r!=null&&r.withDeprecatedEndpoints))continue;let l=oa({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(RP,"getUniqueOperationNamesWithoutSplitByTags");var AP=/({\w+})/g,H3=/[^\w\-]+/g;function U3(e){e=Ve(fu(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(AP)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(AP,"")}By${Ve(r.slice(1,-1))}`}return e.replace(H3,"_")}o(U3,"pathToVariableName");var Qh=/{(\b\w+(?:-\w+)*\b)}/g;function NP(e){let t=e.match(Qh);return t===null?e.replaceAll(Qh,":$1"):(t.forEach(r=>{let n=Xh(r.replaceAll(Qh,":$1"));e=e.replaceAll(r,n)}),e)}o(NP,"replaceHyphenatedPath");function Gt(e){return!Ie(e)}o(Gt,"isSchemaObject");function kP(e){return e.type==="array"}o(kP,"isArraySchemaObject");function MP(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(z3(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(Ie(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(MP,"inferRequiredSchema");var z3=o(e=>!Ie(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");function zn({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Mi(t)}/`:""}${Mi(t)}.${i}`:i}o(zn,"getTagFileName");var Je=o(({type:e,tag:t,options:r})=>`${Ve(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");var sn=o((e,t)=>Wh(Ve(Jh(e)),t),"getZodSchemaName"),em=o((e,t,r)=>Wh(Ve(Jh(e)),`${t}${r}`),"getEnumZodSchemaName"),Dt=o(e=>!e.startsWith("z."),"isNamedZodSchema"),Fi=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),mu=o(e=>ht(`${e}_${fP}`),"getBodyZodSchemaName"),qP=o((e,t)=>ht(`${e}_${t}${pP}`),"getParamZodSchemaName"),G3=o(e=>ht(`${e}${dP}`),"getMainResponseZodSchemaName"),Z3=o((e,t)=>ht(`${e}_${t}_${hP}`),"getErrorResponseZodSchemaName");function gu({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Fi(t,r,n);return!pu(i)&&e!=="default"&&du(i)?Z3(s,e):G3(s)}o(gu,"getResponseZodSchemaName");var sa=o((e,t)=>EP(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),DP=o((e,t)=>Dt(t)?`${e.options.includeNamespaces?`${Je({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),tm=o((e,t)=>Dt(t)?`${e.options.includeNamespaces?`${Je({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${sa(t,e.options)}`:t,"getImportedZodSchemaInferedTypeName");function LP(e){return Ot(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(LP,"primitiveTypeToTsType");var aa=o(e=>Mi(ht(e.operationName)),"getEndpointName");function FP(e,t){return`${t.includeNamespaces?`${Je({type:"endpoints",tag:ca(e,t),options:t})}.`:""}${aa(e)}`}o(FP,"getImportedEndpointName");var BP=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ca(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Un(r??t.defaultTag)}o(ca,"getEndpointTag");function rm(e,t){return t.parameters.map(r=>{var i,s,a,c;let n="string";if(Dt(r.zodSchema))n=tm(e,r.zodSchema);else if((i=r.parameterObject)!=null&&i.schema&&Gt(r.parameterObject.schema)){let u=(a=(s=r.parameterObject)==null?void 0:s.schema)==null?void 0:a.type;u&&Li(u)&&(n=LP(u))}return{name:Mn(r.name),type:n,paramType:r.type,required:((c=r.parameterObject)==null?void 0:c.required)??!0,parameterObject:r.parameterObject,bodyObject:r.bodyObject}}).sort((r,n)=>{if(r.required===n.required){let i=["Path","Body","Query","Header"];return i.indexOf(r.paramType)-i.indexOf(n.paramType)}return r.required?-1:1})}o(rm,"mapEndpointParamsToFunctionParams");function VP(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=yP(i.name)?i.name:`"${i.name}"`,a=Mn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Fh["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Fh.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Mn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(VP,"getEndpointConfig");function yu(e){return{type:"invalid-schema",message:e}}o(yu,"getInvalidSchemaError");function HP(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(HP,"getInvalidOperationIdError");function UP(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(UP,"getMissingPathParameterError");function zP(e){return{type:"not-allowed-inline-enum",message:e}}o(zP,"getNotAllowedInlineEnumError");function GP(e){return{type:"not-allowed-circular-schema",message:e}}o(GP,"getNotAllowedCircularSchemaError");function ZP(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${WP(t,r)}`}}o(ZP,"getMissingAclConditionPropertyError");function nm(e,t,r){return{type:"missing-status-code",message:`Missing status code ${e} in operation ${WP(t,r)}`}}o(nm,"getMissingStatusCodeError");function WP(e,t){return e.operationId??`${t.method} ${t.path}`}o(WP,"getOperationDescriptor");function KP(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(KP,"groupByType");function Kr({schema:e,meta:t,options:r}){let n=[];Ot(e.type).with("string",()=>n.push(Y3(e))).with("number","integer",()=>n.push(J3(e))).with("array",()=>n.push(X3(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&(r!=null&&r.withDescription)&&([`
140
+ `);return s!==-1&&(t=wy(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(ls.prototype,no);var gF=ls(),yF=ls({level:Ay?Ay.level:0});var Nr=new Ja;function fs(e,t,r){console.log(r!==void 0&&r!==t?`${Nr.yellow(`${e}:`.padEnd(20))}${Nr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(fs,"logVariable");function rr(e){console.log(`[INFO] ${e}`)}o(rr,"logInfo");function vn(e){console.log(Nr.green(`[SUCCESS] ${e}`))}o(vn,"logSuccess");function ps(e,t){e instanceof Error?(console.log(Nr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Nr.red(`[ERROR] ${e}`))}o(ps,"logError");function ec(e){console.log(Nr.bgYellow(`==== ${e} ====`))}o(ec,"logBanner");var Ty=gt(require("fs"));function io(){return"0.4.10"}o(io,"getVersion");var CF=gt(Ry());var Zl=Symbol("options_key");function ut(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(Zl,t)||{},[r]:{...e,describe:e.envAlias?`${e.describe||""} [${e.envAlias}]`:e.describe,type:e.type||((i=(n=Reflect.getMetadata("design:type",t,r))==null?void 0:n.name)==null?void 0:i.toLowerCase())}};Reflect.defineMetadata(Zl,s,t)}}}o(ut,"YargOption");function Ny(e){let t=Reflect.getMetadata(Zl,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Ny,"getYargsOption");function tc(e){return async t=>t.options(B$(e)).middleware(async r=>await V$(e,r),!0)}o(tc,"getBuilder");function B$(e){return Object.entries(Ny(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(B$,"getYargsOptions");async function V$(e,t){let r=new e;for(let[n,i]of Object.entries(Ny(e)))r[n]=t[n]??i.default;return r}o(V$,"loadYargsConfig");var y1=gt(Dh());var uP="Schema",lP="Enum",fP="Body",pP="Param",dP="Response",hP="ErrorResponse",Lh="z.void()",au={bindings:["z"],from:"zod"};var cu={input:"input.yaml",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],includeNamespaces:!0,importPath:"ts",extractEnums:!0,configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},schemaSuffix:uP,enumSuffix:lP,additionalPropertiesDefaultValue:!1,removeOperationPrefixEndingWith:"Controller_"};var mP={"invalid-schema":"Invalid Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing Status Codes"};var Fh={"Content-Type":"application/json",Accept:"application/json"},gP="data";var yP=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Mn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");var on=Symbol.for("@ts-pattern/matcher"),q3=Symbol.for("@ts-pattern/isVariadic"),lu="@ts-pattern/anonymous-select-key",Bh=o(e=>!!(e&&typeof e=="object"),"r"),uu=o(e=>e&&!!e[on],"i"),Zr=o((e,t,r)=>{if(uu(e)){let n=e[on](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(Bh(e)){if(!Bh(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];uu(c)&&c[q3]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,p)=>Zr(l,a[p],r))&&i.every((l,p)=>Zr(l,c[p],r))&&(s.length===0||Zr(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Zr(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||uu(s=i)&&s[on]().matcherType==="optional")&&Zr(i,t[n],r);var s})}return Object.is(t,e)},"s"),Bn=o(e=>{var t,r,n;return Bh(e)?uu(e)?(t=(r=(n=e[on]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?ia(e,Bn):ia(Object.values(e),Bn):[]},"o"),ia=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function ur(e){return Object.assign(e,{optional:o(()=>D3(e),"optional"),and:o(t=>Fe(e,t),"and"),or:o(t=>L3(e,t),"or"),select:o(t=>t===void 0?bP(e):bP(t,e),"select")})}o(ur,"u");function D3(e){return ur({[on]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(Bn(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Zr(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>Bn(e),"getSelectionKeys"),matcherType:"optional"})})}o(D3,"h");function Fe(...e){return ur({[on]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Zr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ia(e,Bn),"getSelectionKeys"),matcherType:"and"})})}o(Fe,"m");function L3(...e){return ur({[on]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return ia(e,Bn).forEach(i=>n(i,void 0)),{matched:e.some(i=>Zr(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>ia(e,Bn),"getSelectionKeys"),matcherType:"or"})})}o(L3,"d");function Pe(e){return{[on]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(Pe,"p");function bP(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return ur({[on]:()=>({match:o(n=>{let i={[t??lu]:n};return{matched:r===void 0||Zr(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??lu].concat(r===void 0?[]:Bn(r)),"getSelectionKeys")})})}o(bP,"y");function zr(e){return typeof e=="number"}o(zr,"v");function qn(e){return typeof e=="string"}o(qn,"b");function Dn(e){return typeof e=="bigint"}o(Dn,"w");var Y9=ur(Pe(function(e){return!0}));var Ln=o(e=>Object.assign(ur(e),{startsWith:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>Ln(Fe(e,(r=>Pe(n=>qn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>Ln(Fe(e,(r=>Pe(n=>qn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>Ln(Fe(e,(r=>Pe(n=>qn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return Ln(Fe(e,(r=t,Pe(n=>qn(n)&&!!n.match(r)))));var r},"regex")}),"j"),Q9=Ln(Pe(qn)),Gr=o(e=>Object.assign(ur(e),{between:o((t,r)=>Gr(Fe(e,((n,i)=>Pe(s=>zr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n<r))(t))),"lt"),gt:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n>r))(t))),"gt"),lte:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n<=r))(t))),"lte"),gte:o(t=>Gr(Fe(e,(r=>Pe(n=>zr(n)&&n>=r))(t))),"gte"),int:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&Number.isInteger(t)))),"int"),finite:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&t>0))),"positive"),negative:o(()=>Gr(Fe(e,Pe(t=>zr(t)&&t<0))),"negative")}),"x"),J9=Gr(Pe(zr)),Fn=o(e=>Object.assign(ur(e),{between:o((t,r)=>Fn(Fe(e,((n,i)=>Pe(s=>Dn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n<r))(t))),"lt"),gt:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n>r))(t))),"gt"),lte:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n<=r))(t))),"lte"),gte:o(t=>Fn(Fe(e,(r=>Pe(n=>Dn(n)&&n>=r))(t))),"gte"),positive:o(()=>Fn(Fe(e,Pe(t=>Dn(t)&&t>0))),"positive"),negative:o(()=>Fn(Fe(e,Pe(t=>Dn(t)&&t<0))),"negative")}),"A"),X9=Fn(Pe(Dn)),eH=ur(Pe(function(e){return typeof e=="boolean"})),tH=ur(Pe(function(e){return typeof e=="symbol"})),rH=ur(Pe(function(e){return e==null})),nH=ur(Pe(function(e){return e!=null}));var zh=class zh extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(zh,"W");var Vh=zh,Hh={matched:!1,value:void 0};function Ot(e){return new Uh(e,Hh)}o(Ot,"z");var na=class na{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,p)=>{s=!0,a[l]=p},"a"),u=!n.some(l=>Zr(l,this.input,c))||i&&!i(this.input)?Hh:{matched:!0,value:r(s?lu in a?a[lu]:a:this.input,this.input)};return new na(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new na(this.input,n?{matched:!0,value:r(this.input,this.input)}:Hh)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Vh(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(na,"I");var Uh=na;var vP=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];var Gh=2,_P=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],SP=["query","header","path"],Vn=["get","put","post","delete","options","head","patch","trace"],OP=["string","number","integer","boolean"],Zh=["allOf","anyOf","oneOf"];function Hn(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(Hn,"pick");var Ve=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Mi=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),fu=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ht=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),PP=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Wh=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),EP=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),F3=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),Kh=o(e=>{let t=e.map(Ve).map($P).map(r=>B3(r)).flat();return F3(t)},"getMostCommonAdjacentCombinationSplit"),$P=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),wP=o(e=>$P(e).join(" "),"camelToSpaceSeparated"),B3=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations");function Un(e){return PP(e)}o(Un,"formatTag");function qi(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Un(r??t.defaultTag)}o(qi,"getOperationTag");function xP(e,t){let r={};for(let n in e.paths){let i=e.paths[n],s=Hn(i,Vn);for(let a in s){let c=s[a];if(!c||c.deprecated&&!(t!=null&&t.withDeprecatedEndpoints))continue;let u=t.splitByTags?qi(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(xP,"getOperationsByTag");var IP=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Di=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),Uo=o(e=>Di(e).split("/").at(-1),"getSchemaNameByRef");function Ie(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(Ie,"isReferenceObject");function Jh(e){let t=V3(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ht(t)}o(Jh,"normalizeString");function CP(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(CP,"wrapWithQuotesIfNeeded");function TP(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(TP,"unwrapQuotesIfNeeded");function V3(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(V3,"prefixStringStartingWithNumberIfNeeded");function Xh(e){let t=e.replaceAll("_","#");return ht(t.replaceAll("-","_")).replaceAll("#","_")}o(Xh,"pathParamToVariableName");var Li=o(e=>OP.includes(e),"isPrimitiveType");function jP(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o(jP,"escapeControlCharacters");function Wr(e){return e.includes("application/")&&e.includes("json")||_P.includes(e)||e.includes("text/")}o(Wr,"isParamMediaTypeAllowed");function pu(e){return e>=200&&e<300}o(pu,"isMainResponseStatus");function du(e){return!(e>=200&&e<300)}o(du,"isErrorStatus");function hu(e){return e==="application/json"}o(hu,"isMediaTypeAllowed");function Yh({path:e,method:t,operation:r,options:n,keepOperationPrefixWithoutEnding:i}){let s=`${t}${U3(e)}`,a=r.operationId?Mn(r.operationId):s;if(n.removeOperationPrefixEndingWith&&i)return a.split(n.removeOperationPrefixEndingWith).map((u,l)=>l===0?u:Ve(u)).join("");if(n.removeOperationPrefixEndingWith&&!i){let c=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);a=a.replace(c,"")}return vP.includes(a)?s:a}o(Yh,"getOperationName");function oa({path:e,method:t,operation:r,operationsByTag:n,options:i}){let s=i.splitByTags?qi(r,i):i.defaultTag,a=Yh({path:e,method:t,operation:r,options:i});return n[s].filter(u=>Yh({path:e,method:t,operation:u,options:i})===a).length===1?a:Yh({path:e,method:t,operation:r,options:i,keepOperationPrefixWithoutEnding:!0})}o(oa,"getUniqueOperationName");function RP(e,t,r){let n=[];for(let i in e.paths){let s=e.paths[i],a=Hn(s,Vn);for(let c in a){let u=a[c];if(!u||u.deprecated&&!(r!=null&&r.withDeprecatedEndpoints))continue;let l=oa({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(RP,"getUniqueOperationNamesWithoutSplitByTags");var AP=/({\w+})/g,H3=/[^\w\-]+/g;function U3(e){e=Ve(fu(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(AP)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(AP,"")}By${Ve(r.slice(1,-1))}`}return e.replace(H3,"_")}o(U3,"pathToVariableName");var Qh=/{(\b\w+(?:-\w+)*\b)}/g;function NP(e){let t=e.match(Qh);return t===null?e.replaceAll(Qh,":$1"):(t.forEach(r=>{let n=Xh(r.replaceAll(Qh,":$1"));e=e.replaceAll(r,n)}),e)}o(NP,"replaceHyphenatedPath");function Gt(e){return!Ie(e)}o(Gt,"isSchemaObject");function kP(e){return e.type==="array"}o(kP,"isArraySchemaObject");function MP(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(z3(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(Ie(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(MP,"inferRequiredSchema");var z3=o(e=>!Ie(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");function zn({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Mi(t)}/`:""}${Mi(t)}.${i}`:i}o(zn,"getTagFileName");var Je=o(({type:e,tag:t,options:r})=>`${Ve(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");var sn=o((e,t)=>Wh(Ve(Jh(e)),t),"getZodSchemaName"),em=o((e,t,r)=>Wh(Ve(Jh(e)),`${t}${r}`),"getEnumZodSchemaName"),Dt=o(e=>!e.startsWith("z."),"isNamedZodSchema"),Fi=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),mu=o(e=>ht(`${e}_${fP}`),"getBodyZodSchemaName"),qP=o((e,t)=>ht(`${e}_${t}${pP}`),"getParamZodSchemaName"),G3=o(e=>ht(`${e}${dP}`),"getMainResponseZodSchemaName"),Z3=o((e,t)=>ht(`${e}_${t}_${hP}`),"getErrorResponseZodSchemaName");function gu({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Fi(t,r,n);return!pu(i)&&e!=="default"&&du(i)?Z3(s,e):G3(s)}o(gu,"getResponseZodSchemaName");var sa=o((e,t)=>EP(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),DP=o((e,t)=>Dt(t)?`${e.options.includeNamespaces?`${Je({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),tm=o((e,t)=>Dt(t)?`${e.options.includeNamespaces?`${Je({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${sa(t,e.options)}`:t,"getImportedZodSchemaInferedTypeName");function LP(e){return Ot(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(LP,"primitiveTypeToTsType");var aa=o(e=>Mi(ht(e.operationName)),"getEndpointName");function FP(e,t){return`${t.includeNamespaces?`${Je({type:"endpoints",tag:ca(e,t),options:t})}.`:""}${aa(e)}`}o(FP,"getImportedEndpointName");var BP=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ca(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Un(r??t.defaultTag)}o(ca,"getEndpointTag");function rm(e,t){return t.parameters.map(r=>{var i,s,a,c;let n="string";if(Dt(r.zodSchema))n=tm(e,r.zodSchema);else if((i=r.parameterObject)!=null&&i.schema&&Gt(r.parameterObject.schema)){let u=(a=(s=r.parameterObject)==null?void 0:s.schema)==null?void 0:a.type;u&&Li(u)&&(n=LP(u))}return{name:Mn(r.name),type:n,paramType:r.type,required:((c=r.parameterObject)==null?void 0:c.required)??!0,parameterObject:r.parameterObject,bodyObject:r.bodyObject}}).sort((r,n)=>{if(r.required===n.required){let i=["Path","Body","Query","Header"];return i.indexOf(r.paramType)-i.indexOf(n.paramType)}return r.required?-1:1})}o(rm,"mapEndpointParamsToFunctionParams");function VP(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=yP(i.name)?i.name:`"${i.name}"`,a=Mn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Fh["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Fh.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Mn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(VP,"getEndpointConfig");function yu(e){return{type:"invalid-schema",message:e}}o(yu,"getInvalidSchemaError");function HP(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(HP,"getInvalidOperationIdError");function UP(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(UP,"getMissingPathParameterError");function zP(e){return{type:"not-allowed-inline-enum",message:e}}o(zP,"getNotAllowedInlineEnumError");function GP(e){return{type:"not-allowed-circular-schema",message:e}}o(GP,"getNotAllowedCircularSchemaError");function ZP(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${WP(t,r)}`}}o(ZP,"getMissingAclConditionPropertyError");function nm(e,t,r){return{type:"missing-status-code",message:`Missing status code ${e} in operation ${WP(t,r)}`}}o(nm,"getMissingStatusCodeError");function WP(e,t){return e.operationId??`${t.method} ${t.path}`}o(WP,"getOperationDescriptor");function KP(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(KP,"groupByType");function Kr({schema:e,meta:t,options:r}){let n=[];Ot(e.type).with("string",()=>n.push(Y3(e))).with("number","integer",()=>n.push(J3(e))).with("array",()=>n.push(X3(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&(r!=null&&r.withDescription)&&([`
141
141
  `,"\r",`\r
142
142
  `].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(W3(e,t),(r==null?void 0:r.withDefaultValues)!==!1?K3(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(Kr,"getZodChain");function W3(e,t){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable?"nullable()":t!=null&&t.isRequired?"":"optional()"}o(W3,"getZodChainablePresence");function K3(e){return e.default!==void 0?`default(${Ot(e.type).with("number","integer",()=>TP(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(K3,"getZodChainableDefault");function Y3(e){let t=[];if(e.enum||(e.minLength!==void 0&&t.push(`min(${e.minLength})`),e.maxLength!==void 0&&t.push(`max(${e.maxLength})`)),e.pattern&&t.push(`regex(${Q3(e.pattern)})`),e.format){let r=Ot(e.format).with("email",()=>"email()").with("hostname","uri",()=>"url()").with("uuid",()=>"uuid()").with("date-time",()=>"datetime({ offset: true })").otherwise(()=>"");r&&t.push(r)}return t.join(".")}o(Y3,"getZodChainableStringValidations");function Q3(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=jP(e),`/${e}/`}o(Q3,"formatPatternIfNeeded");function J3(e){let t=[];return e.enum?"":(e.type==="integer"&&t.push("int()"),e.minimum!==void 0?e.exclusiveMinimum===!0?t.push(`gt(${e.minimum})`):t.push(`gte(${e.minimum})`):typeof e.exclusiveMinimum=="number"&&t.push(`gt(${e.exclusiveMinimum})`),e.maximum!==void 0?e.exclusiveMaximum===!0?t.push(`lt(${e.maximum})`):t.push(`lte(${e.maximum})`):typeof e.exclusiveMaximum=="number"&&t.push(`lt(${e.exclusiveMaximum})`),e.multipleOf&&t.push(`multipleOf(${e.multipleOf})`),t.join("."))}o(J3,"getZodChainableNumberValidations");function X3(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(X3,"getZodChainableArrayValidations");var Bi=o(e=>e.reduce((t,r)=>t+r,0),"sum");function ot(e,t){if(!t)return e;if(Ie(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?At("oneOf")+ot(e,{...t,type:t.type[0]}):e+At("oneOf")+Bi(t.type.map(r=>ot(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?At("oneOf")+ot(e,t.oneOf[0]):e+At("oneOf")+Bi(t.oneOf.map(r=>ot(0,r)));if(t.anyOf)return t.anyOf.length===1?At("anyOf")+ot(e,t.anyOf[0]):e+At("anyOf")+Bi(t.anyOf.map(r=>ot(0,r)));if(t.allOf)return t.allOf.length===1?At("allOf")+ot(e,t.allOf[0]):e+At("allOf")+Bi(t.allOf.map(r=>ot(0,r)));if(!t.type)return e;if(Li(t.type))return t.enum?e+YP(t)+At("enum")+Bi(t.enum.map(r=>ot(0,r))):e+YP(t);if(t.type==="array")return t.items?At("array")+ot(e,t.items):At("array")+ot(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.additionalProperties)return t.additionalProperties===!0?At("record")+ot(e):At("record")+ot(e,t.additionalProperties);if(t.properties){let r=Object.values(t.properties);return e+At("object")+Bi(r.map(n=>ot(0,n)))}return At("empty-object")+ot(e)}return e}o(ot,"getOpenAPISchemaComplexity");function YP(e){return Ot(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(YP,"complexityByType");function At(e){return Ot(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","record","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(At,"complexityByComposite");var im=class im{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;Ie(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.includeNamespaces&&i&&i!==t?`${Je({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return ot(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(im,"ZodSchema");var ua=im;function Ge({schema:e,resolver:t,meta:r,tag:n}){var y;let i=new ua(e,t,r),s={parent:i.inherit(r==null?void 0:r.parent),referencedBy:[...i.meta.referencedBy]},a={resolver:t,meta:s,tag:n};if(Ie(e))return eq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=rq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=tq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=nq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let p=iq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let f=oq({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let d=t.options.allReadonly?".readonly()":"";if(kP(e))return e.items?i.assign(`z.array(${Ge({...a,schema:e.items}).getCodeString(n,t.options)}${Kr({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let h=e.type?e.type.toLowerCase():void 0;if(h==="object"||e.properties||e.additionalProperties){let b=t.options.additionalPropertiesDefaultValue!==void 0?t.options.additionalPropertiesDefaultValue:!0,$=(e.additionalProperties===null||e.additionalProperties===void 0?b:e.additionalProperties)===!1?"":".passthrough()";if(typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0)return i.assign(`z.record(${Ge({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+Kr({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options})})`);let w=e.required&&e.required.length>0,T=t.options.withImplicitRequiredProps?!1:!((y=e.required)!=null&&y.length),I="{}";e.properties&&(I="{ "+Object.entries(e.properties).map(([we,Oe])=>{var M;let J={...s,isRequired:T?!0:w?(M=e.required)==null?void 0:M.includes(we):t.options.withImplicitRequiredProps,name:we},k=Oe;if(Ie(Oe)&&t&&(k=t.getSchemaByRef(Oe.$ref),!k))throw new Error(`Schema ${Oe.$ref} not found`);let j=Ge({...a,schema:Oe,meta:J}).getCodeString(n,t.options)+Kr({schema:k,meta:J,options:t.options});return[we,j]}).map(([we,Oe])=>`${CP(we)}: ${Oe}`).join(", ")+" }");let C=T?".partial()":"",ce=t.options.strictObjects?".strict()":"";return i.assign(`z.object(${I})${C}${ce}${$}${d}`)}if(!h)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${h}`)}o(Ge,"getZodSchema");function eq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!Ie(e))return;let s=t.meta.referencedBy.slice(0,-1).map(u=>u.ref?r.getZodSchemaNameByRef(u.ref)??u.ref:void 0).filter(Boolean),a=r.getZodSchemaNameByRef(e.$ref);if(s.length>1&&s.includes(a))return t.assign(r.getCodeByZodSchemaName(t.ref));let c=r.getCodeByZodSchemaName(e.$ref);if(!c){let u=r.getSchemaByRef(e.$ref);if(!u)throw new Error(`Schema ${e.$ref} not found`);c=Ge({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(eq,"getReferenceZodSchema");function tq({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!Gt(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=Ge({schema:e.oneOf[0],resolver:r,meta:n,tag:i});return t.assign(c.getCodeString(i,r.options))}let s=(a=e.oneOf)==null?void 0:a.some(c=>Gt(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
143
143
  z.discriminatedUnion("${c}", [${e.oneOf.map(u=>Ge({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
@@ -148,7 +148,7 @@ ${c.map(u=>`- ${u}`).join(`
148
148
  ${s.map(a=>`- ${a}`).join(`
149
149
  `)}
150
150
  `)}return n.validationErrors}o(g1,"checkOpenAPIDoc");function bq(e,t){return["models","endpoints","queries"].map(r=>fa({output:t.output,fileName:zn({tag:e,type:r,options:t})}))}o(bq,"getOutputFileNames");async function b1({input:e,excludeTags:t,verbose:r,...n}){let i=Date.now();r&&rr("Parsing OpenAPI spec...");let s=await y1.default.bundle(e);r&&vn("Parsing finished."),r&&rr("Running check...");let a=g1(s,{input:e,excludeTags:t.split(","),...n});if(r&&rr(`TIME: ${Date.now()-i}ms`),a.length===0)vn("Check finished.");else throw new Error(`Check finished. Found ${a.length} issues.`)}o(b1,"check");var Zn=class Zn{input;splitByTags;defaultTag;excludeTags;verbose};o(Zn,"CheckOptions"),at([ut({envAlias:"input",demandOption:!0})],Zn.prototype,"input",2),at([ut({envAlias:"splitByTags",default:!0,type:"boolean"})],Zn.prototype,"splitByTags",2),at([ut({envAlias:"defaultTag",default:"Common"})],Zn.prototype,"defaultTag",2),at([ut({envAlias:"excludeTags",default:""})],Zn.prototype,"excludeTags",2),at([ut({envAlias:"verbose",default:!1,type:"boolean"})],Zn.prototype,"verbose",2);var fm=Zn,v1={command:"check",describe:"Check OpenAPI spec",builder:tc(fm),handler:o(async e=>{let t=await e;return t.verbose&&(ec(`OpenAPI CodeGen ${io()}`),fs("input",t.input)),b1(t)},"handler")};var L2=gt(Dh()),F2=require("child_process");var _1="acl/app.ability",pa="AllAbilities",Ir={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subject:"subject"},pm={bindings:[Ir.abilityTuple,Ir.pureAbility,Ir.forcedSubject,Ir.subject],from:"@casl/ability"};var S1=o(e=>`Use${Ve(ht(e.operationName))}Ability`,"getAbilityTypeName"),O1=o(e=>`canUse${Ve(ht(e.operationName))}`,"getAbilityFunctionName"),P1=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),E1=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),$1=o(e=>{var t;return!!((t=dm(e))!=null&&t.length)},"hasAbilityConditions"),dm=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),w1=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),Su=o(e=>`${Ve(e)}${pa}`,"getTagAllAbilitiesName");var hm="src/data",mm="@/data",gm="AppRestClient",x1={bindings:[gm],from:"@/util/rest/clients/app-rest-client"},da={query:"AppQueryOptions",mutation:"AppMutationOptions"},A1={bindings:[da.query,da.mutation],from:"@/types/react-query"};function Wn({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=ym({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=ym({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>sa(u,e.options),"getEntityName"),options:e.options});return vq(e.options,a,c)}o(Wn,"getModelsImports");function I1({tag:e,endpoints:t,options:r}){return ym({type:"endpoints",tag:e,entities:t,getTag:o(n=>ca(n,r),"getTag"),getEntityName:aa,options:r})}o(I1,"getEndpointsImports");function C1({tags:e,entityName:t,getAliasEntityName:r,options:n}){let i=new Map;return e.forEach(s=>{let a=`${t}${r?` as ${r(s)}`:""}`;i.has(s)?n.includeNamespaces||i.get(s).bindings.push(a):i.set(s,{bindings:[n.includeNamespaces?Je({type:"acl",tag:s,options:n}):a],from:`${T1(n)}${zn({type:"acl",tag:s,includeTagDir:!0,options:n})}`})}),Array.from(i.values())}o(C1,"getAclImports");function T1(e){let t=mm;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${hm}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${hm}`,"g"),mm)),`${t}/`.replace(/\/\//g,"/")}o(T1,"getImportPath");function ym({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.includeNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.includeNamespaces?Je({type:e,tag:u,options:s}):i(c)],from:`${l?"./":T1(s)}${zn({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(ym,"getImports");function vq(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.includeNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:It(n.bindings)}))}o(vq,"mergeImports");var fg=gt(Qn());var fn=gt(Qn());function O2(){fL(),pL(),dL(),hL(),mL(),gL(),yL(),bL()}o(O2,"registerAclHbsHelpers");function fL(){fn.default.registerHelper("abilityTypeName",S1)}o(fL,"registerAbilityTypeNameHelper");function pL(){fn.default.registerHelper("abilityFunctionName",O1)}o(pL,"registerAbilityFunctionNameHelper");function dL(){fn.default.registerHelper("ablityAction",P1)}o(dL,"registerAbilityActionHelper");function hL(){fn.default.registerHelper("ablitySubject",E1)}o(hL,"registerAbilitySubjectHelper");function mL(){fn.default.registerHelper("hasAbilityConditions",$1)}o(mL,"registerHasAbilityConditionsHelper");function gL(){fn.default.registerHelper("abilityConditionsTypes",dm)}o(gL,"registerAbilityConditionsTypesHelper");function yL(){fn.default.registerHelper("abilityDescription",w1)}o(yL,"registerAbilityDescriptionHelper");function bL(){fn.default.registerHelper("tagAllAbilitiesName",Su)}o(bL,"registerTagAllAbilitiesNameHelper");var il=gt(Qn());function P2(){vL(),_L(),SL()}o(P2,"registerCommonHbsHelpers");function vL(){il.default.registerHelper("isEqual",(e,t)=>e===t)}o(vL,"registerIsEqualHelper");function _L(){il.default.registerHelper("commaSeparated",e=>e.join(", "))}o(_L,"registerCommaSeparatedListHelper");function SL(){il.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
151
- *`))}o(SL,"registerAddAsteriskAfterNewLineHelper");var Jn=gt(Qn());function E2(e){OL(),PL(e.options),wL(e),EL(),$L(),xL(e),AL()}o(E2,"registerEndpointsHbsHelpers");function OL(){Jn.default.registerHelper("endpointName",aa)}o(OL,"registerEndpointNameHelper");function PL(e){Jn.default.registerHelper("importedEndpointName",t=>FP(t,e))}o(PL,"registerImportedEndpointNameHelper");function EL(){Jn.default.registerHelper("endpointPath",BP)}o(EL,"registerEndpointPathHelper");function $L(){Jn.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o($L,"registerEndpointBodyHelper");function wL(e){Jn.default.registerHelper("endpointParams",t=>rm(e,t))}o(wL,"registerEndpointParamsHelper");function xL(e){Jn.default.registerHelper("endpointArgs",t=>rm(e,t).map(r=>r.name).join(", "))}o(xL,"registerEndpointArgsHelper");function AL(){Jn.default.registerHelper("endpointParamDescription",e=>{var s,a,c,u,l;let t=[`${e.paramType} parameter`],r=((s=e.parameterObject)==null?void 0:s.description)||((a=e.bodyObject)==null?void 0:a.description);r&&t.push(r);let n,i;if((c=e.parameterObject)!=null&&c.schema&&Gt(e.parameterObject.schema)&&(n=(u=e.parameterObject)==null?void 0:u.schema),(l=e.bodyObject)!=null&&l.content){let f=Object.keys(e.bodyObject.content??{}).find(Wr);f&&(i=e.bodyObject.content[f],i.schema&&Gt(i.schema)&&(n=i.schema))}return n&&["description","minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","example"].filter(f=>n[f]).forEach(f=>{t.push(`${Ve(wP(f))}: \`${n[f]}\``)}),i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(AL,"registerEndpointParamDescriptionHelper");var ei=gt(Qn());var Xn={query:"useQuery",mutation:"useMutation"},$2={bindings:[Xn.query,Xn.mutation],from:"@tanstack/react-query"};function w2(){IL(),CL(),TL(),jL(),RL(),NL(),kL()}o(w2,"registerPartialsHbsHelpers");function IL(){ei.default.registerHelper("genImport",e=>ti("import")({import:e}))}o(IL,"registerImportHelper");function CL(){ei.default.registerHelper("genEndpointParams",e=>ti("endpoint-params")({endpoint:e}))}o(CL,"registerGenerateEndpointParamsHelper");function TL(){ei.default.registerHelper("genEndpointConfig",e=>{let t=VP(e);return Object.keys(t).length===0?"":ti("endpoint-config")({endpointConfig:t})})}o(TL,"registerGenerateEndpointConfigHelper");function jL(){ei.default.registerHelper("genQueryKeys",e=>e.length===0?"":ti("query-keys")({endpoints:e}))}o(jL,"registerGenerateQueryKeysHelper");function RL(){ei.default.registerHelper("genQuery",e=>{let t,r;return Gn(e)?(t="query-use-query",r=Xn.query):(t="query-use-mutation",r=Xn.mutation),ti(t)({endpoint:e,queryHook:r})})}o(RL,"registerGenerateQueryHelper");function NL(){ei.default.registerHelper("genCaslAbilityType",e=>ti("casl-ability-type")({endpoint:e,abilityTupleType:Ir.abilityTuple}))}o(NL,"registerGenerateCaslAbilityTypeHelper");function kL(){ei.default.registerHelper("genCaslAbilityFunction",e=>ti("casl-ability-function")({endpoint:e}))}o(kL,"registerGenerateCaslAbilityFunctionHelper");var xa=gt(Qn());var x2=o(e=>`use${Ve(ht(e.operationName))}`,"getQueryName"),ug=o(e=>{let t=e.map(({path:s})=>s),r=/^\/[^\/]*/g,n=It(t.map(s=>s.match(r)).flat()),i=o(s=>n.length===1?"all":`all${Ve(fu(s.replace(/\//g,"")??""))}`,"getQueryKeyName");return n.filter(s=>s!==null).map(s=>({path:s,name:i(s??"")}))},"getAllQueryKeys"),A2=o((e,t)=>{let n=ug(t).find(({path:s})=>e.path.startsWith(s));if(!n)return[e.path];let i=e.path.substring(n.path.length);return[`...keys.${n.name}`,...i?[`"${i}"`]:[]]},"getEndpointPathQueryKeys");function I2(){ML(),qL(),DL(),LL()}o(I2,"registerQueryHbsHelpers");function ML(){xa.default.registerHelper("queryName",x2)}o(ML,"registerQueryNameHelper");function qL(){xa.default.registerHelper("allQueryKeys",ug)}o(qL,"registerQueryKeysHelper");function DL(){xa.default.registerHelper("endpointPathQueryKeys",A2)}o(DL,"registerEndpointPathQueryKeysHelper");function LL(){xa.default.registerHelper("isQuery",Gn)}o(LL,"registerIsQueryHelper");var lg=gt(Qn());function C2(e){FL(e.options),BL(e)}o(C2,"registerZodHbsHelpers");function FL(e){lg.default.registerHelper("zodInferedType",t=>sa(t,e))}o(FL,"registerInferedTypeHelper");function BL(e){lg.default.registerHelper("importedZodSchemaName",t=>DP(e,t))}o(BL,"registerImportedZodSchemaNameHelper");function pn(e,t){let r=lm(t);return P2(),C2(e),E2(e),I2(),O2(),w2(),fg.default.compile(r)}o(pn,"getHbsTemplateDelegate");function ti(e){let t=lm(`partials/${e}`);return fg.default.compile(t)}o(ti,"getHbsPartialTemplateDelegate");function T2({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.endpoints.filter(({acl:l})=>l&&l.length>0);if(!n||n.length===0)return;let i={...pm,bindings:[Ir.abilityTuple,...n.filter(({acl:l})=>l==null?void 0:l[0].conditions)?[Ir.forcedSubject,Ir.subject]:[]]},s=n.reduce((l,p)=>{var d,h;let f=(h=(d=p.acl)==null?void 0:d[0].conditionsTypes)==null?void 0:h.reduce((y,b)=>[...y,...b!=null&&b.zodSchemaName?[b.zodSchemaName]:[]],[]);return[...l,...f??[]]},[]),a=Wn({resolver:e,tag:r,zodSchemasAsTypes:It(s)});return pn(e,"acl")({caslAbilityTupleImport:i,modelsImports:a,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"acl",tag:r,options:e.options}),endpoints:n})}o(T2,"generateAcl");function j2(e,t){if(!t||t.length===0)return;let r={...pm,bindings:[Ir.pureAbility]},n=C1({tags:t,entityName:pa,getAliasEntityName:Su,options:e.options}),i=t.map(a=>Je({type:"acl",tag:a,options:e.options}));return pn(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:pa,includeNamespace:e.options.includeNamespaces,tags:t,namespaces:i})}o(j2,"generateAppAcl");function R2({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints;if(!n||n.length===0)return;let i=n.map(p=>p.response),s=i.some(p=>!Dt(p)),a=n.reduce((p,f)=>[...p,...f.parameters],[]),c=Wn({resolver:e,tag:r,zodSchemas:It(i.filter(Dt)),zodSchemasAsTypes:It(a.map(p=>p.zodSchema).filter(Dt))});return pn(e,"endpoints")({restClientImport:x1,hasZodImport:s,zodImport:au,modelsImports:c,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"endpoints",tag:r,options:e.options}),restClientName:gm,endpoints:n})}o(R2,"generateEndpoints");function N2(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(k2(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(N2,"getZodSchemaRefs");function k2(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&k2(n).forEach(s=>r.add(s)),r},new Set)}o(k2,"getSchemaRefs");function M2({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((l,p)=>[...l,...N2(e,p)],[]).filter(l=>!n[l]),s=Wn({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((l,[p,f])=>{let d=e.getRefByZodSchemaName(p);return{...l,[p]:{code:f,isCircular:!!d&&e.isSchemaCircular(d)}}},{});return pn(e,"models")({zodImport:au,modelsImports:s,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"models",tag:r,options:e.options}),zodSchemasData:a})}o(M2,"generateModels");function q2({resolver:e,data:t,tag:r=""}){var d;let n=(d=t.get(r))==null?void 0:d.endpoints;if(!n||n.length===0)return;let i=n.filter(Gn),s=n.filter(QP),a={...$2,bindings:[...i.length>0?[Xn.query]:[],...s.length>0?[Xn.mutation]:[]]},c={...A1,bindings:[...i.length>0?[da.query]:[],...s.length>0?[da.mutation]:[]]},u=[...i,...s].reduce((h,y)=>[...h,...y.parameters],[]),l=Wn({resolver:e,tag:r,zodSchemasAsTypes:It(u.map(h=>h.zodSchema).filter(Dt))}),p=I1({tag:r,endpoints:n,options:e.options});return pn(e,"queries")({queryImport:a,queryTypesImport:c,modelsImports:l,endpointsImports:p,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"queries",tag:r,options:e.options}),endpoints:n,queryEndpoints:i})}o(q2,"generateQueries");function D2(e,t){let r={...cu,...t},{resolver:n,data:i}=_u(e,r),s=[],a=[],c=["models","endpoints","queries","acl"],u={models:M2,endpoints:R2,queries:q2,acl:T2};i.forEach((p,f)=>{r.excludeTags.find(h=>h.toLowerCase()===f.toLowerCase())||c.forEach(h=>{let y=u[h]({resolver:n,data:i,tag:f});if(y){let b=fa({output:r.output,fileName:zn({tag:f,type:h,options:r})});s.push({fileName:b,content:y}),h==="acl"&&a.push(f)}})});let l=j2(n,a);if(l){let p=fa({output:r.output,fileName:_1});s.push({fileName:p,content:l})}return s}o(D2,"generateCodeFromOpenAPIDoc");async function B2({input:e,excludeTags:t,prettier:r,verbose:n,...i}){let s=Date.now();n&&rr("Parsing OpenAPI spec...");let a=await L2.default.bundle(e);n&&vn("Parsing finished."),n&&rr("Generating code...");let c=D2(a,{input:e,excludeTags:t.split(","),...i});n&&vn("Generation finished."),n&&rr("Writing files..."),m1(c),n&&vn("Writing finished."),r&&VL({output:i.output,verbose:n}),n&&rr(`TIME: ${Date.now()-s}ms`)}o(B2,"generate");function VL({output:e,verbose:t}){t&&rr("Running Prettier..."),(0,F2.exec)(`prettier --write ${e}`,r=>{t&&(r?ps(r,"Prettier error"):vn("Prettier finished."))})}o(VL,"execPrettier");var Lt=class Lt{input;output;includeNamespaces;splitByTags;defaultTag;excludeTags;importPath;extractEnums;removeOperationPrefixEndingWith;prettier;verbose};o(Lt,"GenerateOptions"),at([ut({envAlias:"input",demandOption:!0})],Lt.prototype,"input",2),at([ut({envAlias:"output",default:"output"})],Lt.prototype,"output",2),at([ut({envAlias:"includeNamespaces",default:!0,type:"boolean"})],Lt.prototype,"includeNamespaces",2),at([ut({envAlias:"splitByTags",default:!0,type:"boolean"})],Lt.prototype,"splitByTags",2),at([ut({envAlias:"defaultTag",default:"Common"})],Lt.prototype,"defaultTag",2),at([ut({envAlias:"excludeTags",default:""})],Lt.prototype,"excludeTags",2),at([ut({envAlias:"importPath",default:"ts",type:"string"})],Lt.prototype,"importPath",2),at([ut({envAlias:"extractEnums",default:!0,type:"boolean"})],Lt.prototype,"extractEnums",2),at([ut({envAlias:"removeOperationPrefixEndingWith",default:"Controller_"})],Lt.prototype,"removeOperationPrefixEndingWith",2),at([ut({envAlias:"prettier",default:!0,type:"boolean"})],Lt.prototype,"prettier",2),at([ut({envAlias:"verbose",default:!1,type:"boolean"})],Lt.prototype,"verbose",2);var pg=Lt,V2={command:"generate",describe:"Generate code from OpenAPI spec",builder:tc(pg),handler:o(async e=>{let t=await e;return t.verbose&&(ec(`OpenAPI CodeGen ${io()}`),fs("input",t.input),fs("output",t.output)),B2(t)},"handler")};by(yl(process.argv)).version(io()||"unknown").scriptName("openapi-codegen").command(V2).command(v1).help().demandCommand(1).strictCommands(!0).showHelpOnFail(!0).fail((e,t)=>{e&&ps(e),t&&ps(t),rr("Use '--help' for more info"),process.exit(1)}).parse();
151
+ *`))}o(SL,"registerAddAsteriskAfterNewLineHelper");var Jn=gt(Qn());function E2(e){OL(),PL(e.options),wL(e),EL(),$L(),xL(e),AL()}o(E2,"registerEndpointsHbsHelpers");function OL(){Jn.default.registerHelper("endpointName",aa)}o(OL,"registerEndpointNameHelper");function PL(e){Jn.default.registerHelper("importedEndpointName",t=>FP(t,e))}o(PL,"registerImportedEndpointNameHelper");function EL(){Jn.default.registerHelper("endpointPath",BP)}o(EL,"registerEndpointPathHelper");function $L(){Jn.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o($L,"registerEndpointBodyHelper");function wL(e){Jn.default.registerHelper("endpointParams",t=>rm(e,t))}o(wL,"registerEndpointParamsHelper");function xL(e){Jn.default.registerHelper("endpointArgs",t=>rm(e,t).map(r=>r.name).join(", "))}o(xL,"registerEndpointArgsHelper");function AL(){Jn.default.registerHelper("endpointParamDescription",e=>{var s,a,c,u,l;let t=[`${e.paramType} parameter`],r=((s=e.parameterObject)==null?void 0:s.description)||((a=e.bodyObject)==null?void 0:a.description);r&&t.push(r);let n,i;if((c=e.parameterObject)!=null&&c.schema&&Gt(e.parameterObject.schema)&&(n=(u=e.parameterObject)==null?void 0:u.schema),(l=e.bodyObject)!=null&&l.content){let f=Object.keys(e.bodyObject.content??{}).find(Wr);f&&(i=e.bodyObject.content[f],i.schema&&Gt(i.schema)&&(n=i.schema))}return n&&["description","minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","example"].filter(f=>n[f]).forEach(f=>{t.push(`${Ve(wP(f))}: \`${n[f]}\``)}),i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(AL,"registerEndpointParamDescriptionHelper");var ei=gt(Qn());var Xn={query:"useQuery",mutation:"useMutation"},$2={bindings:[Xn.query,Xn.mutation],from:"@tanstack/react-query"};function w2(){IL(),CL(),TL(),jL(),RL(),NL(),kL()}o(w2,"registerPartialsHbsHelpers");function IL(){ei.default.registerHelper("genImport",e=>ti("import")({import:e}))}o(IL,"registerImportHelper");function CL(){ei.default.registerHelper("genEndpointParams",e=>ti("endpoint-params")({endpoint:e}))}o(CL,"registerGenerateEndpointParamsHelper");function TL(){ei.default.registerHelper("genEndpointConfig",e=>{let t=VP(e);return Object.keys(t).length===0?"":ti("endpoint-config")({endpointConfig:t})})}o(TL,"registerGenerateEndpointConfigHelper");function jL(){ei.default.registerHelper("genQueryKeys",e=>e.length===0?"":ti("query-keys")({endpoints:e}))}o(jL,"registerGenerateQueryKeysHelper");function RL(){ei.default.registerHelper("genQuery",e=>{let t,r;return Gn(e)?(t="query-use-query",r=Xn.query):(t="query-use-mutation",r=Xn.mutation),ti(t)({endpoint:e,queryHook:r})})}o(RL,"registerGenerateQueryHelper");function NL(){ei.default.registerHelper("genCaslAbilityType",e=>ti("casl-ability-type")({endpoint:e,abilityTupleType:Ir.abilityTuple}))}o(NL,"registerGenerateCaslAbilityTypeHelper");function kL(){ei.default.registerHelper("genCaslAbilityFunction",e=>ti("casl-ability-function")({endpoint:e}))}o(kL,"registerGenerateCaslAbilityFunctionHelper");var xa=gt(Qn());var x2=o(e=>`use${Ve(ht(e.operationName))}`,"getQueryName"),ug=o(e=>{let t=e.map(({path:s})=>s),r=/^\/[^\/]*/g,n=It(t.map(s=>s.match(r)).flat()),i=o(s=>n.length===1?"all":`all${Ve(fu(s.replace(/\//g,"")??""))}`,"getQueryKeyName");return n.filter(s=>s!==null).map(s=>({path:s,name:i(s??"")}))},"getAllQueryKeys"),A2=o((e,t)=>{let n=ug(t).find(({path:s})=>e.path.startsWith(s));if(!n)return[e.path];let i=e.path.substring(n.path.length);return[`...keys.${n.name}`,...i?[`"${i}"`]:[]]},"getEndpointPathQueryKeys");function I2(){ML(),qL(),DL(),LL()}o(I2,"registerQueryHbsHelpers");function ML(){xa.default.registerHelper("queryName",x2)}o(ML,"registerQueryNameHelper");function qL(){xa.default.registerHelper("allQueryKeys",ug)}o(qL,"registerQueryKeysHelper");function DL(){xa.default.registerHelper("endpointPathQueryKeys",A2)}o(DL,"registerEndpointPathQueryKeysHelper");function LL(){xa.default.registerHelper("isQuery",Gn)}o(LL,"registerIsQueryHelper");var lg=gt(Qn());function C2(e){FL(e.options),BL(e)}o(C2,"registerZodHbsHelpers");function FL(e){lg.default.registerHelper("zodInferedType",t=>sa(t,e))}o(FL,"registerInferedTypeHelper");function BL(e){lg.default.registerHelper("importedZodSchemaName",t=>DP(e,t))}o(BL,"registerImportedZodSchemaNameHelper");function pn(e,t){let r=lm(t);return P2(),C2(e),E2(e),I2(),O2(),w2(),fg.default.compile(r)}o(pn,"getHbsTemplateDelegate");function ti(e){let t=lm(`partials/${e}`);return fg.default.compile(t)}o(ti,"getHbsPartialTemplateDelegate");function T2({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.endpoints.filter(({acl:l})=>l&&l.length>0);if(!n||n.length===0)return;let i={...pm,bindings:[Ir.abilityTuple,...n.filter(({acl:l})=>l==null?void 0:l[0].conditions).length>0?[Ir.forcedSubject,Ir.subject]:[]]},s=n.reduce((l,p)=>{var d,h;let f=(h=(d=p.acl)==null?void 0:d[0].conditionsTypes)==null?void 0:h.reduce((y,b)=>[...y,...b!=null&&b.zodSchemaName?[b.zodSchemaName]:[]],[]);return[...l,...f??[]]},[]),a=Wn({resolver:e,tag:r,zodSchemasAsTypes:It(s)});return pn(e,"acl")({caslAbilityTupleImport:i,modelsImports:a,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"acl",tag:r,options:e.options}),endpoints:n})}o(T2,"generateAcl");function j2(e,t){if(!t||t.length===0)return;let r={...pm,bindings:[Ir.pureAbility]},n=C1({tags:t,entityName:pa,getAliasEntityName:Su,options:e.options}),i=t.map(a=>Je({type:"acl",tag:a,options:e.options}));return pn(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:pa,includeNamespace:e.options.includeNamespaces,tags:t,namespaces:i})}o(j2,"generateAppAcl");function R2({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints;if(!n||n.length===0)return;let i=n.map(p=>p.response),s=i.some(p=>!Dt(p)),a=n.reduce((p,f)=>[...p,...f.parameters],[]),c=Wn({resolver:e,tag:r,zodSchemas:It(i.filter(Dt)),zodSchemasAsTypes:It(a.map(p=>p.zodSchema).filter(Dt))});return pn(e,"endpoints")({restClientImport:x1,hasZodImport:s,zodImport:au,modelsImports:c,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"endpoints",tag:r,options:e.options}),restClientName:gm,endpoints:n})}o(R2,"generateEndpoints");function N2(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(k2(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(N2,"getZodSchemaRefs");function k2(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&k2(n).forEach(s=>r.add(s)),r},new Set)}o(k2,"getSchemaRefs");function M2({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((l,p)=>[...l,...N2(e,p)],[]).filter(l=>!n[l]),s=Wn({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((l,[p,f])=>{let d=e.getRefByZodSchemaName(p);return{...l,[p]:{code:f,isCircular:!!d&&e.isSchemaCircular(d)}}},{});return pn(e,"models")({zodImport:au,modelsImports:s,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"models",tag:r,options:e.options}),zodSchemasData:a})}o(M2,"generateModels");function q2({resolver:e,data:t,tag:r=""}){var d;let n=(d=t.get(r))==null?void 0:d.endpoints;if(!n||n.length===0)return;let i=n.filter(Gn),s=n.filter(QP),a={...$2,bindings:[...i.length>0?[Xn.query]:[],...s.length>0?[Xn.mutation]:[]]},c={...A1,bindings:[...i.length>0?[da.query]:[],...s.length>0?[da.mutation]:[]]},u=[...i,...s].reduce((h,y)=>[...h,...y.parameters],[]),l=Wn({resolver:e,tag:r,zodSchemasAsTypes:It(u.map(h=>h.zodSchema).filter(Dt))}),p=I1({tag:r,endpoints:n,options:e.options});return pn(e,"queries")({queryImport:a,queryTypesImport:c,modelsImports:l,endpointsImports:p,includeNamespace:e.options.includeNamespaces,namespace:Je({type:"queries",tag:r,options:e.options}),endpoints:n,queryEndpoints:i})}o(q2,"generateQueries");function D2(e,t){let r={...cu,...t},{resolver:n,data:i}=_u(e,r),s=[],a=[],c=["models","endpoints","queries","acl"],u={models:M2,endpoints:R2,queries:q2,acl:T2};i.forEach((p,f)=>{r.excludeTags.find(h=>h.toLowerCase()===f.toLowerCase())||c.forEach(h=>{let y=u[h]({resolver:n,data:i,tag:f});if(y){let b=fa({output:r.output,fileName:zn({tag:f,type:h,options:r})});s.push({fileName:b,content:y}),h==="acl"&&a.push(f)}})});let l=j2(n,a);if(l){let p=fa({output:r.output,fileName:_1});s.push({fileName:p,content:l})}return s}o(D2,"generateCodeFromOpenAPIDoc");async function B2({input:e,excludeTags:t,prettier:r,verbose:n,...i}){let s=Date.now();n&&rr("Parsing OpenAPI spec...");let a=await L2.default.bundle(e);n&&vn("Parsing finished."),n&&rr("Generating code...");let c=D2(a,{input:e,excludeTags:t.split(","),...i});n&&vn("Generation finished."),n&&rr("Writing files..."),m1(c),n&&vn("Writing finished."),r&&VL({output:i.output,verbose:n}),n&&rr(`TIME: ${Date.now()-s}ms`)}o(B2,"generate");function VL({output:e,verbose:t}){t&&rr("Running Prettier..."),(0,F2.exec)(`prettier --write ${e}`,r=>{t&&(r?ps(r,"Prettier error"):vn("Prettier finished."))})}o(VL,"execPrettier");var Lt=class Lt{input;output;includeNamespaces;splitByTags;defaultTag;excludeTags;importPath;extractEnums;removeOperationPrefixEndingWith;prettier;verbose};o(Lt,"GenerateOptions"),at([ut({envAlias:"input",demandOption:!0})],Lt.prototype,"input",2),at([ut({envAlias:"output",default:"output"})],Lt.prototype,"output",2),at([ut({envAlias:"includeNamespaces",default:!0,type:"boolean"})],Lt.prototype,"includeNamespaces",2),at([ut({envAlias:"splitByTags",default:!0,type:"boolean"})],Lt.prototype,"splitByTags",2),at([ut({envAlias:"defaultTag",default:"Common"})],Lt.prototype,"defaultTag",2),at([ut({envAlias:"excludeTags",default:""})],Lt.prototype,"excludeTags",2),at([ut({envAlias:"importPath",default:"ts",type:"string"})],Lt.prototype,"importPath",2),at([ut({envAlias:"extractEnums",default:!0,type:"boolean"})],Lt.prototype,"extractEnums",2),at([ut({envAlias:"removeOperationPrefixEndingWith",default:"Controller_"})],Lt.prototype,"removeOperationPrefixEndingWith",2),at([ut({envAlias:"prettier",default:!0,type:"boolean"})],Lt.prototype,"prettier",2),at([ut({envAlias:"verbose",default:!1,type:"boolean"})],Lt.prototype,"verbose",2);var pg=Lt,V2={command:"generate",describe:"Generate code from OpenAPI spec",builder:tc(pg),handler:o(async e=>{let t=await e;return t.verbose&&(ec(`OpenAPI CodeGen ${io()}`),fs("input",t.input),fs("output",t.output)),B2(t)},"handler")};by(yl(process.argv)).version(io()||"unknown").scriptName("openapi-codegen").command(V2).command(v1).help().demandCommand(1).strictCommands(!0).showHelpOnFail(!0).fail((e,t)=>{e&&ps(e),t&&ps(t),rr("Use '--help' for more info"),process.exit(1)}).parse();
152
152
  /*! Bundled license information:
153
153
 
154
154
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"